feat(web): relink Unity runtime modules in browser packages #22984

Open
lazy-dev-77 wants to merge 0 commits from upstream-pr/22984 into main
lazy-dev-77 commented 2026-11-18 15:50:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by lazy-dev-77 on 2026-11-18T15:50:02Z.


What

Apps with a Unity ELF plugin directly in Media/Modules/ or Media/Plugins/ previously stopped at browser inspection. Route those plugins through the native relinker's runtime-module handling and package the converted providers alongside their originals. Also match native discovery in sce_module/, sce_modules/, and prx/ by preserving ELF assets in deeper directories as data. Previously a nested standalone ELF could stop an otherwise valid conversion.

Tested

On Ubuntu 26.04, built the release WebAssembly relinker with Emscripten 6.0.12 and ran python3 tools/test_web.py --build <wasm-build>. The 48 helper tests and the ZIP/folder integration fixtures passed for Linux and Windows output. The parent rejected the Unity fixture, and a nested standalone ELF failed conversion with Invalid string or symbol table. The same inputs converted successfully with this change and the nested asset kept its original bytes.

Compared the converted modules in both Unity directories against native CLI --module-dir output on both targets. All four matched byte for byte. On a separate homebrew executable that imports a plugin, both the executable and its provider also matched. Checked the Linux loader path and the Windows initialization export. Testing covered generated homebrew fixtures and package contents.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5379250233 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22984). Originally posted by [lazy-dev-77](https://github.com/lazy-dev-77) on 2026-11-18T15:50:02Z. --- ### What Apps with a Unity ELF plugin directly in `Media/Modules/` or `Media/Plugins/` previously stopped at browser inspection. Route those plugins through the native relinker's runtime-module handling and package the converted providers alongside their originals. Also match native discovery in `sce_module/`, `sce_modules/`, and `prx/` by preserving ELF assets in deeper directories as data. Previously a nested standalone ELF could stop an otherwise valid conversion. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> On Ubuntu 26.04, built the release WebAssembly relinker with Emscripten 6.0.12 and ran `python3 tools/test_web.py --build <wasm-build>`. The 48 helper tests and the ZIP/folder integration fixtures passed for Linux and Windows output. The parent rejected the Unity fixture, and a nested standalone ELF failed conversion with `Invalid string or symbol table`. The same inputs converted successfully with this change and the nested asset kept its original bytes. Compared the converted modules in both Unity directories against native CLI `--module-dir` output on both targets. All four matched byte for byte. On a separate homebrew executable that imports a plugin, both the executable and its provider also matched. Checked the Linux loader path and the Windows initialization export. Testing covered generated homebrew fixtures and package contents. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) and the licence notice of code adapted from upstream (see AGENTS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/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 - [x] Generic behaviour, not specific to one title - [x] Depends on: none <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: n/a <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no -->
MarcZX10 commented 2026-11-23 03:31:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T03:31:23Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

Reviewed head 584a39fd9a0b8b002691b6929dddb062e154bc68 against the prepared diff and source at that head. I ran no commands or tests.

Results

Check Result Note
Changed code review passed All changed files and added lines read
Tests in this review not run The author reports WebAssembly and fixture checks passed

Findings

Blocking

None.

Non-blocking

None.

Not verified

I did not run the reported checks or verify behavior on a physical console. No changed files were excluded: core/relinker/wasm/Bindings.cpp, demo/web/archive.mjs, demo/web/tests/archive-root.test.mjs, demo/web/tests/archive.test.mjs, and docs/user/USAGE.md were read. Excluded files: none.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6016252978 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22984#pullrequestreview-6016252978). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-23T03:31:23Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this; the points below are optional. ## What I ran Reviewed head `584a39fd9a0b8b002691b6929dddb062e154bc68` against the prepared diff and source at that head. I ran no commands or tests. ## Results | Check | Result | Note | |---|---|---| | Changed code review | passed | All changed files and added lines read | | Tests in this review | not run | The author reports WebAssembly and fixture checks passed | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified I did not run the reported checks or verify behavior on a physical console. No changed files were excluded: `core/relinker/wasm/Bindings.cpp`, `demo/web/archive.mjs`, `demo/web/tests/archive-root.test.mjs`, `demo/web/tests/archive.test.mjs`, and `docs/user/USAGE.md` were read. Excluded files: none. ## To get this to a good state Nothing is required.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/22984:upstream-pr/22984'
git switch 'upstream-pr/22984'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/22984'
git switch 'upstream-pr/22984'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/22984'
git switch 'upstream-pr/22984'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/22984'
git switch 'main'
git merge --squash 'upstream-pr/22984'
git switch 'main'
git merge --ff-only 'upstream-pr/22984'
git switch 'main'
git merge 'upstream-pr/22984'
git push origin 'main'
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!22984
No description provided.