fix(kernel): read a zero flexibleMemorySize in param.json as the default budget #5865

Merged
billythemenace2 merged 1 commit from upstream-pr/5865 into main 2026-10-15 21:01:25 +00:00
billythemenace2 commented 2026-10-14 14:06:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by billythemenace2 on 2026-10-14T14:06:00Z.


Requested by billy

What

Before: a title whose param.json declares "kernel": {"flexibleMemorySize": 0} stopped at start-up with "param.json kernel.flexibleMemorySize must be a positive multiple of 16 KiB". SONIC SUPERSTARS (PPSA06888) ships exactly that value, so since 72211b70f (#4508) it no longer starts.

After: a zero size leaves the default flexible memory budget, as an absent key or an absent kernel object already does. Sizes that are not a multiple of 16 KiB, negative numbers and non-integers are still rejected.

How

parseParamJson sets flexibleMemorySizeBytes only for a non-zero size. The parser test now checks that 0 gives no value instead of listing it as rejected.

Tested

Windows 11, MinGW-w64 GCC, Release. param_json_parser and param_json_utf8 pass. SONIC SUPERSTARS (PPSA06888) now gets past start-up and mounts its save data on this branch. It then stops on the 1D T# access that #5375 and #5456 address. Not tested: Linux, macOS.

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: PPSA06888 (SONIC SUPERSTARS) #5382
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4859138573 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5865). Originally posted by [billythemenace2](https://github.com/billythemenace2) on 2026-10-14T14:06:00Z. --- <!-- claude-projects-attribution --> _Requested by **billy**_ ### What Before: a title whose `param.json` declares `"kernel": {"flexibleMemorySize": 0}` stopped at start-up with "param.json kernel.flexibleMemorySize must be a positive multiple of 16 KiB". SONIC SUPERSTARS (PPSA06888) ships exactly that value, so since 72211b70f (#4508) it no longer starts. After: a zero size leaves the default flexible memory budget, as an absent key or an absent `kernel` object already does. Sizes that are not a multiple of 16 KiB, negative numbers and non-integers are still rejected. ### How `parseParamJson` sets `flexibleMemorySizeBytes` only for a non-zero size. The parser test now checks that `0` gives no value instead of listing it as rejected. ### Tested Windows 11, MinGW-w64 GCC, Release. `param_json_parser` and `param_json_utf8` pass. SONIC SUPERSTARS (PPSA06888) now gets past start-up and mounts its save data on this branch. It then stops on the 1D T# access that #5375 and #5456 address. Not tested: Linux, macOS. ### 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: PPSA06888 (SONIC SUPERSTARS) #5382 - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Dextroid17 commented 2026-10-15 02:09:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-15T02:09:45Z.


I ran this PR's test on Linux.

Setup: this PR's diff applied to main at 8cd937e29 (the PR's base is 490 commits behind it), default CMake build (CMAKE_BUILD_TYPE empty, unoptimized), clean environment. ctest -R '^param_json_parser$', 3 runs each. The test did not open a GPU device, so this is a CPU-only run.

  • with this PR: 3 of 3 pass.
  • with AppMetadata/src/ParamJsonParser.cpp put back to main's version (the new test kept): 3 of 3 abort with no message. A backtrace of one more run under gdb shows it aborting while an exception unwinds through the test's main (_Unwind_Resume → _Unwind_RaiseException_Phase2 → abort). Main's parser throws "must be a positive multiple of 16 KiB" for "flexibleMemorySize":0, which the new case passes in outside a try.

So the new zero case fails without the fix here. I did not check Windows or macOS.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6182792452 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5865#issuecomment-6182792452). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-15T02:09:45Z. --- I ran this PR's test on Linux. Setup: this PR's diff applied to main at 8cd937e29 (the PR's base is 490 commits behind it), default CMake build (CMAKE_BUILD_TYPE empty, unoptimized), clean environment. `ctest -R '^param_json_parser$'`, 3 runs each. The test did not open a GPU device, so this is a CPU-only run. - with this PR: 3 of 3 pass. - with AppMetadata/src/ParamJsonParser.cpp put back to main's version (the new test kept): 3 of 3 abort with no message. A backtrace of one more run under gdb shows it aborting while an exception unwinds through the test's `main` (`_Unwind_Resume` → `_Unwind_RaiseException_Phase2` → `abort`). Main's parser throws "must be a positive multiple of 16 KiB" for `"flexibleMemorySize":0`, which the new case passes in outside a try. So the new zero case fails without the fix here. I did not check Windows or macOS. AI-assisted: yes
THEMANnt commented 2026-10-15 06:48:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-15T06:48:06Z.


