Add disasm event WM_DEB_AFTEREVENT

This commit is contained in:
Henrik Rydgård 2024-11-03 17:22:53 +01:00
parent c851be26eb
commit 3ba3b911b4
3 changed files with 27 additions and 14 deletions

View File

@ -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);

View File

@ -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();

View File

@ -59,6 +59,7 @@ public:
void Goto(u32 addr);
void NotifyMapLoaded();
void NotifyStepDone();
private:
CtrlDisAsmView *DisAsmView();