mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-24 13:45:57 +00:00
The plugin check accepts exlaunch's exl_inline_hook_with_fp_impl, the inline-hook entry that saves d0..d15 next to x0..x29. Magic of the Kingdom's hook stub calls it and was refused for it (#1388)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7f17cad783
commit
c603112fca
2 files changed
+11
-2
No files matched your search
@@ -182,6 +182,12 @@ class Check(unittest.TestCase):
|
||||
self.assertEqual(hooks[0]['callback'], f'plugin0+{CB_OFF:#x}')
|
||||
self.assertEqual(hooks[0]['trampoline'], f'plugin0+{TRAMP_OFF:#x}')
|
||||
|
||||
def test_good_with_fp_impl(self): # Magic of the Kingdom: the impl that saves d0..d15 as well
|
||||
self.assertIn('exl_inline_hook_with_fp_impl', xp.HOOK_IMPLS)
|
||||
hooks, reasons = xp.check_record(record(), {PLUGIN + IMPL_OFF: 'exl_inline_hook_with_fp_impl'})
|
||||
self.assertEqual(reasons, [])
|
||||
self.assertEqual(hooks[0]['impl'], 'exl_inline_hook_with_fp_impl')
|
||||
|
||||
def test_good_plain_original(self):
|
||||
self.assertEqual(self.reasons(record(original=0xAA0003F3)), []) # mov x19, x0, copied as it is
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ The check (check_record) accepts a record only when every rule holds; each broke
|
||||
- the init called only the svcs ALLOWED_SVCS, GetInfo with ALLOWED_INFO, and the imports ALLOWED_IMPORTS;
|
||||
- every write into a game module is a word of main's .text whose original is no br, blr or ret, and it is one of:
|
||||
- an inline hook (MSFix, Full Inventory Expansion): `b <stub>` into a plugin's .text, the stub in exlaunch's
|
||||
shape (stur x30, [sp, #-0x10]; bl exl_inline_hook_impl or the float one; ldur x30, [sp, #-0x10];
|
||||
shape (stur x30, [sp, #-0x10]; bl one of exlaunch's hook impls, HOOK_IMPLS; ldur x30, [sp, #-0x10];
|
||||
b <trampoline>; .quad <callback in the plugin's .text>), the trampoline the site's original relocated (the
|
||||
same word, the same PC-relative target, or exlaunch's long form of it, relocation_end) and its jump back to
|
||||
the site + 4 (returns_to);
|
||||
@@ -86,7 +86,10 @@ ALLOWED_IMPORTS = SAFE_LIBC | {SNPRINTF, '_ZN2nn2oe17GetDisplayVersionEPNS0_14Di
|
||||
# talks to a service or changes memory mappings.
|
||||
REACH_IMPORTS = SAFE_LIBC | {SNPRINTF}
|
||||
SVC_OUTPUT_DEBUG_STRING = 0x27
|
||||
HOOK_IMPLS = ('exl_inline_hook_impl', 'exl_inline_float_hook_impl')
|
||||
# exlaunch's inline-hook entry points. Each saves the registers its context holds, calls the callback with that context
|
||||
# and restores them; none saves NZCV (recomp/flags.py). exl_inline_hook_with_fp_impl (Magic of the Kingdom) saves
|
||||
# d0..d15 next to x0..x29.
|
||||
HOOK_IMPLS = ('exl_inline_hook_impl', 'exl_inline_float_hook_impl', 'exl_inline_hook_with_fp_impl')
|
||||
STUR_X30 = 0xF81F03FE # stur x30, [sp, #-0x10]
|
||||
LDUR_X30 = 0xF85F03FE # ldur x30, [sp, #-0x10]
|
||||
STUB_WORDS = 6 # 4 instructions and the callback's .quad
|
||||
|
||||
Reference in new issue
Block a user