From e1df43703cca8eeffa6fffcf30309afd9703c789 Mon Sep 17 00:00:00 2001 From: ty Date: Sun, 21 Feb 2021 16:07:54 -0500 Subject: [PATCH] IOP: Execute breakpoints for the interpreter --- pcsx2/R3000AInterpreter.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/pcsx2/R3000AInterpreter.cpp b/pcsx2/R3000AInterpreter.cpp index 223a6c865a..e6c08422ed 100644 --- a/pcsx2/R3000AInterpreter.cpp +++ b/pcsx2/R3000AInterpreter.cpp @@ -17,6 +17,7 @@ #include "PrecompiledHeader.h" #include "IopCommon.h" #include "App.h" // For host irx injection hack +#include "../DebugTools/Breakpoints.h" using namespace R3000A; @@ -123,11 +124,34 @@ void psxJALR() doBranch(_u32(_rRs_)); } +void psxBreakpoint() +{ + u32 pc = psxRegs.pc; + if (CBreakPoints::CheckSkipFirst(BREAKPOINT_IOP, pc) != 0) + return; + + auto cond = CBreakPoints::GetBreakPointCondition(BREAKPOINT_IOP, pc); + if (cond && !cond->Evaluate()) + return; + + CBreakPoints::SetBreakpointTriggered(true); + GetCoreThread().PauseSelfDebug(); + throw Exception::ExitCpuExecute(); +} + /////////////////////////////////////////// // These macros are used to assemble the repassembler functions static __fi void execI() { + // Called for every instruction. + // Enabling the define below will probably, no, will cause the interpretor to be slower. +//#define EXTRA_DEBUG +#ifdef EXTRA_DEBUG + if (psxIsBreakpointNeeded(psxRegs.pc)) + psxBreakpoint(); +#endif + // Inject IRX hack if (psxRegs.pc == 0x1630 && g_Conf->CurrentIRX.Length() > 3) { if (iopMemRead32(0x20018) == 0x1F) {