Update — 2026-10-18

Retested ANIMAL WELL (PPSA22520), v01.000.011, on unmodified main 9caecfd2d5a822be9daf84c69c7c33c7fafe52b9 with rebuilt main libraries. Original metadata, including kernel.flexibleMemorySize: 0, is unchanged. Startup, New Game and the opening room now work without a separate PR kernel, metadata override or local source patch. Late opening-scene trace intervals were approximately 60 presents/s; this is a short observation, not a full-game benchmark.

The reporter additionally confirms audio, save reload and extended play work on this updated runtime. Two bounded automated runs ended at their requested duration limits with no detected fatal error. Later-area confirmation in the original report below refers to the earlier runtime.

System: Windows 11 Pro x64 build 26200, Ryzen 7 7800X3D, RTX 5070 Ti, NVIDIA 616.92, approximately 31 GiB usable RAM; Release, WinLibs GCC 15.2.0 r7.

Earlier PR-specific validation is retained below as history. AI-assisted testing/report: yes.


Confirmed for ANIMAL WELL (PPSA22520), content version 01.000.011, with the original game metadata unchanged.

Setup: Windows x64 (build 26200), Ryzen 7 7800X3D, NVIDIA RTX 5070 Ti, WinLibs GCC 15.2.0 r7, Release.

I cherry-picked this PR's change at 3c81a744bdf7f7898b64d0516c03cc1ac2697e1e onto main d92a8dad390af1807cc91622b924252141816a5a, rebuilt libkernel, and substituted only the patched libkernel.prx in a separate test runtime. The converted executable and every other deployed library were identical to the baseline. No metadata workaround or title-specific shim was used. Controller inputs used APS5_PAD_INPUT_FILE.

  • Before: unmodified main aborted during startup with:
    param.json kernel.flexibleMemorySize must be a positive multiple of 16 KiB
    
    The original metadata contains "kernel": {"flexibleMemorySize": 0}.
  • With this PR: startup selected the normal default:
    [memory] configured flexible memory: 0x1c000000 bytes (448 MiB)
    
    New Game and the opening rooms rendered, movement/jump inputs were exercised, and a save file was created. The run stayed alive for the full 180-second check with no fatal error logged; the test harness then stopped it.
  • param_json_parser and param_json_utf8 each passed three consecutive runs (ctest --repeat until-fail:3).

This confirms the startup fix for Animal Well in discussion #966. The automated check covered 180 seconds of opening gameplay. Additional hands-on testing by the reporter confirms that audio, save reload, later areas, and long-term stability have also been checked and are working.

