Skip to content

GAEJ01_01: match and link Dolphin SDK, MSL_C, TRK, JSystem, audio and boot code - #13

Open
cailet0422 wants to merge 7 commits into
ACreTeam:mainfrom
cailet0422:rev1-sdk-decomp
Open

cailet0422 wants to merge 7 commits into
ACreTeam:mainfrom
cailet0422:rev1-sdk-decomp

Conversation

@cailet0422

Copy link
Copy Markdown

Brings GAEJ01_01 (Rev 1) close to fully matching. With this branch, ninja for GAEJ01_01 rebuilds static.dol and all four RELs with matching SHA-1s, and almost all of the DOL is now linked from source.

GAEJ01_01 before after
DOL code matched 57.2% 99.1% (3566 / 3572 functions)
DOL units linked 108 / 371 370 / 374
RELs 99.99% 100%

What's in it

  • Dolphin SDK (Rev 1): Rev 1 links a newer SDK build than Rev 0 (OS/GX/AR Nov 26 2003, DVD Sep 16 2003, PAD Aug 6 2003), the same build Pikmin 2 uses. The Rev 1 SDK splits are renamed to GAEJ01_01/dolphin/... with sources in src/static/GAEJ01_01/dolphin, starting from the existing Rev 0 attempt and ported from pikmin2 where they differ. Private headers stay next to the sources; include/dolphin only gets an #ifndef around OS_MODULE_VERSION.
  • MSL_C and MetroTRK v2.6: ported from pikmin2, with new self-contained headers under include/PowerPC_EABI_Support/MSL_C/MSL_Common and include/TRK.
  • JSystem: updated to the e+ revision. JKRArchive becomes 0x64 bytes with mExpandSizes, JUTGamePad gets the Rev 1 layout, and JKernel, JUtility and JFWDisplay are ported. jsyswrap.cpp and libjsys are rewritten for e+.
  • jaudio_PP / Famicom: the remaining functions are matched. emusound, oneshot, driver and jammain_2 are split into #included .c_inc files so the -sym on build reproduces the original .text sections.
  • boot code: boot.c, initial_menu.c, dvderr.c, version.c, gba2/JoyBoot.cpp, libforest, and the boot screen data (bootdata/*, nintendo_hi_0.c).
  • RELs: forestd/i/o share module/executor.c (source executor.c) and a new fakemain.c.
  • Config:
    • block_relocations for data words that dtk mistook for pointers.
    • TRK file-I/O stubs typed as functions in symbols.txt.
    • Per-object flags where Rev 1 needs them:
      • JoyBoot/jsyswrap/libjsys: -inline off -sym on
      • JUTSDFile: GC/1.3.2
      • mtx: GC/1.2.5n

The branch has 7 commits, one per area. Configuration and linking are in the last commit.

Things to review

  • Rev 0 is untested. I only have the Rev 1 disc. Rev-1-only changes to files shared with Rev 0 are behind #if VERSION == VER_GAEJ01_01. Some shared JSystem headers changed without a guard; the Rev 1 RELs still match with them, but the Rev 0 build may break. These are:
    • JKRArchive size/vtable
    • JUTGamePad layout
    • JSULink/JSUTree empty destructors removed
    • implicit TColor::operator=
    • JKRThread::run out of line
  • Two fabricated stand-ins reproduce section layout from functions the linker stripped. Both are marked // @unused, @fabricated:
    • Sound_GetPCM (emusound)
    • JC_JUTDirectPrint_setCharColor (jsyswrapper)
  • Structure: there is now a separate src/static/GAEJ01_01 SDK tree alongside GAEJ01_00. If you'd prefer a single tree with VERSION conditionals, I can restructure.
  • Size: this is a large PR. I'm happy to split it (SDK / MSL+TRK / JSystem / audio+Famicom / boot) if that's easier to review.

Remaining in GAEJ01_01

These five functions differ only in register allocation and are still NonMatching:

  • carddrv.c: CARD_SendOpCond, CARD_SoftReset
  • fs_form.c: FS_init_pbs
  • JUTException.cpp: JUTException::showGPRMap
  • JFWDisplay.cpp: JFWDisplay::beginRender

🤖 Generated with Claude Code

cailet0422 and others added 7 commits October 27, 2026 08:25
Rev 1 links a newer SDK build than Rev 0 (OS/GX/AR Nov 26 2003, DVD Sep 16
2003, PAD Aug 6 2003), the same build Pikmin 2 uses. Add a Rev-1-only copy
under src/static/GAEJ01_01/dolphin, starting from the Rev 0 attempt and
porting the newer code (CARD permission checks and font encoding, DVD,
GX 0x5B0-byte GXData, OS, PAD, VI, ...). Private headers stay next to the
sources so include/dolphin is untouched.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Port the Metrowerks C library and MetroTRK v2.6 from the Pikmin 2
decompilation (same generation as e+ Rev 1) and adapt them to this tree.
New self-contained headers live in include/PowerPC_EABI_Support/MSL_C/
MSL_Common and include/TRK; existing headers are not modified.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- JKernel: JKRArchive grows to 0x64 (mExpandSizes), new u32* pSize
  overloads for the ARAM/DVD rippers, JKRThread::run out of line,
  JKRAramBlock/JKRAramArchive helpers in their own headers, placement new
  moved to include/libc/new.h.
- JUtility: Rev 1 JUTGamePad (rumble hard stop, long press, stick clamp),
  coloured JUTDirectPrint, JUTException FPE info, JUTConsole tab width,
  newer exidrv/carddrv/fs_* code paths (fs_subd/fs_rddr Rev 1 changes are
  VERSION-guarded so Rev 0 is unchanged).
- JFramework: JFWDisplay ported from the late-2003 JSystem.
- JSUList: drop the empty user-declared JSULink/JSUTree destructors and use
  the implicit TColor::operator=, which reproduces the original weak
  function section order.
- jsyswrap.cpp and libjsys rewritten for e+ (AGB, picture copy and SD card
  archives, new console/video wrappers). JC_JUTDirectPrint_setCharColor is
  a fabricated stand-in for a stripped wrapper, marked as such.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Split oneshot, driver, jammain_2 and emusound into #included .c_inc
  files so the -sym on build reproduces the original .text sections.
  emusound's Sound_GetPCM is a fabricated stand-in for a stripped function
  whose 32-aligned section produced the trailing padding.
- dspboot: DspBoot comes first; playercall: Jac_CheckPlayerCallback is
  global; system/sub_sys: non-volatile AUDIO_SYSTEM_READY for Rev 1;
  smaller fixes in memory, rspsim, dummyrom, audiothread.
- Famicom: Rev 1 nogbaInput and card result mapping, inline std::strstr in
  famicom_cstring.h, ks_nes_draw register allocation fixes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Port boot.c, initial_menu.c, dvderr.c, version.c, gba2/JoyBoot.cpp and
libforest (osreport, fault, ReconfigBATs) from Animal Crossing and update
them for e+ (REL reload for the indoor/outdoor modules, version check,
fault callback, JUTGba-based GBA boot). The boot screen data (bootdata
gam_win1-3, logo_nin) and nintendo_hi_0 are rebuilt from extracted assets
with display lists decoded back into gbi macros.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
forestd, foresti and foresto share an executor.o/fakemain.o prolog. Add
fakemain.c; glider_v needs 32-byte alignment so its .data starts at 0x20
after fakemain's string, as in forestd.map.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- splits: name Rev 1 SDK units GAEJ01_01/dolphin/..., jsyswrap.cpp,
  jaudio_PP/internal/oneshot.c, bootdata/gam_win1-3.c + logo_nin.c, and
  module/executor.c + fakemain.c in forestd/foresti/foresto.
- configure.py: register Rev 1 SDK, MSL_C, MetroTRK, boot, libforest and
  bootdata objects; mark everything that links byte-identically as
  Matching for GAEJ01_01 (per-object flags where Rev 1 needs them, e.g.
  JoyBoot/jsyswrap -inline off -sym on, JUTSDFile GC/1.3.2, mtx 1.2.5n).
- config.yml: block false-positive relocations found in data
  (nintendo_hi_0, JUTDirectPrint font, jaudio tables, Famicom palette,
  dvderr textures) and add boot/dvderr asset extraction.
- symbols.txt: TRKAccessFile/OpenFile/CloseFile/PositionFile are size-8
  functions.

GAEJ01_01 now builds to the original static.dol and all four RELs.
Remaining Rev 1 code: carddrv CARD_SendOpCond/CARD_SoftReset,
fs_form FS_init_pbs, JUTException showGPRMap, JFWDisplay beginRender
(register allocation only).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cailet0422
cailet0422 marked this pull request as ready for review October 27, 2026 13:07
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