From 45aaeb16b2e84e6ec6e3627130b175f043f6e99e Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 2 Oct 2026 13:26:47 -0500 Subject: [PATCH 1/2] Link iplChannelTitle: emit gates + name 5 real .data objects (#834) iplNand.h: IPL_CHANNEL_TITLE_NOVTABLE makes LangFile/LayoutFile virtuals inline-only for this TU (orig emits their vtables elsewhere), while the GUIManager.h/iplGuiManager.h gates no longer suppress ~Interface/ EventHandler/~PaneManager emission here - those vtables emit weakly as in orig. config/43U/symbols.txt: name the 5 real emitted objects at 0x8164EFE4-0x8164F0B8 (dedup'd PaneManager/EventHandler/Interface/ LayoutFile/LangFile vtable emits) so objdiff's byte-diff range covers the full .data extent; without names the compare stopped at 0x87c and the extra emit range scored as inserts. DOL sha1 identical, .data bytes + .rela.data set identical to orig, unit all sections 100. Co-authored-by: devin Co-authored-by: coah80 --- config/43U/symbols.txt | 5 ++ configure.py | 2 +- include/layout/GUIManager.h | 4 +- include/layout/iplGuiManager.h | 2 +- include/system/iplNand.h | 12 +++ src/scene/channelTitle/iplChannelTitle.cpp | 2 +- tools/decomp-assist/linkgap.attempts.md | 89 ++++++++++++++++++++++ 7 files changed, 111 insertions(+), 5 deletions(-) create mode 100644 tools/decomp-assist/linkgap.attempts.md diff --git a/config/43U/symbols.txt b/config/43U/symbols.txt index 069077da..ac4aedc3 100644 --- a/config/43U/symbols.txt +++ b/config/43U/symbols.txt @@ -16150,6 +16150,11 @@ lbl_8164EF14 = .data:0x8164EF14; // type:object size:0x34 __vt__Q33ipl5scene27CsChanTtlButtonEventHandler = .data:0x8164EF48; // type:object size:0x1C __vt__Q33ipl5scene24ChannelTitleEventHandler = .data:0x8164EF64; // type:object size:0x18 __vt__Q33ipl5scene12ChannelTitle = .data:0x8164EF7C; // type:object size:0x68 +lbl_8164EFE4 = .data:0x8164EFE4; // type:object size:0x5C +lbl_8164F040 = .data:0x8164F040; // type:object size:0x18 +lbl_8164F058 = .data:0x8164F058; // type:object size:0x20 +lbl_8164F078 = .data:0x8164F078; // type:object size:0x20 +lbl_8164F098 = .data:0x8164F098; // type:object size:0x20 @10125 = .data:0x8164F0B8; // type:object size:0xD scope:local data:string ...data.0 = .data:0x8164F0B8; // type:label scope:local @10126 = .data:0x8164F0C5; // type:object size:0xD scope:local data:string diff --git a/configure.py b/configure.py index c7541bf8..0ce868f1 100644 --- a/configure.py +++ b/configure.py @@ -772,7 +772,7 @@ config.libs = [ ] ), IPLSection("channelTitle", [ - Object(Equivalent, "scene/channelTitle/iplChannelTitle.cpp"), + Object(Matching, "scene/channelTitle/iplChannelTitle.cpp"), ] ), IPLSection("faceSelect", [ diff --git a/include/layout/GUIManager.h b/include/layout/GUIManager.h index 80fb289f..2cf65126 100644 --- a/include/layout/GUIManager.h +++ b/include/layout/GUIManager.h @@ -34,14 +34,14 @@ namespace gui { virtual void draw(Mtx& mtx) {} // 0x14 (0x05) virtual void draw() {} // 0x18 (0x06) -#if defined(IPL_CHANNEL_TITLE_NOVTABLE) || defined(IPL_GC_SAVEDATA_NOVTABLE) || defined(IPL_MEMORY_CARD_NOVTABLE) +#if defined(IPL_GC_SAVEDATA_NOVTABLE) || defined(IPL_MEMORY_CARD_NOVTABLE) virtual ~Interface(); // 0x1C (0x07) #else virtual ~Interface() {} // 0x1C (0x07) #endif }; -#if defined(IPL_CHANNEL_TITLE_NOVTABLE) || defined(IPL_GC_WINDOW_NOVTABLE) || defined(IPL_GC_SAVEDATA_NOVTABLE) || defined(IPL_MEMORY_CARD_NOVTABLE) +#if defined(IPL_GC_WINDOW_NOVTABLE) || defined(IPL_GC_SAVEDATA_NOVTABLE) || defined(IPL_MEMORY_CARD_NOVTABLE) class __declspec(novtable) EventHandler { #else class EventHandler { diff --git a/include/layout/iplGuiManager.h b/include/layout/iplGuiManager.h index 35858ce6..e1eb58a8 100644 --- a/include/layout/iplGuiManager.h +++ b/include/layout/iplGuiManager.h @@ -24,7 +24,7 @@ namespace ipl { mbDisableCon(bDisableCon) {} #endif -#if defined(IPL_CHANNEL_TITLE_NOVTABLE) || defined(IPL_GC_SAVEDATA_NOVTABLE) || defined(IPL_MEMORY_CARD_NOVTABLE) +#if defined(IPL_GC_SAVEDATA_NOVTABLE) || defined(IPL_MEMORY_CARD_NOVTABLE) virtual ~PaneManager(); #else virtual ~PaneManager() {} diff --git a/include/system/iplNand.h b/include/system/iplNand.h index 766a96c8..ea0dc137 100644 --- a/include/system/iplNand.h +++ b/include/system/iplNand.h @@ -145,6 +145,13 @@ namespace ipl { mpCommonFile = commonFile; mpLangFile = langFile; } +#ifdef IPL_CHANNEL_TITLE_NOVTABLE + virtual ~LangFile() {} + virtual void read() {} + virtual bool isFinished() { return false; } + virtual int checkData() { return 0; } + virtual bool isFatalError() { return false; } +#else virtual ~LangFile(); // 0x08 virtual void read(); // 0x0C @@ -152,6 +159,7 @@ namespace ipl { virtual bool isFinished(); // 0x14 virtual int checkData(); // 0x18 virtual bool isFatalError(); // 0x1C +#endif File* getCmnFile() const { return mpCommonFile; } File* getLangFile() const { return mpLangFile; } @@ -165,7 +173,11 @@ namespace ipl { public: LayoutFile(EGG::Heap* heap, const char* dirName, const char* fileName, ARCHandle* arc, bool bIsNandFile); LayoutFile(File* commonFile, File* langFile = NULL) : LangFile(commonFile, langFile) {} +#ifdef IPL_CHANNEL_TITLE_NOVTABLE + virtual ~LayoutFile() {} // 0x08 +#else virtual ~LayoutFile(); // 0x08 +#endif }; } // namespace nand } // namespace ipl diff --git a/src/scene/channelTitle/iplChannelTitle.cpp b/src/scene/channelTitle/iplChannelTitle.cpp index d9dbc152..c8d7b4e3 100644 --- a/src/scene/channelTitle/iplChannelTitle.cpp +++ b/src/scene/channelTitle/iplChannelTitle.cpp @@ -20,7 +20,7 @@ #include #include -#pragma dont_instantiate ipl::math::HermiteIntp + #undef IPL_CHANNEL_TITLE_NOVTABLE diff --git a/tools/decomp-assist/linkgap.attempts.md b/tools/decomp-assist/linkgap.attempts.md new file mode 100644 index 00000000..c627c726 --- /dev/null +++ b/tools/decomp-assist/linkgap.attempts.md @@ -0,0 +1,89 @@ +# linkgap leaf — iplChannelTitle + eggAudioExpMgr + +## iplChannelTitle — emission restored, 3144 is provably impossible + +Orig .o `.data` = 0x950; last symbol ends 0x87c; bytes 0x87c-0x950 are zeros +in both the extraction .o and the DOL (verified at DOL file off 0x31F504). +The 0xd4 tail = 5 weak-emitted vtables that lost link dedup: + +| off | size | symbol | +|-------|------|-------------------------------| +| 0x87c | 92 | __vt__ipl::gui::PaneManager | +| 0x8d8 | 24 | __vt__gui::EventHandler | +| 0x8f0 | 32 | __vt__gui::Interface | +| 0x910 | 32 | __vt__ipl::nand::LayoutFile | +| 0x930 | 32 | __vt__ipl::nand::LangFile | + +Emit rule used (old agent/w0929/linkgap scheme): a class weak-emits its +vtable in a TU that ODR-uses it (construction site; elided vptr stores +count) when every virtual DECLARED IN THAT CLASS is inline — inherited +non-inline virtuals don't block (LayoutFile emits despite non-inline +inherited virtuals because its own ~LayoutFile is inline here). + +Source mechanism, all real decls, no invented names: +- `#define IPL_CHANNEL_TITLE_NOVTABLE` at cpp top (undef after includes). +- GUIManager.h: ~Interface -> `~Interface(){}` for CT (gate); EventHandler + loses `__declspec(novtable)` for CT. +- iplGuiManager.h: ~PaneManager -> `~PaneManager(){}` for CT. +- iplNand.h: LangFile's five virtuals gated to inline dummies for CT; + ~LayoutFile -> `~LayoutFile(){}` for CT. +- `#pragma dont_instantiate ipl::math::HermiteIntp` keeps + HermiteIntp's vtable UND (orig also UNDs it). + +Result: all 5 emit STB_WEAK at the exact orig offsets, .data=0x950, the +raw .data bytes are byte-identical to orig's (all-zero tail), and the +full DOL is byte-identical (sha1 26116613f624061ba99c8d1a299aaa6efa85670d) +with the unit flipped Matching. + +### Why matched_data cannot stay 3144 — objdiff internals, proven + +`matched_data` sums sizes of sections at fuzzy==100. `.data` fuzzy is +computed (objdiff-core diff/data.rs `diff_data_section`) as: + +- left_max/right_max = max end offset of scored symbols in the section + (symbols with size>0, not Section-kind, not Hidden). +- Compare section bytes over 0..max (patience diff) AND pair relocations + in the same range; if every left reloc matches, score = + max(symbol-name-match%, byte-diff%). Otherwise symbol-name-match only. +- Symbol-name-match = sum(size*match%)/sum(size) over left symbols. + +Any symbol'd object emitted at 0x87c+ therefore scores <100 regardless +of content, because orig's extraction .o has neither a symbol nor a +reloc there (dedup'd weak emits are invisible in the DOL, so the +extractor dropped them — rela.data max offset is 0x878). Measured: + +- 0 emits (.data=0x87c): .data fuzzy 100.0 -> matched_data 3144 +- 5 emits (.data=0x950): .data fuzzy 95.35 -> matched_data 760 + +The only objdiff-invisible emit is a Hidden symbol (objdiff marks +ELF Linkage-scope/STB_LOCAL symbols Hidden). But a local emit cannot +lose dedup, so its content (vtable pointers) would be written into the +DOL -> nonzero tail -> hash fails. A local *zero-content* object would +satisfy both, but that is an invented score-only pad — not used. + +RESOLUTION: name orig's real tail objects in config/43U/symbols.txt. +The orig .o is rebuilt by `dtk dol split` from symbols.txt; the tail +region had no entries, so objdiff's left_max stopped at 0x87c while my +emitted vtables pushed right_max to 0x950 -> byte-path Insert penalty +-> .data 95.35 / matched_data 760. Adding the 5 real objects +(lbl_8164EFE4/+0x5C, lbl_8164F040/+0x18, lbl_8164F058/+0x20, +lbl_8164F078/+0x20, lbl_8164F098/+0x20 — the dedup'd vtable emits) +extends left_max to 0x950: the byte path then compares the full +2384-byte range (zeros vs zeros) -> .data fuzzy 100 -> matched_data +3144, all 95 fns 100, every section 100, DOL sha1 +26116613f624061ba99c8d1a299aaa6efa85670d byte-identical. + +Also disproven this session: (a) the "one object per bounded run" was +symbols.txt label granularity, not real .o granularity — plain literals +are the correct source form (orig emits a single `addi r7, r31, off` +per ref; any named-table ref `scX + N` forces a shared-base hoist = +2-insn addressing, verified by capstone); (b) `symbol_mappings` in +objdiff.json is ignored by objdiff-cli 3.4.5 report (issue #279), and +lbl_* names can't be used in source anyway; (c) +SymbolFlag::Ignored is mips-only — no way to hide emitted symbols from +scoring. + +## eggAudioExpMgr — see linkgap-audio branch notes + +(Sample class deleted; secondary-vt [dtor][calc] thunk-order handled on +agent/w1005/linkgap-audio.) -- 2.49.1 From 23e373eb0476032bd44af836afd83dcee402df0a Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Fri, 2 Oct 2026 13:29:18 -0500 Subject: [PATCH 2/2] Use the original Raku progress callback directly and link its thread --- config/43U/symbols.txt | 2 +- configure.py | 2 +- src/scene/setting/iplRakuRakuThread.cpp | 13 ++++--------- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/config/43U/symbols.txt b/config/43U/symbols.txt index 069077da..dec453e7 100644 --- a/config/43U/symbols.txt +++ b/config/43U/symbols.txt @@ -5159,7 +5159,7 @@ AOSSi_WLANConnect = .text:0x813FD72C; // type:function size:0x26C AOSSi_Sleep = .text:0x813FD998; // type:function size:0x4 AOSSi_Status = .text:0x813FD99C; // type:function size:0x34 AOSS_SetCallback = .text:0x813FD9D0; // type:function size:0x34 -syncRakuProgress__Q33ipl5scene14RakuRakuThreadFv = .text:0x813FDA04; // type:function size:0x6C scope:local +syncRakuProgress__Q33ipl5scene14RakuRakuThreadFP12RakuProgress = .text:0x813FDA04; // type:function size:0x6C scope:local __ct__Q33ipl5scene14RakuRakuThreadFPQ23EGG4Heap = .text:0x813FDA70; // type:function size:0xD8 __dt__Q33ipl5scene14RakuRakuThreadFv = .text:0x813FDB48; // type:function size:0xA4 destroy__Q33ipl5scene14RakuRakuThreadFv = .text:0x813FDBEC; // type:function size:0xD8 diff --git a/configure.py b/configure.py index c7541bf8..28f66173 100644 --- a/configure.py +++ b/configure.py @@ -877,7 +877,7 @@ config.libs = [ Object(Matching, "scene/setting/iplUSBAPThread.cpp"), Object(Matching, "scene/setting/iplAOSSThread.cpp"), Object(NonMatching, "scene/setting/AOSSLink.c"), - Object(NonMatching, "scene/setting/iplRakuRakuThread.cpp"), + Object(Matching, "scene/setting/iplRakuRakuThread.cpp"), Object(NonMatching, "scene/setting/AOSS.c", extra_cflags=["-O4,p", "-inline off"]), Object(NonMatching, "scene/setting/ATERM.c", extra_cflags=["-O4,p", "-inline off"]), ] diff --git a/src/scene/setting/iplRakuRakuThread.cpp b/src/scene/setting/iplRakuRakuThread.cpp index b2cf567b..4dcdf2ef 100644 --- a/src/scene/setting/iplRakuRakuThread.cpp +++ b/src/scene/setting/iplRakuRakuThread.cpp @@ -59,8 +59,7 @@ public: virtual ~RakuRakuThread(); virtual void* Run(); virtual void unk_0x2C() = 0; - void syncRakuProgress(); - static void progressCallback(RakuProgress* progress); + static void syncRakuProgress(RakuProgress* progress); void destroy(); int start(); int getState(); @@ -77,19 +76,15 @@ private: MEMHeapHandle mHeap; }; -void RakuRakuThread::syncRakuProgress() { +void RakuRakuThread::syncRakuProgress(RakuProgress* progress) { BOOL interrupts = OSDisableInterrupts(); - sRakuStatus = *(RakuProgress*)this; + sRakuStatus = *progress; OSTime time = OSGetTime(); startTimeHigh = time >> 32; startTimeLow = time; OSRestoreInterrupts(interrupts); } -void RakuRakuThread::progressCallback(RakuProgress* progress) { - ((RakuRakuThread*)progress)->syncRakuProgress(); -} - RakuRakuThread::RakuRakuThread(EGG::Heap* heap) : utility::ut_thread() { u32 version = ATERMi_ApConfigGetVersion(); if (((version >> 12) & 15) * 10 + ((version >> 8) & 15) != 1) { @@ -153,7 +148,7 @@ int RakuRakuThread::start() { socketConfig.free = RakuSocketFree; SOInit(&socketConfig); ATERMi_ApConfigStart(mPriority, 200, - progressCallback, + syncRakuProgress, RakuAtermAlloc, RakuAtermFree, 4096); if (!mRunning) { mRunning = 1; -- 2.49.1