Interpreter: Factor function hooking code out of SingleStepInner()
This commit is contained in:
parent
4b25538f2f
commit
f3c13402e8
|
@ -99,32 +99,17 @@ static void Trace(UGeckoInstruction& inst)
|
|||
PowerPC::ppcState.spr[8], regs.c_str(), inst.hex, ppc_inst.c_str());
|
||||
}
|
||||
|
||||
int Interpreter::SingleStepInner()
|
||||
{
|
||||
u32 function = HLE::GetFirstFunctionIndex(PC);
|
||||
if (function != 0)
|
||||
{
|
||||
HLE::HookType type = HLE::GetFunctionTypeByIndex(function);
|
||||
if (type == HLE::HookType::Start || type == HLE::HookType::Replace)
|
||||
{
|
||||
HLE::HookFlag flags = HLE::GetFunctionFlagsByIndex(function);
|
||||
if (HLE::IsEnabled(flags))
|
||||
bool Interpreter::HandleFunctionHooking(u32 address)
|
||||
{
|
||||
return HLE::ReplaceFunctionIfPossible(address, [](u32 function, HLE::HookType type) {
|
||||
HLEFunction(function);
|
||||
if (type == HLE::HookType::Start)
|
||||
{
|
||||
// Run the original.
|
||||
function = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
function = 0;
|
||||
}
|
||||
}
|
||||
return type != HLE::HookType::Start;
|
||||
});
|
||||
}
|
||||
|
||||
if (function == 0)
|
||||
int Interpreter::SingleStepInner()
|
||||
{
|
||||
if (!HandleFunctionHooking(PC))
|
||||
{
|
||||
#ifdef USE_GDBSTUB
|
||||
if (gdb_active() && gdb_bp_x(PC))
|
||||
|
|
|
@ -284,6 +284,8 @@ public:
|
|||
private:
|
||||
static void InitializeInstructionTables();
|
||||
|
||||
static bool HandleFunctionHooking(u32 address);
|
||||
|
||||
// flag helper
|
||||
static void Helper_UpdateCR0(u32 value);
|
||||
static void Helper_UpdateCR1();
|
||||
|
|
Loading…
Reference in New Issue