From 3eb5d8faee2a8e241e1a9decb16c651abda7e85a Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Thu, 1 Oct 2026 18:40:21 -0500 Subject: [PATCH 1/3] cleanup(iplAOSSThread): name stack sentinel like RakuStack (#653) Replace *(u32*)(mpStackBuffer + 0x3FC0) with AOSSStack::sentinel. Co-authored-by: coah --- src/scene/setting/iplAOSSThread.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/scene/setting/iplAOSSThread.cpp b/src/scene/setting/iplAOSSThread.cpp index 66175428..e2b02b55 100644 --- a/src/scene/setting/iplAOSSThread.cpp +++ b/src/scene/setting/iplAOSSThread.cpp @@ -64,6 +64,11 @@ namespace ipl { static s32 sAOSSState; static s32 sAOSSUnk; + struct AOSSStack { + u32 storage[4080]; + u32 sentinel; + }; + class AOSSThread : public utility::ut_thread { public: AOSSThread(EGG::Heap* heap); @@ -84,7 +89,7 @@ namespace ipl { private: s32 mState; // 0x32C s32 mThreadPriority; // 0x330 - u8* mpStackBuffer; // 0x334 + AOSSStack* mpStack; // 0x334 u8* mpHeapBuffer; // 0x338 MEMHeapHandle mpExpHeap; // 0x33C AOSSConfig mAoss; // 0x340 @@ -94,7 +99,7 @@ namespace ipl { mpExpHeap = NULL; sAOSSState = 0; mpHeapBuffer = (u8*)heap->alloc(0x40000, 0x20); - mpStackBuffer = (u8*)heap->alloc(0x1000, 0x20); + mpStack = (AOSSStack*)heap->alloc(0x1000, 0x20); } void AOSSThread::destroy(int flag) { @@ -137,8 +142,8 @@ namespace ipl { mThreadPriority = OSGetThreadPriority(OSGetCurrentThread()) - 2; sAOSSState = 1; SOInit(&config); - memset(mpStackBuffer, 0, 4); - Create(mpStackBuffer, 0x1000, mThreadPriority, TRUE); + memset(mpStack, 0, 4); + Create(mpStack, 0x1000, mThreadPriority, TRUE); OSRestoreInterrupts(level); return 1; @@ -178,7 +183,7 @@ namespace ipl { mAoss.unk_0x04 = 4; NETGetWirelessMacAddress(mAoss.mac); - *(u32*)(mpStackBuffer + 0x3FC0) = 0x97654321; + mpStack->sentinel = 0x97654321; mState = AOSSi_Init(&mAoss); AOSSi_EndLocal(); -- 2.49.1 From 51b78ed7dad0d24f059cf38fa3e4ea384858cde3 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Thu, 1 Oct 2026 18:40:27 -0500 Subject: [PATCH 2/3] cleanup(iplBalloon): name fade/align/margin fields (#654) Rename TextBalloon unk_ members and ctor/setPos params. Co-authored-by: coah --- include/scene/textBalloon/iplBalloon.h | 16 +++++----- src/scene/textBalloon/iplBalloon.cpp | 44 +++++++++++++------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/include/scene/textBalloon/iplBalloon.h b/include/scene/textBalloon/iplBalloon.h index 8dd197ba..794fb47c 100644 --- a/include/scene/textBalloon/iplBalloon.h +++ b/include/scene/textBalloon/iplBalloon.h @@ -14,8 +14,8 @@ namespace ipl { WAIT_UNTIL_FADE_IN = 15 }; - TextBalloon(EGG::Heap* heap, nand::LayoutFile* layoutFile, const char* directory, const char* fileName, const ipl::math::VEC3& unk2, - f32 unk3 = 120.0f, f32 unk4 = 30.0f); + TextBalloon(EGG::Heap* heap, nand::LayoutFile* layoutFile, const char* directory, const char* fileName, const ipl::math::VEC3& initialPos, + f32 margin16x9 = 120.0f, f32 margin4x3 = 30.0f); ~TextBalloon(); void calc(); @@ -31,7 +31,7 @@ namespace ipl { void fadeout(); void fadeoutForce(); - void setPos(const math::VEC3& pos, bool unk0, int unk1); + void setPos(const math::VEC3& pos, bool use16x9X, int hAlign); void updatePos(const math::VEC3& pos); void set_translate(const math::VEC3& trans); @@ -50,7 +50,7 @@ namespace ipl { undefined4 unk_0x00; undefined4 unk_0x04; - BOOL unk_0x08; + BOOL mbWaitingFadeIn; // 0x08 layout::Object* mpLayout; // 0x0C @@ -60,10 +60,10 @@ namespace ipl { u32 mTextLen; // 0x18 math::VEC3 mBalloonPos; // 0x1C - undefined4 unk_0x28; - undefined unk_0x2C; - f32 unk_0x30; - f32 unk_0x34; + undefined4 mHAlign; // 0x28 + undefined mbUse16x9X; // 0x2C + f32 mMargin16x9; // 0x30 + f32 mMargin4x3; // 0x34 int mWaitUntilFadeIn; // 0x38 diff --git a/src/scene/textBalloon/iplBalloon.cpp b/src/scene/textBalloon/iplBalloon.cpp index 39f70cd5..b8b102e2 100644 --- a/src/scene/textBalloon/iplBalloon.cpp +++ b/src/scene/textBalloon/iplBalloon.cpp @@ -10,9 +10,9 @@ namespace ipl { namespace scene { - TextBalloon::TextBalloon(EGG::Heap* heap, nand::LayoutFile* layoutFile, const char* directory, const char* fileName, const math::VEC3& unk2, - f32 unk3, f32 unk4) - : unk_0x08(FALSE), mpText(NULL), mTextLen(0), mBalloonPos(unk2), unk_0x28(0), unk_0x2C(1), unk_0x30(unk3), unk_0x34(unk4), + TextBalloon::TextBalloon(EGG::Heap* heap, nand::LayoutFile* layoutFile, const char* directory, const char* fileName, const math::VEC3& initialPos, + f32 margin16x9, f32 margin4x3) + : mbWaitingFadeIn(FALSE), mpText(NULL), mTextLen(0), mBalloonPos(initialPos), mHAlign(0), mbUse16x9X(1), mMargin16x9(margin16x9), mMargin4x3(margin4x3), mWaitUntilFadeIn(0) { mpLayout = new (heap, 4) layout::Object(heap, layoutFile, directory, fileName); mpLayout->bind("my_IplTopBalloon_a_BalloonInOut.brlan"); @@ -31,7 +31,7 @@ namespace ipl { void TextBalloon::calc() { mpLayout->calc(); - switch (unk_0x08) { + switch (mbWaitingFadeIn) { case TRUE: { break; } @@ -73,7 +73,7 @@ namespace ipl { balloonPane->SetVisible(false); - unk_0x08 = FALSE; + mbWaitingFadeIn = FALSE; } void TextBalloon::fadein() { @@ -81,7 +81,7 @@ namespace ipl { mpLayout->FindPaneByName("N_Balloon")->SetVisible(false); mWaitUntilFadeIn = 0; - unk_0x08 = TRUE; + mbWaitingFadeIn = TRUE; set_textbox(mpText); set_translate(mBalloonPos); @@ -91,17 +91,17 @@ namespace ipl { void TextBalloon::fadeinNoSetTextbox() { if (mpText != NULL) { mWaitUntilFadeIn = 0; - unk_0x08 = TRUE; + mbWaitingFadeIn = TRUE; set_translate(mBalloonPos); } } - void TextBalloon::setPos(const math::VEC3& pos, bool unk0, int unk1) { + void TextBalloon::setPos(const math::VEC3& pos, bool use16x9X, int hAlign) { mBalloonPos = pos; - unk_0x28 = unk1; - unk_0x2C = unk0; + mHAlign = hAlign; + mbUse16x9X = use16x9X; nw4r::ut::Rect proj16x9; nw4r::ut::Rect proj4x3; @@ -109,7 +109,7 @@ namespace ipl { System::getProjectionRect(&proj16x9); System::getProjectionRect4x3(&proj4x3); - if (unk_0x2C == 0) { + if (mbUse16x9X == 0) { mBalloonPos.x *= proj4x3.GetWidth() / proj16x9.GetWidth(); } } @@ -122,7 +122,7 @@ namespace ipl { System::getProjectionRect(&proj16x9); System::getProjectionRect4x3(&proj4x3); - if (unk_0x2C == 0) { + if (mbUse16x9X == 0) { mBalloonPos.x *= proj4x3.GetWidth() / proj16x9.GetWidth(); } @@ -133,27 +133,27 @@ namespace ipl { if (mWaitUntilFadeIn++ > WAIT_UNTIL_FADE_IN) { anm_fadein(); snd::getSystem()->startSE("WIPL_SE_BALLOON"); - unk_0x08 = FALSE; + mbWaitingFadeIn = FALSE; } } void TextBalloon::fadeout() { - if (!unk_0x08) { + if (!mbWaitingFadeIn) { mpLayout->setAnmType(ANIM_TYPE_BACKWARD); mpLayout->start(); } - unk_0x08 = FALSE; + mbWaitingFadeIn = FALSE; } void TextBalloon::fadeoutForce() { - if (!unk_0x08) { + if (!mbWaitingFadeIn) { if (mpLayout->getAnim()->getAnmType() == ANIM_TYPE_FORWARD) { mpLayout->getAnim()->setAnmType(ANIM_TYPE_BACKWARD); mpLayout->getAnim()->restart(); } - } else if (unk_0x08 == TRUE) { + } else if (mbWaitingFadeIn == TRUE) { mWaitUntilFadeIn = 0; - unk_0x08 = FALSE; + mbWaitingFadeIn = FALSE; } } @@ -167,9 +167,9 @@ namespace ipl { f32 temp0; if (SCGetAspectRatio() == SC_ASPECT_RATIO_16x9) { - temp0 = unk_0x30; + temp0 = mMargin16x9; } else { - temp0 = unk_0x34; + temp0 = mMargin4x3; } nw4r::lyt::Pane* balloonPane = mpLayout->FindPaneByName("N_Balloon"); @@ -181,7 +181,7 @@ namespace ipl { System::getProjectionRect(&proj16x9); System::getProjectionRect4x3(&proj4x3); - switch (unk_0x28) { + switch (mHAlign) { case 1: { temp1 = get_size("W_Base")->width / 2; break; @@ -192,7 +192,7 @@ namespace ipl { } } - if (unk_0x2C == 0) { + if (mbUse16x9X == 0) { temp1 *= proj4x3.GetWidth() / proj16x9.GetWidth(); } -- 2.49.1 From e3cbe4ed636681d4373c9aa210c829293b7a5fc5 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Thu, 1 Oct 2026 18:40:42 -0500 Subject: [PATCH 3/3] cleanup(SDMemory): rename iplSDMemory_813EE358 to containsTitleId Helper scans a title-id list for a match; unused SDMemory* param kept. Verified ok + sha1 26116613f624061ba99c8d1a299aaa6efa85670d. --- config/43U/symbols.txt | 2 +- src/scene/sdChannelMemory/iplSDMemory.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config/43U/symbols.txt b/config/43U/symbols.txt index 70b27d78..d70e6b28 100644 --- a/config/43U/symbols.txt +++ b/config/43U/symbols.txt @@ -4866,7 +4866,7 @@ onDialogState9__Q33ipl5scene8SDMemoryFv = .text:0x813EDF04; // type:function siz onDialogState10__Q33ipl5scene8SDMemoryFv = .text:0x813EDFA8; // type:function size:0x130 onDialogState11__Q33ipl5scene8SDMemoryFv = .text:0x813EE0D8; // type:function size:0xE0 onDialogState12__Q33ipl5scene8SDMemoryFv = .text:0x813EE1B8; // type:function size:0x1A0 -iplSDMemory_813EE358 = .text:0x813EE358; // type:function size:0x44 +iplSDMemory_containsTitleId = .text:0x813EE358; // type:function size:0x44 onDialogState13__Q33ipl5scene8SDMemoryFv = .text:0x813EE39C; // type:function size:0xEC onDialogState14__Q33ipl5scene8SDMemoryFv = .text:0x813EE488; // type:function size:0x1C4 onDialogState15__Q33ipl5scene8SDMemoryFv = .text:0x813EE64C; // type:function size:0x12C diff --git a/src/scene/sdChannelMemory/iplSDMemory.cpp b/src/scene/sdChannelMemory/iplSDMemory.cpp index b054b116..731c8611 100644 --- a/src/scene/sdChannelMemory/iplSDMemory.cpp +++ b/src/scene/sdChannelMemory/iplSDMemory.cpp @@ -934,7 +934,7 @@ namespace ipl { } } - extern "C" bool iplSDMemory_813EE358(const SDMemory* memory, + extern "C" bool iplSDMemory_containsTitleId(const SDMemory* memory, ESTitleId titleId, const ESTitleId* titleIds, u32 titleCount) { for (u32 i = 0; i < titleCount; i++) { @@ -951,7 +951,7 @@ namespace ipl { s32 result = mpSDChannelSelect->getWorker()->get_async_result(); if (result == 0) { ESTitleId titleId = mTitleIds[mCurrentTitle]; - if (iplSDMemory_813EE358(this, titleId, + if (iplSDMemory_containsTitleId(this, titleId, mNandTitleIds, mNandTitleCount)) { mDialogState = 17; } else { @@ -984,8 +984,8 @@ namespace ipl { swprintf(mCurrentTitleName, 0x107f, L"%ls\n%ls", titleName, message); System::getDialog()->setTitleForSDMemory(mCurrentTitleName); - if (iplSDMemory_813EE358(this, mTitleIds[mCurrentTitle], mSDTitleIds, mTitleNameCount) || - iplSDMemory_813EE358(this, mTitleIds[mCurrentTitle], mNandTitleIds, mNandTitleCount)) { + if (iplSDMemory_containsTitleId(this, mTitleIds[mCurrentTitle], mSDTitleIds, mTitleNameCount) || + iplSDMemory_containsTitleId(this, mTitleIds[mCurrentTitle], mNandTitleIds, mNandTitleCount)) { ESTitleId titleId = mTitleIds[mCurrentTitle]; if (iplSDChannelSelect_813DB478(mpSDChannelSelect, titleId)) { mDialogState = 14; @@ -1064,7 +1064,7 @@ namespace ipl { mCurrentTitle++; if (mTitleCount > mCurrentTitle) { ESTitleId nextTitleId = mTitleIds[mCurrentTitle]; - if (iplSDMemory_813EE358(this, nextTitleId, + if (iplSDMemory_containsTitleId(this, nextTitleId, mNandTitleIds, mNandTitleCount)) { mDialogState = 17; } else { -- 2.49.1