fix(libSceSysmodule): reject unsupported module IDs #3716

Closed
MarcZX10 wants to merge 1 commit from upstream-pr/3716 into main
MarcZX10 commented 2026-10-11 15:55:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T15:55:40Z.


What

On current main, sceSysmoduleLoadModule logs an unknown ID and returns 0. Demon’s Souls calls it with module ID 0x10b, interprets that as a successful load, and enters the ACM path even though AnyPS5 has no ACM implementation. The public sceSysmoduleIsLoaded and sceSysmoduleUnloadModule functions also silently return success for unknown IDs.

Return the defined SCE_SYSMODULE_ERROR_INVALID_VALUE (0x805A1000) from those three APIs for unsupported IDs. Known modules that have not been loaded still return SCE_SYSMODULE_ERROR_UNLOADED. Add regression assertions for all three calls with ACM ID 0x10b.

Closes #3710.

Tested

Linux, GCC 12.2, Release: built guest_sysmodule_tests; guest_sysmodule and guest_sysmodule_maps_scan pass (2/2). tools/check_conventions.py and git diff --check pass. The new assertions fail against the previous implementation, where the unknown-ID branches return success.

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 in TechnicalDebt
  • 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 title-specific
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4820336504 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3716). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-11T15:55:40Z. --- ### What On current `main`, `sceSysmoduleLoadModule` logs an unknown ID and returns `0`. Demon’s Souls calls it with module ID `0x10b`, interprets that as a successful load, and enters the ACM path even though AnyPS5 has no ACM implementation. The public `sceSysmoduleIsLoaded` and `sceSysmoduleUnloadModule` functions also silently return success for unknown IDs. Return the defined `SCE_SYSMODULE_ERROR_INVALID_VALUE` (`0x805A1000`) from those three APIs for unsupported IDs. Known modules that have not been loaded still return `SCE_SYSMODULE_ERROR_UNLOADED`. Add regression assertions for all three calls with ACM ID `0x10b`. Closes #3710. ### Tested Linux, GCC 12.2, Release: built `guest_sysmodule_tests`; `guest_sysmodule` and `guest_sysmodule_maps_scan` pass (2/2). `tools/check_conventions.py` and `git diff --check` pass. The new assertions fail against the previous implementation, where the unknown-ID branches return success. ### 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](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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 title-specific - [x] Depends on: none - [x] AI-assisted: yes
adriadam10 commented 2026-10-11 18:01:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T18:01:26Z.

Review: CHANGES_REQUESTED


Thanks for tracking this down. Checked: guest_sysmodule and guest_sysmodule_maps_scan pass on this PR merged onto current main. Points to fix:

  • 0x10b is a real module ID (libSceAcm, already in the tree under core/libs/prx/libSceAcm). #3769 maps it in ModuleTable.hpp (reported on Dungeons PPSA16064, Windows test), which is the opposite premise to this PR: with this change LoadModule(0x10b) fails instead of loading. The Demon's Souls case in #3710 is better solved by the mapping; please coordinate with #3769 and drop the 0x10b assertions here.
  • Returning 0x805A1000 for every unmapped ID is not backed by a source. The only measurement is #3538 (PS5 FW 13.60), which covers id 0 only. Either measure/cite the behaviour for non-zero unmapped IDs or keep the current logged path and record it under "Unknown function info" in docs/dev/TechnicalDebt.md.
  • core/libs/prx/libSceSysmodule/Export.cpp (IsLoaded/LoadModule/UnloadModule) and core/libs/tests/GuestSysmodule.cpp (constants and top of main) overlap #3538; list it under Depends on and rebase after it lands.

