mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-03-03 07:13:50 +00:00
Jit64: Factor function hooking out of DoJit()
This commit is contained in:
parent
f3c13402e8
commit
3400165171
@ -806,26 +806,8 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitBloc
|
|||||||
SetJumpTarget(noExtIntEnable);
|
SetJumpTarget(noExtIntEnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 function = HLE::GetFirstFunctionIndex(op.address);
|
if (HandleFunctionHooking(op.address))
|
||||||
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::Replace)
|
|
||||||
{
|
|
||||||
MOV(32, R(RSCRATCH), PPCSTATE(npc));
|
|
||||||
js.downcountAmount += js.st.numCycles;
|
|
||||||
WriteExitDestInRSCRATCH();
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!op.skip)
|
if (!op.skip)
|
||||||
{
|
{
|
||||||
@ -1042,3 +1024,18 @@ void Jit64::IntializeSpeculativeConstants()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Jit64::HandleFunctionHooking(u32 address)
|
||||||
|
{
|
||||||
|
return HLE::ReplaceFunctionIfPossible(address, [&](u32 function, HLE::HookType type) {
|
||||||
|
HLEFunction(function);
|
||||||
|
|
||||||
|
if (type != HLE::HookType::Replace)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
MOV(32, R(RSCRATCH), PPCSTATE(npc));
|
||||||
|
js.downcountAmount += js.st.numCycles;
|
||||||
|
WriteExitDestInRSCRATCH();
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -234,6 +234,8 @@ private:
|
|||||||
static void InitializeInstructionTables();
|
static void InitializeInstructionTables();
|
||||||
void CompileInstruction(PPCAnalyst::CodeOp& op);
|
void CompileInstruction(PPCAnalyst::CodeOp& op);
|
||||||
|
|
||||||
|
bool HandleFunctionHooking(u32 address);
|
||||||
|
|
||||||
void AllocStack();
|
void AllocStack();
|
||||||
void FreeStack();
|
void FreeStack();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user