fix(libc): prefer nested prx/*.guest.prx for RelinkedModulePath #6544

Closed
notaxeltv wants to merge 1 commit from upstream-pr/6544 into main
notaxeltv commented 2026-10-15 19:43:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by notaxeltv on 2026-10-15T19:43:00Z.


What

RelinkedModulePath only rewrote path → path.guest.prx in the same directory. Titles that keep unbound Engine.*.prx next to eboot.bin while the converted PE lives under prx/*.guest.prx (the layout #3123 documents) then LoadLibrary the same binary twice on Windows; the second image's vtables stay unbound and Job0 in Engine.Render.Core2 jumps to null.

After the same-directory .guest.prx miss, look under prx/, sce_module/ and sce_modules/ next to that path for the same filename before the existing case-insensitive match. Orthogonal to #6226 (stem match in the same directory).

Tested

Windows 10, WinLibs GCC 15.2.0. guest_dynamic_loader passes (covers nested prx/Engine.Render.prx.guest.prx). tools/check_conventions.py --base upstream/main passes. PPSA03541 with separate unbound root copies and nested guests: past Job0, presents HDR10, then aborts on COPY_DATA GDS (not implemented) — no null rip on Job0.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source (none)
  • Generic behaviour, not specific to one title
  • Depends on: none (rebase if #6226 merges first — same function, different lookup)
  • Unblocks: PPSA03541 #3123
  • GPUs tested: n/a
  • AI-assisted: yes

Made with Cursor

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4878893376 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6544). Originally posted by [notaxeltv](https://github.com/notaxeltv) on 2026-10-15T19:43:00Z. --- ### What `RelinkedModulePath` only rewrote `path` → `path.guest.prx` in the same directory. Titles that keep unbound `Engine.*.prx` next to `eboot.bin` while the converted PE lives under `prx/*.guest.prx` (the layout #3123 documents) then `LoadLibrary` the same binary twice on Windows; the second image's vtables stay unbound and `Job0` in `Engine.Render.Core2` jumps to null. After the same-directory `.guest.prx` miss, look under `prx/`, `sce_module/` and `sce_modules/` next to that path for the same filename before the existing case-insensitive match. Orthogonal to #6226 (stem match in the same directory). ### Tested Windows 10, WinLibs GCC 15.2.0. `guest_dynamic_loader` passes (covers nested `prx/Engine.Render.prx.guest.prx`). `tools/check_conventions.py --base upstream/main` passes. PPSA03541 with separate unbound root copies and nested guests: past Job0, presents HDR10, then aborts on `COPY_DATA` GDS (not implemented) — no null rip on Job0. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's technical debt file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source (none) - [x] Generic behaviour, not specific to one title - [x] Depends on: none (rebase if #6226 merges first — same function, different lookup) - [x] Unblocks: PPSA03541 #3123 - [x] GPUs tested: n/a - [x] AI-assisted: yes Made with [Cursor](https://cursor.com)
jotitadev commented 2026-10-15 20:19:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-15T20:19:11Z.

Review: COMMENTED


Linux run (Ubuntu 26.04, Intel i7-8700, GCC 15.2, full build, non-GPU tests), head 83e675746 merged onto main 44df21632.

  • Builds; guest_dynamic_loader and guest_dynamic_loader_fixed_base pass, including the new nested prx/Engine.Render.prx.guest.prx case.
  • With General.cpp from main and the PR's test, both abort at GuestDynamicLoader.cpp:109 (Require(nested != nullptr), the nested load), so the test protects the change on Linux too.

Non-GPU suite (ctest -E "^agc"): same result as main; only file_writer_binary and file_writer_text fail, and they fail on main too on this machine (Ubuntu 26.04 coreutils).

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5539354627 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6544#pullrequestreview-5539354627). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-15T20:19:11Z. **Review:** COMMENTED --- Linux run (Ubuntu 26.04, Intel i7-8700, GCC 15.2, full build, non-GPU tests), head `83e675746` merged onto `main` `44df21632`. - Builds; `guest_dynamic_loader` and `guest_dynamic_loader_fixed_base` pass, including the new nested `prx/Engine.Render.prx.guest.prx` case. - With `General.cpp` from `main` and the PR's test, both abort at `GuestDynamicLoader.cpp:109` (`Require(nested != nullptr)`, the nested load), so the test protects the change on Linux too. Non-GPU suite (`ctest -E "^agc"`): same result as `main`; only `file_writer_binary` and `file_writer_text` fail, and they fail on `main` too on this machine (Ubuntu 26.04 coreutils). Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
oneandonlydean commented 2026-10-17 10:38:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T10:38:36Z.


Thanks, the change looks right for the layout it targets (a converted copy in prx/ or sce_module/, the PPSA03541 double load on Windows). Two asks and a rebase:

  1. Same directory first. In the motivating layout, a load that already succeeds on main now resolves differently. Please check the same directory first and fall back to the nested lookup only when that misses, so layouts that work today keep their behaviour.
  2. Case-insensitive nested lookup, to match the existing same-directory matching.

#6226 changes the same function (RelinkedModulePath) for a different layout. The intended order once both land is: exact, then same directory ignoring case, then nested, then stem.

The branch is about 600 commits behind main, so please rebase onto current main before we run CI.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6232909674 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6544#issuecomment-6232909674). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-17T10:38:36Z. --- Thanks, the change looks right for the layout it targets (a converted copy in `prx/` or `sce_module/`, the PPSA03541 double load on Windows). Two asks and a rebase: 1. **Same directory first.** In the motivating layout, a load that already succeeds on main now resolves differently. Please check the same directory first and fall back to the nested lookup only when that misses, so layouts that work today keep their behaviour. 2. **Case-insensitive nested lookup**, to match the existing same-directory matching. #6226 changes the same function (`RelinkedModulePath`) for a different layout. The intended order once both land is: exact, then same directory ignoring case, then nested, then stem. The branch is about 600 commits behind main, so please rebase onto current main before we run CI.
oneandonlydean commented 2026-10-21 06:56:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T06:56:57Z.


@notaxeltv a heads-up for the rebase: #8626 has just merged and changed RelinkedModulePath in core/libs/prx/libc/src/General.cpp (exact match, then case-insensitive, then a guarded stem fallback). This branch now conflicts with main in that function, so the nested prx/*.guest.prx preference needs to be re-applied on top of the new lookup order. The earlier asks above still apply.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6310038269 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6544#issuecomment-6310038269). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-21T06:56:57Z. --- @notaxeltv a heads-up for the rebase: #8626 has just merged and changed `RelinkedModulePath` in `core/libs/prx/libc/src/General.cpp` (exact match, then case-insensitive, then a guarded stem fallback). This branch now conflicts with `main` in that function, so the nested `prx/*.guest.prx` preference needs to be re-applied on top of the new lookup order. The earlier asks above still apply.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!6544
No description provided.