Skip to content

feat(pal): carry 59 functions from their v1.01 C - #418

Merged
llesieur99 merged 1 commit into
OpenRAC:masterfrom
cadelass:match/pal-50hz-carry
Nov 4, 2026
Merged

llesieur99 merged 1 commit into
OpenRAC:masterfrom
cadelass:match/pal-50hz-carry

Conversation

@cadelass

@cadelass cadelass commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

What

59 PAL-only functions (func_PAL_…) in C: 48,232 bytes over 294 places in the 27 levels. All match PAL (SCES_516.07), every place.

Each one has the same instructions as a v1.01 function that already has matched C. Its unit in src/pal/ is that C, changed only where PAL's bytes differ:

  • 50 Hz values:
    • frame counts: 30 → 25, 60 → 50, 90 → 75, 120 → 100, 270 → 225, 600 → 500;
    • per-frame steps: 1/60 → 1/50, 2π/60 → 2π/50;
    • per-frame² accelerations, scaled by (60/50)²: gravity −1/720 → −1/500, 0.0025 → 0.0036.
  • Callees that are PAL's own functions take their func_PAL_ names.
  • A few integer ids take PAL's values (for example 0x27BE → 0x1310 in func_PAL_L03_003CAA68).

Several PAL constants are one ulp off the exact quotient (0x3CA3D70B for 1/50, 0x3E4CCCCE for 1/5). They are written as the shortest decimal that gives those bits (0.020000001f, 0.20000002f). Each unit's header names its v1.01 twin and lists what changed.

The unit's flags are its v1.01 file's: the F7 copies keep -malign-loops=2, for example. One reference needed PAL's catalogue name: the 8-byte callback that func_PAL_L10_00423AA0 passes is func_L00_00410D18 in PAL.

Pairing: I compared opcode sequences of PAL's remaining functions with the matched v1.01 ones, and kept only same-size pairs at 97% or more. 158 such pairs exist. These 59 are the ones whose differences map onto the C and that then match every place with no compiler warnings. The others stay INCLUDE_ASM, for example:

  • 21 menu accessors func_PAL_L00_0030F*, each passing its own address constant;
  • pairs whose differences are struct offsets, not constants.

No nonmatching/ notes are added.

The 59 functions
PAL function v1.01 C Bytes Places
func_PAL_L00_002AB0C0 func_L00_002AB1D8 520 27
func_PAL_L00_002B3E90 func_L00_002B3F68 592 27
func_PAL_L00_002D5380 func_L00_002D4E58 420 27
func_PAL_L00_003B1D70 func_L00_003AE550 944 27
func_PAL_L00_003BFBD8 func_L00_003BBF48 312 27
func_PAL_L00_003F9B90 func_L00_003F5750 288 27
func_PAL_L00_004033A8 func_L00_003FEAC8 212 27
func_PAL_L00_00430308 func_L00_0042AD98 672 13
func_PAL_L02_00335678 func_L02_00333480 452 9
func_PAL_L02_0038CE70 func_L02_00389F70 152 7
func_PAL_L01_002A8B30 func_L01_002A8C48 540 6
func_PAL_L06_003E8240 func_L06_003E4BE0 808 5
func_PAL_L05_0037C968 func_L05_0037A218 992 4
func_PAL_L05_00447F28 func_L05_00441D40 352 4
func_PAL_L12_0040CBA0 func_L12_00408050 424 4
func_PAL_L05_00432530 func_L05_0042C928 424 3
func_PAL_L18_003FDE80 func_L18_003F9DA0 176 3
func_PAL_L02_00405E88 func_L02_00401530 264 2
func_PAL_L03_003DDB50 func_L03_003D9820 224 2
func_PAL_L04_0033EB40 func_L04_0033CC00 1216 2
func_PAL_L04_0040B8B8 func_L04_004073E8 948 2
func_PAL_L13_003F0F10 func_L13_003ECD48 348 2
func_PAL_L00_004138A0 func_L00_0040EAA0 1540 1
func_PAL_L01_003D5C30 func_L01_003D1A48 1268 1
func_PAL_L01_00414828 func_L01_0040F5A8 944 1
func_PAL_L01_00415E78 func_L00_0040EAA0 1540 1
func_PAL_L01_00432438 func_L01_0042C8D8 1440 1
func_PAL_L02_003D62B8 func_L02_003D2248 328 1
func_PAL_L02_00402030 func_L02_003FD8B8 1328 1
func_PAL_L02_0043F638 func_L00_0040EAA0 1540 1
func_PAL_L03_003CAA68 func_L03_003C6A28 1060 1
func_PAL_L03_003CBB00 func_L03_003C7AC0 864 1
func_PAL_L03_00423F28 func_L03_0041EAE0 1196 1
func_PAL_L04_003F16D8 func_L04_003ED740 1264 1
func_PAL_L05_00419C60 func_L00_0040EAA0 1540 1
func_PAL_L06_00405FA8 func_L06_00402230 528 1
func_PAL_L06_0045ACC8 func_L00_0040EAA0 1540 1
func_PAL_L07_003FC8D0 func_L07_003F80B8 888 1
func_PAL_L08_003DD458 func_L08_003D92D8 1212 1
func_PAL_L09_00408290 func_L09_00403398 872 1
func_PAL_L10_0041A730 func_L00_0040EAA0 1540 1
func_PAL_L10_00423AA0 func_L10_0041EC10 316 1
func_PAL_L11_003E0D58 func_L11_003DCEB0 436 1
func_PAL_L11_0043C288 func_L11_00436D08 632 1
func_PAL_L11_0043D438 func_L11_00437EA8 292 1
func_PAL_L11_00445BB8 func_L11_00440360 1068 1
func_PAL_L11_004460C0 func_L11_00440868 264 1
func_PAL_L11_0044BC30 func_L11_004461E8 1040 1
func_PAL_L11_00458020 func_L11_00452450 956 1
func_PAL_L11_00467118 func_L11_00461308 1236 1
func_PAL_L11_00473908 func_L00_0040EAA0 1540 1
func_PAL_L11_004791F0 func_L11_00472E10 896 1
func_PAL_L12_0041C930 func_L00_0040EAA0 1540 1
func_PAL_L13_00421C68 func_L00_0040EAA0 1540 1
func_PAL_L17_003D0B70 func_L17_003CC850 608 1
func_PAL_L19_00425AE0 func_L19_004203F0 1064 1
func_PAL_L20_003A1940 func_L20_0039E9F8 444 1
func_PAL_L20_00449750 func_L20_00443CF0 100 1
func_PAL_L20_00449870 func_L20_00443DF0 548 1

