Skip to content

feat(src): match four USA v2.00 functions - #443

Open
gelatinous-bullion wants to merge 1 commit into
OpenRAC:masterfrom
gelatinous-bullion:match/us2-002CCAA0
Open

gelatinous-bullion wants to merge 1 commit into
OpenRAC:masterfrom
gelatinous-bullion:match/us2-002CCAA0

Conversation

@gelatinous-bullion

Copy link
Copy Markdown

What

Four of USA v2.00's own functions, each the C of a matched USA v1.01 function with v2.00's differences, plus one measured catalogue entry correction.

Function Bytes Places From v2.00's differences
func_US2_002CCAA0 376 boot + 27 levels func_002CBAE0 three callees renamed
func_US2_002957C0 1,452 boot + 27 levels func_00294F10 allocator source-line arguments +8; func_0029D4D0 is func_US2_0029E308; same -G64 la-addend flags
func_US2_L05_0041F478 3,516 level 05 func_L05_0041DF58 HUD text ids 0x16A lower; two callees renamed
func_US2_0026EDE8 2,348 boot func_0026EDE8 skips resource table 1; pad pressed word at 0x1A4 (as elsewhere in v2.00); sixteen callees renamed; same call-used flags

All four are reserved in my #152 comment. (func_US2_L04_004127A8, also in that reservation, landed meanwhile in 32707af; this branch is rebased on 045f54e and keeps master's version.)

Catalogue entry: func_US2_0026EDE8

The v2.00 boot row stopped at 0x0026F70C, before the function's own jr $ra; addiu $sp,$sp,0xD0; no row held those two words, and a padding nop follows at 0x0026F714. PAL's copy had the same defect (func_PAL_0026EC50). A measured FUNCTION_END_EXTRA entry, "func_US2_0026EDE8": (2340, 8), gives them back; python3 tools/carry.py --version us2 --entries changed only that row (2340 -> 2348 bytes). This also adds 8 bytes to v2.00's total code.

volatile in func_US2_002CCAA0, for a ruling

func_US2_002CCAA0 matches only with extern volatile int D_001AB910 __attribute__((sda));, the same declaration master already uses in its v1.01 twin func_002CBAE0 (src/game/002C7748-g8.c) and in func_002CBC58 (src/game/002C7748-panels-g8.c, 62919eb). Retail rereads the word for every test and keeps one load whose value is discarded (the empty D_0025A058/D_00259B48 arm); without the qualifier the function is 328 bytes, not 376.

AGENTS.md reserves volatile for memory a second context writes. I found no such writer: the boot never stores to -0x36E0($gp), and 0x001AB910 lies in the level programs' data (0 in the boot image, 1 in level 05's). So this follows master's precedent but not the rule's wording. If the maintainers rule against it, the same ruling applies to the two functions on master, and I will move this one to nonmatching/ with its marker restored.

Checks (on 045f54e + this commit)

  • tools/check.py --version us2: func_US2_002CCAA0 28 of 28, func_US2_002957C0 28 of 28, func_US2_L05_0041F478 1 of 1, func_US2_0026EDE8 1 of 1 places match.
  • python3 tools/build.py all --strict --version us2: 28 programs OK (e.g. us2 boot: OK: 2523640 loaded bytes equal; 2664 C functions (896900 bytes)). Every function is in placed.json of each program that has it; no C rejected in any program.
  • python3 tools/build.py all --strict (USA v1.01, since tools/levels.py changed): 28 programs OK.
  • python3 tests/check_repository.py: repository checks passed.
  • python3 tools/progress.py --check: the reports of us, pal, us2 agree on every function they share.
  • python3 -m unittest discover -s tests: 355 tests; the 11 compiler-output modules need the 32-bit compiler, so they were run inside the rac2-build container (85 tests, OK); the rest passed on the host.
  • Not run: PAL (no PAL disc). The catalogue entry is v2.00's alone and the C is in src/us2/.

Progress (local tools/progress.py --version us2, report not committed)

  • After: 8,529 of 8,579 functions, 5,480,864 of 5,577,956 bytes (98.26%).
  • This PR: +4 functions, +7,692 bytes (98.1216% -> 98.2594%, +0.1378 points against the same master).

🤖 Generated with Claude Code

Four of the release's own functions, each the C of a matched USA v1.01
function with v2.00's differences:

- func_US2_002CCAA0 (376 bytes, boot and 27 levels): func_002CBAE0 with
  three callees renamed; D_001AB910 stays volatile as in func_002CBAE0 and
  func_002CBC58 (retail rereads it per test and keeps one discarded load;
  328 bytes without the qualifier).
- func_US2_002957C0 (1,452 bytes, boot and 27 levels): func_00294F10, the
  allocator's source-line arguments 8 higher, func_0029D4D0 is
  func_US2_0029E308; same -G64 la-addend flags.
- func_US2_L05_0041F478 (3,516 bytes, level 05): func_L05_0041DF58, text
  ids 0x16A lower, two callees renamed.
- func_US2_0026EDE8 (2,348 bytes, boot): func_0026EDE8, skipping resource
  table 1, the pad's pressed word at 0x1A4, sixteen callees renamed; same
  call-used flags.

Catalogue: func_US2_0026EDE8's row stopped before its `jr $ra; addiu
$sp,$sp,0xD0` (no row held those words; a padding nop follows). A measured
FUNCTION_END_EXTRA entry, as for PAL's func_PAL_0026EC50, gives them back;
tools/carry.py --version us2 --entries changed only that row (2340 -> 2348).

Checked on 045f54e:
- tools/check.py --version us2: 28/28, 28/28, 1/1, 1/1 places match.
- tools/build.py all --strict --version us2: 28 programs OK; each function
  is placed in every program that has it, none rejected.
- tools/build.py all --strict (v1.01): 28 programs OK.
- tests/check_repository.py and tools/progress.py --check pass; unit tests
  pass (the compiler tests run in the rac2-build container).
- PAL not checked (no PAL disc); the catalogue entry is v2.00's only.

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.

1 participant