Skip to content

Match 57 NTSC-U functions - #92

Merged
Veradictus merged 1 commit into
OpenRAC:mainfrom
Clank700:claude/rac4-us-90-matches
Nov 6, 2026
Merged

Veradictus merged 1 commit into
OpenRAC:mainfrom
Clank700:claude/rac4-us-90-matches

Conversation

@Clank700

@Clank700 Clank700 commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

What

57 NTSC-U (SCUS_974.65) functions move from unmatched to matched, one C file each; one of them (func_L00_00528810) replaces its near miss in nonmatching/. US matched functions 5,435 → 5,492 (414,340 → 418,508 bytes), PAL 6,032 → 6,083 (497,616 → 501,564 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.

Every function here is new on both discs: none has a src/pal/ source on main, so no existing source or its credit moves (compared function by function in progress/report.json and progress/pal/report.json, per unit: no function name appears in two units with different percentages, and none of the existing functions gets worse or disappears).

This branch is rebased on current main (c78d917, after #90) and mergeable.

Compiler: 29 of the 57 files carry their own compiler flags

The default route (SN GCC 2.95.3, -O2 -G8 -fopt-stack) builds 28 of the files. The other 29 only match with a per-file header, which is how this repository already handles it (tools/build.sh reads /* cflags: ... */ from the first lines; nothing in the build scripts changes):

  • 23 files: @ee29, the Sony EE GCC 2.9 route. Not all of RAC4 was built with one compiler: besides the SN compiler, part of the library-like and glue code comes out of Sony's ee-gcc 2.9 (2.9-ee-991111). This repository already supports that whole-file route (commit ddfe94d, tools/cc.sh, docs/TOOLCHAIN.md "Sony EE GCC 2.9 route"); the token @ee29 in the first-line cflags selects it and defaults to -O2 -G0 (one file adds -O2 -G0 explicitly). These 23 functions do not match under the SN route at all, and match byte for byte under the Sony route. Supporting evidence from our own objects (not from the disc): all 23 start with sd saves of callee-saved registers, 21 of them at ascending 16-byte spacing (offsets 0, 0x10, 0x20, ...), which is the Sony 2.9 prologue style; SN 2.95.3 with -fopt-stack saves with 8-byte slots.
  • 6 files: -fno-schedule-insns variants (5 × -fno-schedule-insns, 1 × -fno-schedule-insns -fno-schedule-insns2), which the repository already uses in other sources; they turn off one or both instruction-scheduling passes of the SN compiler.

How we checked that the flag is actually needed: we compiled the 29 files again without their cflags line (default SN route) and ran the same strict comparison; all 29 fail (bytes differ at every one of their 40 placements). With their own header all 29 are exact.

A caveat we want to be honest about: matching under an alternative whole-file profile shows the code is compatible with that profile; it does not prove the historical flag set. The per-file header only states 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 (above). Plain C only: no inline assembly, register declarations or do { } while (0) shaping, and no source adapted from another project.

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

  • Build: all 6,298 sources of the head (outside src/libgcc and src/libm) compiled with each file's own flags, every compile's exit code logged: 0 non-zero. 6,292 objects come from a clean full build of the previous head of this branch (the sources of the head are identical to that tree except the 6 PAL files that main added since, which were compiled fresh); build/libgcc and build/libm are copied from an earlier full build, since src/ changes do not affect them.
  • tools/audit_matches.py: exit 0, 4,032 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. This is not new: the same lines are reported on main without this change (diffed line by line against a build of 60818dd; only the count of checked functions differs), and none of the 57 functions appears in them. CONTRIBUTING asks for 0, so we do not call this gate clean; the existing entries (54 call targets, 25 GPREL16, 1 HI16/LO16, in sources this PR does not touch) need a separate fix.
  • 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 all 57 functions (every catalogued level placement, 173 in all: code bytes with relocation fields masked, and every call target resolved at that placement's own level): 57 of 57 exact at every placement; negative controls (bytes of another function, call targets shifted by +4) are all rejected.
  • Our local rebuild of config/*/map.tsv also flips some unrelated rows (libm rows, because build/libm was not rebuilt here); those rows were restored to main's values, so the map diff contains only the new functions.
  • No overlap with the open PRs Match 45 NTSC-U helpers with pinned compiler profiles #71, Match 48 PAL resident functions and retain one nonmatching reconstruction #93, Match 26 NTSC-U functions #94, Match 50 PAL engine and menu functions #95, Match 165 PAL functions #96 and Match 198 NTSC-U functions converted from their PAL matches #97, by file, by function name or by PAL placement. Match 45 NTSC-U helpers with pinned compiler profiles #71 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

@bytematchdev

bytematchdev Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

ByteMatch progress report

SCES_532.85

Code matched 8.63% (+0.07%) · 501.56 KB of 5.81 MB
Fuzzy match 9.12% (+0.07%)
Functions 6,083 (+51) / 18,113
Units complete 3,270 / 3,329
✅ Newly matched (51)
  • func_L00_0077D4D0 (196 bytes)
  • func_L00_00528D10 (164 bytes)
  • func_L00_00507D18 (144 bytes)
  • func_L00_007722B8 (120 bytes)
  • func_L01_00575660 (116 bytes)
  • func_L00_004FF728 (112 bytes)
  • func_L01_0048BCD0 (104 bytes)
  • func_L00_005000C0 (104 bytes)
  • func_L00_00506868 (104 bytes)
  • func_L00_0052FBC0 (104 bytes)
  • func_L00_00541A28 (104 bytes)
  • func_L00_00541AE0 (104 bytes)
  • func_L00_00780CD0 (100 bytes)
  • func_L00_004FFFC0 (96 bytes)
  • func_L00_00540838 (96 bytes)
  • func_L00_00521408 (92 bytes)
  • func_L00_00508270 (88 bytes)
  • func_L00_00517468 (88 bytes)
  • func_L00_00714F98 (88 bytes)
  • func_L06_004C8B58 (84 bytes)
  • func_L00_00519B58 (84 bytes)
  • func_L41_003E33D0 (84 bytes)
  • func_L00_005082C8 (80 bytes)
  • func_L00_00517340 (80 bytes)
  • func_L00_00520AA8 (80 bytes)
  • func_L00_0074DFE8 (80 bytes)
  • func_L00_00719490 (76 bytes)
  • func_L00_00773630 (76 bytes)
  • func_L00_005303C8 (72 bytes)
  • func_L00_00538690 (72 bytes)
  • …and 21 more

SCUS_974.65

Code matched 7.24% (+0.07%) · 418.51 KB of 5.78 MB
Fuzzy match 7.80% (+0.07%)
Functions 5,492 (+57) / 18,085
Units complete 2,839 / 2,899
✅ Newly matched (57)
  • func_L00_007780F8 (196 bytes)
  • func_L00_00528810 (164 bytes)
  • func_L00_00507818 (144 bytes)
  • func_L00_0076D2A8 (120 bytes)
  • func_L01_00572A68 (116 bytes)
  • func_L00_004FF228 (112 bytes)
  • func_L01_0048A628 (104 bytes)
  • func_L00_004FFBC0 (104 bytes)
  • func_L00_00506368 (104 bytes)
  • func_L00_0052F6C0 (104 bytes)
  • func_L00_00541528 (104 bytes)
  • func_L00_005415E0 (104 bytes)
  • func_L00_0077B8F0 (100 bytes)
  • func_L00_004FFAC0 (96 bytes)
  • func_L00_00540338 (96 bytes)
  • func_L00_00520F08 (92 bytes)
  • func_L00_00507D70 (88 bytes)
  • func_L00_00516F68 (88 bytes)
  • func_L00_00711178 (88 bytes)
  • func_L06_004C7320 (84 bytes)
  • func_L00_00519658 (84 bytes)
  • func_L41_003E2B98 (84 bytes)
  • func_L00_00507DC8 (80 bytes)
  • func_L00_00516E40 (80 bytes)
  • func_L00_005205A8 (80 bytes)
  • func_L00_007493B8 (80 bytes)
  • func_L00_00715648 (76 bytes)
  • func_L00_0076E620 (76 bytes)
  • func_L00_0052FEC8 (72 bytes)
  • func_L00_00538190 (72 bytes)
  • …and 27 more

Commit 4349a29 · Ratchet: Deadlocked on ByteMatch

@Clank700
Clank700 force-pushed the claude/rac4-us-90-matches branch from df1eff5 to 5c7d8a5 Compare November 3, 2026 22:14
@Clank700
Clank700 marked this pull request as draft November 3, 2026 22:14
@Clank700 Clank700 changed the title Match 90 NTSC-U functions Match 57 NTSC-U functions Nov 3, 2026
57 resident-menu, game and overlay functions now match the US disc, one C
file each (one of them replaces its near miss in nonmatching/). The C is
built with each file's own flags: 28 files use the defaults, 23 the Sony EE
GCC 2.9 route already used by the repository (@ee29) and 6 a
-fno-schedule-insns variant, each stated in the file header. Every function
is new on both discs: none has a src/pal/ source on main, so no existing
source or its credit moves. Main program and levels: 5,435 -> 5,492
functions on US (414,340 -> 418,508 bytes), 6,032 -> 6,083 on PAL.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Clank700
Clank700 force-pushed the claude/rac4-us-90-matches branch from 5c7d8a5 to 4349a29 Compare November 4, 2026 17:47
@Clank700
Clank700 marked this pull request as ready for review November 4, 2026 17:51
@Clank700 Clank700 mentioned this pull request Nov 4, 2026
@Veradictus
Veradictus merged commit e7982af into OpenRAC:main Nov 6, 2026
1 check passed
Veradictus added a commit that referenced this pull request Nov 6, 2026
The L00 menu, L41 and func_00454400 matches from #92 and #98 read globals
through literal addresses (0x2233A4, 0x22323C, 0x2213C8, 0x21DE8C,
0x21DFF0). Declare them as externs; every function still matches.
Veradictus added a commit that referenced this pull request Nov 6, 2026
Maps and reports regenerated from a full build after merging #71 and
#92-#106.
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