Skip to content

Match 50 PAL resident functions - #89

Merged
Lynder063 merged 1 commit into
OpenRAC:mainfrom
Sumaiter:decomp/pal-large-batch-06
Nov 3, 2026
Merged

Lynder063 merged 1 commit into
OpenRAC:mainfrom
Sumaiter:decomp/pal-large-batch-06

Conversation

@Sumaiter

@Sumaiter Sumaiter commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Adds matching C implementations for 50 previously undecompiled PAL resident functions (9,796 bytes). Cross-game comparison identified public RAC1/RAC2/RAC3 implementations useful for 28 of these reconstructions. Immutable donor commits, paths and functions are credited in config/pal/crossgame_sources.tsv, source comments and THIRD_PARTY_NOTICES.md. Fingerprints were used to find references; acceptance uses this game's PAL retail code.

The batch covers HUD and text helpers, packet generation, serialization/checksums, interpolation, visibility lookup, resource dispatch, menu callbacks, state updates and two core variadic forwarding wrappers. Interfaces were checked against actual callers and callees, including full 64-bit color forwarding, text and buffer pointers, callback argument types, output initialization and object extents. Candidates needing register pins, assembly barriers, unsupported padding or unproven shift bounds were excluded.

Adds 50 PAL match rows and corresponding US other rows while preserving all existing entries and their order. PAL matched code increases from 464,252 to 474,048 bytes (7.986549% to 8.155070%), and matched functions from 5,855 to 5,905. The US progress report is unchanged.

ByteMatch's Worse entry for func_00479E28 is a unit reclassification, not a code regression: the old func_004794F0 near miss covered that PAL address at 89.06%, while the new exact source covers the same address at 100%. The US report is unchanged.

Validation:

  • Rebuilt all 50 final translation units through the unchanged tools/cc.sh pipeline and compared them at their direct PAL catalogue addresses: 50/50 MATCH.
  • Independently resolved all 406 text relocation entries against PAL retail, including call targets, function pointers, HI16/LO16 addresses and GP-relative references. Checked locally defined small-data initializers against retail; PAL GP was derived from startup code.
  • Checked all 9 entries of the generated menu switch tables against the actual retail branch targets.
  • Five independent review groups found no call, global, constant or reference-metadata discrepancies.
  • Both versions' progress/source-map checks pass. Verified the exact PAL function/byte increase, unchanged US report, preservation of existing map rows, and that staged C source hashes equal the audited sources.
  • All 7 compiler-route behavior tests pass, and git diff --cached --check reports no whitespace errors.

The full repository build completed: 6,114 ordinary translation units, 11 libgcc objects and 26 libm objects. The US-retail-dependent audit_matches.py, audit_relocs.py and full match_map.py --write regeneration could not be completed because this checkout has no NTSC-U image or dumps (baserom/SCUS_974.65.elf and baserom/us/main.elf are absent; the PAL map writer also reads the US reference data). The 50 added PAL units were therefore verified directly as above, and their maps were updated incrementally with every old row preserved. Both committed progress/source-map checks pass. A linked game build and runtime test were not run. No compiler-pipeline changes, disc data, extracted binaries or assembly listings are included.

Co-Authored-By: Kimi Code <noreply@moonshot.cn>
@bytematchdev

bytematchdev Bot commented Nov 3, 2026

Copy link
Copy Markdown

ByteMatch progress report

SCES_532.85

Code matched 8.16% (+0.17%) · 474.05 KB of 5.81 MB
Fuzzy match 8.65% (+0.17%)
Functions 5,905 (+50) / 18,113
Units complete 3,164 (+50) / 3,223
✅ Newly matched (50)
  • func_0046D780 (552 bytes)
  • func_00454E18 (380 bytes)
  • func_0045F078 (352 bytes)
  • func_00476678 (348 bytes)
  • func_0044B268 (316 bytes)
  • func_004DFED8 (280 bytes)
  • func_004635A8 (276 bytes)
  • func_00469508 (276 bytes)
  • func_004493D8 (264 bytes)
  • func_0050EC18 (252 bytes)
  • func_005052D0 (244 bytes)
  • func_00505950 (244 bytes)
  • func_0050A1D8 (232 bytes)
  • func_0050C758 (232 bytes)
  • func_0048C420 (228 bytes)
  • func_00457BA0 (224 bytes)
  • func_004B2508 (224 bytes)
  • func_00447A00 (212 bytes)
  • func_004D9930 (212 bytes)
  • func_004749A0 (204 bytes)
  • func_004AA638 (204 bytes)
  • func_004C9590 (200 bytes)
  • func_004D4D38 (200 bytes)
  • func_00504F78 (200 bytes)
  • func_004C4648 (196 bytes)
  • func_004C4078 (192 bytes)
  • func_004F0B38 (192 bytes)
  • func_0045D6C0 (188 bytes)
  • func_00447AD8 (184 bytes)
  • func_00484EB0 (184 bytes)
  • …and 20 more
📉 Worse (1)
  • func_00479E28 89.06% → 0.00%

SCUS_974.65

Code matched 7.17% · 414.34 KB of 5.78 MB
Fuzzy match 7.73%
Functions 5,435 / 18,085
Units complete 2,839 / 2,899

No function changes.

Commit 523c06a · Ratchet: Deadlocked on ByteMatch

@Lynder063
Lynder063 merged commit 9d88a67 into OpenRAC:main Nov 3, 2026
1 check passed
Lynder063 added a commit that referenced this pull request Nov 3, 2026
Veradictus pushed a commit to chistianh/rac-deadlocked-decomp that referenced this pull request Nov 4, 2026
…, OpenRAC#88 and OpenRAC#89

map.tsv is the union of the rows those four PRs generated, in match_map.py's order.
Reports and README tables rebuilt with tools/progress.py.

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