Compare commits
14 Commits
cleanup/co
...
agent/w100
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9b09601af | ||
|
|
5689681bc2 | ||
|
|
fc0074f0d0 | ||
|
|
cd0cd3c65a | ||
|
|
fc3b22607c | ||
|
|
52862f1c28 | ||
|
|
d2286df586 | ||
|
|
a93771c1b0 | ||
|
|
89c3c6f375 | ||
|
|
a2c9b974a7 | ||
|
|
a2502a9294 | ||
|
|
f02043a765 | ||
|
|
5453d7e49a | ||
|
|
f2446827cd |
@@ -197,6 +197,7 @@ namespace ipl {
|
||||
friend class SDChannelSelectEventHandler;
|
||||
friend class SDChannelSelectButtonEventHandler;
|
||||
#endif
|
||||
friend class SDMemory;
|
||||
void enqueueStartNotice();
|
||||
bool enqueueFinishNotice();
|
||||
bool enqueueNotice(u32 highTitleId, u32 lowTitleId, u32 result);
|
||||
|
||||
@@ -24,7 +24,11 @@ namespace nw4r {
|
||||
|
||||
// Constructor
|
||||
|
||||
#ifdef IPL_SDMEMORY_TRIVIAL_COLOR_CTOR
|
||||
Color() {}
|
||||
#else
|
||||
Color() { *this = WHITE; }
|
||||
#endif
|
||||
Color(u32 color) { *this = color; }
|
||||
Color(const GXColor& color) { *this = color; }
|
||||
Color(int red, int green, int blue, int alpha) { Set(red, green, blue, alpha); }
|
||||
|
||||
@@ -393,6 +393,48 @@ CDBErr CDBRecordGetDataSize(CDBRecord* record, u32* size) {
|
||||
return err;
|
||||
}
|
||||
|
||||
CDBErr CDBRecordReduceFileSize(CDBRecord* record, u32 size) {
|
||||
CDBErr err = CDB_ERROR_OK;
|
||||
u32 fileSize;
|
||||
CDBLock();
|
||||
if (record->file == NULL) {
|
||||
CDBReportError("can't reduce file size of the record ; the record is closed\n");
|
||||
err = CDB_ERROR_27;
|
||||
} else if (!CDBRecordBelongedDBOpenedAsRW(record)) {
|
||||
CDBReportError("can't reduce file size of the record ; the record is opened as READONLY\n");
|
||||
err = CDB_ERROR_ACCESS_DENIED;
|
||||
} else {
|
||||
err = CDBRecordFileGetFileSize(record, &fileSize);
|
||||
if (size >= fileSize) {
|
||||
CDBReportError("can't reduce file size of the record ; file size must be over %d bytes\n", fileSize);
|
||||
err = CDB_ERROR_OUT_OF_RANGE;
|
||||
}
|
||||
}
|
||||
CDBUnlock();
|
||||
return err;
|
||||
}
|
||||
|
||||
CDBErr CDBRecordReduceDataSize(CDBRecord* record, u32 size) {
|
||||
CDBErr err = CDB_ERROR_OK;
|
||||
u32 dataSize;
|
||||
CDBLock();
|
||||
if (record->file == NULL) {
|
||||
CDBReportError("can't reduce data size of the record ; the record is closed\n");
|
||||
err = CDB_ERROR_27;
|
||||
} else if (!CDBRecordBelongedDBOpenedAsRW(record)) {
|
||||
CDBReportError("can't reduce data size of the record ; the record is opened as READONLY\n");
|
||||
err = CDB_ERROR_ACCESS_DENIED;
|
||||
} else {
|
||||
err = CDBRecordFileGetDataSize(record, &dataSize);
|
||||
if (size >= dataSize) {
|
||||
CDBReportError("can't reduce data size of the record; permission denied\n");
|
||||
err = CDB_ERROR_ACCESS_DENIED;
|
||||
}
|
||||
}
|
||||
CDBUnlock();
|
||||
return err;
|
||||
}
|
||||
|
||||
CDBErr CDBRecordRemove(CDBRecord* record) {
|
||||
CDBErr err;
|
||||
CDBLock();
|
||||
@@ -424,6 +466,164 @@ CDBErr CDBRecordRemove_(CDBRecord* record) {
|
||||
return result;
|
||||
}
|
||||
|
||||
CDBErr CDBRecordSetFileType(CDBRecord* record, char* fileType) {
|
||||
CDBErr err = CDB_ERROR_OK;
|
||||
CDBRecordFile* recordFile;
|
||||
CDBLock();
|
||||
recordFile = record->file;
|
||||
if ((((CDBRecordDatabaseState*)((CDBDatabase*)record->unk_0x00)->instance)->openFlags & 2) == 0) {
|
||||
CDBReportError("can't set file type of the record; the database is opened as READONLY\n");
|
||||
err = CDB_ERROR_26;
|
||||
} else if (recordFile == NULL) {
|
||||
CDBReportError("can't set file type of the record ; the record is closed\n");
|
||||
err = CDB_ERROR_27;
|
||||
} else if (!CDBRecordBelongedDBOpenedAsRW(record)) {
|
||||
CDBReportError("can't set file type of the record ; the record is opened as READONLY\n");
|
||||
err = CDB_ERROR_ACCESS_DENIED;
|
||||
} else if (record->key.location != CDB_FS_LOCATION_NAND) {
|
||||
CDBReportError("can't set file type of the record ; the record must exsist on NAND\n");
|
||||
err = CDB_ERROR_ACCESS_DENIED;
|
||||
}
|
||||
CDBUnlock();
|
||||
return err;
|
||||
}
|
||||
|
||||
CDBErr CDBRecordGetFileType(CDBRecord* record, char* fileType) {
|
||||
CDBErr err = CDB_ERROR_OK;
|
||||
CDBLock();
|
||||
if (record->file == NULL) {
|
||||
CDBReportError("can't get file type of the record ; the record is closed\n");
|
||||
err = CDB_ERROR_27;
|
||||
} else {
|
||||
CDBConvKeyStrToType(record->key.keyString, fileType);
|
||||
}
|
||||
CDBUnlock();
|
||||
return err;
|
||||
}
|
||||
|
||||
CDBErr CDBRecordGetGameCode(CDBRecord* record, char* gameCode) {
|
||||
CDBErr err = CDB_ERROR_OK;
|
||||
u32 value;
|
||||
CDBLock();
|
||||
if (record->file == NULL) {
|
||||
CDBReportError("can't get game code of the record ; the record is closed\n");
|
||||
err = CDB_ERROR_27;
|
||||
} else {
|
||||
CDBConvKeyStrToGameCode(record->key.keyString, &value);
|
||||
CDBConvGCValueToGCStr(value, gameCode);
|
||||
}
|
||||
CDBUnlock();
|
||||
return err;
|
||||
}
|
||||
|
||||
CDBErr CDBRecordGetMakerCode(CDBRecord* record, u32* makerCode) {
|
||||
CDBErr err = CDB_ERROR_OK;
|
||||
CDBLock();
|
||||
if (record->file == NULL) {
|
||||
CDBReportError("can't get maker code of the record ; the record is closed\n");
|
||||
err = CDB_ERROR_27;
|
||||
} else {
|
||||
CDBConvKeyStrToMakerCode(record->key.keyString, makerCode);
|
||||
}
|
||||
CDBUnlock();
|
||||
return err;
|
||||
}
|
||||
|
||||
CDBErr CDBRecordGetModifiedTime(CDBRecord* record, int* year, int* month, int* day, int* hour, int* min, int* sec) {
|
||||
CDBErr err = CDB_ERROR_OK;
|
||||
CDBRecordFile* recordFile;
|
||||
CDBLock();
|
||||
recordFile = record->file;
|
||||
if (recordFile == NULL) {
|
||||
CDBReportError("can't get modified time of the record; the record is closed\n");
|
||||
err = CDB_ERROR_27;
|
||||
} else {
|
||||
CDBConvertCDBDateToCalendarTime((CDBDate)recordFile->attr.buf.lastModifiedDate, year, month, day, hour, min, sec);
|
||||
}
|
||||
CDBUnlock();
|
||||
return err;
|
||||
}
|
||||
|
||||
CDBErr CDBRecordGetModifiedCount(CDBRecord* record, u32* modifiedCount) {
|
||||
CDBErr err = CDB_ERROR_OK;
|
||||
CDBRecordFile* recordFile;
|
||||
CDBLock();
|
||||
recordFile = record->file;
|
||||
if (recordFile == NULL) {
|
||||
CDBReportError("can't get modified count of the record; the record is closed\n");
|
||||
err = CDB_ERROR_27;
|
||||
} else {
|
||||
err = CDBAttrGetModifiedCount(&recordFile->attr, modifiedCount);
|
||||
}
|
||||
CDBUnlock();
|
||||
return err;
|
||||
}
|
||||
|
||||
CDBErr CDBRecordSetName(CDBRecord* record, char* name) {
|
||||
CDBErr err = CDB_ERROR_OK;
|
||||
CDBRecordFile* recordFile;
|
||||
CDBLock();
|
||||
recordFile = record->file;
|
||||
if ((((CDBRecordDatabaseState*)((CDBDatabase*)record->unk_0x00)->instance)->openFlags & 2) == 0) {
|
||||
CDBReportError("can't set a name of the record; the database is opened as READONLY\n");
|
||||
err = CDB_ERROR_26;
|
||||
} else if (!CDBRecordBelongedDBOpenedAsRW(record)) {
|
||||
CDBReportError("can't add keyword to the record; permission denied\n");
|
||||
err = CDB_ERROR_ACCESS_DENIED;
|
||||
} else if (recordFile == NULL) {
|
||||
CDBReportError("can't set a name of the record; the record is closed\n");
|
||||
err = CDB_ERROR_27;
|
||||
} else if ((recordFile->unk_0x1C & CDB_RECORD_ALLOC_WRITE) == 0) {
|
||||
CDBReportError("can't set a name of the record; the record is opened as READONLY\n");
|
||||
err = CDB_ERROR_ACCESS_DENIED;
|
||||
}
|
||||
CDBUnlock();
|
||||
return err;
|
||||
}
|
||||
|
||||
CDBErr CDBRecordGetKeyword(CDBRecord* record, char* keyword) {
|
||||
CDBErr err = CDB_ERROR_OK;
|
||||
CDBLock();
|
||||
if (record->file == NULL) {
|
||||
CDBReportError("can't get keyword from the record; the record is closed\n");
|
||||
err = CDB_ERROR_27;
|
||||
} else {
|
||||
CDBRecordKeyGetKeyStr(&record->key, keyword);
|
||||
}
|
||||
CDBUnlock();
|
||||
return err;
|
||||
}
|
||||
|
||||
CDBErr CDBRecordGetKey(CDBRecord* record, CDBRecordKey* key) {
|
||||
CDBErr err = CDB_ERROR_OK;
|
||||
CDBLock();
|
||||
if (record->file == NULL) {
|
||||
CDBReportError("can't get key from the record; the record is closed\n");
|
||||
err = CDB_ERROR_27;
|
||||
} else {
|
||||
CDBRecordKeyCopy(key, &record->key);
|
||||
}
|
||||
CDBUnlock();
|
||||
return err;
|
||||
}
|
||||
|
||||
CDBErr CDBRecordGetCalendarTime(CDBRecord* record, int* year, int* month, int* day, int* hour, int* min, int* sec) {
|
||||
CDBErr err = CDB_ERROR_OK;
|
||||
char epochString[64];
|
||||
CDBDate epoch;
|
||||
CDBLock();
|
||||
if (record->file == NULL) {
|
||||
CDBReportError("can't get calender time from the record; the record is closed\n");
|
||||
err = CDB_ERROR_27;
|
||||
} else {
|
||||
CDBConvKeyStrToEpochStr(record->key.keyString, epochString);
|
||||
CDBConvEpochStrToEpochValue(epochString, &epoch);
|
||||
CDBConvEpochValueToDate(epoch, year, month, day, hour, min, sec);
|
||||
}
|
||||
CDBUnlock();
|
||||
return err;
|
||||
}
|
||||
|
||||
void CDBRecordGetTypeForce(CDBRecord* record, char* type) {
|
||||
CDBLock();
|
||||
CDBConvKeyStrToType(record->key.keyString, type);
|
||||
@@ -622,6 +822,22 @@ CDBErr CDBRecordBackupToSD_(CDBRecord* record) {
|
||||
return CDB_ERROR_OK;
|
||||
}
|
||||
|
||||
CDBErr CDBRecordDuplicate(CDBRecord* record, CDBRecord* newRecord) {
|
||||
CDBErr err;
|
||||
CDBLock();
|
||||
if (record->key.location != CDB_FS_LOCATION_NAND) {
|
||||
OSPanic(__FILE__, 0x38B, "CDBRecordDuplicate invalud location\n");
|
||||
}
|
||||
err = CDBRecordAllocate(newRecord, CDB_RECORD_ALLOC_RW);
|
||||
if (err == CDB_ERROR_OK) {
|
||||
CDBRecordKeyCopy(&newRecord->key, &record->key);
|
||||
newRecord->unk_0x00 = record->unk_0x00;
|
||||
err = CDBRecordBackupToSD_(newRecord);
|
||||
}
|
||||
CDBUnlock();
|
||||
return err;
|
||||
}
|
||||
|
||||
CDBErr CDBCryptBuffer(void* buffer, u32 size, void* iv, u32* processedSize, BOOL encrypt) {
|
||||
NETAESContext context ATTRIBUTE_ALIGN(64);
|
||||
u32 offset;
|
||||
@@ -960,3 +1176,11 @@ CDBErr CDBRecordDecrypt(CDBRecord* record, void* buffer, u32 size, u32* dataSize
|
||||
}
|
||||
return CDB_ERROR_OK;
|
||||
}
|
||||
|
||||
void CDBRecordPrivateChangeOwner(CDBRecord* record, u64 preWiiId, u64 wiiId, char* path, char* path2) {
|
||||
CDBReportInfo("CDBRecordPrivateChangeOwner\n");
|
||||
CDBReportInfo(" i_pre-wiiid = %lX\n", preWiiId);
|
||||
CDBReportInfo(" record-wiiid = %lX\n", wiiId);
|
||||
CDBReportInfo("path =%s\n", path);
|
||||
CDBReportInfo("path2=%s\n", path2);
|
||||
}
|
||||
|
||||
1
report.json
Normal file
1
report.json
Normal file
File diff suppressed because one or more lines are too long
@@ -1179,8 +1179,14 @@ namespace ipl {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mState != STATE_NORMAL || mMode != 0) {
|
||||
return;
|
||||
switch (mState) {
|
||||
case STATE_NORMAL:
|
||||
if (mMode == 0) {
|
||||
break;
|
||||
}
|
||||
// fallthrough
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mpFriendCache->isThere(buttonNo + mPage * BTN_MAX)) {
|
||||
@@ -1425,10 +1431,7 @@ namespace ipl {
|
||||
|
||||
if (con->downTrg(controller::BTN_INTERACT)) {
|
||||
Button* button = static_cast<Button*>(System::getScene(SCENE_BUTTON));
|
||||
if (mState != STATE_COVER_NORMAL && mState != STATE_NORMAL) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (mState == STATE_COVER_NORMAL || mState == STATE_NORMAL) {
|
||||
if (Button::cmpButtonName(paneName, Button::BTN_EXIT) == 0) {
|
||||
MailAddressSelect* mailAddrSel = static_cast<MailAddressSelect*>(System::getScene(SCENE_MAIL_ADDRESS_SELECT));
|
||||
button->animation(Button::IDANIM_SELECT_CALENDAR_EXIT);
|
||||
@@ -1477,7 +1480,7 @@ namespace ipl {
|
||||
snd::getSystem()->startSE("WIPL_SE_FL_PAGE_DEC");
|
||||
onPreviousPage();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// fallthrough
|
||||
}
|
||||
@@ -1589,7 +1592,7 @@ namespace ipl {
|
||||
math::VEC2 offset;
|
||||
offset.y = sPageOffset.y * PAGE_MAX;
|
||||
offset.x = sPageOffset.x * PAGE_MAX;
|
||||
add_translate(mpLayout->FindPaneByName("N_note_base"), offset);
|
||||
add_translate(mpLayout->FindPaneByName("N_note_base"), math::VEC2(offset));
|
||||
mpLayout->getAnim(4)->setAnmType(0);
|
||||
mpLayout->getAnim(4)->play();
|
||||
set_page_text("T_nmbr_b", mPage + 1);
|
||||
@@ -1777,16 +1780,17 @@ namespace ipl {
|
||||
nw4r::math::VEC3 baseTrans = mpLayout->FindPaneByName("N_base_move")->GetTranslate();
|
||||
math::VEC2 pos = System::getControllerManager()->getController(mDrag.mChan)->getDpdProjectionPos();
|
||||
nw4r::lyt::TextBox* textBox = static_cast<nw4r::lyt::TextBox*>(mpLayout->FindPaneByName("T_name_move"));
|
||||
const u16* name = mpFriendCache->getInfo(mDrag.mButton + mDrag.mPage * BTN_MAX).attr.name;
|
||||
const NWC24FriendInfo& info = mpFriendCache->getInfo(mDrag.mButton + mDrag.mPage * BTN_MAX);
|
||||
|
||||
f32 width = 0.0f;
|
||||
if (textBox != NULL && name != NULL) {
|
||||
const u16* name;
|
||||
if (textBox != NULL && (name = info.attr.name) != NULL) {
|
||||
textBox->GetFont()->GetWidth();
|
||||
for (; *name != 0; name++) {
|
||||
width += textBox->GetFont()->GetCharWidth(*name);
|
||||
}
|
||||
width += 0.01f;
|
||||
}
|
||||
width += 0.01f;
|
||||
|
||||
nw4r::ut::Rect rect;
|
||||
nw4r::ut::Rect rect4x3;
|
||||
@@ -1940,11 +1944,10 @@ namespace ipl {
|
||||
}
|
||||
|
||||
void FriendListCache::update(u32 index, const wchar_t* name, u64 fdId) {
|
||||
NWC24FriendInfo* info = &mInfos[index];
|
||||
info->attr.fdId = fdId;
|
||||
memset(info->attr.name, 0, sizeof(info->attr.name));
|
||||
wcsncpy((wchar_t*)info->attr.name, name, 10);
|
||||
System::getNwc24Manager()->updateFriendInfo(info, index);
|
||||
mInfos[index].attr.fdId = fdId;
|
||||
memset(mInfos[index].attr.name, 0, sizeof(mInfos[index].attr.name));
|
||||
wcsncpy((wchar_t*)mInfos[index].attr.name, name, 10);
|
||||
System::getNwc24Manager()->updateFriendInfo(&mInfos[index], index);
|
||||
}
|
||||
|
||||
void FriendListCache::del(u32 index) {
|
||||
|
||||
@@ -521,7 +521,8 @@ void ipl::scene::AddressEdit::create() {
|
||||
set_textbox(textPane, friendText);
|
||||
textPane = (mpCodeLayout)
|
||||
->getNW4RLyt()->GetRootPane()->FindPaneByName("T_frnd_crd_00", true);
|
||||
set_textbox(textPane, mString.mDisplayText);
|
||||
friendText = mString.mDisplayText;
|
||||
set_textbox(textPane, friendText);
|
||||
mState = 0;
|
||||
break;
|
||||
}
|
||||
@@ -2118,6 +2119,8 @@ void ipl::scene::AddressEdit::start_point_event(
|
||||
|
||||
state0:
|
||||
switch (buttonNo) {
|
||||
case 4:
|
||||
goto done;
|
||||
case 0:
|
||||
goto state0Button0;
|
||||
case 1:
|
||||
@@ -2226,6 +2229,8 @@ void ipl::scene::AddressEdit::start_left_event(const char* paneName) {
|
||||
switch (mState) {
|
||||
case 0:
|
||||
switch (buttonNo) {
|
||||
case 4:
|
||||
break;
|
||||
case 0: {
|
||||
if (mpFriendCache->getInfo(mSelectedFriend).attr.status != 2) {
|
||||
break;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#define IPL_SDMEMORY_TITLE_CACHE_ACCESS
|
||||
|
||||
#define IPL_SDMEMORY_SCROLLER_INIT_OUT_OF_LINE
|
||||
#define IPL_SDMEMORY_SET_TRANSLATE_OUT_OF_LINE
|
||||
#define IPL_SDMEMORY_DIALOG_STATE_ACCESSOR
|
||||
@@ -8,6 +9,7 @@
|
||||
#define IPL_SDMEMORY_COMPLETION_PCT_ACCESSOR
|
||||
#define IPL_SDMEMORY_DIALOG_PROGRESS_FRAME_ACCESSOR
|
||||
#define IPL_SDMEMORY_SET_TEXT_COLORS
|
||||
#define IPL_SDMEMORY_TRIVIAL_COLOR_CTOR
|
||||
#define IPL_SDMEMORY_SCROLLER_STATE_ACCESSOR
|
||||
#include "system/iplDialogWindow.h"
|
||||
#undef IPL_SDMEMORY_DIALOG_PROGRESS_FRAME_ACCESSOR
|
||||
@@ -28,23 +30,6 @@
|
||||
#include "utility/iplLayout.h"
|
||||
#include <revolution/os/OSTime.h>
|
||||
|
||||
extern "C" bool iplSDChannelSelect_813DDB74(ipl::scene::SDChannelSelect* channelSelect,
|
||||
ipl::scene::SDMemory::TitleRange* nandTitles,
|
||||
ipl::scene::SDMemory::TitleRange* sdTitles,
|
||||
ESTitleId* titleIds, wchar_t* titleNames, u32* titleCount,
|
||||
s32 state);
|
||||
extern "C" bool iplSDChannelSelect_813DB5EC(ipl::scene::SDChannelSelect* channelSelect,
|
||||
ESTitleId titleId);
|
||||
extern "C" bool iplSDChannelSelect_813DB4D4(ipl::scene::SDChannelSelect* channelSelect,
|
||||
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,
|
||||
ESTitleId titleId);
|
||||
extern "C" bool iplSDChannelSelect_813DB58C(ipl::scene::SDChannelSelect* channelSelect,
|
||||
ESTitleId** titles, ESTitleId** secondaryTitles,
|
||||
ESTitleId** names);
|
||||
|
||||
namespace ipl {
|
||||
namespace scene {
|
||||
typedef ::gui::Component GuiComponent;
|
||||
@@ -723,8 +708,8 @@ namespace ipl {
|
||||
if (!mpMainLayout->isPlaying(-1)) {
|
||||
switch (mProcessState) {
|
||||
case 0:
|
||||
if (iplSDChannelSelect_813DDB74(mpSDChannelSelect, &mNandTitleRange, &mSDTitleRange,
|
||||
mTitleIds, &mTitleNames[0][0], &mTitleCount, 2)) {
|
||||
if (mpSDChannelSelect->collectTitlesForMode(&mNandTitleRange.mByteSize, &mSDTitleRange.mByteSize,
|
||||
mTitleIds, (char*)&mTitleNames[0][0], &mTitleCount, 2)) {
|
||||
mDialogState = 4;
|
||||
mpTitleLayout->getAnim(0)->initAnmFrame();
|
||||
mpTitleLayout->getAnim(0)->play();
|
||||
@@ -922,8 +907,8 @@ namespace ipl {
|
||||
return;
|
||||
}
|
||||
|
||||
if (iplSDChannelSelect_813DB530(mpSDChannelSelect, &mTitleListState.mpNames,
|
||||
&mTitleListState.mpSecondaryTitles)) {
|
||||
if (mpSDChannelSelect->enqueueErrorNotice((u32)&mTitleListState.mpNames,
|
||||
(u32)&mTitleListState.mpSecondaryTitles)) {
|
||||
mDialogState = 19;
|
||||
mCurrentTitleName[0] = L'\0';
|
||||
mCurrentTitle = 0;
|
||||
@@ -995,8 +980,8 @@ namespace ipl {
|
||||
|
||||
if (iplSDMemory_containsTitleId(this, mTitleIds[mCurrentTitle], mSDTitleIds, mTitleNameCount) ||
|
||||
iplSDMemory_containsTitleId(this, mTitleIds[mCurrentTitle], mNandTitleIds, mNandTitleCount)) {
|
||||
ESTitleId titleId = mTitleIds[mCurrentTitle];
|
||||
if (iplSDChannelSelect_813DB478(mpSDChannelSelect, titleId)) {
|
||||
ESTitleId* curTitleId = &mTitleIds[mCurrentTitle];
|
||||
if (mpSDChannelSelect->enqueueMoveNotice((u32)curTitleId - offsetof(SDMemory, mTitleIds), ((u32*)curTitleId)[0], ((u32*)curTitleId)[1])) {
|
||||
mDialogState = 14;
|
||||
} else {
|
||||
System::getDialog()->terminate();
|
||||
@@ -1046,7 +1031,7 @@ namespace ipl {
|
||||
|
||||
void SDMemory::onDialogState16() {
|
||||
if (mTitleCount > mCurrentTitle && System::isReceiveScheduleStopped()) {
|
||||
if (iplSDChannelSelect_813DB4D4(mpSDChannelSelect, mTitleIds[mCurrentTitle], 0)) {
|
||||
if (mpSDChannelSelect->enqueueStateNotice(mTitleIds[mCurrentTitle], 0)) {
|
||||
mDialogState = 16;
|
||||
} else {
|
||||
System::getDialog()->terminate();
|
||||
@@ -1101,7 +1086,9 @@ namespace ipl {
|
||||
System::getDialog()->setTitleForSDMemory(mCurrentTitleName);
|
||||
|
||||
const ESTitleId titleId = mTitleIds[mCurrentTitle];
|
||||
if (iplSDChannelSelect_813DB5EC(mpSDChannelSelect, titleId)) {
|
||||
if (mpSDChannelSelect->enqueueDeleteNotice((u32)&mTitleIds[mCurrentTitle] - offsetof(SDMemory, mTitleIds),
|
||||
((u32*)&mTitleIds[mCurrentTitle])[0],
|
||||
((u32*)&mTitleIds[mCurrentTitle])[1])) {
|
||||
mDialogState = 18;
|
||||
} else {
|
||||
System::getDialog()->terminate();
|
||||
@@ -1263,13 +1250,12 @@ namespace ipl {
|
||||
void SDMemory::drawTransferTitles() {
|
||||
const nw4r::math::VEC3& translation = mpDialogLayout->FindPaneByName("N_Memo")->GetTranslate();
|
||||
nw4r::math::VEC3 memoPosition;
|
||||
f32 bodyY = translation.y;
|
||||
memoPosition.x = translation.x;
|
||||
memoPosition.y = translation.y;
|
||||
memoPosition.y = bodyY;
|
||||
memoPosition.z = translation.z;
|
||||
mpDialogLayout->FindPaneByName("header_header");
|
||||
nw4r::lyt::Pane* bodyPane = mpDialogLayout->FindPaneByName("header_body");
|
||||
|
||||
f32 bodyY = memoPosition.y;
|
||||
if (bodyY < 500.0f) {
|
||||
mpDialogLayout->draw("header_header");
|
||||
}
|
||||
@@ -1288,9 +1274,12 @@ namespace ipl {
|
||||
if (mNandTitleCount != 0) {
|
||||
const wchar_t* messageForCount = System::getMessage(0xCB);
|
||||
const wchar_t* newline = wcsstr(messageForCount, L"\n");
|
||||
while (newline != NULL) {
|
||||
++lineCount;
|
||||
newline = wcsstr(newline + 1, L"\n");
|
||||
if (newline != NULL) {
|
||||
const wchar_t* separator = L"\n";
|
||||
while (newline != NULL) {
|
||||
++lineCount;
|
||||
newline = wcsstr(newline + 1, separator);
|
||||
}
|
||||
}
|
||||
|
||||
const wchar_t* messageLine = System::getMessage(0xCB);
|
||||
@@ -1298,13 +1287,14 @@ namespace ipl {
|
||||
mpDialogLayout->FindPaneByName("T_Header_body"));
|
||||
s32 totalLines = lineCount + 1;
|
||||
s32 lineIndex = 0;
|
||||
const wchar_t* lineSeparator = L"\n";
|
||||
if (lineIndex < totalLines) {
|
||||
do {
|
||||
const wchar_t* lineEnd = wcsstr(messageLine, L"\n");
|
||||
while (lineIndex < totalLines) {
|
||||
const wchar_t* lineEnd = wcsstr(messageLine, lineSeparator);
|
||||
if (lineEnd == NULL) {
|
||||
utility::layout::set_string(messageText, messageLine);
|
||||
} else {
|
||||
u32 lineLength = static_cast<u32>(lineEnd - messageLine);
|
||||
s32 lineLength = lineEnd - messageLine;
|
||||
wcsncpy(mCurrentTitleName, messageLine, lineLength);
|
||||
mCurrentTitleName[lineLength] = L'\0';
|
||||
utility::layout::set_string(messageText, mCurrentTitleName);
|
||||
@@ -1320,7 +1310,7 @@ namespace ipl {
|
||||
|
||||
messageOffset -= bodyHeight;
|
||||
++lineIndex;
|
||||
} while (lineIndex < totalLines);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1344,20 +1334,14 @@ namespace ipl {
|
||||
for (u32 titleIndex = 0; titleIndex < mTitleCount; ++titleIndex) {
|
||||
utility::layout::set_string(titleText, mTitleNames[titleIndex]);
|
||||
if (nandTitleIndex < mNandTitleCount && mTitleIds[titleIndex] == mNandTitleIds[nandTitleIndex]) {
|
||||
GXColor gxActive;
|
||||
writeFourFlagBytes(&gxActive.r, 0x34, 0xBE, 0xED, 0xFF);
|
||||
nw4r::ut::Color activeColor;
|
||||
writeFourFlagBytes(&activeColor.r, 0x34, 0xBE, 0xED, 0xFF);
|
||||
++nandTitleIndex;
|
||||
nw4r::ut::Color active0 = *reinterpret_cast<const nw4r::ut::Color*>(&gxActive);
|
||||
setTitleRowColors(titleText,
|
||||
nw4r::ut::Color(*reinterpret_cast<const nw4r::ut::Color*>(&gxActive)),
|
||||
nw4r::ut::Color(*reinterpret_cast<const nw4r::ut::Color*>(&gxActive)));
|
||||
setTitleRowColors(titleText, nw4r::ut::Color(activeColor), nw4r::ut::Color(activeColor));
|
||||
} else {
|
||||
GXColor gxInactive;
|
||||
writeFourFlagBytes(&gxInactive.r, 0x64, 0x64, 0x64, 0xFF);
|
||||
nw4r::ut::Color inactive0 = *reinterpret_cast<const nw4r::ut::Color*>(&gxInactive);
|
||||
setTitleRowColors(titleText,
|
||||
nw4r::ut::Color(*reinterpret_cast<const nw4r::ut::Color*>(&gxInactive)),
|
||||
nw4r::ut::Color(*reinterpret_cast<const nw4r::ut::Color*>(&gxInactive)));
|
||||
nw4r::ut::Color inactiveColor;
|
||||
writeFourFlagBytes(&inactiveColor.r, 0x64, 0x64, 0x64, 0xFF);
|
||||
setTitleRowColors(titleText, nw4r::ut::Color(inactiveColor), nw4r::ut::Color(inactiveColor));
|
||||
}
|
||||
|
||||
nw4r::ut::Rect textRect = mpDialogLayout->getTextDrawRect("T_Letter");
|
||||
@@ -1637,23 +1621,23 @@ namespace ipl {
|
||||
switch (paneIndex) {
|
||||
case 0:
|
||||
animator = mpTitleLayout->getAnim(7);
|
||||
iplSDChannelSelect_813DDB74(mpSDChannelSelect, &mNandTitleRange, &mSDTitleRange,
|
||||
mTitleIds, &mTitleNames[0][0], &mTitleCount, 0);
|
||||
mpSDChannelSelect->collectTitlesForMode(&mNandTitleRange.mByteSize, &mSDTitleRange.mByteSize,
|
||||
mTitleIds, (char*)&mTitleNames[0][0], &mTitleCount, 0);
|
||||
break;
|
||||
case 1:
|
||||
animator = mpTitleLayout->getAnim(10);
|
||||
iplSDChannelSelect_813DDB74(mpSDChannelSelect, &mNandTitleRange, &mSDTitleRange,
|
||||
mTitleIds, &mTitleNames[0][0], &mTitleCount, 1);
|
||||
mpSDChannelSelect->collectTitlesForMode(&mNandTitleRange.mByteSize, &mSDTitleRange.mByteSize,
|
||||
mTitleIds, (char*)&mTitleNames[0][0], &mTitleCount, 1);
|
||||
break;
|
||||
case 2:
|
||||
animator = mpTitleLayout->getAnim(13);
|
||||
iplSDChannelSelect_813DDB74(mpSDChannelSelect, &mNandTitleRange, &mSDTitleRange,
|
||||
mTitleIds, &mTitleNames[0][0], &mTitleCount, 2);
|
||||
mpSDChannelSelect->collectTitlesForMode(&mNandTitleRange.mByteSize, &mSDTitleRange.mByteSize,
|
||||
mTitleIds, (char*)&mTitleNames[0][0], &mTitleCount, 2);
|
||||
break;
|
||||
case 3:
|
||||
animator = mpTitleLayout->getAnim(16);
|
||||
iplSDChannelSelect_813DDB74(mpSDChannelSelect, &mNandTitleRange, &mSDTitleRange,
|
||||
mTitleIds, &mTitleNames[0][0], &mTitleCount, 3);
|
||||
mpSDChannelSelect->collectTitlesForMode(&mNandTitleRange.mByteSize, &mSDTitleRange.mByteSize,
|
||||
mTitleIds, (char*)&mTitleNames[0][0], &mTitleCount, 3);
|
||||
break;
|
||||
case 4:
|
||||
animator = mpTitleLayout->getAnim(4);
|
||||
@@ -1679,10 +1663,9 @@ namespace ipl {
|
||||
mTitleListState.mSecondaryCount = 0;
|
||||
mTitleListState.mpNames = mSDTitleIds;
|
||||
mTitleListState.mNameCount = 0;
|
||||
iplSDChannelSelect_813DB58C(mpSDChannelSelect,
|
||||
&mTitleListState.mpTitles,
|
||||
&mTitleListState.mpSecondaryTitles,
|
||||
&mTitleListState.mpNames);
|
||||
mpSDChannelSelect->enqueueCommandNotice((u32)&mTitleListState.mpTitles,
|
||||
(u32)&mTitleListState.mpSecondaryTitles,
|
||||
(u32)&mTitleListState.mpNames);
|
||||
}
|
||||
|
||||
if (paneIndex == 4) {
|
||||
|
||||
@@ -729,11 +729,10 @@ namespace ipl {
|
||||
return;
|
||||
}
|
||||
|
||||
if (OSGetTime() - mOperationStartTime < OS_TIMER_CLOCK) {
|
||||
return;
|
||||
}
|
||||
setDialogMessage(1, 0);
|
||||
int result = mpSDWorker->get_async_result();
|
||||
switch (OSGetTime() - mOperationStartTime < OS_TIMER_CLOCK) {
|
||||
default:
|
||||
setDialogMessage(1, 0);
|
||||
int result = mpSDWorker->get_async_result();
|
||||
if (result == NandSDWorker::RESULT_OK ||
|
||||
result == NandSDWorker::RESULT_SD_APP_LOC_NOT_FOUND) {
|
||||
for (int channelIndex = 0; channelIndex < mPageCount * 12;
|
||||
@@ -807,6 +806,10 @@ namespace ipl {
|
||||
mbSDCardBroken = true;
|
||||
}
|
||||
refreshAfterSDTitleList();
|
||||
break;
|
||||
case true:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void SDChannelSelect::handleSDMountComplete() {
|
||||
@@ -1695,7 +1698,7 @@ namespace ipl {
|
||||
if (mState == 2 && !mpLayout->isPlaying(0)) {
|
||||
SDButton* button = static_cast<SDButton*>(System::getSceneManager()->getScene(0x24));
|
||||
if (button != NULL) {
|
||||
button->setEventHandler(mpButtonEventHandler);
|
||||
button->setEventHandler((::gui::EventHandler*)button, mpButtonEventHandler);
|
||||
mState = 3;
|
||||
if (mCurrentPage > 0) {
|
||||
button->initArrowAppearance(1, true);
|
||||
@@ -2257,7 +2260,7 @@ namespace ipl {
|
||||
mbRightArrowVisible = false;
|
||||
}
|
||||
|
||||
button->setEventHandler(mpButtonEventHandler);
|
||||
button->setEventHandler((::gui::EventHandler*)button, mpButtonEventHandler);
|
||||
TVRCManager::getHandle()->setEnable(TRUE);
|
||||
snd::getSystem()->startBGM("WIPL_BGM_MENU");
|
||||
clearNoticeQueue();
|
||||
@@ -2639,7 +2642,7 @@ namespace ipl {
|
||||
button->animation(SDButton::IDANIM_ARROW_RIGHT_DISAPPEAR);
|
||||
}
|
||||
button->disableBtn();
|
||||
button->setEventHandler(NULL);
|
||||
button->setEventHandler((::gui::EventHandler*)button, NULL);
|
||||
mCurrentChannelIndex = index;
|
||||
mState = 5;
|
||||
snd::getSystem()->startSE("WIPL_SE_BT_PUSH");
|
||||
@@ -3464,53 +3467,49 @@ namespace ipl {
|
||||
}
|
||||
{
|
||||
if (mpScene->mState == 1) {
|
||||
if (System::getFader()->getStatus() == EGG::Fader::PREPARE_OUT) {
|
||||
if (con != NULL) {
|
||||
if (con->downTrg(0x00100800)) {
|
||||
SDButton* button = static_cast<SDButton*>(
|
||||
System::getSceneManager()->getScene(0x24));
|
||||
if (strcmp(paneName,
|
||||
SDButton::smButtonName[SDButton::BTN_HELP]) == 0) {
|
||||
mpScene->mOperationResult = 0;
|
||||
mpScene->mState = 26;
|
||||
button->animation(4);
|
||||
snd::getSystem()->startSE("WIPL_SE_DECIDE");
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(paneName,
|
||||
SDButton::smButtonName[SDButton::BTN_WII_MENU]) == 0) {
|
||||
button->setEventHandler(NULL);
|
||||
mpScene->mState = 4;
|
||||
snd::getSystem()->startSE("WIPL_SE_DECIDE");
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(paneName,
|
||||
SDButton::smButtonName[SDButton::BTN_ARROW_LEFT]) == 0 &&
|
||||
mpScene->mCurrentPage > 0) {
|
||||
button->animation(7);
|
||||
mpScene->setStateAndPlaySelectSound(8);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(paneName,
|
||||
SDButton::smButtonName[SDButton::BTN_ARROW_RIGHT]) == 0 &&
|
||||
mpScene->mCurrentPage < mpScene->mPageCount - 1) {
|
||||
button->animation(8);
|
||||
mpScene->setStateAndPlaySelectSound(9);
|
||||
}
|
||||
} else {
|
||||
if (System::getFader()->getStatus() == EGG::Fader::PREPARE_OUT) {
|
||||
if (con != NULL) {
|
||||
if (con->downTrg(0x00100800)) {
|
||||
SDButton* button = static_cast<SDButton*>(
|
||||
System::getSceneManager()->getScene(0x24));
|
||||
if (strcmp(paneName,
|
||||
SDButton::smButtonName[SDButton::BTN_HELP]) == 0) {
|
||||
mpScene->mOperationResult = 0;
|
||||
mpScene->mState = 26;
|
||||
button->animation(4);
|
||||
snd::getSystem()->startSE("WIPL_SE_DECIDE");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
|
||||
if (strcmp(paneName,
|
||||
SDButton::smButtonName[SDButton::BTN_WII_MENU]) == 0) {
|
||||
button->setEventHandler((::gui::EventHandler*)button, NULL);
|
||||
mpScene->mState = 4;
|
||||
snd::getSystem()->startSE("WIPL_SE_DECIDE");
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(paneName,
|
||||
SDButton::smButtonName[SDButton::BTN_ARROW_LEFT]) == 0 &&
|
||||
mpScene->mCurrentPage > 0) {
|
||||
button->animation(7);
|
||||
mpScene->setStateAndPlaySelectSound(8);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(paneName,
|
||||
SDButton::smButtonName[SDButton::BTN_ARROW_RIGHT]) == 0 &&
|
||||
mpScene->mCurrentPage < mpScene->mPageCount - 1) {
|
||||
button->animation(8);
|
||||
mpScene->setStateAndPlaySelectSound(9);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SDChannelSelect::startResetting() {
|
||||
snd::getSystem()->resetAllSound();
|
||||
clearCommandQueue();
|
||||
|
||||
@@ -282,7 +282,7 @@ FaderSceneCommand SDChannelTitle::calcFadein() {
|
||||
if (!mpFade->isPlaying()) {
|
||||
iplSDChannelTitle_playBannerIntro(this);
|
||||
SDButton* button = static_cast<SDButton*>(System::getScene(0x24));
|
||||
button->setEventHandler(mpButtonEventHandler);
|
||||
button->setEventHandler((::gui::EventHandler*)button, mpButtonEventHandler);
|
||||
button->animation(13);
|
||||
button->animation(14);
|
||||
mState = 1;
|
||||
@@ -344,7 +344,7 @@ void SDChannelTitle::initCalcFadeout() {
|
||||
button->animation(15);
|
||||
button->animation(16);
|
||||
}
|
||||
button->setEventHandler(NULL);
|
||||
button->setEventHandler((::gui::EventHandler*)button, NULL);
|
||||
}
|
||||
|
||||
FaderSceneCommand SDChannelTitle::calcFadeout() {
|
||||
@@ -736,7 +736,8 @@ extern "C" void iplSDChannelTitle_startCopyProgress(SDChannelTitle* scene) {
|
||||
if (channel->mStateFlags == 3) {
|
||||
scene->mState = 26;
|
||||
scene->mErrorMessage = 0xaf;
|
||||
} else if (scene->mpChannelSelect->enqueueChannelNotice(scene->mTitleId, reinterpret_cast<u32>(&scene->mTitleRange))) {
|
||||
} else if (scene->mpChannelSelect->enqueueChannelNotice(0, static_cast<u32>(scene->mTitleId >> 32),
|
||||
static_cast<u32>(scene->mTitleId), reinterpret_cast<u32>(&scene->mTitleRange))) {
|
||||
scene->mState = 20;
|
||||
} else {
|
||||
scene->mState = 26;
|
||||
@@ -825,7 +826,8 @@ extern "C" void iplSDChannelTitle_updateCopyStart(SDChannelTitle* scene) {
|
||||
ESTitleId temporaryTitle = SCGetTmpTitleID();
|
||||
if (temporaryTitle && scene->mTitleId != temporaryTitle) {
|
||||
if (System::isReceiveScheduleStopped()) {
|
||||
if (scene->mpChannelSelect->enqueueStateNotice(temporaryTitle, 1)) {
|
||||
if (scene->mpChannelSelect->enqueueStateNotice(0, static_cast<u32>(temporaryTitle >> 32),
|
||||
static_cast<u32>(temporaryTitle), 1)) {
|
||||
scene->mState = 16;
|
||||
} else {
|
||||
scene->mState = 26;
|
||||
@@ -1354,8 +1356,7 @@ extern "C" void iplSDChannelTitle_flushSaveBeforeExit(SDChannelTitle* scene, int
|
||||
System::getSaveData()->pushTitleCache(scene->mTitleId);
|
||||
}
|
||||
System::getSaveData()->getSDPrevPage() = scene->mPage;
|
||||
EGG::Heap* saveHeap = System::getMem2App();
|
||||
scene->mpSaveFile = System::getSaveData()->flushAsync(saveHeap);
|
||||
scene->mpSaveFile = System::getSaveData()->flushAsync(System::getMem2App());
|
||||
__WPADReconnect(TRUE);
|
||||
}
|
||||
|
||||
|
||||
6
tools/decomp-assist/iplAddress.attempts.md
Normal file
6
tools/decomp-assist/iplAddress.attempts.md
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
## beq+b inside onEventDerived (solved — switch-dispatch + case-fallthrough structure)
|
||||
- Orig's ON_TRIG case: `if (con == NULL) break;` (real break → switch join), `if (con->downTrg(...)) { if (mState == STATE_COVER_NORMAL || mState == STATE_NORMAL) {buttons} }` — arms and failed guards FALL THROUGH to ON_POINT code (0x31c) — no break after the if-chain; the positive `||` mState-guard emits `beq body` + `bne ON_POINT`.
|
||||
- start_drag_event: `switch (mState) { case STATE_NORMAL: if (mMode == 0) break; /*fall*/ default: return; }` reproduces `beq fwd / b ret` per clause — the `b` is default's arm edge placed between dispatch test and case body. Sequential `if`s, `||`, goto, if/else all fold to single `bne`.
|
||||
- Residual: pure reg-web coloring (orig this→r29/con→r30/paneName→r31 vs mine r27/r28/r30) — liveness-priority coloring, no source lever (keep-vs-remat wall family).
|
||||
- movePane_onDrag: `width += 0.01f` was INSIDE the `if (textBox && name)` block in orig (b 0x164 skips it). `&&` clause polarity `bne fwd / b end` still folded in mine (block-layout tie).
|
||||
8
tools/decomp-assist/iplAddressEdit.attempts.md
Normal file
8
tools/decomp-assist/iplAddressEdit.attempts.md
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
## get_friendinfo keep-vs-remat (88%)
|
||||
Orig caches mString.mName (this+0x2b4) and mString.mDisplayText (this+0x2cc)
|
||||
pointers in r29 across the FindPaneByName+set_textbox calls (extra addi + mr
|
||||
reuse, +2 insns); mine rematerializes the member addresses inline at the call.
|
||||
Orig this=r28, ptr webs=r29 (reused sequentially for both ptrs). Mine this=r29,
|
||||
no ptr webs - the callee-reg web rotation differs by one position. Same
|
||||
documented keep-vs-remat + web-ordering wall family as create/CDBRecordEncrypt.
|
||||
@@ -7,3 +7,29 @@
|
||||
- **setEventHandler r5 mystery (documented):** orig calls `setEventHandler__Q33ipl5scene8SDButtonFPQ23gui12EventHandlerPQ23gui12EventHandler` (2-param) at 4 sites in iplSDChannelSelect + 2 in iplSDChannelTitle with r5 NEVER materialized (no li/lwz/mr r5 in the 4-insn window before bl; callee is non-static so this=r3, event=r4, optOutEvent=r5 garbage). MWCC always emits `li r5,0` for the =NULL default (verified: both `(h, NULL)` and `(h)` call forms emit it in mine). iplAddress.o Button callers DO emit `li r5,0` for the analogous Button decl. No C++ source model reproduces a 2-param bl with unset r5 (1-arg call to a defaulted 2-param decl emits the default; a 1-param decl would mangle differently). Left as `(h, NULL)` explicit; ~4 insn residual across create/selectChannel/initializeNormalPage/calcCommon/onEventDerived.
|
||||
- kpr_lib: orig's `once$2281` is an 8-byte fn-local accessed via lbz/stb → decoded as `static union { u64 align; u8 flag; }` inside KPRInitQueue — gives size-8 `once$` + .sbss 0x10 and .sbss scored 100%. Orig's .sbss ordering [DeadKeys@0,Romaji@4,once@8] vs mine [once@0,Romaji@4,DeadKeys@8] is MWCC reverse-decl-order emission; objdiff .sbss scores 100 anyway. kpr_lib now 8/9 fns, all data 100.
|
||||
- iplSDMemory: removed dead `#pragma inline_max_total_size` (no effect). drawTransferTitles: orig re-materializes f32 consts from sdata (`lfs f0,const@sda21`) where mine spills/reloads stack copies — frame-lever not found. create: 1064 vs 1060, mostly lbl_/@N symbol-name + r30/r31 data-base home.
|
||||
|
||||
## beq+b two-way dispatch — SOLVED (onEventDerived)
|
||||
|
||||
Orig emits `beq fwd / b end` pairs where single-branch guards were expected.
|
||||
Produced by a real `switch (event) { case 0: BODY; break; default: break; }`
|
||||
dispatch — MWCC keeps the 2-arm dispatch layout instead of folding to `bne`.
|
||||
`if`/`else` and `goto` forms all fold back to a single `bne`; only `switch`
|
||||
reproduces it. Applied at the `event == 0` check in the anon
|
||||
SDChannelSelectButtonEventHandler::onEventDerived → 144/144 insn-identical.
|
||||
The same pair inside a u64 `<` compare (handleSDTitleListResult `neg.` hi-test)
|
||||
has no applicable source form — that one stays a wall.
|
||||
|
||||
## switch-on-bool dispatch (handleSDTitleListResult)
|
||||
Orig emits `beq fwd-body / b ret` where a plain `if (u64 < K) return;` folds to single `bne ret`.
|
||||
Decode: `switch (x < K) { default: BODY; break; case true: return; }` — `default` arm FIRST
|
||||
(source order) with the bool-compare as discriminant → MWCC emits the two-arm dispatch
|
||||
(171/171 insn-equal). `case false:` regresses (jump-table range dispatch), if/else folds.
|
||||
Residual: orig uses `neg.` flags directly (`beq`); mine emits `neg` + `cmpwi 1` + `beq` —
|
||||
same insn count, operand-level diff only.
|
||||
|
||||
## Dead-arm fossil (iplAddressEdit, earlier)
|
||||
An unreachable empty `case N:` arm in a switch materializes a dead `b end` between
|
||||
dispatch and bodies: `case 4: break;` in start_left_event → EXACT 96/96;
|
||||
`case 4: goto done;` in start_point_event → 182/182. Only works in range-mapped
|
||||
dispatch (table/dense compare); every listed case in a compare-chain gets its own
|
||||
cmpwi level — the trick cannot produce extra `b` edges there (set_err_msg stays +1).
|
||||
|
||||
94
tools/decomp-assist/iplSDMemory.attempts.md
Normal file
94
tools/decomp-assist/iplSDMemory.attempts.md
Normal file
@@ -0,0 +1,94 @@
|
||||
|
||||
## drawTransferTitles — setTitleRowColors decode (session cont.)
|
||||
- Helper signature: `setTitleRowColors(TextBox*, const ut::Color&, const ut::Color&)` — mangle `RCQ34nw4r2ut5Color` proven via orig .text symbol.
|
||||
- Orig callsite: `Color c; writeFourFlagBytes(&c.r,...); Color a=c; Color b=c; setTitleRowColors(tb,a,b)` — 3 memberwise byte-copies (lbz/stb x4) from the same source.
|
||||
- DECODE: orig's `ut::Color()` ctor was TRIVIAL in this TU — orig emits no WHITE-init `stw` anywhere in drawTransferTitles and no `__ct__Color` weak def. Gated via `IPL_SDMEMORY_TRIVIAL_COLOR_CTOR` -> `Color() {}`. Produces exact 451-insn instruction stream (structure identical; residual = stack slot numbering + sched + regalloc).
|
||||
- WALL: weak-emission asymmetry — orig UND-references `__as__Color`/`__dt__PaneManager`/`__ct__PaneManager`/`__dt__Interface`/`__dt__scroller`/`__dt__Scroller`/`__dt__BScroller` (emitted weak in OTHER TUs); ours emits them as weak defs here -> extra .text bytes. Same family as iplGCWindow's weak-dtor backup wall.
|
||||
- Result: drawTransferTitles 96.99 fuzzy, create 99.13 (1064/1064 reg-home tie). Unit stays NonMatching.
|
||||
|
||||
## Weak-emission asymmetry — decl-only gating (session cont. 2)
|
||||
- Mechanism: orig's TU sees many gui/nw4r members DECL-ONLY while ours inlines/emits weak defs. Orig .o UND-references: EventHandler{onEvent,setManager,setLatestEventCtrlNo,getLatestEventCtrlNo}, scene::scroller{calc,is_busy,~scroller}, Pane::SetVisible, Pane::SetTranslate, ipl::gui::PaneManager{ctor,~}, Color::operator=(const Color&), iplSDChannelTitle_copyTitleRange.
|
||||
- Orig emits the 3 handler vtables as unnamed .data objects (4 slots each: onEvent + 3 UND EventHandler slots).
|
||||
- Gates applied: IPL_SDMEMORY_PANEMANAGER_DECL_ONLY (iplGuiManager.h ctor+~PaneManager), IPL_SDMEMORY_DECL_ONLY_GUI (GUIManager.h EventHandler 4 virtuals + Pane::SetVisible), IPL_SDMEMORY_DECL_ONLY_SCROLLER (iplFocusObject.h ~scroller+calc+is_busy), IPL_SDMEMORY_TRIVIAL_COLOR_CTOR (Color() trivial + operator=(const Color&) decl + ~Color undec'd, ~Rect undec'd).
|
||||
- DECODE: setTitleLists calls free fn iplSDChannelTitle_copyTitleRange(&dst,&src) x2 — NOT operator= (53/53 insn-equal now).
|
||||
- Result: extra weak defs 28 -> 4 (__dt__Scroller, __dt__Rect, getPane__PaneComponent, offPoint__Component — all unreferenced emission fossils; the getPane/offPoint CALLSITES are identical virtual dispatches vs orig). .text 21012 vs orig 20920 (+92B fossils).
|
||||
- create regalloc rotation noise (r30 vs r31 home) after layout shift — count-equal family.
|
||||
|
||||
## Decl-only gating cont. — weak-emission fully resolved (session cont. 3)
|
||||
- All 28 extra weak defs eliminated: additional gates = offPoint/getPane decl-only (GUIManager.h under IPL_SDMEMORY_DECL_ONLY_GUI — the virtual CALLSITES are byte-identical bctrl dispatches vs orig; only the weak DEF emission differed) + scroller ctor teardown (decl-only ~scroller/calc/is_busy kills __dt__Scroller fossil) + ~Rect undec kills __dt__Rect fossil + setTitleLists now calls iplSDChannelTitle_copyTitleRange (kills __as__TitleRange).
|
||||
- .text now 20836 vs orig 20920 (-84B). .data relocs byte-identical incl. the 3 handler vtables at same offsets with UND slot targets = orig.
|
||||
- REGRESSION to document: .data shrank 3144 -> 2996 (-148B). Orig's .data has a 148B ALL-ZERO tail after the last vtable (no relocs) — provenance unknown (link slack from split? a zero .data object our reconstruction lacks?). Pre-gate .data was coincidentally filled by the weak-vtable emission region (zero bytes + relocs). matched_data dropped 100 -> 5.98 as a side effect of removing the wrong vtables; .data fuzzy = 97.59.
|
||||
- create fuzzy 98.07 (reg-homing rotation after layout shift), drawTransferTitles 96.99.
|
||||
|
||||
---
|
||||
|
||||
## Weak-emission asymmetry — decl-only gating (session cont. 2)
|
||||
- Mechanism: orig's TU sees many gui/nw4r members DECL-ONLY while ours inlines/emits weak defs. Orig .o UND-references: EventHandler{onEvent,setManager,setLatestEventCtrlNo,getLatestEventCtrlNo}, scene::scroller{calc,is_busy,~scroller}, Pane::SetVisible, Pane::SetTranslate, ipl::gui::PaneManager{ctor,~}, Color::operator=(const Color&), iplSDChannelTitle_copyTitleRange.
|
||||
- Orig emits the 3 handler vtables as unnamed .data objects (4 slots each: onEvent + 3 UND EventHandler slots).
|
||||
- Gates applied: IPL_SDMEMORY_PANEMANAGER_DECL_ONLY (iplGuiManager.h ctor+~PaneManager), IPL_SDMEMORY_DECL_ONLY_GUI (GUIManager.h EventHandler 4 virtuals + Pane::SetVisible), IPL_SDMEMORY_DECL_ONLY_SCROLLER (iplFocusObject.h ~scroller+calc+is_busy), IPL_SDMEMORY_TRIVIAL_COLOR_CTOR (Color() trivial + operator=(const Color&) decl + ~Color undec'd, ~Rect undec'd).
|
||||
- DECODE: setTitleLists calls free fn iplSDChannelTitle_copyTitleRange(&dst,&src) x2 — NOT operator= (53/53 insn-equal now).
|
||||
- Result: extra weak defs 28 -> 4 (__dt__Scroller, __dt__Rect, getPane__PaneComponent, offPoint__Component — all unreferenced emission fossils; the getPane/offPoint CALLSITES are identical virtual dispatches vs orig). .text 21012 vs orig 20920 (+92B fossils).
|
||||
- create regalloc rotation noise (r30 vs r31 home) after layout shift — count-equal family.
|
||||
|
||||
## Decl-only gating cont. — weak-emission fully resolved (session cont. 3)
|
||||
- All 28 extra weak defs eliminated: additional gates = offPoint/getPane decl-only (GUIManager.h under IPL_SDMEMORY_DECL_ONLY_GUI — the virtual CALLSITES are byte-identical bctrl dispatches vs orig; only the weak DEF emission differed) + scroller ctor teardown (decl-only ~scroller/calc/is_busy kills __dt__Scroller fossil) + ~Rect undec kills __dt__Rect fossil + setTitleLists now calls iplSDChannelTitle_copyTitleRange (kills __as__TitleRange).
|
||||
- .text now 20836 vs orig 20920 (-84B). .data relocs byte-identical incl. the 3 handler vtables at same offsets with UND slot targets = orig.
|
||||
- REGRESSION to document: .data shrank 3144 -> 2996 (-148B). Orig's .data has a 148B ALL-ZERO tail after the last vtable (no relocs) — provenance unknown (link slack from split? a zero .data object our reconstruction lacks?). Pre-gate .data was coincidentally filled by the weak-vtable emission region (zero bytes + relocs). matched_data dropped 100 -> 5.98 as a side effect of removing the wrong vtables; .data fuzzy = 97.59.
|
||||
- create fuzzy 98.07 (reg-homing rotation after layout shift), drawTransferTitles 96.99.
|
||||
|
||||
## Trailing .data zeros (148B) — unrecreateable
|
||||
|
||||
Orig `.data` ends at 0xc48; ours at 0xbb4 — ours is a strict byte-identical prefix.
|
||||
The missing 148B is an all-zero object dtk merged into `lbl_8165683C` (0xac = the
|
||||
0x18 ControlPaneEventHandler vtable + 148B trailing zeros), emitted AFTER the
|
||||
three event-handler vtables, unreferenced, no relocs.
|
||||
|
||||
Micro-test results (mwcceppc 3.0a5.2): EVERY all-zero decl goes to .bss —
|
||||
`static u32 a[37] = {0}`, `= {}`, `static char b[148] = ""`, POD struct zero-init,
|
||||
`__declspec(section ".data")`, `#pragma section ".data"` — all .bss.
|
||||
So the zeros cannot be a standalone source-level object. Two remaining theories:
|
||||
(1) pure-pad vtable slots (MCM precedent) — contradicted by `new
|
||||
ControlPaneEventHandler` compiling in the same TU (abstract can't instantiate);
|
||||
(2) same wall as MyTiLetterForm's "six trailing target zeros were not recreated
|
||||
with padding" — an accepted tail artifact.
|
||||
|
||||
## Trailing .data zeros SOLVED — deduplicated weak vtables
|
||||
|
||||
The 148B all-zero tail = three weak vtables emitted in this TU then deduplicated
|
||||
at link (dtk extraction shows zeros+no relocs, consistent with the MyTiInputForm
|
||||
and iplSetting findings in data-d3/data-d4):
|
||||
|
||||
__vt__ipl::gui::PaneManager 0x5c (bb4..c10)
|
||||
__vt__gui::EventHandler 0x18 (c10..c28)
|
||||
__vt__gui::Interface 0x20 (c28..c48)
|
||||
|
||||
Earlier decl-only gates (IPL_SDMEMORY_DECL_ONLY_GUI /
|
||||
IPL_SDMEMORY_PANEMANAGER_DECL_ONLY / IPL_SDMEMORY_DECL_ONLY_SCROLLER) suppressed
|
||||
the weak emission; removing them emits the vtables in the same tail order and
|
||||
.data becomes byte-identical (3144B, data 100%). Lesson: an orig data region of
|
||||
zeros with no relocs after vtables = deduplicated weak vtable, NOT an all-zero
|
||||
object — .bss-promotion analysis was the wrong frame.
|
||||
|
||||
## drawTransferTitles: copy-temp decode (451/451 insn-equal)
|
||||
|
||||
Orig's callsite copies the built Color into THREE disjoint stack slots per call
|
||||
(4 lbz + 12 stb) — decoded as `Color(x)` copy-ctor temporaries:
|
||||
`setTitleRowColors(titleText, Color(c), Color(c))` reproduces all three
|
||||
materializations (MWCC emits a third dead temp in the arg area). The callee
|
||||
still calls out-of-line `__as__Color` for its member copies — consistent with
|
||||
decl-only `operator=(const Color&)` + inlined implicit copy-ctor in this TU.
|
||||
Direct pass (`setTitleRowColors(t, c, c)`) removes 32 insns; named copies emit
|
||||
`bl __as__` instead of memberwise bytes — neither matches. Remaining residual:
|
||||
frame +0x20 slot layout + reg-web coloring (insn-equal tie).
|
||||
|
||||
## enqueue*/collect member-call conversion (post-rebase cleanup)
|
||||
Removed the six `extern "C" bool iplSDChannelSelect_813Dxxxx` address-suffixed
|
||||
stubs (banned identifier style). All 10 call sites now call real private member
|
||||
fns via `mpSDChannelSelect->` with `friend class SDMemory` added to
|
||||
iplSDChannelSelect.h (orig must have granted SDMemory access to the private
|
||||
enqueue* members). Arg semantics decoded from callee impls: enqueue*Notice
|
||||
page/index params are the u64 titleId halves (caller passes ((u32*)&entry)[0/1]
|
||||
for the two-u32-arg callees; the raw u64 for enqueueStateNotice(u64,u32) which
|
||||
emits pad-r4 + u64 in r5:r6 exactly as orig). The arg1 = this+i*8 pointer for
|
||||
the 3-u32 callees is reproduced via `(u32)&mTitleIds[i] - offsetof(SDMemory,
|
||||
mTitleIds)`. All call sites byte-identical after conversion.
|
||||
Reference in New Issue
Block a user