Compare commits

...

6 Commits

Author SHA1 Message Date
coah
c0bfe74e5a match(SaveDataManager): decompile getNumValidChannel
Exact match (23/23, diffs 0). DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d.

Adds ChannelSlot/ChannelPage overlays (slots at +0x30, page stride 0xC0)
so the loop uses typed .valid/.titleId instead of raw byte loads.
2026-10-01 18:21:09 -05:00
coah
728bfa984b cleanup(TMCJPEG): name decode-buffer refill helpers (#632)
Rename TMCJPEG_814EAF50/814EB108 to refillJpegBufferAfterFF
and refillJpegBuffer.
2026-10-01 18:15:59 -05:00
coah
921234fdac cleanup(rvl_dec): name literal-copy goto label (#631)
Rename LAB_813325b8 to copy_lit_tail.
2026-10-01 18:15:23 -05:00
coah
9d6f9dce74 cleanup(Contest): name NAT detection callback (#629)
Rename iplContest_813D54F8 to onNatDetectionDone.
2026-10-01 18:15:18 -05:00
coah
f1bcb9d78c cleanup(ChannelTitle): name disk TMD/tmp-title task callbacks (#628)
Rename address-suffixed static tasks to markTmdReadyTask and
deleteTmpTitleContentTask.
2026-10-01 18:14:53 -05:00
coah
efda1f0093 Restore SD state-machine switch case mappings (#623) 2026-10-01 18:14:28 -05:00
9 changed files with 119 additions and 112 deletions

View File

@@ -3930,9 +3930,9 @@ isLimitOutChannel__Q33ipl5scene12ChannelTitleFv = .text:0x813B9F8C; // type:func
dispTimeLimitWindow__Q33ipl5scene12ChannelTitleFv = .text:0x813B9FE0; // type:function size:0x104 dispTimeLimitWindow__Q33ipl5scene12ChannelTitleFv = .text:0x813B9FE0; // type:function size:0x104
getTimeLimitString__Q33ipl5scene12ChannelTitleFPwUlUl = .text:0x813BA0E4; // type:function size:0x484 getTimeLimitString__Q33ipl5scene12ChannelTitleFPwUlUl = .text:0x813BA0E4; // type:function size:0x484
getTmdTask__Q33ipl5scene12ChannelTitleFPv = .text:0x813BA568; // type:function size:0x11C getTmdTask__Q33ipl5scene12ChannelTitleFPv = .text:0x813BA568; // type:function size:0x11C
iplChannelTitle_813BA684__Q33ipl5scene12ChannelTitleFPv = .text:0x813BA684; // type:function size:0xC markTmdReadyTask__Q33ipl5scene12ChannelTitleFPv = .text:0x813BA684; // type:function size:0xC
getTicketLimitTask__Q33ipl5scene12ChannelTitleFPv = .text:0x813BA690; // type:function size:0xF4 getTicketLimitTask__Q33ipl5scene12ChannelTitleFPv = .text:0x813BA690; // type:function size:0xF4
iplChannelTitle_813BA784__Q33ipl5scene12ChannelTitleFPv = .text:0x813BA784; // type:function size:0xE0 deleteTmpTitleContentTask__Q33ipl5scene12ChannelTitleFPv = .text:0x813BA784; // type:function size:0xE0
isTimeLimitedTicket__Q33ipl5scene12ChannelTitleFP12ESTicketViewPUl = .text:0x813BA864; // type:function size:0xF4 isTimeLimitedTicket__Q33ipl5scene12ChannelTitleFP12ESTicketViewPUl = .text:0x813BA864; // type:function size:0xF4
startGetTicketLimitTask__Q33ipl5scene12ChannelTitleFv = .text:0x813BA958; // type:function size:0x8C startGetTicketLimitTask__Q33ipl5scene12ChannelTitleFv = .text:0x813BA958; // type:function size:0x8C
updateLockedMsg__Q33ipl5scene12ChannelTitleFi = .text:0x813BA9E4; // type:function size:0x16C updateLockedMsg__Q33ipl5scene12ChannelTitleFi = .text:0x813BA9E4; // type:function size:0x16C
@@ -4441,7 +4441,7 @@ IPLContestAlloc = .text:0x813D5240; // type:function size:0x60
IPLContestFree = .text:0x813D52A0; // type:function size:0x64 IPLContestFree = .text:0x813D52A0; // type:function size:0x64
sNHTTPReqCallback = .text:0x813D5304; // type:function size:0x1E0 sNHTTPReqCallback = .text:0x813D5304; // type:function size:0x1E0
sNHTTPCleanupCallback = .text:0x813D54E4; // type:function size:0x14 sNHTTPCleanupCallback = .text:0x813D54E4; // type:function size:0x14
iplContest_813D54F8 = .text:0x813D54F8; // type:function size:0x6C onNatDetectionDone = .text:0x813D54F8; // type:function size:0x6C
AddressToString = .text:0x813D5564; // type:function size:0xE4 AddressToString = .text:0x813D5564; // type:function size:0xE4
DiscoverReachability = .text:0x813D5648; // type:function size:0xE0 DiscoverReachability = .text:0x813D5648; // type:function size:0xE0
DiscoverMapping = .text:0x813D5728; // type:function size:0xE4 DiscoverMapping = .text:0x813D5728; // type:function size:0xE4
@@ -8879,8 +8879,8 @@ TMCJPEGDEC_move_ptr = .text:0x814EAD28; // type:function size:0xE4
TMCJPEGDEC_load_buff = .text:0x814EAE0C; // type:function size:0x124 TMCJPEGDEC_load_buff = .text:0x814EAE0C; // type:function size:0x124
TMCJPEGDEC_get_position = .text:0x814EAF30; // type:function size:0x10 TMCJPEGDEC_get_position = .text:0x814EAF30; // type:function size:0x10
TMCJPEGDEC_chk_possible_size = .text:0x814EAF40; // type:function size:0x10 TMCJPEGDEC_chk_possible_size = .text:0x814EAF40; // type:function size:0x10
TMCJPEG_814EAF50 = .text:0x814EAF50; // type:function size:0x1B8 scope:local refillJpegBufferAfterFF = .text:0x814EAF50; // type:function size:0x1B8 scope:local
TMCJPEG_814EB108 = .text:0x814EB108; // type:function size:0x198 scope:local refillJpegBuffer = .text:0x814EB108; // type:function size:0x198 scope:local
TMCJPEGDEC_init_buff_thumbnail = .text:0x814EB2A0; // type:function size:0x88 TMCJPEGDEC_init_buff_thumbnail = .text:0x814EB2A0; // type:function size:0x88
TMCJPEGDEC_init_buff = .text:0x814EB328; // type:function size:0x10 TMCJPEGDEC_init_buff = .text:0x814EB328; // type:function size:0x10
TMCJPEGDEC_rewind_ptr = .text:0x814EB338; // type:function size:0xA4 TMCJPEGDEC_rewind_ptr = .text:0x814EB338; // type:function size:0xA4

View File

@@ -293,8 +293,8 @@ namespace ipl {
LOCKED_DIALOG_ANIM_MAX, LOCKED_DIALOG_ANIM_MAX,
}; };
static void iplChannelTitle_813BA684(void* work); static void markTmdReadyTask(void* work);
static void iplChannelTitle_813BA784(void* work); static void deleteTmpTitleContentTask(void* work);
static void getTmdTask(void* work); static void getTmdTask(void* work);
static void getTicketLimitTask(void* work); static void getTicketLimitTask(void* work);
static BOOL isTimeLimitedTicket(ESTicketView * ticket, u32* remainTime = NULL); static BOOL isTimeLimitedTicket(ESTicketView * ticket, u32* remainTime = NULL);

View File

@@ -26,6 +26,18 @@ namespace ipl {
namespace savedata { namespace savedata {
extern "C" BOOL isTitleCached(void* manager, ESTitleId titleId); extern "C" BOOL isTitleCached(void* manager, ESTitleId titleId);
struct ChannelSlot {
u8 valid; // 0x00 (primaryType)
u8 pad[3]; // 0x01
s32 titleId; // 0x04 (sceneID)
u8 rest[8]; // 0x08
};
struct ChannelPage {
u8 pad[0x30];
ChannelSlot slots[MAX_CHANNEL_INDEX]; // 0x30
};
class Manager { class Manager {
public: public:
Manager(EGG::Heap* heap); Manager(EGG::Heap* heap);

View File

@@ -1,7 +1,7 @@
#include <tmc_jpeg_internal.h> #include <tmc_jpeg_internal.h>
static s32 TMCJPEG_814EAF50(TMCCJPEGDecWork* work); static s32 refillJpegBufferAfterFF(TMCCJPEGDecWork* work);
static s32 TMCJPEG_814EB108(TMCCJPEGDecWork* work); static s32 refillJpegBuffer(TMCCJPEGDecWork* work);
s32 TMCJPEGDEC_init_ptr_buff(TMCCJPEGDecWork* work, void* param) { s32 TMCJPEGDEC_init_ptr_buff(TMCCJPEGDecWork* work, void* param) {
u32 readSize; u32 readSize;
@@ -52,7 +52,7 @@ s32 TMCJPEGDEC_get_byte(u8* dst, TMCCJPEGDecWork* work) {
if (work->pBufCur >= work->pBufEnd) { if (work->pBufCur >= work->pBufEnd) {
if (work->remaining != 0) { if (work->remaining != 0) {
s32 r = TMCJPEG_814EB108(work); s32 r = refillJpegBuffer(work);
if (r < 0) { if (r < 0) {
return r; return r;
} }
@@ -69,7 +69,7 @@ s32 TMCJPEGDEC_get_byte(u8* dst, TMCCJPEGDecWork* work) {
if (cur >= work->pBufEnd) { if (cur >= work->pBufEnd) {
if (work->remaining != 0) { if (work->remaining != 0) {
s32 r = TMCJPEG_814EB108(work); s32 r = refillJpegBuffer(work);
if (r < 0) { if (r < 0) {
return r; return r;
} }
@@ -92,7 +92,7 @@ s32 TMCJPEGDEC_get_wbyte(u16* dst, TMCCJPEGDecWork* work) {
if (work->pBufCur >= work->pBufEnd) { if (work->pBufCur >= work->pBufEnd) {
if (work->remaining != 0) { if (work->remaining != 0) {
r = TMCJPEG_814EB108(work); r = refillJpegBuffer(work);
if (r < 0) { if (r < 0) {
goto br; goto br;
} else { } else {
@@ -119,7 +119,7 @@ s32 TMCJPEGDEC_get_wbyte(u16* dst, TMCCJPEGDecWork* work) {
} }
if (work->remaining != 0) { if (work->remaining != 0) {
r = TMCJPEG_814EB108(work); r = refillJpegBuffer(work);
if (r >= 0) { if (r >= 0) {
goto o1; goto o1;
} }
@@ -144,7 +144,7 @@ p2:
goto r2; goto r2;
} }
if (work->remaining != 0) { if (work->remaining != 0) {
r = TMCJPEG_814EB108(work); r = refillJpegBuffer(work);
if (r < 0) if (r < 0)
goto ez; goto ez;
else { else {
@@ -166,7 +166,7 @@ r2:
} }
if (work->remaining != 0) { if (work->remaining != 0) {
r = TMCJPEG_814EB108(work); r = refillJpegBuffer(work);
if (r < 0) if (r < 0)
goto ez; goto ez;
else { else {
@@ -193,7 +193,7 @@ s32 TMCJPEGDEC_get_sbyte(u8* dst, u32 count, TMCCJPEGDecWork* work) {
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
if (work->pBufCur >= work->pBufEnd) { if (work->pBufCur >= work->pBufEnd) {
if (work->remaining != 0) { if (work->remaining != 0) {
r = TMCJPEG_814EB108(work); r = refillJpegBuffer(work);
if (r < 0) { if (r < 0) {
goto copy_byte; goto copy_byte;
} else { } else {
@@ -214,7 +214,7 @@ s32 TMCJPEGDEC_get_sbyte(u8* dst, u32 count, TMCCJPEGDecWork* work) {
goto r0; goto r0;
} }
if (work->remaining != 0) { if (work->remaining != 0) {
r = TMCJPEG_814EB108(work); r = refillJpegBuffer(work);
if (r >= 0) { if (r >= 0) {
goto r0; goto r0;
} }
@@ -251,7 +251,7 @@ lp:
if (work->remaining == 0) { if (work->remaining == 0) {
goto er1; goto er1;
} }
r = TMCJPEG_814EB108(work); r = refillJpegBuffer(work);
if (r >= 0) { if (r >= 0) {
goto lc; goto lc;
} }
@@ -271,7 +271,7 @@ lc:
if (work->remaining == 0) { if (work->remaining == 0) {
goto er2; goto er2;
} }
r = TMCJPEG_814EB108(work); r = refillJpegBuffer(work);
if (r >= 0) { if (r >= 0) {
goto ret0; goto ret0;
} }
@@ -320,7 +320,7 @@ s32 TMCJPEGDEC_load_buff(TMCCJPEGDecWork* work) {
if (work->remaining == 0) { if (work->remaining == 0) {
break; break;
} }
r = TMCJPEG_814EAF50(work); r = refillJpegBufferAfterFF(work);
if (r < 0) { if (r < 0) {
return r; return r;
} }
@@ -345,7 +345,7 @@ s32 TMCJPEGDEC_load_buff(TMCCJPEGDecWork* work) {
if (work->remaining == 0) { if (work->remaining == 0) {
break; break;
} }
r = TMCJPEG_814EAF50(work); r = refillJpegBufferAfterFF(work);
if (r < 0) { if (r < 0) {
return r; return r;
} }
@@ -364,7 +364,7 @@ s32 TMCJPEGDEC_chk_possible_size(TMCCJPEGDecWork* work) {
return work->pBufEnd - work->pBufCur; return work->pBufEnd - work->pBufCur;
} }
static s32 TMCJPEG_814EAF50(TMCCJPEGDecWork* work) { static s32 refillJpegBufferAfterFF(TMCCJPEGDecWork* work) {
u8 marker; u8 marker;
u32 readSize; u32 readSize;
u8* dest; u8* dest;
@@ -410,7 +410,7 @@ static s32 TMCJPEG_814EAF50(TMCCJPEGDecWork* work) {
return 0; return 0;
} }
static s32 TMCJPEG_814EB108(TMCCJPEGDecWork* work) { static s32 refillJpegBuffer(TMCCJPEGDecWork* work) {
u8* end; u8* end;
u32 i, j; u32 i, j;
s32 readSize; s32 readSize;

View File

@@ -2289,7 +2289,7 @@ namespace ipl {
unk_0x360 = false; unk_0x360 = false;
System::getTask1()->request(iplChannelTitle_813BA684, this, NULL); System::getTask1()->request(markTmdReadyTask, this, NULL);
mState = STATE_WAIT_TMD; mState = STATE_WAIT_TMD;
} else { } else {
@@ -2301,7 +2301,7 @@ namespace ipl {
unk_0x360 = false; unk_0x360 = false;
System::getTask1()->request(iplChannelTitle_813BA684, this, NULL); System::getTask1()->request(markTmdReadyTask, this, NULL);
mState = STATE_WAIT_TMD; mState = STATE_WAIT_TMD;
} }
@@ -2408,7 +2408,7 @@ namespace ipl {
if (mTmpTitleID != 0) { if (mTmpTitleID != 0) {
SCSetTmpTitleID(0); SCSetTmpTitleID(0);
System::getTask1()->request(iplChannelTitle_813BA784, this, NULL); System::getTask1()->request(deleteTmpTitleContentTask, this, NULL);
} else { } else {
unk_0x370 = true; unk_0x370 = true;
} }
@@ -2673,7 +2673,7 @@ namespace ipl {
chanTtl->unk_0x360 = true; chanTtl->unk_0x360 = true;
} }
void ChannelTitle::iplChannelTitle_813BA684(void* work) { void ChannelTitle::markTmdReadyTask(void* work) {
ChannelTitle* chanTtl = static_cast<ChannelTitle*>(work); ChannelTitle* chanTtl = static_cast<ChannelTitle*>(work);
chanTtl->unk_0x360 = true; chanTtl->unk_0x360 = true;
} }
@@ -2699,7 +2699,7 @@ namespace ipl {
} }
#pragma pop #pragma pop
void ChannelTitle::iplChannelTitle_813BA784(void* work) { void ChannelTitle::deleteTmpTitleContentTask(void* work) {
ChannelTitle* chanTtl = static_cast<ChannelTitle*>(work); ChannelTitle* chanTtl = static_cast<ChannelTitle*>(work);
if (chanTtl->mTmpTitleID != 0) { if (chanTtl->mTmpTitleID != 0) {

View File

@@ -48,7 +48,7 @@ void IPLContestGSFree(void* block);
void* IPLContestGSRealloc(void* oldBlock, u32 newSize); void* IPLContestGSRealloc(void* oldBlock, u32 newSize);
void* IPLContestGSMemalign(u32 align, u32 size); void* IPLContestGSMemalign(u32 align, u32 size);
void iplContest_813D54F8(BOOL success, NAT nat); void onNatDetectionDone(BOOL success, NAT nat);
void* IPLContestAlloc(int size); void* IPLContestAlloc(int size);
void IPLContestFree(void* block, u32 _unused); void IPLContestFree(void* block, u32 _unused);
@@ -227,7 +227,7 @@ int IPLContestProcess() {
break; break;
} }
case 2: { case 2: {
NNStartNatDetection(iplContest_813D54F8); NNStartNatDetection(onNatDetectionDone);
g_session.unk_0x030 = 3; g_session.unk_0x030 = 3;
OSReport("Port mapping detectioning test has been started.\n"); OSReport("Port mapping detectioning test has been started.\n");
g_session.detectStartTime = OSGetTime(); g_session.detectStartTime = OSGetTime();
@@ -461,7 +461,7 @@ void sNHTTPCleanupCallback() {
g_session.state = 3; g_session.state = 3;
} }
void iplContest_813D54F8(gsi_bool success, NAT nat) { void onNatDetectionDone(gsi_bool success, NAT nat) {
if (success) { if (success) {
g_session.nat = nat; g_session.nat = nat;
g_session.unk_0x03c = 0; g_session.unk_0x03c = 0;

View File

@@ -1037,52 +1037,52 @@ namespace ipl {
} }
switch (mWorkerCommand) { switch (mWorkerCommand) {
case 0: case 1:
processWorkerCommands(); processWorkerCommands();
break; break;
case 1: case 0:
handleNandTitleUsageComplete(); handleNandTitleUsageComplete();
break; break;
case 2: case 2:
handleSDTitleList(); handleSDTitleList();
break; break;
case 3: case 4:
handleSDMountComplete(); handleSDMountComplete();
break; break;
case 4: case 5:
handleSDTitleListResult(); handleSDTitleListResult();
break; break;
case 5: case 3:
handleSDChannelUpdateComplete(); handleSDChannelUpdateComplete();
break; break;
case 6: case 7:
handleCopyComplete(); handleCopyComplete();
break; break;
case 7: case 8:
handleSDLocationUpdateComplete(); handleSDLocationUpdateComplete();
break; break;
case 8: case 9:
handleSDLocationReadComplete(); handleSDLocationReadComplete();
break; break;
case 9: case 10:
handleMoveComplete(); handleMoveComplete();
break; break;
case 10: case 11:
handleBackupFitComplete(); handleBackupFitComplete();
break; break;
case 11: case 12:
handleNandSDCleanupComplete(); handleNandSDCleanupComplete();
break; break;
case 12: case 13:
handleSDDeleteComplete(); handleSDDeleteComplete();
break; break;
case 13: case 6:
handleSDCardReady(); handleSDCardReady();
break; break;
case 14: case 15:
handleCardCommand(); handleCardCommand();
break; break;
case 15: case 14:
break; break;
} }
@@ -1749,79 +1749,79 @@ namespace ipl {
} }
switch (state) { switch (state) {
case 0: case 1:
processNormalInput(); processNormalInput();
break; break;
case 1: case 8:
case 9:
setPageActionFrame(); setPageActionFrame();
break; break;
case 2: case 10:
case 11:
finishPageScroll(); finishPageScroll();
break; break;
case 3: case 5:
createChildScene(0x23, this, NULL, this); createChildScene(0x23, this, NULL, this);
mState = 6; mState = 6;
break; break;
case 4: case 7:
advancePageAnimation(); advancePageAnimation();
break; break;
case 5: case 12:
mState = 13; mState = 13;
break; break;
case 6: case 14:
initializeNormalPage(); initializeNormalPage();
break; break;
case 7: case 15:
updateDragState(); updateDragState();
break; break;
case 8: case 16:
updateDragPageTransition(); updateDragPageTransition();
break; break;
case 9: case 17:
finishDragWait(); finishDragWait();
break; break;
case 10: case 18:
finishDragPageTransition(); finishDragPageTransition();
break; break;
case 11: case 19:
applyChannelMove(); applyChannelMove();
break; break;
case 12: case 20:
finishChannelMove(); finishChannelMove();
break; break;
case 13: case 21:
resetDragPreview(); resetDragPreview();
break; break;
case 14:
finishDragPageChange();
break;
case 15:
handleFourPageDialog();
break;
case 16:
flushSaveDataAndMountSD();
break;
case 17:
handleThreePageDialog();
break;
case 18:
finishCardDialog();
break;
case 19:
finishDialogOperation();
break;
case 20:
finishDialogTransition();
break;
case 21:
case 22: case 22:
case 23: case 23:
finishDragPageChange();
break;
case 24: case 24:
handleFourPageDialog();
break;
case 25: case 25:
flushSaveDataAndMountSD();
break;
case 26: case 26:
handleThreePageDialog();
break;
case 27: case 27:
finishCardDialog();
break;
case 28: case 28:
finishDialogOperation();
break;
case 29: case 29:
finishDialogTransition();
break;
case 0:
case 2:
case 3:
case 4:
case 6:
case 13:
default: default:
break; break;
} }

View File

@@ -230,34 +230,29 @@ namespace ipl {
blr blr
} }
asm int Manager::getNumValidChannel() const { int Manager::getNumValidChannel() const {
nofralloc const ChannelSlot* q;
li r9, 0 int dens = 12;
li r10, 0 const ChannelPage* p;
li r4, 0 int slot;
li r0, 0xc int count = 0;
getNumValidChannel_L1: int page;
add r8, r3, r4 u8 flag;
li r5, 0 s32 val;
mtctr r0 for (page = 0; page < 4; page++) {
getNumValidChannel_L2: p = (const ChannelPage*)((const u8*)this + page * 0xc0);
add r7, r8, r5 for (slot = 0; slot < dens; slot++) {
lbz r6, 0x30(r7) q = &p->slots[slot];
cmpwi r6, 0 flag = q->valid;
beq getNumValidChannel_L3 if (flag != 0) {
lwz r6, 0x34(r7) val = q->titleId;
cmpwi r6, 0 if (val != 0) {
beq getNumValidChannel_L3 count++;
addi r9, r9, 1 }
getNumValidChannel_L3: }
addi r5, r5, 0x10 }
bdnz getNumValidChannel_L2 }
addi r10, r10, 1 return count;
addi r4, r4, 0xc0
cmpwi r10, 4
blt getNumValidChannel_L1
mr r3, r9
blr
} }
BOOL Manager::isResetAcceptable() { BOOL Manager::isResetAcceptable() {

View File

@@ -674,7 +674,7 @@ int Rvl_decode_ash(u8* out, u8* in) {
shifted = shifted - nodeVal; shifted = shifted - nodeVal;
tmp15 = nodeVal >> 3; tmp15 = nodeVal >> 3;
if (tmp15 == 0) { if (tmp15 == 0) {
goto LAB_813325b8; goto copy_lit_tail;
} }
do { do {
*out = litPtr[-1]; *out = litPtr[-1];
@@ -690,7 +690,7 @@ int Rvl_decode_ash(u8* out, u8* in) {
tmp15 = tmp15 - 1; tmp15 = tmp15 - 1;
} while (tmp15 != 0); } while (tmp15 != 0);
for (nodeVal = nodeVal & 7; nodeVal != 0; nodeVal = nodeVal - 1) { for (nodeVal = nodeVal & 7; nodeVal != 0; nodeVal = nodeVal - 1) {
LAB_813325b8: copy_lit_tail:
dst = litPtr - 1; dst = litPtr - 1;
litPtr = litPtr + 1; litPtr = litPtr + 1;
*out = *dst; *out = *dst;