Skip to content

feat(us): add native frontend routines with NTSC validation - #1

Merged
Veradictus merged 5 commits into
OpenRAC:masterfrom
llesieur99:codex/ntsc-float-setter-20261025
Oct 29, 2026
Merged

Veradictus merged 5 commits into
OpenRAC:masterfrom
llesieur99:codex/ntsc-float-setter-20261025

Conversation

@llesieur99

@llesieur99 llesieur99 commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add six native NTSC-U routines, in eight program placements:

Program Function Complete body Role
frontbin func_U_003EB578 12 bytes Store a float at state +0x50
boot_elf func_U_003F0D38 12 bytes The same setter's boot_elf copy
boot_elf func_U_003C4CB8 200 bytes Short-counter/state update and RGB extraction
boot_elf func_U_003E46B0 200 bytes State-derived ratio and two-float helper call
boot_elf func_U_00396860 296 bytes Update the thirteen-entry timer/fade/callback table
boot_elf func_U_003C18B0 296 bytes Initialize frontend labels and state from settings
frontbin func_U_003BC0F0 296 bytes The same initializer's frontbin copy
boot_elf func_U_003B82B8 1,108 bytes Select and draw frontend dialogs, with a compiler-generated jump table

The two agent waves add three 296-byte placements and the 1,108-byte dialog routine. The three 296-byte placements represent two distinct routines, not 888 unique bytes. The original two 12-byte placements are also one distinct frontend function, not 24 unique bytes. This does not claim that every frontend or level copy of the new routines is now compiled from C.

  • Keep existing counterpart file flags: the setters use their existing -mno-split-addresses recipe; the 200-byte routines and table update inherit @ps2as; the two initializer copies keep their default assembler. No per-function override, assembly instructions, register pin, barrier or byte substitution.
  • Both initializer copies retain the observed store through the resident address 0x001D4B4C, explicitly rather than hiding it behind a qualifier or instruction workaround. Literal-address accesses have existing repository precedent, but are called out here for review.
  • Check the RGB helper's three output-pointer stores and preserve the existing resident D_00142694[] declaration for the ratio routine. Typed helper interfaces replace unprototyped calls.
  • Reuse and attribute the NTSC decomp / the existing nonmatching/boot_elf/func_003E47F8.c draft; no SDK source or headers are imported.
  • Register all eight native sources and regenerate Bytematch names and the NTSC report with the repository tools.

Native objects with compiler-generated data

The dialog routine's stock C compile produces a 1,108-byte function, four text alignment bytes and 128 bytes of read-only jump-table/padding. Previously c_objects.py rejected all isolated native objects with extra sections even when the C matched.

Native core objects that pass the stock check can now use the existing whole-object files.tsv linker path. The build links the compiler's data section, not retail words substituted into C. Addresses come from the real relocations or the existing unique-data lookup; the whole-program comparison remains mandatory. Native named symbols are checked with NativeNames in both the isolated-text and whole-object paths. Shared objects retain their existing whole-PAL-file requirements, and native level data objects remain rejected. No compiler transform or flag override is added.

Twelve regression tests cover stock-match requirements, unchanged shared/level exclusions, single whole-object registration, wrong native symbol addresses, missing data placement and import without optional packages. The disassembler is loaded only when disassembly is requested; the full test suite also passes with Python -S. docs/versions.md documents the new native core path.

Verified locally

  • Stock tools/check.py --version us --native reports MATCH for all eight source files, with inherited flags.
  • c_objects.compile_one accepts all eight objects: seven text-only objects and the dialog whole object with its compiler-generated read-only table.
  • Every complete body equals retail without masks. The two setters have zero relocations; all six callers also pass independent SDK linker runs with the real named symbol addresses, exit0 and complete retail equality. The dialog's entire 128-byte relocated table also equals retail.
  • tools/asm_build.py --version us --c frontbin boot_elf, with the generic native whole-object support described above, completes with both programs MATCH: two functions from C in frontbin and six in boot_elf. Other functions were assembled in this focused validation build.
  • Broader regression: tools/asm_build.py --version us --c completes with 54 of 54 NTSC programs MATCH. This build uses the same eight C placements; every other function remains assembly, so this is not a full-C-corpus carry claim.
  • Separate inspection of the linked files confirms all eight C symbols at their expected addresses, their complete sizes and every non-BSS section identical to retail. The generated linker script takes the dialog's .rodata from the compiler object.
  • python tests/check_repository.py passes after regeneration.
  • python -S -m unittest discover -s tests: 36 tests pass, including twelve new native-object regression tests, without installed site packages.
  • git diff --check and scoped outgoing-content review pass; no game data, assembly dumps, objects, toolchains or private paths are included.

