fix(libSceGameUpdate): return the module's lifecycle and argument errors #7856

Merged
KernelPanicNT merged 1 commit from upstream-pr/7856 into main 2026-10-20 02:46:47 +00:00
KernelPanicNT commented 2026-10-19 11:17:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by KernelPanicNT on 2026-10-19T11:17:46Z.


What

libSceGameUpdate now returns the module's own lifecycle and argument errors, and no longer reports success for requests that do not exist.

Source of the behaviour. prosper's reading of the PS5 3.20 libSceGameUpdate.sprx marks the argument checks as HIGH confidence. Its implementation follows them:

Call Order of checks
Initialize already initialized → 0x80412802
Terminate not initialized → 0x80412801
CreateRequest not initialized → 0x80412801
Check(id, param, result) id <= 0 → 0x80412805; null pointer → 0x80412803; either size not 0x30 → 0x80412804; non-zero check type (+8) or reserved word (+0xc..+0x2c) → 0x80412803; then not initialized → 0x80412801; unknown id → 0x80412805
AbortRequest / DeleteRequest id <= 0 → 0x80412805; not initialized → 0x80412801; unknown id → 0x80412805
GetAddcontLatestVersion null label or info → 0x80412803, before the initialization check

On main:

The GetAddcontLatestVersion reordering is the change #2499 was asked to bring back as a single-library PR.

CreateRequest on an initialized library still returns 0x80D50001, so no request ever exists, and Check, Abort and Delete answer 0x80412805 for any id that passes their argument checks. The module's 8 request slots and the answer of its patch-check service offline are recorded as debt and not modelled.

Changes:

  • Export.cpp:
    • new ALREADY_INITIALIZED and REQUEST_NOT_FOUND codes;
    • the checks in the order above;
    • static_asserts that GameUpdateCheckParam and GameUpdateCheckResult are 0x30 bytes.
  • guest_gameupdate, new TestRequestArguments:
    • every row of the table, the argument errors before initialization;
    • a double Initialize, a double Terminate;
    • the null checks of GetAddcontLatestVersion before initialization.
  • docs/dev/debt/libSceGameUpdate.md: a new entry for the request functions.

Tested

Linux (GitHub Codespace, 4 cores, native build of this branch on 36f60df9e, rebased onto 674c25388 without conflicts):

  • guest_gameupdate: 5/5 runs pass.
  • Negative control: with Export.cpp from main, guest_gameupdate aborts (sceGameUpdateTerminate before initialization returns 0); 5/5 pass again after restoring it.

Windows (fork CI, run 39238868071, this branch on 674c25388): build and the full test suite pass, 1632/1632.

Checks:

  • python3 tools/check_conventions.py --base origin/main passes; python3 tools/pr_overlap.py --branch fix/gameupdate-lifecycle-errors reports only the test reorganization #6044.
  • tools/progress.py: unchanged (3887/4698 on base and head); this corrects return values only.

Checklist

  • Based on current main (674c25388); 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 (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4920083546 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7856). Originally posted by [KernelPanicNT](https://github.com/KernelPanicNT) on 2026-10-19T11:17:46Z. --- ### What libSceGameUpdate now returns the module's own lifecycle and argument errors, and no longer reports success for requests that do not exist. **Source of the behaviour.** [prosper's reading of the PS5 3.20 `libSceGameUpdate.sprx`](https://github.com/mattias800/prosper/blob/ed42e499888d5a86792c3e1b2df3aebd8ca1a681/prosper/src/hle/service/hle_service.cpp#L1306-L1330) marks the argument checks as HIGH confidence. [Its implementation](https://github.com/mattias800/prosper/blob/ed42e499888d5a86792c3e1b2df3aebd8ca1a681/prosper/src/hle/service/hle_service.cpp#L1357-L1445) follows them: | Call | Order of checks | |---|---| | `Initialize` | already initialized → `0x80412802` | | `Terminate` | not initialized → `0x80412801` | | `CreateRequest` | not initialized → `0x80412801` | | `Check(id, param, result)` | `id <= 0` → `0x80412805`; null pointer → `0x80412803`; either size not `0x30` → `0x80412804`; non-zero check type (+8) or reserved word (+0xc..+0x2c) → `0x80412803`; then not initialized → `0x80412801`; unknown id → `0x80412805` | | `AbortRequest` / `DeleteRequest` | `id <= 0` → `0x80412805`; not initialized → `0x80412801`; unknown id → `0x80412805` | | `GetAddcontLatestVersion` | null label or info → `0x80412803`, before the initialization check | On `main`: - [`Initialize` and `Terminate`](https://github.com/boykopovar/AnyPS5/blob/36f60df9edb32989cef1394ef6f93b276b055510/core/libs/prx/libSceGameUpdate/Export.cpp#L59-L67) always succeed. - [`AbortRequest` and `DeleteRequest`](https://github.com/boykopovar/AnyPS5/blob/36f60df9edb32989cef1394ef6f93b276b055510/core/libs/prx/libSceGameUpdate/Export.cpp#L17-L36) return 0 for any id, although `CreateRequest` never creates a request. - [`Check`](https://github.com/boykopovar/AnyPS5/blob/36f60df9edb32989cef1394ef6f93b276b055510/core/libs/prx/libSceGameUpdate/Export.cpp#L22-L27) ignores its arguments. - [`GetAddcontLatestVersion`](https://github.com/boykopovar/AnyPS5/blob/36f60df9edb32989cef1394ef6f93b276b055510/core/libs/prx/libSceGameUpdate/Export.cpp#L38-L57) checks initialization first. The `GetAddcontLatestVersion` reordering is the change [#2499 was asked](https://github.com/boykopovar/AnyPS5/pull/2499) to bring back as a single-library PR. `CreateRequest` on an initialized library still returns `0x80D50001`, so no request ever exists, and `Check`, `Abort` and `Delete` answer `0x80412805` for any id that passes their argument checks. The module's 8 request slots and the answer of its patch-check service offline are recorded as debt and not modelled. Changes: - `Export.cpp`: - new `ALREADY_INITIALIZED` and `REQUEST_NOT_FOUND` codes; - the checks in the order above; - `static_assert`s that `GameUpdateCheckParam` and `GameUpdateCheckResult` are 0x30 bytes. - `guest_gameupdate`, new `TestRequestArguments`: - every row of the table, the argument errors before initialization; - a double `Initialize`, a double `Terminate`; - the null checks of `GetAddcontLatestVersion` before initialization. - `docs/dev/debt/libSceGameUpdate.md`: a new entry for the request functions. ### Tested Linux (GitHub Codespace, 4 cores, native build of this branch on `36f60df9e`, rebased onto `674c25388` without conflicts): - `guest_gameupdate`: 5/5 runs pass. - Negative control: with `Export.cpp` from `main`, `guest_gameupdate` aborts (`sceGameUpdateTerminate` before initialization returns 0); 5/5 pass again after restoring it. Windows (fork CI, [run 39238868071](https://github.com/KernelPanicNT/AnyPS5/actions/runs/39238868071), this branch on `674c25388`): build and the full test suite pass, 1632/1632. Checks: - `python3 tools/check_conventions.py --base origin/main` passes; `python3 tools/pr_overlap.py --branch fix/gameupdate-lifecycle-errors` reports only the test reorganization #6044. - `tools/progress.py`: unchanged (3887/4698 on base and head); this corrects return values only. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main` (`674c25388`); 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] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-19 11:25:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T11:25:39Z.


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 6044 core/libs/tests/GuestGameUpdate.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6266094119 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7856#issuecomment-6266094119). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-19T11:25:39Z. --- <!-- 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 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/GuestGameUpdate.cpp` |
fogydes commented 2026-10-19 12:34:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fogydes on 2026-10-19T12:34:44Z.

Review: COMMENTED


Verified on Windows 11 with MinGW-w64 GCC 15.2.0 (Release):

  • Error Codes & Ordering: In core/libs/prx/libSceGameUpdate/Export.cpp, argument validation and lifecycle checks align with PS5 3.20 behaviour (returning 0x80412802 for duplicate initialization, 0x80412801 for uninitialized calls, 0x80412805 for invalid/unregistered request IDs, and checking pointers before initialization in sceGameUpdateGetAddcontLatestVersion).
  • Structure Bounds: static_asserts properly guard GameUpdateCheckParam and GameUpdateCheckResult against layout drift.
  • Unit Testing: Built guest_gameupdate_tests.exe and verified ctest --test-dir build-libs -R "^guest_gameupdate$" -V passes in 0.06s:
    1/1 Test #1104: guest_gameupdate .................   Passed    0.06 sec
    
    All request parameter checks, double initialize/terminate, and null check fixtures passed.
  • Conventions & Debt: Technical debt documented in docs/dev/debt/libSceGameUpdate.md. Zero code comments added; tools/check_conventions.py passes cleanly.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5571597736 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7856#pullrequestreview-5571597736). Originally posted by [fogydes](https://github.com/fogydes) on 2026-10-19T12:34:44Z. **Review:** COMMENTED --- Verified on Windows 11 with MinGW-w64 GCC 15.2.0 (Release): - **Error Codes & Ordering**: In `core/libs/prx/libSceGameUpdate/Export.cpp`, argument validation and lifecycle checks align with PS5 3.20 behaviour (returning `0x80412802` for duplicate initialization, `0x80412801` for uninitialized calls, `0x80412805` for invalid/unregistered request IDs, and checking pointers before initialization in `sceGameUpdateGetAddcontLatestVersion`). - **Structure Bounds**: `static_assert`s properly guard `GameUpdateCheckParam` and `GameUpdateCheckResult` against layout drift. - **Unit Testing**: Built `guest_gameupdate_tests.exe` and verified `ctest --test-dir build-libs -R "^guest_gameupdate$" -V` passes in 0.06s: ```text 1/1 Test #1104: guest_gameupdate ................. Passed 0.06 sec ``` All request parameter checks, double initialize/terminate, and null check fixtures passed. - **Conventions & Debt**: Technical debt documented in `docs/dev/debt/libSceGameUpdate.md`. Zero code comments added; `tools/check_conventions.py` passes cleanly.
adriadam10 commented 2026-10-20 02:48:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-20T02:48:23Z.


Checked against prosper's reading of the PS5 3.20 module (check order for Check, Abort, Delete, Initialize, Terminate, GetAddcontLatestVersion), the GameUpdateCheckParam/Result layouts (option at +8, 9 reserved words, 0x30 total), and the new test rows (they fail on main: Terminate before Initialize returned 0). The debt entry covers the unmodelled request slots; merged.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6282165473 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7856#issuecomment-6282165473). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-20T02:48:23Z. --- Checked against prosper's reading of the PS5 3.20 module (check order for `Check`, `Abort`, `Delete`, `Initialize`, `Terminate`, `GetAddcontLatestVersion`), the `GameUpdateCheckParam`/`Result` layouts (option at +8, 9 reserved words, 0x30 total), and the new test rows (they fail on `main`: `Terminate` before `Initialize` returned 0). The debt entry covers the unmodelled request slots; 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!7856
No description provided.