mirror of
https://github.com/alliedmodders/sourcemod.git
synced 2025-12-06 18:08:36 +00:00
Fix dhooks regression (#2249)
Co-authored-by: Kenzzer <kenzzer@users.noreply.github.com>
This commit is contained in:
parent
b5e077c6f7
commit
f6737a4760
@ -317,9 +317,13 @@ void CHook::CreateBridge()
|
||||
PrintRegisters(jit);
|
||||
|
||||
// Jump to the trampoline
|
||||
jit.sub(rsp, 8);
|
||||
jit.push(rax);
|
||||
jit.mov(rax, reinterpret_cast<std::uint64_t>(&m_pTrampoline));
|
||||
jit.mov(rax, rax());
|
||||
jit.jump(rax);
|
||||
jit.mov(rsp(8), rax);
|
||||
jit.pop(rax);
|
||||
jit.retn();
|
||||
|
||||
// This code will be executed if a pre-hook returns ReturnAction_Supercede
|
||||
jit.rewrite<std::int32_t>(jumpOff - sizeof(std::int32_t), jit.get_outputpos() - jumpOff);
|
||||
@ -621,8 +625,12 @@ void CHook::CreateBridge()
|
||||
masm.j(equal, &label_supercede);
|
||||
|
||||
// Jump to the trampoline
|
||||
masm.subl(esp, 4);
|
||||
masm.push(eax);
|
||||
masm.movl(eax, Operand(ExternalAddress(&m_pTrampoline)));
|
||||
masm.jmp(eax);
|
||||
masm.movl(Operand(esp, 4), eax);
|
||||
masm.pop(eax);
|
||||
masm.ret();
|
||||
|
||||
// This code will be executed if a pre-hook returns ReturnAction_Supercede
|
||||
masm.bind(&label_supercede);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user