Commit Graph

703 Commits

Author SHA1 Message Date
cristian
39e1ae7edf Decompile 2 jump-table functions to C behind NON_MATCHING
func_81207698 (threshold lookup switch, hand-decompiled from asm since m2c
gave a degenerate draft) and func_81208C08 (message-dispatch switch, m2c via
the rodata jtbl input) in fragment1_86CB0. Bare GLOBAL_ASM: 51 -> 49.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 10:02:34 -04:00
cristian
40a5253f5a Decompile func_81202758 to C behind NON_MATCHING
Tile-grid draw routine sourcing glyph data from D_8122C748->unk0000; each
m2c "D_8122C748 + offset" maps to &D_8122C748->unk0000[offset]. Bare
GLOBAL_ASM: 52 -> 51.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 09:55:40 -04:00
cristian
c764224f64 docs: record m2c jump-table workflow (pass rodata .s)
m2c resolves switch jump tables when the rodata .s defining jtbl_* is passed
as an extra input. Unblocks the 14 remaining jump-table functions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 09:51:13 -04:00
cristian
acba8cbf02 Fix func_81202758 forward-decl signature in func_81202FCC
Correct the prototype to (u16*, s32) to match the actual function, avoiding
a future conflict when func_81202758 is decompiled.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 09:47:29 -04:00
cristian
0182e1383d Decompile 2 more functions to C behind NON_MATCHING
func_81202FCC (timer-driven counter update) and func_812006AC (GB-pak ROM
read with checksum, mirrors sibling func_812008C8) in fragment1_7F9A0.
Bare GLOBAL_ASM: 54 -> 52.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 09:45:59 -04:00
cristian
ee756f49ca docs: update C-first progress (7 functions, 71.6%)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 09:38:09 -04:00
cristian
c4ad1bb9e6 Decompile 2 more functions to C behind NON_MATCHING
func_812004B8 (GB-pak write/verify retry loop, mirrors sibling func_81200358)
and func_81202EA8 (saturating additive RGB565 blend) in fragment1_7F9A0.
Bare GLOBAL_ASM: 56 -> 54.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 09:37:30 -04:00
cristian
541dfa4c1b Decompile 5 functions to C behind NON_MATCHING
C-first: wrap func_80033D1C, func_800414B8, func_8003F4C0 (3D140/33FE0) and
func_812075C0, func_81209690 (fragment1_86CB0) in #ifdef NON_MATCHING. The
matching build still uses GLOBAL_ASM and stays byte-exact; NON_MATCHING now
compiles these from C. Bare GLOBAL_ASM: 61 -> 56.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 09:33:07 -04:00
cristian
fab939a784 docs: C-first plan, Rust/Python tool equivalence, dev deps
Add docs/c-first-plan.md (campaign to write C for every function before
matching), document the macOS build gotchas and Rust matching toolkit in
README/CLAUDE, and record m2c as an optional dev dependency.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 09:33:07 -04:00
cristian
fc4b527fd9 Rust tools: add ps-status --c-coverage and ps-fdiff --file
Support the C-first campaign: globalasm now detects whether each GLOBAL_ASM
is behind a NON_MATCHING guard; ps-status --c-coverage reports guarded vs
bare counts (the "bare -> 0" metric) with --list/--json; ps-fdiff --file
summarizes every function in a source object, ranked closest-first.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 09:32:55 -04:00
cristian
49c07fe999 ps-core: match mapfile_parser .text symbol table exactly
The map parser dropped symbol-less contributions and vram==0 archive
members, undercounting progress by 6980 bytes vs progress.py. Skip
unallocated (vram==0) contributions and synthesize a $_static_symbol for
the leading gap before a contribution's first named symbol, matching
mapfile_parser symbol-for-symbol (8240 symbols / 2204464 bytes).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 09:32:55 -04:00
cristian
f0b540b4b5 macOS: auto-detect GNU libiconv for EUC-JP encoding
macOS's BSD iconv mis-encodes an ASCII backslash as the EUC-JP fullwidth
backslash (0xA1C0) after a multibyte character, corrupting \n escapes in
Japanese string literals and breaking the byte-match (~293-byte divergence
in fragment62). Prefer GNU libiconv from Homebrew when present, warn otherwise.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 09:32:43 -04:00
cristian
91cd790c86 Add Rust matching tools (ps-status, ps-firstdiff, ps-fdiff)
Introduce a cargo workspace under tools/rust/ with a shared ps-core
library and three binaries for the byte-for-byte matching effort:

- ps-status: status of functions pending decompilation. Build-free mode
  scans GLOBAL_ASM in src/ (validated: 190 funcs across 68 files, matching
  grep); build-aware mode reports byte progress per folder from the linker
  .map, porting the progress.py metric.
- ps-firstdiff: first difference(s) between built and expected ROM, with
  function naming and jal-target resolution (like tools/first_diff.py).
- ps-fdiff: non-interactive per-function asm diff of built ROM vs baserom
  (like ./diff.py -mwo <func>).

ps-core provides parsers for GLOBAL_ASM, symbol_addrs, and GNU ld .map
files (with vram/vrom lookups), a .z64 reader with md5 verification, and a
rabbitizer wrapper for disassembly. All parsers are unit-tested.

Wired into tools/Makefile (cargo build, skipped with a warning if cargo is
absent), target/ gitignored, and documented in README.md and
tools/rust/README.md.