AI-assisted testing/report: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6186248871 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5865#issuecomment-6186248871). Originally posted by [THEMANnt](https://github.com/THEMANnt) on 2026-10-15T06:48:06Z. --- ### Update — 2026-10-18 Retested **ANIMAL WELL (PPSA22520), v01.000.011**, on unmodified main `9caecfd2d5a822be9daf84c69c7c33c7fafe52b9` with rebuilt main libraries. Original metadata, including `kernel.flexibleMemorySize: 0`, is unchanged. Startup, New Game and the opening room now work without a separate PR kernel, metadata override or local source patch. Late opening-scene trace intervals were approximately 60 presents/s; this is a short observation, not a full-game benchmark. The reporter additionally confirms **audio, save reload and extended play work on this updated runtime**. Two bounded automated runs ended at their requested duration limits with no detected fatal error. Later-area confirmation in the original report below refers to the earlier runtime. System: Windows 11 Pro x64 build 26200, Ryzen 7 7800X3D, RTX 5070 Ti, NVIDIA 616.92, approximately 31 GiB usable RAM; Release, WinLibs GCC 15.2.0 r7. Earlier PR-specific validation is retained below as history. AI-assisted testing/report: yes. --- Confirmed for **ANIMAL WELL (PPSA22520), content version 01.000.011**, with the original game metadata unchanged. Setup: Windows x64 (build 26200), Ryzen 7 7800X3D, NVIDIA RTX 5070 Ti, WinLibs GCC 15.2.0 r7, Release. I cherry-picked this PR's change at `3c81a744bdf7f7898b64d0516c03cc1ac2697e1e` onto main `d92a8dad390af1807cc91622b924252141816a5a`, rebuilt libkernel, and substituted only the patched `libkernel.prx` in a separate test runtime. The converted executable and every other deployed library were identical to the baseline. No metadata workaround or title-specific shim was used. Controller inputs used `APS5_PAD_INPUT_FILE`. - **Before:** unmodified main aborted during startup with: ```text param.json kernel.flexibleMemorySize must be a positive multiple of 16 KiB ``` The original metadata contains `"kernel": {"flexibleMemorySize": 0}`. - **With this PR:** startup selected the normal default: ```text [memory] configured flexible memory: 0x1c000000 bytes (448 MiB) ``` New Game and the opening rooms rendered, movement/jump inputs were exercised, and a save file was created. The run stayed alive for the full 180-second check with no fatal error logged; the test harness then stopped it. - `param_json_parser` and `param_json_utf8` each passed three consecutive runs (`ctest --repeat until-fail:3`). This confirms the startup fix for Animal Well in discussion #966. The automated check covered 180 seconds of opening gameplay. Additional hands-on testing by the reporter confirms that audio, save reload, later areas, and long-term stability have also been checked and are working. AI-assisted testing/report: yes.
github-actions[bot] commented 2026-10-15 12:10:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:10:38Z.


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 1835 core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp
core/libs/tests/ParamJsonParser.cpp
PR 3891 core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp
core/libs/tests/ParamJsonParser.cpp
PR 4156 core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp
core/libs/tests/ParamJsonParser.cpp
PR 4396 core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp
core/libs/tests/ParamJsonParser.cpp
PR 4397 core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp
core/libs/tests/ParamJsonParser.cpp
PR 4422 core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp
core/libs/tests/ParamJsonParser.cpp
PR 4423 core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp
core/libs/tests/ParamJsonParser.cpp
PR 4424 core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp
core/libs/tests/ParamJsonParser.cpp
PR 4520 core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp
core/libs/tests/ParamJsonParser.cpp
PR 4521 core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp
core/libs/tests/ParamJsonParser.cpp
PR 4522 core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp
core/libs/tests/ParamJsonParser.cpp
PR 4523 core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp
core/libs/tests/ParamJsonParser.cpp
PR 4566 core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp
core/libs/tests/ParamJsonParser.cpp
PR 4599 core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp
core/libs/tests/ParamJsonParser.cpp
PR 4718 core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp
core/libs/tests/ParamJsonParser.cpp
PR 4740 core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp
core/libs/tests/ParamJsonParser.cpp
PR 4749 core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp
core/libs/tests/ParamJsonParser.cpp
PR 4760 core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp
core/libs/tests/ParamJsonParser.cpp
PR 4813 core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp
core/libs/tests/ParamJsonParser.cpp
PR 5021 core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp
core/libs/tests/ParamJsonParser.cpp
PR 6044 core/libs/tests/ParamJsonParser.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6191721865 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5865#issuecomment-6191721865). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-15T12:10:38Z. --- <!-- 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 1835](https://www.github.com/boykopovar/AnyPS5/pull/1835) | `core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp`<br>`core/libs/tests/ParamJsonParser.cpp` | | [PR 3891](https://www.github.com/boykopovar/AnyPS5/pull/3891) | `core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp`<br>`core/libs/tests/ParamJsonParser.cpp` | | [PR 4156](https://www.github.com/boykopovar/AnyPS5/pull/4156) | `core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp`<br>`core/libs/tests/ParamJsonParser.cpp` | | [PR 4396](https://www.github.com/boykopovar/AnyPS5/pull/4396) | `core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp`<br>`core/libs/tests/ParamJsonParser.cpp` | | [PR 4397](https://www.github.com/boykopovar/AnyPS5/pull/4397) | `core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp`<br>`core/libs/tests/ParamJsonParser.cpp` | | [PR 4422](https://www.github.com/boykopovar/AnyPS5/pull/4422) | `core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp`<br>`core/libs/tests/ParamJsonParser.cpp` | | [PR 4423](https://www.github.com/boykopovar/AnyPS5/pull/4423) | `core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp`<br>`core/libs/tests/ParamJsonParser.cpp` | | [PR 4424](https://www.github.com/boykopovar/AnyPS5/pull/4424) | `core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp`<br>`core/libs/tests/ParamJsonParser.cpp` | | [PR 4520](https://www.github.com/boykopovar/AnyPS5/pull/4520) | `core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp`<br>`core/libs/tests/ParamJsonParser.cpp` | | [PR 4521](https://www.github.com/boykopovar/AnyPS5/pull/4521) | `core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp`<br>`core/libs/tests/ParamJsonParser.cpp` | | [PR 4522](https://www.github.com/boykopovar/AnyPS5/pull/4522) | `core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp`<br>`core/libs/tests/ParamJsonParser.cpp` | | [PR 4523](https://www.github.com/boykopovar/AnyPS5/pull/4523) | `core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp`<br>`core/libs/tests/ParamJsonParser.cpp` | | [PR 4566](https://www.github.com/boykopovar/AnyPS5/pull/4566) | `core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp`<br>`core/libs/tests/ParamJsonParser.cpp` | | [PR 4599](https://www.github.com/boykopovar/AnyPS5/pull/4599) | `core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp`<br>`core/libs/tests/ParamJsonParser.cpp` | | [PR 4718](https://www.github.com/boykopovar/AnyPS5/pull/4718) | `core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp`<br>`core/libs/tests/ParamJsonParser.cpp` | | [PR 4740](https://www.github.com/boykopovar/AnyPS5/pull/4740) | `core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp`<br>`core/libs/tests/ParamJsonParser.cpp` | | [PR 4749](https://www.github.com/boykopovar/AnyPS5/pull/4749) | `core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp`<br>`core/libs/tests/ParamJsonParser.cpp` | | [PR 4760](https://www.github.com/boykopovar/AnyPS5/pull/4760) | `core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp`<br>`core/libs/tests/ParamJsonParser.cpp` | | [PR 4813](https://www.github.com/boykopovar/AnyPS5/pull/4813) | `core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp`<br>`core/libs/tests/ParamJsonParser.cpp` | | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/prx/libkernel/AppMetadata/src/ParamJsonParser.cpp`<br>`core/libs/tests/ParamJsonParser.cpp` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/ParamJsonParser.cpp` |
adriadam10 commented 2026-10-15 13:51:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T13:51:08Z.


