mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-24 13:45:57 +00:00
Mod plugins that hook the middle of game functions, swap pointers in the game's data, use the SD card or switch their hooks during play build in, and may call what the game itself calls; Zonai Fieldworks starts (#1388)
Zonai Fieldworks was refused at several steps; each is now handled: 1. The start-up asked GetInfo 6, 7, 16 and 17 and SetHeapSize; runtime/plugin_init.c serves them. 2. Its start-up calls main where the lift has no function start. The tool names those addresses (--entries-out) and the installer lifts again with them as `entry` lines, up to four rounds (installer/steps.py PLUGIN_ENTRY_ROUNDS). 3. Branch hooks into the middle of game functions (far-jump veneers) and pointer swaps in main's data are accepted hook kinds; the veneer targets seed the plugin's lift, and an Orig trampoline counts as a seed. 4. Code the start-up writes into the plugin's own .text (hook pads it switches to during play) is found by comparing the image before and after the init, and seeds the lift (init_code). Without it the game stopped with "no function at guest pc" when a feature switched on. 5. recomp/gen.py: a branch-out alternative on a flag-writing site leaves with the flags from before the site; an inline hook may sit on a blr. 6. nn::fs::MountSdCard mounts <profile>/sdcard (runtime/fs_host.c), and nn::settings language codes are answered (runtime/ov_system.c). The import check now also allows what the game's main imports (--exefs, game_imports): the game runs on those paths, so the runtime serves them. Left out: nn::ro, the C runtime start, the thread-local allocator hook and the shader compiler. Break in code the hooks reach is allowed (an abort ends the game with the reason, as on the Switch), and RenameFile, DeleteDirectoryRecursively, Commit and Unmount join the SD card calls. Checked: Zonai Fieldworks, The Second Quest, Challenge Mode and Material Columns on 1.4.3, Full Inventory Expansion, Quick Weapon Durability and Magic of the Kingdom on 1.2.1 accepted; UltraCam's init still crashes its service run. Plain lift unchanged; probes 4/4 on both versions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
942b6b7b2b
commit
3fe8d7a1d9
9 files changed
+552
-136
No files matched your search
+14
-6
@@ -123,14 +123,22 @@ The Mods tab order decides between a plugin and another mod's patch on the same
|
||||
plugin site over one of the port's own patches turns that built-in patch off while the mod is on.
|
||||
|
||||
The rebuild refuses a plugin when its start-up or the code its redirects reach needs what the port does not give it:
|
||||
system calls other than the few its start-up needs (memory queries and maps, the clock, debug output), library calls
|
||||
outside a reviewed list (memory and string functions, the heap, text formatting), threads, services or input; a
|
||||
redirect that is not one of exlaunch's hook shapes (inline hook, replace hook, call-site rewrite); or two runs of its
|
||||
start-up that differ in code; or a start-up that crashes the service run or does not return within two minutes. The
|
||||
row then says **Its plugin ... cannot run in the port** with the reason, and the mod stays off; **Use <mod> without its
|
||||
code** uses the rest of it, including its other plugins that were built in. UltraCam stays refused: it hooks the graphics API,
|
||||
system calls other than the few its start-up needs (memory queries and maps, the heap size, the clock, debug output),
|
||||
or a library call the game itself never makes and a reviewed list does not hold (memory and string functions, the heap,
|
||||
text formatting, mutexes, the clock, the system language, the SD card's files), such as network sockets or the module
|
||||
loader. A library call the game makes (threads, input, time, its files) runs on the path the game runs on. A start-up
|
||||
still gets only the system calls above, so it cannot start a thread or open a service; a redirect that is not one of exlaunch's hook shapes
|
||||
(inline hook, replace hook, call-site rewrite, a branch into its code from inside a game function, a pointer in the
|
||||
game's data swapped for one into its code); a write into the game's read-only data or into another module; two runs of
|
||||
its start-up that differ in code; or a start-up that crashes the service run or does not return within two minutes.
|
||||
The row then says **Its plugin ... cannot run in the port** with the reason, and the mod stays off; **Use <mod> without
|
||||
its code** uses the rest of it, including its other plugins that were built in. UltraCam stays refused: it hooks the graphics API,
|
||||
reads input and opens sockets.
|
||||
|
||||
When a start-up calls into the middle of a game function, the rebuild lifts the game again with that address as a
|
||||
function start and reruns the start-up, up to four times. A plugin that reads or writes files on the SD card gets
|
||||
the folder `sdcard` in the game's profile folder in its place.
|
||||
|
||||
`plugin_trace = 1` in `totk.ini` logs the first call into each of a plugin's hooks (`plugins: hook entry ... reached`).
|
||||
|
||||
## Cheats
|
||||
|
||||
Reference in new issue
Block a user