mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Interpreter: Factor function hooking code out of SingleStepInner()
This commit is contained in:
@ -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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Interpreter::HandleFunctionHooking(u32 address)
|
||||||
|
{
|
||||||
|
return HLE::ReplaceFunctionIfPossible(address, [](u32 function, HLE::HookType type) {
|
||||||
|
HLEFunction(function);
|
||||||
|
return type != HLE::HookType::Start;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
int Interpreter::SingleStepInner()
|
int Interpreter::SingleStepInner()
|
||||||
{
|
{
|
||||||
u32 function = HLE::GetFirstFunctionIndex(PC);
|
if (!HandleFunctionHooking(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))
|
|
||||||
{
|
|
||||||
HLEFunction(function);
|
|
||||||
if (type == HLE::HookType::Start)
|
|
||||||
{
|
|
||||||
// Run the original.
|
|
||||||
function = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
function = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (function == 0)
|
|
||||||
{
|
{
|
||||||
#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();
|
||||||
|
Reference in New Issue
Block a user