fix(libScePlayGo): take the chunk set from sce_sys/playgo-chunk.dat #3435

Merged
alfalfa-star merged 3 commits from upstream-pr/3435 into main 2026-10-11 10:36:22 +00:00
alfalfa-star commented 2026-10-11 10:31:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-11T10:31:23Z.


What

Since #3238, a dump without playgo-chunkdefs.xml accepts every chunk id. Unreal Engine 4 titles find their chunks by calling scePlayGoGetLocus for ids 0, 1, 2, ... until it returns SCE_PLAYGO_ERROR_BAD_CHUNK_ID (0x80B2000C). That error never comes now, so the loop never ends.

Title: RIDE 4 (PPSA01599, UE4) on main 8ec0e131 adds a chunk entry on every pass of that loop, on the main thread during engine pre-init. It stops a few seconds in, before any window, with:

PS5 Out of Memory:
    AvailablePhysical: 4901502976
    UsedPhysical:      9279373312
LowLevelFatalError [File:Unknown] [Line: 186]
Ran out of memory allocating 5565054976 bytes with alignment 65536

Under gdb, the loop is a virtual call per chunk index at app.elf+0x254f73f. That call returns 0 (stop) only when scePlayGoGetLocus returns 0x80B2000C. Its loop counter is an int while the chunk ids are uint16_t, so it wraps and never ends.

Fix

PS5 dumps do carry the package's chunk table: sce_sys/playgo-chunk.dat, magic plgx. The 16-bit value at offset 0x0A is the chunk count. In four dumps, exactly that many 0x20-byte chunk entries follow from offset 0x100, and the field at 0x10 is the file size:

Title count at 0x0A file size
RIDE 4 (PPSA01599) 35 0xA10
Persona 5 Royal (PPSA05110) 25 0x760
LEGO Horizon Adventures (PPSA14632) 1 0x1A0
Kena: Bridge of Spirits (PPSA01802) 1 0x1A0

The chunk set is now taken from these sources, in order:

  • playgo-chunkdefs.xml, unchanged.
  • Otherwise sce_sys/playgo-chunk.dat: ids 0 to count - 1 are valid, everything else returns BAD_CHUNK_ID, and scePlayGoGetChunkId reports the same set.
  • Otherwise, with neither file, every id is accepted as #3238 does. The titles #3238 was written for (Guardians of the Galaxy asking for ids 1-10, 007 First Light) keep working if their table lists those chunks. I don't have those dumps, so that part is unverified. @Tamalero, could you check it on PPSA01748?

The comment block above the chunk table described only the XML source, so it is removed. The TechnicalDebt entry now says where the set comes from and what is assumed about the plgx format.

Tested

