From ca54e619e9bb42f95d2acb1efeac66f91be6c3bc Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Wed, 30 Sep 2026 00:48:15 +0000 Subject: [PATCH] iplGCWindow: 47/48 functions, pool identical (worker c44639cd) --- README.md | 4 +- include/scene/memoryCard/iplGCWindow.h | 5 +++ src/scene/memoryCard/iplGCWindow.cpp | 44 ++++++++++++++------- tools/decomp-assist/iplGCWindow.attempts.md | 35 ++++++++++++++++ 4 files changed, 72 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index de3dd3a5..8041768c 100644 --- a/README.md +++ b/README.md @@ -53,9 +53,9 @@ Progress | Decompiled | Matched | Linked | Data | |:---:|:---:|:---:|:---:| -| 82.37% | 73.10% | 56.76% | 86.29% | +| 82.37% | 73.12% | 56.76% | 86.29% | -units 748/1027 complete, functions 10668/12563 matched. +units 748/1027 complete, functions 10669/12563 matched. decompiled = code with a C/C++ implementation (objdiff fuzzy), matched = byte-exact code, linked = code actually linked into the DOL, data = byte-exact data diff --git a/include/scene/memoryCard/iplGCWindow.h b/include/scene/memoryCard/iplGCWindow.h index ea1057de..e59e6d8a 100644 --- a/include/scene/memoryCard/iplGCWindow.h +++ b/include/scene/memoryCard/iplGCWindow.h @@ -65,12 +65,17 @@ private: class SavedataEditWindow : public MemoryBase { public: + SavedataEditWindow(EGG::Heap* heap, nand::LayoutFile* layoutFile, const char* directory, const char* fileName); virtual void init(); virtual void calc(); virtual void draw(); virtual void destroy(); private: + void add_animation(const char* fileName, const char* groupName) { + AnmName animation = {fileName, groupName}; + MemoryBase::add_animation(&animation, 1); + } void on_normal(); void on_fadein(); void on_fadeout1st(); diff --git a/src/scene/memoryCard/iplGCWindow.cpp b/src/scene/memoryCard/iplGCWindow.cpp index a9fe5842..9851686e 100644 --- a/src/scene/memoryCard/iplGCWindow.cpp +++ b/src/scene/memoryCard/iplGCWindow.cpp @@ -745,13 +745,16 @@ void GCWindow::onMemEvent(long event, u8 cardState) { set_textbox("T_Message_00", 0xe5); break; } + goto process_complete; + case 0x15: + return; + + process_complete: System::getHomeButtonMenu()->enable(); mWaiting = false; show_button_ok(); mState = 0xe; break; - case 0x15: - break; } } } @@ -767,18 +770,31 @@ void GCWindow::stop_wait_anim() { snd::sSystem.startSE("WIPL_SE_COPY_FINISH"); } -static const MemoryBase::AnmName scDataAnmName[10] = { - {"it_DataDetail_a_SeenIn.brlan", "G_Mask"}, - {"it_DataDetail_a_SeenOut.brlan", "G_Mask"}, - {"it_DataDetail_a_DelFoucusIn.brlan", "G_Del"}, - {"it_DataDetail_a_DelFoucusOut.brlan", "G_Del"}, - {"it_DataDetail_a_DelFlash.brlan", "G_DelFlash"}, - {"it_DataDetail_a_SelectOut.brlan", "G_Select"}, - {"it_DataDetail_a_SeenOutYes.brlan", "G_Mask"}, - {"it_DataDetail_a_SeenOutYesOk.brlan", "G_Mask"}, - {"it_DataDetail_a_SeenOutNo.brlan", "G_Mask"}, - {"it_DataDetail_a_Wait.brlan", "G_Wait"}, -}; +SavedataEditWindow::SavedataEditWindow(EGG::Heap* heap, nand::LayoutFile* layoutFile, + const char* directory, const char* fileName) + : mState(0), mActive(false) { + mpLayout = new layout::Object(heap, layoutFile, directory, fileName); + add_animation("it_DataDetail_a_SeenIn.brlan", scAnmName[0].groupName); + add_animation("it_DataDetail_a_SeenOut.brlan", scAnmName[0].groupName); + add_animation("it_DataDetail_a_DelFoucusIn.brlan", scAnmName[8].groupName); + add_animation("it_DataDetail_a_DelFoucusOut.brlan", scAnmName[8].groupName); + add_animation("it_DataDetail_a_DelFlash.brlan", scAnmName[10].groupName); + add_animation("it_DataDetail_a_SelectOut.brlan", scAnmName[11].groupName); + add_animation("it_DataDetail_a_SeenOutYes.brlan", scAnmName[0].groupName); + add_animation("it_DataDetail_a_SeenOutYesOk.brlan", scAnmName[0].groupName); + add_animation("it_DataDetail_a_SeenOutNo.brlan", scAnmName[0].groupName); + add_animation("it_DataDetail_a_Wait.brlan", scAnmName[15].groupName); + mpLayout->finishBinding(); + set_visible("N_Wait", false); + set_visible("T_Block_01", false); + mpEvent = new MemoryBaseEvent(this); + mpPaneManager = new gui::PaneManager(mpEvent, mpLayout->getDrawInfo(), NULL, NULL, true); + mpPaneManager->setupScene(mpLayout); + mpPaneManager->setAllComponentTriggerTarget(false); + mpPaneManager->setTriggerTarget(mpLayout->FindPaneByName(scButtonName[2]), true); + add_anmbutton(scButtonName[2], get_animation(2), get_animation(3), get_animation(4)); + set_textbox("T_Del_00", 0xbd); +} void SavedataEditWindow::calc() { mpLayout->calc(); diff --git a/tools/decomp-assist/iplGCWindow.attempts.md b/tools/decomp-assist/iplGCWindow.attempts.md index 5fb20ab6..fd1516f3 100644 --- a/tools/decomp-assist/iplGCWindow.attempts.md +++ b/tools/decomp-assist/iplGCWindow.attempts.md @@ -27,3 +27,38 @@ The GCWindow vtable is emitted naturally. Its original object symbol includes 32 SavedataEditWindow's virtual lifecycle names are inferred: init, calc, draw, destroy. The observed final lifecycle slot is 0x5c, and calc invokes it when fadeout completes; all seven surviving SavedataEditWindow functions match instruction-exactly. The initializer signature and unused lifecycle methods need confirmation before that class is instantiated. Its event pointer field is inferred from the corresponding memory-window layout. No other unit is switched to Matching, no other source is changed, and shared-header declarations are guarded by IPL_GC_WINDOW_CPP, defined only by iplGCWindow.cpp. + +## Continuation from c77b866e + +Starting measurements: 46/48 instruction-exact functions, 8552/9964 code bytes, 248/2032 data bytes, 38/50 pool strings. + +### Pool and constructor + +The original object's .rela.text, .rela.rodata and .rela.data contain no references into the twelve trailing strings at .data offsets 0x444 through 0x597. The only reference to the encompassing lbl_81652C50 symbol is the preceding WIPL_SE_COPY_FINISH literal. Therefore no surviving target function uses the missing strings. The SavedataEditWindow layout uses the same deletion animation indices as those filenames imply; its constructor was stripped from the final DOL. The neighboring SavedataEdit constructor also disables T_Block_01 during layout initialization. + +1. Reconstructed an inline SavedataEditWindow constructor using a local animation table and the same pane/event/button setup as GCWindow and GCSaveData. Because the constructor has no live callers, MWCC omitted it and the missing strings remained absent, 38/50. +2. Compiled the ordinary constructor out of line. Its animation table and T_Block_01 appeared in exactly the target order and offsets. A direct B_Del_00 argument emitted an extra string; referencing the existing scButtonName[2] corrected the pool to 50/50. The local descriptor table added 80 rodata bytes, reducing that section to 88.37209%; rejected that table representation. +3. Added a private name/group overload that creates one ordinary stack descriptor and calls MemoryBase::add_animation. Individual calls reproduced the original animation filenames. Literal group arguments duplicated G_DelFlash and G_Select, giving 52 strings and an sdata mismatch. Reusing the existing scAnmName groupName fields restored 50/50 pool strings and 100% rodata, sdata and sdata2. Kept this implementation. +4. Tested guarded inline MemoryBaseEvent destructor/event-handler definitions recovered from the original iplMemoryCardBase assembly. The empty destructor alone emitted no additional vtable. Inlining the event handler emitted its real 28-byte vtable after MemCardEventHandler, rather than in the preceding 32-byte discarded range. It did not improve objdiff data measurements; reverted both changes. + +The pool now matches all 50 strings with identical offsets. The raw data bytes are identical over the complete 0x678-byte candidate .data section. Original .data has 0x6f8 bytes, including linker-discarded weak-table ranges; the candidate naturally emits 100 bytes for the GCWindow vtable rather than the original symbol's 132-byte span and 16 bytes for MemCardEventHandler rather than its 168-byte span. No padding, retention directive or synthetic symbol was introduced. The reconstructed constructor's code cannot be instruction-verified because the original DOL has no surviving constructor symbol. Its intended behavior follows the existing scene setup, and this uncertainty remains explicit. + +### onMemEvent + +1. Changed the format-message state's terminal break into an early return. Still 153/155 instructions. +2. Moved that early-return case immediately before the processing case. Generated 154/155 instructions, but the return branch appeared before the nested operation switch. +3. Placed the format-message case after the operation switch and routed processing to the named process_complete block. Generated exactly 155/155 instructions with diffs 0. Exact-name objdiff reports 100%. Kept this arrangement. + +### init + +1. Reused the full-width blocks variable and explicitly masked it after the digit-array initialization, instead of introducing a separate truncated blockCount. Still 198/198 instructions with 48 differing positions. +2. Bound the interpolated result to a const reference before finding the pane. Same 198/198 instructions, 48 differing positions and exchanged vector stack slots; rejected. +3. Declared and initialized the blocks accumulator before the title calls and assigned the getter result later. Same 198/198 instructions and 48 differing positions; rejected. Restored the previously accepted initialization source. + +The remaining init differences are register allocation in decimal conversion and the two vector stack slots. No further untried target functions remain. + +### Validation baseline + +The installed gate has no baseline-c77b866e.json. The final full gate therefore uses --base 550c5f19, the closest installed baseline. An additional fresh report was generated by rebuilding the unchanged c77b866e GCWindow source/header in this worktree and saved only to /tmp/sol-high-gcw-r2-current-main-baseline.json. The final report is also compared against that current-main snapshot across every unit and every previously exact function. Protected baseline files were neither edited nor created. + +Final full gate with --base 550c5f19: GATE PASS. Pool IDENTICAL, 47/48 instruction-exact functions, 9172/9964 code bytes, 248/2032 data bytes. rodata, sdata and sdata2 each 100%; data 8.861147%. Fresh c77b866e comparison: zero regressions across all unit measures and previously exact functions. The complete 43U build passed with DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d. Forbidden patterns and readability warnings: zero. -- 2.49.1