mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Debugger: Debounce updates to disasm text.
This is a bit slow, so deferring it improves update speed.
This commit is contained in:
1 parent
045fc0f2b4
commit
7fe9c4e519
3 files changed
+56
-37
No files matched your search
@@ -87,6 +87,9 @@ LRESULT CALLBACK FuncListProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
|
||||
return (LRESULT)CallWindowProc((WNDPROC)DefFuncListProc,hDlg,message,wParam,lParam);
|
||||
}
|
||||
|
||||
static constexpr UINT_PTR IDT_UPDATE = 0xC0DE0042;
|
||||
static constexpr UINT UPDATE_DELAY = 1000 / 60;
|
||||
|
||||
CDisasm::CDisasm(HINSTANCE _hInstance, HWND _hParent, DebugInterface *_cpu) : Dialog((LPCSTR)IDD_DISASM, _hInstance, _hParent) {
|
||||
cpu = _cpu;
|
||||
lastTicks = PSP_IsInited() ? CoreTiming::GetTicks() : 0;
|
||||
@@ -236,10 +239,8 @@ void CDisasm::stepInto()
|
||||
if (vfpudlg)
|
||||
vfpudlg->Update();
|
||||
|
||||
CtrlMemView::getFrom(GetDlgItem(m_hDlg,IDC_DEBUGMEMVIEW))->redraw();
|
||||
threadList->reloadThreads();
|
||||
stackTraceView->loadStackTrace();
|
||||
updateThreadLabel(false);
|
||||
}
|
||||
|
||||
void CDisasm::stepOver()
|
||||
@@ -678,6 +679,14 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
g_activeWindow = WINDOW_CPUDEBUGGER;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_TIMER:
|
||||
if (wParam == IDT_UPDATE) {
|
||||
ProcessUpdateDialog();
|
||||
updateDialogScheduled_ = false;
|
||||
KillTimer(GetDlgHandle(), wParam);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
@@ -786,9 +795,7 @@ void CDisasm::SetDebugMode(bool _bDebug, bool switchPC)
|
||||
threadList->reloadThreads();
|
||||
stackTraceView->loadStackTrace();
|
||||
moduleList->loadModules();
|
||||
updateThreadLabel(false);
|
||||
|
||||
SetDlgItemText(m_hDlg, IDC_STOPGO, L"Go");
|
||||
EnableWindow(GetDlgItem(hDlg, IDC_STOPGO), TRUE);
|
||||
EnableWindow(GetDlgItem(hDlg, IDC_STEP), TRUE);
|
||||
EnableWindow(GetDlgItem(hDlg, IDC_STEPOVER), TRUE);
|
||||
@@ -802,27 +809,13 @@ void CDisasm::SetDebugMode(bool _bDebug, bool switchPC)
|
||||
ptr->gotoPC();
|
||||
|
||||
ptr->scanFunctions();
|
||||
CtrlMemView *mem = CtrlMemView::getFrom(GetDlgItem(m_hDlg,IDC_DEBUGMEMVIEW));
|
||||
mem->redraw();
|
||||
|
||||
// update the callstack
|
||||
//CDisam::blah blah
|
||||
UpdateDialog();
|
||||
}
|
||||
else
|
||||
{
|
||||
updateThreadLabel(true);
|
||||
|
||||
if (ingame)
|
||||
{
|
||||
SetDlgItemText(m_hDlg, IDC_STOPGO, L"Break");
|
||||
EnableWindow(GetDlgItem(hDlg, IDC_STOPGO), TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetDlgItemText(m_hDlg, IDC_STOPGO, L"Go");
|
||||
EnableWindow(GetDlgItem(hDlg, IDC_STOPGO), FALSE);
|
||||
}
|
||||
EnableWindow(GetDlgItem(hDlg, IDC_STEP), FALSE);
|
||||
EnableWindow(GetDlgItem(hDlg, IDC_STEPOVER), FALSE);
|
||||
EnableWindow(GetDlgItem(hDlg, IDC_STEPHLE), FALSE);
|
||||
@@ -832,6 +825,8 @@ void CDisasm::SetDebugMode(bool _bDebug, bool switchPC)
|
||||
CtrlRegisterList *reglist = CtrlRegisterList::getFrom(GetDlgItem(m_hDlg,IDC_REGLIST));
|
||||
reglist->redraw();
|
||||
}
|
||||
|
||||
UpdateDialog();
|
||||
}
|
||||
|
||||
void CDisasm::Show(bool bShow, bool includeToTop) {
|
||||
@@ -863,8 +858,29 @@ void CDisasm::Goto(u32 addr)
|
||||
ptr->redraw();
|
||||
}
|
||||
|
||||
void CDisasm::UpdateDialog(bool _bComplete)
|
||||
{
|
||||
void CDisasm::UpdateDialog() {
|
||||
if (!updateDialogScheduled_) {
|
||||
SetTimer(GetDlgHandle(), IDT_UPDATE, UPDATE_DELAY, nullptr);
|
||||
updateDialogScheduled_ = true;
|
||||
}
|
||||
|
||||
// Since these update on a delay, it's okay to do them immediately.
|
||||
CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg, IDC_DISASMVIEW));
|
||||
ptr->redraw();
|
||||
CtrlRegisterList *rl = CtrlRegisterList::getFrom(GetDlgItem(m_hDlg, IDC_REGLIST));
|
||||
rl->redraw();
|
||||
|
||||
// Repaint windows at the bottom. only the memory view needs to be forced to redraw.
|
||||
// All others are updated manually
|
||||
CtrlMemView *memview = CtrlMemView::getFrom(GetDlgItem(m_hDlg, IDC_DEBUGMEMVIEW));
|
||||
memview->redraw();
|
||||
|
||||
// Update memory window too.
|
||||
if (memoryWindow)
|
||||
memoryWindow->Update();
|
||||
}
|
||||
|
||||
void CDisasm::ProcessUpdateDialog() {
|
||||
/*
|
||||
HWND gotoInt = GetDlgItem(m_hDlg, IDC_GOTOINT);
|
||||
ComboBox_ResetContent(gotoInt);
|
||||
@@ -878,23 +894,20 @@ void CDisasm::UpdateDialog(bool _bComplete)
|
||||
ComboBox_SetItemData(gotoInt,0,0xFFFFFFFF);
|
||||
ComboBox_SetCurSel(gotoInt,0);
|
||||
*/
|
||||
CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW));
|
||||
ptr->redraw();
|
||||
CtrlRegisterList *rl = CtrlRegisterList::getFrom(GetDlgItem(m_hDlg,IDC_REGLIST));
|
||||
rl->redraw();
|
||||
|
||||
// Update Debug Counter
|
||||
wchar_t tempTicks[24];
|
||||
if (PSP_IsInited()) {
|
||||
wchar_t tempTicks[24];
|
||||
_snwprintf(tempTicks, 24, L"%lld", CoreTiming::GetTicks() - lastTicks);
|
||||
SetDlgItemText(m_hDlg, IDC_DEBUG_COUNT, tempTicks);
|
||||
}
|
||||
|
||||
// Update memory window
|
||||
if (memoryWindow)
|
||||
memoryWindow->Update();
|
||||
bool ingame = (GetUIState() == UISTATE_INGAME || GetUIState() == UISTATE_EXCEPTION) && PSP_IsInited();
|
||||
if (Core_IsStepping() || !ingame) {
|
||||
SetDlgItemText(m_hDlg, IDC_STOPGO, L"Go");
|
||||
} else {
|
||||
SetDlgItemText(m_hDlg, IDC_STOPGO, L"Break");
|
||||
}
|
||||
|
||||
// repaint windows at the bottom. only the memory view needs to be forced to
|
||||
// redraw. all others are updated manually
|
||||
CtrlMemView *memview = CtrlMemView::getFrom(GetDlgItem(m_hDlg, IDC_DEBUGMEMVIEW));
|
||||
memview->redraw();
|
||||
updateThreadLabel(!ingame || !Core_IsStepping());
|
||||
}
|
||||
Reference in new issue
Block a user