fix(libkernel): read defaultLanguage from localizedParameters #710

Merged
merwie merged 1 commit from upstream-pr/710 into main 2026-10-05 23:16:36 +00:00
merwie commented 2026-10-05 17:31:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by merwie on 2026-10-05T17:31:54Z.


What

A PS5 param.json keeps defaultLanguage inside localizedParameters, next to the language entries:

"localizedParameters": {
  "defaultLanguage": "en-GB",
  "en-GB": { "titleName": "..." }
}

parseParamJson looked for defaultLanguage at the root only, then fell back to en-US and to the first member of localizedParameters. Without an en-US entry the first member is the defaultLanguage string, and the next lookup threw expected JSON object in param.json, which stops presentation ([videoout] presentation failed).

  • defaultLanguage is read from localizedParameters first, then from the root as before.
  • The last fallback takes the first member that is an object; a localizedParameters without one throws param.json localizedParameters has no language entry.
  • param_json_parser (from #661): new language cases — nested defaultLanguage with CRLF line endings and only en-GB, nested selection over en-US, fallback to en-US, the root-level defaultLanguage, and no language entry. With the parser change reverted the test fails with expected JSON object in param.json.

Tested

Windows 11, WinLibs GCC 15.2.0 r7, Ryzen 7 9800X3D, Radeon RX 9070 XT.

  • ctest (rebased on 2707b3a3): 315/317 passed, including param_json_parser. agc_driver_lds_atomics64 and agc_driver_vopc_compare_table fail on this machine on main as well (Vulkan device tests).
  • PPSA12544 (Hollow Knight: Silksong; localizedParameters holds defaultLanguage and en-GB only) with #698, #699, #700, #702, #705, #709, #648: the window title is read and the title continues to the Vulkan device and swapchain.

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:4748629790 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/710). Originally posted by [merwie](https://github.com/merwie) on 2026-10-05T17:31:54Z. --- ### What A PS5 `param.json` keeps `defaultLanguage` inside `localizedParameters`, next to the language entries: ```json "localizedParameters": { "defaultLanguage": "en-GB", "en-GB": { "titleName": "..." } } ``` `parseParamJson` looked for `defaultLanguage` at the root only, then fell back to `en-US` and to the first member of `localizedParameters`. Without an `en-US` entry the first member is the `defaultLanguage` string, and the next lookup threw `expected JSON object in param.json`, which stops presentation (`[videoout] presentation failed`). - `defaultLanguage` is read from `localizedParameters` first, then from the root as before. - The last fallback takes the first member that is an object; a `localizedParameters` without one throws `param.json localizedParameters has no language entry`. - `param_json_parser` (from #661): new language cases — nested `defaultLanguage` with CRLF line endings and only `en-GB`, nested selection over `en-US`, fallback to `en-US`, the root-level `defaultLanguage`, and no language entry. With the parser change reverted the test fails with `expected JSON object in param.json`. ### Tested Windows 11, WinLibs GCC 15.2.0 r7, Ryzen 7 9800X3D, Radeon RX 9070 XT. - `ctest` (rebased on `2707b3a3`): 315/317 passed, including `param_json_parser`. `agc_driver_lds_atomics64` and `agc_driver_vopc_compare_table` fail on this machine on `main` as well (Vulkan device tests). - PPSA12544 (Hollow Knight: Silksong; `localizedParameters` holds `defaultLanguage` and `en-GB` only) with #698, #699, #700, #702, #705, #709, #648: the window title is read and the title continues to the Vulkan device and swapchain. ### 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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in TechnicalDebt - [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)
oneandonlydean commented 2026-10-05 19:45:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-05T19:45:51Z.


Thanks, the parser change looks right to me. defaultLanguage is now read from localizedParameters first and from the root as before, the last fallback skips non-object members, and a localizedParameters without any language object now gives a clear error.

Two things about the test, though.

  1. On Linux the new param_json_parser test aborts (GCC 16, Release, with only this PR merged on main). The four parse cases pass, and the abort comes from the last Rejects(...) case: the std::runtime_error from parseParamJson is never caught, and the process aborts in _Unwind_RaiseException_Phase2, reached through _Unwind_Resume in main. None of these changed it: dropping the Remove guard, catching std::exception instead, or linking libkernel and using its copy of the parser instead of compiling ParamJsonParser.cpp into the test. #661's test catches exceptions from the same parser on Linux without trouble, so its setup may be the easier one to follow. The CI hasn't run on this PR yet, which is why it didn't show up there.
  2. #661 adds core/libs/tests/ParamJsonParser.cpp and a param_json_parser_tests / param_json_parser target too, in another place in core/libs/prx/libkernel/CMakeLists.txt. Git reports an add/add conflict on the test file. The two CMake blocks merge without a conflict, but together they define the same target twice, so CMake fails to configure. #661 has since landed, so could you rebase onto it, add your cases to its test file and drop your CMake block?

On PPSA21564: its param.json keeps defaultLanguage inside localizedParameters too, but it's en-US and there's an en-US entry, so main already picks the same title.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6001774825 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/710#issuecomment-6001774825). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-05T19:45:51Z. --- Thanks, the parser change looks right to me. `defaultLanguage` is now read from `localizedParameters` first and from the root as before, the last fallback skips non-object members, and a `localizedParameters` without any language object now gives a clear error. Two things about the test, though. 1. On Linux the new `param_json_parser` test aborts (GCC 16, Release, with only this PR merged on main). The four parse cases pass, and the abort comes from the last `Rejects(...)` case: the `std::runtime_error` from `parseParamJson` is never caught, and the process aborts in `_Unwind_RaiseException_Phase2`, reached through `_Unwind_Resume` in `main`. None of these changed it: dropping the `Remove` guard, catching `std::exception` instead, or linking `libkernel` and using its copy of the parser instead of compiling `ParamJsonParser.cpp` into the test. #661's test catches exceptions from the same parser on Linux without trouble, so its setup may be the easier one to follow. The CI hasn't run on this PR yet, which is why it didn't show up there. 2. #661 adds `core/libs/tests/ParamJsonParser.cpp` and a `param_json_parser_tests` / `param_json_parser` target too, in another place in `core/libs/prx/libkernel/CMakeLists.txt`. Git reports an add/add conflict on the test file. The two CMake blocks merge without a conflict, but together they define the same target twice, so CMake fails to configure. #661 has since landed, so could you rebase onto it, add your cases to its test file and drop your CMake block? On PPSA21564: its `param.json` keeps `defaultLanguage` inside `localizedParameters` too, but it's `en-US` and there's an `en-US` entry, so main already picks the same title.
merwie commented 2026-10-05 20:52:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by merwie on 2026-10-05T20:52:40Z.


Thanks for testing it on Linux. Rebased onto #661 and reworked the test as suggested:

  • my CMake block and test file are gone; the language cases are added to #661's ParamJsonParser.cpp (its Require/try structure, one shared temp file), and the PR now only touches the parser and that test file;
  • the case that expects a throw now runs inside #661's setup (linked against libkernel/libc, configure_windows_unwind), which you saw catching exceptions from the parser on Linux. I could not reproduce the abort here (Windows only), so a Linux run would be appreciated.

With the parser change reverted the test now fails cleanly with expected JSON object in param.json; with it, ctest 315/317 (the two agc_driver Vulkan tests that fail on this machine on main too).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6002706621 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/710#issuecomment-6002706621). Originally posted by [merwie](https://github.com/merwie) on 2026-10-05T20:52:40Z. --- Thanks for testing it on Linux. Rebased onto #661 and reworked the test as suggested: - my CMake block and test file are gone; the language cases are added to #661's `ParamJsonParser.cpp` (its `Require`/`try` structure, one shared temp file), and the PR now only touches the parser and that test file; - the case that expects a throw now runs inside #661's setup (linked against `libkernel`/`libc`, `configure_windows_unwind`), which you saw catching exceptions from the parser on Linux. I could not reproduce the abort here (Windows only), so a Linux run would be appreciated. With the parser change reverted the test now fails cleanly with `expected JSON object in param.json`; with it, `ctest` 315/317 (the two `agc_driver` Vulkan tests that fail on this machine on `main` too).
oneandonlydean commented 2026-10-05 22:57:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-05T22:57:00Z.


Thanks for reworking it. I ran it on Linux at 9489b85 (GCC 16, Release, with only this PR merged on main): param_json_parser passes, 20 of 20 repeats, so the abort I saw is gone with #661's setup.

With only the new test lines applied to main's parser, it fails with expected JSON object in param.json, as you describe, so the test covers the change. The parser change itself still looks right to me, and the PR now only touches the parser and #661's test file.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6004896094 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/710#issuecomment-6004896094). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-05T22:57:00Z. --- Thanks for reworking it. I ran it on Linux at 9489b85 (GCC 16, Release, with only this PR merged on main): `param_json_parser` passes, 20 of 20 repeats, so the abort I saw is gone with #661's setup. With only the new test lines applied to main's parser, it fails with `expected JSON object in param.json`, as you describe, so the test covers the change. The parser change itself still looks right to me, and the PR now only touches the parser and #661's test file.
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!710
No description provided.