Welcome to push again with those addressed.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5484337450 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3716#pullrequestreview-5484337450). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T18:01:26Z. **Review:** CHANGES_REQUESTED --- Thanks for tracking this down. Checked: `guest_sysmodule` and `guest_sysmodule_maps_scan` pass on this PR merged onto current `main`. Points to fix: - `0x10b` is a real module ID (`libSceAcm`, already in the tree under `core/libs/prx/libSceAcm`). #3769 maps it in `ModuleTable.hpp` (reported on Dungeons PPSA16064, Windows test), which is the opposite premise to this PR: with this change `LoadModule(0x10b)` fails instead of loading. The Demon's Souls case in #3710 is better solved by the mapping; please coordinate with #3769 and drop the `0x10b` assertions here. - Returning `0x805A1000` for every unmapped ID is not backed by a source. The only measurement is #3538 (PS5 FW 13.60), which covers id 0 only. Either measure/cite the behaviour for non-zero unmapped IDs or keep the current logged path and record it under "Unknown function info" in `docs/dev/TechnicalDebt.md`. - `core/libs/prx/libSceSysmodule/Export.cpp` (IsLoaded/LoadModule/UnloadModule) and `core/libs/tests/GuestSysmodule.cpp` (constants and top of `main`) overlap #3538; list it under **Depends on** and rebase after it lands. Welcome to push again with those addressed.
Mouhand-Kaddo commented 2026-10-11 20:36:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Mouhand-Kaddo on 2026-10-11T20:36:07Z.


Tested locally on Windows with a legal Demon's Souls PPSA01342 v1.04 copy (BuildVersion 2020-12-09.781263), Release, ANYPS5_ENABLE_SPIRV_TOOLS=OFF, based on main a11c8f7f7. Applied this PR's implementation commit; guest_sysmodule passed (1/1).

This change exposes a second required module ID: the title stops at:

Critical FAILURE: sceSysmoduleLoadModule(0x010f)
Message: RESULT FAIL: sceSysmoduleLoadModule(0x010f) => 0x805a1000
PS5PlatformServices.cpp (477), running duration 00:00:06.06

Adding #3841's Share registration removes that assertion. With both changes, the title instead remains in audio initialization: submitted serial 1, completed serial 0 after 600 seconds. The original main audio-buffer access violation was not observed in that bounded run, but no main menu was reached. This result is for v1.04; I have not verified the v1.005 report or these PR changes on Linux.

AI-assisted testing and report.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6113475884 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3716#issuecomment-6113475884). Originally posted by [Mouhand-Kaddo](https://github.com/Mouhand-Kaddo) on 2026-10-11T20:36:07Z. --- Tested locally on Windows with a legal Demon's Souls PPSA01342 v1.04 copy (BuildVersion 2020-12-09.781263), Release, ANYPS5_ENABLE_SPIRV_TOOLS=OFF, based on main a11c8f7f7. Applied this PR's implementation commit; guest_sysmodule passed (1/1). This change exposes a second required module ID: the title stops at: ``` Critical FAILURE: sceSysmoduleLoadModule(0x010f) Message: RESULT FAIL: sceSysmoduleLoadModule(0x010f) => 0x805a1000 PS5PlatformServices.cpp (477), running duration 00:00:06.06 ``` Adding #3841's Share registration removes that assertion. With both changes, the title instead remains in audio initialization: submitted serial 1, completed serial 0 after 600 seconds. The original main audio-buffer access violation was not observed in that bounded run, but no main menu was reached. This result is for v1.04; I have not verified the v1.005 report or these PR changes on Linux. AI-assisted testing and report.
MarcZX10 commented 2026-10-12 17:08:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T17:08:21Z.


Closing this as superseded by the maintainer-selected fixes. #3538 is merged and handles the measured module ID 0 case; #3769 is the selected carrier for the real libSceAcm ID 0x10b. The proposed generic error for other unmapped IDs had no supporting console evidence in review, so this PR should not change that behavior.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6128956366 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3716#issuecomment-6128956366). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T17:08:21Z. --- Closing this as superseded by the maintainer-selected fixes. #3538 is merged and handles the measured module ID 0 case; #3769 is the selected carrier for the real libSceAcm ID 0x10b. The proposed generic error for other unmapped IDs had no supporting console evidence in review, so this PR should not change that behavior.

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!3716
No description provided.