sysmodule: load game-shipped modules from /app0/sce_module #1266

Closed
github-bot wants to merge 1 commit from gh-pr/1266/head into gh-pr/1266/base
Owner

@⁠overlordxrz-source on GitHub · 2026-10-09 00:10 UTC · original
overlordxrz-source:libs/sysmodule-game-modules → main · +62 −0 · 1 files · 1 commits · closed without merging

What

sceSysmoduleLoadModule / sceSysmoduleLoadModuleInternalWithArg now load and start a module from /app0/sce_module/<name>.prx on the first request when the ID is one that libSceSysmodule marks as a game module (the module ships with the game, not with the system). Nothing else changes. Unknown IDs, system modules, an already loaded PRX, or a missing file all keep the current reference-count-only behaviour. 210d4dc's load/unload/IsLoaded bookkeeping is untouched.

The IDs are the entries flagged "located in /app0/sce_module" in libSceSysmodule's module table: 0x38 Face, 0x39 Smart, 0x86 S3DConversion, 0x93 Hand, 0xcb HeadTracker, 0xd8 FaceTracker, 0xd9 HandTracker, 0xe8 AudioLatencyEstimation, 0xf7 NpToolkit, 0xfe JobManager, 0x102 NpToolkit2, 0x115 NpCppWebApi, 0x135 FontGsm. shadPS4 uses the same table (sysmodule_table.h, IsGame). Loading goes through the same steps sceKernelLoadStartModule uses: LoadProgram, then RelocateProgram (which re-relocates everything, so imports already bound to stubs in the eboot or plugins get rebound), then StartModule.

Root cause

fdac55a stopped preloading every PRX in sce_module/ and now loads only libc, because "other PRXs are requested by the application". That matches the real runtime. But the request path, sceSysmoduleLoadModule, never loaded anything. So since Oct 4, modules a game ships besides libc are never mapped or started, and every import from them resolves to the unresolved-import stub, which returns 0. With 210d4dc, sceSysmoduleIsLoaded correctly reports these modules as unloaded, so games now go down the "load it myself, then use it" path and call straight into those stubs.

