feat(libSceSysmodule): implement sceSysmoduleIsLoadedInternal #6823

Merged
ErenYeager1836 merged 1 commit from upstream-pr/6823 into main 2026-10-19 11:24:28 +00:00
ErenYeager1836 commented 2026-10-16 13:29:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ErenYeager1836 on 2026-10-16T13:29:50Z.


What

Implement sceSysmoduleIsLoadedInternal in libSceSysmodule.
Completes the internal sysmodule lifecycle triplet alongside sceSysmoduleLoadModuleInternal and sceSysmoduleUnloadModuleInternal:

  • Validates the 32-bit internal module ID: returns SCE_SYSMODULE_ERROR_INVALID_VALUE (0x805A1000) if (id & 0x7fffffffu) == 0.
  • Throws std::runtime_error on unknown module ID matching neighboring internal sysmodule exports.
  • Queries gLoadCount: returns SCE_SYSMODULE_ERROR_UNLOADED (0x805A1001) if not loaded or load count is zero, and returns 0 when loaded.
  • Adds test coverage in GuestSysmodule.cpp verifying invalid IDs, unknown IDs, unloaded state, and status transitions through module load and unload lifecycles (including kFiberModuleId and kAgcModuleId).

Tested

Windows 11, unit test suite (guest_sysmodule_tests). Verified invalid IDs (0 and kInternalFlag), unmapped ID runtime error, unloaded error code, and load/unload transitions.

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
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4889088095 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6823). Originally posted by [ErenYeager1836](https://github.com/ErenYeager1836) on 2026-10-16T13:29:50Z. --- ### What Implement `sceSysmoduleIsLoadedInternal` in `libSceSysmodule`. Completes the internal sysmodule lifecycle triplet alongside `sceSysmoduleLoadModuleInternal` and `sceSysmoduleUnloadModuleInternal`: - Validates the 32-bit internal module ID: returns `SCE_SYSMODULE_ERROR_INVALID_VALUE` (`0x805A1000`) if `(id & 0x7fffffffu) == 0`. - Throws `std::runtime_error` on unknown module ID matching neighboring internal sysmodule exports. - Queries `gLoadCount`: returns `SCE_SYSMODULE_ERROR_UNLOADED` (`0x805A1001`) if not loaded or load count is zero, and returns 0 when loaded. - Adds test coverage in `GuestSysmodule.cpp` verifying invalid IDs, unknown IDs, unloaded state, and status transitions through module load and unload lifecycles (including `kFiberModuleId` and `kAgcModuleId`). ### Tested Windows 11, unit test suite (`guest_sysmodule_tests`). Verified invalid IDs (`0` and `kInternalFlag`), unmapped ID runtime error, unloaded error code, and load/unload transitions. ### 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) - [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 - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-16 13:30:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-16T13:30:24Z.


Progress report (36f60df → de1d73c)

➖ System libraries: 82.74% (+0.0%, +1 implemented functions)

✅ 1 implemented
Library Name
libSceSysmodule sceSysmoduleIsLoadedInternal
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6216584457 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6823#issuecomment-6216584457). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-16T13:30:24Z. --- <!-- progress-report --> ### Progress report (36f60df → de1d73c) ➖ **System libraries**: 82.74% (+0.0%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libSceSysmodule | `sceSysmoduleIsLoadedInternal` | </details>
github-actions[bot] commented 2026-10-16 14:39:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-16T14:39:27Z.


Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5021 core/libs/prx/libSceSysmodule/Export.cpp
PR 6044 core/libs/tests/GuestSysmodule.cpp
PR 7332 core/libs/prx/libSceSysmodule/Export.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6217895373 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6823#issuecomment-6217895373). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-16T14:39:27Z. --- <!-- pr-overlap --> Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/prx/libSceSysmodule/Export.cpp` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/GuestSysmodule.cpp` | | [PR 7332](https://www.github.com/boykopovar/AnyPS5/pull/7332) | `core/libs/prx/libSceSysmodule/Export.cpp` |
Dextroid17 commented 2026-10-17 23:58:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-17T23:58:07Z.


Linux run on head dc53fe72a, since the CI build jobs were skipped on this head: CachyOS (Arch-based) x86-64, GCC 16.2.1, Release, env -i, ctest -R '^guest_sysmodule$', 3 runs per arm.

  • Head: guest_sysmodule passes 3/3.
  • Load-count check removed: I made sceSysmoduleIsLoadedInternal return 0 for any valid known ID, ignoring gLoadCount. guest_sysmodule aborts 3/3, so this exercises the load-count branch only. The log shows only Subprocess aborted. By reading, the first Require to fail is sceSysmoduleIsLoadedInternal(kFiberModuleId) == kModuleUnloaded before the load.
  • Merged onto main bd5856170 (clean merge; the PR's base 82ddae75b was 889 commits behind it): guest_sysmodule passes 3/3, and tools/check_conventions.py passes.

Not run: Windows or a PS5.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6243434052 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6823#issuecomment-6243434052). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-17T23:58:07Z. --- Linux run on head `dc53fe72a`, since the CI build jobs were skipped on this head: CachyOS (Arch-based) x86-64, GCC 16.2.1, Release, `env -i`, `ctest -R '^guest_sysmodule$'`, 3 runs per arm. - **Head:** `guest_sysmodule` passes 3/3. - **Load-count check removed:** I made `sceSysmoduleIsLoadedInternal` return 0 for any valid known ID, ignoring `gLoadCount`. `guest_sysmodule` aborts 3/3, so this exercises the load-count branch only. The log shows only `Subprocess aborted`. By reading, the first `Require` to fail is `sceSysmoduleIsLoadedInternal(kFiberModuleId) == kModuleUnloaded` before the load. - **Merged onto main** `bd5856170` (clean merge; the PR's base `82ddae75b` was 889 commits behind it): `guest_sysmodule` passes 3/3, and `tools/check_conventions.py` passes. Not run: Windows or a PS5. AI-assisted: yes
adriadam10 commented 2026-10-19 11:25:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T11:25:13Z.


Checked the semantics against shadPS4 and prosper (same results as sceSysmoduleIsLoaded for known ids; id 0 and unknown ids consistent with the neighbouring *Internal exports), and that the new test lines fail without the load-count check (also shown by @Dextroid17's mutation run).

The only conflict with main was adjacent test blocks in GuestSysmodule.cpp; I rebased onto current main keeping both, and guest_sysmodule plus the scoped suite pass; merged.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6266086786 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6823#issuecomment-6266086786). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-19T11:25:13Z. --- Checked the semantics against shadPS4 and prosper (same results as `sceSysmoduleIsLoaded` for known ids; id 0 and unknown ids consistent with the neighbouring `*Internal` exports), and that the new test lines fail without the load-count check (also shown by @Dextroid17's mutation run). The only conflict with `main` was adjacent test blocks in `GuestSysmodule.cpp`; I rebased onto current `main` keeping both, and `guest_sysmodule` plus the scoped suite pass; merged.
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!6823
No description provided.