Skip to content

Japan and RedSound: GC/2.0p3 from mweppc replaces the GC/2.0p1k patch chain - #17830

Draft
frioux wants to merge 1 commit into
zcanann:stagingfrom
frioux:jp-compiler-mweppc
Draft

frioux wants to merge 1 commit into
zcanann:stagingfrom
frioux:jp-compiler-mweppc

Conversation

@frioux

@frioux frioux commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Update: the compiler change moved from doldecomp/mweppc#4 (closed) to PrimeDecomp/mwcc-tools#4, the same change in mwcc-tools' gc2/. This PR still installs the compiler from an mweppc release (tools/download_mweppc.py); that part needs reworking once mwcc-tools decides how the compiler is distributed. References to mweppc#4 below are historical.

Draft: depends on doldecomp/mweppc#4

What changed

  • Japanese game units and the RedSound library (all regions) build with GC/2.0p3, doldecomp/mweppc's GC_2_0p3: BFBB's source-level GC_2_0p2 plus four alias rules measured on FFCC Japan (ksa and pwcp from our patch chain, and two new rules: direct small-data loads of const globals, and loads of part of a small literal, are ordered like pointer loads). tools/download_mweppc.py installs it from a pinned mweppc release as a ninja pre-compile step; RELEASE is None until mweppc publishes a release carrying 2.0p3/, so the build stops with a message until then.
  • The GC/2.0p1a..k byte-patch chain is removed (tools/patch_compiler*.py, tools/aliaspatch_*.py, the CI steps that ran them): nothing else used it. tools/project.py lets a pre-compile step provide a configured compiler (the same hunk as GC/2.5a from mweppc (kss alias rule) for PAL/USA; pppRand vector randomizers match in all regions #17827).
  • CMenuPcs::LetterClose and pppFrameYmCheckBGHeight drop the forms written to fit GC/2.0p1k and use the plain source that now matches in every region.
  • pppParHitSphMat, pppYmCheckBGHeight and pppYmMoveCircle are MatchingFor Japan too.
  • docs/compiler_baseline.md: new GC/2.0p3 section (rules, measurements, which patch clauses 2.0p2 already covers); the patch-chain sections stay as history.

Evidence (fresh baselines at staging 912dd23, report.json, all three regions)

region exact functions exact code bytes exact data bytes complete units partial lower
PAL 4674 -> 4674 unchanged unchanged 443 -> 443 none
USA 4670 -> 4670 unchanged unchanged 443 -> 443 none
Japan 4581 -> 4595 (+14 / -0) 1,675,980 -> 1,701,300 1,599,800 -> 1,601,288 421 -> 424 none

Japan gains CalcResultOpenAnim, makeFurTex, DrawFur, GbaQueue::LoadPlayerStat / LoadEnemyStat / LoadMapItemStat, CheckHitFaceCylinder, CMapPcs::drawAfter / drawAfterViewer, pppParHitSphMat, pppConstructYmMoveCircle, pppFrameYmCheckBGHeight, SetWorldParam and LetterClose; LoadMapObj 77.66 -> 93.32, PickFur 98.41 -> 99.41, CalcMainMenuSub 99.48 -> 99.98. gbaque and menu_letter Japanese data reach 100%.

Compiler alone, same source, every Japanese game unit (3081 functions):

compiler exact vs GC/2.0p1k
GC/2.0p1g (BFBB) 2959 +0 / -43
GC/2.0p1k (current) 3002
mweppc GC_2_0p2 2994 +10 / -18
mweppc GC_2_0p3 3014 +12 / -0

265 of 274 Japanese objects are byte-identical to GC/2.0p1k's; the other nine differ only in the improved functions. RedSound objects are byte-identical to GC/2.0p1g's in PAL, USA and Japan. all_source, progress, report.json and ok (DOL checksum) pass in all three regions, built with the locally built mweppc compiler packed as a release-format zip and pinned through a temporary file:// RELEASE (not committed).

Why plausible

  • The compiler is mweppc source, not byte patches: each rule is a few lines of C at the function it changes, and every other mweppc version still builds byte-identically. FFCC's other patch clauses (e3ns, c3a, dsl/dsls/dslu) are already covered by 2.0p2's rules for floating-point literals and small-data stores; an instrumented build shows they never change an answer on top of 2.0p2.
  • LetterClose now reads m_letterMenuState->listCursor again for s_BackUpTopPos instead of a state2 local plus a read-back of s_BackUpCur[0]; Japan reloads m_letterMenuState after the direct store to s_BackUpCur[0], PAL/USA keep one load, from the same source. pppFrameYmCheckBGHeight reads ppvMng first instead of between two direction stores. Both are 100 in PAL and USA with GC/2.5 as before.

Notes

🤖 Generated with Claude Code

https://claude.ai/code/session_01QmcpERTQ1WaRZ73F12eUis

…0p1k patch chain

GC/2.0p3 is doldecomp/mweppc's GC_2_0p3: BFBB's source-level 2.0p2 plus the
FFCC Japan alias rules (ksa and pwcp from the old patch chain, and two new
pointer-like small-data load rules). tools/download_mweppc.py installs it from
a pinned mweppc release (RELEASE is None until that release exists). The
GC/2.0p1a..k patch scripts are removed: GC/2.0p3 reproduces GC/2.0p1k on 265
of 274 Japanese objects byte for byte and is closer to retail on the rest, and
RedSound's objects are identical to GC/2.0p1g's in every region.

CMenuPcs::LetterClose and pppFrameYmCheckBGHeight drop the forms that fitted
GC/2.0p1k and match in all regions; pppParHitSphMat, pppYmCheckBGHeight and
pppYmMoveCircle link in Japan.

Japan: +14 / -0 exact functions, +25,320 code and +1,488 data bytes exact,
no partial lower. PAL and USA: report unchanged. All DOL checksums pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QmcpERTQ1WaRZ73F12eUis
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