Repository navigation
feat(relinker): add --module-dir for modules loaded at run time - #846
Conversation
|
On the overlap report with #684: the two changes are independent. Both add a field after |
|
Independent verification (relinker-only, builds anywhere). Built the relinker from
One thing to make explicit before merge: this branch carries No real Unity title was tested here (no dump). |
|
Thanks. #684 has landed, so as you expected this branch now conflicts with main in While you're there, please add |
|
Merged |
|
@boykopovar a design question before this goes further (cc @oneandonlydean). The code itself checks out on Linux: we rebased it onto current
|
|
Thanks for running it on Linux.
|
8e0079e to
871fcf2
Compare
|
Rebased onto current |
|
A data point for the auto-discovery question, now that #2708 looks for guest modules only in Hollow Knight: Silksong (PPSA12544) keeps two of the modules its eboot lists as DT_NEEDED in
So for Unity titles, the flag or auto-discovery has to cover start-up modules outside 🤖 Generated with Claude Code |
|
Data point for the auto-discovery question: Unity (PPSA07117) on Windows 11.
Investigated with AI assistance (Claude Code). |
|
@oneandonlydean @boykopovar, before I switch this to auto-discovery, one conflict to settle. #2708 landed after the request above and removed recursive module search on purpose ("I want the behavior to be consistent every time"). Auto-discovery would bring back a walk of the whole input tree for Which do you want? If it's auto-discovery, I'll switch: walk the module parent directory, skip What changed in this push (merge of
Tested: Windows 11. Non-GPU |
|
On the overlap report with #2119: the two changes are independent. #2119 adds |
|
Data point for run-time loaded modules: Hotline Miami (PPSA09682, Unity), relinked from the decrypted dump with What I could read from the relinked module: the function at +0x1891 is reached from the module entry at +0x10010 (it runs the init array). It checks its second argument as a parameter block, Not established: whether the title is meant to pass a block here and something earlier in our emulation leaves it out, or whether that call sequence is something the relinker or loader should not trigger for a module loaded at run time. A gdb breakpoint on AI-assisted (Claude Code). |
|
A second Unity title stops the same way: PPSA02801 faults at AI-assisted (Claude Code). |
|
A third Unity title with run-time plugins: God of War Sons of Sparta (PPSA28997). Its
So the relative dependency paths would need to be computed from the directory the module is loaded from ( |
|
Windows result for Command: Before: the title's runtime-loaded plugin in No game files shared. AI-assisted (Claude). |
Relinks the ELF modules of extra directories under the module parent directory. Modules the executable or another module needs start with the executable; the others are initialized when the title loads them with sceKernelLoadStartModule, with its start arguments (Windows: __aps5_guest_initialize export; Linux: left out of DT_NEEDED). Squashed onto main by the reviewer (history had a merge commit).
558c53e to
1c6eac4
Compare
|
Rebased onto current Checked: relinker + libkernel build and 183 scoped tests pass ( |
|
Thanks @adriadam10. Your rebase has the same tree as the one I had prepared on |
|
Windows re-test of the Unity titles on current
So the PSNCore fault that #846 comments reported for these titles is not reproduced on current AI-assisted (Claude Code). |
|
Follow-up on the Hotline Miami stop (PPSA09682,
Cult of the Lamb, DREDGE and Harmony's Odyssey each ran 180 s with the same two module directories: no fault, no abort, no error line, shader cache hits and texture creation continuing; I did not look at the window. AI-assisted (Claude Code). |
What
Adds
--module-dir <dir>to the relinker, for modules a title keeps outsidesce_module/sce_modules/prx. Since #2708 the relinker looks for guest modules only in those directories.Unity titles keep two kinds of modules elsewhere:
Media/Modules: modules the executable needs at startup (Il2cppUserAssemblies.prx,PS5Util.prx).Media/Plugins: native plugins, loaded at run time withsceKernelLoadStartModule. In PPSA12544, an unrelinked plugin shows up asDllNotFoundException: Unable to load DLL 'PSN'for/app0/Media/Plugins/PSN.prx.How the option works:
--module-dir <dir>(repeatable) relinks the ELF modules of a directory under the module parent directory (--sce-module-path, by default the input's directory). Outputs keep the relative path, and feat(libkernel): load the relinked module for a guest module path #717 then finds them as<path>.guest.prx. The directory must exist inside the parent directory and differ from the other module directories. The option conflicts with--skip-sce-module.DT_INITentry and init array as__aps5_guest_initialize, anddlopencalls it once, with the start argumentssceKernelLoadStartModulerecords for the LinuxDT_INITstub (36c979b), so*resgets the entry's result. On Linux these modules are left out ofDT_NEEDED, and that stub passes the arguments. The plugins check them: PPSA12544's PSN plugin is loaded withsceKernelLoadStartModule(path, 16, {16, 0x200, ...})and refuses to start without them (PSN is an old version that cannot be used by the current player runtime).USAGE.mddocuments the option. TechnicalDebt covers modules that another module needs being initialized at startup, and macOS not passing start arguments.Design question open for the maintainers: an explicit option vs. auto-discovery (see the comments).
Tested
Windows 11, PPSA12544, relinked with
--windows --module-dir Media/Modules --module-dir Media/Pluginsonmain4a747c4 plus feat(agc): depth planes sampled as 2D arrays, cubes and integer views #425. All 12 guest modules are converted. TheMedia/Modulesmodules start at launch and the plugins on load. The title boots without theDllNotFoundException, the SaveData plugin mounts its save data, and the title menu renders at about 60 fps (bring-up: Hollow Knight: Silksong (PPSA12544) #726).test_guest_module_dir.pycovers:DT_NEEDEDon Linux;It fails on
main(unknown option), and the needed-module case fails without the startup rule.Non-GPU
ctestpasses (460), and the conventions check passes.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code