Skip to content

feat(libSceJson2): implement missing initialization entry points - #3483

Closed
Lorkydey wants to merge 2 commits into
boykopovar:mainfrom
Lorkydey:feat/json-init-parameters
Closed

Lorkydey wants to merge 2 commits into
boykopovar:mainfrom
Lorkydey:feat/json-init-parameters

Conversation

@Lorkydey

@Lorkydey Lorkydey commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Withdrawn in favor of #3495, an independent relinker fix with no Markdown changes. This JSON implementation remains available on its branch.


What

Implement the missing libSceJson2 initialization entry points tracked in #3348:

  • InitParameter2 base-object constructor (C2).
  • InitParameterRtti constructor.
  • InitParameterRtti2::setAllocatorRtti.
  • InitParameter2::setSpecialFloatFormatType.

Both InitParameter2 constructors initialize the full 40-byte object. The existing 24-byte representation left its format and reserved fields untouched. #2776 and #3043 report startup stops at the missing format setter; this change addresses those entry points, not overall game compatibility.

Carries screamm's implementation, as explicitly invited in #3348, preserving the author and commit message. It is rebased onto main, retaining the newer unrelated callback stub and technical-debt entries. A separate test commit adds guards around the 40-byte object, a file-buffer size above 32 bits, and checks that changing the format preserves the other fields.

The inferred layouts and unsupported behavior remain recorded in TechnicalDebt. Initialization still ignores the stored settings, and non-finite JSON serialization still throws. These semantics have not been measured on a console.

Tested

Windows x64, WinLibs MinGW-w64 GCC 15.2.0 (ucrt r7), CMake, Ninja, Release, BUILD_TESTING=ON:

  • cmake --build build --target guest_json_tests --parallel 6.

  • ctest --test-dir build -R '^guest_json$' --output-on-failure --no-tests=error: passed.

  • An isolated executable calling C2 against main's library throws InitParameter2C2Ev not implemented (exit 1). The same executable against the updated library verifies all 40 bytes are initialized and succeeds (exit 0).

  • python tools/check_conventions.py --base origin/main and git diff --check origin/main...HEAD: passed.

  • cmake --build build --parallel 10: full build passed on main 0f863c10 plus these two commits.

  • cmake --build build --target libs --parallel 10: passed; patched libraries are up to date.

  • python tools/check_test_registration.py build: passed.

No game execution or Linux runtime testing performed locally.

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 (no new dependencies)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

David and others added 2 commits October 11, 2026 13:15
…pecialFloatFormatType

Resident Evil 4 (PPSA07411, boykopovar#2776) and PRAGMATA (PPSA02530, boykopovar#3043) stop
on the absent export with

  what():  _ZN3sce4Json14InitParameter225setSpecialFloatFormatTypeENS0_22SpecialFloatFormatTypeE not implemented

Deathloop, Minecraft Legends and Cyberpunk import the base-object
constructor InitParameter2::InitParameter2(), InitParameterRtti2::
setAllocatorRtti and InitParameterRtti::InitParameterRtti(AllocParamRtti*,
void*, unsigned long), which were NotImplemented stubs.

InitParameter2 is the 40-byte object of SharpEmu and KytyPS5: the
allocator, its user data, the file buffer size and the 32-bit special
float format type at 0x18. Both constructors zero it, setAllocatorRtti
writes the allocation parameters and user data where setAllocator writes
the allocator, and setSpecialFloatFormatType stores the type.
InitParameterRtti's constructor writes its three arguments to the first
24 bytes. The NID WVZBP4IyM+E recomputes from the mangled name and is in
the aerolib database. The enum's values are unknown, so no value is
rejected; the inferred layouts are recorded in TechnicalDebt.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

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
#3469 docs/dev/TechnicalDebt.md L590

@github-actions

Copy link
Copy Markdown

Progress report (0f863c1 → 94d3771)

📈 System libraries: 85.84% (+0.1%, +4 implemented functions)

✅ 4 implemented
Library Name
libSceJson2 _ZN3sce4Json14InitParameter225setSpecialFloatFormatTypeENS0_22SpecialFloatFormatTypeE
libSceJson2 _ZN3sce4Json14InitParameter2C2Ev
libSceJson2 _ZN3sce4Json17InitParameterRttiC1EPNS0_14AllocParamRttiEPvm
libSceJson2 _ZN3sce4Json18InitParameterRtti216setAllocatorRttiEPNS0_14AllocParamRttiEPv

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.

1 participant