fix(agc): return error for unsupported init versions #4835

Merged
MarcZX10 merged 1 commit from upstream-pr/4835 into main 2026-10-13 09:00:28 +00:00
MarcZX10 commented 2026-10-12 23:15:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T23:15:55Z.


What

Make sceAgcInit return AGC_ERROR_INVALID_ARGUMENT (0x80890001) when its version argument is outside AnyPS5's register-default tables. Keep the existing version 13 support. Add regressions for unsupported versions and the pointer-valued argument observed in PPSA99011. Record that OpenAGC accepts only versions 0–12 while AnyPS5 has a version 13 table, so the retail upper limit remains unverified. A contributor also reports that Prospero Win (PPSA99995) progresses into its launcher loop with this change, while PS5 FSR4 Showcase (PPSA99011) fails at its own vkCreateDevice check. Neither run establishes the console return value for an unsupported version.

Tested

  • Linux Debian 12, GCC 12.2 Release: built agc_command_tests; ctest --test-dir /tmp/AnyPS5-4808-build -R '^agc_initialization$' --output-on-failure passed (1/1).
  • Linux GCC 12 and MinGW GCC 12: changed C++ sources passed -std=c++20 -Wall -Wextra -Werror -fsyntax-only.
  • git diff --check passed.
  • python3 tools/check_conventions.py reports one unrelated existing finding: sceAgcDriverGetShaderDebuggingStatus in libSceAgcDriver/Unimplemented.cpp is documented under “Unknown function info,” while the checker expects a “Silent stubs” section. This PR does not change that export.
  • PPSA99011 was not rerun.

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: PPSA99011 #4808 (initialization error handling only; title not rerun)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4836106379 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4835). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T23:15:55Z. --- ### What Make `sceAgcInit` return `AGC_ERROR_INVALID_ARGUMENT` (`0x80890001`) when its version argument is outside AnyPS5's register-default tables. Keep the existing version 13 support. Add regressions for unsupported versions and the pointer-valued argument observed in PPSA99011. Record that OpenAGC accepts only versions 0–12 while AnyPS5 has a version 13 table, so the retail upper limit remains unverified. A contributor also reports that Prospero Win (PPSA99995) progresses into its launcher loop with this change, while PS5 FSR4 Showcase (PPSA99011) fails at its own `vkCreateDevice` check. Neither run establishes the console return value for an unsupported version. ### Tested - Linux Debian 12, GCC 12.2 Release: built `agc_command_tests`; `ctest --test-dir /tmp/AnyPS5-4808-build -R '^agc_initialization$' --output-on-failure` passed (1/1). - Linux GCC 12 and MinGW GCC 12: changed C++ sources passed `-std=c++20 -Wall -Wextra -Werror -fsyntax-only`. - `git diff --check` passed. - `python3 tools/check_conventions.py` reports one unrelated existing finding: `sceAgcDriverGetShaderDebuggingStatus` in `libSceAgcDriver/Unimplemented.cpp` is documented under “Unknown function info,” while the checker expects a “Silent stubs” section. This PR does not change that export. - PPSA99011 was not rerun. ### 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 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: PPSA99011 #4808 (initialization error handling only; title not rerun) - [x] AI-assisted: yes
babyhuey commented 2026-10-12 23:22:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-12T23:22:18Z.


Ran PS5 FSR4 Showcase (PPSA99011, --trap-sdk-syscall-stubs) with this PR on main 90c68394 (fork test/verify-agcinit 688d056b; it merges clean), on Linux (GCC 13) and Windows 11 (WinLibs GCC 15.2):

  • agc_initialization passes 5/5 on both, no warnings in Init.cpp or tests/Commands.cpp.
  • The throw is gone. The title runs on, then reports its own failure and exits 0:
    [debug:0] FSR4_SHOWCASE_BEGIN heap=0
    [debug:0] FSR4_SHOWCASE_ERROR vkCreateDevice(physical, &di, NULL, &device) = -3
    [debug:0] FSR4_SHOWCASE_END result=FAIL
    

That matches its source. It's built on mpereiraesaa/ps5-vulkan, which calls sceAgcInit(&state, sizeof(state)) and returns VK_ERROR_INITIALIZATION_FAILED (-3) for any non-zero result, after unloading module 0x80000094. So with 0x80890001 the title fails cleanly where it used to throw.

