Skip to content

fix(libkernel): read defaultLanguage from localizedParameters - #710

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
merwie:fix/param-json-default-language
Oct 5, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
merwie:fix/param-json-default-language

Conversation

@merwie

@merwie merwie commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

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 fix(libkernel): preserve 64-bit metadata download sizes #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.

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

@oneandonlydean

Copy link
Copy Markdown
Collaborator

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. fix(libkernel): preserve 64-bit metadata download sizes #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. fix(libkernel): preserve 64-bit metadata download sizes #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. fix(libkernel): preserve 64-bit metadata download sizes #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.

A PS5 param.json keeps defaultLanguage inside localizedParameters, next to
the language entries. The parser looked for it at the root only, then fell
back to en-US and to the first member, which is the defaultLanguage string
when no en-US entry exists (PPSA12544 has only en-GB), and threw
"expected JSON object". defaultLanguage is now read from
localizedParameters first, and the fallback takes the first language
object.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@merwie
merwie force-pushed the fix/param-json-default-language branch from ee75ed3 to 9489b85 Compare October 5, 2026 20:52
@merwie

merwie commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

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

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).

@github-actions github-actions Bot added libkernel and removed needs rebase Conflicts with main, rebase needed labels Oct 5, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants