exlaunch
exlaunch copied to clipboard
Add support for inline hooks
Resolves #1 Resolves #3
Introduces inline hooks to the exlaunch environment.
Modified:
-
exl::util::Hook
- Added two new static members for inline hook environment manage (
s_InlineHookJit
,s_UsedInlineHooks
) - Added three new static methods:
-
void InlineHook(uinptr_t hook, uintptr_t callback, bool is_extended)
-
hook
- The address where the hook should be injected -
callback
- The address of the callback function (must take eitherExInlineCtx*
orInlineCtx*
) -
is_extended
- Needs to betrue
if the callback takesExInlineCtx*
-
-
void InlineHook(uintptr_t hook, ExInlineCallback callback)
, a wrapper for the less user-friendlyInlineHook
-
void InlineHook(uintptr_t hook, InlineCallback callback)
, a wrapper for the less user-friendlyInlineHook
-
- Modified the (so far) unused
InlineCtx
structure to reflect thex29
andx30
registers which are also stored there - Added a new
ExInlineCtx
structure which includes a field for the stack pointer as well as an array of 32FpuRegister
, and all elements inInlineCtx
- Added a new
FpuRegister
union which holds representations of A64's SIMD registers - Modified
Hook::Initialize
to also initialize the new inline hook environment members - Changed
InlineHookHandlerSize
from 0x9C -> 0xC to reflect the actual size of the handler - Removed what was going to be the
InlineHandler
imports and replaced them by three newextern "C"
imports
- Added two new static members for inline hook environment manage (
-
exl::hook
- Added four new static functions to help create inline hooks from either function pointers or
main
offsets
- Added four new static functions to help create inline hooks from either function pointers or
-
__virtmem_rng
- Added a static counter that is multiplied against the tick to ensure consecutive calls of
__virtmem_rng
can succeed Example output of dumping the extended context from a callback. This callback was run at the beginning of Smash Ultimate'sCameraManager::update
function and the game continued normal execution afterwards
- Added a static counter that is multiplied against the tick to ensure consecutive calls of
X0: 3e6f2b20a0
X1: 0
X2: 0
X3: 0
X4: 0
X5: 0
X6: 0
X7: 0
X8: c1200000
X9: 0
X10: 3eacf87650
X11: 0
X12: 0
X13: 0
X14: 0
X15: 0
X16: 6c5c3d47c8
X17: 442d9800c
X18: d
X19: 42aa0000
X20: c1200000
X21: 3e6f2b1400
X22: 6c5906e148
X23: 3eab4d6378
X24: 6c5b449000
X25: 3eaee1df68
X26: 6c5b449000
X27: 3e45c39720
X28: 3e45c39730
X29: 3e46dbad50
X30: 6c554e9d94
SP: 3e46db8580
V0 { 1080, 0, 0, 0 }
V1 { 1920, 0, 0, 0 }
V2 { 1080, 0, 0, 0 }
V3 { 0, 0, 0, 0 }
V4 { 0, 0, 0, 0 }
V5 { 0, 0, 0, 0 }
V6 { 0, 0, 0, 0 }
V7 { 0, 0, 0, 0 }
V8 { 1920, 0, 0, 0 }
V9 { 1080, 0, 0, 0 }
V10 { 0, 0, 0, 0 }
V11 { 0, 0, 0, 0 }
V12 { 0, 0, 0, 0 }
V13 { 0, 0, 0, 0 }
V14 { 0, 0, 0, 0 }
V15 { 0, 0, 0, 0 }
V16 { 0, 0, 0, 0 }
V17 { 0, 0, 0, 0 }
V18 { 0, 0, 0, 0 }
V19 { 0, 0, 0, 0 }
V20 { 0, 0, 0, 0 }
V21 { 0, 0, 0, 0 }
V22 { 0, 0, 0, 0 }
V23 { 0, 0, 0, 0 }
V24 { 0, 0, 0, 0 }
V25 { 0, 0, 0, 0 }
V26 { 0, 0, 0, 0 }
V27 { 0, 0, 0, 0 }
V28 { 0, 0, 0, 0 }
V29 { 0, 0, 0, 0 }
V30 { 0, 0, 0, 0 }
V31 { 0, 0, 0, 0 }
Looking forward to seeing this merged!