Skip to content

Add GC 2.5a: 2.5 with FFCC's store alias rule - #3

Closed
frioux wants to merge 1 commit into
doldecomp:mainfrom
frioux:gc-2.5a
Closed

frioux wants to merge 1 commit into
doldecomp:mainfrom
frioux:gc-2.5a

Conversation

@frioux

@frioux frioux commented Nov 10, 2026

Copy link
Copy Markdown

Adds GC_2_5a, a derived version like GC_2_0p2: GameCube 2.5 plus one alias-analysis rule that the PAL and USA game code of the Final Fantasy Crystal Chronicles decompilation needs. The name "2.5a" is provisional; happy to rename it (2.5p1, 2.5f, ...) if you prefer.

What

  • include/version.h: VERSION_GC_2_5A between 2.5 and 2.6 (2.6 and 2.7 move up one index), config/GC_2_5a/config.json with "derived_from": "GC_2_5".
  • The eleven VERSION == VERSION_GC_2_5 tests now include 2.5a (#elif VERSION <= VERSION_GC_2_5A in the chains that already start with < VERSION_GC_2_5, the same way <= VERSION_GC_2_0P2 is used; == VERSION_GC_2_5 || == VERSION_GC_2_5A for the standalone ones), so 2.5a is 2.5 everywhere else, build 105 included.
  • Alias.c operand_alias, 2.5a only: a store through a base register with several reaching definitions, some with an alias and some without, keeps the alias of those that have one when it is a single static object (Object/ObjectPart whose object is not DLOCAL), instead of becoming worst_case. Loads, and stores into locals, are unchanged.
  • README: table row, a note under the table, and a section in the style of the BFBB one.

Why / evidence

All measured on FFCC's game code, every unit the project builds with GC/2.5, scored per function like FFCC's report.json (objdiff 3.6.1).

  • Stock 2.5, 2.6 and 2.7 produce byte-identical objects for all 269 PAL and 268 USA game units, and 2.0 only loses functions, so no release reproduces the retail code.
  • FFCC's pppRand* vector randomizers store each channel through target = (off == -1) ? (T*)gPppDefaultValueBuffer : (T*)(work + off) while reading *valuePtr. Retail loads *valuePtr once; 2.5 reloads it after every store through target (it is worst_case). FFCC's current source works around that with a scale local, which leaves nine functions at 87-97%.
Compiler PAL (of 3121) PAL, per-channel pppRand* USA (of 3116) USA, per-channel pppRand*
2.5 3066 3063 3061 3058
2.5a 3066 3075 3061 3070
  • On FFCC's current source, 2.5a's objects are byte-identical to 2.5's (269/269 PAL, 268/268 USA).
  • With the natural per-channel source (FFCC PR GC/2.5a from mweppc (kss alias rule) for PAL/USA; pppRand vector randomizers match in all regions zcanann/FFCC-Decomp#17827; also the source the Japanese release matches), 2.5a gains 12 functions over 2.5 on the same source and loses none: +9 / -0 over the current source in each region.
  • Broader rules, as controls (PAL, current source): the rule for loads and stores alike loses 18 functions and gains none (with the per-channel source: -15, still gains none, because the target loads move above the stores); for every store, including into locals, loses CMenuPcs::loadData (a store into a local array). Static objects only (this PR) loses nothing.
  • Before / after (pppRandIV, per-channel source):
2.5                    2.5a, retail
stw   r0,0(r4)         stw   r0,0(r4)
lwz   r0,12(r31)       lwz   r0,12(r31)
lfs   f1,0(r5)         lwz   r3,4(r4)
xoris r0,r0,32768      xoris r0,r0,32768
lwz   r3,4(r4)

Only FFCC has been measured; I had no other GameCube 2.5 project at hand. Nothing changes for anyone who does not select 2.5a.

How tested (macOS arm64, LLVM 23)

  • python configure.py && ninja: all six versions build with clang. build/GC_{2_0,2_0p2,2_5,2_6,2_7}/clang/mwcceppc.exe are byte-identical to the same build of main.
  • configure.py --mwcc: ninja build/GC_2_0/ok build/GC_2_5/ok build/GC_2_6/ok build/GC_2_7/ok gives the same per-function results as main (compare.json identical apart from object hashes), and build/GC_2_5a/source-only/mwcceppc.exe and build/GC_2_0p2/source-only/mwcceppc.exe link ("4079 functions, all from the sources"). On this host the exact counts are two lower than the README's for every version, on main as well.
  • The source-only (MWCC-built) 2.5a also gives FFCC's 269 PAL units +0 / -0.
  • ruff format --check, ruff check, clang-format --dry-run -Werror on all C sources: clean.
  • Not run: --matching / relink.ok, tools/verify.py's full regressions baseline, and the native Linux build (not available on arm64 macOS). Downloading the original compilers from files.decomp.dev failed here with an SSL error, so I seeded build/compilers from FFCC's copy of the same compilers_20250812 bundle.

FFCC will switch from its current byte-patched 2.5 (PR zcanann/FFCC-Decomp#17827) to this build once it is merged and released; the FFCC side expects the release archive to carry 2.5a/mwcceppc.exe next to 2.5/.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QmcpERTQ1WaRZ73F12eUis

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QmcpERTQ1WaRZ73F12eUis
frioux added a commit to frioux/FFCC-Decomp that referenced this pull request Nov 10, 2026
GC/2.5a is now doldecomp/mweppc's GC_2_5a (GC 2.5 built from the
decompiled source with the kss rule, doldecomp/mweppc#3) rather than a
byte patch of the bundled GC/2.5. tools/download_mweppc.py installs it
from mweppc's release archive, pinned by URL and SHA-256; until that
release exists RELEASE is None and the build stops with a message
naming the pending value. tools/patch_compiler_pal.py and its ninja rule
are removed.

Validated with a locally built GC_2_5a: objects byte-identical to the
byte-patched GC/2.5a; report.json unchanged in all three regions.

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

frioux commented Nov 15, 2026

Copy link
Copy Markdown
Author

Closing in favour of PrimeDecomp/mwcc-tools#3, the same change ported to mwcc-tools' gc2/.

@frioux frioux closed this Nov 15, 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