Skip to content

maketex: 50.32% -> 99.82% (rev1 symbols + Rev1 save/memcard differences; v1.00 byte-identical) - #43

Open
SirEnkido wants to merge 4 commits into
zcanann:mainfrom
SirEnkido:agent/maketex
Open

maketex: 50.32% -> 99.82% (rev1 symbols + Rev1 save/memcard differences; v1.00 byte-identical)#43
SirEnkido wants to merge 4 commits into
zcanann:mainfrom
SirEnkido:agent/maketex

Conversation

@SirEnkido

Copy link
Copy Markdown

What changed

main/dlls/engine/2/maketex (memory-card save/load) on GSAE01_rev1: 50.32% → 99.82%, in three steps:

  1. Symbols only (config/GSAE01_rev1/symbols.txt): named saveGame_prepareAndWrite, loadMemCardImages, cardSetStatusNoCard2 from the v1.00 config → 50.32% → 87.90%
  2. saveGame_prepareAndWrite: Rev 1 skips the slot rewrite when a callback is given (retail asm at 0x8007ED98 provably gates on cb == NULL) → 88.03%
  3. loadMemCardImages: Rev 1 moved the comment writer into a separate global function (loadMemCardComments, defined after loadMemCardImages) and switched the check from gGameTextFontIsSjis to getCurLanguage() == LANGUAGE_JAPANESE, reordering the string pool; string-literal offsets are named macros → 99.82%

Steps 2–3 are wrapped in #ifdef VERSION_GSAE01_rev1 (the #else path is upstream's v1.00 code, whitespace-neutral).

Evidence

  • The v1.00 object is byte-identical with and without the guards — sections, symbol table and relocations were compared against origin/main's maketex.c compiled with the same GC/2.0 cflags. The active GSAE01 target is untouched.
  • ninja all_source progress build/GSAE01_rev1/report.json exits 0; independently re-audited (a whitespace regression in the SJIS block was caught and fixed in a follow-up commit)

⚠️ Please read — first version guards in game source

This PR introduces the first #ifdef VERSION_GSAE01_rev1 guards in src/ (5 of them; upstream has none outside the borrowed dolphin/pad/Pad.c VERSION_GCCP01). I want to be upfront about that rather than bury it:

  • The define is emitted by upstream configure.py itself (-DVERSION_{version}), so the mechanism exists by design; docs/version_progress.md's "no version-specific source guards" describes what tools/version_progress.py does when projecting splits, and AGENTS.md has no rule against guards — but this is still a judgment call that's yours, not mine.
  • A guard-free rewrite is not possible here: the retail Rev 1 asm provably changed the code (cb gate, factored-out helper, language check + reordered pool) while v1.00 has none of that — no shared helper can match both. (Sibling PR for engine/0 uses the same technique with the same byte-identical-v1.00 verification.)
  • Fallback offered: if you'd rather not have guards, drop commits 2–4 and keep only commit 1 (6d72368d3b, symbols-only, 50.32% → 87.90%). Or tell me your preferred style and I'll restructure.

Other notes

  • loadMemCardImages 99.17% / loadMemCardComments 99.03% residual: MWCC rematerializes the sMemoryCardFileNameString base once (lis/addi vs addi r3,r31,0xa0) — five source variants tried, none changed it; root cause is the pre-existing upstream names + offset addressing of a char array defined in src/track/intersect_memcard.c, not introduced here.
  • Rev 1 .data for this unit stays low (gMemoryCardBannerAssetNames, 168 bytes) because the branch keeps the single v1.00-order byte array; deliberately did not add a sixth guard around data.
  • loadMemCardComments is a newly coined name (no retail symbol); rename freely.

Produced by Claude agents following AGENTS.md, operated by @SirEnkido.

🤖 Generated with Claude Code

SirEnkido and others added 4 commits August 15, 2026 18:01
…mages/cardSetStatusNoCard2 in GSAE01_rev1 symbols)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ewrite when a callback is given; VERSION_GSAE01_rev1 guard, v1.00 object byte-identical)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…of loadMemCardImages, language check via getCurLanguage; named string-literal offsets; v1.00 object byte-identical)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…, objects unchanged)

Co-Authored-By: Claude Fable 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