The PS5 IDs for these modules match the table. In the pre-Oct-4 logs attached to issues here (33 runs from the blanket-preload era, which list every sce_module file), every game that logs id = 277 (0x115) ships libSceNpCppWebApi.prx. No game requests 0x115 without shipping it. The other 3 ship it, but their logs end before they request it. Examples: Demon's Souls PPSA01341/PPSA01342, Astro Bot PPSA21564, Astro's Playroom PPSA01325, and Kerbal Space Program PPSA03748 and other Unity titles. Post-Oct-4 logs (#1121, #1134, #1158, #1070) show Unresolved import stub called ... [NpCppWebApi_v1].

Games / issues

  • #1164: Demon's Souls PPSA01341 on 58978d1 (comment by FilipMW) faults in game code reading NULL+0x60. Its sce_module is libc.prx + libSceNpCppWebApi.prx, and it calls sceSysmoduleLoadModule(0x115) at startup. This patch makes that call load the PRX again. I haven't confirmed this is the cause of that crash.
  • #1164 / #337: Subnautica PPSA02453. The startup NULL-global crash from 45b6d2c no longer shows on 2f4b8a3 (latest comment: it now reaches rendering and hits a separate Vulkan depth-compare format error). That fits 210d4dc's IsLoaded fix. This PR doesn't claim to fix it.
  • #1158 / #1070 / #1121 / #1134: the NpCppWebApi_v1 unresolved stubs come from the missing module this loads.

Tested

  • Cross-compiled src/libs/libSysmodule.cpp for x86_64-linux (zig c++ 0.17, C++20) against current main.
  • Native harness: the ID→name table matches every non-zero game-flagged entry of libSceSysmodule's module table (13/13), and returns nothing for the 138 system entries and for 0x113, 0xb4, 0x105, 0x127, 0xffff.
  • clang-format clean with src/.clang-format.
  • Not run with any game. No game files available. kernel_file_system_tests only uses 0x113/0xb4, which aren't game modules, so its behaviour is unchanged.

Written with AI assistance.

**@⁠overlordxrz-source** on GitHub · 2026-10-09 00:10 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1266) `overlordxrz-source:libs/sysmodule-game-modules` → `main` · +62 −0 · 1 files · 1 commits · closed without merging ### What `sceSysmoduleLoadModule` / `sceSysmoduleLoadModuleInternalWithArg` now load and start a module from `/app0/sce_module/<name>.prx` on the first request when the ID is one that libSceSysmodule marks as a game module (the module ships with the game, not with the system). Nothing else changes. Unknown IDs, system modules, an already loaded PRX, or a missing file all keep the current reference-count-only behaviour. 210d4dc's load/unload/IsLoaded bookkeeping is untouched. The IDs are the entries flagged "located in /app0/sce_module" in libSceSysmodule's module table: 0x38 Face, 0x39 Smart, 0x86 S3DConversion, 0x93 Hand, 0xcb HeadTracker, 0xd8 FaceTracker, 0xd9 HandTracker, 0xe8 AudioLatencyEstimation, 0xf7 NpToolkit, 0xfe JobManager, 0x102 NpToolkit2, 0x115 NpCppWebApi, 0x135 FontGsm. shadPS4 uses the same table (`sysmodule_table.h`, `IsGame`). Loading goes through the same steps `sceKernelLoadStartModule` uses: `LoadProgram`, then `RelocateProgram` (which re-relocates everything, so imports already bound to stubs in the eboot or plugins get rebound), then `StartModule`. ### Root cause fdac55a stopped preloading every PRX in `sce_module/` and now loads only libc, because "other PRXs are requested by the application". That matches the real runtime. But the request path, `sceSysmoduleLoadModule`, never loaded anything. So since Oct 4, modules a game ships besides libc are never mapped or started, and every import from them resolves to the unresolved-import stub, which returns 0. With 210d4dc, `sceSysmoduleIsLoaded` correctly reports these modules as unloaded, so games now go down the "load it myself, then use it" path and call straight into those stubs. The PS5 IDs for these modules match the table. In the pre-Oct-4 logs attached to issues here (33 runs from the blanket-preload era, which list every sce_module file), every game that logs `id = 277` (0x115) ships `libSceNpCppWebApi.prx`. No game requests 0x115 without shipping it. The other 3 ship it, but their logs end before they request it. Examples: Demon's Souls PPSA01341/PPSA01342, Astro Bot PPSA21564, Astro's Playroom PPSA01325, and Kerbal Space Program PPSA03748 and other Unity titles. Post-Oct-4 logs (#1121, #1134, #1158, #1070) show `Unresolved import stub called ... [NpCppWebApi_v1]`. ### Games / issues - #1164: Demon's Souls PPSA01341 on 58978d1 (comment by FilipMW) faults in game code reading NULL+0x60. Its sce_module is `libc.prx` + `libSceNpCppWebApi.prx`, and it calls `sceSysmoduleLoadModule(0x115)` at startup. This patch makes that call load the PRX again. I haven't confirmed this is the cause of that crash. - #1164 / #337: Subnautica PPSA02453. The startup NULL-global crash from 45b6d2c no longer shows on 2f4b8a3 (latest comment: it now reaches rendering and hits a separate Vulkan depth-compare format error). That fits 210d4dc's `IsLoaded` fix. This PR doesn't claim to fix it. - #1158 / #1070 / #1121 / #1134: the `NpCppWebApi_v1` unresolved stubs come from the missing module this loads. ### Tested - Cross-compiled `src/libs/libSysmodule.cpp` for x86_64-linux (zig c++ 0.17, C++20) against current main. - Native harness: the ID→name table matches every non-zero game-flagged entry of libSceSysmodule's module table (13/13), and returns nothing for the 138 system entries and for 0x113, 0xb4, 0x105, 0x127, 0xffff. - clang-format clean with `src/.clang-format`. - Not run with any game. No game files available. `kernel_file_system_tests` only uses 0x113/0xb4, which aren't game modules, so its behaviour is unchanged. Written with AI assistance.
Since fdac55a the runtime only loads libc at startup and leaves other
PRXs to the application. The application asks for them with
sceSysmoduleLoadModule, but that only counted references, so modules the
game ships in sce_module (libSceNpCppWebApi, libSceJobManager, ...) were
never loaded and their imports stayed bound to the unresolved stubs.