Full-program NTSC ELF SHA-1s checked by the build:

  • frontbin: 3bc94ee895e4b4af9b5602a229af599c1103b542
  • boot_elf: 487975305f8a263c750dfede50391b575ed07835

Why this is a draft

  • PAL full builds and compile-all pr_check.py have not been run: PAL inputs are not available in this environment.
  • The documented complete carry_us.sh workflow, with both discs and the full existing C set, still needs to be run before merge.
  • Refresh config/us/built.tsv through that canonical workflow before promoting these candidates into the exact progress figure.

The native map entries record the verified NTSC compile results, but are provisional integration metadata rather than a claim that the complete PAL/NTSC carry was run. config/us/built.tsv is unchanged. The generated report keeps exact matched_code=627004 and matched_functions=5671 unchanged; this PR does not advertise an exact progress increase or gameplay validation.

No PAL source or flag table is changed. Based on 403f30a9561324342c87802960eefbaaae13b372.

Add plain C for the NTSC frontend float setter and its boot_elf copy,
using their existing counterpart file flags. Regenerate the native source
map, Bytematch names and NTSC report without claiming an exact progress gain.

Verified both complete 12-byte bodies with the stock checker and both full
NTSC programs with the stock C insertion build. An independent linked-section
audit agrees; all 24 unit tests and the repository checker pass.

PAL full builds and the complete two-disc carry remain pending. Keep this as
a draft contribution until those gates and built.tsv are refreshed.
@bytematchdev

bytematchdev Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

ByteMatch progress report

SCUS_973.53

Code matched 8.35% · 627.00 KB of 7.51 MB
Fuzzy match 8.89% (+0.00%)
Functions 5,671 / 16,222
Units complete 298 / 397
✅ Newly matched (2)
  • func_003BC0F0 (296 bytes)
  • func_003EB578 (12 bytes)

SCES_524.56

Code matched 8.72% · 657.78 KB of 7.55 MB
Fuzzy match 8.72%
Functions 5,807 / 16,164
Units complete 281 / 424

No function changes.

Commit f1ec2cd · Ratchet & Clank: Up Your Arsenal on ByteMatch

Add the NTSC short-counter/RGB state update and the state-derived ratio
routine in their native boot_elf files. Each complete body is 200 bytes,
with the existing counterpart file's Ps2EeAs flags and typed helpers.

Stock compilation and independent SDK linkage match all bytes with zero
masks. Complete NTSC builds match with one C function in frontbin and
three in boot_elf; separate linked-section and symbol audits agree.

Regenerate native metadata without increasing the exact progress counts.
All 24 unit tests and the repository checks pass. PAL full builds and
the complete canonical carry remain pending; the PR stays a draft.
@llesieur99 llesieur99 changed the title feat(us): add native frontend float setter candidates feat(us): add native frontend routines with NTSC validation Oct 25, 2026
Add three native 296-byte placements with their unchanged counterpart file
flags. Credit the NTSC decomp drafts and keep globals external. Explicitly
retain the initializer's observed resident-address store for review.

Verified stock native C checks, independent SDK links with actual symbol
addresses and zero masks, and complete NTSC frontbin/boot_elf builds MATCH
with two/five C functions. Independent linked-section audit passes.
All24 unit tests and repository checks pass; exact counters are unchanged.

PAL full builds and the canonical two-disc carry remain unavailable, so
the PR stays draft and built.tsv is not refreshed or claimed as validated.
Add the1108-byte native dialog routine from the attributed NTSC draft, using
the original file flags. Its compiler-generated128-byte jump table is linked
through the existing whole-file path rather than replaced by retail words.

Allow stock-matching native core objects with private data into that path;
keep shared-file and native-level exclusions. Validate native symbol addresses
with NativeNames. Document the behavior and add11 regression tests.

Independent SDK link reproduces the complete routine and entire relocated
table with zero masks. Both focused NTSC program builds MATCH with frontbin2C
and boot_elf6C. Independent audit confirms all8 C symbols and every linked
non-BSS section against retail. All35 unit tests and repository checks pass.

PAL full builds and canonical two-disc carry remain pending. The PR stays
draft, built.tsv and exact C counters are unchanged, and no merge is attempted.
Load and configure rabbitizer only when code_section actually disassembles
code. Importing asm_build for pure metadata/link tests needs no disassembler.
Add a subprocess regression importing the module with Python -S.

All36 unit tests pass without site packages; no CI dependency installation
or weakened check is required. The disassembler configuration is unchanged.
@Veradictus
Veradictus marked this pull request as ready for review October 29, 2026 15:36
@Veradictus
Veradictus merged commit 44c86b7 into OpenRAC:master Oct 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants