feat(libSceSystemService): convert between the running title's app id and title id #8354

Merged
MarrasFederico merged 4 commits from upstream-pr/8354 into main 2026-10-24 11:53:37 +00:00
MarrasFederico commented 2026-10-20 10:57:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarrasFederico on 2026-10-20T10:57:25Z.


What

sceSystemServiceGetAppId, sceSystemServiceGetAppTitleId and sceLncUtilGetAppTitleId were parameterless throwing stubs among the firmware 3.20 pending exports. SharpProspero SystemService.cs documents them:

  • int sceSystemServiceGetAppId(const char* titleId) converts a title id to its application id;
  • int sceSystemServiceGetAppTitleId(int appId, char* titleId) writes the NUL-terminated title id into a buffer of at least 10 bytes;
  • sceLncUtilGetAppTitleId(appId, titleId) does the same through the launcher utility. SharpProspero declares it void, but main now declares it int sceLncUtilGetAppTitleId(std::int32_t appId, char* titleId) among the pending exports. It takes that signature and returns 0 on success, like sceSystemServiceGetAppTitleId.

AnyPS5 runs one title, whose app id is SYSTEM_SERVICE_RUNNING_APP_ID (what sceSystemServiceGetAppIdOfRunningBigApp returns) and whose title id comes from param.json or param.sfo. The three calls now move between the two for that title, next to sceSystemServiceGetAppIdOfRunningBigApp:

  • sceSystemServiceGetAppId returns the running app id for exactly the running title id.
  • sceSystemServiceGetAppTitleId / sceLncUtilGetAppTitleId write the running title id and its NUL for the running app id, and nothing past them.
  • Unknown results throw, as sceSystemServiceKillApp does for another application: another title id or app id, a null pointer, and a running title id that does not fit the 10-byte buffer. SharpProspero names ErrorNoAppInfo only for sceSystemServiceGetAppFocusedAppStatus, so it is not used here.

The debt file records these throwing cases, and the pending-exports count drops from 477 to 474.

Tested