Load and start the modules libSceSysmodule marks as game modules from
/app0/sce_module/<name>.prx on the first request, as the real library
does. Unknown IDs, system modules and missing files keep the existing
reference-only behaviour.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:50:42 +00:00
github-bot closed this pull request 2026-11-26 09:50:42 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-09 00:12 UTC · original

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 36e1b9fd-6c11-4961-a3f8-c23a67e2d880
📥 Commits

Reviewing files that changed from the base of the PR and between 2f4b8a335d and 1125a0013e.

📒 Files selected for processing (1)
  • src/libs/libSysmodule.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

LoadModule now calls LoadGameModule before incrementing the module reference count. The new helper maps recognized IDs to module names, checks for files under /app0/sce_module, skips files already registered with the runtime linker, and loads and relocates other files. It starts a loaded module only when its initialization address is nonzero.

Suggested reviewers: nmzik

Priority: ➖ Normal

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 1125a

The supplied evidence identifies no issue that must be fixed before merging. Game testing was not reported, so normal validation remains appropriate.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: loading game-shipped sysmodules from /app0/sce_module.
Description check Passed The description is directly related to the changeset and explains the affected APIs, behavior, root cause, validation, and limitations.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-09 00:12 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1266#issuecomment-6071572702) <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/1266?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=2" alt="Review in Change Stack →" width="220" height="32"></a> <!-- review_stack_entry_end --> <!-- recent_review_start --> No actionable comments were generated in the recent review. 🎉 <details> <summary>ℹ️ Recent review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `36e1b9fd-6c11-4961-a3f8-c23a67e2d880` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 2f4b8a335d5e27a5153bdea670bd877a061e37b1 and 1125a0013eea7bdf54cda852c515ae0c45ef7e06. </details> <details> <summary>📒 Files selected for processing (1)</summary> * `src/libs/libSysmodule.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. </details> --- <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough `LoadModule` now calls `LoadGameModule` before incrementing the module reference count. The new helper maps recognized IDs to module names, checks for files under `/app0/sce_module`, skips files already registered with the runtime linker, and loads and relocates other files. It starts a loaded module only when its initialization address is nonzero. **Suggested reviewers:** `nmzik` </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"1125a0013eea7bdf54cda852c515ae0c45ef7e06" --> **Change:** Bug fix <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** **⚪ Minimal** · up to `1125a` <!-- final_review_risk_coverage:{"sourceCommitId":"1125a0013eea7bdf54cda852c515ae0c45ef7e06","coveredCommitId":"1125a0013eea7bdf54cda852c515ae0c45ef7e06","kind":"reviewed"} --> The supplied evidence identifies no issue that must be fixed before merging. Game testing was not reported, so normal validation remains appropriate. <!-- final_review_risk_end --> <!-- pre_merge_checks_walkthrough_start --> <details> <summary>🚥 Pre-merge checks | ✅ 4 | ❌ 1</summary> ### ❌ Failed checks (1 warning) | Check name | Status | Explanation | Resolution | | :---------------- | :---------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ![Warning](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-warning.svg) | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary>✅ Passed checks (4 passed)</summary> | Check name | Status | Explanation | | :------------------------ | :-------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title clearly and concisely describes the main change: loading game-shipped sysmodules from /app0/sce_module. | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description is directly related to the changeset and explains the affected APIs, behavior, root cause, validation, and limitations. | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | </details> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- autopilot:start --> - [ ] <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autopilot</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts <!-- autopilot:end --> <!-- tips_start --> --- Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=1266)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary>❤️ Share</summary> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
Author
Owner

@⁠overlordxrz-source on GitHub · 2026-10-16 18:52 UTC · original

Closing in favour of e7ac24203's table of game-shipped modules. Happy to add module IDs to it when a game needs one.

**@⁠overlordxrz-source** on GitHub · 2026-10-16 18:52 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1266#issuecomment-6222514600) Closing in favour of e7ac24203's table of game-shipped modules. Happy to add module IDs to it when a game needs one.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.