Skip to content

feat(src): four functions in C (sky renderers, level-8 emitter, beam), three original assembly routines - #425

Open
DrLegitamate wants to merge 4 commits into
OpenRAC:masterfrom
DrLegitamate:match/drlegitamate-near-misses
Open

DrLegitamate wants to merge 4 commits into
OpenRAC:masterfrom
DrLegitamate:match/drlegitamate-near-misses

Conversation

@DrLegitamate

@DrLegitamate DrLegitamate commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Four functions in C (USA v1.01: 59 placements):

Function Size Places File
func_002E3998 572 boot + 27 levels src/game/002E10B8-sky-g8.c (new)
func_002E3BD8 628 boot + 27 levels src/game/002E10B8-sky-g8.c (new)
func_L08_0041E790 756 levels 8, 19 src/levels/shared/L08_0041E790-g8.c (new, -O2 -G8 -ffunction-sections -g)
func_00308768 1600 boot src/game/00308600-uv-g8.c (new, default -G8)
  • The two sky piece renderers' earlier near misses passed a fourth argument to the handwritten
    func_002E3E54, which takes three: its body never reads $a3, as its functional C already said.
    With the real interface both match. Recorded in docs/MATCHING-BLOCKERS.md.
  • func_L08_0041E790: the retained draft matches unchanged on the current compiler (the missing
    division nop was fixed in 1e7eac4).
  • func_00308768: found by re-measuring every unreserved retained near miss on the current
    compiler. Its draft (adapted from RAC1, approved SDATA aliases only) now matches unchanged.
    Two other drafts that now match were left out: func_003136D0 needs 15 dead initial values
    (over the ruled limit of five) and func_L00_003ADCD8 needs an ad-hoc swap asm. Note: commit
    6375003 adds this function's unit, which fd24afe left out by mistake; squashing them is fine.

Three original assembly routines (ASM_FUNC, AGENTS.md "Handwritten assembly", second
criterion, so this needs a maintainer's agreement): func_002A05A8, func_002A0F48,
func_002A1490 in src/game/002A0430.c. Trapping add/addi/sub throughout (29, 7, 32),
$at as a working register in all three; func_002A0F48 also has 31 VU0 macro/COP2 instructions,
func_002A1490 has no return (it leaves by jumps, like func_002A1130), and func_002A05A8 has
two cvt.w.s words in an encoding the compiler does not emit. No RAC1 identity is claimed.

Near-miss records: func_L03_0041DAD0 improves from 8 to 7 rows without the earlier
const declarations; dated notes for func_L18_0043FFF8, func_L02_002EFB60 and
func_L00_00426C78 (plus its missing README row) record what tied, so it is not repeated.
The superseded near-miss and functional entries of the three matched functions are removed.

Checks run

  • python3 tools/build.py all --strict (USA v1.01): 28 programs OK, no C fallback; every new function is present in each carrying placed.json; the boot places 2,603 C functions
  • python3 -m unittest discover -s tests: 415 tests, OK (1 skipped)
  • python3 tests/check_repository.py: repository checks passed
  • python3 tools/progress.py --check: passed (the report awaits the maintainer's refresh)

Not run

  • PAL and USA v2.00 builds: this machine has only the USA v1.01 disc. The new files and markers
    apply to the same function identities there, but they are unchecked.
  • The progress report and README table are left for the maintainer's refresh.

🤖 Generated with Claude Code

https://claude.ai/code/session_017f7s8LKfAFAYnD6HxXEGy9

DrLegitamate and others added 2 commits November 5, 2026 20:18
…mbly routines

- func_002E3998 and func_002E3BD8, the sky's textured and Gouraud piece
  renderers (28 places each), in a new src/game/002E10B8-sky-g8.c. The old
  near misses stopped at a `daddu $a3` copy because they passed a fourth
  argument to func_002E3E54. That handwritten vertex transform takes three:
  its body never reads $a3, and its functional C already said "arg3 is
  unused". In retail, $a3 only holds the +0x2C halfword because that value
  dies before the call. With the real interface both functions match.
- func_L08_0041E790 (levels 8 and 19): the retained draft matches unchanged
  on the current compiler, in its own L08_0041E790-g8.c with its recorded
  -O2 -G8 -ffunction-sections -g profile. The one missing division nop was a
  compiler difference, fixed in 1e7eac4.
- func_002A05A8, func_002A0F48, func_002A1490 marked ASM_FUNC under the
  second criterion of AGENTS.md "Handwritten assembly" (needs a maintainer's
  agreement). The disassembler flags their trapping add/addi/sub as
  handwritten: 29, 7 and 32 of them. All three use $at as a working register.
  func_002A0F48 has 31 VU0 macro/COP2 instructions; func_002A1490 leaves by
  jumps with no return, like func_002A1130; func_002A05A8 has two cvt.w.s
  words in an encoding the compiler never emits.

Removes the superseded near-miss and functional entries for the three
matched functions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017f7s8LKfAFAYnD6HxXEGy9
…t compiler

- func_L03_0041DAD0: 7 rows (was 8), with the three $gp globals plain again
  (the `const` on two was an experiment, not evidence) and a struct view for
  the three rate stores. Only a $f2/$f3 swap is left.
- func_L18_0043FFF8, func_L02_002EFB60, func_L00_00426C78: dated notes on
  what was tried today and what tied, so it is not repeated.
- func_L00_00426C78 gets its missing README row.
- docs/MATCHING-BLOCKERS.md: the func_002E3E54 interface finding behind
  the two sky matches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017f7s8LKfAFAYnD6HxXEGy9
@bytematchdev

bytematchdev Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

ByteMatch progress report

SCES_516.07

Code matched 56.58% · 3.23 MB of 5.70 MB
Fuzzy match 56.58%
Functions 7,242 / 8,677
Data matched 0.00%
Units complete 990 / 1,217

No function changes.

SCUS_972.68_v2

Code matched 86.02% · 4.80 MB of 5.58 MB
Fuzzy match 86.02%
Functions 7,932 / 8,639
Data matched 0.00%
Units complete 1,017 / 1,190

No function changes.

SCUS_972.68

Code matched 91.80% · 5.07 MB of 5.53 MB
Fuzzy match 91.80%
Functions 8,173 / 8,584
Data matched 0.00%
Units complete 983 / 1,069

No function changes.

Commit 6375003 · Ratchet & Clank: Going Commando on ByteMatch

DrLegitamate and others added 2 commits November 5, 2026 20:33
The 1,600-byte beam renderer in the boot, in its own unit
src/game/00308600-uv-g8.c (default -G8 profile). Its retained draft, adapted
from RAC1's visibomb_and_pyrocitor.c, uses only approved SDATA aliases for
the corner and UV arrays. On 31 October it stopped at one reloaded V pointer
in the first UV loop. On the current compiler it matches unchanged; it was
found by re-measuring the retained near misses.

tools/build.py all --strict (USA v1.01): 28 programs OK, no C fallback; the
boot now places 2,603 C functions. Unit tests, tests/check_repository.py and
tools/progress.py --check pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017f7s8LKfAFAYnD6HxXEGy9
fd24afe removed the near-miss draft but, through a failed `git add`, left
out the C itself: src/game/00308600-uv-g8.c and the marker change in
src/game/00308600.c. This commit adds them. The checks reported in fd24afe
were run on this complete tree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017f7s8LKfAFAYnD6HxXEGy9
@DrLegitamate DrLegitamate changed the title feat(src): two sky renderers and a level-8 emitter in C, three original assembly routines feat(src): four functions in C (sky renderers, level-8 emitter, beam), three original assembly routines Nov 5, 2026
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