Ubuntu 26.04.1, kernel 7.0.0-38, GCC 15.2.0, Release, full build with BUILD_TESTING=ON. Windows was not compiled. No title was run.

  • New guest_system_service_app_title_id, run three times, each in its own directory:
    • known (param.json with PPSA00000):
      • GetAppId("PPSA00000") returns the running app id, and both title id calls write PPSA00000 and its NUL for it, leaving the bytes after the 10-byte window untouched.
      • GetAppId throws for PPSA00001, a lowercase, shorter or longer id, leading or trailing spaces, CUSA00000 and an empty string.
      • Both title id calls throw for app ids 0, -1, INT_MIN, INT_MAX, the running id plus one and 0xFFFFFFFF, and for null buffers, without writing.
    • long (a 10-character title id): GetAppId works, and both title id calls throw without writing.
    • missing (no param.json or param.sfo): all three throw without writing.
  • On main, known and long fail, since every call throws. Writing the id without its NUL, matching a prefix of the title id, accepting any app id, or letting a 10-character id through makes the test fail.
  • guest_system_service, guest_system_service_language and guest_system_service_time_zone still pass.
  • Updated to main 524398151f. It takes main's new pending-export signatures and removes its three stubs of these functions. The test now also requires sceLncUtilGetAppTitleId to return 0. All 10 guest_system_service* tests pass. The pending-exports debt entry is main's new text, which no longer carries a count.
  • tools/check_conventions.py --base origin/main passes. tools/pr_overlap.py reports #8335, which also edits the pending-exports count on line 19 of the debt file: whichever is merged second updates that number. It could not compare #6044 (test reorganization) and #7201 (macOS port), which conflict with main; neither touches these three calls.

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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4934730181 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8354). Originally posted by [MarrasFederico](https://github.com/MarrasFederico) on 2026-10-20T10:57:25Z. --- ### What `sceSystemServiceGetAppId`, `sceSystemServiceGetAppTitleId` and `sceLncUtilGetAppTitleId` were parameterless throwing stubs among the firmware 3.20 pending exports. [SharpProspero `SystemService.cs`](https://github.com/SvenGDK/SharpProspero/blob/5dfdb4b0b166e83dc9ae275001afb695f12c7174/src/SharpProspero/Interop/SystemService/SystemService.cs#L236-L260) documents them: - `int sceSystemServiceGetAppId(const char* titleId)` converts a title id to its application id; - `int sceSystemServiceGetAppTitleId(int appId, char* titleId)` writes the NUL-terminated title id into a buffer of at least 10 bytes; - `sceLncUtilGetAppTitleId(appId, titleId)` does the same through the launcher utility. SharpProspero declares it `void`, but `main` now declares it `int sceLncUtilGetAppTitleId(std::int32_t appId, char* titleId)` among the pending exports. It takes that signature and returns 0 on success, like `sceSystemServiceGetAppTitleId`. AnyPS5 runs one title, whose app id is `SYSTEM_SERVICE_RUNNING_APP_ID` (what `sceSystemServiceGetAppIdOfRunningBigApp` returns) and whose title id comes from `param.json` or `param.sfo`. The three calls now move between the two for that title, next to `sceSystemServiceGetAppIdOfRunningBigApp`: - **`sceSystemServiceGetAppId`** returns the running app id for exactly the running title id. - **`sceSystemServiceGetAppTitleId` / `sceLncUtilGetAppTitleId`** write the running title id and its NUL for the running app id, and nothing past them. - **Unknown results throw, as `sceSystemServiceKillApp` does for another application:** another title id or app id, a null pointer, and a running title id that does not fit the 10-byte buffer. SharpProspero names `ErrorNoAppInfo` only for `sceSystemServiceGetAppFocusedAppStatus`, so it is not used here. The debt file records these throwing cases, and the pending-exports count drops from 477 to 474. ### 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. --> Ubuntu 26.04.1, kernel 7.0.0-38, GCC 15.2.0, Release, full build with `BUILD_TESTING=ON`. Windows was not compiled. No title was run. - New `guest_system_service_app_title_id`, run three times, each in its own directory: - **`known`** (`param.json` with `PPSA00000`): - `GetAppId("PPSA00000")` returns the running app id, and both title id calls write `PPSA00000` and its NUL for it, leaving the bytes after the 10-byte window untouched. - `GetAppId` throws for `PPSA00001`, a lowercase, shorter or longer id, leading or trailing spaces, `CUSA00000` and an empty string. - Both title id calls throw for app ids 0, -1, `INT_MIN`, `INT_MAX`, the running id plus one and `0xFFFFFFFF`, and for null buffers, without writing. - **`long`** (a 10-character title id): `GetAppId` works, and both title id calls throw without writing. - **`missing`** (no `param.json` or `param.sfo`): all three throw without writing. - On `main`, `known` and `long` fail, since every call throws. Writing the id without its NUL, matching a prefix of the title id, accepting any app id, or letting a 10-character id through makes the test fail. - `guest_system_service`, `guest_system_service_language` and `guest_system_service_time_zone` still pass. - **Updated to `main` `524398151f`.** It takes `main`'s new pending-export signatures and removes its three stubs of these functions. The test now also requires `sceLncUtilGetAppTitleId` to return 0. All 10 `guest_system_service*` tests pass. The pending-exports debt entry is `main`'s new text, which no longer carries a count. - `tools/check_conventions.py --base origin/main` passes. `tools/pr_overlap.py` reports #8335, which also edits the pending-exports count on line 19 of the debt file: whichever is merged second updates that number. It could not compare #6044 (test reorganization) and #7201 (macOS port), which conflict with `main`; neither touches these three calls. ### 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 <!-- #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 -->
ycbuzi commented 2026-10-21 07:46:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ycbuzi on 2026-10-21T07:46:31Z.


Windows run of 7c83407e11 merged onto main b77bd58806 (690a8ebc1e), the build the description lists as not done. Windows 11 Home 10.0.26200, MinGW-w64 GCC 15.2.0 (ucrt-posix-seh r7), Release, BUILD_TESTING=ON.

The merge conflicts only in docs/dev/debt/libSceSystemService.md, as GitHub shows; for this run I took this PR's side of that, and the code merged without conflicts. Built libSceSystemService and guest_system_service_app_title_id_tests with no errors. The build also rebuilds libSceAgcDriver, which prints two memcmp bound warnings, as main does from Graphics/src/PipelineLibrary.cpp. ctest --repeat until-fail:2 on guest_system_service_app_title_id_known, _long and _missing: all pass on both repeats. Not run: the negative control against main's library, a title.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6310836696 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8354#issuecomment-6310836696). Originally posted by [ycbuzi](https://github.com/ycbuzi) on 2026-10-21T07:46:31Z. --- Windows run of 7c83407e11 merged onto `main` b77bd58806 (690a8ebc1e), the build the description lists as not done. Windows 11 Home 10.0.26200, MinGW-w64 GCC 15.2.0 (ucrt-posix-seh r7), Release, `BUILD_TESTING=ON`. The merge conflicts only in `docs/dev/debt/libSceSystemService.md`, as GitHub shows; for this run I took this PR's side of that, and the code merged without conflicts. Built `libSceSystemService` and `guest_system_service_app_title_id_tests` with no errors. The build also rebuilds `libSceAgcDriver`, which prints two `memcmp` bound warnings, as `main` does from `Graphics/src/PipelineLibrary.cpp`. `ctest --repeat until-fail:2` on `guest_system_service_app_title_id_known`, `_long` and `_missing`: all pass on both repeats. Not run: the negative control against `main`'s library, a title.
ycbuzi commented 2026-10-22 08:34:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ycbuzi on 2026-10-22T08:34:25Z.


Windows run of e0e231ef3f, the update since my earlier run, merged onto main d6eafa54d0 (8a7389d16c, clean). Windows 11 Home 10.0.26200, MinGW-w64 GCC 15.2.0 (ucrt-posix-seh r7), Release, BUILD_TESTING=ON.

Built libSceSystemService and guest_system_service_app_title_id_tests with no errors. The build also rebuilds libSceAgcDriver, which prints two memcmp bound warnings, as main does from Graphics/src/PipelineLibrary.cpp. ctest --repeat until-fail:2 on guest_system_service_app_title_id_known, _long and _missing: all pass on both repeats. The negative control, which my earlier run left out: with Export.cpp and PendingExports.cpp of libSceSystemService taken from main, _known and _long abort with sceSystemServiceGetAppId not implemented (exit code 0xc0000409), and _missing still passes. Not run: a title.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6336425412 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8354#issuecomment-6336425412). Originally posted by [ycbuzi](https://github.com/ycbuzi) on 2026-10-22T08:34:25Z. --- Windows run of e0e231ef3f, the update since my earlier run, merged onto `main` d6eafa54d0 (8a7389d16c, clean). Windows 11 Home 10.0.26200, MinGW-w64 GCC 15.2.0 (ucrt-posix-seh r7), Release, `BUILD_TESTING=ON`. Built `libSceSystemService` and `guest_system_service_app_title_id_tests` with no errors. The build also rebuilds `libSceAgcDriver`, which prints two `memcmp` bound warnings, as `main` does from `Graphics/src/PipelineLibrary.cpp`. `ctest --repeat until-fail:2` on `guest_system_service_app_title_id_known`, `_long` and `_missing`: all pass on both repeats. The negative control, which my earlier run left out: with `Export.cpp` and `PendingExports.cpp` of `libSceSystemService` taken from `main`, `_known` and `_long` abort with `sceSystemServiceGetAppId not implemented` (exit code `0xc0000409`), and `_missing` still passes. Not run: a title.
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!8354
No description provided.