diff --git a/Windows/Debugger/DebuggerShared.h b/Windows/Debugger/DebuggerShared.h index 6490a52837..05daf87a6c 100644 --- a/Windows/Debugger/DebuggerShared.h +++ b/Windows/Debugger/DebuggerShared.h @@ -9,7 +9,8 @@ enum { WM_DEB_GOTOWPARAM = WM_USER+2, WM_DEB_SETDEBUGLPARAM, WM_DEB_UPDATE, WM_DEB_SETSTATUSBARTEXT, - WM_DEB_GOTOHEXEDIT + WM_DEB_GOTOHEXEDIT, + WM_DEB_AFTERSTEP, }; bool executeExpressionWindow(HWND hwnd, DebugInterface* cpu, u32& dest); diff --git a/Windows/Debugger/Debugger_Disasm.cpp b/Windows/Debugger/Debugger_Disasm.cpp index 878f62ca7a..9efa656620 100644 --- a/Windows/Debugger/Debugger_Disasm.cpp +++ b/Windows/Debugger/Debugger_Disasm.cpp @@ -198,8 +198,7 @@ CDisasm::~CDisasm() delete moduleList; } -void CDisasm::step(CPUStepType stepType) -{ +void CDisasm::step(CPUStepType stepType) { if (!PSP_IsInited() || !Core_IsStepping()) { return; } @@ -213,17 +212,12 @@ void CDisasm::step(CPUStepType stepType) Sleep(1); - // At this point, the step should be done, and the new address is just PC. - // Ideally, this part should be done as a reaction to an update message and not directly here. - // That way we could get rid of the sleep. - u32 oldAddress = ptr->getSelection(); - u32 newAddress = cpu->GetPC(); - if (newAddress > oldAddress && newAddress < oldAddress + 12) { - // Heuristic for when to scroll at the edge rather than jump the window. - ptr->scrollStepping(newAddress); - } - ptr->gotoAddr(newAddress); - UpdateDialog(); + // TODO: This should be called from ProcessStep + NotifyStepDone(); +} + +void CDisasm::NotifyStepDone() { + PostMessage(m_hDlg, WM_DEB_AFTERSTEP, 0, 0); } void CDisasm::runToLine() { @@ -485,6 +479,23 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) NotifyMapLoaded(); break; + case WM_DEB_AFTERSTEP: + { + CtrlDisAsmView *ptr = DisAsmView(); + // At this point, the step should be done, and the new address is just PC. + // Ideally, this part should be done as a reaction to an update message and not directly here. + // That way we could get rid of the sleep. + u32 oldAddress = ptr->getSelection(); + u32 newAddress = cpu->GetPC(); + if (newAddress > oldAddress && newAddress < oldAddress + 12) { + // Heuristic for when to scroll at the edge rather than jump the window. + ptr->scrollStepping(newAddress); + } + ptr->gotoAddr(newAddress); + UpdateDialog(); + break; + } + case WM_DEB_GOTOWPARAM: { CtrlDisAsmView *ptr = DisAsmView(); diff --git a/Windows/Debugger/Debugger_Disasm.h b/Windows/Debugger/Debugger_Disasm.h index c6e0212276..6d456db8b4 100644 --- a/Windows/Debugger/Debugger_Disasm.h +++ b/Windows/Debugger/Debugger_Disasm.h @@ -59,6 +59,7 @@ public: void Goto(u32 addr); void NotifyMapLoaded(); + void NotifyStepDone(); private: CtrlDisAsmView *DisAsmView();