feat(libkernel): read param.sfo when param.json is absent #5993

Merged
Get-fix merged 1 commit from upstream-pr/5993 into main 2026-10-18 14:50:35 +00:00
Get-fix commented 2026-10-14 18:37:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Get-fix on 2026-10-14T18:37:03Z.


What

PS4 titles and homebrew ship sce_sys/param.sfo instead of param.json. The OpenOrbis graphics, input and pngdec samples stop right after main: Creating a scene with what(): param.json not found. When param.json is absent, the application metadata now reads the title, title ID, download data size and user defined parameters from param.sfo, and /data and /download0 are mounted for it as for param.json. param.json is still preferred when both files exist.

The parser checks the PSF header, the table and entry bounds, string terminators, 32-bit integer entries, repeated keys and a negative download data size, and throws on each. The localized TITLE_00 to TITLE_30 are not selected by the console language; that is recorded in the libkernel debt file.

Part of the PS4 homebrew work tracked in #3093.

Tested

Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release, full build with BUILD_TESTING=ON, on main e442f4c2e:

  • param_sfo_parser (new), guest_app_info, param_json_parser and the download_data_mount_* cases, including the new sfo case: 9/9. guest_app_info checks that param.json wins over param.sfo and that a process with only param.sfo gets its title ID; download_data_mount_sfo starts a process whose run directory has only param.sfo and checks /data, /download0 and the title ID.
  • Each of these makes a test fail: preferring param.sfo; never reading it; not mounting /data or /download0 for it; ignoring integer entries; shifting the user parameters; not checking the entry count or the data length; accepting repeated keys or a negative download data size.
  • OpenOrbis samples with the other changes listed in #3093 (left out one at a time on main 84b01f9cd, all together on e442f4c2e): graphics, input and pngdec start with their own param.sfo.
  • tools/check_conventions.py --base origin/main passes.