Checked that flexibleMemorySize: 0 now leaves the default budget while non-multiples of 16 KiB, negatives and non-integers are still rejected. Build and tests pass (173 tests, param_json_parser included), and the new zero case fails against main's parser. Matches the Linux run by @Dextroid17 and the Animal Well run by @THEMANnt; merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6193704431 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5865#issuecomment-6193704431). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-15T13:51:08Z. --- Checked that `flexibleMemorySize: 0` now leaves the default budget while non-multiples of 16 KiB, negatives and non-integers are still rejected. Build and tests pass (173 tests, `param_json_parser` included), and the new zero case fails against main's parser. Matches the Linux run by @Dextroid17 and the Animal Well run by @THEMANnt; merging.
notaxeltv commented 2026-10-15 19:17:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by notaxeltv on 2026-10-15T19:17:30Z.


Confirmed on PPSA22520 (ANIMAL WELL v01.000.011): stock sce_sys/param.json has kernel.flexibleMemorySize: 0, and current main aborts at start with param.json kernel.flexibleMemorySize must be a positive multiple of 16 KiB. Removing the kernel object (same as treating 0 as absent / default 448 MiB) lets the title create the Vulkan swapchain and run (textures, mouse, shader cache writes). Windows 10, RTX 3080.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6200320212 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5865#issuecomment-6200320212). Originally posted by [notaxeltv](https://github.com/notaxeltv) on 2026-10-15T19:17:30Z. --- Confirmed on PPSA22520 (ANIMAL WELL v01.000.011): stock `sce_sys/param.json` has `kernel.flexibleMemorySize: 0`, and current `main` aborts at start with `param.json kernel.flexibleMemorySize must be a positive multiple of 16 KiB`. Removing the `kernel` object (same as treating 0 as absent / default 448 MiB) lets the title create the Vulkan swapchain and run (textures, mouse, shader cache writes). Windows 10, RTX 3080.
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!5865
No description provided.