Checked

On origin/master 21cf0111, with the compiler rebuilt from it:

  • python3 tools/build.py all --strict --version pal: 28 programs OK.
  • python3 tools/build.py all --strict: 28 programs OK. The v1.01 build is unchanged; the branch only adds src/pal/ files and their config/cflags.txt lines.
  • python3 tools/check.py <function> --version pal: every place matches, for each of the 59.
  • python3 -m unittest discover -s tests: 382 tests OK.
  • python3 tests/check_repository.py: passed.
  • python3 tools/progress.py --check: passed.

USA v2.00 was not run: I don't have its dump. These are PAL-only functions, so v2.00 doesn't have them. progress/ reports and the README table are not touched.

🤖 Generated with Claude Code

Each is a PAL-only function whose code has the same instructions as a matched
v1.01 function. The C is v1.01's, with PAL's 50 Hz values (frame counts,
per-frame steps, (60/50)^2 accelerations), its own callees and its text ids.

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

bytematchdev Bot commented Nov 4, 2026

Copy link
Copy Markdown

ByteMatch progress report

SCES_516.07

Code matched 55.43% · 3.16 MB of 5.70 MB
Fuzzy match 55.43%
Functions 7,156 / 8,671
Data matched 0.00%
Units complete 990 / 1,217

No function changes.

SCUS_972.68

Code matched 90.31% · 4.99 MB of 5.53 MB
Fuzzy match 90.31%
Functions 8,096 / 8,578
Data matched 0.00%
Units complete 972 / 1,060

No function changes.

SCUS_972.68_v2

Code matched 84.86% · 4.73 MB of 5.58 MB
Fuzzy match 84.86%
Functions 7,870 / 8,633
Data matched 0.00%
Units complete 1,015 / 1,188

No function changes.

Commit 07bf086 · Ratchet & Clank: Going Commando on ByteMatch

@llesieur99
llesieur99 merged commit acf5ae4 into OpenRAC:master Nov 4, 2026
2 checks passed
bigbeno37 pushed a commit to bigbeno37/rac2-decomp that referenced this pull request Nov 4, 2026
Match func_L01_00390A50 (528 bytes) and func_002CD3C0 (284 bytes), adding
812 distinct USA v1.01 bytes and 46 carrying C placements. Group the real
forced-trigger arm, use canonical point/volume calls, and separate the UI
coordinate from its later owner pointer.

Restore the caller-supplied owner in two existing setup helpers and
explicitly forward all four FP bounds through the three regional rectangle
wrappers. Their complete objects remain unchanged. A native 32-bit C regression
covers the context, flags, bounds and null path in all regions; its prior-
source control detects the missing FP arguments.

Retain fourteen bounded near misses with their new allocation, alignment,
copy and ABI constraints. Remove obsolete matching/functional drafts and
their index entries rather than leaving parallel implementations.

Validation: 84 loaded images equal retail with zero C fallbacks; strict
USA/US2 builds preserved under an equivalent-input guard, PAL rebuilt after
upstream OpenRAC#418; all 46 new C placements verified, 168 owner-hook and 84
forwarder placements controlled; 383 unit tests; repository and three
progress checks. README/report bytes unchanged.
bigbeno37 added a commit that referenced this pull request Nov 5, 2026
tools/build.py all --strict on master 236cfdf (after #416, #417, #418,
#420, 4b786ab, 4d6e47b and 236cfdf): 28 programs OK in each of us,
pal and us2. tools/progress.py for each release; --check --strict passes
for all three.

US 8,173 of 8,584 (91.80%), PAL 7,242 of 8,677 (56.58%),
US2 7,932 of 8,639 (86.02%).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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