Compare commits

...

1 Commits

Author SHA1 Message Date
coah
7cf7f1735f iplSDChannelSelect 98/129, iplSetting 102/112 (worker 1cf3ee73) 2026-09-30 13:40:11 +00:00
7 changed files with 1272 additions and 175 deletions

View File

@@ -53,9 +53,9 @@ Progress
<!-- progress:start -->
| Decompiled | Matched | Linked | Data |
|:---:|:---:|:---:|:---:|
| 97.14% | 83.51% | 58.20% | 89.94% |
| 97.17% | 83.64% | 58.20% | 89.94% |
units 778/1027 complete, functions 12020/12563 matched.
units 778/1027 complete, functions 12026/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
<!-- progress:end -->

View File

@@ -163,6 +163,28 @@ namespace ipl {
unkVal1 = param_6;
}
#ifdef IPL_SD_CHANNEL_SELECT_CPP
T get() const {
f32 frame = mFrame;
f32 inverseDuration = 1.0f / mMaxFrame;
T result =
(mStart * (1.0f + (inverseDuration * (inverseDuration *
(inverseDuration * (frame * (2.0f * frame * frame)))) -
inverseDuration * (inverseDuration * (3.0f * frame * frame))))) -
(mEnd * (inverseDuration * (inverseDuration *
(inverseDuration * (frame * (2.0f * frame * frame)))) -
inverseDuration * (inverseDuration * (3.0f * frame * frame))));
f32 frameSquared = frame * frame;
f32 cubic = inverseDuration * (inverseDuration * (frame * frameSquared));
f32 tangent = unkVal0 * (frame + (cubic -
inverseDuration * (2.0f * frame * frame))) +
unkVal1 * (cubic - inverseDuration * frameSquared);
result.x += tangent;
result.y += tangent;
result.z += tangent;
return result;
}
#else
T get() const {
f32 var_f27 = mFrame;
f32 var_f28 = 1.0f / mMaxFrame;
@@ -195,6 +217,7 @@ namespace ipl {
r = r + temp_f3;
return r;*/
}
#endif
protected:
f32 unkVal0;

View File

@@ -134,7 +134,15 @@ namespace ipl {
VEC3& operator/=(f32 val) { return operator*=(1.f / val); }
VEC3 operator+(const VEC3& rhs) const { return VEC3(x + rhs.x, y + rhs.y, z + rhs.z); }
VEC3 operator+(f32 v) const { return VEC3(x + v, y + v, z + v); }
#ifdef IPL_SD_CHANNEL_SELECT_CPP
nw4r::math::VEC3 operator-(const VEC3& rhs) const {
nw4r::math::VEC3 difference;
nw4r::math::VEC3Sub(&difference, this, &rhs);
return difference;
}
#else
VEC3 operator-(const VEC3& rhs) const { return VEC3(x - rhs.x, y - rhs.y, z - rhs.z); }
#endif
VEC3 operator*(f32 val) const { return VEC3(x * val, y * val, z * val); }
VEC3 operator*(f64 val) const {
nw4r::math::VEC3 vecOut;

View File

@@ -41,8 +41,13 @@ namespace ipl {
struct SettingAPScanList {
u8 unknown[0x14];
u16 count;
u8 entries[0x7fe];
union {
struct {
u16 count;
u8 entries[0x7fe];
};
u8 recordBuffer[0x800];
};
union {
WDBssDesc_* currentDescriptor;
u16* currentDescriptorWords;

View File

@@ -454,7 +454,6 @@ namespace ipl {
case 3:
case 4:
mbInitialLoadComplete = false;
break;
case 2:
clearCommandQueue();
clearNoticeQueue();
@@ -476,7 +475,14 @@ namespace ipl {
goto process_worker;
}
}
if (mCurrentSDState < 5 && mCurrentSDState >= 1 && mDialogState == 0) {
switch (mCurrentSDState) {
case 1:
case 2:
case 3:
case 4: {
if (mDialogState != 0) {
return;
}
mSourcePage = -1;
mSourceIndex = -1;
mbShowNoCardMessage = true;
@@ -511,6 +517,10 @@ namespace ipl {
default:
break;
}
break;
}
default:
break;
}
process_worker:
@@ -518,7 +528,7 @@ namespace ipl {
return;
}
if (mCommandQueue.count > 0) {
if (mCommandQueue.count != 0) {
SDChannelSelectCommand command =
mCommandQueue.commands[mCommandQueue.readIndex];
@@ -533,11 +543,25 @@ namespace ipl {
mpSDWorker->list_sd_app_async(mpSDTitleIds);
mWorkerCommand = 2;
break;
case 8:
mpSDWorker->update_sd_app_location_async(mpChannelTitleIds);
mWorkerCommand = 4;
break;
case 9:
mpSDWorker->read_sd_app_location_async(mpChannelTitleIds);
mWorkerCommand = 5;
break;
case 5:
mpSDWorker->copy_sd_app_to_nand_async(
static_cast<ESTitleId32>(command.titleId), true);
mWorkerCommand = 7;
break;
case 10:
mpSDWorker->check_for_sd_app_to_nand_async(
static_cast<ESTitleId>(command.titleId),
command.arguments.appBlocks[0], command.arguments.appBlocks[1]);
mWorkerCommand = 8;
break;
case 6:
mpSDWorker->copy_nand_app_to_sd_async(
static_cast<ESTitleId>(command.titleId));
@@ -546,39 +570,27 @@ namespace ipl {
case 7: {
mpSDWorker->delete_nand_app_async(
static_cast<ESTitleId>(command.titleId),
command.arguments.values[2] != 0);
command.arguments.values[0] != 0);
mWorkerCommand = 10;
u32 titleCount = mNandTitleCount;
u32 index = 0;
if (mNandTitleCount > 0) {
do {
if (mpNandTitleInfo[index].curTitleId == command.titleId) {
break;
}
++index;
} while (index < mNandTitleCount);
for (; index < titleCount; ++index) {
if (mpNandTitleInfo[index].curTitleId == command.titleId) {
break;
}
}
if (index < mNandTitleCount) {
for (; index + 1 < mNandTitleCount; ++index) {
mpNandTitleInfo[index] = mpNandTitleInfo[index + 1];
for (; index < mNandTitleCount - 1; ++index) {
NandSDWorker::TitleUsage& currentTitle = mpNandTitleInfo[index];
NandSDWorker::TitleUsage& nextTitle = mpNandTitleInfo[index + 1];
currentTitle.curTitleId = nextTitle.curTitleId;
currentTitle.size = nextTitle.size;
currentTitle.inode = nextTitle.inode;
}
--mNandTitleCount;
}
break;
}
case 8:
mpSDWorker->update_sd_app_location_async(mpChannelTitleIds);
mWorkerCommand = 4;
break;
case 9:
mpSDWorker->read_sd_app_location_async(mpChannelTitleIds);
mWorkerCommand = 5;
break;
case 10:
mpSDWorker->check_for_sd_app_to_nand_async(
static_cast<ESTitleId>(command.titleId),
command.arguments.appBlocks[0], command.arguments.appBlocks[1]);
mWorkerCommand = 8;
break;
case 11:
mpSDWorker->check_backup_fits_async(
command.arguments.titleLists[0], command.arguments.titleLists[1]);
@@ -601,22 +613,21 @@ namespace ipl {
mLastOperation = command.type;
mCommandQueue.pop();
} else if (mNoticeQueue.count > 0) {
} else if (mNoticeQueue.count != 0) {
SDChannelSelectCommand notice =
mNoticeQueue.notices[mNoticeQueue.readIndex];
SDChannelObj* channel = findChannelObject(
notice.arguments.values[1], notice.arguments.values[2]);
if (channel != NULL && channel->mStateFlags >= 1 &&
channel->mStateFlags <= 2) {
notice.arguments.values[0], notice.arguments.values[1]);
if (channel != NULL && static_cast<u32>(channel->mStateFlags) - 1 <= 1) {
EGG::FrmHeap* objectHeap = EGG::FrmHeap::create(
0x212b8, mpLayoutHeap, 2);
SDChannelObj* loadedChannel =
new (mpThumbnailHeap, 4) SDChannelObj(
objectHeap, notice.arguments.values[1],
notice.arguments.values[2]);
objectHeap, notice.arguments.values[0],
notice.arguments.values[1]);
mpCurrentLoadedChannel = loadedChannel;
mpSDWorker->get_sd_app_meta_async(
notice.arguments.values[0],
static_cast<ESTitleId32>(notice.titleId),
static_cast<u8*>(iplSDChannelObj_813E3128(loadedChannel)),
&loadedChannel->mAppMeta);
mWorkerCommand = 3;
@@ -846,39 +857,40 @@ namespace ipl {
}
mLastOperation = 14;
SDChannelObj* channel = mpCurrentLoadedChannel;
int page = channel->mPage;
int index = channel->mIndex;
int page = mpCurrentLoadedChannel->mPage;
int index = mpCurrentLoadedChannel->mIndex;
if (!isChannelInCalc(page, index, mCurrentPage) ||
static_cast<u32>(mCurrentSDState) - 1 <= 1) {
destroyChannelObject(channel);
destroyChannelObject(mpCurrentLoadedChannel);
mWorkerCommand = 1;
mpCurrentLoadedChannel = NULL;
return;
}
if (mpSDWorker->get_async_result() >= 0) {
channel->mStateFlags = 0;
channel->mState = 2;
DCFlushRange(iplSDChannelObj_813E3128(channel), 0x19000);
SDChannelObj* completed = mpCurrentLoadedChannel;
completed->mStateFlags = 0;
completed->mState = 2;
DCFlushRange(iplSDChannelObj_813E3128(mpCurrentLoadedChannel), 0x19000);
} else {
memcpy(iplSDChannelObj_813E3128(channel),
memcpy(iplSDChannelObj_813E3128(mpCurrentLoadedChannel),
mpCorruptIconFile->getBuffer(), mpCorruptIconFile->getLength());
memset(&channel->mAppMeta, 0, sizeof(channel->mAppMeta));
channel->mStateFlags = 3;
channel->mState = 2;
memset(&mpCurrentLoadedChannel->mAppMeta, 0, sizeof(mpCurrentLoadedChannel->mAppMeta));
SDChannelObj* completed = mpCurrentLoadedChannel;
completed->mStateFlags = 3;
completed->mState = 2;
}
SDChannelObj* previous = findChannelObject(page, index);
if (previous != NULL) {
nw4r::ut::List_Insert(&mChannelObjects, previous, channel);
nw4r::ut::List_Insert(&mChannelObjects, previous, mpCurrentLoadedChannel);
nw4r::ut::List_Remove(&mChannelObjects, previous);
destroyChannelObject(previous);
} else {
nw4r::ut::List_Append(&mChannelObjects, channel);
nw4r::ut::List_Append(&mChannelObjects, mpCurrentLoadedChannel);
}
updateChannelObject(channel);
updateChannelObject(mpCurrentLoadedChannel);
if (mCurrentPage == page) {
mpPaneManager->initPane(getChannelPane(index));
}
@@ -1145,113 +1157,121 @@ namespace ipl {
break;
}
switch (mDialogState) {
case 0:
if (mOperationState != 10) {
if (mOperationState < 10 && mOperationState == 7) {
mOperationState = 8;
}
} else {
mOperationState = 14;
}
break;
case 2:
if (mDialogState == 0) {
switch (mOperationState) {
case 0:
case 1:
case 7:
case 13:
mOperationState = 2;
mAnimationState = mAnimationTarget;
break;
case 2:
if (mAnimationState != mAnimationTarget) {
mAnimationState = mAnimationTarget;
}
mDialogState = 0;
break;
case 4:
if (mAnimationState == mAnimationTarget) {
mDialogState = 0;
} else {
mOperationState = 5;
}
break;
case 10:
case 14:
case 15:
mOperationState = 11;
break;
}
break;
case 1:
switch (mOperationState) {
case 0:
case 1:
case 2:
case 7:
case 8:
case 13:
mOperationState = 1;
mDialogState = 0;
mAnimationState = mAnimationTarget;
break;
case 4:
mOperationState = 5;
break;
case 10:
case 14:
case 15:
mOperationState = 11;
break;
}
break;
case 8:
switch (mOperationState) {
case 0:
case 1:
case 7:
case 13:
mOperationState = 8;
mAnimationState = mAnimationTarget;
break;
case 4:
mOperationState = 5;
break;
case 8:
if (mAnimationState != mAnimationTarget) {
mAnimationState = mAnimationTarget;
}
mDialogState = 0;
break;
case 10:
case 14:
case 15:
if (mAnimationState == mAnimationTarget) {
mDialogState = 0;
} else {
mOperationState = 11;
}
mOperationState = 14;
break;
}
} else {
switch (mDialogState) {
case 2:
switch (mOperationState) {
case 0:
case 1:
case 7:
case 13:
mOperationState = 2;
mAnimationState = mAnimationTarget;
break;
case 2:
if (mAnimationState != mAnimationTarget) {
mAnimationState = mAnimationTarget;
}
mDialogState = 0;
break;
case 4:
if (mAnimationState == mAnimationTarget) {
mDialogState = 0;
} else {
mOperationState = 5;
}
break;
case 10:
case 14:
case 15:
mOperationState = 11;
break;
}
break;
case 8:
switch (mOperationState) {
case 0:
case 1:
case 7:
case 13:
mOperationState = 8;
mAnimationState = mAnimationTarget;
break;
case 8:
if (mAnimationState != mAnimationTarget) {
mAnimationState = mAnimationTarget;
}
mDialogState = 0;
break;
case 10:
case 14:
case 15:
if (mAnimationState == mAnimationTarget) {
mDialogState = 0;
} else {
mOperationState = 11;
}
break;
case 4:
mOperationState = 5;
break;
}
break;
case 1:
switch (mOperationState) {
case 0:
case 1:
case 2:
case 7:
case 8:
case 13:
mOperationState = 1;
mDialogState = 0;
mAnimationState = mAnimationTarget;
break;
case 4:
mOperationState = 5;
break;
case 10:
case 14:
case 15:
mOperationState = 11;
break;
}
break;
default:
break;
}
break;
default:
break;
}
layout::Animator* animator = NULL;
switch (mOperationState) {
case 2:
static_cast<nw4r::lyt::TextBox*>(mpNoCardLayout->FindPaneByName("T_TimerMes"))
->SetString(System::getMessage(mAnimationState), 0);
{
nw4r::lyt::TextBox* messagePane = static_cast<nw4r::lyt::TextBox*>(
mpNoCardLayout->FindPaneByName("T_TimerMes"));
messagePane->SetString(System::getMessage(mAnimationState), 0);
}
animator = mpNoCardLayout->getAnim(0);
break;
case 5:
animator = mpNoCardLayout->getAnim(1);
break;
case 8:
static_cast<nw4r::lyt::TextBox*>(mpNoCardLayout->FindPaneByName("T_TimerMes_01"))
->SetString(System::getMessage(mAnimationState), 0);
{
nw4r::lyt::TextBox* messagePane = static_cast<nw4r::lyt::TextBox*>(
mpNoCardLayout->FindPaneByName("T_TimerMes_01"));
messagePane->SetString(System::getMessage(mAnimationState), 0);
}
animator = mpNoCardLayout->getAnim(2);
break;
case 11:
@@ -3024,8 +3044,8 @@ namespace ipl {
return;
}
int sourceSlot = mSourcePage * MAX_CHANNEL_INDEX + mSourceIndex;
int destinationSlot = mDestinationPage * MAX_CHANNEL_INDEX + mDestinationIndex;
int sourceSlot = mSourcePage * MAX_CHANNEL_INDEX + mSourceIndex;
u32 sourceTitleId = mpChannelTitleIds[sourceSlot];
u32 destinationTitleId = mpChannelTitleIds[destinationSlot];
mpChannelTitleIds[sourceSlot] = destinationTitleId;
@@ -3039,6 +3059,7 @@ namespace ipl {
transitionAnimator = mpPageLayouts[2]->getAnim(1);
transitionAnimator->play();
mState = 21;
return;
}
mpCurrentChannel = findChannelObject(mSourcePage, mSourceIndex);
@@ -3055,10 +3076,16 @@ namespace ipl {
iplSDChannelObj_813E3178(
destination, getChannelBasePane(mSourcePage, mSourceIndex, mCurrentPage));
static_cast<SDChannelObj*>(mpCurrentChannel)->mPage = mDestinationPage;
static_cast<SDChannelObj*>(mpCurrentChannel)->mIndex = mDestinationIndex;
destination->mPage = mSourcePage;
destination->mIndex = mSourceIndex;
SDChannelObj* current;
int destinationIndex = mDestinationIndex;
current = static_cast<SDChannelObj*>(mpCurrentChannel);
int destinationPage = mDestinationPage;
current->mPage = destinationPage;
current->mIndex = destinationIndex;
int sourceIndex = mSourceIndex;
int sourcePage = mSourcePage;
destination->mPage = sourcePage;
destination->mIndex = sourceIndex;
iplSDChannelObj_813E322C(static_cast<SDChannelObj*>(mpCurrentChannel));
iplSDChannelObj_813E322C(destination);

View File

@@ -124,7 +124,7 @@ namespace ipl {
wchar_t wrappedLine[17];
};
static const SettingAnimationBinding sSettingAnimationBindings[] = {
static const SettingAnimationBinding scAnmTable[] = {
{0, 2}, {0, 3}, {1, 2}, {1, 3}, {2, 2}, {2, 3}, {3, 2}, {3, 3}, {4, 2}, {4, 3},
{5, 0}, {6, 0}, {7, 8}, {7, 9}, {7, 10}, {7, 11}, {8, 8}, {8, 9}, {8, 10}, {8, 11},
{9, 1}, {10, 1}, {11, 14}, {11, 15}, {11, 16}, {11, 17}, {11, 18}, {11, 19}, {12, 14}, {12, 15},
@@ -347,7 +347,7 @@ namespace ipl {
mpMainLayout = new layout::Object(getSceneHeap(), mpSettingLayoutFile, "arc", "my_AP_a.brlyt");
for (int index = 0; index < 58; index++) {
bool initialAnimation = index == 20 || index == 10;
const SettingAnimationBinding& binding = sSettingAnimationBindings[index];
const SettingAnimationBinding& binding = scAnmTable[index];
const char* animation = sSettingAPAnimations[binding.animation];
const char* pane = sSettingAPPaneNames[binding.pane];
mpMainLayout->bindToGroup(animation, pane, false, initialAnimation);
@@ -2727,17 +2727,17 @@ namespace ipl {
layout::Animator* animation = mpMainLayout->getAnim(2);
animation->initFrame();
animation->restart();
mpMainLayout->FindPaneByName(sSettingAPPaneNames[0])->SetVisible(false);
mpMainLayout->FindPaneByName(sSettingArrowNames[0])->SetVisible(false);
for (int point = 0; point < 8; ++point) {
mpPaneManager->getPaneComponentByPane(
mpMainLayout->FindPaneByName(sSettingAPPaneNames[0]))->setPointed(point, false);
mpMainLayout->FindPaneByName(sSettingArrowNames[0]))->setPointed(point, false);
}
}
if (mAPScanList.count == unk_0x914 + 5) {
layout::Animator* animation = mpMainLayout->getAnim(1);
animation->initFrame();
animation->restart();
mpMainLayout->FindPaneByName(sSettingAPPaneNames[1])->SetVisible(true);
mpMainLayout->FindPaneByName(sSettingArrowNames[1])->SetVisible(true);
}
} else {
++unk_0x914;
@@ -2745,23 +2745,25 @@ namespace ipl {
layout::Animator* animation = mpMainLayout->getAnim(3);
animation->initFrame();
animation->restart();
mpMainLayout->FindPaneByName(sSettingAPPaneNames[1])->SetVisible(false);
mpMainLayout->FindPaneByName(sSettingArrowNames[1])->SetVisible(false);
for (int point = 0; point < 8; ++point) {
mpPaneManager->getPaneComponentByPane(
mpMainLayout->FindPaneByName(sSettingAPPaneNames[1]))->setPointed(point, false);
mpMainLayout->FindPaneByName(sSettingArrowNames[1]))->setPointed(point, false);
}
}
if (unk_0x914 == 1) {
layout::Animator* animation = mpMainLayout->getAnim(0);
animation->initFrame();
animation->restart();
mpMainLayout->FindPaneByName(sSettingAPPaneNames[0])->SetVisible(true);
mpMainLayout->FindPaneByName(sSettingArrowNames[0])->SetVisible(true);
}
}
mpMainLayout->getAnim(10)->stop();
mpMainLayout->getAnim(11)->stop();
unk_0x918 = unk_0x91C[0] + 10;
layout::Animator* animation = mpMainLayout->getAnim(unk_0x918);
int scrollDirection = unk_0x91C[0];
layout::Object* scrollLayout = mpMainLayout;
unk_0x918 = scrollDirection + 10;
layout::Animator* animation = scrollLayout->getAnim(unk_0x918);
animation->initFrame();
animation->restart();
}
@@ -2776,44 +2778,45 @@ namespace ipl {
};
int recordOffset = 2;
for (int index = 0; index <= mAPScanList.count; ++index) {
WDBssDesc_* descriptor = mAPScanList.currentDescriptor;
int recordLength = descriptor->length * 2;
recordOffset += recordLength;
recordOffset += mAPScanList.currentDescriptor->length * 2;
if (recordOffset > 0x800) {
return;
}
mpMainLayout->getAnim(10)->stop();
mpMainLayout->getAnim(11)->stop();
u8 privacyMode = static_cast<u8>(WDGetPrivacyMode(descriptor));
u8 privacyMode = static_cast<u8>(WDGetPrivacyMode(mAPScanList.currentDescriptor));
char ssid[0x21];
wchar_t displayName[0x21];
memcpy(ssid, descriptor->ssid, 0x20);
memcpy(ssid, mAPScanList.currentDescriptor->ssid, 0x20);
ssid[0x20] = 0;
memset(displayName, 0, sizeof(displayName));
int row = index + 1 - unk_0x914;
if (row >= 0 && row <= 5) {
utility::CharacterCode::UTF8ToUTF16(displayName, ssid, 0x21);
nw4r::lyt::TextBox* textBox = static_cast<nw4r::lyt::TextBox*>(
nw4r::lyt::TextBox* textBox = nw4r::ut::DynamicCast<nw4r::lyt::TextBox*>(
mpMainLayout->FindPaneByName(sSettingAPTextNames[row]));
utility::CharacterCode::UTF8ToUTF16(displayName, ssid, 0x21);
textBox->SetString(displayName);
if (privacyMode == 0) {
mpMainLayout->getAnim(row + APPrivacyOpenAnimation)->initFrame();
mpMainLayout->getAnim(row + APPrivacyOpenAnimation)->restart();
layout::Animator* selectedAnimation = mpMainLayout->getAnim(row + APPrivacyOpenAnimation);
selectedAnimation->initFrame();
selectedAnimation->restart();
mpMainLayout->getAnim(row + APPrivacyProtectedAnimation)->stop();
} else {
mpMainLayout->getAnim(row + APPrivacyProtectedAnimation)->initFrame();
mpMainLayout->getAnim(row + APPrivacyProtectedAnimation)->restart();
layout::Animator* selectedAnimation = mpMainLayout->getAnim(row + APPrivacyProtectedAnimation);
selectedAnimation->initFrame();
selectedAnimation->restart();
mpMainLayout->getAnim(row + APPrivacyOpenAnimation)->stop();
}
for (int animation = row + APSignalAnimationBase;
animation <= row + APSignalAnimationEnd; animation += 6) {
mpMainLayout->getAnim(animation)->stop();
}
int signal = getRadioLevel(descriptor);
mpMainLayout->getAnim(row + signal * 6 + APSignalAnimationBase)->initFrame();
mpMainLayout->getAnim(row + signal * 6 + APSignalAnimationBase)->restart();
mpMainLayout->getAnim(row + APSignalAnimationBase + 0)->stop();
mpMainLayout->getAnim(row + APSignalAnimationBase + 6)->stop();
mpMainLayout->getAnim(row + APSignalAnimationBase + 12)->stop();
mpMainLayout->getAnim(row + APSignalAnimationBase + 18)->stop();
u8 signal = getRadioLevel(mAPScanList.currentDescriptor);
layout::Animator* selectedAnimation = mpMainLayout->getAnim(row + signal * 6 + APSignalAnimationBase);
selectedAnimation->initFrame();
selectedAnimation->restart();
}
mAPScanList.currentDescriptorWords += recordLength / sizeof(u16);
mAPScanList.currentDescriptor = reinterpret_cast<WDBssDesc_*>(&mAPScanList.recordBuffer[recordOffset]);
}
}

File diff suppressed because it is too large Load Diff