The Python scripts (progress.py, tools/first_diff.py, diff.py) are kept in
place: only the build-free ps-status path can be validated without a ROM
and toolchain. Parity of the build-dependent tools must be confirmed in a
full build environment before removing the Python equivalents.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-01 23:52:13 -04:00
csaldiasdev
33c207cdca starting point. 2026-06-28 17:30:52 -04:00
Revo
a4011d1146 Merge pull request #225 from zanderyk/func_800328E4
Some checks failed
C/C++ CI / build (push) Has been cancelled
Match `func_800328E4` and `func_80032940` and `func_80032990`
2026-06-10 12:07:18 -04:00
Revo
7baf18daff Merge pull request #229 from dplewis/macos-archiver
Fix ultralib build on macOS
2026-06-10 12:07:01 -04:00
Diamond Lewis
35badf1d48 Fix ultralib build on macOS 2026-06-10 10:51:35 -05:00
Revo
756f7e332e Merge pull request #228 from zanderyk/jpeg-utils-match
Some checks failed
C/C++ CI / build (push) Has been cancelled
Jpeg utils match
2026-02-27 22:01:32 -05:00
alexanderkarlis
0379a7b95e rename C970 -> jpegutils 2026-02-27 15:28:46 -05:00
alexanderkarlis
cbbffad95b JpegUtils_ProcessHuffmanTableImplOld 2026-02-27 15:23:33 -05:00
alexanderkarlis
c536feed78 JpegUtils_SetHuffmanTableOld 2026-02-27 15:18:03 -05:00
alexanderkarlis
333811564a JpegUtils_ProcessHuffmanTableImpl 2026-02-27 15:05:21 -05:00
alexanderkarlis
5e43fa88ff JpegUtils_GetHuffmanCodes 2026-02-27 14:48:01 -05:00
alexanderkarlis
b8e8c5caba JpegUtils_ProcessHuffmanTable 2026-02-27 14:44:05 -05:00
alexanderkarlis
67269da1f7 JpegUtils_ParseHuffmanCodesLengths 2026-02-27 14:35:07 -05:00
alexanderkarlis
4a065fe712 JpegUtils_ProcessQuantizationTable 2026-02-27 14:08:33 -05:00
alexanderkarlis
f1fdf1adad rename func 2026-02-27 13:35:56 -05:00
alexanderkarlis
8f89095bf0 jpeg encoding/decoding utils 2026-02-27 13:19:57 -05:00
Revo
223521eda8 Merge pull request #227 from dplewis/match-various
Some checks failed
C/C++ CI / build (push) Has been cancelled
Match various functions
2026-02-17 13:47:21 -05:00
Diamond Lewis
d44c63a551 Match various functions 2026-02-17 11:06:39 -06:00
Revo
2cd6af3ba4 Merge pull request #226 from zanderyk/bugfix/mdebug-int-overflow
Some checks failed
C/C++ CI / build (push) Has been cancelled
fix integer overflow in mdebug relocation offsets
2026-02-16 10:10:28 -05:00
alexanderkarlis
0d463f98dc mdebug int overflow 32 bit mask 2026-02-16 09:56:14 -05:00
alexanderkarlis
e223fece42 100% func_80032990 2026-02-15 17:38:08 -05:00
alexanderkarlis
3680238cc2 100% match func_80032940 2026-02-15 11:08:40 -05:00
alexanderkarlis
d6fc91cd63 100% func_800328E4 2026-02-10 19:57:52 -05:00
Revo
246a0d68b7 Merge pull request #224 from dplewis/17300-match
Some checks failed
C/C++ CI / build (push) Has been cancelled
Match 17300
2026-01-10 15:51:50 -05:00
Diamond Lewis
164cc63770 Match 17300 2026-01-10 04:49:18 -06:00
Revo
b98d1f7aec Merge pull request #223 from dplewis/stage-loader-match
Match stage_loader.c
2026-01-09 10:46:58 -05:00
Diamond Lewis
497f0085d7 Match stage_loader.c 2026-01-09 09:12:26 -06:00
Revo
a2e2f12a6d Merge pull request #222 from dplewis/30640
30640
2026-01-09 08:49:59 -05:00
Diamond Lewis
f362de2a8d 30640 2026-01-09 06:06:02 -06:00
Revo
77017093b0 Merge pull request #221 from dplewis/33FE0
33FE0
2025-12-25 15:47:39 -05:00
Diamond Lewis
7ad1700684 33FE0 2025-12-25 14:41:52 -06:00
Revo
5dc7d23ec0 Merge pull request #219 from dplewis/frag25
Some checks failed
C/C++ CI / build (push) Has been cancelled
Fragment25
2025-12-05 18:07:20 -05:00
Revo
07784c348d Merge pull request #220 from dplewis/frag2
Fragment2 handle non matching
2025-12-05 18:07:08 -05:00
Diamond Lewis
cc018cd5cf Fragment2 func_87801400 match 2025-12-05 17:03:39 -06:00
Diamond Lewis
85b4f767a6 Fragment25 2025-12-05 15:49:33 -06:00
Revo
f67a09ed9a Merge pull request #218 from dplewis/232C0
Some checks failed
C/C++ CI / build (push) Has been cancelled
232C0
2025-12-04 07:53:11 -05:00
Diamond Lewis
a979bc58ab 232C0 2025-12-03 23:17:50 -06:00
Revo
ad4d09c2d6 Merge pull request #217 from dplewis/46680
Some checks are pending
C/C++ CI / build (push) Waiting to run
46680
2025-12-03 23:48:31 -05:00