From 09316e5096d697ae89ba598e0a503b9f4ee24e20 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Mon, 28 Sep 2026 03:52:02 +0000 Subject: [PATCH 01/13] fix: restore MSL extab flags and force-active stripped symbols --- config/43U/config.yml | 8 ++++++++ config/ldscript_ipl2.lcf | 4 ++++ configure.py | 10 +++++----- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/config/43U/config.yml b/config/43U/config.yml index 4a2c10af..c9324235 100644 --- a/config/43U/config.yml +++ b/config/43U/config.yml @@ -10,6 +10,14 @@ splits: 'config/43U/splits.txt' ldscript_template: 'config/ldscript_ipl2.lcf' +force_active: + - labs + - itoa + - strpbrk + - strspn + - strcspn + - atol + quick_analysis: true fill_gaps: false diff --git a/config/ldscript_ipl2.lcf b/config/ldscript_ipl2.lcf index 7e39b783..27bf1dcc 100644 --- a/config/ldscript_ipl2.lcf +++ b/config/ldscript_ipl2.lcf @@ -36,3 +36,7 @@ SECTIONS { __ArenaLo = (_db_stack_addr + 0x1F) & ~0x1F; __ArenaHi = $ARENAHI; } + +FORCEACTIVE { + $FORCEACTIVE +} diff --git a/configure.py b/configure.py index 19414553..0fdcfc42 100644 --- a/configure.py +++ b/configure.py @@ -1946,13 +1946,13 @@ config.libs = [ Object(NonMatching, "MSL_Common_Embedded/ansi_fp.c"), Object(Matching, "MSL_Common/ctype.c"), Object(NonMatching, "MSL_Common/locale.c"), - Object(Matching, "MSL_Common/arith.c"), - Object(Matching, "MSL_Common/bsearch.c"), - Object(Matching, "MSL_Common/buffer_io.c"), + Object(Matching, "MSL_Common/arith.c", extra_cflags=["-Cpp_exceptions on"]), + Object(Matching, "MSL_Common/bsearch.c", extra_cflags=["-Cpp_exceptions on"]), + Object(Matching, "MSL_Common/buffer_io.c", extra_cflags=["-Cpp_exceptions on"]), Object(Matching, "MSL_Common/direct_io.c", extra_cflags=["-Cpp_exceptions on"]), Object(NonMatching, "MSL_Common/file_io.c"), - Object(Matching, "MSL_Common/FILE_POS.c"), - Object(Matching, "MSL_Common/mbstring.c"), + Object(Matching, "MSL_Common/FILE_POS.c", extra_cflags=["-Cpp_exceptions on"]), + Object(Matching, "MSL_Common/mbstring.c", extra_cflags=["-Cpp_exceptions on"]), Object(Matching, "MSL_Common/mem.c"), Object(Matching, "MSL_Common/mem_funcs.c"), Object(Matching, "MSL_Common/math_api.c"), -- 2.49.1 From 43ce074617abc95c5137be329240bf4b5702573c Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Mon, 28 Sep 2026 03:59:48 +0000 Subject: [PATCH 02/13] fix: limit ChannelTitle novtable header changes to IPL_CHANNEL_TITLE_NOVTABLE PR #182 made gui::EventHandler novtable and rewrote HermiteIntp for every unit, which dropped __vt__Q23gui12EventHandler from linked scene units and moved EventHandler::onEvent. Restore the pre-#182 definitions unless the macro is defined. --- include/layout/GUIManager.h | 4 +++ include/math/iplInterporation.h | 53 +++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/include/layout/GUIManager.h b/include/layout/GUIManager.h index 8d163534..2569806c 100644 --- a/include/layout/GUIManager.h +++ b/include/layout/GUIManager.h @@ -37,7 +37,11 @@ namespace gui { #endif }; +#ifdef IPL_CHANNEL_TITLE_NOVTABLE class __declspec(novtable) EventHandler { +#else + class EventHandler { +#endif public: enum { ON_TRIG = 0, diff --git a/include/math/iplInterporation.h b/include/math/iplInterporation.h index 1943578a..2e3d7471 100644 --- a/include/math/iplInterporation.h +++ b/include/math/iplInterporation.h @@ -44,6 +44,7 @@ namespace ipl { T get2() const { return (((mStart * (mMaxFrame - mFrame)) + (mEnd * mFrame)) / mMaxFrame); } }; +#ifdef IPL_CHANNEL_TITLE_NOVTABLE template class __declspec(novtable) HermiteIntp : public utility::FrameController { public: @@ -130,6 +131,58 @@ namespace ipl { }; #pragma dont_instantiate HermiteIntp +#else + template + class HermiteIntp : public Interporation { + public: + HermiteIntp() {} + + void init(const T& start, const T& end, f32 maxFrame, f32 param_5, f32 param_6, int playback = ANIM_TYPE_FORWARD, f32 speed = 1.0f) { + mStart = start; + mEnd = end; + utility::FrameController::init(playback, maxFrame, 0.0f, speed); + unkVal0 = param_5; + unkVal1 = param_6; + } + + T get() const { + f32 var_f27 = mFrame; + f32 var_f28 = 1.0f / mMaxFrame; + f32 t1t2 = + (var_f28 * (var_f28 * (var_f28 * (var_f27 * (2.0f * var_f27 * var_f27))))) - (var_f28 * (var_f28 * (3.0f * var_f27 * var_f27))); + + T r = (mStart * (1.0f + t1t2)) - (mEnd * t1t2); + + f32 temp_f4 = var_f27 * var_f27; + f32 temp_f7 = var_f28 * (var_f28 * (var_f27 * temp_f4)); + f32 temp_f3 = + (unkVal0 * (var_f27 + (temp_f7 - (var_f28 * (2.0f * var_f27 * var_f27))))) + (unkVal1 * (temp_f7 - (var_f28 * temp_f4))); + + r = r + temp_f3; + + return r; + + /*f32 var_f27 = mMaxFrame; + f32 var_f28 = 1.0f / mMaxFrame; + T sp28 = mEnd * ((var_f28 * (var_f28 * (var_f28 * (var_f27 * (2.0f * var_f27 * var_f27))))) - + (var_f28 * (var_f28 * (3.0f * var_f27 * var_f27)))); + T sp1C = mStart * (1.0f + ((var_f28 * (var_f28 * (var_f28 * (var_f27 * (2.0f * var_f27 * var_f27))))) - + (var_f28 * (var_f28 * (3.0f * var_f27 * var_f27))))); + T r = sp1C - sp28; + + f32 temp_f4 = var_f27 * var_f27; + f32 temp_f7 = var_f28 * (var_f28 * (var_f27 * temp_f4)); + f32 temp_f3 = + (unkVal0 * (var_f27 + (temp_f7 - (var_f28 * (2.0f * var_f27 * var_f27))))) + (unkVal1 * (temp_f7 - (var_f28 * temp_f4))); + r = r + temp_f3; + return r;*/ + } + + protected: + f32 unkVal0; + f32 unkVal1; + }; +#endif } // namespace math } // namespace ipl -- 2.49.1 From 5a3afa664e917adbb414fc7a972b00cbe97b22e3 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Mon, 28 Sep 2026 03:59:48 +0000 Subject: [PATCH 03/13] fix: restore u16 addrType in cdb::Manager::createNewRecord The original symbol takes u16 (mangled UsUs); the enum parameter made createNewRecord 4 bytes longer. Match the caller in iplNwc24Manager with a u16 local assigned through if/else. --- include/system/iplCdbManager.h | 2 +- src/system/iplCdbManager.cpp | 2 +- src/system/iplNwc24Manager.cpp | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/system/iplCdbManager.h b/include/system/iplCdbManager.h index 66e62ba5..4120d09a 100644 --- a/include/system/iplCdbManager.h +++ b/include/system/iplCdbManager.h @@ -25,7 +25,7 @@ namespace ipl { void closeDatabase(); BOOL createNewRecord(const char* recordName, const char* recordFileType, const OSCalendarTime* dateTime, u32* gameCode, u16* makerCode, - const math::VEC2& recordPos, u32 recordFlags, const NWC24FriendAddr& addr, NWC24FriendType addrType, u16 noReplyFlag, + const math::VEC2& recordPos, u32 recordFlags, const NWC24FriendAddr& addr, u16 addrType, u16 noReplyFlag, const wchar_t* titleText, const wchar_t* bodyText, const void* faceData, const void** attachData, u32* attachSize, RBRAttachmentType* attachType); diff --git a/src/system/iplCdbManager.cpp b/src/system/iplCdbManager.cpp index b72bd1bd..d34468c4 100644 --- a/src/system/iplCdbManager.cpp +++ b/src/system/iplCdbManager.cpp @@ -38,7 +38,7 @@ namespace ipl { } BOOL Manager::createNewRecord(const char* recordName, const char* recordFileType, const OSCalendarTime* dateTime, u32* gameCode, - u16* makerCode, const math::VEC2& recordPos, u32 recordFlags, const NWC24FriendAddr& addr, NWC24FriendType addrType, + u16* makerCode, const math::VEC2& recordPos, u32 recordFlags, const NWC24FriendAddr& addr, u16 addrType, u16 noReplyFlag, const wchar_t* titleText, const wchar_t* bodyText, const void* faceData, const void** attachData, u32* attachSize, RBRAttachmentType* attachType) { BOOL result = FALSE; diff --git a/src/system/iplNwc24Manager.cpp b/src/system/iplNwc24Manager.cpp index 4a9b0058..81f315be 100644 --- a/src/system/iplNwc24Manager.cpp +++ b/src/system/iplNwc24Manager.cpp @@ -569,7 +569,7 @@ namespace ipl { NWC24FriendAddr msgFriendAddr; memset(&msgFriendAddr, 0, sizeof(msgFriendAddr)); - NWC24FriendType msgFriendType; + u16 msgFriendType; // Get friend data if (msgType == NWC24_MSGTYPE_PUBLIC) { @@ -586,7 +586,11 @@ namespace ipl { } else { u32 index = 0; getMsgFromId(&msgObj, &msgFriendAddr.wiiId); - msgFriendType = msgFriendAddr.wiiId == myUserId ? NWC24_FRIENDTYPE_NONE : NWC24_FRIENDTYPE_WII; + if (msgFriendAddr.wiiId == myUserId) { + msgFriendType = NWC24_FRIENDTYPE_NONE; + } else { + msgFriendType = NWC24_FRIENDTYPE_WII; + } if (searchFriendInfo(msgFriendAddr.wiiId, &index)) { NWC24FriendInfo friendInfo ALIGN32; readFriendInfo(&friendInfo, index); -- 2.49.1 From a2f2d98ba16413e01c1f3096e59648fe0ff0aa06 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Mon, 28 Sep 2026 04:00:46 +0000 Subject: [PATCH 04/13] fix: emit TVRC loop handlers after TVRCSendStartAsync The original object places both alarm handlers at the end of .text. --- src/system/TVRC.cpp | 334 ++++++++++++++++++++++---------------------- 1 file changed, 169 insertions(+), 165 deletions(-) diff --git a/src/system/TVRC.cpp b/src/system/TVRC.cpp index ebbe9b4c..8b963c23 100644 --- a/src/system/TVRC.cpp +++ b/src/system/TVRC.cpp @@ -119,175 +119,11 @@ namespace LibTVRC { void __FTVRCLoop0Handler(OSAlarm *alarm, OSContext *ctx); - void __FTVRCLoop1Handler(OSAlarm *alarm, OSContext *ctx) { - if (_ctCombo != 0 && _isActive != 0) { - if (_func1state == -1) { - _unitStartTime = OSGetTime(); - _func1state = 0; - } - - if (_isLastOnOff != 0) { - _unitLastTime = OSGetTime(); - - if (_func1state == 0) { - WPADSetSensorBarPower(TRUE); - _func1state = 1; - OSSetAlarm(&_alarm, _tickWait[1], __FTVRCLoop1Handler); - return; - } - - BOOL active = (int)(_unitLastTime - _unitStartTime) < (int)(*(u32*)&_tickT * _ctCombo); - WPADSetSensorBarPower(FALSE); - _func1state = 0; - if (active) { - OSSetAlarm(&_alarm, _tickWait[0], __FTVRCLoop1Handler); - } else { - OSSetAlarm(&_alarm, _tickWait[0], __FTVRCLoop0Handler); - } - } else { - WPADSetSensorBarPower(FALSE); - OSSetAlarm(&_alarm, *(u32*)&_tickT * _ctCombo, __FTVRCLoop0Handler); - } - } - } + void __FTVRCLoop1Handler(OSAlarm *alarm, OSContext *ctx); } // namespace LibTVRC using namespace LibTVRC; -extern "C" asm void __FTVRCLoop0Handler__7LibTVRCFP7OSAlarmP9OSContext() { - nofralloc - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - mr r31, r4 - stw r30, 0x8(r1) - mr r30, r3 - lwz r0, _isActive__7LibTVRC - cmpwi r0, 0 - bne TVRCLoop0_active - li r0, 2 - stw r0, _func0state__7LibTVRC -TVRCLoop0_active: - lwz r0, _func0state__7LibTVRC - cmpwi r0, 1 - bne TVRCLoop0_check_state - li r0, 0 - stw r0, _func0state__7LibTVRC - b TVRCLoop0_prepare -TVRCLoop0_check_state: - cmpwi r0, 0 - bne TVRCLoop0_check_stop - lwz r4, _loop0count__7LibTVRC - li r0, 0 - lwz r3, _isOnOff__7LibTVRC - addi r4, r4, 1 - stw r0, _func0state__7LibTVRC - stw r4, _loop0count__7LibTVRC - stw r3, _isLastOnOff__7LibTVRC - b TVRCLoop0_prepare -TVRCLoop0_check_stop: - cmpwi r0, 2 - bne TVRCLoop0_prepare - lwz r0, _isReserveDeactive__7LibTVRC - cmpwi r0, 0 - bne TVRCLoop0_stop - bl OSGetTime - lis r5, 0x8000 - lwz r6, _totalStartTime__7LibTVRC+4 - lwz r5, 0xf8(r5) - li r0, 0x3e8 - subfc r4, r6, r4 - lwz r7, _totalStartTime__7LibTVRC - srwi r6, r5, 2 - li r5, 0 - divwu r6, r6, r0 - subfe r3, r7, r3 - bl __div2i - lwz r7, _limitMilli__7LibTVRC - li r6, 0 - xoris r5, r3, 0x8000 - xoris r0, r6, 0x8000 - subfc r3, r4, r7 - subfe r5, r5, r0 - subfe r5, r0, r0 - neg. r5, r5 - beq TVRCLoop0_continue -TVRCLoop0_stop: - li r3, 1 - bl WPADSetSensorBarPower - li r0, 0 - stw r0, _isActive__7LibTVRC - b TVRCLoop0_exit -TVRCLoop0_continue: - lwz r4, _isUseRepeatCode__7LibTVRC - lwz r3, _repeatBitLength__7LibTVRC - lwz r0, _repeatBitArray__7LibTVRC - stw r4, _isRepeatActive__7LibTVRC - stw r3, _bitLength__7LibTVRC - stw r0, _bitArray__7LibTVRC - stw r6, _isOnOff__7LibTVRC - stw r6, _isLastOnOff__7LibTVRC - stw r6, _func0state__7LibTVRC - stw r6, _loop0count__7LibTVRC -TVRCLoop0_prepare: - li r3, 0 - lwz r7, _bitArray__7LibTVRC - stw r3, _ctCombo__7LibTVRC - lwz r8, _bitLength__7LibTVRC - lwz r4, _loop0count__7LibTVRC - lwz r0, _isLastOnOff__7LibTVRC - b TVRCLoop0_check_bits -TVRCLoop0_bit_loop: - srawi r5, r4, 3 - addi r3, r3, 1 - addze r6, r5 - srawi r5, r4, 3 - lbzx r6, r7, r6 - addze r5, r5 - slwi r5, r5, 3 - stw r3, _ctCombo__7LibTVRC - subf r5, r5, r4 - subfic r5, r5, 7 - sraw r5, r6, r5 - clrlwi r5, r5, 31 - cmpw r0, r5 - stw r5, _isOnOff__7LibTVRC - beq TVRCLoop0_bit_match - li r3, -1 - li r0, 0 - stw r3, _func1state__7LibTVRC - mr r3, r30 - mr r4, r31 - stw r0, _func0state__7LibTVRC - bl __FTVRCLoop1Handler__7LibTVRCFP7OSAlarmP9OSContext - b TVRCLoop0_exit -TVRCLoop0_bit_match: - addi r4, r4, 1 - stw r5, _isLastOnOff__7LibTVRC - mr r0, r5 - stw r4, _loop0count__7LibTVRC -TVRCLoop0_check_bits: - cmpw r4, r8 - blt TVRCLoop0_bit_loop - addi r3, r3, 1 - li r5, -1 - li r0, 2 - stw r3, _ctCombo__7LibTVRC - mr r3, r30 - mr r4, r31 - stw r5, _func1state__7LibTVRC - stw r0, _func0state__7LibTVRC - bl __FTVRCLoop1Handler__7LibTVRCFP7OSAlarmP9OSContext -TVRCLoop0_exit: - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - lwz r30, 0x8(r1) - mtlr r0 - addi r1, r1, 0x10 - blr -} - BOOL TVRCInit(void* pRsrc) { if (_isInitialized) { _lastError = 0; @@ -596,3 +432,171 @@ TVRCSendStartAsync_exit: addi r1, r1, 0x40 blr } + +extern "C" asm void __FTVRCLoop0Handler__7LibTVRCFP7OSAlarmP9OSContext() { + nofralloc + stwu r1, -0x10(r1) + mflr r0 + stw r0, 0x14(r1) + stw r31, 0xc(r1) + mr r31, r4 + stw r30, 0x8(r1) + mr r30, r3 + lwz r0, _isActive__7LibTVRC + cmpwi r0, 0 + bne TVRCLoop0_active + li r0, 2 + stw r0, _func0state__7LibTVRC +TVRCLoop0_active: + lwz r0, _func0state__7LibTVRC + cmpwi r0, 1 + bne TVRCLoop0_check_state + li r0, 0 + stw r0, _func0state__7LibTVRC + b TVRCLoop0_prepare +TVRCLoop0_check_state: + cmpwi r0, 0 + bne TVRCLoop0_check_stop + lwz r4, _loop0count__7LibTVRC + li r0, 0 + lwz r3, _isOnOff__7LibTVRC + addi r4, r4, 1 + stw r0, _func0state__7LibTVRC + stw r4, _loop0count__7LibTVRC + stw r3, _isLastOnOff__7LibTVRC + b TVRCLoop0_prepare +TVRCLoop0_check_stop: + cmpwi r0, 2 + bne TVRCLoop0_prepare + lwz r0, _isReserveDeactive__7LibTVRC + cmpwi r0, 0 + bne TVRCLoop0_stop + bl OSGetTime + lis r5, 0x8000 + lwz r6, _totalStartTime__7LibTVRC+4 + lwz r5, 0xf8(r5) + li r0, 0x3e8 + subfc r4, r6, r4 + lwz r7, _totalStartTime__7LibTVRC + srwi r6, r5, 2 + li r5, 0 + divwu r6, r6, r0 + subfe r3, r7, r3 + bl __div2i + lwz r7, _limitMilli__7LibTVRC + li r6, 0 + xoris r5, r3, 0x8000 + xoris r0, r6, 0x8000 + subfc r3, r4, r7 + subfe r5, r5, r0 + subfe r5, r0, r0 + neg. r5, r5 + beq TVRCLoop0_continue +TVRCLoop0_stop: + li r3, 1 + bl WPADSetSensorBarPower + li r0, 0 + stw r0, _isActive__7LibTVRC + b TVRCLoop0_exit +TVRCLoop0_continue: + lwz r4, _isUseRepeatCode__7LibTVRC + lwz r3, _repeatBitLength__7LibTVRC + lwz r0, _repeatBitArray__7LibTVRC + stw r4, _isRepeatActive__7LibTVRC + stw r3, _bitLength__7LibTVRC + stw r0, _bitArray__7LibTVRC + stw r6, _isOnOff__7LibTVRC + stw r6, _isLastOnOff__7LibTVRC + stw r6, _func0state__7LibTVRC + stw r6, _loop0count__7LibTVRC +TVRCLoop0_prepare: + li r3, 0 + lwz r7, _bitArray__7LibTVRC + stw r3, _ctCombo__7LibTVRC + lwz r8, _bitLength__7LibTVRC + lwz r4, _loop0count__7LibTVRC + lwz r0, _isLastOnOff__7LibTVRC + b TVRCLoop0_check_bits +TVRCLoop0_bit_loop: + srawi r5, r4, 3 + addi r3, r3, 1 + addze r6, r5 + srawi r5, r4, 3 + lbzx r6, r7, r6 + addze r5, r5 + slwi r5, r5, 3 + stw r3, _ctCombo__7LibTVRC + subf r5, r5, r4 + subfic r5, r5, 7 + sraw r5, r6, r5 + clrlwi r5, r5, 31 + cmpw r0, r5 + stw r5, _isOnOff__7LibTVRC + beq TVRCLoop0_bit_match + li r3, -1 + li r0, 0 + stw r3, _func1state__7LibTVRC + mr r3, r30 + mr r4, r31 + stw r0, _func0state__7LibTVRC + bl __FTVRCLoop1Handler__7LibTVRCFP7OSAlarmP9OSContext + b TVRCLoop0_exit +TVRCLoop0_bit_match: + addi r4, r4, 1 + stw r5, _isLastOnOff__7LibTVRC + mr r0, r5 + stw r4, _loop0count__7LibTVRC +TVRCLoop0_check_bits: + cmpw r4, r8 + blt TVRCLoop0_bit_loop + addi r3, r3, 1 + li r5, -1 + li r0, 2 + stw r3, _ctCombo__7LibTVRC + mr r3, r30 + mr r4, r31 + stw r5, _func1state__7LibTVRC + stw r0, _func0state__7LibTVRC + bl __FTVRCLoop1Handler__7LibTVRCFP7OSAlarmP9OSContext +TVRCLoop0_exit: + lwz r0, 0x14(r1) + lwz r31, 0xc(r1) + lwz r30, 0x8(r1) + mtlr r0 + addi r1, r1, 0x10 + blr +} + +namespace LibTVRC { + void __FTVRCLoop1Handler(OSAlarm *alarm, OSContext *ctx) { + if (_ctCombo != 0 && _isActive != 0) { + if (_func1state == -1) { + _unitStartTime = OSGetTime(); + _func1state = 0; + } + + if (_isLastOnOff != 0) { + _unitLastTime = OSGetTime(); + + if (_func1state == 0) { + WPADSetSensorBarPower(TRUE); + _func1state = 1; + OSSetAlarm(&_alarm, _tickWait[1], __FTVRCLoop1Handler); + return; + } + + BOOL active = (int)(_unitLastTime - _unitStartTime) < (int)(*(u32*)&_tickT * _ctCombo); + WPADSetSensorBarPower(FALSE); + _func1state = 0; + if (active) { + OSSetAlarm(&_alarm, _tickWait[0], __FTVRCLoop1Handler); + } else { + OSSetAlarm(&_alarm, _tickWait[0], __FTVRCLoop0Handler); + } + } else { + WPADSetSensorBarPower(FALSE); + OSSetAlarm(&_alarm, *(u32*)&_tickT * _ctCombo, __FTVRCLoop0Handler); + } + } + } +} // namespace LibTVRC -- 2.49.1 From bf2d6fe2efce660c648aec54d25b441c4677006e Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Mon, 28 Sep 2026 04:03:35 +0000 Subject: [PATCH 05/13] fix: construct scene::Date::mscMaxDate with utility::Date The MaxDate wrapper emitted a weak MaxDate ctor that the original does not have, shifting .text by 0x10 after iplDate. Go back to a plain utility::Date followed by the 0x10-byte padding array. --- include/scene/calendar/iplDate.h | 8 +------- src/scene/calendar/iplDate.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/include/scene/calendar/iplDate.h b/include/scene/calendar/iplDate.h index c694479c..2adaeaa3 100644 --- a/include/scene/calendar/iplDate.h +++ b/include/scene/calendar/iplDate.h @@ -7,12 +7,6 @@ namespace ipl { namespace scene { - class MaxDate : public utility::Date { - public: - u8 padding[0x10]; - MaxDate(int year, int month, int day) : utility::Date(year, month, day) {} - }; - class Date : ::gui::EventHandler { public: typedef struct AnmFrame { @@ -88,7 +82,7 @@ namespace ipl { static const char* mscAnimPanes[ANIM_PANE_MAX]; static utility::Date mscMinDate; - static MaxDate mscMaxDate; + static utility::Date mscMaxDate; nw4r::ut::Link mNode1; // 0x40 nw4r::ut::Link mNode2; // 0x48 diff --git a/src/scene/calendar/iplDate.cpp b/src/scene/calendar/iplDate.cpp index d23c2107..974aa4ec 100644 --- a/src/scene/calendar/iplDate.cpp +++ b/src/scene/calendar/iplDate.cpp @@ -60,9 +60,11 @@ namespace ipl { // clang-format on utility::Date Date::mscMinDate(MIN_YEAR, MIN_MONTH, MIN_DAY); - MaxDate Date::mscMaxDate(MAX_YEAR, MAX_MONTH, MAX_DAY); + utility::Date Date::mscMaxDate(MAX_YEAR, MAX_MONTH, MAX_DAY); - DECOMP_FORCE_ACTIVE(iplDate_cpp, &Date::mscMaxDate); + u8 padding[0x10]; + + DECOMP_FORCE_ACTIVE(iplDate_cpp, padding); Date::Date(EGG::Heap* heap, nand::LayoutFile* file, const char* layoutFolder, const char* layoutFileName) : ::gui::EventHandler(), mbAppearMsg(0), unk_0x10(0), unk_0x14(0), mpLayout(NULL), mpCurrentPaneAnim(0), unk_0x3C(0) { -- 2.49.1 From 03743397006f8c2a8ad322bee6a2c2bb74953dc7 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Mon, 28 Sep 2026 04:07:16 +0000 Subject: [PATCH 06/13] fix: define textinput PaneComponent dtor after PaneManager dtor Matches the original object's function order, which also pulls the weak GUIComponent dtor into place. --- src/keyboard/tiGUIManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/keyboard/tiGUIManager.cpp b/src/keyboard/tiGUIManager.cpp index 4d1c0f0b..40df3ca3 100644 --- a/src/keyboard/tiGUIManager.cpp +++ b/src/keyboard/tiGUIManager.cpp @@ -250,6 +250,8 @@ namespace textinput { } } + PaneComponent::~PaneComponent() {} + void PaneManager::createLayoutScene(const nw4r::lyt::Layout& layout) { mIDCounter = 0; walkInChildren(layout.GetRootPane()->GetChildList()); @@ -315,8 +317,6 @@ namespace textinput { return NULL; } - PaneComponent::~PaneComponent() {} - void PaneManager::setAllBoundingBoxComponentTriggerTarget(bool bEnable) { const volatile u16& numObjects = mPaneComponents.numObjects; for (u32 i = 0; i < numObjects; i++) { -- 2.49.1 From fc9418731b5fc68c76097259e3f2ff10291538d9 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Mon, 28 Sep 2026 04:10:06 +0000 Subject: [PATCH 07/13] fix: define EGG audio Arg and SoundHeapMgr ctors out of line Emits IAudioMgr::Arg::Arg first and SoundHeapMgr's weak dtor ahead of its ctor, matching the original eggAudioMgr function order. --- libs/EGG/include/egg/core/eggAudioHeapMgr.h | 2 +- libs/EGG/include/egg/core/eggAudioMgr.h | 9 +-------- libs/EGG/src/core/eggAudioMgr.cpp | 11 +++++++++++ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/libs/EGG/include/egg/core/eggAudioHeapMgr.h b/libs/EGG/include/egg/core/eggAudioHeapMgr.h index a8a37541..1602326d 100644 --- a/libs/EGG/include/egg/core/eggAudioHeapMgr.h +++ b/libs/EGG/include/egg/core/eggAudioHeapMgr.h @@ -15,7 +15,7 @@ namespace EGG { class SoundHeapMgr { public: - SoundHeapMgr() NO_INLINE {} + SoundHeapMgr(); ~SoundHeapMgr() { destroySoundHeap(); } diff --git a/libs/EGG/include/egg/core/eggAudioMgr.h b/libs/EGG/include/egg/core/eggAudioMgr.h index 43909119..62bc570b 100644 --- a/libs/EGG/include/egg/core/eggAudioMgr.h +++ b/libs/EGG/include/egg/core/eggAudioMgr.h @@ -17,14 +17,7 @@ namespace EGG { s32 soundThreadPrio; // 0x08 s32 dvdThreadPrio; // 0x0C - Arg() NO_INLINE { - pHeap = NULL; - - soundThreadPrio = nw4r::snd::SoundSystem::DEFAULT_SOUND_THREAD_PRIORITY; - dvdThreadPrio = nw4r::snd::SoundSystem::DEFAULT_DVD_THREAD_PRIORITY; - - unk_0x04 = 0; - } + Arg(); }; public: diff --git a/libs/EGG/src/core/eggAudioMgr.cpp b/libs/EGG/src/core/eggAudioMgr.cpp index 6b84bd1f..9fb54bce 100644 --- a/libs/EGG/src/core/eggAudioMgr.cpp +++ b/libs/EGG/src/core/eggAudioMgr.cpp @@ -7,6 +7,15 @@ #include namespace EGG { + IAudioMgr::Arg::Arg() { + pHeap = NULL; + + soundThreadPrio = nw4r::snd::SoundSystem::DEFAULT_SOUND_THREAD_PRIORITY; + dvdThreadPrio = nw4r::snd::SoundSystem::DEFAULT_DVD_THREAD_PRIORITY; + + unk_0x04 = 0; + } + SimpleAudioMgr::SimpleAudioMgrArg::SimpleAudioMgrArg() { soundHeapSize = DEFAULT_SOUND_HEAP_SIZE; } @@ -14,6 +23,8 @@ namespace EGG { SimpleAudioMgr::SimpleAudioMgr() : ArcPlayer(&getSoundHeap()) { } + SoundHeapMgr::SoundHeapMgr() {} + SimpleAudioMgr::~SimpleAudioMgr() { } -- 2.49.1 From 6408f7b737a283989a1a2e214bcdb70ef65a483d Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Mon, 28 Sep 2026 04:11:57 +0000 Subject: [PATCH 08/13] fix: define WaveFile dtors in AudioWavePlayer after the ctor The original emits WavePacket's weak dtor first, then the WaveFileAiff and WaveFileWav dtors. Declaring the dtors after getBit keeps the vtables in AudioWaveUtility. --- include/bannerSound/AudioWaveUtility.h | 4 ++-- src/bannerSound/AudioWavePlayer.cpp | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/bannerSound/AudioWaveUtility.h b/include/bannerSound/AudioWaveUtility.h index e492efc8..e3d731be 100644 --- a/include/bannerSound/AudioWaveUtility.h +++ b/include/bannerSound/AudioWaveUtility.h @@ -30,9 +30,9 @@ private: class WaveFileAiff : public WaveFile { public: WaveFileAiff(); - virtual ~WaveFileAiff() {} virtual u32 getBit() const override; + virtual ~WaveFileAiff(); virtual int getChannels() const override { return mNumChans; } virtual f64 getSamplingRate() const override { return mSamplingRate; } virtual s32 getFrames() const override; @@ -67,9 +67,9 @@ private: class WaveFileWav : public WaveFile { public: WaveFileWav(); - virtual ~WaveFileWav() {} virtual u32 getBit() const override; + virtual ~WaveFileWav(); virtual int getChannels() const override { return mNumChans; } virtual f64 getSamplingRate() const override { return mSamplingRate; } virtual s32 getFrames() const override; diff --git a/src/bannerSound/AudioWavePlayer.cpp b/src/bannerSound/AudioWavePlayer.cpp index c80b9b5a..9407bd56 100644 --- a/src/bannerSound/AudioWavePlayer.cpp +++ b/src/bannerSound/AudioWavePlayer.cpp @@ -80,6 +80,10 @@ SimpleWavePlayer::SimpleWavePlayer() : mSetupParam(1, nw4r::snd::SAMPLE_FORMAT_P mThreadRunning = false; } +WaveFileAiff::~WaveFileAiff() {} + +WaveFileWav::~WaveFileWav() {} + SimpleWavePlayer::~SimpleWavePlayer() { } -- 2.49.1 From fb33c24ee1822f768e7acb85725ac6af9fccef45 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Mon, 28 Sep 2026 04:20:44 +0000 Subject: [PATCH 09/13] fix: restore fork-point iplCSMtx string pooling Moving "MTX34" into a static const array put it in .sdata2 and left the pooled .sdata copy to be dead-stripped, shifting both sections. --- src/channelScript/systemmenu/iplCSMtx.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/channelScript/systemmenu/iplCSMtx.cpp b/src/channelScript/systemmenu/iplCSMtx.cpp index e4d288a4..de34bc58 100644 --- a/src/channelScript/systemmenu/iplCSMtx.cpp +++ b/src/channelScript/systemmenu/iplCSMtx.cpp @@ -8,8 +8,6 @@ namespace ipl { // used but pooled first DECOMP_FORCE_ACTIVE(iplCSMtx_cpp, "MTX34"); - static const char mtx34_name[] = "MTX34"; - #define PROPERTY_COUNT 13 extern const CHANSVmPropertyList cPropertyList[PROPERTY_COUNT]; @@ -153,7 +151,7 @@ namespace ipl { BOOL init(CHANSVm* vm) { BOOL result = FALSE; // Create class - CHANSVmNativeClass* cls = CHANSVmAddNativeClass(vm, mtx34_name, ctor, NULL); + CHANSVmNativeClass* cls = CHANSVmAddNativeClass(vm, "MTX34", ctor, NULL); if (cls != NULL) { // Add properties result = CHANSVmAddNativePropertyAccessorsList(vm, cls, cPropertyList, PROPERTY_COUNT) == CHANS_VM_OK; -- 2.49.1 From 14388685543fc9873d3a5f245f8c5a0408e68b3c Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Mon, 28 Sep 2026 04:20:44 +0000 Subject: [PATCH 10/13] fix: share tiGUIManager's named 0.0f constant drawLine_ and PaneComponent::contain now load lbl_81694EE8, as in the original, instead of emitting their own 0.0f ahead of it in .sdata2. --- src/keyboard/tiGUIManager.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/keyboard/tiGUIManager.cpp b/src/keyboard/tiGUIManager.cpp index 40df3ca3..326e11b0 100644 --- a/src/keyboard/tiGUIManager.cpp +++ b/src/keyboard/tiGUIManager.cpp @@ -8,6 +8,7 @@ namespace textinput { namespace gui { extern "C" void drawLine___Q29textinput3guiFfffffUcR8_GXColor(); + extern "C" const f32 lbl_81694EE8; void drawLine_(f32 x0, f32 y0, f32 x1, f32 y1, f32 z, u8 width, GXColor& color) { GXClearVtxDesc(); @@ -30,7 +31,7 @@ namespace textinput { GXSetBlendMode(GX_BM_NONE, GX_BL_ZERO, GX_BL_ZERO, GX_LO_NOOP); Mtx mtx; - MTXTrans(mtx, 0.0f, 0.0f, 0.0f); + MTXTrans(mtx, lbl_81694EE8, lbl_81694EE8, lbl_81694EE8); GXLoadPosMtxImm(mtx, 0); GXSetLineWidth(width, GX_TO_ZERO); @@ -46,16 +47,6 @@ namespace textinput { GXEnd(); } - #pragma push - #pragma section sconst_type ".sdata2" - extern "C" const f32 lbl_81694EE8 = 0.0f; - extern "C" const u8 lbl_81694EEC = 0xFF; - extern "C" const u8 lbl_81694EED = 0x00; - extern "C" const u8 lbl_81694EEE = 0x00; - extern "C" const u8 lbl_81694EEF = 0xFF; - extern "C" const f32 lbl_81694EF0 = 0.5f; - #pragma pop - u32 GUIComponent::updatePointerImpl(const GUIPointer& pointer) { int point = pointer.getCtrlNo(); u32 event = EVENT_NONE; @@ -343,7 +334,7 @@ namespace textinput { MTXInverse(mpPane->GetGlobalMtx(), globalMtx); nw4r::math::VEC3 pos; - MTXMultVec(globalMtx, nw4r::math::VEC3(x, y, 0), pos); + MTXMultVec(globalMtx, nw4r::math::VEC3(x, y, lbl_81694EE8), pos); nw4r::ut::Rect rect = mpPane->GetPaneRect(*drawInfo); @@ -355,6 +346,16 @@ namespace textinput { } } + #pragma push + #pragma section sconst_type ".sdata2" + extern "C" const f32 lbl_81694EE8 = 0.0f; + extern "C" const u8 lbl_81694EEC = 0xFF; + extern "C" const u8 lbl_81694EED = 0x00; + extern "C" const u8 lbl_81694EEE = 0x00; + extern "C" const u8 lbl_81694EEF = 0xFF; + extern "C" const f32 lbl_81694EF0 = 0.5f; + #pragma pop + extern "C" asm void draw__Q39textinput3gui13PaneComponentFv() { nofralloc stwu r1, -0x40(r1) -- 2.49.1 From 72c348e16880c3e695370f227f017cc192a4f352 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Mon, 28 Sep 2026 04:20:49 +0000 Subject: [PATCH 11/13] fix: force-active unreferenced iplDate and WDScan data MWLD dead-strips scene::padding (the 0x10 bytes after Date::mscMaxDate) and the unreferenced WDScan .sdata2 bytes lbl_81695063/lbl_81695067, which shifted .bss and .sdata2. --- config/43U/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/43U/config.yml b/config/43U/config.yml index c9324235..8b30cbc8 100644 --- a/config/43U/config.yml +++ b/config/43U/config.yml @@ -17,6 +17,9 @@ force_active: - strspn - strcspn - atol + - padding__Q23ipl5scene + - lbl_81695063 + - lbl_81695067 quick_analysis: true fill_gaps: false -- 2.49.1 From 8518d7a486cc91af26705743491f6dc7f6a725f3 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Mon, 28 Sep 2026 04:21:25 +0000 Subject: [PATCH 12/13] fix: unlink eggAudioExpMgr MWCC emits the @52 calc thunk ahead of the @52 dtor thunk, but the original has them the other way round, which swaps two vtable entries. Link the original object until the order is matched. --- configure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.py b/configure.py index 0fdcfc42..3e2b8b81 100644 --- a/configure.py +++ b/configure.py @@ -1907,7 +1907,7 @@ config.libs = [ [ Object(Matching, "core/eggAllocator.cpp"), Object(Matching, "core/eggAudioArcPlayerMgr.cpp"), - Object(Matching, "core/eggAudioExpMgr.cpp"), + Object(Equivalent, "core/eggAudioExpMgr.cpp"), Object(Matching, "core/eggAudioFxMgr.cpp"), Object(Matching, "core/eggAudioMgr.cpp"), Object(Matching, "core/eggAudioHeapMgr.cpp"), -- 2.49.1 From a2d71c76ca11a905389119adf7c411e474f53ca3 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Mon, 28 Sep 2026 04:23:42 +0000 Subject: [PATCH 13/13] fix: shrink Calendar .data padding now that EventHandler has a vtable With gui::EventHandler no longer novtable, its 0x18-byte vtable fills most of the gap after __vt__Q33ipl5scene8Calendar; keep one 4-byte pad. --- src/scene/calendar/iplCalendar.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/scene/calendar/iplCalendar.cpp b/src/scene/calendar/iplCalendar.cpp index 27b48278..ae8e1363 100644 --- a/src/scene/calendar/iplCalendar.cpp +++ b/src/scene/calendar/iplCalendar.cpp @@ -880,12 +880,6 @@ namespace ipl { BOOL Calendar::is_lower_limit() { static const f32 pad0 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad1 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad2 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad3 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad4 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad5 __attribute__((section(".data"), aligned(1), used)) = 0.0f; - static const f32 pad6 __attribute__((section(".data"), aligned(1), used)) = 0.0f; return mpBoardDate->year == mscMinDate.year && mpBoardDate->month == mscMinDate.month; } } // namespace scene -- 2.49.1