Whether it would get further on a console is still open. That port passes a pointer, while mihawk-99/PS5_Vulkan declares sceAgcInit(uint32_t version) and its hardware notes record that call succeeding.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6134514798 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4835#issuecomment-6134514798). Originally posted by [babyhuey](https://github.com/babyhuey) on 2026-10-12T23:22:18Z. --- Ran PS5 FSR4 Showcase (PPSA99011, `--trap-sdk-syscall-stubs`) with this PR on `main` 90c68394 (fork `test/verify-agcinit` 688d056b; it merges clean), on Linux (GCC 13) and Windows 11 (WinLibs GCC 15.2): - `agc_initialization` passes 5/5 on both, no warnings in `Init.cpp` or `tests/Commands.cpp`. - The throw is gone. The title runs on, then reports its own failure and exits 0: ``` [debug:0] FSR4_SHOWCASE_BEGIN heap=0 [debug:0] FSR4_SHOWCASE_ERROR vkCreateDevice(physical, &di, NULL, &device) = -3 [debug:0] FSR4_SHOWCASE_END result=FAIL ``` That matches its source. It's built on [mpereiraesaa/ps5-vulkan](https://github.com/mpereiraesaa/ps5-vulkan/blob/e6d3c3f82f3c/native/platform_ps5.c#L105-L112), which calls `sceAgcInit(&state, sizeof(state))` and returns `VK_ERROR_INITIALIZATION_FAILED` (-3) for any non-zero result, after unloading module `0x80000094`. So with `0x80890001` the title fails cleanly where it used to throw. Whether it would get further on a console is still open. That port passes a pointer, while [mihawk-99/PS5_Vulkan](https://github.com/mihawk-99/PS5_Vulkan/blob/main/driver/ps5vk_private.h) declares `sceAgcInit(uint32_t version)` and its hardware notes record that call succeeding.
oneandonlydean commented 2026-10-13 02:44:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T02:44:13Z.


Closing: 0x80890001 for an unknown version comes from OpenAGC and isn't measured, and with it PPSA99011 fails at its own check instead of the throw, so no title gets further. Reopen with what the console returns for sceAgcInit(&state, 8).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6137052497 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4835#issuecomment-6137052497). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T02:44:13Z. --- Closing: `0x80890001` for an unknown version comes from OpenAGC and isn't measured, and with it PPSA99011 fails at its own check instead of the throw, so no title gets further. Reopen with what the console returns for `sceAgcInit(&state, 8)`.
LeandroLP23 commented 2026-10-13 06:58:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-13T06:58:08Z.


One title does get further with this, which bears on the closing reason: Prospero Win (PPSA99995), the second title in #4808.

Windows 11 (26300), Radeon 860M, WinLibs GCC 15.2.0, Release. Head cbd615bb4 merged onto main 88107b7de, relinked with --windows, run for 60 s:

  • On main it throws sceAgcInit: unsupported register defaults version at start-up.
  • With this PR it keeps going. It mounts its data root, sets up keyboard and mouse, and enters its launcher loop, still running at 60 s. Its own record log shows:
    PW_WINE64 data_mount ... data_after=1 elevated_after=1 ... root=/data/prospero-win
    PW_WINE64 hid keyboard module=0x20000000 init=0 open=0x1 user=268435456
    PW_WINE64 launcher video=state pad=ok hid=ok frame=1 apps=0 cycle=0 refused=0 script=0
    
    apps=0 is because its game library is empty here.

PS5 FSR4 Showcase behaves as babyhuey reported: it fails at its own vkCreateDevice check. The point about the error value stands, since 0x80890001 is OpenAGC's, not measured. I'm only adding that, with a non-throwing result, Prospero Win runs.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6140115499 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4835#issuecomment-6140115499). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-13T06:58:08Z. --- One title does get further with this, which bears on the closing reason: **Prospero Win (PPSA99995)**, the second title in #4808. Windows 11 (26300), Radeon 860M, WinLibs GCC 15.2.0, Release. Head `cbd615bb4` merged onto `main` `88107b7de`, relinked with `--windows`, run for 60 s: - On `main` it throws `sceAgcInit: unsupported register defaults version` at start-up. - With this PR it keeps going. It mounts its data root, sets up keyboard and mouse, and enters its launcher loop, still running at 60 s. Its own record log shows: ``` PW_WINE64 data_mount ... data_after=1 elevated_after=1 ... root=/data/prospero-win PW_WINE64 hid keyboard module=0x20000000 init=0 open=0x1 user=268435456 PW_WINE64 launcher video=state pad=ok hid=ok frame=1 apps=0 cycle=0 refused=0 script=0 ``` `apps=0` is because its game library is empty here. PS5 FSR4 Showcase behaves as babyhuey reported: it fails at its own `vkCreateDevice` check. The point about the error value stands, since `0x80890001` is OpenAGC's, not measured. I'm only adding that, with a non-throwing result, Prospero Win runs. AI-assisted: yes (Claude Code)
MarcZX10 commented 2026-10-13 08:11:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T08:11:52Z.


Thanks for the Prospero Win run. It materially changes the earlier statement that no title gets further: the reported run reaches its launcher loop with this change. I updated the description to include that result and the separate FSR4 Showcase result, while keeping the limitation clear: neither run establishes the console return value for an unsupported version. The exact error mapping therefore remains unverified.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6141245205 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4835#issuecomment-6141245205). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T08:11:52Z. --- Thanks for the Prospero Win run. It materially changes the earlier statement that no title gets further: the reported run reaches its launcher loop with this change. I updated the description to include that result and the separate FSR4 Showcase result, while keeping the limitation clear: neither run establishes the console return value for an unsupported version. The exact error mapping therefore remains unverified.
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!4835
No description provided.