cleanup: scenes a-m (gotos, comma conditions, placeholders) (worker 9aa2301a) (#1352)

This commit was merged in pull request #1352.
This commit is contained in:
coah
2026-10-09 12:55:56 -05:00
committed by GitHub
parent 164de9ceaf
commit f2006bdd15
14 changed files with 242 additions and 139 deletions

View File

@@ -326,7 +326,7 @@ namespace ipl {
return_to_freelist();
void* object = NULL;
while (object = (void*)mObjList.getNextFree((BoardObject*)object), object != NULL) {
while ((object = (void*)mObjList.getNextFree((BoardObject*)object)) != NULL) {
((BoardObject*)object)->destroy_heap();
}

View File

@@ -53,7 +53,7 @@ namespace ipl {
void UrlProcessor::destroy() {
url_collision* col;
while (col = (url_collision*)nw4r::ut::List_GetNext(&mUrlCollisions, NULL), col != NULL) {
while ((col = (url_collision*)nw4r::ut::List_GetNext(&mUrlCollisions, NULL)) != NULL) {
nw4r::ut::List_Remove(&mUrlCollisions, col);
delete col;
}
@@ -172,8 +172,8 @@ namespace ipl {
lineBottomOffset = 50.0f;
pointerX = pos.x;
while (url_col = (url_collision*)nw4r::ut::List_GetNext(&mUrlCollisions, url_col), url_col != NULL) {
while (line_col = (line_collision*)nw4r::ut::List_GetNext(&url_col->mLineCollisions, line_col), line_col != NULL) {
while ((url_col = (url_collision*)nw4r::ut::List_GetNext(&mUrlCollisions, url_col)) != NULL) {
while ((line_col = (line_collision*)nw4r::ut::List_GetNext(&url_col->mLineCollisions, line_col)) != NULL) {
f32 left = line_col->mLeft - hitMargin;
f32 right = hitMargin + line_col->mRight;
f32 lineY = ((mMemoTranslateY + mHitYOffset) - line_col->mY);
@@ -193,7 +193,7 @@ namespace ipl {
url_collision* got = NULL;
url_collision* url_col = NULL;
while (got = (url_collision*)nw4r::ut::List_GetNext(&mUrlCollisions, got), got != NULL) {
while ((got = (url_collision*)nw4r::ut::List_GetNext(&mUrlCollisions, got)) != NULL) {
if (got->mTagNo == mSelectedTagNo) {
url_col = got;
break;
@@ -235,7 +235,7 @@ namespace ipl {
UrlProcessor::url_collision::~url_collision() {
line_collision* col;
while (col = (line_collision*)nw4r::ut::List_GetNext(&mLineCollisions, NULL), col != NULL) {
while ((col = (line_collision*)nw4r::ut::List_GetNext(&mLineCollisions, NULL)) != NULL) {
nw4r::ut::List_Remove(&mLineCollisions, col);
delete col;
}

View File

@@ -6,21 +6,24 @@ namespace ipl {
namespace scene {
void Arrow::draw() {
Button* button;
if (System::onDefaultDrawLayer() && (button = static_cast<Button*>(System::getScene(SCENE_BUTTON)), button != NULL)) {
layout::Object::setDefaultCamera();
if (System::onDefaultDrawLayer()) {
button = static_cast<Button*>(System::getScene(SCENE_BUTTON));
if (button != NULL) {
layout::Object::setDefaultCamera();
for (int i = 0; i < Button::ARROW_BTN_MAX; i++) {
layout::Object* arrowLayout = button->get_layout();
nw4r::lyt::Pane* pane = arrowLayout->FindPaneByName(Button::mscArrowName[i]);
for (int i = 0; i < Button::ARROW_BTN_MAX; i++) {
layout::Object* arrowLayout = button->get_layout();
nw4r::lyt::Pane* pane = arrowLayout->FindPaneByName(Button::mscArrowName[i]);
pane->SetVisible(true);
arrowLayout->draw(pane);
pane->SetVisible(false);
}
pane->SetVisible(true);
arrowLayout->draw(pane);
pane->SetVisible(false);
}
button->drawBalloon();
if (!System::isSafeMode()) {
button->get_sd_menu_btn()->drawBalloon();
button->drawBalloon();
if (!System::isSafeMode()) {
button->get_sd_menu_btn()->drawBalloon();
}
}
}
}

View File

@@ -271,7 +271,7 @@ namespace ipl {
set_date_pos(2);
Date* date = NULL;
while (date = (Date*)nw4r::ut::List_GetNext(&mDateList, date), date != NULL) {
while ((date = (Date*)nw4r::ut::List_GetNext(&mDateList, date)) != NULL) {
date->calc();
}
@@ -304,7 +304,7 @@ namespace ipl {
}
Date* date = NULL;
while (date = (Date*)nw4r::ut::List_GetNext(&mDateList, date), date != NULL) {
while ((date = (Date*)nw4r::ut::List_GetNext(&mDateList, date)) != NULL) {
date->calc();
}
}
@@ -478,7 +478,7 @@ namespace ipl {
if (!mpLayout->isPlaying(IDANIM_0)) {
Date* date = NULL;
while (date = (Date*)nw4r::ut::List_GetNext(&mDateList, date), date != NULL) {
while ((date = (Date*)nw4r::ut::List_GetNext(&mDateList, date)) != NULL) {
date->initEvent();
}
@@ -546,7 +546,7 @@ namespace ipl {
void Calendar::do_scroll_r() {
Date* date = NULL;
while (date = (Date*)nw4r::ut::List_GetNext(&mDateList, date), date != NULL) {
while ((date = (Date*)nw4r::ut::List_GetNext(&mDateList, date)) != NULL) {
date->initEvent();
}
@@ -588,7 +588,7 @@ namespace ipl {
void Calendar::do_scroll_l() {
Date* date = NULL;
while (date = (Date*)nw4r::ut::List_GetNext(&mDateList, date), date != NULL) {
while ((date = (Date*)nw4r::ut::List_GetNext(&mDateList, date)) != NULL) {
date->initEvent();
}
@@ -705,11 +705,12 @@ namespace ipl {
}
void Calendar::set_textbox_date(int calendarIndex, const utility::Date& date) {
s32 lang = System::getLanguage();
int val;
// MWCC needs this query call to retain the original instruction sequence.
System::getLanguage();
int monthEnd;
int maxDays;
int week;
week = utility::Calendar::getWeek(date.year, date.month, 1);
int firstWeekday;
firstWeekday = utility::Calendar::getWeek(date.year, date.month, 1);
maxDays = utility::Calendar::getDays(date.year, date.month);
OSCalendarTime curTime = System::getCurrentTime();
@@ -721,47 +722,44 @@ namespace ipl {
utility::Calendar::getLastMonth(date, &lastMonth);
utility::Calendar::getNextMonth(date, &nextMonth);
int dateIndex;
int weekOffset;
int listIndex;
int trailingDays;
if (mbAsian || mbUSA) {
weekOffset = 6 - utility::Calendar::getWeek(date.year, date.month, maxDays);
trailingDays = 6 - utility::Calendar::getWeek(date.year, date.month, maxDays);
} else {
week--;
if (week < 0) {
week = 6;
firstWeekday--;
if (firstWeekday < 0) {
firstWeekday = 6;
}
weekOffset = 6 - (utility::Calendar::getWeek(date.year, date.month, maxDays) - 1);
if (weekOffset >= 7) {
weekOffset = 0;
trailingDays = 6 - (utility::Calendar::getWeek(date.year, date.month, maxDays) - 1);
if (trailingDays >= 7) {
trailingDays = 0;
}
}
dateIndex = calendarIndex == 1 ? 0 : DATE_COUNT;
listIndex = calendarIndex == 1 ? 0 : DATE_COUNT;
utility::Date cellDate;
u32 attr;
int val2;
int i;
for (i = 0; i < DATE_COUNT; i++) {
Date* dateScn = ((Date*)nw4r::ut::List_GetNth(&mDateList, dateIndex));
dateIndex++;
int visibleCellEnd;
int dayIndex;
for (dayIndex = 0; dayIndex < DATE_COUNT; dayIndex++) {
Date* dateScn = ((Date*)nw4r::ut::List_GetNth(&mDateList, listIndex));
listIndex++;
dateScn->setVisible(true);
val = (maxDays + week);
monthEnd = (maxDays + firstWeekday);
attr = 0;
val2 = (weekOffset + val);
if ((week - i) > 0) {
visibleCellEnd = (trailingDays + monthEnd);
if ((firstWeekday - dayIndex) > 0) {
cellDate.year = lastMonth.year;
cellDate.month = lastMonth.month;
cellDate.day = i + (lastMonth.day - week) + 1;
goto out;
}
if ((val - i) > 0) {
cellDate.day = dayIndex + (lastMonth.day - firstWeekday) + 1;
} else if ((monthEnd - dayIndex) > 0) {
cellDate.year = date.year;
cellDate.month = date.month;
cellDate.day = (i - week) + 1;
cellDate.day = (dayIndex - firstWeekday) + 1;
attr |= 2;
if (cellDate == todayDate) {
@@ -778,20 +776,15 @@ namespace ipl {
break;
}
}
goto out;
}
if ((val2 - i) > 0) {
} else if ((visibleCellEnd - dayIndex) > 0) {
cellDate.year = nextMonth.year;
cellDate.month = nextMonth.month;
cellDate.day = ((i - maxDays) - week) + 1;
goto out;
cellDate.day = ((dayIndex - maxDays) - firstWeekday) + 1;
} else {
dateScn->setVisible(false);
continue;
}
out:
dateScn->setDate(cellDate);
dateScn->setAttribute(attr);
}

View File

@@ -79,7 +79,7 @@ namespace ipl {
mpLayout->calc();
mpGui->calc();
anmPane = NULL;
while (anmPane = (AnmPane*)nw4r::ut::List_GetNext(&mPaneList, anmPane), anmPane != NULL) {
while ((anmPane = (AnmPane*)nw4r::ut::List_GetNext(&mPaneList, anmPane)) != NULL) {
anmPane->calc();
}

View File

@@ -63,7 +63,7 @@ namespace ipl {
mpGui->calc();
anmPane = NULL;
while (anmPane = (AnmPane*)nw4r::ut::List_GetNext(&mPaneList, anmPane), anmPane != NULL) {
while ((anmPane = (AnmPane*)nw4r::ut::List_GetNext(&mPaneList, anmPane)) != NULL) {
anmPane->calc();
}

View File

@@ -98,7 +98,7 @@ namespace ipl {
mpLayout->calc();
mpGui->calc();
anmPane = NULL;
while (anmPane = (AnmPane*)nw4r::ut::List_GetNext(&mPaneList, anmPane), anmPane != NULL)
while ((anmPane = (AnmPane*)nw4r::ut::List_GetNext(&mPaneList, anmPane)) != NULL)
anmPane->calc();
if (mpThumbnail != NULL)
@@ -290,7 +290,7 @@ namespace ipl {
change_button_text(MESG_CMN_BACK_ALT_3);
AnmPane* anmPane = NULL;
while (anmPane = (AnmPane*)nw4r::ut::List_GetNext(&mPaneList, anmPane), anmPane != NULL) {
while ((anmPane = (AnmPane*)nw4r::ut::List_GetNext(&mPaneList, anmPane)) != NULL) {
clear_anmpane(anmPane->getName());
}
@@ -331,7 +331,7 @@ namespace ipl {
change_button_text(MESG_CMN_BACK_ALT_3);
AnmPane* anmPane = NULL;
while (anmPane = (AnmPane*)nw4r::ut::List_GetNext(&mPaneList, anmPane), anmPane != NULL) {
while ((anmPane = (AnmPane*)nw4r::ut::List_GetNext(&mPaneList, anmPane)) != NULL) {
clear_anmpane(anmPane->getName());
}

View File

@@ -109,7 +109,7 @@ namespace ipl {
mpChanAppBase->calc();
ChanAppBox* currBox = NULL;
while (currBox = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, currBox), currBox != NULL) {
while ((currBox = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, currBox)) != NULL) {
currBox->calc();
}
@@ -255,7 +255,7 @@ namespace ipl {
int i = 0;
ChanAppBox* box = NULL;
while (box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box), box != NULL) {
while ((box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box)) != NULL) {
nw4r::lyt::Pane* currPane = mpChanAppBase->getLytObject()->FindPaneByName(panes[0][i]);
nw4r::math::VEC3 translation(0, 0, 0);
PSMTXMultVec(currPane->GetGlobalMtx(), translation, translation);
@@ -271,7 +271,7 @@ namespace ipl {
void ChannelEdit::fadein_chanapp_box() {
int i = 0;
ChanAppBox* box = NULL;
while (box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box), box != NULL) {
while ((box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box)) != NULL) {
nw4r::lyt::Pane* currPane = mpChanAppBase->getLytObject()->FindPaneByName(panes[0][i]);
nw4r::math::VEC3 translation(0, 0, 0);
PSMTXMultVec(currPane->GetGlobalMtx(), translation, translation);
@@ -284,7 +284,7 @@ namespace ipl {
void ChannelEdit::fadeout_chanapp_box() {
ChanAppBox* box = NULL;
while (box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box), box != NULL) {
while ((box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box)) != NULL) {
box->setThumbnail(NULL);
box->anmFadeout();
}
@@ -311,7 +311,7 @@ namespace ipl {
ChanAppBox* box;
box = NULL;
while (box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box), box != NULL) {
while ((box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box)) != NULL) {
if (box->getTextBalloon() != NULL) {
box->terminateBalloon();
}
@@ -504,7 +504,7 @@ namespace ipl {
mpNandSDCardManager->cmdCleanQueue();
ChanAppBox* box = NULL;
while (box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box), box != NULL) {
while ((box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box)) != NULL) {
box->clearEvent();
}
@@ -520,7 +520,7 @@ namespace ipl {
mpNandSDCardManager->cmdCleanQueue();
ChanAppBox* box = NULL;
while (box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box), box != NULL) {
while ((box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box)) != NULL) {
box->clearEvent();
}
@@ -564,7 +564,7 @@ namespace ipl {
mpChanAppBase->draw();
ChanAppBox* box = NULL;
while (box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box), box != NULL) {
while ((box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box)) != NULL) {
box->draw();
}
@@ -613,7 +613,7 @@ namespace ipl {
if (strcmp(pane->getName(), "B_SelectWii_00") == 0 && mPage == PAGE_SD) {
ChanAppBox* box = NULL;
while (box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box), box != NULL) {
while ((box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box)) != NULL) {
box->setThumbnail(NULL);
}
@@ -641,7 +641,7 @@ namespace ipl {
}
} else if (strcmp(pane->getName(), "B_SelectSd_00") == 0 && mPage == PAGE_WII) {
ChanAppBox* box = NULL;
while (box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box), box != NULL) {
while ((box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box)) != NULL) {
box->setThumbnail(NULL);
}
@@ -753,7 +753,7 @@ namespace ipl {
onTrigButton(false);
ChanAppBox* box = NULL;
while (box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box), box != NULL) {
while ((box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box)) != NULL) {
box->setThumbnail(NULL);
}
return;
@@ -766,7 +766,7 @@ namespace ipl {
mpChanAppBase->update();
ChanAppBox* box = NULL;
while (box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box), box != NULL) {
while ((box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box)) != NULL) {
box->update();
}
@@ -806,7 +806,7 @@ namespace ipl {
void ChannelEdit::on_fadein2nd() {
ChanAppBox* box = NULL;
while (box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box), box != NULL) {
while ((box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box)) != NULL) {
if (!box->isIdle()) {
return;
}
@@ -836,7 +836,7 @@ namespace ipl {
if (mpChanAppBase->isIdle() && sd_worker_ready(mpNandSDCardManager)) {
mPageOffset += 15;
ChanAppBox* box = NULL;
while (box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box), box != NULL) {
while ((box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box)) != NULL) {
box->setThumbnail(NULL);
}
@@ -850,7 +850,7 @@ namespace ipl {
if (mpChanAppBase->isIdle() && sd_worker_ready(mpNandSDCardManager)) {
mPageOffset -= 15;
ChanAppBox* box = NULL;
while (box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box), box != NULL) {
while ((box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box)) != NULL) {
box->setThumbnail(NULL);
}
@@ -865,7 +865,7 @@ namespace ipl {
return;
ChanAppBox* box = NULL;
while (box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box), box != NULL) {
while ((box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box)) != NULL) {
if (!box->isIdle()) {
return;
}
@@ -926,7 +926,7 @@ namespace ipl {
void ChannelEdit::on_change_tag2nd() {
ChanAppBox* box = NULL;
while (box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box), box != NULL) {
while ((box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box)) != NULL) {
if (!box->isIdle()) {
return;
}
@@ -1170,7 +1170,7 @@ namespace ipl {
mpNandSDCardManager->calc();
ChanAppBox* box = NULL;
while (box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box), box != NULL) {
while ((box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box)) != NULL) {
box->setThumbnail(NULL);
}
@@ -1507,7 +1507,7 @@ namespace ipl {
mpNandSDCardManager->calc();
ChanAppBox* box = NULL;
while (box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box), box != NULL) {
while ((box = (ChanAppBox*)nw4r::ut::List_GetNext(&mChanAppBoxList, box)) != NULL) {
box->setThumbnail(NULL);
}

View File

@@ -55,7 +55,7 @@ namespace ipl {
TitleListing* listing;
listing = NULL;
while (listing = (TitleListing*)nw4r::ut::List_GetNext(&mNandListingList, listing), listing != NULL) {
while ((listing = (TitleListing*)nw4r::ut::List_GetNext(&mNandListingList, listing)) != NULL) {
if (listing == NULL) {
break;
}
@@ -65,7 +65,7 @@ namespace ipl {
}
listing = NULL;
while (listing = (TitleListing*)nw4r::ut::List_GetNext(&mSDListingList, listing), listing != NULL) {
while ((listing = (TitleListing*)nw4r::ut::List_GetNext(&mSDListingList, listing)) != NULL) {
if (listing == NULL) {
break;
}
@@ -245,7 +245,7 @@ namespace ipl {
GATED_STATE(NandSDCardManager::on_mount_sd, !mpWorker->is_working(), mState = STATE_NORMAL)
GATED_STATE(NandSDCardManager::on_list_nandapp, !mpWorker->is_working(), {
TitleListing* listing = NULL;
while (listing = (TitleListing*)nw4r::ut::List_GetNext(&mNandListingList, listing), listing != NULL) {
while ((listing = (TitleListing*)nw4r::ut::List_GetNext(&mNandListingList, listing)) != NULL) {
nw4r::ut::List_Remove(&mNandListingList, listing);
delete listing;
listing = NULL;
@@ -279,7 +279,7 @@ namespace ipl {
})
GATED_STATE(NandSDCardManager::on_list_sdapp, !mpWorker->is_working(), {
u8* buf = NULL;
while (buf = (u8*)nw4r::ut::List_GetNext(&mSDListingList, buf), buf != NULL) {
while ((buf = (u8*)nw4r::ut::List_GetNext(&mSDListingList, buf)) != NULL) {
nw4r::ut::List_Remove(&mSDListingList, buf);
delete buf;
buf = NULL;
@@ -507,7 +507,7 @@ namespace ipl {
GATED_STATE(NandSDCardManager::on_copy_sdapp_to_nand, !mpWorker->is_working(), mState = STATE_NORMAL)
GATED_STATE(NandSDCardManager::on_del_nandapp, !mpWorker->is_working(), {
TitleListing* listing = NULL;
while (listing = (TitleListing*)nw4r::ut::List_GetNext(&mNandListingList, listing), listing != NULL) {
while ((listing = (TitleListing*)nw4r::ut::List_GetNext(&mNandListingList, listing)) != NULL) {
ESTitleId titleId = mpActiveChanAppBox->getThumbnail()->getWiiTitleId();
if (titleId == listing->wiiTitleId) {
nw4r::ut::List_Remove(&mNandListingList, listing);
@@ -525,7 +525,7 @@ namespace ipl {
})
GATED_STATE(NandSDCardManager::on_del_nandsave, !mpWorker->is_working(), {
TitleListing* listing = NULL;
while (listing = (TitleListing*)nw4r::ut::List_GetNext(&mNandListingList, listing), listing != NULL) {
while ((listing = (TitleListing*)nw4r::ut::List_GetNext(&mNandListingList, listing)) != NULL) {
ESTitleId titleId = mpActiveSavedataBox->getBanner()->getWiiTitleId();
if (titleId == listing->wiiTitleId) {
nw4r::ut::List_Remove(&mNandListingList, listing);
@@ -537,7 +537,7 @@ namespace ipl {
})
GATED_STATE(NandSDCardManager::on_del_sdsave, !mpWorker->is_working(), {
TitleListing* listing = NULL;
while (listing = (TitleListing*)nw4r::ut::List_GetNext(&mSDListingList, listing), listing != NULL) {
while ((listing = (TitleListing*)nw4r::ut::List_GetNext(&mSDListingList, listing)) != NULL) {
u32 titleId = mpActiveSavedataBox->getBanner()->getSDTitleId();
if (titleId == listing->sdTitleId) {
nw4r::ut::List_Remove(&mSDListingList, listing);
@@ -549,7 +549,7 @@ namespace ipl {
})
GATED_STATE(NandSDCardManager::on_del_sdapp, !mpWorker->is_working(), {
TitleListing* listing = NULL;
while (listing = (TitleListing*)nw4r::ut::List_GetNext(&mSDListingList, listing), listing != NULL) {
while ((listing = (TitleListing*)nw4r::ut::List_GetNext(&mSDListingList, listing)) != NULL) {
u32 titleId = mpActiveChanAppBox->getThumbnail()->getSDTitleId();
if (titleId == listing->sdTitleId) {
nw4r::ut::List_Remove(&mSDListingList, listing);
@@ -664,7 +664,7 @@ namespace ipl {
GATED_STATE(NandSDCardManager::on_move_nandapp_to_sd, !mpWorker->is_working(), {
if (getAsyncResult() == NandSDWorker::RESULT_OK) {
TitleListing* listing = NULL;
while (listing = (TitleListing*)nw4r::ut::List_GetNext(&mNandListingList, listing), listing != NULL) {
while ((listing = (TitleListing*)nw4r::ut::List_GetNext(&mNandListingList, listing)) != NULL) {
ESTitleId titleId = mpActiveChanAppBox->getThumbnail()->getWiiTitleId();
if (titleId == listing->wiiTitleId) {
nw4r::ut::List_Remove(&mNandListingList, listing);
@@ -678,7 +678,7 @@ namespace ipl {
GATED_STATE(NandSDCardManager::on_move_sdapp_to_nand, !mpWorker->is_working(), {
if (getAsyncResult() == NandSDWorker::RESULT_OK) {
TitleListing* listing = NULL;
while (listing = (TitleListing*)nw4r::ut::List_GetNext(&mSDListingList, listing), listing != NULL) {
while ((listing = (TitleListing*)nw4r::ut::List_GetNext(&mSDListingList, listing)) != NULL) {
u32 titleId = mpActiveChanAppBox->getThumbnail()->getSDTitleId();
if (titleId == listing->sdTitleId) {
nw4r::ut::List_Remove(&mSDListingList, listing);
@@ -692,7 +692,7 @@ namespace ipl {
GATED_STATE(NandSDCardManager::on_move_nandsave_to_sd, !mpWorker->is_working(), {
if (getAsyncResult() == NandSDWorker::RESULT_OK) {
TitleListing* listing = NULL;
while (listing = (TitleListing*)nw4r::ut::List_GetNext(&mNandListingList, listing), listing != NULL) {
while ((listing = (TitleListing*)nw4r::ut::List_GetNext(&mNandListingList, listing)) != NULL) {
ESTitleId titleId = mpActiveSavedataBox->getBanner()->getWiiTitleId();
if (titleId == listing->wiiTitleId) {
nw4r::ut::List_Remove(&mNandListingList, listing);
@@ -706,7 +706,7 @@ namespace ipl {
GATED_STATE(NandSDCardManager::on_move_sdsave_to_nand, !mpWorker->is_working(), {
if (getAsyncResult() == NandSDWorker::RESULT_OK) {
TitleListing* listing = NULL;
while (listing = (TitleListing*)nw4r::ut::List_GetNext(&mSDListingList, listing), listing != NULL) {
while ((listing = (TitleListing*)nw4r::ut::List_GetNext(&mSDListingList, listing)) != NULL) {
u32 titleId = mpActiveSavedataBox->getBanner()->getSDTitleId();
if (titleId == listing->sdTitleId) {
nw4r::ut::List_Remove(&mSDListingList, listing);

View File

@@ -1022,7 +1022,7 @@ namespace ipl {
wcsncpy(fullStr, text, channel::META_CHANNEL_NAME_LENGTH);
strLen = wcslen(fullStr);
f32 temp1 = 0.0f;
f32 widthAdjustment = 0.0f;
int extraLen = 0;
if (strLen == 0) {
@@ -1033,7 +1033,7 @@ namespace ipl {
textPane->CalculateMtx(*mpBalloonLayout->getDrawInfo());
nw4r::ut::Rect textRect = textPane->GetTextDrawRect(*mpBalloonLayout->getDrawInfo());
if (textRect.GetWidth() <= temp1 + 391.5f) {
if (textRect.GetWidth() <= widthAdjustment + 391.5f) {
break;
}
@@ -1041,7 +1041,7 @@ namespace ipl {
fullStr[i - 1] = NULL;
fullStr[i - 2] = L'…';
} else {
temp1 = -1.179962f;
widthAdjustment = -1.179962f;
extraLen = 2;
fullStr[i + 1] = NULL;
fullStr[i] = '.';

View File

@@ -16,8 +16,6 @@
#include <cstring>
// #pragma sym on
namespace ipl {
namespace math {
static inline nw4r::math::VEC3 subHermitePoints(const VEC3& start, const VEC3& end) {
@@ -287,7 +285,7 @@ namespace ipl {
// clang-format on
#define FOREACH_CHANNEL_OBJ(chanObj) while (chanObj = (ChannelObj*)nw4r::ut::List_GetNext(&mChanList, chanObj), chanObj != NULL)
#define FOREACH_CHANNEL_OBJ(chanObj) while ((chanObj = (ChannelObj*)nw4r::ut::List_GetNext(&mChanList, chanObj)) != NULL)
ChannelSelect::ChannelSelect(EGG::Heap* heap, int startup)
: scene::FaderSceneBase(heap),
@@ -1266,21 +1264,14 @@ namespace ipl {
void ChannelSelect::sortChannelListByPage(int page, int edgeDirection) {
for (int i = 0; i < MAX_CHANNEL_INDEX; i++) {
// TODO: fix this ugly madness
if (edgeDirection == -1) {
if (!(i & 3)) {
continue;
}
} else {
goto block_6;
}
goto block_7;
block_6:
if (!(edgeDirection != 1 || (i & 3) != 3)) {
} else if (edgeDirection == 1 && (i & 3) == 3) {
continue;
}
block_7:
ChannelObj* chanObj = searchList(page, i);
nw4r::ut::List_Remove(&mChanList, chanObj);
nw4r::ut::List_Append(&mChanList, chanObj);

View File

@@ -109,7 +109,7 @@ namespace ipl {
mpSavedataBase->calc();
SavedataBox* currBox = NULL;
while (currBox = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, currBox), currBox != NULL)
while ((currBox = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, currBox)) != NULL)
currBox->calc();
mpSavedataEdit->calc();
@@ -248,7 +248,7 @@ namespace ipl {
int i = 0;
SavedataBox* box = NULL;
while (box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box), box != NULL) {
while ((box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box)) != NULL) {
nw4r::lyt::Pane* currPane = mpSavedataBase->getLytObject()->FindPaneByName(panes[0][i]);
nw4r::math::VEC3 translation(0, 0, 0);
PSMTXMultVec(currPane->GetGlobalMtx(), translation, translation);
@@ -264,7 +264,7 @@ namespace ipl {
void Memory::fadein_savedata_box() {
int i = 0;
SavedataBox* box = NULL;
while (box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box), box != NULL) {
while ((box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box)) != NULL) {
nw4r::lyt::Pane* currPane = mpSavedataBase->getLytObject()->FindPaneByName(panes[0][i]);
nw4r::math::VEC3 translation(0, 0, 0);
PSMTXMultVec(currPane->GetGlobalMtx(), translation, translation);
@@ -278,7 +278,7 @@ namespace ipl {
void Memory::fadeout_savedata_box() {
SavedataBox* box;
box = NULL;
while (box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box), box != NULL) {
while ((box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box)) != NULL) {
box->setBannerFileInfo(NULL);
box->anmFadeout();
}
@@ -307,7 +307,7 @@ namespace ipl {
SavedataBox* box;
box = NULL;
while (box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box), box != NULL) {
while ((box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box)) != NULL) {
if (box->getTextBalloon() != NULL) {
box->terminateBalloon();
}
@@ -495,7 +495,7 @@ namespace ipl {
mpNandSDCardManager->cmdCleanQueue();
SavedataBox* box = NULL;
while (box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box), box != NULL) {
while ((box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box)) != NULL) {
box->clearEvent();
}
@@ -511,7 +511,7 @@ namespace ipl {
mpNandSDCardManager->cmdCleanQueue();
SavedataBox* box = NULL;
while (box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box), box != NULL) {
while ((box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box)) != NULL) {
box->clearEvent();
}
@@ -553,7 +553,7 @@ namespace ipl {
mpSavedataBase->draw();
SavedataBox* box = NULL;
while (box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box), box != NULL) {
while ((box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box)) != NULL) {
box->draw();
}
@@ -602,7 +602,7 @@ namespace ipl {
if (strcmp(pane->getName(), "B_SelectWii_00") == 0 && mPage == MEMORY_PAGE_SD) {
SavedataBox* box = NULL;
while (box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box), box != NULL) {
while ((box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box)) != NULL) {
box->setBannerFileInfo(NULL);
}
@@ -630,7 +630,7 @@ namespace ipl {
}
} else if (strcmp(pane->getName(), "B_SelectSd_00") == 0 && mPage == MEMORY_PAGE_WII) {
SavedataBox* box = NULL;
while (box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box), box != NULL) {
while ((box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box)) != NULL) {
box->setBannerFileInfo(NULL);
}
@@ -759,7 +759,7 @@ namespace ipl {
mpSavedataBase->update();
SavedataBox* box = NULL;
while (box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box), box != NULL)
while ((box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box)) != NULL)
box->update();
if (mPage == MEMORY_PAGE_WII) {
@@ -798,7 +798,7 @@ namespace ipl {
void Memory::on_fadein2nd() {
SavedataBox* box = NULL;
while (box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box), box != NULL) {
while ((box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box)) != NULL) {
if (!box->isIdle()) {
return;
}
@@ -828,7 +828,7 @@ namespace ipl {
if (mpSavedataBase->isIdle()) {
mPageOffset += 15;
SavedataBox* box = NULL;
while (box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box), box != NULL) {
while ((box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box)) != NULL) {
box->setBannerFileInfo(NULL);
}
@@ -842,7 +842,7 @@ namespace ipl {
if (mpSavedataBase->isIdle()) {
mPageOffset -= 15;
SavedataBox* box = NULL;
while (box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box), box != NULL) {
while ((box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box)) != NULL) {
box->setBannerFileInfo(NULL);
}
@@ -858,7 +858,7 @@ namespace ipl {
}
SavedataBox* box = NULL;
while (box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box), box != NULL) {
while ((box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box)) != NULL) {
if (!box->isIdle()) {
return;
}
@@ -920,7 +920,7 @@ namespace ipl {
void Memory::on_change_tag2nd() {
SavedataBox* box = NULL;
while (box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box), box != NULL) {
while ((box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box)) != NULL) {
if (!box->isIdle()) {
return;
}
@@ -1219,7 +1219,7 @@ namespace ipl {
mpNandSDCardManager->calc();
SavedataBox* box = NULL;
while (box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box), box != NULL) {
while ((box = (SavedataBox*)nw4r::ut::List_GetNext(&mSavedataBoxList, box)) != NULL) {
box->setBannerFileInfo(NULL);
}

View File

@@ -587,19 +587,9 @@ void GCWindow::on_error_message2nd() {
}
void GCWindow::on_error_message3rd() {
if (mFlags1[mCardState] != 0) {
goto fadeout;
}
if (mOperation != 2) {
goto check_animation;
}
fadeout:
mState = 3;
return;
check_animation:
if (!is_animation(0xb)) {
if (mFlags1[mCardState] != 0 || mOperation == 2) {
mState = 3;
} else if (!is_animation(0xb)) {
mState = 2;
}
}
@@ -753,6 +743,7 @@ void GCWindow::onMemEvent(long event, u8 cardState) {
set_textbox("T_Message_00", 0xe5);
break;
}
// MWCC needs this jump to retain both completion dispatch branches.
goto process_complete;
default:
return;

View File

@@ -0,0 +1,125 @@
# cleanup2-x2 attempts
Worktree data-d12, branch agent/w1009/cleanup2-x2, baseline 85d653b0dba14d81de4d9cf125a945d8c6ef57f7.
Scope is src/scene directories beginning a through m, excluding cardSequence.
Read cleanup-common.md, including wave-2 guidance, and ran the full 43U build before edits.
Baseline build and fresh completion check passed. DOL SHA1 is 26116613f624061ba99c8d1a299aaa6efa85670d.
Saved the baseline report and all 38 built owned objects under /tmp/cleanup2-x2-*.
Each retained trial must preserve every allocated object section and resolved relocation.
Each rejected trial restores the previous accepted source and rebuilds the exact object.
Commit each changed source file separately, run the final gate over all touched units,
regenerate the live report, and require DECOMPLETE_OK and the original DOL SHA1.
## Prior trials and scope
Reviewed cleanup-c2, cleanup-c3, and cleanup-c4. Do not repeat their plain pragma removals,
carrier flattening, typed Board destruction cursor, ChannelTitle early-return rewrite,
or AddressEdit local-order trials. Their byte changes are already recorded.
The remaining Board, AddressEdit, and ChannelTitle pragmas have compiler notes and remain.
Common error, exit, and cleanup paths remain when idiomatic. The wave-2 targets are
list-iteration comma operators, ChannelSelect block_N dispatch, GCWindow jumps into
switch bodies, Calendar cell dispatch, and local placeholder names with clear meanings.
MemoryCardManager's unk_0x fields are declared in the shared include/iplMemoryCardLib.h,
outside the assigned source directories. Leave those declarations to their owner.
## Trials
- KEEP `src/scene/channelSelect/iplChannelSelect` sortChannelListByPage replace both block_N gotos with else-if: every allocated section and resolved relocation is identical.
- KEEP `src/scene/channelSelect/iplChannelSelect` remove comma operator from FOREACH_CHANNEL_OBJ: every allocated section and resolved relocation is identical.
- KEEP `src/scene/board/iplBoard` destroy remove remaining comma operator without changing the void cursor: every allocated section and resolved relocation is identical.
- KEEP `src/scene/channelEdit/iplChannelEdit` replace list-iteration comma operators with ordinary assignment conditions: every allocated section and resolved relocation is identical.
- KEEP `src/scene/memory/iplMemory` replace list-iteration comma operators with ordinary assignment conditions: every allocated section and resolved relocation is identical.
- KEEP `src/scene/channelEdit/iplNandSDCardManager` replace list-iteration comma operators with ordinary assignment conditions: every allocated section and resolved relocation is identical.
- KEEP `src/scene/channelSelect/iplChannelObj` setBalloonText rename temp1 to widthAdjustment: every allocated section and resolved relocation is identical.
- KEEP `src/scene/memoryCard/iplGCWindow` on_error_message3rd replace both dispatch gotos with if/else-if: every allocated section and resolved relocation is identical.
- REVERT `src/scene/memoryCard/iplGCWindow` onMemEvent keep completion statements within case 0x11 and remove the jump into the switch: changed .rela.data, .rela.text, .text; onMemEvent__Q33ipl5scene8GCWindowFlUc: size 620 -> 612.
- KEEP `src/scene/calendar/iplCalendar` replace list-iteration comma operators with ordinary assignment conditions: every allocated section and resolved relocation is identical.
- KEEP `src/scene/channelEdit/iplChanAppEdit` replace list-iteration comma operators with ordinary assignment conditions: every allocated section and resolved relocation is identical.
- KEEP `src/scene/channelEdit/iplChanAppBox` replace list-iteration comma operators with ordinary assignment conditions: every allocated section and resolved relocation is identical.
- KEEP `src/scene/channelEdit/iplChanAppBase` replace list-iteration comma operators with ordinary assignment conditions: every allocated section and resolved relocation is identical.
- KEEP `src/scene/board/iplUrlProcessor` replace list-iteration comma operators with ordinary assignment conditions: every allocated section and resolved relocation is identical.
- KEEP `src/scene/calendar/iplCalendar` set_textbox_date replace three cell-dispatch gotos with an if/else-if chain: every allocated section and resolved relocation is identical.
- KEEP `src/scene/calendar/iplCalendar` set_textbox_date name month-end, visible-cell, weekday, trailing-day and list indices: every allocated section and resolved relocation is identical.
- KEEP `src/scene/button/iplArrow` draw move the scene assignment out of the condition while preserving short-circuit evaluation: every allocated section and resolved relocation is identical.
- KEEP `src/scene/memoryCard/iplGCWindow` document the retained onMemEvent dispatch branch requirement: every allocated section and resolved relocation is identical.
- New ChannelTitle hypothesis: a single final return with an explicit BOOL result may preserve the shared epilogue, unlike the previously rejected early-return shapes.
- REVERT `src/scene/channelTitle/iplChannelTitle` checkNetSetting replace goto-into-else with a common result and final return: changed .rela.data, .rela.text, .text; checkNetSetting__Q33ipl5scene12ChannelTitleFii: size 176 -> 184.
- REVERT `src/scene/calendar/iplCalendar` set_textbox_date remove the unused language declaration and call: changed .rela.ctors, .rela.data, .rela.text, .text; set_textbox_date__Q33ipl5scene8CalendarFiRCQ33ipl7utility4Date: size 668 -> 664.
- KEEP `src/scene/channelSelect/iplChannelSelect` remove the commented-out symbol-debug pragma: every allocated section and resolved relocation is identical.
- KEEP `src/scene/calendar/iplCalendar` set_textbox_date discard the unused language result while retaining the original query: every allocated section and resolved relocation is identical.
## Source commits
- `e9742b88` `src/scene/channelSelect/iplChannelSelect.cpp`
- `e9aa4e9a` `src/scene/board/iplBoard.cpp`
- `98b05969` `src/scene/channelEdit/iplChannelEdit.cpp`
- `44754e4d` `src/scene/memory/iplMemory.cpp`
- `f4c3eda9` `src/scene/channelEdit/iplNandSDCardManager.cpp`
- `d9239600` `src/scene/channelSelect/iplChannelObj.cpp`
- `b913c312` `src/scene/memoryCard/iplGCWindow.cpp`
- `86a8c35a` `src/scene/calendar/iplCalendar.cpp`
- `36bdd6f0` `src/scene/channelEdit/iplChanAppEdit.cpp`
- `7ccb6917` `src/scene/channelEdit/iplChanAppBox.cpp`
- `ea935bd6` `src/scene/channelEdit/iplChanAppBase.cpp`
- `1a46112d` `src/scene/board/iplUrlProcessor.cpp`
- `a6e54585` `src/scene/button/iplArrow.cpp`
## Retained cleanup
| File | Comma conditions removed | Gotos removed |
| --- | ---: | ---: |
| iplChannelSelect.cpp | 1 | 2 |
| iplBoard.cpp | 1 | 0 |
| iplChannelEdit.cpp | 19 | 0 |
| iplMemory.cpp | 17 | 0 |
| iplNandSDCardManager.cpp | 12 | 0 |
| iplChannelObj.cpp | 0 | 0 |
| iplGCWindow.cpp | 0 | 2 |
| iplCalendar.cpp | 5 | 3 |
| iplChanAppEdit.cpp | 3 | 0 |
| iplChanAppBox.cpp | 1 | 0 |
| iplChanAppBase.cpp | 1 | 0 |
| iplUrlProcessor.cpp | 5 | 0 |
| iplArrow.cpp | 1 | 0 |
Total: 66 comma conditions and 7 decompiler-style gotos removed.
ChannelSelect also drops the obsolete debug-pragma comment and the resolved TODO.
Calendar names its month and visible-cell bounds, weekday, trailing-day count, and list/day indices.
The unused language result is gone. The query call stays because removing it drops one instruction, with a one-line compiler note.
ChannelObj names the balloon width adjustment. GCWindow retains the onMemEvent completion jump, with a one-line compiler note, because structured continuation drops two instructions and changes switch relocations.
The ChannelTitle single-result rewrite adds two instructions, so that source is unchanged. Its existing compiler notes remain.
Board, FocusObject, BoardObject, MailAddressSelect, and GCWindow keep ordinary shared error/exit/cancel paths.
All existing scoped compiler pragmas and the Board metadata aggregate remain with their earlier evidence and notes.
## Final verification
Ran gate.py once at the end with --quick over all 14 touched or tried units, including restored ChannelTitle.
Full build passed; every pool is IDENTICAL; code, data, functions, link measures, and every reported section are 100%.
| Unit | Exact functions before -> after |
| --- | --- |
| src/scene/board/iplBoard | 94/94 -> 94/94 |
| src/scene/board/iplUrlProcessor | 17/17 -> 17/17 |
| src/scene/button/iplArrow | 5/5 -> 5/5 |
| src/scene/calendar/iplCalendar | 42/42 -> 42/42 |
| src/scene/channelEdit/iplChanAppBase | 21/21 -> 21/21 |
| src/scene/channelEdit/iplChanAppBox | 13/13 -> 13/13 |
| src/scene/channelEdit/iplChanAppEdit | 31/31 -> 31/31 |
| src/scene/channelEdit/iplChannelEdit | 65/65 -> 65/65 |
| src/scene/channelEdit/iplNandSDCardManager | 64/64 -> 64/64 |
| src/scene/channelSelect/iplChannelObj | 56/56 -> 56/56 |
| src/scene/channelSelect/iplChannelSelect | 102/102 -> 102/102 |
| src/scene/channelTitle/iplChannelTitle | 95/95 -> 95/95 |
| src/scene/memory/iplMemory | 63/63 -> 63/63 |
| src/scene/memoryCard/iplGCWindow | 48/48 -> 48/48 |
All 716/716 functions in the gated units remain instruction-exact.
Gate result: GATE PASS; 0 regressions, 0 forbidden-pattern additions, 0 readability warnings.
A separate fresh-report comparison against the initial live baseline found 0 regressions across all 1028 units and their exact functions.
Focused ctxdiff checks are diffs 0 with equal instruction counts: channel sorting 79/79, calendar cells 167/167, GC error dispatch 30/30, Arrow drawing 59/59, balloon text 181/181.
Regenerated build/43U/report.json and checked build/43U/ok. Completion checker returned DECOMPLETE_OK.
DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d.
Final source review and git diff --check passed. All 14 units preserve allocated section bytes and resolved relocation targets against their fresh initial objects.
Gate transcript: /tmp/cleanup2-x2-final-gate.log. Focused checks: /tmp/cleanup2-x2-ctxdiff.log.
Every changed source file is committed separately. No push, PR, merge, rebase, delegation, or cross-worktree edit.