Not tested on Linux.

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: OpenOrbis PS4 toolchain samples, #3093
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4862688093 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5993). Originally posted by [Get-fix](https://github.com/Get-fix) on 2026-10-14T18:37:03Z. --- ### What PS4 titles and homebrew ship `sce_sys/param.sfo` instead of `param.json`. The OpenOrbis graphics, input and pngdec samples stop right after `main: Creating a scene` with `what(): param.json not found`. When `param.json` is absent, the application metadata now reads the title, title ID, download data size and user defined parameters from `param.sfo`, and `/data` and `/download0` are mounted for it as for `param.json`. `param.json` is still preferred when both files exist. The parser checks the PSF header, the table and entry bounds, string terminators, 32-bit integer entries, repeated keys and a negative download data size, and throws on each. The localized `TITLE_00` to `TITLE_30` are not selected by the console language; that is recorded in the libkernel debt file. Part of the PS4 homebrew work tracked in #3093. ### Tested Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release, full build with `BUILD_TESTING=ON`, on `main` `e442f4c2e`: - `param_sfo_parser` (new), `guest_app_info`, `param_json_parser` and the `download_data_mount_*` cases, including the new `sfo` case: 9/9. `guest_app_info` checks that `param.json` wins over `param.sfo` and that a process with only `param.sfo` gets its title ID; `download_data_mount_sfo` starts a process whose run directory has only `param.sfo` and checks `/data`, `/download0` and the title ID. - Each of these makes a test fail: preferring `param.sfo`; never reading it; not mounting `/data` or `/download0` for it; ignoring integer entries; shifting the user parameters; not checking the entry count or the data length; accepting repeated keys or a negative download data size. - OpenOrbis samples with the other changes listed in #3093 (left out one at a time on `main` `84b01f9cd`, all together on `e442f4c2e`): graphics, input and pngdec start with their own `param.sfo`. - `tools/check_conventions.py --base origin/main` passes. Not tested on Linux. ### 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: OpenOrbis PS4 toolchain samples, #3093 - [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-14 18:42:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-14T18:42:58Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 6658 docs/dev/debt/libkernel.md L210
PR 6936 docs/dev/debt/libkernel.md L210
PR 6977 core/libs/prx/libkernel/AppMetadata/include/ParamSfoParser.hpp
core/libs/prx/libkernel/AppMetadata/src/ParamSfoParser.cpp
core/libs/tests/ParamSfoParser.cpp
PR 7049 docs/dev/debt/libkernel.md L210
PR 7105 docs/dev/debt/libkernel.md L210
PR 7149 docs/dev/debt/libkernel.md L210
PR 7447 docs/dev/debt/libkernel.md L210
PR 7464 docs/dev/debt/libkernel.md L210
PR 7509 docs/dev/debt/libkernel.md L210
PR 7556 docs/dev/debt/libkernel.md L210

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 4972 core/libs/prx/libkernel/CMakeLists.txt
PR 5021 core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libkernel.md
PR 5999 docs/dev/debt/libkernel.md
PR 6044 core/libs/prx/libkernel/CMakeLists.txt
core/libs/tests/GuestAppInfo.cpp
core/libs/tests/GuestDownloadDataMount.cpp
PR 6222 core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libkernel.md
PR 6510 docs/dev/debt/libkernel.md
PR 6534 docs/dev/debt/libkernel.md
PR 6908 core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libkernel.md
PR 7088 docs/dev/debt/libkernel.md
PR 7201 core/libs/prx/libkernel/CMakeLists.txt
PR 7299 core/libs/prx/libkernel/CMakeLists.txt
docs/dev/debt/libkernel.md
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6175696233 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5993#issuecomment-6175696233). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-14T18:42:58Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | [PR 6658](https://www.github.com/boykopovar/AnyPS5/pull/6658) | `docs/dev/debt/libkernel.md` [L210](https://github.com/boykopovar/AnyPS5/blob/e00260b6b38419e779845b352f051d9b69321649/docs/dev/debt/libkernel.md#L210) | | | | [PR 6936](https://www.github.com/boykopovar/AnyPS5/pull/6936) | `docs/dev/debt/libkernel.md` [L210](https://github.com/boykopovar/AnyPS5/blob/e00260b6b38419e779845b352f051d9b69321649/docs/dev/debt/libkernel.md#L210) | | | | [PR 6977](https://www.github.com/boykopovar/AnyPS5/pull/6977) | | | `core/libs/prx/libkernel/AppMetadata/include/ParamSfoParser.hpp`<br>`core/libs/prx/libkernel/AppMetadata/src/ParamSfoParser.cpp`<br>`core/libs/tests/ParamSfoParser.cpp` | | [PR 7049](https://www.github.com/boykopovar/AnyPS5/pull/7049) | `docs/dev/debt/libkernel.md` [L210](https://github.com/boykopovar/AnyPS5/blob/e00260b6b38419e779845b352f051d9b69321649/docs/dev/debt/libkernel.md#L210) | | | | [PR 7105](https://www.github.com/boykopovar/AnyPS5/pull/7105) | `docs/dev/debt/libkernel.md` [L210](https://github.com/boykopovar/AnyPS5/blob/e00260b6b38419e779845b352f051d9b69321649/docs/dev/debt/libkernel.md#L210) | | | | [PR 7149](https://www.github.com/boykopovar/AnyPS5/pull/7149) | `docs/dev/debt/libkernel.md` [L210](https://github.com/boykopovar/AnyPS5/blob/e00260b6b38419e779845b352f051d9b69321649/docs/dev/debt/libkernel.md#L210) | | | | [PR 7447](https://www.github.com/boykopovar/AnyPS5/pull/7447) | `docs/dev/debt/libkernel.md` [L210](https://github.com/boykopovar/AnyPS5/blob/e00260b6b38419e779845b352f051d9b69321649/docs/dev/debt/libkernel.md#L210) | | | | [PR 7464](https://www.github.com/boykopovar/AnyPS5/pull/7464) | `docs/dev/debt/libkernel.md` [L210](https://github.com/boykopovar/AnyPS5/blob/e00260b6b38419e779845b352f051d9b69321649/docs/dev/debt/libkernel.md#L210) | | | | [PR 7509](https://www.github.com/boykopovar/AnyPS5/pull/7509) | `docs/dev/debt/libkernel.md` [L210](https://github.com/boykopovar/AnyPS5/blob/e00260b6b38419e779845b352f051d9b69321649/docs/dev/debt/libkernel.md#L210) | | | | [PR 7556](https://www.github.com/boykopovar/AnyPS5/pull/7556) | `docs/dev/debt/libkernel.md` [L210](https://github.com/boykopovar/AnyPS5/blob/e00260b6b38419e779845b352f051d9b69321649/docs/dev/debt/libkernel.md#L210) | | | 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 4972](https://www.github.com/boykopovar/AnyPS5/pull/4972) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/prx/libkernel/CMakeLists.txt`<br>`docs/dev/debt/libkernel.md` | | [PR 5999](https://www.github.com/boykopovar/AnyPS5/pull/5999) | `docs/dev/debt/libkernel.md` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/prx/libkernel/CMakeLists.txt`<br>`core/libs/tests/GuestAppInfo.cpp`<br>`core/libs/tests/GuestDownloadDataMount.cpp` | | [PR 6222](https://www.github.com/boykopovar/AnyPS5/pull/6222) | `core/libs/prx/libkernel/CMakeLists.txt`<br>`docs/dev/debt/libkernel.md` | | [PR 6510](https://www.github.com/boykopovar/AnyPS5/pull/6510) | `docs/dev/debt/libkernel.md` | | [PR 6534](https://www.github.com/boykopovar/AnyPS5/pull/6534) | `docs/dev/debt/libkernel.md` | | [PR 6908](https://www.github.com/boykopovar/AnyPS5/pull/6908) | `core/libs/prx/libkernel/CMakeLists.txt`<br>`docs/dev/debt/libkernel.md` | | [PR 7088](https://www.github.com/boykopovar/AnyPS5/pull/7088) | `docs/dev/debt/libkernel.md` | | [PR 7201](https://www.github.com/boykopovar/AnyPS5/pull/7201) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 7299](https://www.github.com/boykopovar/AnyPS5/pull/7299) | `core/libs/prx/libkernel/CMakeLists.txt`<br>`docs/dev/debt/libkernel.md` |
Get-fix commented 2026-10-15 13:35:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Get-fix on 2026-10-15T13:35:11Z.


Rebased onto main (now Get-fix/AnyPS5@c8d40fc48) for the needs rebase label. main had added a bullet at the end of docs/dev/debt/libkernel.md, where this pull request adds its param.sfo bullet; both are kept. The code is unchanged. The param tests (param_sfo_parser, guest_app_info, param_json_parser, download_data_mount_*) pass on a full build of the rebased branch merged with main 92cdc7b62.

I checked the overlap the bot lists. I fetched each listed pull request and, for every file it shares with this one, merged its change with git merge-file into current main (a5e2a80c6) and into main with this pull request merged. A conflict that appears only in the second case is one this pull request adds.

The bot lists 61 pull requests, with 88 shared files between them. This pull request adds a conflict in two:

  • #5611 (virtual-query layout): both add a bullet at the end of docs/dev/debt/libkernel.md. Keeping both resolves it.
  • #6044 (test reorganisation, 500 files): it already conflicts with main in core/libs/prx/libkernel/CMakeLists.txt. The param_sfo_parser registration of this pull request sits next to lines #6044 rewrites, so whichever merges second registers one test in the other's style.

The other 59 merge the same with and without this pull request.

AI-assisted: yes (Claude Code). I ran these checks myself on Windows 11.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6193364572 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5993#issuecomment-6193364572). Originally posted by [Get-fix](https://github.com/Get-fix) on 2026-10-15T13:35:11Z. --- Rebased onto `main` (now Get-fix/AnyPS5@c8d40fc48) for the **needs rebase** label. `main` had added a bullet at the end of `docs/dev/debt/libkernel.md`, where this pull request adds its `param.sfo` bullet; both are kept. The code is unchanged. The param tests (`param_sfo_parser`, `guest_app_info`, `param_json_parser`, `download_data_mount_*`) pass on a full build of the rebased branch merged with `main` `92cdc7b62`. I checked the overlap the bot lists. I fetched each listed pull request and, for every file it shares with this one, merged its change with `git merge-file` into current `main` (`a5e2a80c6`) and into `main` with this pull request merged. A conflict that appears only in the second case is one this pull request adds. The bot lists 61 pull requests, with 88 shared files between them. This pull request adds a conflict in two: - **#5611** (virtual-query layout): both add a bullet at the end of `docs/dev/debt/libkernel.md`. Keeping both resolves it. - **#6044** (test reorganisation, 500 files): it already conflicts with `main` in `core/libs/prx/libkernel/CMakeLists.txt`. The `param_sfo_parser` registration of this pull request sits next to lines #6044 rewrites, so whichever merges second registers one test in the other's style. The other 59 merge the same with and without this pull request. AI-assisted: yes (Claude Code). I ran these checks myself on Windows 11. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Get-fix commented 2026-10-15 18:37:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Get-fix on 2026-10-15T18:37:12Z.


Rebased onto main 03c4cb5e7 (now Get-fix/AnyPS5@91117ec4d) for the needs rebase label. main had added a sceKernelVirtualQuery entry at the end of docs/dev/debt/libkernel.md, where this one adds its param.sfo entry; I kept both. main also added a lock in ensureTitleLoaded, which Git merged around this change's parseParams call; parseParams takes no lock, so the title is loaded once under it. In a build of main 03c4cb5e7 with my other open pull requests, guest_app_info, param_sfo_parser, param_json_parser, param_json_utf8 and the five download_data_mount_* tests pass, the full ctest passes except two tests this change does not touch (agc_driver_gpu_indirect_arguments_misaligned_writer_ahead does not compile with MinGW on main (#6452 fixes it), and prx_thread_local_destructors fails as it did on main 92cdc7b62 on this machine without my changes), and 15 of the 16 OpenOrbis sample programs start (networking was not run).

AI-assisted: yes (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6199512538 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5993#issuecomment-6199512538). Originally posted by [Get-fix](https://github.com/Get-fix) on 2026-10-15T18:37:12Z. --- Rebased onto `main` `03c4cb5e7` (now Get-fix/AnyPS5@91117ec4d) for the **needs rebase** label. `main` had added a `sceKernelVirtualQuery` entry at the end of `docs/dev/debt/libkernel.md`, where this one adds its `param.sfo` entry; I kept both. `main` also added a lock in `ensureTitleLoaded`, which Git merged around this change's `parseParams` call; `parseParams` takes no lock, so the title is loaded once under it. In a build of `main` `03c4cb5e7` with my other open pull requests, `guest_app_info`, `param_sfo_parser`, `param_json_parser`, `param_json_utf8` and the five `download_data_mount_*` tests pass, the full ctest passes except two tests this change does not touch (`agc_driver_gpu_indirect_arguments_misaligned_writer_ahead` does not compile with MinGW on `main` (#6452 fixes it), and `prx_thread_local_destructors` fails as it did on `main` `92cdc7b62` on this machine without my changes), and 15 of the 16 OpenOrbis sample programs start (`networking` was not run). AI-assisted: yes (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jotitadev commented 2026-10-15 20:04:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-15T20:04:13Z.

Review: COMMENTED


Linux run (Ubuntu 26.04, Intel i7-8700, GCC 15.2, full build, non-GPU tests), head 91117ec4d merged onto main 44df21632.

  • Builds; param_sfo_parser, param_json_parser, param_json_utf8, guest_app_info and the five download_data_mount_* cases (including the new sfo) pass, 9/9.
  • With AppMetadata.cpp from main (parser and tests kept): download_data_mount_sfo and guest_app_info abort; the other seven pass.

Non-GPU suite (ctest -E "^agc"): same result as main; only file_writer_binary and file_writer_text fail, and they fail on main too on this machine (Ubuntu 26.04 coreutils).

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5539186600 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5993#pullrequestreview-5539186600). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-15T20:04:13Z. **Review:** COMMENTED --- Linux run (Ubuntu 26.04, Intel i7-8700, GCC 15.2, full build, non-GPU tests), head `91117ec4d` merged onto `main` `44df21632`. - Builds; `param_sfo_parser`, `param_json_parser`, `param_json_utf8`, `guest_app_info` and the five `download_data_mount_*` cases (including the new `sfo`) pass, 9/9. - With `AppMetadata.cpp` from `main` (parser and tests kept): `download_data_mount_sfo` and `guest_app_info` abort; the other seven pass. Non-GPU suite (`ctest -E "^agc"`): same result as `main`; only `file_writer_binary` and `file_writer_text` fail, and they fail on `main` too on this machine (Ubuntu 26.04 coreutils). Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Get-fix commented 2026-10-15 23:26:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Get-fix on 2026-10-15T23:26:31Z.


Thanks for the Linux run, @jotitadev, and for checking that download_data_mount_sfo and guest_app_info fail with main's AppMetadata.cpp.

AI-assisted: yes (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6204395634 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5993#issuecomment-6204395634). Originally posted by [Get-fix](https://github.com/Get-fix) on 2026-10-15T23:26:31Z. --- Thanks for the Linux run, @jotitadev, and for checking that `download_data_mount_sfo` and `guest_app_info` fail with `main`'s `AppMetadata.cpp`. AI-assisted: yes (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/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!5993
No description provided.