Skip to content

Commit

Permalink
Hopefully backup proper registers
Browse files Browse the repository at this point in the history
  • Loading branch information
Sirius902 committed Aug 10, 2021
1 parent 70d1aac commit eaf8495
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
30 changes: 14 additions & 16 deletions LuaBackendDLL/main_dll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,23 +286,21 @@ void hookGame(uint64_t moduleAddress) {
uint8_t func[] = {
PUSHF_1, PUSHF_2,
PushRax,
PushRdi,
PushRbp,
PushRbx,
PushR12_1, PushR12_2,
PushR13_1, PushR13_2,
PushR14_1, PushR14_2,
PushR15_1, PushR15_2,
0x48, 0x83, 0xEC, 0x0E, // sub rsp, 0x0E
PushRcx,
PushRdx,
PushR8_1, PushR8_2,
PushR9_1, PushR9_2,
PushR10_1, PushR10_2,
PushR11_1, PushR11_2,
0x48, 0x83, 0xEC, 0x06, // sub rsp, 0x06
CALL((uintptr_t)&onFrame),
0x48, 0x83, 0xC4, 0x0E, // sub rsp, 0x0E
PopR15_1, PopR15_2,
PopR14_1, PopR14_2,
PopR13_1, PopR13_2,
PopR12_1, PopR12_2,
PopRbx,
PopRbp,
PopRdi,
0x48, 0x83, 0xC4, 0x06, // add rsp, 0x06
PopR11_1, PopR11_2,
PopR10_1, PopR10_2,
PopR9_1, PopR9_2,
PopR8_1, PopR8_2,
PopRdx,
PopRcx,
PopRax,
POPF_1, POPF_2,
JUMP_TO(hookEnd),
Expand Down
8 changes: 8 additions & 0 deletions LuaBackendDLL/x86_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ constexpr uint8_t PushR9_1 = 0x41;
constexpr uint8_t PushR9_2 = 0x51;
constexpr uint8_t PopR9_1 = 0x41;
constexpr uint8_t PopR9_2 = 0x59;
constexpr uint8_t PushR10_1 = 0x41;
constexpr uint8_t PushR10_2 = 0x52;
constexpr uint8_t PopR10_1 = 0x41;
constexpr uint8_t PopR10_2 = 0x5A;
constexpr uint8_t PushR11_1 = 0x41;
constexpr uint8_t PushR11_2 = 0x53;
constexpr uint8_t PopR11_1 = 0x41;
constexpr uint8_t PopR11_2 = 0x5B;
constexpr uint8_t PushR12_1 = 0x41;
constexpr uint8_t PushR12_2 = 0x54;
constexpr uint8_t PopR12_1 = 0x41;
Expand Down

0 comments on commit eaf8495

Please sign in to comment.