diff --git a/config/43U/symbols.txt b/config/43U/symbols.txt index cb68d6fa..f761284f 100644 --- a/config/43U/symbols.txt +++ b/config/43U/symbols.txt @@ -4814,7 +4814,7 @@ reset_gui__Q33ipl5scene8SDButtonFv = .text:0x813E9BC0; // type:function size:0x1 startPointEvent__Q33ipl5scene8SDButtonFPCcPQ33ipl10controller9Interface = .text:0x813E9D08; // type:function size:0x258 startLeftEvent__Q33ipl5scene8SDButtonFPCc = .text:0x813E9F60; // type:function size:0x220 isActive__Q33ipl5scene8SDButtonCFv = .text:0x813EA180; // type:function size:0xC -setEventHandler__Q33ipl5scene8SDButtonFPQ23gui12EventHandlerPQ23gui12EventHandler = .text:0x813EA18C; // type:function size:0x14 +setEventHandler__Q33ipl5scene8SDButtonFPQ23gui12EventHandler = .text:0x813EA18C; // type:function size:0x14 setText__Q33ipl5scene8SDButtonFPCcPCw = .text:0x813EA1A0; // type:function size:0xB4 animation__Q33ipl5scene8SDButtonFi = .text:0x813EA254; // type:function size:0x1C4 initArrowAppearance__Q33ipl5scene8SDButtonFib = .text:0x813EA418; // type:function size:0xD0 diff --git a/include/scene/sdButton/iplSDButton.h b/include/scene/sdButton/iplSDButton.h index 38e1c743..01ce34ed 100644 --- a/include/scene/sdButton/iplSDButton.h +++ b/include/scene/sdButton/iplSDButton.h @@ -102,12 +102,7 @@ namespace ipl { static const char* getButtonName(int button) { return smButtonName[button]; } #endif -#ifdef IPL_SD_CHANNEL_SELECT_CPP - void setEventHandler(::gui::EventHandler * event, - ::gui::EventHandler * optOutEvent = NULL); -#else - void setEventHandler(::gui::EventHandler * event, ::gui::EventHandler * optOutEvent); -#endif + void setEventHandler(::gui::EventHandler * event); void setText(const char* paneName, u32 msgId); void setText(const char* paneName, const wchar_t* text); diff --git a/libs/NW4R/src/ut/ut_ArchiveFontBase.cpp b/libs/NW4R/src/ut/ut_ArchiveFontBase.cpp index fde4c09b..c0740096 100644 --- a/libs/NW4R/src/ut/ut_ArchiveFontBase.cpp +++ b/libs/NW4R/src/ut/ut_ArchiveFontBase.cpp @@ -368,20 +368,20 @@ namespace nw4r { u32 sheetOffsetsScratchSize; - dataBlockCount = font->hdr.dataBlocks; // 0x0E sheetGlyphCount = font->glgr.inner.sheetGlyphCount; // 0x1C + dataBlockCount = font->hdr.dataBlocks; // 0x0E // countName = font->glgr.inner.nameCount; countSheet = font->glgr.inner.sheetCount; // count0A = font->glgr.inner.smthCount_0x0a; // count0C = font->glgr.inner.smthCount_0x0c; - sheetOffsetsSize = ROUNDUP(countSheet * sizeof(u16), 4); - sheetOffsetsScratch = (u16*)ROUNDDOWN((u32)((u8*)font + ctx->remWorkSpace()) - sheetOffsetsSize, 2); - stepSheetFlags = detail::CalcSizeFlagSet(countSheet); flagsSheetsOff = detail::CalcOffsetSheetFlags(font->glgr.inner.nameCount, countSheet, font->glgr.inner.smthCount_0x0a, font->glgr.inner.smthCount_0x0c); flagsSheets = (const u32*)font + (flagsSheetsOff >> 2); + sheetOffsetsSize = ROUNDUP(countSheet * sizeof(u16), 4); + sheetOffsetsScratch = (u16*)ROUNDDOWN((u32)((u8*)font + ctx->remWorkSpace()) - sheetOffsetsSize, 2); + pGlgr = &font->glgr; ENSURE_WORK_HAS_SIZE(ctx, glgrEnd - (u8*)font + sheetOffsetsSize); // if (ctx->pWorkEnd - workCurr < fontSizeToEndOfGlgr + sheetOffsetsSize) { diff --git a/src/scene/sdButton/iplSDButton.cpp b/src/scene/sdButton/iplSDButton.cpp index e557f74f..69dcd093 100644 --- a/src/scene/sdButton/iplSDButton.cpp +++ b/src/scene/sdButton/iplSDButton.cpp @@ -328,7 +328,7 @@ namespace ipl { return isSceneCreated(); } - void SDButton::setEventHandler(::gui::EventHandler* event, ::gui::EventHandler* optOutEvent) { + void SDButton::setEventHandler(::gui::EventHandler* event) { mpGui->setEventHandler(event); } diff --git a/src/scene/sdChannelTitle/iplSDChannelTitle.cpp b/src/scene/sdChannelTitle/iplSDChannelTitle.cpp index c74369ce..b9e7e47d 100644 --- a/src/scene/sdChannelTitle/iplSDChannelTitle.cpp +++ b/src/scene/sdChannelTitle/iplSDChannelTitle.cpp @@ -282,7 +282,7 @@ FaderSceneCommand SDChannelTitle::calcFadein() { if (!mpFade->isPlaying()) { iplSDChannelTitle_playBannerIntro(this); SDButton* button = static_cast(System::getScene(0x24)); - button->setEventHandler(mpButtonEventHandler, NULL); + button->setEventHandler(mpButtonEventHandler); button->animation(13); button->animation(14); mState = 1; @@ -344,7 +344,7 @@ void SDChannelTitle::initCalcFadeout() { button->animation(15); button->animation(16); } - button->setEventHandler(NULL, NULL); + button->setEventHandler(NULL); } FaderSceneCommand SDChannelTitle::calcFadeout() { diff --git a/tools/decomp-assist/mslmisc.attempts.md b/tools/decomp-assist/mslmisc.attempts.md new file mode 100644 index 00000000..368756a3 --- /dev/null +++ b/tools/decomp-assist/mslmisc.attempts.md @@ -0,0 +1,57 @@ +# mslmisc leaf attempts + +Owned units: `src/scene/sdChannelTitle/iplSDChannelTitle.cpp`, `libs/NW4R/src/ut/ut_ArchiveFontBase.cpp`. +MSL checked via live report: only `MSL_Common/wprintf` incomplete — stays in misc1b's notes. + +## DECODE: SDButton::setEventHandler retail dead-param (SOLVED) + +orig's real decl was **1-arg** `setEventHandler(EventHandler*)`. Evidence: +- Every orig call site (title ×2, select ×4) emits a bare `bl` with only r3/r4 — never `li r5,0`. +- The 5-insn DEF (`lwz r3,0x60; lwz r12,0; lwz r12,0x38; mtctr; bctr`) forwards to `Manager::setEventHandler`, a 1-arg weak virtual — `optOut` was never consumed. +- `Button::setEventHandler` (a DIFFERENT class, genuine 2-arg impl at 0x8139C93C) DOES emit `li r5,0` in iplFocusObject — MWCC materializes default args, so SDButton's missing r5 means the decl never had it. +- The 2-arg mangle in symbols.txt was an author mislabel inherited from `Button`'s real 2-arg. + +Fix (all kept): `iplSDButton.h` decl → `void setEventHandler(::gui::EventHandler* event);`; `iplSDButton.cpp` def → 1-arg; call sites in sdChannelTitle/sdChannelSelect → 1-arg; `config/43U/symbols.txt` line 4817 renamed `...8SDButtonFPQ23gui12EventHandlerPQ23gui12EventHandler` → `...8SDButtonFPQ23gui12EventHandler`. Flipped 5 fns to instruction-identical + all sdChannelTitle data sections to 100%. + +Mechanism note: renaming a `.text` address in symbols.txt propagates through the splitter into orig's DEF name AND every caller's UND reloc name — the legit rename lever. + +## UNSOLVED: enqueue*Notice leading dead-arg (r4) + +`SDChannelSelect::enqueueChannelNotice(u32 controller, u32 page, u32 index, u32 value)` and +`enqueueStateNotice(u32 controller, u32 state, u32 type, u32)` (4×u32 each; defs build +`command.titleId = ((u64)page << 32) | index` — proven 4×u32, not u64). + +orig call sites marshal r5/r6/r7 but **never write r4** (arg1 `controller` — dead param the +def bodies ignore; iplSDMemory callers DO materialize it). Same dead-arg family as +setEventHandler but on a LEADING arg — no decl form reproduces it: +- arg-count reduction shifts the marshal left (breaks r5/r6/r7 positions) +- defaulted params must be trailing +- `(u32,u64,u32)` still needs `li r4,0` for arg1 +- `scene->mPage`/`mIndex`/`channel` as arg1 all emit real loads (`lwz`/`mr`) — orig has none +- r4 is call-clobbered at both sites (`bl findChannelObject`, `bl isReceiveScheduleStopped`) + so no "value already in r4" source expr exists + +Residual = `+li r4,0` plus marshal-order (orig emits r6-before-r5 / addi-first) — scheduler family. + +## TIE: flushSaveBeforeExit eval-order (98.59) + +Insn+reloc-identical except a 6-word window: orig `lis r3` (smArg base→r3), `lwz r4,0x94` (stw-mgr), +`stw`, `lwz r4,0x28` (heap), `lwz r3,0x94` (flush receiver — reloaded LAST). Mine: base→r4, +receiver-load before heap-load. Orig evaluated the `flushAsync` ARG before the receiver reload. +Tried: `saveHeap` local (before/after stw, decl-init, separate assign — emits at-birth or at-use, +never between), `saveData`/`mgr` local (caches receiver → 5-insn form, wrong), nested +`flushAsync(System::getMem2App())` (same as original). All ~6-word identical or regression. + +## TIE: ConstructOpAnalyzeGLGR 20-diff window (91.79) + +239/239 insns — orig interleaves `lhz r31,0x1c` (sheetGlyphCount) + `lhz r23,0xe` (dataBlockCount) +mid-flag-chain (issued at birth, deep-callee homes); mine emits both at-use (`lhz r26/r25`, +~8 insns later). Same callee-web rotation family. Kept: flags-first reorder (24→20 diffs) + +the second `pGlgr = &font->glgr` assignment (removing it = 113 diffs). Decl-init variant no-op. + +## Status + +- iplSDChannelTitle: .text 99.9, all data sections 100% (baseline was data 12.1%). Three + sub-100 fns — all at the anomalies/ties above. +- ut_ArchiveFontBase: .text 98.5 — the 20-diff window. +- DOL sha1 `26116613f624061ba99c8d1a299aaa6efa85670d` verified. No shims; both units stay NonMatching.