Linux (Arch), GCC, Release, on main 99c1c263.

  • guest_playgo gets a new case. A child process runs from a root whose app0/sce_sys/playgo-chunk.dat declares 3 chunks:
    • ids 0-2 are reported as local;
    • {1, 3} returns 0x80B2000C;
    • scePlayGoGetChunkId counts 3.
  • The case aborts on main and passes with the fix. The existing no-file cases are unchanged.
  • RIDE 4 (PPSA01599) on main with this fix and two others for earlier stops (#3440, an unmap with a hole, and select on stdin, #2811) gets past pre-init. It renders the Unreal Engine logo and the legal screen, then stops at a #2548 shader.
  • tools/check_conventions.py passes.

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 specific to one title
  • Depends on: none
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4818411057 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3435). Originally posted by [alfalfa-star](https://github.com/alfalfa-star) on 2026-10-11T10:31:23Z. --- ### What Since #3238, a dump without `playgo-chunkdefs.xml` accepts every chunk id. Unreal Engine 4 titles find their chunks by calling `scePlayGoGetLocus` for ids 0, 1, 2, ... until it returns `SCE_PLAYGO_ERROR_BAD_CHUNK_ID` (`0x80B2000C`). That error never comes now, so the loop never ends. **Title:** RIDE 4 (PPSA01599, UE4) on main 8ec0e131 adds a chunk entry on every pass of that loop, on the main thread during engine pre-init. It stops a few seconds in, before any window, with: ```text PS5 Out of Memory: AvailablePhysical: 4901502976 UsedPhysical: 9279373312 LowLevelFatalError [File:Unknown] [Line: 186] Ran out of memory allocating 5565054976 bytes with alignment 65536 ``` Under gdb, the loop is a virtual call per chunk index at `app.elf+0x254f73f`. That call returns 0 (stop) only when `scePlayGoGetLocus` returns `0x80B2000C`. Its loop counter is an `int` while the chunk ids are `uint16_t`, so it wraps and never ends. ### Fix PS5 dumps do carry the package's chunk table: `sce_sys/playgo-chunk.dat`, magic `plgx`. The 16-bit value at offset 0x0A is the chunk count. In four dumps, exactly that many 0x20-byte chunk entries follow from offset 0x100, and the field at 0x10 is the file size: | Title | count at 0x0A | file size | |---|---|---| | RIDE 4 (PPSA01599) | 35 | 0xA10 | | Persona 5 Royal (PPSA05110) | 25 | 0x760 | | LEGO Horizon Adventures (PPSA14632) | 1 | 0x1A0 | | Kena: Bridge of Spirits (PPSA01802) | 1 | 0x1A0 | The chunk set is now taken from these sources, in order: - `playgo-chunkdefs.xml`, unchanged. - Otherwise `sce_sys/playgo-chunk.dat`: ids 0 to count - 1 are valid, everything else returns `BAD_CHUNK_ID`, and `scePlayGoGetChunkId` reports the same set. - Otherwise, with neither file, every id is accepted as #3238 does. The titles #3238 was written for (Guardians of the Galaxy asking for ids 1-10, 007 First Light) keep working if their table lists those chunks. I don't have those dumps, so that part is unverified. @Tamalero, could you check it on PPSA01748? The comment block above the chunk table described only the XML source, so it is removed. The TechnicalDebt entry now says where the set comes from and what is assumed about the `plgx` format. ### Tested Linux (Arch), GCC, Release, on main 99c1c263. - `guest_playgo` gets a new case. A child process runs from a root whose `app0/sce_sys/playgo-chunk.dat` declares 3 chunks: - ids 0-2 are reported as local; - `{1, 3}` returns `0x80B2000C`; - `scePlayGoGetChunkId` counts 3. - The case aborts on main and passes with the fix. The existing no-file cases are unchanged. - RIDE 4 (PPSA01599) on main with this fix and two others for earlier stops (#3440, an unmap with a hole, and `select` on stdin, #2811) gets past pre-init. It renders the Unreal Engine logo and the legal screen, then stops at a #2548 shader. - `tools/check_conventions.py` passes. ### 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 specific to one title - [x] Depends on: none - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
adriadam10 commented 2026-10-11 10:36:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T10:36:19Z.


Checked build and ctest (libs/PlayGo, 19 tests) on the PR merged onto main, and that guest_playgo fails without the change and passes with it. The chunk_count offset (0x0A) matches the PlayGo header layout in shadPS4. Assumption of contiguous ids is recorded in TechnicalDebt; merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108136953 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3435#issuecomment-6108136953). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T10:36:19Z. --- Checked build and ctest (libs/PlayGo, 19 tests) on the PR merged onto main, and that `guest_playgo` fails without the change and passes with it. The `chunk_count` offset (0x0A) matches the PlayGo header layout in shadPS4. Assumption of contiguous ids is recorded in TechnicalDebt; merging.
Tamalero commented 2026-10-11 21:48:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-11T21:48:36Z.


Checked on Guardians of the Galaxy (PPSA01748): it keeps working. Its dump has neither sce_sys/playgo-chunk.dat nor playgo-chunkdefs.xml, only sce_sys/playgo-scenario.json. So ReadPackageChunks returns false, the table stays undefined, and every chunk id is accepted as with #3238. The same holds for my Ratchet & Clank: Rift Apart (PPSA01474) and High on Life (PPSA15388) dumps, which have neither file either.

Run check: libScePlayGo.prx built from main cbd98bbd, swapped into my otherwise unchanged build. Guardians passes its chunk queries (ids 1-10) and renders to frame 1441 (one run). Without #3238 it stalls before the loading screen.

So for these three dumps the new path is never taken. I couldn't test the plgx table itself, since none of them has one.

Tested and written by Claude (AI assistant) on a contributor's machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114168635 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3435#issuecomment-6114168635). Originally posted by [Tamalero](https://github.com/Tamalero) on 2026-10-11T21:48:36Z. --- Checked on Guardians of the Galaxy (PPSA01748): it keeps working. Its dump has neither `sce_sys/playgo-chunk.dat` nor `playgo-chunkdefs.xml`, only `sce_sys/playgo-scenario.json`. So `ReadPackageChunks` returns false, the table stays undefined, and every chunk id is accepted as with #3238. The same holds for my Ratchet & Clank: Rift Apart (PPSA01474) and High on Life (PPSA15388) dumps, which have neither file either. Run check: `libScePlayGo.prx` built from `main` `cbd98bbd`, swapped into my otherwise unchanged build. Guardians passes its chunk queries (ids 1-10) and renders to frame 1441 (one run). Without #3238 it stalls before the loading screen. So for these three dumps the new path is never taken. I couldn't test the `plgx` table itself, since none of them has one. *Tested and written by Claude (AI assistant) on a contributor's machine.*
xXPBSXx commented 2026-10-12 13:30:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T13:30:42Z.


The change is now open as https://github.com/boykopovar/AnyPS5/pull/4491 (ids below 256 accepted without a chunk table; Sifu, Demon Slayer and Returnal numbers in its description). The chunk count read from playgo-chunk.dat (#3435) and the Guardians case of #3238 (ids 1 to 10) are unchanged.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6125289856 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3435#issuecomment-6125289856). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-12T13:30:42Z. --- The change is now open as https://github.com/boykopovar/AnyPS5/pull/4491 (ids below 256 accepted without a chunk table; Sifu, Demon Slayer and Returnal numbers in its description). The chunk count read from `playgo-chunk.dat` (#3435) and the Guardians case of #3238 (ids 1 to 10) are unchanged. AI-assisted (Claude Code).
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!3435
No description provided.