From c2cf3a73eb5f02d46feb530075cd103161836762 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Wed, 30 Sep 2026 10:54:43 +0000 Subject: [PATCH] iplSetting 97/112, iplSDChannelSelect 94/129, iplSDMemory (worker 5693252e) --- README.md | 4 +- include/scene/board/iplFocusObject.h | 1 + libs/NW4R/include/nw4r/ut/Rect.h | 4 + src/scene/sdChannelMemory/iplSDMemory.cpp | 311 ++++++------ .../sdChannelSelect/iplSDChannelSelect.cpp | 100 ++-- src/scene/setting/iplSetting.cpp | 460 +++++++++--------- .../decomp-assist/sol-low-scenes-attempts.md | 156 ++++++ 7 files changed, 603 insertions(+), 433 deletions(-) create mode 100644 tools/decomp-assist/sol-low-scenes-attempts.md diff --git a/README.md b/README.md index b6962084..ae24a0e9 100644 --- a/README.md +++ b/README.md @@ -53,9 +53,9 @@ Progress | Decompiled | Matched | Linked | Data | |:---:|:---:|:---:|:---:| -| 95.37% | 82.76% | 58.19% | 89.47% | +| 95.41% | 83.02% | 58.19% | 89.47% | -units 777/1027 complete, functions 11967/12563 matched. +units 777/1027 complete, functions 11991/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/board/iplFocusObject.h b/include/scene/board/iplFocusObject.h index 70ac3aa1..08b677bb 100644 --- a/include/scene/board/iplFocusObject.h +++ b/include/scene/board/iplFocusObject.h @@ -86,6 +86,7 @@ namespace ipl { const utility::BScroller& getBInst() { return mBScroller; } #ifdef IPL_SDMEMORY_SCROLLER_BINST_RESET + void initScroll() { mScroller.init(); } void resetBInst() { mBScroller.reset(); } #endif diff --git a/libs/NW4R/include/nw4r/ut/Rect.h b/libs/NW4R/include/nw4r/ut/Rect.h index 94551133..165b3095 100644 --- a/libs/NW4R/include/nw4r/ut/Rect.h +++ b/libs/NW4R/include/nw4r/ut/Rect.h @@ -14,7 +14,11 @@ namespace nw4r { #else Rect() : left(), top(), right(), bottom() {} #endif +#ifdef IPL_SETTING_RECT_OUT_OF_LINE + Rect(f32 l, f32 t, f32 r, f32 b); +#else Rect(f32 l, f32 t, f32 r, f32 b) : left(l), top(t), right(r), bottom(b) {} +#endif #ifndef IPL_CONTROLLER_TRIVIAL_RECT_DTOR ~Rect() {} diff --git a/src/scene/sdChannelMemory/iplSDMemory.cpp b/src/scene/sdChannelMemory/iplSDMemory.cpp index 36d5c93d..26611c63 100644 --- a/src/scene/sdChannelMemory/iplSDMemory.cpp +++ b/src/scene/sdChannelMemory/iplSDMemory.cpp @@ -33,13 +33,13 @@ extern "C" bool iplSDChannelSelect_813DDB74(ipl::scene::SDChannelSelect* channel ESTitleId* titleIds, wchar_t* titleNames, u32* titleCount, s32 state); extern "C" bool iplSDChannelSelect_813DB5EC(ipl::scene::SDChannelSelect* channelSelect, - const ESTitleId* titleEntry, ESTitleId titleId); + ESTitleId titleId); extern "C" bool iplSDChannelSelect_813DB4D4(ipl::scene::SDChannelSelect* channelSelect, - const ESTitleId* titleEntry, ESTitleId titleId, u32 flags); + ESTitleId titleId, u32 flags); extern "C" bool iplSDChannelSelect_813DB530(ipl::scene::SDChannelSelect* channelSelect, ESTitleId** titleNames, ESTitleId** secondaryTitles); extern "C" bool iplSDChannelSelect_813DB478(ipl::scene::SDChannelSelect* channelSelect, - const ESTitleId* titleEntry, ESTitleId titleId); + ESTitleId titleId); extern "C" bool iplSDChannelSelect_813DB58C(ipl::scene::SDChannelSelect* channelSelect, ESTitleId** titles, ESTitleId** secondaryTitles, ESTitleId** names); @@ -63,13 +63,13 @@ namespace ipl { void setTitleRowColors(nw4r::lyt::TextBox* textBox, const nw4r::ut::Color& first, const nw4r::ut::Color& second); - static const char* const sControlPaneNames[] = { + static const char* sControlPaneNames[] = { "A", "B", "B_BtnA", }; - static const char* const sTitlePaneNames[] = {"A", "B", "B_BtnA", "C", "D"}; - static const char* const sAdditionalTitlePaneNames[] = {"B_00", "C_00", "D_00", "B_BtnA"}; - static const char* const sDialogPaneNames[] = {"B_ArwR", "B_ArwL", "B_CalExit", "B_CalExit_00"}; + static const char* sTitlePaneNames[] = {"A", "B", "B_BtnA", "C", "D"}; + static const char* sAdditionalTitlePaneNames[] = {"B_00", "C_00", "D_00", "B_BtnA"}; + static const char* sDialogPaneNames[] = {"B_ArwR", "B_ArwL", "B_CalExit", "B_CalExit_00"}; SDMemory::SDMemory() : mScroller() {} @@ -410,8 +410,7 @@ namespace ipl { for (int i = 0; i < 4; i++) { if (mPanelAnimationStates[i] != 0) { mPanelAnimationStates[i] = 0; - nw4r::lyt::Pane* pane = mpDialogLayout->FindPaneByName(sDialogPaneNames[i]); - mpPaneManagers[2]->initPane(pane); + mpPaneManagers[2]->initPane(mpDialogLayout->GetRootPane()->FindPaneByName(sDialogPaneNames[i], true)); layout::Animator* animation = NULL; switch (i) { @@ -544,123 +543,117 @@ namespace ipl { s32 SDMemory::updateState() { NandSDWorker::WorkSDState sdState = mpSDChannelSelect->getSDState(); s32 result = 0; - if (static_cast(sdState - NandSDWorker::SD_STATE_EJECTED) > - static_cast(NandSDWorker::SD_STATE_INSERTED - NandSDWorker::SD_STATE_EJECTED)) { - return result; - } - - switch (mDialogState) { - case 1: - case 2: { - mpMainLayout->getAnim(1)->initAnmFrame(); - mpMainLayout->getAnim(1)->initFrame(); - mpMainLayout->getAnim(1)->restart(); - mpDialogLayout->getAnim(1)->initAnmFrame(); - mpDialogLayout->getAnim(1)->initFrame(); - mpDialogLayout->getAnim(1)->restart(); - mTransferFlags[1] = 0; - mDialogState = 3; - result = 1; - break; - } - case 3: - if (mTransferFlags[1] != 0) { - mpDialogLayout->getAnim(1)->initAnmFrame(); - mpDialogLayout->getAnim(1)->initFrame(); - mpDialogLayout->getAnim(1)->restart(); + if (sdState == NandSDWorker::SD_STATE_EJECTED || sdState == NandSDWorker::SD_STATE_INSERTED) { + switch (mDialogState) { + case 1: + case 2: { + mpMainLayout->getAnim(1)->initAnmFrame(); + mpMainLayout->getAnim(1)->play(); + mpProgressLayout->getAnim(1)->initAnmFrame(); + mpProgressLayout->getAnim(1)->play(); mTransferFlags[1] = 0; - } - if (!mpMainLayout->isPlaying(1) && !mpDialogLayout->isPlaying(1)) { - result = 2; - } else { + mDialogState = 3; result = 1; + break; } - break; - case 5: - case 6: - mpTitleLayout->getAnim(1)->initAnmFrame(); - mpTitleLayout->getAnim(1)->initFrame(); - mpTitleLayout->getAnim(1)->restart(); - mpDialogLayout->getAnim(1)->initAnmFrame(); - mpDialogLayout->getAnim(1)->initFrame(); - mpDialogLayout->getAnim(1)->restart(); - mTransferFlags[1] = 0; - mDialogState = 7; - result = 1; - break; - case 7: - if (mTransferFlags[1] != 0) { - mpDialogLayout->getAnim(1)->initAnmFrame(); - mpDialogLayout->getAnim(1)->initFrame(); - mpDialogLayout->getAnim(1)->restart(); - mTransferFlags[1] = 0; - } - if (!mpTitleLayout->isPlaying(1) && !mpDialogLayout->isPlaying(1)) { - result = 2; - } else { - result = 1; - } - break; - case 10: - case 11: - mDialogState = 12; - mpDialogLayout->getAnim(1)->initAnmFrame(); - mpDialogLayout->getAnim(1)->initFrame(); - mpDialogLayout->getAnim(1)->restart(); - mTransferFlags[1] = 0; - mScroller.init(); - mScroller.resetBInst(); - if (mControllerFlags[0] != 0) { - hideDownArrow(); - } - if (mControllerFlags[1] != 0) { - hideUpArrow(); - } - result = 1; - break; - case 12: - if (mTransferFlags[1] != 0) { - mScroller.init(); - mScroller.resetBInst(); - mpDialogLayout->getAnim(1)->initAnmFrame(); - mpDialogLayout->getAnim(1)->initFrame(); - mpDialogLayout->getAnim(1)->restart(); - mTransferFlags[1] = 0; - } - if (!mpTitleLayout->isPlaying(1) && !mpDialogLayout->isPlaying(1)) { - result = 2; - } else { - result = 1; - } - break; - case 8: - case 22: { - DialogWindow* dialog = System::getDialog(); - s32 dialogState = dialog->getStateForSDMemory(); - if (dialogState == 2) { - dialog->terminate(); - mpDialogLayout->getAnim(1)->initAnmFrame(); - mpDialogLayout->getAnim(1)->initFrame(); - mpDialogLayout->getAnim(1)->restart(); - mTransferFlags[1] = 0; - } else if ((dialogState == 3 || dialogState == 4) && mTransferFlags[1] != 0) { - mpDialogLayout->getAnim(1)->initAnmFrame(); - mpDialogLayout->getAnim(1)->initFrame(); - mpDialogLayout->getAnim(1)->restart(); - mTransferFlags[1] = 0; - } - - if (dialog->getLastResult() != -1) { - if (mpDialogLayout->isPlaying(1) || dialog->getLastResult() == 1) { - result = 1; - } else { - result = 2; + case 3: + if (mTransferFlags[1] != 0) { + mpProgressLayout->getAnim(1)->initAnmFrame(); + mpProgressLayout->getAnim(1)->play(); + mTransferFlags[1] = 0; } + if (!mpMainLayout->isPlaying(1) && !mpProgressLayout->isPlaying(1)) { + result = 2; + } else { + result = 1; + } + break; + case 5: + case 6: + mpTitleLayout->getAnim(1)->initAnmFrame(); + mpTitleLayout->getAnim(1)->play(); + mpProgressLayout->getAnim(1)->initAnmFrame(); + mpProgressLayout->getAnim(1)->play(); + mTransferFlags[1] = 0; + mDialogState = 7; + result = 1; + break; + case 7: + if (mTransferFlags[1] != 0) { + mpProgressLayout->getAnim(1)->initAnmFrame(); + mpProgressLayout->getAnim(1)->play(); + mTransferFlags[1] = 0; + } + if (!mpTitleLayout->isPlaying(1) && !mpProgressLayout->isPlaying(1)) { + result = 2; + } else { + result = 1; + } + break; + case 10: + case 11: + mDialogState = 12; + mpDialogLayout->getAnim(1)->initAnmFrame(); + mpDialogLayout->getAnim(1)->play(); + mpProgressLayout->getAnim(1)->initAnmFrame(); + mpProgressLayout->getAnim(1)->play(); + mTransferFlags[1] = 0; + mScroller.initScroll(); + mScroller.resetBInst(); + if (mControllerFlags[0] != 0) { + hideDownArrow(); + } + if (mControllerFlags[1] != 0) { + hideUpArrow(); + } + result = 1; + break; + case 12: + if (mTransferFlags[1] != 0) { + mScroller.initScroll(); + mScroller.resetBInst(); + mpProgressLayout->getAnim(1)->initAnmFrame(); + mpProgressLayout->getAnim(1)->play(); + mTransferFlags[1] = 0; + } + if (!mpDialogLayout->isPlaying(1) && !mpProgressLayout->isPlaying(1)) { + result = 2; + } else { + result = 1; + } + break; + case 8: + case 22: { + if (sdState == NandSDWorker::SD_STATE_EJECTED || sdState == NandSDWorker::SD_STATE_INSERTED) { + if (System::getDialog()->getStateForSDMemory() == 2) { + System::getDialog()->terminate(); + mpProgressLayout->getAnim(1)->initAnmFrame(); + mpProgressLayout->getAnim(1)->play(); + mTransferFlags[1] = 0; + } else if (System::getDialog()->getStateForSDMemory() == 4 || + System::getDialog()->getStateForSDMemory() == 3) { + if (mTransferFlags[1] != 0) { + mpProgressLayout->getAnim(1)->initAnmFrame(); + mpProgressLayout->getAnim(1)->play(); + mTransferFlags[1] = 0; + } + } + } + + if (System::getDialog()->getLastResult() != -1 && !mpProgressLayout->isPlaying(1)) { + if (System::getDialog()->getLastResult() != 1 && + (sdState == NandSDWorker::SD_STATE_EJECTED || sdState == NandSDWorker::SD_STATE_INSERTED)) { + result = 2; + } + } else { + result = 1; + } + break; } - break; - } - default: - break; + default: + break; + } + } if (result == 2) { @@ -673,8 +666,7 @@ namespace ipl { if (!mpMainLayout->isPlaying(-1)) { for (int i = 0; i < 3; i++) { mPanelStates[i] = 0; - nw4r::lyt::Pane* pane = mpMainLayout->FindPaneByName(sControlPaneNames[i]); - mpPaneManagers[0]->initPane(pane); + mpPaneManagers[0]->initPane(mpMainLayout->GetRootPane()->FindPaneByName(sControlPaneNames[i], true)); } mDialogState = 1; @@ -758,7 +750,7 @@ namespace ipl { } if (!mpSDChannelSelect->getWorker()->is_working() && - OSGetTime() - mTransferStartTime > OS_TIMER_CLOCK) { + static_cast(OSGetTime() - mTransferStartTime) > static_cast(OS_TIMER_CLOCK)) { System::getDialog()->terminate(); } } @@ -804,7 +796,7 @@ namespace ipl { case 4: mDialogState = 0; mpMainLayout->getAnim(0)->play(); - snd::getSystem()->startSE("WIPL_SE_BT_TARGETTING"); + snd::getSystem()->startSE("WIPL_SE_INFO_WINDOW"); break; default: mTransferStartTime = 0; @@ -822,8 +814,7 @@ namespace ipl { if (!mpDialogLayout->isPlaying(0)) { for (int i = 0; i < 4; i++) { mPanelAnimationStates[i] = 0; - nw4r::lyt::Pane* pane = mpDialogLayout->FindPaneByName(sDialogPaneNames[i]); - mpPaneManagers[2]->initPane(pane); + mpPaneManagers[2]->initPane(mpDialogLayout->GetRootPane()->FindPaneByName(sDialogPaneNames[i], true)); } mDialogState = 10; @@ -924,7 +915,7 @@ namespace ipl { } extern "C" bool iplSDMemory_813EE358(const SDMemory* memory, - const ESTitleId* titleEntry, ESTitleId titleId, + ESTitleId titleId, const ESTitleId* titleIds, u32 titleCount) { for (u32 i = 0; i < titleCount; i++) { if (titleIds[i] == titleId) { @@ -939,9 +930,8 @@ namespace ipl { if (!mpSDChannelSelect->getWorker()->is_working()) { s32 result = mpSDChannelSelect->getWorker()->get_async_result(); if (result == 0) { - const ESTitleId* titleEntry = &mTitleIds[mCurrentTitle]; - ESTitleId titleId = *titleEntry; - if (iplSDMemory_813EE358(this, titleEntry, titleId, + ESTitleId titleId = mTitleIds[mCurrentTitle]; + if (iplSDMemory_813EE358(this, titleId, mNandTitleIds, mNandTitleCount)) { mDialogState = 17; } else { @@ -974,24 +964,10 @@ namespace ipl { swprintf(mCurrentTitleName, 0x107f, L"%ls\n%ls", titleName, message); System::getDialog()->setTitleForSDMemory(mCurrentTitleName); - bool isKnownTitle; - { - const ESTitleId* titleEntry = &mTitleIds[mCurrentTitle]; - ESTitleId titleId = *titleEntry; - isKnownTitle = iplSDMemory_813EE358(this, titleEntry, titleId, - mSDTitleIds, mTitleNameCount); - } - if (!isKnownTitle) { - const ESTitleId* titleEntry = &mTitleIds[mCurrentTitle]; - ESTitleId titleId = *titleEntry; - isKnownTitle = iplSDMemory_813EE358(this, titleEntry, titleId, - mNandTitleIds, mNandTitleCount); - } - - if (isKnownTitle) { - const ESTitleId* titleEntry = &mTitleIds[mCurrentTitle]; - ESTitleId titleId = *titleEntry; - if (iplSDChannelSelect_813DB478(mpSDChannelSelect, titleEntry, titleId)) { + if (iplSDMemory_813EE358(this, mTitleIds[mCurrentTitle], mSDTitleIds, mTitleNameCount) || + iplSDMemory_813EE358(this, mTitleIds[mCurrentTitle], mNandTitleIds, mNandTitleCount)) { + ESTitleId titleId = mTitleIds[mCurrentTitle]; + if (iplSDChannelSelect_813DB478(mpSDChannelSelect, titleId)) { mDialogState = 14; } else { System::getDialog()->terminate(); @@ -1000,12 +976,10 @@ namespace ipl { mMessageId = 0xAE; } } else { - f32 completedTitles = static_cast(mCurrentTitle + 1); - f32 totalTitles = static_cast(mTitleCount); mDialogState = 15; - f32 progress = completedTitles * 100.0f / totalTitles; + f32 progress = static_cast(mCurrentTitle + 1) * 100.0f / static_cast(mTitleCount); if (progress >= 100.0f) { - progress = 100.0f; + progress = 99.0f; } mTransferFrame = static_cast(progress); @@ -1014,16 +988,10 @@ namespace ipl { } void SDMemory::onDialogState15() { - u32 completedPercent = NandSDWorker::getCompletionPct() / mTitleCount; - u32 currentTitle = mCurrentTitle; - u32 titleCount = mTitleCount; - f32 completedPercentFloat = static_cast(completedPercent); - f32 currentTitleNumber = static_cast(currentTitle + 1); - f32 progress = currentTitleNumber * 100.0f; - progress = progress / static_cast(titleCount); - progress += completedPercentFloat; + f32 progress = static_cast(mCurrentTitle) * 100.0f / static_cast(mTitleCount); + progress += static_cast(NandSDWorker::getCompletionPct() / mTitleCount); if (progress >= 100.0f) { - progress = 100.0f; + progress = 99.0f; } mTransferFrame = static_cast(progress); @@ -1049,8 +1017,7 @@ namespace ipl { void SDMemory::onDialogState16() { if (mTitleCount > mCurrentTitle && System::isReceiveScheduleStopped()) { - const ESTitleId* titleEntry = &mTitleIds[mCurrentTitle]; - if (iplSDChannelSelect_813DB4D4(mpSDChannelSelect, titleEntry, *titleEntry, 0)) { + if (iplSDChannelSelect_813DB4D4(mpSDChannelSelect, mTitleIds[mCurrentTitle], 0)) { mDialogState = 16; } else { System::getDialog()->terminate(); @@ -1076,9 +1043,8 @@ namespace ipl { if (mpSDChannelSelect->getWorker()->get_async_result() == 0) { mCurrentTitle++; if (mTitleCount > mCurrentTitle) { - const ESTitleId* nextTitle = &mTitleIds[mCurrentTitle]; - ESTitleId nextTitleId = *nextTitle; - if (iplSDMemory_813EE358(this, nextTitle, nextTitleId, + ESTitleId nextTitleId = mTitleIds[mCurrentTitle]; + if (iplSDMemory_813EE358(this, nextTitleId, mNandTitleIds, mNandTitleCount)) { mDialogState = 17; } else { @@ -1105,9 +1071,8 @@ namespace ipl { swprintf(mCurrentTitleName, 0x107f, L"%ls\n%ls", titleName, message); System::getDialog()->setTitleForSDMemory(mCurrentTitleName); - const ESTitleId* titleEntry = &mTitleIds[mCurrentTitle]; - const ESTitleId titleId = *titleEntry; - if (iplSDChannelSelect_813DB5EC(mpSDChannelSelect, titleEntry, titleId)) { + const ESTitleId titleId = mTitleIds[mCurrentTitle]; + if (iplSDChannelSelect_813DB5EC(mpSDChannelSelect, titleId)) { mDialogState = 18; } else { System::getDialog()->terminate(); @@ -1162,7 +1127,7 @@ namespace ipl { if (blockCountMarker != NULL && message != NULL) { format[0] = L'\0'; - wcsncat(format, message, static_cast(blockCountMarker - message) >> 1); + wcsncat(format, message, static_cast(blockCountMarker - message)); wcscat(format, L"%d"); wcscat(format, blockCountMarker + 4); @@ -1198,7 +1163,7 @@ namespace ipl { mpMainLayout->getAnim(0)->initAnmFrame(); mpMainLayout->getAnim(0)->play(); - snd::getSystem()->startSE("WIPL_SE_CANCEL"); + snd::getSystem()->startSE("WIPL_SE_INFO_WINDOW"); mDialogState = 0; } @@ -1548,8 +1513,6 @@ namespace ipl { } if (animator != NULL) { - mProcessState = paneIndex; - mDialogState = 2; animator->initAnmFrame(); animator->setAnmType(ANIM_TYPE_FORWARD); animator->initFrame(); diff --git a/src/scene/sdChannelSelect/iplSDChannelSelect.cpp b/src/scene/sdChannelSelect/iplSDChannelSelect.cpp index 88cdb7c1..c60081f2 100644 --- a/src/scene/sdChannelSelect/iplSDChannelSelect.cpp +++ b/src/scene/sdChannelSelect/iplSDChannelSelect.cpp @@ -1030,40 +1030,50 @@ namespace ipl { return; } - int firstIndex; int indexStep; - if (pageOffset == 2) { + int pageTitleIndex; + int firstIndex; + switch (pageOffset) { + case -2: + firstIndex = 3; + indexStep = 4; + break; + case 2: firstIndex = 0; indexStep = 4; - } else if (pageOffset < 2) { - if (pageOffset == -2) { - firstIndex = 3; - indexStep = 4; - } else { - firstIndex = 0; - indexStep = 1; - } - } else { + break; + default: firstIndex = 0; indexStep = 1; + break; } - int pageTitleIndex = page * 12; - SDChannelObj* channel; - if (index >= 0 && index < 12 && - (channel = findChannelObject(page, index)) != NULL && channel->mState == 2 && - mpChannelTitleIds[pageTitleIndex + index] != 0) { - enqueueNotice(mpChannelTitleIds[pageTitleIndex + index], page, index); + pageTitleIndex = page * 12; + if (index >= 0 && index < 12) { + SDChannelObj* channel = findChannelObject(page, index); + if (channel != NULL) { + int titleIndex = pageTitleIndex + index; + if (channel->mStateFlags == 2) { + ESTitleId titleId = mpChannelTitleIds[titleIndex]; + if (titleId != 0) { + enqueueNotice(titleId, page, index); + } + } + } } - for (int channelIndex = firstIndex; channelIndex < 12; - channelIndex += indexStep) { - if (channelIndex != index && - (channel = findChannelObject(page, channelIndex)) != NULL && - channel->mState == 2 && - mpChannelTitleIds[pageTitleIndex + channelIndex] != 0) { - enqueueNotice(mpChannelTitleIds[pageTitleIndex + channelIndex], page, - channelIndex); + for (; firstIndex < 12; firstIndex += indexStep) { + if (index != firstIndex) { + SDChannelObj* channel = findChannelObject(page, firstIndex); + if (channel != NULL) { + int titleIndex = pageTitleIndex + firstIndex; + if (channel->mStateFlags == 2) { + ESTitleId titleId = mpChannelTitleIds[titleIndex]; + if (titleId != 0) { + enqueueNotice(titleId, page, firstIndex); + } + } + } } } } @@ -1135,10 +1145,18 @@ namespace ipl { } if (mCurrentSDState != 6) { - if (mState < 24) { - if (mState >= 15) { - mbDialogActive = true; - } + switch (mState) { + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + mbDialogActive = true; + break; } } @@ -1955,11 +1973,7 @@ namespace ipl { System::getFader()->fadeOut(); TVRCManager::getHandle()->setEnable(FALSE); System::getChannelManager()->refreshAsync(); - reserveAllSceneDestruction( - 4, System::isSafeMode() - ? NULL - : reinterpret_cast( - System::getNwc24ManagerForce()->received())); + reserveAllSceneDestruction(4, reinterpret_cast(System::getNwc24Manager()->received())); } } @@ -2269,12 +2283,20 @@ namespace ipl { if (keepChannel != NULL && page == keepPage && index == keepIndex) { continue; } - if (mState < 0x18) { - if (mState >= 0xF) { - if (page == mSourcePage && index == mSourceIndex) { - continue; - } + switch (mState) { + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + if (page == mSourcePage && index == mSourceIndex) { + continue; } + break; } if (!isChannelInCalc(page, index, currentPage)) { SDChannelObj* previous = static_cast( diff --git a/src/scene/setting/iplSetting.cpp b/src/scene/setting/iplSetting.cpp index ed0dc58b..611317fb 100644 --- a/src/scene/setting/iplSetting.cpp +++ b/src/scene/setting/iplSetting.cpp @@ -1,3 +1,4 @@ +#define IPL_SETTING_RECT_OUT_OF_LINE #define IPL_SETTING_IMPLEMENTATION #include "scene/setting/iplSetting.h" #include "scene/setting/iplAPScanThread.h" @@ -1279,61 +1280,58 @@ namespace ipl { ext_ead::www::SurfaceManager::GetInstance()->StopThreadAsync(); OSReport("!!!!!!!!!!!!! SCFlush !!!!!!!!!!!!!!\n"); SCFlush(); - } - if (surfaceState != 0) { - if (unk_0x7C == 5) { - if (mInitialArgument == 2 || mInitialArgument == 5) { - SCSetConfigDoneFlag(TRUE); - SCSetConfigDoneFlag2(TRUE); - SCSetUpdateType(0); - SCFlush(); - } - - while (WPADGetStatus() != 0 || - System::getBS2Manager()->getIPLState() != bs2::IPL_STATE_8) { - snd::getSystem()->calc(); - System::getBS2Manager()->update(); - VIWaitForRetrace(); - if (WPADGetStatus() != 0) { - OSReport("wait for WPAD\n"); - } - if (System::getBS2Manager()->getIPLState() != bs2::IPL_STATE_8) { - OSReport("wait for BS2\n"); - } - } - - VISetBlack(TRUE); - VIFlush(); - VIWaitForRetrace(); - OSReport("VI Black\n"); - while (!__OSSyncSram()) { - OSReport("sync sram\n"); - } - while (!System::isReceiveScheduleStopped()) { - OSReport("Wait ScheduleStopped\n"); - OSSleepMilliseconds(5); - } - __OSLaunchTitlelForSystem(mUpdateTitleId, 0, NULL); - for (;;) { - OSReport(NULL); - } - } else if (ext_ead::www::SurfaceManager::GetInstance()->IsThreadStopped()) { - OSReport("reserve destroy\n"); - ext_ead::www::SurfaceManager::DisposeManager(); - OSReport("reserve destroy done\n"); - if (mInitialArgument == 2 || mInitialArgument == 5) { - SCSetConfigDoneFlag(TRUE); - SCSetConfigDoneFlag2(TRUE); - SCSetUpdateType(0); - SCFlush(); - reserveAllSceneDestruction(0x1a, NULL); - } else { - System::reloadDownloadTask(); - reserveAllSceneDestruction(0x15, NULL); - } - delete mpBrowserData; - return FADER_SCN_NEXT; + } else if (surfaceState != 0 && unk_0x7C == 5) { + if (mInitialArgument == 2 || mInitialArgument == 5) { + SCSetConfigDoneFlag(TRUE); + SCSetConfigDoneFlag2(TRUE); + SCSetUpdateType(0); + SCFlush(); } + + while (WPADGetStatus() != 0 || + System::getBS2Manager()->getIPLState() != bs2::IPL_STATE_8) { + snd::getSystem()->calc(); + System::getBS2Manager()->update(); + VIWaitForRetrace(); + if (WPADGetStatus() != 0) { + OSReport("wait for WPAD\n"); + } + if (System::getBS2Manager()->getIPLState() != bs2::IPL_STATE_8) { + OSReport("wait for BS2\n"); + } + } + + VISetBlack(TRUE); + VIFlush(); + VIWaitForRetrace(); + OSReport("VI Black\n"); + while (!__OSSyncSram()) { + OSReport("sync sram\n"); + } + while (!System::isReceiveScheduleStopped()) { + OSReport("Wait ScheduleStopped\n"); + OSSleepMilliseconds(5); + } + __OSLaunchTitlelForSystem(mUpdateTitleId, 0, NULL); + for (;;) { + OSReport(NULL); + } + } else if (surfaceState != 0 && ext_ead::www::SurfaceManager::GetInstance()->IsThreadStopped()) { + OSReport("reserve destroy\n"); + ext_ead::www::SurfaceManager::DisposeManager(); + OSReport("reserve destroy done\n"); + if (mInitialArgument == 2 || mInitialArgument == 5) { + SCSetConfigDoneFlag(TRUE); + SCSetConfigDoneFlag2(TRUE); + SCSetUpdateType(0); + SCFlush(); + reserveAllSceneDestruction(0x1a, NULL); + } else { + System::reloadDownloadTask(); + reserveAllSceneDestruction(0x15, NULL); + } + delete mpBrowserData; + return FADER_SCN_NEXT; } } @@ -1435,6 +1433,17 @@ namespace ipl { } } + } +} + +namespace nw4r { + namespace ut { + Rect::Rect(f32 l, f32 t, f32 r, f32 b) : left(l), top(t), right(r), bottom(b) {} + } +} + +namespace ipl { + namespace scene { void Setting::initWiiSettingData() { mpWiiSettingData = www::wiisetting::getWiiSettingData(); mpWiiSettingFlag = www::wiisetting::getWiiSettingFlag(); @@ -2242,62 +2251,60 @@ namespace ipl { } u8 Setting::checkTextNum(const char* text) { - int formId = mpWiiSettingData->data[0x36]; u8 result = 4; u32 message = 0; - if (formId < 13) { - if (formId != 2) { - if (formId < 2) { - } else if (formId < 10) { + switch (mpWiiSettingData->data[0x36]) { + case 2: + if (wcslen(reinterpret_cast(unk_0x938)) != 0) { + if (checkSpace()) { + result = 3; } else { - if (strlen(text) == 4) { - result = 3; - } - message = 0x1ba; + message = 0x1c1; } } else { - size_t length = wcslen(reinterpret_cast(unk_0x938)); - if (length == 0) { - message = 0x1c0; - } else if (checkSpace()) { + message = 0x1c0; + } + break; + case 10: + case 11: + case 12: + if (strlen(text) == 4) { + result = 3; + } + message = 0x1ba; + break; + case 13: + case 14: { + u32 minimum; + switch (System::getRegion()) { + case 0: + case 11: + minimum = 3; + break; + case 6: + minimum = 2; + break; + default: + minimum = 6; + break; + } + if (wcslen(reinterpret_cast(unk_0x938)) >= minimum) { + if (checkSpace()) { result = 3; } else { message = 0x1c1; } + } else { + message = 0x1bb; } - } else if (formId != 15) { - if (formId <= 14) { - int region = System::getRegion(); - u32 minimum; - if (region == 6) { - minimum = 2; - } else if (region < 6) { - if (region == 0) { - minimum = 3; - } else { - minimum = 6; - } - } else { - if (region == 11) { - minimum = 3; - } else { - minimum = 6; - } - } - size_t length = wcslen(reinterpret_cast(unk_0x938)); - if (length < minimum) { - message = 0x1bb; - } else if (checkSpace()) { - result = 3; - } else { - message = 0x1c1; - } - } - } else { + break; + } + case 15: if (strlen(text) == 5) { result = 3; } message = 0x1bc; + break; } www::wiisetting::setFuncResult(result); if (result == 4) { @@ -2920,22 +2927,24 @@ namespace ipl { } void Setting::setUseEULA_() { - if (unk_0x7C != 2) { - if (unk_0x7C < 2) { - if (unk_0x7C != 0) { - if (unk_0x7C >= 0) { - setUseEULA_Start_(); - } - } else { - setUseEULA_Init_(); - } - } else if (unk_0x7C == 4) { - setUseEULA_WaitStopMotor_(); - } else if (unk_0x7C < 4 && !snd::getSystem()->isSEActive("WIPL_SE_DECIDE")) { + switch (unk_0x7C) { + case 0: + setUseEULA_Init_(); + break; + case 1: + setUseEULA_Start_(); + break; + case 2: + setUseEULA_Cancel_(); + break; + case 3: + if (!snd::getSystem()->isSEActive("WIPL_SE_DECIDE")) { unk_0x7C = 4; } - } else { - setUseEULA_Cancel_(); + break; + case 4: + setUseEULA_WaitStopMotor_(); + break; } } @@ -3160,18 +3169,21 @@ namespace ipl { mUpdateTiming = 0; mIsResetAcceptable = 1; } else if (mpWiiSettingFlag->smthMsgData == 9) { - if (result == 2) { - System::getDialog()->terminate(); - mUpdateTiming = 6; - mpWiiSettingFlag->err = networkError; - } else if (result == 1) { + switch (result) { + case 1: System::getDialog()->setProgBarLength(100); mProfileIDMode = 6; mUpdateTiming = 0; mpWiiSettingFlag->smthMsgData = 0x54; SCSetUpdateType(2); SCFlush(); - } else if (result == 3) { + break; + case 2: + System::getDialog()->terminate(); + mUpdateTiming = 6; + mpWiiSettingFlag->err = networkError; + break; + case 3: System::getDialog()->terminate(); if (SCGetConfigDoneFlag2() == 0) { mProfileIDMode = 6; @@ -3181,6 +3193,7 @@ namespace ipl { } mUpdateTiming = 0; mpWiiSettingFlag->smthMsgData = 0x54; + break; } } else { if (result == 1) { @@ -3403,13 +3416,14 @@ namespace ipl { if (initialized) { www::wiisetting::setFuncResult(1); } else { - if (error < -2) { - if (error == -5) { - System::getErrorHandler()->set(ErrorHandler::DEFAULT, 1); - } - } else if (error == -2) { - System::getErrorHandler()->log("NandSDWorker", error, "iplSetting.cpp", 0x13a7); + switch (error) { + case -5: + System::getErrorHandler()->set(ErrorHandler::DEFAULT, 1); + break; + case -2: + System::getErrorHandler()->log("NandSDWorker", -2, "iplSetting.cpp", 0x13a7); System::getErrorHandler()->set(ErrorHandler::DEFAULT, 2); + break; } } } @@ -3445,6 +3459,11 @@ namespace ipl { void Setting::cancelUSBAP() { switch (unk_0x84) { + case 1: + case 2: + static_cast(mpUSBAPThread)->cancel(); + unk_0x84 = 3; + break; case 3: if (unk_0x91C[1] != 0 || static_cast(mpUSBAPThread)->is()) { www::wiisetting::setFuncResult(5); @@ -3453,61 +3472,58 @@ namespace ipl { resetFuncMsgQ(); } break; - case 1: - case 2: - static_cast(mpUSBAPThread)->cancel(); - unk_0x84 = 3; - break; - default: - break; } } void Setting::AOSSProcess() { u8 message = mpWiiSettingFlag->smthMsgData; if (message == 0x22u) { - if (mAOSSState == 3) { - if (System::getDialog()->getLastResult() >= 0) { - mAOSSState = 0; - www::wiisetting::setFuncResult(10); - resetFuncMsgQ(); - } - } else { + if (mAOSSState != 3) { System::getDialog()->callBtn1(0x1c2, 0x2e); mAOSSState = 3; unk_0x74 = 2; - } - return; - } - bool cancelled = message == 0x21u; - if (mAOSSState == 0) { - if (!snd::getSystem()->isSEActive("WIPL_SE_DECIDE")) { - if (cancelled || static_cast(mpAOSSThread)->start() == 0) { - www::wiisetting::setFuncResult(cancelled ? 5 : 2); - resetFuncMsgQ(); - } else { - mAOSSState = 1; - } - } - } else if (mAOSSState >= 0 && mAOSSState < 3) { - int result = 0; - if (static_cast(mpAOSSThread)->finish(&m_AOSSConfig, &result) != 0) { + } else if (System::getDialog()->getLastResult() >= 0) { mAOSSState = 0; - if (cancelled) { - www::wiisetting::setFuncResult(5); - } else if (result == 0) { - ncd::NCDSetting::getData(); - ncd::NCDSetting::getID(); - ncd::NCDSetting::setAOSSParams(m_AOSSConfig); - www::wiisetting::setFuncResult(1); - } else { - OSReport("m_AOSSThread : Terminated with Error(%d)\n", result); - www::wiisetting::setFuncResult(2); - } + www::wiisetting::setFuncResult(10); resetFuncMsgQ(); - } else if (cancelled && mAOSSState != 2) { - static_cast(mpAOSSThread)->cancel(); - mAOSSState = 2; + } + } else { + bool cancelled = message == 0x21u; + switch (mAOSSState) { + case 0: + if (!snd::getSystem()->isSEActive("WIPL_SE_DECIDE")) { + if (!cancelled && static_cast(mpAOSSThread)->start() != 0) { + mAOSSState = 1; + } else { + www::wiisetting::setFuncResult(cancelled ? 5 : 2); + resetFuncMsgQ(); + } + } + break; + case 1: + case 2: { + int result; + if (static_cast(mpAOSSThread)->finish(&m_AOSSConfig, &result) != 0) { + mAOSSState = 0; + if (cancelled) { + www::wiisetting::setFuncResult(5); + } else if (result != 0) { + OSReport("m_AOSSThread : Terminated with Error(%d)\n", result); + www::wiisetting::setFuncResult(2); + } else { + ncd::NCDSetting::getData(); + ncd::NCDSetting::getID(); + ncd::NCDSetting::setAOSSParams(m_AOSSConfig); + www::wiisetting::setFuncResult(1); + } + mAOSSState = 0; + resetFuncMsgQ(); + } else if (cancelled && mAOSSState != 2) { + static_cast(mpAOSSThread)->cancel(); + mAOSSState = 2; + } + break; + } } } } @@ -3524,60 +3540,68 @@ namespace ipl { www::wiisetting::setFuncResult(10); resetFuncMsgQ(); } - return; - } - bool cancelCommand = command == 0x2bu; - int state = static_cast(mpRakuRakuThread)->getState(); - int result = 0; - if (cancelCommand && (state == 0 || state == 6 || state == 7 || state == 8)) { - if (static_cast(mpRakuRakuThread)->finish(NULL, NULL) != 0) { - www::wiisetting::setFuncResult(5); - resetFuncMsgQ(); - } else { - static_cast(mpRakuRakuThread)->cancel(); - } - return; - } - if (!cancelCommand && state == 0) { - if (!snd::getSystem()->isSEActive("WIPL_SE_DECIDE") && - static_cast(mpRakuRakuThread)->start() == 0) { - www::wiisetting::setFuncResult(2); - resetFuncMsgQ(); - } - return; - } - if (!cancelCommand && state == 5) { - if (mpWiiSettingFlag->smthMsgData == 0x29u) { - www::wiisetting::setFuncResult(1); - resetFuncMsgQ(); - } - return; - } - if (state == 7) { - if (static_cast(mpRakuRakuThread)->finish(NULL, &result) != 0) { - www::wiisetting::setFuncResult(2); - resetFuncMsgQ(); - } - return; - } - if (state > 4 && state < 7) { - if (static_cast(mpRakuRakuThread)->finish( - &m_RakuConfig.cfg, &result) != 0) { - if (result == 1) { - ncd::NCDSetting::getData(); - ncd::NCDSetting::getID(); - ncd::NCDSetting::setRakuParams(m_RakuConfig.cfg); - www::wiisetting::setFuncResult(1); - } else { - www::wiisetting::setFuncResult(2); + } else { + bool cancelled = command == 0x2bu; + int state = static_cast(mpRakuRakuThread)->getState(); + int result; + if (cancelled) { + switch (state) { + case 0: + case 6: + case 7: + if (static_cast(mpRakuRakuThread)->finish(NULL, NULL) != 0) { + www::wiisetting::setFuncResult(5); + resetFuncMsgQ(); + } + break; + default: + static_cast(mpRakuRakuThread)->cancel(); + break; + } + } else { + switch (state) { + case 0: + if (!snd::getSystem()->isSEActive("WIPL_SE_DECIDE") && + static_cast(mpRakuRakuThread)->start() == 0) { + www::wiisetting::setFuncResult(cancelled ? 5 : 2); + resetFuncMsgQ(); + } + break; + case 4: + if (mpWiiSettingFlag->smthMsgData == 0x28u) { + www::wiisetting::setFuncResult(1); + resetFuncMsgQ(); + } + break; + case 5: + if (mpWiiSettingFlag->smthMsgData == 0x29u) { + www::wiisetting::setFuncResult(1); + resetFuncMsgQ(); + } + break; + case 6: { + if (static_cast(mpRakuRakuThread)->finish(&m_RakuConfig.cfg, &result) != 0) { + if (result != 1) { + www::wiisetting::setFuncResult(2); + } else { + ncd::NCDSetting::getData(); + ncd::NCDSetting::getID(); + ncd::NCDSetting::setRakuParams(m_RakuConfig.cfg); + www::wiisetting::setFuncResult(1); + } + resetFuncMsgQ(); + } + break; + } + case 7: { + if (static_cast(mpRakuRakuThread)->finish(NULL, &result) != 0) { + www::wiisetting::setFuncResult(2); + resetFuncMsgQ(); + } + break; + } } - resetFuncMsgQ(); } - return; - } - if (state > 0 && state < 4 && mpWiiSettingFlag->smthMsgData == 0x28u) { - www::wiisetting::setFuncResult(1); - resetFuncMsgQ(); } } diff --git a/tools/decomp-assist/sol-low-scenes-attempts.md b/tools/decomp-assist/sol-low-scenes-attempts.md new file mode 100644 index 00000000..5d76578a --- /dev/null +++ b/tools/decomp-assist/sol-low-scenes-attempts.md @@ -0,0 +1,156 @@ +# Scene matching attempts + +43U only. Failed experiments were reverted. Retained improvements passed the full gate before their final handoff. No configure.py linking changes. + +All 112/129/66 original function symbols are present. String sequences are identical in all three units. No asm bodies remain in these source files. Compiler-emitted helper placement still differs from the extracted object; emitted text order is not claimed identical. + +Starting instruction-exact counts: Setting 88/112, SDChannelSelect 90/129, SDMemory 49/66. Starting objdiff function counts: 89/112, 90/129, 49/66. These are different measurements. + +Retained work: EULA/USB/network dispatch, Setting input and fadeout flow, missing Rect constructor, SD worker dispatch, SD memory dialog/transfer/progress/scroll flow and SD channel notice iteration. Each matching improvement has a local commit. Shared-header changes are guarded by macros defined only by the owning .cpp. + +## Remaining functions and attempts + +Counts below are current objdiff percentages. Each row records distinct source variations. Identical compiler output is recorded as no gain; it is not accepted as a match. Some larger functions still need deeper block-by-block reconstruction. + +### src/scene/setting/iplSetting + +- ipl::scene::Setting::createBrowser() | 89.86711% | 301/301 instructions; diffs 143 in registers, scheduling, branches or relocations. + Attempts: name first branch condition: 305/301 instructions; for loop with explicit while and increment: 301/301 instructions, diffs 143; invert first complete if/else: 301/301 instructions, diffs 142. +- ipl::scene::Setting::calcNormal() | 67.91796% | 1096/1158 instructions; instruction count/control-flow or inlining differs. + Attempts: name first branch condition: 1096/1158 instructions; invert first complete if/else: 1096/1158 instructions; string-pool divergence, reverted; nested short-circuit branch guards: 1096/1158 instructions. +- ipl::scene::Setting::calcFadeout() | 99.96988% | 166/166 instructions; diffs 0 in registers, scheduling, branches or relocations; instruction diff is zero but objdiff remains below 100, relocation/data reference still open. + Attempts: name first branch condition: 167/166 instructions; for loop with explicit while and increment: 166/166 instructions, diffs 0; invert first complete if/else: 166/166 instructions, diffs 15. +- ipl::scene::Setting::draw() | 37.54272% | 276/632 instructions; instruction count/control-flow or inlining differs. + Attempts: name first branch condition: 276/632 instructions; nested short-circuit branch guards: 276/632 instructions; reverse constant comparison operands: 276/632 instructions. +- ipl::scene::Setting::initKeyboard(const char*) | 65.976524% | 210/213 instructions; instruction count/control-flow or inlining differs. + Attempts: name first branch condition: 212/213 instructions; invert first complete if/else: 210/213 instructions; nested short-circuit branch guards: 210/213 instructions. +- ipl::scene::Setting::calcKeyboard() | 75.62414% | 293/290 instructions; instruction count/control-flow or inlining differs. + Attempts: name first branch condition: 293/290 instructions; while loop as for loop: 293/290 instructions; invert first complete if/else: 293/290 instructions. +- ipl::scene::Setting::convertRevIP(unsigned char*, const char*) | 98.15069% | 73/73 instructions; diffs 21 in registers, scheduling, branches or relocations. + Attempts: initialize output pointer earlier: 73/73 instructions, diffs 27; while loop: 73/73 instructions, diffs 14; advance pointer before count: 73/73 instructions, diffs 21. +- ipl::scene::Setting::checkIPString(const wchar_t*) | 76.210526% | 35/38 instructions; instruction count/control-flow or inlining differs. + Attempts: explicit return branches: 32/38 instructions; named validation result: 31/38 instructions; member function pointer call: 47/38 instructions. +- ipl::scene::Setting::scanAP() | 81.21691% | 265/272 instructions; instruction count/control-flow or inlining differs. + Attempts: name first branch condition: 265/272 instructions; invert first complete if/else: 265/272 instructions; reverse constant comparison operands: 265/272 instructions. +- ipl::scene::Setting::initScroll() | 50.104694% | 272/277 instructions; instruction count/control-flow or inlining differs. + Attempts: name first branch condition: 272/277 instructions; for loop with explicit while and increment: 272/277 instructions; invert first complete if/else: 272/277 instructions. +- ipl::scene::Setting::updateScroll() | 94.46928% | 183/179 instructions; instruction count/control-flow or inlining differs. + Attempts: name first branch condition: 183/179 instructions; for loop with explicit while and increment: 183/179 instructions; invert first complete if/else: 183/179 instructions. +- ipl::scene::Setting::setAPDraw() | 62.204678% | 148/171 instructions; instruction count/control-flow or inlining differs. + Attempts: name first branch condition: 148/171 instructions; for loop with explicit while and increment: 148/171 instructions; invert first complete if/else: 148/171 instructions. +- ipl::scene::Setting::validateEULA_() | 64.414894% | 93/94 instructions; instruction count/control-flow or inlining differs. + Attempts: result-not-zero branch and reused result: 94/94 instructions, 56 diffs; declare valid flag before calls: 94/94, 56 diffs; cache application heap: 94/94, 58 diffs. +- ipl::scene::Setting::makeSupportCode() | 99.07895% | 76/76 instructions; diffs 10 in registers, scheduling, branches or relocations. + Attempts: separate appended length: 76/76 instructions, 13 diffs; reuse chunk length for title and label: 76/76, 3 register diffs; signed final code length: 76/76, 3 register diffs. +- ipl::scene::Setting::setUSBAP() | 78.42105% | 55/57 instructions; instruction count/control-flow or inlining differs. + Attempts: state switch plus positive owner-result branch: 56/57 instructions; early status-zero break: 56/57 instructions; status switch: 56/57 instructions; target reloads status. + +### src/scene/sdChannelSelect/iplSDChannelSelect + +- ipl::scene::SDChannelSelect::create() | 94.23972% | 146/146 instructions; diffs 84 in registers, scheduling, branches or relocations. + Attempts: name first branch condition: 146/146 instructions, diffs 84; while loop as for loop: 146/146 instructions, diffs 84; reverse constant comparison operands: 146/146 instructions, diffs 84. +- ipl::scene::SDChannelSelect::enqueueStartNotice() | 94.117645% | 18/17 instructions; instruction count/control-flow or inlining differs. + Attempts: fully initialized argument aggregate: 21/17 instructions; zero aggregate then nonzero fields: 19/17 instructions; memset then nonzero fields: 19/17 instructions. +- ipl::scene::SDChannelSelect::enqueueFinishNotice() | 94.44444% | 19/18 instructions; instruction count/control-flow or inlining differs. + Attempts: fully initialized argument aggregate: 22/18 instructions; zero aggregate then nonzero fields: 20/18 instructions; memset then nonzero fields: 20/18 instructions. +- ipl::scene::SDChannelSelect::enqueueNotice(unsigned long, unsigned long, unsigned long) | 97.51111% | 46/45 instructions; instruction count/control-flow or inlining differs. + Attempts: fully initialized argument aggregate: 54/45 instructions; zero aggregate then nonzero fields: 52/45 instructions; memset then nonzero fields: 52/45 instructions. +- ipl::scene::SDChannelSelect::enqueueLoadNotice() | 95.652176% | 24/23 instructions; instruction count/control-flow or inlining differs. + Attempts: fully initialized argument aggregate: 27/23 instructions; zero aggregate then nonzero fields: 25/23 instructions; memset then nonzero fields: 25/23 instructions. +- ipl::scene::SDChannelSelect::enqueuePageNotice() | 95.652176% | 24/23 instructions; instruction count/control-flow or inlining differs. + Attempts: fully initialized argument aggregate: 27/23 instructions; zero aggregate then nonzero fields: 25/23 instructions; memset then nonzero fields: 25/23 instructions. +- ipl::scene::SDChannelSelect::enqueueResultNotice(unsigned long) | 95.652176% | 24/23 instructions; instruction count/control-flow or inlining differs. + Attempts: fully initialized argument aggregate: 30/23 instructions; zero aggregate then nonzero fields: 28/23 instructions; memset then nonzero fields: 31/23 instructions. +- ipl::scene::SDChannelSelect::enqueueChannelNotice(unsigned long, unsigned long, unsigned long, unsigned long) | 90.86957% | 25/23 instructions; instruction count/control-flow or inlining differs. + Attempts: fully initialized argument aggregate: 32/23 instructions; zero aggregate then nonzero fields: 30/23 instructions; memset then nonzero fields: 35/23 instructions. +- ipl::scene::SDChannelSelect::enqueueMoveNotice(unsigned long, unsigned long, unsigned long) | 95.652176% | 24/23 instructions; instruction count/control-flow or inlining differs. + Attempts: fully initialized argument aggregate: 29/23 instructions; zero aggregate then nonzero fields: 27/23 instructions; memset then nonzero fields: 31/23 instructions. +- ipl::scene::SDChannelSelect::enqueueStateNotice(unsigned long, unsigned long, unsigned long, unsigned long) | 95.13043% | 24/23 instructions; instruction count/control-flow or inlining differs. + Attempts: fully initialized argument aggregate: 30/23 instructions; zero aggregate then nonzero fields: 28/23 instructions; memset then nonzero fields: 33/23 instructions. +- ipl::scene::SDChannelSelect::enqueueErrorNotice(unsigned long, unsigned long) | 95.652176% | 24/23 instructions; instruction count/control-flow or inlining differs. + Attempts: fully initialized argument aggregate: 29/23 instructions; zero aggregate then nonzero fields: 27/23 instructions; memset then nonzero fields: 31/23 instructions. +- ipl::scene::SDChannelSelect::processWorkerCommands() | 83.055214% | 327/326 instructions; instruction count/control-flow or inlining differs. + Attempts: name first branch condition: 327/326 instructions; for loop with explicit while and increment: 327/326 instructions; invert first complete if/else: 327/326 instructions. +- ipl::scene::SDChannelSelect::handleSDTitleListResult() | 99.15205% | 170/171 instructions; instruction count/control-flow or inlining differs. + Attempts: name first branch condition: 171/171 instructions, diffs 30; for loop with explicit while and increment: 170/171 instructions; invert first complete if/else: 169/171 instructions. +- ipl::scene::SDChannelSelect::handleSDChannelUpdateComplete() | 86.82407% | 105/108 instructions; instruction count/control-flow or inlining differs. + Attempts: name first branch condition: 106/108 instructions; invert first complete if/else: 105/108 instructions; reverse constant comparison operands: 105/108 instructions. +- ipl::scene::SDChannelSelect::updateDialogAnimation() | 77.24719% | 263/267 instructions; instruction count/control-flow or inlining differs. + Attempts: name first branch condition: 263/267 instructions; invert first complete if/else: 263/267 instructions; nested short-circuit branch guards: 263/267 instructions. +- ipl::scene::SDChannelSelect::isCurrentTitleUsageEnough(const long*) const | 93.07843% | 50/51 instructions; instruction count/control-flow or inlining differs. + Attempts: bytes before blocks and explicit return: 51/51 instructions, diffs 9; separate negative guards: 52/51 instructions; named sufficient result: 50/51 instructions. +- ipl::scene::SDChannelSelect::getCurrentTitleUsage(long*, long*) const | 86.82353% | 49/51 instructions; instruction count/control-flow or inlining differs. + Attempts: explicit sums: 49/51 instructions; entry first in sums: 49/51 instructions; initialize blocks before bytes: 49/51 instructions. +- ipl::scene::SDChannelSelect::collectTitlesByUsage(const long*, const long*, unsigned long long*, char*, unsigned long*) | 97.81188% | 101/101 instructions; diffs 4 in registers, scheduling, branches or relocations. + Attempts: name first branch condition: 101/101 instructions, diffs 4; nested short-circuit branch guards: 101/101 instructions, diffs 4; increment output count directly: 101/101 instructions, diffs 4; assign output count from expression: 101/101 instructions, diffs 4; positive enough-usage conjunction: 101/101 instructions, diffs 4. +- ipl::scene::SDChannelSelect::collectTitlesFromNandUsage(const long*, const long*, unsigned long long*, char*, unsigned long*) | 97.833336% | 102/102 instructions; diffs 4 in registers, scheduling, branches or relocations. + Attempts: name first branch condition: 102/102 instructions, diffs 4; nested short-circuit branch guards: 102/102 instructions, diffs 4; assign output count from expression: 102/102 instructions, diffs 4; named next output count: 102/102 instructions, diffs 4; negative remaining-usage guards: 102/102 instructions, diffs 4. +- ipl::scene::SDChannelSelect::collectTitlesByChannelOrder(const long*, const long*, unsigned long long*, char*, unsigned long*) | 86.55556% | 118/126 instructions; instruction count/control-flow or inlining differs. + Attempts: name first branch condition: 119/126 instructions; nested short-circuit branch guards: 118/126 instructions; reverse constant comparison operands: 118/126 instructions. +- ipl::scene::SDChannelSelect::collectTitlesBySpecialChannels(const long*, const long*, unsigned long long*, char*, unsigned long*) | 71.63989% | 331/361 instructions; instruction count/control-flow or inlining differs. + Attempts: name first branch condition: 331/361 instructions; for loop with explicit while and increment: 331/361 instructions; nested short-circuit branch guards: 331/361 instructions. +- ipl::scene::SDChannelSelect::findAdjacentChannel(int, int*, int*) const | 48.044445% | 48/45 instructions; instruction count/control-flow or inlining differs. + Attempts: wrap candidate at loop top: 44/45 instructions; initialized found flag: 47/45 instructions; flag assigned on both breaks: 45/45, 12 diffs; step first then wrap: 45/45, 15 diffs; explicit signed direction branch: 45/45, 12 diffs. +- ipl::scene::SDChannelSelect::flushSaveDataAndMountSD() | 99.65714% | 35/35 instructions; diffs 2 in registers, scheduling, branches or relocations. + Attempts: cache heap and save manager: 35/35 instructions, 2 register diffs; retain manager after setter: 34/35 instructions; reload manager after setter: 35/35, 2 register diffs. +- ipl::scene::SDChannelSelect::calcCommon() | 99.07407% | 109/108 instructions; instruction count/control-flow or inlining differs. + Attempts: name first branch condition: 113/108 instructions; invert first complete if/else: 109/108 instructions; nested short-circuit branch guards: 109/108 instructions. +- ipl::scene::SDChannelSelect::destroy() | 95.097565% | 203/205 instructions; instruction count/control-flow or inlining differs. + Attempts: name first branch condition: 203/205 instructions; while loop as for loop: 203/205 instructions; reverse constant comparison operands: 203/205 instructions. +- ipl::scene::SDChannelSelect::drawChannelTransitionObjects() | 94.974846% | 153/159 instructions; instruction count/control-flow or inlining differs. + Attempts: name first branch condition: 157/159 instructions; while loop as for loop: 153/159 instructions; nested short-circuit branch guards: 153/159 instructions. +- ipl::scene::SDChannelSelect::initializeNormalPage() | 98.93617% | 95/94 instructions; instruction count/control-flow or inlining differs. + Attempts: name first branch condition: 101/94 instructions; invert first complete if/else: 95/94 instructions; reverse constant comparison operands: 95/94 instructions. +- ipl::scene::SDChannelSelect::selectChannel(int, int) | 98.305084% | 60/59 instructions; instruction count/control-flow or inlining differs. + Attempts: name first branch condition: 60/59 instructions; named page-position value: 60/59 instructions; componentwise page-position value: 62/59 instructions. +- ipl::scene::SDChannelSelect::startPageTransition(int, int) | 99.888885% | 45/45 instructions; diffs 5 in registers, scheduling, branches or relocations. + Attempts: implicit position copy: 45/45 instructions, 6 diffs; const copy initialization: 45/45, 5 stack-offset diffs; const direct copy: 45/45, 5 stack-offset diffs. +- ipl::scene::SDChannelSelect::setChannelScissor(const ipl::scene::SDChannelObj*) const | 93.48498% | 233/233 instructions; diffs 67 in registers, scheduling, branches or relocations. + Attempts: name first branch condition: 238/233 instructions; invert first complete if/else: 233/233 instructions, diffs 128; reverse constant comparison operands: 233/233 instructions, diffs 67. +- ipl::scene::SDChannelSelect::updatePageTransform() | 76.60645% | 151/155 instructions; instruction count/control-flow or inlining differs. + Attempts: for loop with explicit while and increment: 151/155 instructions; named position and scale geometry: 151/155 instructions; componentwise position and scale assignment: 146/155 instructions. +- ipl::scene::SDChannelSelect::applyChannelMove() | 94.66923% | 130/130 instructions; diffs 61 in registers, scheduling, branches or relocations. + Attempts: name first branch condition: 130/130 instructions, diffs 61; invert first complete if/else: 130/130 instructions, diffs 70; nested short-circuit branch guards: 130/130 instructions, diffs 61. +- ipl::scene::SDChannelSelect::onEventDerived(const char*, unsigned long, ipl::controller::Interface*) | 94.08572% | 103/105 instructions; instruction count/control-flow or inlining differs. + Attempts: name first branch condition: 107/105 instructions; nested short-circuit branch guards: 103/105 instructions; reverse constant comparison operands: 103/105 instructions. +- ipl::scene::SDChannelSelect::onButtonEvent(const char*, unsigned long, const ipl::controller::Interface*) | 93.73627% | 87/91 instructions; instruction count/control-flow or inlining differs. + Attempts: name first branch condition: 91/91 instructions, diffs 65; nested short-circuit branch guards: 87/91 instructions; reverse constant comparison operands: 87/91 instructions. +- ipl::scene::@unnamed@iplSDChannelSelect_cpp@::SDChannelSelectButtonEventHandler::onEventDerived(unsigned long, unsigned long, const ipl::controller::Interface*) | 95.68056% | 140/144 instructions; instruction count/control-flow or inlining differs. + Attempts: name first branch condition: 140/144 instructions; invert first complete if/else: 140/144 instructions; nested short-circuit branch guards: 140/144 instructions. + +### src/scene/sdChannelMemory/iplSDMemory + +- ipl::scene::SDMemory::create(EGG::Heap*, ipl::nand::LayoutFile*, ipl::scene::SDChannelSelect*) | 88.6062% | 1001/1064 instructions; instruction count/control-flow or inlining differs. + Attempts: static text-box casts: 986/1064 instructions; unsigned pane indexes: 1001/1064 instructions; pane lookup temporary before trigger call: 1001/1064 instructions. +- ipl::scene::SDMemory::setScrollLimit() | 98.888885% | 81/81 instructions; diffs 11 in registers, scheduling, branches or relocations. + Attempts: item height then content and viewport: 81/81 instructions, 11 diffs; single geometry expression: 81/81, 12 diffs; content and viewport before items: 81/81, 12 diffs. +- ipl::scene::SDMemory::onDialogState8() | 99.77848% | 158/158 instructions; diffs 6 in registers, scheduling, branches or relocations. + Attempts: signed elapsed-time comparison: 158/158 instructions, 6 register diffs; retained; retrieve message before pane lookups: 157/158 instructions; reverted; direct pane SetString: 157/158; reverted; TextBox local and direct ceil conversion: 157/158, missing frsp; reverted. +- ipl::scene::SDMemory::onDialogState21() | 90.060974% | 79/82 instructions; instruction count/control-flow or inlining differs. + Attempts: wcsncpy initialization: 81/82 instructions; reverted; wmemset initialization: unresolved instruction/branch differences; reverted; wcscpy initialization: unresolved instruction/branch differences; reverted. +- ipl::scene::SDMemory::drawTransferTitles() | 66.3969% | 376/451 instructions; instruction count/control-flow or inlining differs. + Attempts: target-derived memo position, alpha, NAND-title cursor and separate text/background rows: 419/451 instructions; componentwise memo translation and signed line length: 438/451 instructions; guarded newline-count do loop: 420/451 instructions. + +## Measurement uncertainty + +SDMemory::updateState has objdiff 100.0 and identical raw 1228-byte function bodies. SHA256: f6d214c0c43ea01b29a036f0056c89759db994a876e5131f0f1d3c5a8f24228c. ctxdiff/gate still report two differences: conditional CR1 branch operands are decoded using operand zero as an immediate, even though operand zero is the CR register. Subtracting the different source/target symbol addresses creates false branch differences. Gate tooling was not edited. Thus the reported instruction-exact count is 60/66 while objdiff reports 61/66. + +Data scores remain partial, including None for SDMemory .data. The original objects contain zero-filled deduplicated weak data. No padding, forced placement or artificial data was added. The full DOL hash is the gate authority; none of these units was changed to Matching. + +Notice argument initialization remains complete: target appears to omit a copied word, but removing its initialization would introduce an uninitialized read. SDButton callers still supply the declared unused second event-handler parameter; target omits its setup. No mismangled one-argument alias was introduced. + +Failed compile variants were reverted and excluded from the successful-attempt counts. Three compile-valid source attempts exist for every function listed above. The units remain partial. + +## Final full gate + +```text +main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d +[src/scene/setting/iplSetting] objdiff: code 21896/37884 data 472/5696 functions 97/112 fuzzy 86.6897 linked code 0 +[src/scene/setting/iplSetting] instruction-exact functions: 97/112 +[src/scene/sdChannelSelect/iplSDChannelSelect] objdiff: code 19192/33828 data 144/2960 functions 94/129 fuzzy 95.1933 linked code 0 +[src/scene/sdChannelSelect/iplSDChannelSelect] instruction-exact functions: 94/129 +[src/scene/sdChannelMemory/iplSDMemory] objdiff: code 13528/20872 data None/3344 functions 61/66 fuzzy 94.5922 linked code 0 +[src/scene/sdChannelMemory/iplSDMemory] instruction-exact functions: 60/66 +regressions vs baseline: 0 +GATE PASS +``` -- 2.49.1