diff --git a/Common/System/System.h b/Common/System/System.h index fdd7a81874..3658451816 100644 --- a/Common/System/System.h +++ b/Common/System/System.h @@ -217,6 +217,7 @@ enum class SystemNotification { UI, MEM_VIEW, DISASSEMBLY, + DISASSEMBLY_AFTERSTEP, DEBUG_MODE_CHANGE, BOOT_DONE, // this is sent from EMU thread! Make sure that Host handles it properly! SYMBOL_MAP_UPDATED, diff --git a/Core/Core.cpp b/Core/Core.cpp index dbb66d51ae..124d2d8a29 100644 --- a/Core/Core.cpp +++ b/Core/Core.cpp @@ -364,7 +364,7 @@ void Core_ProcessStepping() { } // Update disasm dialog. - System_Notify(SystemNotification::DISASSEMBLY); + System_Notify(SystemNotification::DISASSEMBLY_AFTERSTEP); System_Notify(SystemNotification::MEM_VIEW); } } diff --git a/Windows/Debugger/Debugger_Disasm.cpp b/Windows/Debugger/Debugger_Disasm.cpp index 9efa656620..124fc7a862 100644 --- a/Windows/Debugger/Debugger_Disasm.cpp +++ b/Windows/Debugger/Debugger_Disasm.cpp @@ -209,15 +209,6 @@ void CDisasm::step(CPUStepType stepType) { u32 stepSize = ptr->getInstructionSizeAt(cpu->GetPC()); Core_PerformStep(cpu, stepType, stepSize); - - Sleep(1); - - // TODO: This should be called from ProcessStep - NotifyStepDone(); -} - -void CDisasm::NotifyStepDone() { - PostMessage(m_hDlg, WM_DEB_AFTERSTEP, 0, 0); } void CDisasm::runToLine() { @@ -479,23 +470,6 @@ 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(); @@ -532,6 +506,23 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) Update(); return TRUE; + 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); + Update(); + break; + } + case WM_DEB_TABPRESSED: bottomTabs->NextTab(true); SetFocus(bottomTabs->CurrentTabHandle()); diff --git a/Windows/Debugger/Debugger_Disasm.h b/Windows/Debugger/Debugger_Disasm.h index 6d456db8b4..c6e0212276 100644 --- a/Windows/Debugger/Debugger_Disasm.h +++ b/Windows/Debugger/Debugger_Disasm.h @@ -59,7 +59,6 @@ public: void Goto(u32 addr); void NotifyMapLoaded(); - void NotifyStepDone(); private: CtrlDisAsmView *DisAsmView(); diff --git a/Windows/main.cpp b/Windows/main.cpp index 01f6b1dfb3..03f90d34c9 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -436,6 +436,11 @@ void System_Notify(SystemNotification notification) { PostDialogMessage(disasmWindow, WM_DEB_UPDATE); break; + case SystemNotification::DISASSEMBLY_AFTERSTEP: + if (disasmWindow) + PostDialogMessage(disasmWindow, WM_DEB_AFTERSTEP); + break; + case SystemNotification::SYMBOL_MAP_UPDATED: if (g_symbolMap) g_symbolMap->SortSymbols(); // internal locking is performed here