mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Debugger: Debounce redraws using timers.
This commit is contained in:
parent
293b5c0cf9
commit
de1a6a93d8
7 changed files with 67 additions and 14 deletions
|
@ -31,6 +31,9 @@
|
|||
|
||||
TCHAR CtrlDisAsmView::szClassName[] = _T("CtrlDisAsmView");
|
||||
|
||||
static constexpr UINT_PTR IDT_REDRAW = 0xC0DE0001;
|
||||
static constexpr UINT REDRAW_DELAY = 1000 / 60;
|
||||
|
||||
void CtrlDisAsmView::init()
|
||||
{
|
||||
WNDCLASSEX wc;
|
||||
|
@ -138,6 +141,16 @@ LRESULT CALLBACK CtrlDisAsmView::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA
|
|||
}
|
||||
}
|
||||
return DLGC_WANTCHARS|DLGC_WANTARROWS;
|
||||
|
||||
case WM_TIMER:
|
||||
if (wParam == IDT_REDRAW) {
|
||||
InvalidateRect(hwnd, nullptr, FALSE);
|
||||
UpdateWindow(hwnd);
|
||||
ccp->redrawScheduled_ = false;
|
||||
KillTimer(hwnd, wParam);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -835,8 +848,10 @@ void CtrlDisAsmView::redraw()
|
|||
GetClientRect(wnd, &rect);
|
||||
visibleRows = rect.bottom/rowHeight;
|
||||
|
||||
InvalidateRect(wnd, NULL, FALSE);
|
||||
UpdateWindow(wnd);
|
||||
if (!redrawScheduled_) {
|
||||
SetTimer(wnd, IDT_REDRAW, REDRAW_DELAY, nullptr);
|
||||
redrawScheduled_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CtrlDisAsmView::toggleBreakpoint(bool toggleEnabled)
|
||||
|
@ -1071,7 +1086,6 @@ void CtrlDisAsmView::onMouseMove(WPARAM wParam, LPARAM lParam, int button)
|
|||
{
|
||||
int y = HIWORD(lParam);
|
||||
setCurAddress(yToAddress(y), KeyDownAsync(VK_SHIFT));
|
||||
// TODO: Perhaps don't do this every time, but on a timer?
|
||||
redraw();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -173,4 +173,7 @@ public:
|
|||
selectRangeEnd = extend ? std::max(selectRangeEnd, after) : after;
|
||||
updateStatusBarText();
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
bool redrawScheduled_ = false;
|
||||
};
|
||||
|
|
|
@ -20,6 +20,12 @@
|
|||
|
||||
wchar_t CtrlMemView::szClassName[] = L"CtrlMemView";
|
||||
|
||||
static constexpr UINT_PTR IDT_REDRAW_DELAYED = 0xC0DE0001;
|
||||
static constexpr UINT REDRAW_DELAY = 1000 / 60;
|
||||
// We also redraw regularly, since data changes during runtime.
|
||||
static constexpr UINT_PTR IDT_REDRAW_AUTO = 0xC0DE0002;
|
||||
static constexpr UINT REDRAW_INTERVAL = 1000;
|
||||
|
||||
CtrlMemView::CtrlMemView(HWND _wnd)
|
||||
{
|
||||
wnd=_wnd;
|
||||
|
@ -56,7 +62,7 @@ CtrlMemView::CtrlMemView(HWND _wnd)
|
|||
asciiStart = hexStart + (rowSize*3+1)*charWidth;
|
||||
|
||||
// set redraw timer
|
||||
SetTimer(wnd,1,1000,0);
|
||||
SetTimer(wnd, IDT_REDRAW_AUTO, REDRAW_INTERVAL, nullptr);
|
||||
}
|
||||
|
||||
CtrlMemView::~CtrlMemView()
|
||||
|
@ -157,8 +163,16 @@ LRESULT CALLBACK CtrlMemView::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
|
|||
return DLGC_WANTARROWS|DLGC_WANTCHARS|DLGC_WANTTAB;
|
||||
break;
|
||||
case WM_TIMER:
|
||||
if (wParam == 1 && IsWindowVisible(ccp->wnd))
|
||||
// This is actually delayed too, using another timer. That way we won't update twice.
|
||||
if (wParam == IDT_REDRAW_AUTO && IsWindowVisible(ccp->wnd))
|
||||
ccp->redraw();
|
||||
|
||||
if (wParam == IDT_REDRAW_DELAYED) {
|
||||
InvalidateRect(hwnd, nullptr, FALSE);
|
||||
UpdateWindow(hwnd);
|
||||
ccp->redrawScheduled_ = false;
|
||||
KillTimer(hwnd, wParam);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -459,8 +473,10 @@ void CtrlMemView::redraw()
|
|||
visibleRows -= offsetSpace; // visibleRows is calculated based on the size of the control, but X rows have already been used for the offsets and are no longer usable
|
||||
}
|
||||
|
||||
InvalidateRect(wnd, NULL, FALSE);
|
||||
UpdateWindow(wnd);
|
||||
if (!redrawScheduled_) {
|
||||
SetTimer(wnd, IDT_REDRAW_DELAYED, REDRAW_DELAY, nullptr);
|
||||
redrawScheduled_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CtrlMemView::onMouseDown(WPARAM wParam, LPARAM lParam, int button)
|
||||
|
|
|
@ -106,4 +106,7 @@ public:
|
|||
void toggleOffsetScale(CommonToggles toggle);
|
||||
void toggleStringSearch(CommonToggles toggle);
|
||||
void setHighlightType(MemBlockFlags flags);
|
||||
|
||||
private:
|
||||
bool redrawScheduled_ = false;
|
||||
};
|
||||
|
|
|
@ -24,6 +24,9 @@ enum { REGISTER_PC = 32, REGISTER_HI, REGISTER_LO, REGISTERS_END };
|
|||
|
||||
TCHAR CtrlRegisterList::szClassName[] = _T("CtrlRegisterList");
|
||||
|
||||
static constexpr UINT_PTR IDT_REDRAW = 0xC0DE0001;
|
||||
static constexpr UINT REDRAW_DELAY = 1000 / 60;
|
||||
|
||||
void CtrlRegisterList::init()
|
||||
{
|
||||
WNDCLASSEX wc;
|
||||
|
@ -103,6 +106,16 @@ LRESULT CALLBACK CtrlRegisterList::wndProc(HWND hwnd, UINT msg, WPARAM wParam, L
|
|||
break;
|
||||
case WM_GETDLGCODE: // want chars so that we can return 0 on key press and supress the beeping sound
|
||||
return DLGC_WANTARROWS|DLGC_WANTCHARS;
|
||||
|
||||
case WM_TIMER:
|
||||
if (wParam == IDT_REDRAW) {
|
||||
InvalidateRect(hwnd, nullptr, FALSE);
|
||||
UpdateWindow(hwnd);
|
||||
ccp->redrawScheduled_ = false;
|
||||
KillTimer(hwnd, wParam);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -342,10 +355,11 @@ void CtrlRegisterList::onKeyDown(WPARAM wParam, LPARAM lParam)
|
|||
}
|
||||
|
||||
|
||||
void CtrlRegisterList::redraw()
|
||||
{
|
||||
InvalidateRect(wnd, NULL, FALSE);
|
||||
UpdateWindow(wnd);
|
||||
void CtrlRegisterList::redraw() {
|
||||
if (!redrawScheduled_) {
|
||||
SetTimer(wnd, IDT_REDRAW, REDRAW_DELAY, nullptr);
|
||||
redrawScheduled_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
u32 CtrlRegisterList::getSelectedRegValue(char *out, size_t size)
|
||||
|
|
|
@ -76,4 +76,7 @@ public:
|
|||
{
|
||||
return cpu;
|
||||
}
|
||||
|
||||
private:
|
||||
bool redrawScheduled_ = false;
|
||||
};
|
||||
|
|
|
@ -909,6 +909,6 @@ void CDisasm::UpdateDialog(bool _bComplete)
|
|||
|
||||
// repaint windows at the bottom. only the memory view needs to be forced to
|
||||
// redraw. all others are updated manually
|
||||
InvalidateRect (GetDlgItem(m_hDlg, IDC_DEBUGMEMVIEW), NULL, TRUE);
|
||||
UpdateWindow (GetDlgItem(m_hDlg, IDC_DEBUGMEMVIEW));
|
||||
CtrlMemView *memview = CtrlMemView::getFrom(GetDlgItem(m_hDlg, IDC_DEBUGMEMVIEW));
|
||||
memview->redraw();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue