Compare commits

...

1 Commits

Author SHA1 Message Date
coah
296a24e8c0 iplSDChannelSelect 102/129, iplSDMemory 63/66 (worker 68e4d339) 2026-09-30 15:01:09 +00:00
7 changed files with 1604 additions and 167 deletions

View File

@@ -53,9 +53,9 @@ Progress
<!-- progress:start -->
| Decompiled | Matched | Linked | Data |
|:---:|:---:|:---:|:---:|
| 97.63% | 83.85% | 58.20% | 90.15% |
| 97.67% | 83.95% | 58.20% | 90.15% |
units 778/1027 complete, functions 12039/12563 matched.
units 778/1027 complete, functions 12044/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

@@ -312,6 +312,33 @@ namespace ipl {
void setLayoutFrame(int state);
BOOL tellStartingZoomAnm();
void initPageAnimations(const math::VEC3& position, int direction);
#ifdef IPL_SD_CHANNEL_SELECT_CPP
void removeNandTitleInfo(ESTitleId titleId) {
u32 titleCount = mNandTitleCount;
u32 index = 0;
for (; index < titleCount; ++index) {
if (mpNandTitleInfo[index].curTitleId == titleId) {
break;
}
}
if (index < mNandTitleCount) {
for (; index < mNandTitleCount - 1; ++index) {
NandSDWorker::TitleUsage& nextTitle = mpNandTitleInfo[index + 1];
NandSDWorker::TitleUsage& currentTitle = mpNandTitleInfo[index];
currentTitle.curTitleId = nextTitle.curTitleId;
currentTitle.size = nextTitle.size;
currentTitle.inode = nextTitle.inode;
}
--mNandTitleCount;
}
}
nw4r::math::VEC3 getPageTransitionPosition(int index) const {
nw4r::math::VEC3 position(0.0f, 0.0f, 0.0f);
nw4r::lyt::Pane* pane = getCenterChannelPane(index);
PSMTXMultVec(pane->GetGlobalMtx(), position, position);
return position;
}
#endif
static BOOL isChannelReady(const SDChannelObj* channel);
nw4r::ut::List mChannelObjects;
nand::LayoutFile* mpLayoutFile;

View File

@@ -29,6 +29,9 @@ namespace ipl {
class Setting;
class APScanThread;
#ifdef IPL_SETTING_IMPLEMENTATION
class APEvent;
#else
class APEvent : public ::gui::EventHandler {
public:
APEvent(Setting* setting) : ::gui::EventHandler(), mpSetting(setting) {}
@@ -38,6 +41,7 @@ namespace ipl {
private:
Setting* mpSetting;
};
#endif
struct SettingAPScanList {
u8 unknown[0x14];
@@ -261,6 +265,17 @@ namespace ipl {
#endif
};
#ifdef IPL_SETTING_IMPLEMENTATION
class APEvent : public ::gui::EventHandler {
public:
APEvent(Setting* setting) : ::gui::EventHandler(), mpSetting(setting) {}
virtual void onEvent(u32 componentID, u32 event, void* data);
private:
Setting* mpSetting;
};
#endif
} // namespace scene
} // namespace ipl

View File

@@ -46,16 +46,6 @@ extern "C" bool iplSDChannelSelect_813DB58C(ipl::scene::SDChannelSelect* channel
ESTitleId** names);
namespace ipl {
namespace utility {
void Scroller::init() {
mState = 0;
mScroll = 0.0f;
unk_0x3C = 0.0f;
mUpLimit = 0.0f;
mDownLimit = 0.0f;
}
}
namespace scene {
typedef ::gui::Component GuiComponent;
typedef ::gui::PaneComponent GuiPaneComponent;
@@ -284,38 +274,19 @@ namespace ipl {
mScroller.setDownLimit(downLimit);
}
void SDMemory::updateSideArrows() {
controller::Interface* masterController = System::getMasterController();
}
if (mScroller.getBInst().isActive() ? false : true) {
if (masterController->down(controller::BTN_UP)) {
showLeftArrow();
}
if (!masterController->down(controller::BTN_UP)) {
hideLeftArrow();
}
if (masterController->down(controller::BTN_DOWN)) {
showRightArrow();
}
if (!masterController->down(controller::BTN_DOWN)) {
hideRightArrow();
}
} else {
if (mScroller.getBInst().isUp()) {
showLeftArrow();
}
if (!mScroller.getBInst().isUp()) {
hideLeftArrow();
}
if (mScroller.getBInst().isDown()) {
showRightArrow();
}
if (!mScroller.getBInst().isDown()) {
hideRightArrow();
}
}
namespace utility {
void Scroller::init() {
mState = 0;
mScroll = 0.0f;
unk_0x3C = 0.0f;
mUpLimit = 0.0f;
mDownLimit = 0.0f;
}
}
namespace scene {
void SDMemory::resetScrollArrows() {
mControllerFlags[0] = 0;
mControllerFlags[1] = 0;
@@ -387,6 +358,38 @@ namespace ipl {
}
}
void SDMemory::updateSideArrows() {
controller::Interface* masterController = System::getMasterController();
if (mScroller.getBInst().isActive() ? false : true) {
if (masterController->down(controller::BTN_UP)) {
showLeftArrow();
}
if (!masterController->down(controller::BTN_UP)) {
hideLeftArrow();
}
if (masterController->down(controller::BTN_DOWN)) {
showRightArrow();
}
if (!masterController->down(controller::BTN_DOWN)) {
hideRightArrow();
}
} else {
if (mScroller.getBInst().isUp()) {
showLeftArrow();
}
if (!mScroller.getBInst().isUp()) {
hideLeftArrow();
}
if (mScroller.getBInst().isDown()) {
showRightArrow();
}
if (!mScroller.getBInst().isDown()) {
hideRightArrow();
}
}
}
void SDMemory::showLeftArrow() {
if (mControllerFlags[2] == 0) {
layout::Animator* animation = mpDialogLayout->getAnim(19);
@@ -779,7 +782,6 @@ namespace ipl {
}
void SDMemory::onDialogState8() {
if (System::getDialog()->getStateForSDMemory() == 2) {
if (mTransferStartTime == 0) {
@@ -806,20 +808,19 @@ namespace ipl {
animation->initFrame();
animation->restart();
nw4r::lyt::Pane* headerPane = mpDialogLayout->FindPaneByName("T_Header");
static_cast<nw4r::lyt::TextBox*>(headerPane)->SetString(System::getMessage(0xBE), 0);
nw4r::lyt::TextBox* titleText = static_cast<nw4r::lyt::TextBox*>(mpDialogLayout->FindPaneByName("T_Header"));
titleText->SetString(System::getMessage(0xBE), 0);
mButtonState = 0;
nw4r::lyt::Pane* titlePane = mpDialogLayout->FindPaneByName("N_Body");
nw4r::lyt::Pane* bodyPane = mpDialogLayout->FindPaneByName("T_Letter");
bodyPane->SetAlpha(0xFF);
titleText = static_cast<nw4r::lyt::TextBox*>(mpDialogLayout->FindPaneByName("T_Letter"));
titleText->SetAlpha(0xFF);
for (u32 i = 0; i < mTitleCount; i++) {
utility::layout::set_string(bodyPane, mTitleNames[i]);
utility::layout::set_string(titleText, mTitleNames[i]);
nw4r::ut::Rect textRect = mpDialogLayout->getTextDrawRect("T_Letter");
f32 lineCount = -(textRect.bottom - textRect.top) / titlePane->GetSize().height;
f32 roundedLineCount = ceil(lineCount);
mButtonState += static_cast<s32>(roundedLineCount);
mButtonState += static_cast<s32>(static_cast<f32>(ceil(lineCount)));
}
setScrollLimit();

View File

@@ -572,23 +572,7 @@ namespace ipl {
static_cast<ESTitleId>(command.titleId),
command.arguments.values[0] != 0);
mWorkerCommand = 10;
u32 titleCount = mNandTitleCount;
u32 index = 0;
for (; index < titleCount; ++index) {
if (mpNandTitleInfo[index].curTitleId == command.titleId) {
break;
}
}
if (index < mNandTitleCount) {
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;
}
removeNandTitleInfo(command.titleId);
break;
}
case 11:
@@ -2678,10 +2662,7 @@ namespace ipl {
mpLayout->setAnmType(ANIM_TYPE_BACKWARD, -1);
mpLayout->start(-1);
nw4r::math::VEC3 position(0.0f, 0.0f, 0.0f);
nw4r::lyt::Pane* pane = getCenterChannelPane(index);
PSMTXMultVec(pane->GetGlobalMtx(), position, position);
math::VEC3 animationPosition(position);
math::VEC3 animationPosition(getPageTransitionPosition(index));
initPageAnimations(animationPosition, 1);
updatePageTransform();
mState = 14;
@@ -3200,27 +3181,32 @@ namespace ipl {
int index = getCenterChannelIndex(paneName);
if (index >= 0) {
s32 eventType = event;
if (eventType != 2) {
if (eventType >= 2) {
if (eventType == 5 && !controller->pinch()) {
mDestinationIndex = index;
mDestinationPage = mCurrentPage;
mbButtonEnabled = true;
}
} else if (eventType >= 1) {
if (isChannelMoveTarget(mCurrentPage, index) ||
(mCurrentPage == mSourcePage && index == mSourceIndex)) {
SDChannelObj* channel = findChannelObject(mCurrentPage, index);
iplSDChannelObj_813E3354(channel, 2);
snd::getSystem()->startSE("WIPL_SE_CH_TARGETTING");
controller->rumble(1);
}
switch (static_cast<s32>(event)) {
case 5:
if (!controller->pinch()) {
mDestinationIndex = index;
mDestinationPage = mCurrentPage;
mbButtonEnabled = true;
}
} else if (isChannelMoveTarget(mCurrentPage, index) ||
(mCurrentPage == mSourcePage && index == mSourceIndex)) {
SDChannelObj* channel = findChannelObject(mCurrentPage, index);
iplSDChannelObj_813E33EC(channel, 2);
break;
case 1:
if (isChannelMoveTarget(mCurrentPage, index) ||
(mCurrentPage == mSourcePage && index == mSourceIndex)) {
SDChannelObj* channel = findChannelObject(mCurrentPage, index);
iplSDChannelObj_813E3354(channel, 2);
snd::getSystem()->startSE("WIPL_SE_CH_TARGETTING");
controller->rumble(1);
}
break;
case 2:
if (isChannelMoveTarget(mCurrentPage, index) ||
(mCurrentPage == mSourcePage && index == mSourceIndex)) {
SDChannelObj* channel = findChannelObject(mCurrentPage, index);
iplSDChannelObj_813E33EC(channel, 2);
}
break;
default:
break;
}
}
@@ -3236,10 +3222,9 @@ namespace ipl {
switch (event) {
case ::gui::EventHandler::ON_LEFT:
if (strcmp(paneName, SDButton::smButtonName[SDButton::BTN_ARROW_LEFT]) == 0) {
if (mCurrentPage > 0) {
mPendingIndex = -1;
}
if (strcmp(paneName, SDButton::smButtonName[SDButton::BTN_ARROW_LEFT]) == 0 &&
mCurrentPage > 0) {
mPendingIndex = -1;
} else if (strcmp(paneName, SDButton::smButtonName[SDButton::BTN_ARROW_RIGHT]) == 0) {
if (mCurrentPage < mPageCount - 1) {
mPendingPage = -1;
@@ -3247,8 +3232,9 @@ namespace ipl {
}
break;
case ::gui::EventHandler::ON_POINT:
if (strcmp(paneName, SDButton::smButtonName[SDButton::BTN_ARROW_LEFT]) == 0) {
if (mCurrentPage > 0 && mPendingIndex < 0) {
if (strcmp(paneName, SDButton::smButtonName[SDButton::BTN_ARROW_LEFT]) == 0 &&
mCurrentPage > 0) {
if (mPendingIndex < 0) {
mPendingIndex = 0;
}
} else if (strcmp(paneName, SDButton::smButtonName[SDButton::BTN_ARROW_RIGHT]) == 0) {

View File

@@ -49,19 +49,6 @@ namespace ipl {
};
}
namespace ipl {
namespace keyboard {
Manager::State& Manager::State::operator=(const Manager::State& other) {
type = other.type;
iplType = other.iplType;
pressOK = other.pressOK;
reservedByte = other.reservedByte;
wcString = other.wcString;
return *this;
}
}
}
namespace ipl {
namespace scene {
class USBAPThread {
@@ -571,6 +558,24 @@ namespace ipl {
return FADER_SCN_CONTINUE;
}
}
}
namespace ipl {
namespace keyboard {
Manager::State& Manager::State::operator=(const Manager::State& other) {
type = other.type;
iplType = other.iplType;
pressOK = other.pressOK;
reservedByte = other.reservedByte;
wcString = other.wcString;
return *this;
}
}
}
namespace ipl {
namespace scene {
void Setting::updateController_() {
nw4r::ut::Rect projection;
System::getProjectionRect4x3(&projection);
@@ -1362,16 +1367,22 @@ namespace ipl {
}
ext_ead::www::BrowserThread* browser = surface->GetBrowserThread();
if (browser == NULL || browser->GetTextureBuffer(0, NULL) == NULL) {
if (browser == NULL) {
return;
}
if (browser->GetTextureBuffer(0, NULL) == NULL) {
return;
}
ext_ead::www::BrowserWindow* browserWindow =
static_cast<ext_ead::www::BrowserWindow*>(browser->mpBrowserWindows[0]);
if (browserWindow != NULL && browserWindow->unk_0x2C4[3] != 0) {
if ((browserWindow != NULL ? browserWindow->unk_0x2C4[3] : 0) != 0) {
unk_0x91C[2] = 1;
mState = 0;
browserWindow->unk_0x2C4[3] = 0;
browserWindow = static_cast<ext_ead::www::BrowserWindow*>(browser->mpBrowserWindows[0]);
if (browserWindow != NULL) {
browserWindow->unk_0x2C4[3] = 0;
}
www::trasition::ScrollState scrollState = www::trasition::GetScrollState();
browserScrollDirection = scrollState == www::trasition::SCROLL_LEFT
? 1
@@ -1383,80 +1394,116 @@ namespace ipl {
ext_ead::www::Heap::reportLeaHeap();
}
bool showBrowserWindow =
mpSecondAnimation->isPlaying() || mpFirstAnimation->isPlaying();
mpChangeLayout->FindPaneByName("N_Tra0")->SetVisible(showBrowserWindow);
if (!mpSecondAnimation->isPlaying() && !mpFirstAnimation->isPlaying()) {
mpChangeLayout->FindPaneByName("N_Tra0")->SetVisible(false);
} else {
mpChangeLayout->FindPaneByName("N_Tra0")->SetVisible(true);
}
WWWRect* wideRect = NULL;
WWWRect* standardRect = NULL;
void* wideBuffer = browser->GetTextureBuffer(1, &wideRect);
void* standardBuffer = browser->GetTextureBuffer(0, &standardRect);
if (wideBuffer == NULL || standardBuffer == NULL) {
return;
}
nw4r::ut::Rect projection4x3;
nw4r::ut::Rect projection16x9;
System::getProjectionRect4x3(&projection4x3);
System::getProjectionRect16x9(&projection16x9);
GXTexObj standardTexture;
GXTexObj wideTexture;
GXInitTexObj(&standardTexture, standardBuffer, standardRect->w, standardRect->h, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
GXInitTexObj(&wideTexture, wideBuffer, wideRect->w, wideRect->h, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
GXInitTexObjLOD(&standardTexture, GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, GX_FALSE, GX_FALSE, GX_ANISO_1);
GXInitTexObjLOD(&wideTexture, GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, GX_FALSE, GX_FALSE, GX_ANISO_1);
if (browserScrollDirection != 0) {
nw4r::lyt::Material* standardMaterial =
mpChangeLayout->FindPaneByName("N_Tra0")->FindMaterialByName("Tex0");
nw4r::lyt::Material* firstWideMaterial =
mpChangeLayout->FindPaneByName("N_Tra0")->FindMaterialByName("Tex1");
nw4r::lyt::Material* secondWideMaterial =
mpChangeLayout->FindPaneByName("N_Tra0")->FindMaterialByName("Tex2");
standardMaterial->SetTexture(0, standardTexture);
firstWideMaterial->SetTexture(0, wideTexture);
secondWideMaterial->SetTexture(0, wideTexture);
mpChangeLayout->FindPaneByName("N_Tra0")->SetVisible(true);
if (browserScrollDirection == 1) {
mpSecondAnimation->initFrame();
mpSecondAnimation->restart();
} else {
mpFirstAnimation->initFrame();
mpFirstAnimation->restart();
}
mpChangeLayout->calc();
browserScrollDirection = 0;
}
utility::Graphics::setOrtho(0);
GXColor opaqueColor = {0xFF, 0xFF, 0xFF, 0xFF};
GXColor fadeColor = {0xFF, 0xFF, 0xFF, (u8)(mState * 0xFF / 20)};
int screenWidth = abs(static_cast<int>(projection4x3.GetWidth()));
int screenHeight = abs(static_cast<int>(projection4x3.GetHeight()));
nw4r::ut::Rect screenRect(-screenWidth / 2, screenHeight / 2,
screenWidth / 2, -screenHeight / 2);
utility::Graphics::drawTexture(screenRect, standardTexture, opaqueColor, 1);
utility::Graphics::drawTexture(projection16x9, wideTexture, fadeColor, 1);
nw4r::ut::Rect screenRect = projection4x3;
screenRect.left = -screenWidth / 2;
screenRect.top = screenHeight / 2;
screenRect.right = screenWidth / 2;
screenRect.bottom = -screenHeight / 2;
if (mpWiiSettingData->data[0x12] == 0x1E && unk_0x92C > 3) {
SensitivityDrawing::draw(static_cast<nand::File*>(mpBackgroundTPLFile));
}
if (wideBuffer != NULL && standardBuffer != NULL) {
GXTexObj wideTexture;
GXTexObj standardTexture;
GXInitTexObj(&wideTexture, wideBuffer, wideRect->w, wideRect->h, GX_TF_RGB565, GX_CLAMP, GX_CLAMP, GX_FALSE);
GXInitTexObj(&standardTexture, standardBuffer, standardRect->w, standardRect->h, GX_TF_RGB565, GX_CLAMP, GX_CLAMP, GX_FALSE);
GXInitTexObjLOD(&wideTexture, GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, GX_FALSE, GX_FALSE, GX_ANISO_1);
GXInitTexObjLOD(&standardTexture, GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, GX_FALSE, GX_FALSE, GX_ANISO_1);
GXTexObj sideTexture;
TPLGetGXTexObjFromPalette(reinterpret_cast<TPLPalette*>(static_cast<nand::File*>(mpBackgroundTPLFile)->getBuffer()), &sideTexture, 0);
TPLDescriptor* sideDescriptor = TPLGet(reinterpret_cast<TPLPalette*>(static_cast<nand::File*>(mpBackgroundTPLFile)->getBuffer()), 0);
mpChangeLayout->draw();
mpWaitLayout->draw();
if (mState == 0xC) {
unk_0xB9C = 1;
nw4r::ut::Rect projection16x9;
System::getProjectionRect16x9(&projection16x9);
int wideWidth = abs(static_cast<int>(projection16x9.GetWidth()));
int wideHeight = abs(static_cast<int>(projection16x9.GetHeight()));
f32 wideLeft = -wideWidth / 2;
f32 wideTop = wideHeight / 2;
f32 wideRight = wideWidth / 2;
nw4r::ut::Rect leftSide(wideLeft, wideTop,
wideLeft + sideDescriptor->textureHeader->width,
wideTop - sideDescriptor->textureHeader->height);
nw4r::ut::Rect rightSide(wideRight - sideDescriptor->textureHeader->width,
wideTop, wideRight, wideTop - sideDescriptor->textureHeader->height);
if (browserScrollDirection != 0) {
nw4r::lyt::Material* wideMaterial =
mpChangeLayout->FindPaneByName("N_Tra0")->FindMaterialByName("Tex0");
nw4r::lyt::Material* firstStandardMaterial =
mpChangeLayout->FindPaneByName("N_Tra0")->FindMaterialByName("Tex1");
nw4r::lyt::Material* secondStandardMaterial =
mpChangeLayout->FindPaneByName("N_Tra0")->FindMaterialByName("Tex2");
wideMaterial->SetTexture(0, wideTexture);
firstStandardMaterial->SetTexture(0, standardTexture);
secondStandardMaterial->SetTexture(0, standardTexture);
mpChangeLayout->FindPaneByName("N_Tra0")->SetVisible(true);
if (browserScrollDirection == 1) {
utility::FrameController* animation = mpSecondAnimation;
animation->initFrame();
animation->restart();
} else {
utility::FrameController* animation = mpFirstAnimation;
animation->initFrame();
animation->restart();
}
mpChangeLayout->calc();
browserScrollDirection = 0;
}
if (unk_0x74 == 8 && mState != 20) {
mState = 0;
}
utility::Graphics::setOrtho(0);
GXColor opaqueColor = {0xFF, 0xFF, 0xFF, 0xFF};
GXColor fadeColor = {0xFF, 0xFF, 0xFF, (u8)(mState * 0xFF / 20)};
utility::Graphics::drawTexture(screenRect, wideTexture, opaqueColor, 1);
bool hasWidePixels = false;
int pixelWords = wideRect->w * wideRect->h * 2 / 4;
for (int pixel = 0; pixel < pixelWords; ++pixel) {
if (static_cast<const u32*>(wideBuffer)[pixel] != 0) {
hasWidePixels = true;
break;
}
}
if (hasWidePixels) {
utility::Graphics::drawTexture(rightSide, sideTexture, opaqueColor, 1);
utility::Graphics::drawTexture(leftSide, sideTexture, opaqueColor, 1);
}
utility::Graphics::drawTexture(screenRect, standardTexture, fadeColor, 1);
utility::Graphics::drawTexture(rightSide, sideTexture, fadeColor, 1);
utility::Graphics::drawTexture(leftSide, sideTexture, fadeColor, 1);
if (mpWiiSettingData->data[0x12] == 0x1E && unk_0x92C > 3) {
SensitivityDrawing::draw(static_cast<nand::File*>(mpBackgroundTPLFile));
}
mpChangeLayout->draw();
mpWaitLayout->draw();
if (mState == 0xC) {
unk_0xB9C = 1;
}
}
if (mpWiiSettingFlag->smthMsgData >= 2 && mpWiiSettingFlag->smthMsgData <= 7) {
GXRenderModeObj renderMode = *System::getRenderModeObj();
u32 left;
u32 top;
u32 width;
u32 height;
GXGetScissor(&left, &top, &width, &height);
GXSetScissor(0, System::getRenderModeObj()->efbHeight / 2 - 0xA4, System::getRenderModeObj()->fbWidth, 0x132);
mpWaitLayout->draw();
GXSetScissor(0, renderMode.efbHeight / 2 - 0xA4, renderMode.fbWidth, 0x132);
mpMainLayout->draw();
GXSetScissor(left, top, width, height);
}
}

File diff suppressed because it is too large Load Diff