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());
|
PowerPC::ppcState.spr[8], regs.c_str(), inst.hex, ppc_inst.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
int Interpreter::SingleStepInner()
|
bool Interpreter::HandleFunctionHooking(u32 address)
|
||||||
{
|
|
||||||
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))
|
|
||||||
{
|
{
|
||||||
|
return HLE::ReplaceFunctionIfPossible(address, [](u32 function, HLE::HookType type) {
|
||||||
HLEFunction(function);
|
HLEFunction(function);
|
||||||
if (type == HLE::HookType::Start)
|
return type != HLE::HookType::Start;
|
||||||
{
|
});
|
||||||
// Run the original.
|
|
||||||
function = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
function = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (function == 0)
|
int Interpreter::SingleStepInner()
|
||||||
|
{
|
||||||
|
if (!HandleFunctionHooking(PC))
|
||||||
{
|
{
|
||||||
#ifdef USE_GDBSTUB
|
#ifdef USE_GDBSTUB
|
||||||
if (gdb_active() && gdb_bp_x(PC))
|
if (gdb_active() && gdb_bp_x(PC))
|
||||||
|
|
|
@ -284,6 +284,8 @@ public:
|
||||||
private:
|
private:
|
||||||
static void InitializeInstructionTables();
|
static void InitializeInstructionTables();
|
||||||
|
|
||||||
|
static bool HandleFunctionHooking(u32 address);
|
||||||
|
|
||||||
// flag helper
|
// flag helper
|
||||||
static void Helper_UpdateCR0(u32 value);
|
static void Helper_UpdateCR0(u32 value);
|
||||||
static void Helper_UpdateCR1();
|
static void Helper_UpdateCR1();
|
||||||
|
|
Loading…
Reference in New Issue