Skip to content

Match 99 NTSC-U functions - #98

Draft
Clank700 wants to merge 1 commit into
OpenRAC:mainfrom
Clank700:claude/rac4-us-next
Draft

Clank700 wants to merge 1 commit into
OpenRAC:mainfrom
Clank700:claude/rac4-us-next

Conversation

@Clank700

@Clank700 Clank700 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

What

99 NTSC-U (SCUS_974.65) functions move from unmatched to matched, one C file each; 12 of them replace their near miss in nonmatching/ (file and README row removed). US matched functions 5,435 → 5,534 (414,340 → 421,364 bytes), PAL 6,032 → 6,084 (497,616 → 501,228 bytes). config/us/map.tsv, config/pal/map.tsv, both progress reports and the README table are regenerated with the repository tools; only the rows of the new sources changed (our local libm rows, which differ because build/libm was not rebuilt, were restored to main's values).

Every function here is new on both discs: none has a src/pal/ source, so no existing source or its credit moves (no function name appears in two units with different percentages in config/us/map.tsv or config/pal/map.tsv, on main or here). Functions already matched on main, in open PRs (#71, #92, #93 to #97), PAL twins of existing src/pal/ sources and anything that would add an audit_matches.py or audit_relocs.py entry were left out on purpose.

Compiler: 19 of the 99 files carry their own flags

80 files build with the default route (SN GCC 2.95.3, -O2 -G8 -fopt-stack). The other 19 need a per-file header, as the repository already does elsewhere (tools/build.sh reads /* cflags: ... */ from the first lines; nothing in the build scripts changes):

  • 5 files: @ee29, the Sony EE GCC 2.9 route (4 × @ee29, 1 × @ee29 -O2 -G0). Part of the library-like and glue code was built with Sony's ee-gcc 2.9 rather than the SN compiler. The repository already supports this whole-file route (commit ddfe94d, tools/cc.sh, docs/TOOLCHAIN.md "Sony EE GCC 2.9 route"). These functions start with sd saves of callee-saved registers at ascending 16-byte spacing, which is the Sony 2.9 prologue style (SN 2.95.3 with -fopt-stack saves with 8-byte slots).
  • 5 files: -fno-schedule-insns variants (3 × -fno-schedule-insns -fno-schedule-insns2, 2 × -fno-schedule-insns), which the repository already uses in other sources.
  • 4 files -mno-split-addresses (+1 combined with -G0), 1 -G0, 1 -fno-opt-stack, 1 -ffast-math, 1 redundant -O2 -G8 (the default; harmless).

Matching under a per-file profile shows the code is compatible with that profile; it does not prove the historical flag set. The header states only what reproduces the bytes.

How the C was found

Reconstructed from the retail code of this repository (our assembly, m2c) and made to match by compiling with the file's own flags, then checked function by function. Plain C only: no inline assembly, register declarations, M2C_ macros or do { } while (0) shaping, and no source adapted from another project. Declarations of callees were aligned to the existing definitions where that leaves the compiled object byte-identical; three of the new definitions differ in return type from declarations in older files that were not touched (that kind of mismatch already exists on main for about 5% of the definitions).

Checks (clean build of every source of this exact head, on top of main c78d917)

  • Build of all 6,340 sources (outside src/libgcc and src/libm) with each file's own flags; build/libgcc and build/libm come from an earlier full build (src/ changes do not affect them).
  • tools/audit_matches.py: exit 0, 4,021 exact, 3 not exact (the same 3 as on main: func_00161890, func_00547A98, func_L01_004F3100).
  • tools/audit_relocs.py (with the overlay ELFs): exit 1, 80 mismatches in 43 functions, 3 unresolved, identical to main (line by line against a build of 60818dd; only the count of checked functions differs). CONTRIBUTING asks for 0, so we do not call this gate clean; those entries are in sources this PR does not touch.
  • tools/match_map.py --check and tools/progress.py --check, for US and --version pal: all exit 0.
  • Beyond the repository tools, a per-placement check of the new functions (every catalogued level placement: code bytes with relocation fields masked, and every call target resolved at that placement's own level): no byte difference and no call-target mismatch at any placement that could be checked; negative controls (bytes of another function, call targets shifted by +4) are all rejected.
  • Overlap with other open PRs: Match 57 NTSC-U functions #92 (57 NTSC-U functions) also edits the maps, reports and README, so whichever of the two lands second needs tools/match_map.py --write / tools/progress.py run again.

🤖 Generated with Claude Code

99 resident-menu, game, net and overlay functions now match the US disc, one
C file each (12 of them replace their near miss in nonmatching/). 80 files
build with the default route; 19 carry a per-file cflags header (Sony EE GCC
2.9 route @ee29, -fno-schedule-insns variants, -mno-split-addresses and a few
single flags). Every function is new on both discs: none has a src/pal/
source, so no existing source or its credit moves. Main program and levels:
5,435 -> 5,534 functions on US (414,340 -> 421,364 bytes), 6,032 -> 6,084 on
PAL.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@bytematchdev

bytematchdev Bot commented Nov 4, 2026

Copy link
Copy Markdown

ByteMatch progress report

SCES_532.85

Code matched 8.62% (+0.06%) · 501.23 KB of 5.81 MB
Fuzzy match 9.10% (+0.05%)
Functions 6,084 (+52) / 18,113
Units complete 3,282 (+12) / 3,341
✅ Newly matched (72)
  • func_L00_0051B458 (264 bytes)
  • func_004E8BD8 (224 bytes)
  • func_L00_00673950 (192 bytes)
  • func_00148800 (180 bytes)
  • func_005014E0 (180 bytes)
  • func_00502150 (180 bytes)
  • func_L01_005A9BF0 (176 bytes)
  • func_00425150 (164 bytes)
  • func_004E87F8 (164 bytes)
  • func_004D3708 (156 bytes)
  • func_004A0818 (152 bytes)
  • func_004B8F28 (152 bytes)
  • func_004BE4F0 (144 bytes)
  • func_004B1800 (140 bytes)
  • func_004A8A28 (136 bytes)
  • func_004B4CE8 (136 bytes)
  • func_L00_00519550 (136 bytes)
  • func_00473078 (128 bytes)
  • func_004E9020 (112 bytes)
  • func_L00_00538758 (112 bytes)
  • func_L01_00435C00 (104 bytes)
  • func_0050F2A0 (96 bytes)
  • func_L00_0077A8A8 (96 bytes)
  • func_0045EA10 (88 bytes)
  • func_00502BB8 (88 bytes)
  • func_L01_0041CB10 (84 bytes)
  • func_L01_0046A340 (84 bytes)
  • func_L41_003E3428 (84 bytes)
  • func_0045FC28 (80 bytes)
  • func_00464878 (80 bytes)
  • …and 42 more
⚠️ No longer matching (20)
  • func_004E8BD8 100.00% → 0.00%
  • func_005014E0 100.00% → 0.00%
  • func_00502150 100.00% → 0.00%
  • func_004E87F8 100.00% → 0.00%
  • func_004D3708 100.00% → 0.00%
  • func_004A0818 100.00% → 0.00%
  • func_004B8F28 100.00% → 0.00%
  • func_004BE4F0 100.00% → 0.00%
  • func_004B1800 100.00% → 0.00%
  • func_004A8A28 100.00% → 0.00%
  • func_004B4CE8 100.00% → 0.00%
  • func_0045EA10 100.00% → 0.00%
  • func_00502BB8 100.00% → 0.00%
  • func_0045FC28 100.00% → 0.00%
  • func_00464878 100.00% → 0.00%
  • func_0053DDA0 100.00% → 0.00%
  • func_0045CF60 100.00% → 0.00%
  • func_0049CF38 100.00% → 0.00%
  • func_0049CF80 100.00% → 0.00%
  • func_00498590 100.00% → 0.00%
📉 Worse (9)
  • func_00148800 88.89% → 0.00%
  • func_00473078 89.06% → 0.00%
  • func_01EEFE4C 91.67% → 0.00%
  • func_01EACB58 86.67% → 0.00%
  • func_01ED2DC0 88.46% → 0.00%
  • func_01F07D98 87.50% → 0.00%
  • func_01F07E5C 87.50% → 0.00%
  • func_01F07F20 87.50% → 0.00%
  • func_01E9B240 90.00% → 0.00%

SCUS_974.65

Code matched 7.29% (+0.12%) · 421.36 KB of 5.78 MB
Fuzzy match 7.83% (+0.11%)
Functions 5,534 (+99) / 18,085
Units complete 2,872 (+33) / 2,932
✅ Newly matched (99)
  • func_L00_0051AF58 (264 bytes)
  • func_004E7CB0 (224 bytes)
  • func_L00_006702E0 (192 bytes)
  • func_00148800 (180 bytes)
  • func_00500470 (180 bytes)
  • func_005010E0 (180 bytes)
  • func_L01_005A5878 (176 bytes)
  • func_00424F40 (164 bytes)
  • func_004E78D0 (164 bytes)
  • func_004D27F8 (156 bytes)
  • func_0049FAE0 (152 bytes)
  • func_004B8038 (152 bytes)
  • func_004BD6F0 (144 bytes)
  • func_004B0970 (140 bytes)
  • func_004A7CB8 (136 bytes)
  • func_004B3E20 (136 bytes)
  • func_L00_00519050 (136 bytes)
  • func_00472798 (128 bytes)
  • func_004E80F8 (112 bytes)
  • func_L00_00538258 (112 bytes)
  • func_L01_00434DB0 (104 bytes)
  • func_L41_00625FE0 (104 bytes)
  • func_0050E208 (96 bytes)
  • func_L00_007754D0 (96 bytes)
  • func_0045E1F8 (88 bytes)
  • func_00501B48 (88 bytes)
  • func_L01_0041BF10 (84 bytes)
  • func_L01_00468F58 (84 bytes)
  • func_L01_0064E8F0 (84 bytes)
  • func_L41_003E2BF0 (84 bytes)
  • …and 69 more
📉 Worse (10)
  • func_00148800 88.89% → 0.00%
  • func_00472798 89.06% → 0.00%
  • func_01EEFE4C 91.67% → 0.00%
  • func_01EACB58 86.67% → 0.00%
  • func_01ED2DC0 88.46% → 0.00%
  • func_01F07D98 87.50% → 0.00%
  • func_01F07E5C 87.50% → 0.00%
  • func_01F07F20 87.50% → 0.00%
  • func_01E9B240 90.00% → 0.00%
  • func_00497938 89.29% → 0.00%

Commit 1843712 · Ratchet: Deadlocked on ByteMatch

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.

1 participant