Compare commits

...

8 Commits

Author SHA1 Message Date
coah
aca28f2ad3 match(iplSaveDataManager): convert getAvailableInList to C
Exact match (28/28, diffs 0). Finds first zero titleId whose
chanInfo primaryType is not 1, using dens=12 for page/slot.
2026-10-01 17:32:29 -05:00
coah
602b10ed43 data(CDBFileSystemUtils): match .sdata path separator (#530)
Replace lbl_816979E8 + .sdata section pragma with a plain
char CDBFSPathSeparator = '/' so the .sdata symbol size matches
the original (1 byte). Rename the symbol in symbols.txt to match.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: coah <coah80@users.noreply.github.com>
2026-10-01 17:32:14 -05:00
github-actions[bot]
f0a91338f4 docs: update progress [skip ci] 2026-10-01 22:31:51 +00:00
coah
ff568a273c cleanup(rvl_dec): name Rvl_decode_ash C locals (#528)
Replace Ghidra locals in the non-asm ASH decoder path with
bitstream/huffman-oriented names.
2026-10-01 17:31:22 -05:00
coah
9f6ef656fd cleanup(rvl_dec): name Rvl_decode_szs C locals (#526)
Replace Ghidra locals in the non-asm SZS decoder path with
readable names (decodedSize, bitMask, copyLen, etc.).
2026-10-01 17:31:13 -05:00
coah
9d2f607b3f data(NHTTP_request): match multipart boundary .rodata size (#529)
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: coah <coah80@users.noreply.github.com>
2026-10-01 17:31:00 -05:00
coah
c836ab8bae cleanup(iplChannelManager): name title lookup and meta helpers (#520)
Rename Matching-only fn_8133A* APIs and update SD call sites plus
mangled symbols.txt entries.
2026-10-01 17:30:44 -05:00
coah
b889c52efc CDBDatabase: convert CleanUpEmptyDirectories to matching C (#527)
Exact match (133/133, diffs 0). Uses labeled error strings so the
DOL string pool stays identical to baserom.

Co-authored-by: asm2c <asm2c@local>
2026-10-01 17:30:33 -05:00
11 changed files with 379 additions and 479 deletions

View File

@@ -53,7 +53,7 @@ Progress
<!-- progress:start -->
| Decompiled | Matched | Linked | Data |
|:---:|:---:|:---:|:---:|
| 99.37% | 87.71% | 61.93% | 92.05% |
| 99.37% | 87.71% | 61.93% | 92.06% |
units 917/1027 complete, functions 12213/12563 matched.

View File

@@ -1385,19 +1385,19 @@ getDiskBannerData__Q33ipl7channel7ManagerFib = .text:0x81339FB0; // type:functio
titleIDtoPageIndex__Q33ipl7channel7ManagerCFUxPiPi = .text:0x8133A2BC; // type:function size:0xA0
getLockedMsgFromBuf__Q33ipl7channel7ManagerCFPCQ33ipl7channel22SChanMgrDiskInMessages = .text:0x8133A35C; // type:function size:0xA8
nand_error_handling__Q33ipl7channel7ManagerFi = .text:0x8133A404; // type:function size:0xDC
fn_8133A4E0__Q33ipl7channel7ManagerFUx = .text:0x8133A4E0; // type:function size:0x9C
fn_8133A57C__Q33ipl7channel7ManagerFUx = .text:0x8133A57C; // type:function size:0x3C
fn_8133A5B8__Q33ipl7channel7ManagerFUx = .text:0x8133A5B8; // type:function size:0x38
fn_8133A5F0__Q33ipl7channel7ManagerFUx = .text:0x8133A5F0; // type:function size:0x44
fn_8133A634__Q33ipl7channel7ManagerFUx = .text:0x8133A634; // type:function size:0x44
fn_8133A678__Q33ipl7channel7ManagerFUx = .text:0x8133A678; // type:function size:0x40
fn_8133A6B8__Q33ipl7channel7ManagerFUx = .text:0x8133A6B8; // type:function size:0x84
fn_8133A73C__Q33ipl7channel7ManagerFUx = .text:0x8133A73C; // type:function size:0x68
fn_8133A7A4__Q33ipl7channel7ManagerFPQ23EGG4HeapUx = .text:0x8133A7A4; // type:function size:0xB8
fn_8133A85C__Q33ipl7channel7ManagerFPQ23EGG4HeapUx = .text:0x8133A85C; // type:function size:0xC8
fn_8133A924__Q33ipl7channel7ManagerFPQ23EGG4HeapUx = .text:0x8133A924; // type:function size:0xCC
fn_8133A9F0__Q33ipl7channel7ManagerFv = .text:0x8133A9F0; // type:function size:0x60
fn_8133AA50__Q33ipl7channel7ManagerFUx = .text:0x8133AA50; // type:function size:0x30
findEntryByTitleId__Q33ipl7channel7ManagerFUx = .text:0x8133A4E0; // type:function size:0x9C
getBannerCSIdx__Q33ipl7channel7ManagerFUx = .text:0x8133A57C; // type:function size:0x3C
getSoundSize__Q33ipl7channel7ManagerFUx = .text:0x8133A5B8; // type:function size:0x38
needsNetSetting__Q33ipl7channel7ManagerFUx = .text:0x8133A5F0; // type:function size:0x44
usesAltSound__Q33ipl7channel7ManagerFUx = .text:0x8133A634; // type:function size:0x44
isMissingTicket__Q33ipl7channel7ManagerFUx = .text:0x8133A678; // type:function size:0x40
isNewsChannelV6Plus__Q33ipl7channel7ManagerFUx = .text:0x8133A6B8; // type:function size:0x84
isOperaChannel__Q33ipl7channel7ManagerFUx = .text:0x8133A73C; // type:function size:0x68
readBannerMetaAsync__Q33ipl7channel7ManagerFPQ23EGG4HeapUx = .text:0x8133A7A4; // type:function size:0xB8
readSoundMetaAsync__Q33ipl7channel7ManagerFPQ23EGG4HeapUx = .text:0x8133A85C; // type:function size:0xC8
readBannerCSAsync__Q33ipl7channel7ManagerFPQ23EGG4HeapUx = .text:0x8133A924; // type:function size:0xCC
clearTmpChannel__Q33ipl7channel7ManagerFv = .text:0x8133A9F0; // type:function size:0x60
unloadBanner__Q33ipl7channel7ManagerFUx = .text:0x8133AA50; // type:function size:0x30
__ct__Q33ipl7channel20ChannelScriptManagerFv = .text:0x8133AA80; // type:function size:0x10
create__Q33ipl7channel20ChannelScriptManagerFPQ23EGG7ExpHeap = .text:0x8133AA90; // type:function size:0x90
init__Q33ipl7channel20ChannelScriptManagerFPQ33ipl4nand4FilePQ33ipl7channel9RsoThread = .text:0x8133AB20; // type:function size:0x3D4
@@ -22538,7 +22538,7 @@ lbl_816979C8 = .sdata:0x816979C8; // type:object size:0x5 data:string
lbl_816979D0 = .sdata:0x816979D0; // type:object size:0x5 data:string
lbl_816979D8 = .sdata:0x816979D8; // type:object size:0x4 data:string
lbl_816979E0 = .sdata:0x816979E0; // type:object size:0x8 data:string
lbl_816979E8 = .sdata:0x816979E8; // type:object size:0x1 data:byte
CDBFSPathSeparator = .sdata:0x816979E8; // type:object size:0x1 data:byte
@1433 = .sdata:0x816979F0; // type:object size:0x4 scope:local data:string
@1435 = .sdata:0x816979F4; // type:object size:0x1 scope:local
@1440 = .sdata:0x816979F8; // type:object size:0x6 scope:local data:string

View File

@@ -336,19 +336,19 @@ namespace ipl {
BOOL nand_error_handling(int code);
SEntry* fn_8133A4E0(ESTitleId titleId);
u32 fn_8133A57C(ESTitleId titleId);
u32 fn_8133A5B8(ESTitleId titleId);
BOOL fn_8133A5F0(ESTitleId titleId);
BOOL fn_8133A634(ESTitleId titleId);
BOOL fn_8133A678(ESTitleId titleId);
BOOL fn_8133A6B8(ESTitleId titleId);
BOOL fn_8133A73C(ESTitleId titleId);
nand::MetaFile* fn_8133A7A4(EGG::Heap* heap, ESTitleId titleId);
nand::MetaFile* fn_8133A85C(EGG::Heap* heap, ESTitleId titleId);
nand::SharedFile* fn_8133A924(EGG::Heap* heap, ESTitleId titleId);
void fn_8133A9F0();
void fn_8133AA50(ESTitleId titleId);
SEntry* findEntryByTitleId(ESTitleId titleId);
u32 getBannerCSIdx(ESTitleId titleId);
u32 getSoundSize(ESTitleId titleId);
BOOL needsNetSetting(ESTitleId titleId);
BOOL usesAltSound(ESTitleId titleId);
BOOL isMissingTicket(ESTitleId titleId);
BOOL isNewsChannelV6Plus(ESTitleId titleId);
BOOL isOperaChannel(ESTitleId titleId);
nand::MetaFile* readBannerMetaAsync(EGG::Heap* heap, ESTitleId titleId);
nand::MetaFile* readSoundMetaAsync(EGG::Heap* heap, ESTitleId titleId);
nand::SharedFile* readBannerCSAsync(EGG::Heap* heap, ESTitleId titleId);
void clearTmpChannel();
void unloadBanner(ESTitleId titleId);
BOOL isReady() { return mState == FINISH; }

View File

@@ -2691,160 +2691,81 @@ CDBErr CDBDatabaseCleanUpEmptyDirectoriesMonth(char* year, CDBLocation location,
return CDB_ERROR_OK;
}
asm CDBErr CDBDatabaseCleanUpEmptyDirectories(CDBDatabase* database, CDBRecordLocation recordLocation) {
#ifdef __MWERKS__
nofralloc
stwu r1, -0x20(r1)
mflr r0
cmpwi r3, 0x0
stw r0, 0x24(r1)
stw r31, 0x1c(r1)
mr r31, r3
stw r30, 0x18(r1)
stw r29, 0x14(r1)
mr r29, r4
lwz r5, CDBDatabaseWorkBuf(r0)
addi r30, r5, 0x430c
bne L_8148A13C
li r3, 0x1
b L_8148A2FC
L_8148A13C:
bl CDBLock
lwz r3, 0x8(r31)
cmpwi r3, 0x0
beq L_8148A158
addis r3, r3, 0x1
lwz r31, -0x3ff0(r3)
b L_8148A15C
L_8148A158:
li r31, 0x0
L_8148A15C:
bl CDBUnlock
cmpwi r31, 0x0
bne L_8148A198
li r3, 0x2
bl CDBIsPrintDebugMessage
cmpwi r3, 0x0
beq L_8148A190
li r3, 0x2
bl CDBReport_
lis r3, lbl_8166B5D0@ha
addi r3, r3, lbl_8166B5D0@l
crclr 4*cr1+eq
bl OSReport
L_8148A190:
li r3, 0x1b
b L_8148A2FC
L_8148A198:
cmpwi r31, 0x1
bne L_8148A1D0
li r3, 0x2
bl CDBIsPrintDebugMessage
cmpwi r3, 0x0
beq L_8148A1C8
li r3, 0x2
bl CDBReport_
lis r3, lbl_8166B618@ha
addi r3, r3, lbl_8166B618@l
crclr 4*cr1+eq
bl OSReport
L_8148A1C8:
li r3, 0x1a
b L_8148A2FC
L_8148A1D0:
clrlwi. r0, r29, 31
beq L_8148A24C
mr r3, r30
li r4, 0x1
bl CDBFSFindFirstRoot
b L_8148A234
L_8148A1E8:
mr r3, r30
bl CDBFindDataIsDirectory
cmpwi r3, 0x0
beq L_8148A22C
mr r3, r30
bl CDBFindDataGetName
bl CDBFSIsYearDirName
cmpwi r3, 0x0
beq L_8148A22C
mr r3, r30
bl CDBFindDataGetName
li r4, 0x1
li r5, 0x0
bl CDBDatabaseCleanUpEmptyDirectoriesMonth
cmpwi r3, 0x0
beq L_8148A22C
b L_8148A2FC
L_8148A22C:
mr r3, r30
bl CDBFSFindNext
L_8148A234:
mr r3, r30
bl CDBFindDataIsEnd
cmpwi r3, 0x0
beq L_8148A1E8
mr r3, r30
bl CDBFSFindClose
L_8148A24C:
bl CDBVFSync
li r31, 0x0
bl CDBFSSDIsMounted
cmpwi r3, 0x0
beq L_8148A270
bl CDBFSSDIsEjected
cmpwi r3, 0x0
bne L_8148A270
li r31, 0x1
L_8148A270:
cmpwi r31, 0x0
beq L_8148A2F4
rlwinm. r0, r29, 0, 30, 30
beq L_8148A2F4
mr r3, r30
li r4, 0x2
bl CDBFSFindFirstRoot
b L_8148A2DC
L_8148A290:
mr r3, r30
bl CDBFindDataIsDirectory
cmpwi r3, 0x0
beq L_8148A2D4
mr r3, r30
bl CDBFindDataGetName
bl CDBFSIsYearDirName
cmpwi r3, 0x0
beq L_8148A2D4
mr r3, r30
bl CDBFindDataGetName
li r4, 0x2
li r5, 0x0
bl CDBDatabaseCleanUpEmptyDirectoriesMonth
cmpwi r3, 0x0
beq L_8148A2D4
b L_8148A2FC
L_8148A2D4:
mr r3, r30
bl CDBFSFindNext
L_8148A2DC:
mr r3, r30
bl CDBFindDataIsEnd
cmpwi r3, 0x0
beq L_8148A290
mr r3, r30
bl CDBFSFindClose
L_8148A2F4:
bl CDBVFSync
li r3, 0x0
L_8148A2FC:
lwz r0, 0x24(r1)
lwz r31, 0x1c(r1)
lwz r30, 0x18(r1)
lwz r29, 0x14(r1)
mtlr r0
addi r1, r1, 0x20
blr
#endif
CDBErr CDBDatabaseCleanUpEmptyDirectories(CDBDatabase* database, CDBRecordLocation recordLocation) {
CDBDatabase* db;
CDBFindData* find;
int flags;
CDBDatabaseState* instance;
CDBErr result;
BOOL sdAvailable;
db = database;
find = &CDBDatabaseWorkBuf->year;
if (db == NULL) {
return CDB_ERROR_1;
}
CDBLock();
instance = db->instance;
if (instance != NULL) {
flags = instance->flags;
} else {
flags = 0;
}
CDBUnlock();
if (flags == 0) {
CDBReportError(lbl_8166B5D0);
return CDB_ERROR_27;
}
if (flags == 1) {
CDBReportError(lbl_8166B618);
return CDB_ERROR_26;
}
if ((recordLocation & 1) != 0) {
CDBFSFindFirstRoot(find, 1);
while (CDBFindDataIsEnd(find) == 0) {
if (CDBFindDataIsDirectory(find) != 0) {
if (CDBFSIsYearDirName(CDBFindDataGetName(find)) != 0) {
result = CDBDatabaseCleanUpEmptyDirectoriesMonth(CDBFindDataGetName(find), 1, NULL);
if (result != CDB_ERROR_OK) {
return result;
}
}
}
CDBFSFindNext(find);
}
CDBFSFindClose(find);
}
CDBVFSync();
sdAvailable = 0;
if (CDBFSSDIsMounted() != 0) {
if (CDBFSSDIsEjected() == 0) {
sdAvailable = 1;
}
}
if (sdAvailable != 0) {
if ((recordLocation & 2) != 0) {
CDBFSFindFirstRoot(find, 2);
while (CDBFindDataIsEnd(find) == 0) {
if (CDBFindDataIsDirectory(find) != 0) {
if (CDBFSIsYearDirName(CDBFindDataGetName(find)) != 0) {
result = CDBDatabaseCleanUpEmptyDirectoriesMonth(CDBFindDataGetName(find), 2, NULL);
if (result != CDB_ERROR_OK) {
return result;
}
}
}
CDBFSFindNext(find);
}
CDBFSFindClose(find);
}
}
CDBVFSync();
return CDB_ERROR_OK;
}
#pragma section data_type ".data"

View File

@@ -6,13 +6,10 @@
#include <stdlib.h>
#include <string.h>
#pragma push
#pragma section sconst_type ".sdata"
extern const char lbl_816979E8[8] = "/\0\0\0\0\0\0\0";
#pragma pop
char CDBFSPathSeparator = '/';
void CDBFSConcatenatePath(char* path, const char* concatPath) {
strcat(path, lbl_816979E8);
strcat(path, &CDBFSPathSeparator);
strcat(path, concatPath);
}

View File

@@ -1,6 +1,6 @@
#include <private/nhttp.h>
const char NHTTPi_strMultipartBound[] = STR_POSTBOUND;
const char NHTTPi_strMultipartBound[24] = STR_POSTBOUND;
void* NHTTPi_alloc(u32 size, int align);
void NHTTPi_free(void* ptr);

View File

@@ -1058,7 +1058,7 @@ namespace ipl {
}
const ESTitleId* titleEntry = &mTitleIds[mCurrentTitle];
System::getChannelManager()->fn_8133AA50(*titleEntry);
System::getChannelManager()->unloadBanner(*titleEntry);
if (mpSDChannelSelect->getWorker()->get_async_result() == 0) {
mCurrentTitle++;

View File

@@ -849,7 +849,7 @@ extern "C" void iplSDChannelTitle_813E7074(SDChannelTitle* scene) {
extern "C" void iplSDChannelTitle_813E71A4(SDChannelTitle* scene) {
if (!scene->mpChannelSelect->getWorker()->is_working()) {
SCSetTmpTitleID(0);
System::getChannelManager()->fn_8133A9F0();
System::getChannelManager()->clearTmpChannel();
int result = scene->mpChannelSelect->getWorker()->get_async_result();
if (!result) {
if (scene->mbCopiedTitle) {
@@ -983,7 +983,7 @@ extern "C" void iplSDChannelTitle_813E7800(SDChannelTitle* scene) {
extern "C" void iplSDChannelTitle_813E787C(SDChannelTitle* scene) {
if (scene->mbTmdReady) {
if (!System::getChannelManager()->fn_8133A678(scene->mTitleId) && !utility::ESMisc::CheckTmdCountryCode(scene->mpTmd)) {
if (!System::getChannelManager()->isMissingTicket(scene->mTitleId) && !utility::ESMisc::CheckTmdCountryCode(scene->mpTmd)) {
System::getErrorHandler()->set(ErrorHandler::DEFAULT, 3, NULL, 0, -1);
}
scene->mMakerCode = scene->mpTmd->head.groupId;
@@ -1043,8 +1043,8 @@ extern "C" void iplSDChannelTitle_813E7B30(SDChannelTitle* scene, ESTitleId titl
delete scene->mpScriptFile;
scene->mpScriptFile = NULL;
}
if (System::getChannelManager()->fn_8133A57C(title)) {
scene->mpScriptFile = System::getChannelManager()->fn_8133A924(scene->mpRsoHeap, title);
if (System::getChannelManager()->getBannerCSIdx(title)) {
scene->mpScriptFile = System::getChannelManager()->readBannerCSAsync(scene->mpRsoHeap, title);
scene->mbScriptFailed = false;
scene->mScriptEnabled = 1;
scene->mScriptState = 1;
@@ -1097,7 +1097,7 @@ extern "C" void iplSDChannelTitle_813E7D14(SDChannelTitle* scene) {
scene->mScriptState = 1;
scene->mScriptHeapIndex = nextHeap;
}
if (System::getChannelManager()->fn_8133A634(scene->mTitleId) &&
if (System::getChannelManager()->usesAltSound(scene->mTitleId) &&
scene->mScriptFrame == scene->mScriptDuration - 240) {
snd::getSystem()->stopBannerSound(180);
}
@@ -1155,7 +1155,7 @@ extern "C" void iplSDChannelTitle_813E8034(SDChannelTitle* scene) {
scene->mpBannerAnimations[0]->play();
}
if (scene->mState != 6) {
if (!System::getChannelManager()->fn_8133A634(scene->mTitleId) || !scene->mScriptEnabled) {
if (!System::getChannelManager()->usesAltSound(scene->mTitleId) || !scene->mScriptEnabled) {
iplSDChannelTitle_813E8160(scene);
}
if (!scene->mpBannerLayout) {
@@ -1169,7 +1169,7 @@ extern "C" void iplSDChannelTitle_813E8034(SDChannelTitle* scene) {
extern "C" void iplSDChannelTitle_813E8160(SDChannelTitle* scene) {
if (scene->mpSoundFiles[scene->mLoadedIndex] && scene->mpSoundFiles[scene->mLoadedIndex]->checkData() == 1) {
void* sound = scene->mpSoundFiles[scene->mLoadedIndex]->getBuffer();
u32 size = System::getChannelManager()->fn_8133A5B8(scene->mTitleId);
u32 size = System::getChannelManager()->getSoundSize(scene->mTitleId);
snd::getSystem()->startBannerSound(sound, size, false);
}
}
@@ -1230,7 +1230,7 @@ extern "C" void iplSDChannelTitle_813E8360(SDChannelTitle* scene) {
}
extern "C" BOOL iplSDChannelTitle_813E847C(SDChannelTitle*, ESTmdView*, ESTitleId titleId) {
if (!System::getChannelManager()->fn_8133A5F0(titleId) || ncd::NCDSetting::getConnectEnableFlag()) {
if (!System::getChannelManager()->needsNetSetting(titleId) || ncd::NCDSetting::getConnectEnableFlag()) {
return TRUE;
}
return FALSE;
@@ -1429,8 +1429,8 @@ extern "C" void iplSDChannelTitle_813E8D14(SDChannelTitle*, nw4r::lyt::Pane* pan
}
extern "C" nand::LayoutFile* iplSDChannelTitle_813E8DCC(SDChannelTitle*, ESTitleId title, nand::File** sound) {
*sound = System::getChannelManager()->fn_8133A85C(System::getMem2App(), title);
nand::MetaFile* banner = System::getChannelManager()->fn_8133A7A4(System::getMem2App(), title);
*sound = System::getChannelManager()->readSoundMetaAsync(System::getMem2App(), title);
nand::MetaFile* banner = System::getChannelManager()->readBannerMetaAsync(System::getMem2App(), title);
return new (System::getMem2App(), 4) nand::LayoutFile(banner, NULL);
}
@@ -1453,15 +1453,15 @@ extern "C" BOOL iplSDChannelTitle_813E8F04(SDChannelTitle* scene, ESTmdView* tmd
return TRUE;
}
if (parental.enable & SC_PARENTAL_FLAG_ENABLED) {
u32 restrictions = System::getChannelManager()->fn_8133A6B8(scene->mTitleId);
u32 restrictions = System::getChannelManager()->isNewsChannelV6Plus(scene->mTitleId);
u32 networkRestrictions = SCGetNetContentRestrictions();
if (networkRestrictions & restrictions) {
return FALSE;
}
if (SCGetWwwRestriction() && System::getChannelManager()->fn_8133A73C(scene->mTitleId)) {
if (SCGetWwwRestriction() && System::getChannelManager()->isOperaChannel(scene->mTitleId)) {
return FALSE;
}
if (System::getChannelManager()->fn_8133A73C(scene->mTitleId)) {
if (System::getChannelManager()->isOperaChannel(scene->mTitleId)) {
return TRUE;
} else {
return utility::ESMisc::CheckTmdParentalControl(tmd);

View File

@@ -1235,7 +1235,7 @@ namespace ipl {
#pragma pop
SEntry* Manager::fn_8133A4E0(ESTitleId titleId) {
SEntry* Manager::findEntryByTitleId(ESTitleId titleId) {
for (int page = 0; page < MAX_CHANNEL_PAGE; page++) {
for (int index = 0; index < MAX_CHANNEL_INDEX; index++) {
ESTitleId cmp = ES_TITLE_ID(mChannels[page][index].info.titleType, mChannels[page][index].info.titleCode);
@@ -1255,8 +1255,8 @@ namespace ipl {
return NULL;
}
u32 Manager::fn_8133A57C(ESTitleId titleId) {
SEntry* channel = fn_8133A4E0(titleId);
u32 Manager::getBannerCSIdx(ESTitleId titleId) {
SEntry* channel = findEntryByTitleId(titleId);
if (channel != NULL) {
return channel->metaHdr->blockHdr.bannerCSIdx;
} else {
@@ -1264,8 +1264,8 @@ namespace ipl {
}
}
u32 Manager::fn_8133A5B8(ESTitleId titleId) {
SEntry* channel = fn_8133A4E0(titleId);
u32 Manager::getSoundSize(ESTitleId titleId) {
SEntry* channel = findEntryByTitleId(titleId);
if (channel != NULL) {
return channel->metaHdr->blockHdr.soundSize;
} else {
@@ -1273,8 +1273,8 @@ namespace ipl {
}
}
BOOL Manager::fn_8133A5F0(ESTitleId titleId) {
SEntry* channel = fn_8133A4E0(titleId);
BOOL Manager::needsNetSetting(ESTitleId titleId) {
SEntry* channel = findEntryByTitleId(titleId);
if (channel != NULL && (channel->metaHdr->blockHdr.netSetting << 8)) {
return TRUE;
} else {
@@ -1282,8 +1282,8 @@ namespace ipl {
}
}
BOOL Manager::fn_8133A634(ESTitleId titleId) {
SEntry* channel = fn_8133A4E0(titleId);
BOOL Manager::usesAltSound(ESTitleId titleId) {
SEntry* channel = findEntryByTitleId(titleId);
if (channel != NULL && (channel->metaHdr->blockHdr.useAltSound << 14)) {
return TRUE;
} else {
@@ -1291,8 +1291,8 @@ namespace ipl {
}
}
BOOL Manager::fn_8133A678(ESTitleId titleId) {
SEntry* channel = fn_8133A4E0(titleId);
BOOL Manager::isMissingTicket(ESTitleId titleId) {
SEntry* channel = findEntryByTitleId(titleId);
if (channel != NULL && channel->missingTicket != FALSE) {
return TRUE;
} else {
@@ -1300,8 +1300,8 @@ namespace ipl {
}
}
BOOL Manager::fn_8133A6B8(ESTitleId titleId) {
SEntry* channel = fn_8133A4E0(titleId);
BOOL Manager::isNewsChannelV6Plus(ESTitleId titleId) {
SEntry* channel = findEntryByTitleId(titleId);
if (channel == NULL) {
return FALSE;
}
@@ -1315,8 +1315,8 @@ namespace ipl {
}
}
BOOL Manager::fn_8133A73C(ESTitleId titleId) {
SEntry* channel = fn_8133A4E0(titleId);
BOOL Manager::isOperaChannel(ESTitleId titleId) {
SEntry* channel = findEntryByTitleId(titleId);
if (channel == NULL) {
return FALSE;
}
@@ -1329,8 +1329,8 @@ namespace ipl {
}
}
nand::MetaFile* Manager::fn_8133A7A4(EGG::Heap* heap, ESTitleId titleId) {
SEntry* channel = fn_8133A4E0(titleId);
nand::MetaFile* Manager::readBannerMetaAsync(EGG::Heap* heap, ESTitleId titleId) {
SEntry* channel = findEntryByTitleId(titleId);
if (channel == NULL) {
return NULL;
}
@@ -1343,8 +1343,8 @@ namespace ipl {
}
}
nand::MetaFile* Manager::fn_8133A85C(EGG::Heap* heap, ESTitleId titleId) {
SEntry* channel = fn_8133A4E0(titleId);
nand::MetaFile* Manager::readSoundMetaAsync(EGG::Heap* heap, ESTitleId titleId) {
SEntry* channel = findEntryByTitleId(titleId);
if (channel == NULL) {
return NULL;
}
@@ -1357,8 +1357,8 @@ namespace ipl {
}
}
nand::SharedFile* Manager::fn_8133A924(EGG::Heap* heap, ESTitleId titleId) {
SEntry* channel = fn_8133A4E0(titleId);
nand::SharedFile* Manager::readBannerCSAsync(EGG::Heap* heap, ESTitleId titleId) {
SEntry* channel = findEntryByTitleId(titleId);
if (channel == NULL) {
return NULL;
}
@@ -1366,7 +1366,7 @@ namespace ipl {
if (!channel->loadedBnr || channel->info.primaryType == channel::PRIMARY_TYPE_DISK) {
return NULL;
} else {
u32 index = fn_8133A57C(titleId);
u32 index = getBannerCSIdx(titleId);
if (index == 0) {
return NULL;
}
@@ -1375,15 +1375,15 @@ namespace ipl {
}
}
void Manager::fn_8133A9F0() {
void Manager::clearTmpChannel() {
if (mTmpChannel.bnrFile != NULL) {
delete mTmpChannel.bnrFile;
}
memset(&mTmpChannel, 0, sizeof(mTmpChannel));
}
void Manager::fn_8133AA50(ESTitleId titleId) {
SEntry* channel = fn_8133A4E0(titleId);
void Manager::unloadBanner(ESTitleId titleId) {
SEntry* channel = findEntryByTitleId(titleId);
if (channel != NULL) {
channel->loadedBnr = false;
}

View File

@@ -1003,39 +1003,21 @@ namespace ipl {
return count - 1;
}
asm int Manager::getAvailableInList(register const ESTitleId* titleIds, register u32 titleCount) {
nofralloc
li r8, 0
li r6, 0
li r7, 0xc
mtctr r5
cmplwi r5, 0
ble getAvailableInList_L3
getAvailableInList_L1:
add r5, r4, r6
lwzx r0, r4, r6
lwz r5, 4(r5)
or. r0, r5, r0
bne getAvailableInList_L2
divw r5, r8, r7
mullw r0, r5, r7
mulli r5, r5, 0xc0
subf r0, r0, r8
add r5, r3, r5
slwi r0, r0, 4
add r5, r5, r0
lbz r0, 0x30(r5)
cmplwi r0, 1
beq getAvailableInList_L2
mr r3, r8
blr
getAvailableInList_L2:
addi r8, r8, 1
addi r6, r6, 8
bdnz getAvailableInList_L1
getAvailableInList_L3:
li r3, -1
blr
int Manager::getAvailableInList(const ESTitleId* titleIds, u32 titleCount) {
int dens = 12;
u32 i;
for (i = 0; i < titleCount; i++) {
if (titleIds[i] == 0) {
int page = (int)i / dens;
int slot = (int)i % dens;
u8* p = (u8*)this + page * 0xc0;
p += slot * 16;
if (*(p + 0x30) != 1) {
return (int)i;
}
}
}
return -1;
}
asm int Manager::isEqualChannel(register ESTitleId titleId0, register ESTitleId titleId1) {

View File

@@ -152,81 +152,81 @@ Rvl_decode_szs_done:
}
#else
int Rvl_decode_szs(u8* out, u8* in) {
register u8* pbVar1;
register u8 bVar2;
register u8 bVar3;
register u8* pbVar5;
register int iVar6;
register int iVar7;
register u32 uVar8;
register u32 uVar9;
register u32 uVar10;
register u32 param_5;
iVar6 = *(int*)(in + 4);
uVar8 = 0;
register u8* copySrc;
register u8 hdrByte;
register u8 extLenByte;
register u8* inPtr;
register int decodedSize;
register int remaining;
register u32 bitMask;
register u32 copyLen;
register u32 blockCount;
register u32 flags;
decodedSize = *(int*)(in + 4);
bitMask = 0;
in += 0x10;
iVar7 = iVar6;
remaining = decodedSize;
do {
next:
while (1) {
uVar8 >>= 1;
pbVar5 = in;
if (uVar8 == 0) {
param_5 = *in;
uVar8 = 0x80;
pbVar5 = in + 1;
bitMask >>= 1;
inPtr = in;
if (bitMask == 0) {
flags = *in;
bitMask = 0x80;
inPtr = in + 1;
}
bVar2 = *pbVar5;
if ((uVar8 & param_5) == 0) {
hdrByte = *inPtr;
if ((bitMask & flags) == 0) {
break;
}
in = pbVar5 + 1;
iVar7--;
*out = bVar2;
in = inPtr + 1;
remaining--;
*out = hdrByte;
out++;
if (iVar7 != 0) {
if (remaining != 0) {
goto next;
}
goto done;
}
uVar9 = bVar2 >> 4;
in = pbVar5 + 2;
if (uVar9 == 0) {
bVar3 = *in;
in = pbVar5 + 3;
uVar9 = bVar3 + 0x10;
copyLen = hdrByte >> 4;
in = inPtr + 2;
if (copyLen == 0) {
extLenByte = *in;
in = inPtr + 3;
copyLen = extLenByte + 0x10;
}
pbVar5 = out - (((bVar2 & 0xf) << 8) | pbVar5[1]);
iVar7 = (iVar7 - uVar9) - 2;
*out = pbVar5[-1];
out[1] = *pbVar5;
pbVar5 += 2;
uVar10 = uVar9 >> 3;
inPtr = out - (((hdrByte & 0xf) << 8) | inPtr[1]);
remaining = (remaining - copyLen) - 2;
*out = inPtr[-1];
out[1] = *inPtr;
inPtr += 2;
blockCount = copyLen >> 3;
out += 2;
if (uVar10 != 0) {
if (blockCount != 0) {
do {
*out = pbVar5[-1];
out[1] = *pbVar5;
out[2] = pbVar5[1];
out[3] = pbVar5[2];
out[4] = pbVar5[3];
out[5] = pbVar5[4];
out[6] = pbVar5[5];
out[7] = pbVar5[6];
pbVar5 += 8;
*out = inPtr[-1];
out[1] = *inPtr;
out[2] = inPtr[1];
out[3] = inPtr[2];
out[4] = inPtr[3];
out[5] = inPtr[4];
out[6] = inPtr[5];
out[7] = inPtr[6];
inPtr += 8;
out += 8;
uVar10--;
} while (uVar10 != 0);
blockCount--;
} while (blockCount != 0);
}
for (uVar9 &= 7; uVar9 != 0; uVar9--) {
pbVar1 = pbVar5 - 1;
pbVar5++;
*out = *pbVar1;
for (copyLen &= 7; copyLen != 0; copyLen--) {
copySrc = inPtr - 1;
inPtr++;
*out = *copySrc;
out++;
}
} while (0 < iVar7);
} while (0 < remaining);
done:
return iVar6;
return decodedSize;
}
#endif
#ifdef __MWERKS__
@@ -490,225 +490,225 @@ L_Rvl_decode_ash_return:
}
#else
int Rvl_decode_ash(u8* out, u8* in) {
u8* puVar1;
u32* puVar2;
u32 uVar3;
u32 uVar4;
u32 uVar5;
u32 uVar6;
int iVar7;
u16 uVar8;
u16 uVar10;
u8* puVar9;
int iVar11;
u32 uVar12;
u32 uVar13;
u32 uVar14;
u32 uVar15;
int iVar16;
int iVar17;
u32 uVar18;
u32 uVar19;
u32 uVar20;
u16* puVar21;
u8* dst;
u32* inWordPtr;
u32 decodedSize;
u32 sym9;
u32 sym11;
u32 nodeVal;
int needBits;
u16 nodeCount;
u16 nextNode;
u8* litPtr;
int bitOff1;
u32 bitPos1;
u32 shifted;
u32 bitWord1;
u32 tmp15;
int stackDepth;
int bitOff2;
u32 bitPos2;
u32 bitWord2;
u32 tmp20;
u16* stackPtr;
uVar3 = *(u32*)(in + 4) & 0xffffff;
iVar11 = 0x10;
uVar12 = 0;
uVar18 = 0;
uVar19 = *(u32*)(*(int*)(in + 8) + in);
iVar17 = *(int*)(in + 8) + 4;
puVar21 = (u16*)&work[0x4ff8];
uVar8 = 0x200;
iVar16 = 0;
uVar14 = *(u32*)(in + 0xc);
uVar10 = 0x200;
decodedSize = *(u32*)(in + 4) & 0xffffff;
bitOff1 = 0x10;
bitPos1 = 0;
bitPos2 = 0;
bitWord2 = *(u32*)(*(int*)(in + 8) + in);
bitOff2 = *(int*)(in + 8) + 4;
stackPtr = (u16*)&work[0x4ff8];
nodeCount = 0x200;
stackDepth = 0;
bitWord1 = *(u32*)(in + 0xc);
nextNode = 0x200;
do {
while (1) {
if (uVar12 == 0x1f) {
uVar13 = *(u32*)(in + iVar11);
uVar12 = 0;
iVar11 = iVar11 + 4;
if (bitPos1 == 0x1f) {
shifted = *(u32*)(in + bitOff1);
bitPos1 = 0;
bitOff1 = bitOff1 + 4;
} else {
uVar12 = uVar12 + 1;
uVar13 = uVar14 << 1;
bitPos1 = bitPos1 + 1;
shifted = bitWord1 << 1;
}
if (-1 < (int)uVar14) {
if (-1 < (int)bitWord1) {
break;
}
*puVar21 = uVar10 | 0x8000;
puVar21[1] = uVar10 | 0x4000;
puVar21 = puVar21 + 2;
iVar16 = iVar16 + 2;
uVar8 = uVar8 + 1;
uVar14 = uVar13;
uVar10 = uVar10 + 1;
*stackPtr = nextNode | 0x8000;
stackPtr[1] = nextNode | 0x4000;
stackPtr = stackPtr + 2;
stackDepth = stackDepth + 2;
nodeCount = nodeCount + 1;
bitWord1 = shifted;
nextNode = nextNode + 1;
}
iVar7 = uVar12 + 9;
if (iVar7 < 0x21) {
uVar4 = uVar13 >> 0x17;
if (iVar7 == 0x20) {
uVar14 = *(u32*)(in + iVar11);
uVar12 = 0;
iVar11 = iVar11 + 4;
needBits = bitPos1 + 9;
if (needBits < 0x21) {
sym9 = shifted >> 0x17;
if (needBits == 0x20) {
bitWord1 = *(u32*)(in + bitOff1);
bitPos1 = 0;
bitOff1 = bitOff1 + 4;
} else {
uVar14 = uVar13 << 9;
uVar12 = uVar12 + 9;
bitWord1 = shifted << 9;
bitPos1 = bitPos1 + 9;
}
} else {
puVar2 = (u32*)(in + iVar11);
iVar11 = iVar11 + 4;
uVar4 = uVar13 >> 0x17 | *puVar2 >> (0x40U - iVar7 & 0x3f);
uVar12 = uVar12 - 0x17;
uVar14 = *puVar2 << (uVar12 & 0x3f);
inWordPtr = (u32*)(in + bitOff1);
bitOff1 = bitOff1 + 4;
sym9 = shifted >> 0x17 | *inWordPtr >> (0x40U - needBits & 0x3f);
bitPos1 = bitPos1 - 0x17;
bitWord1 = *inWordPtr << (bitPos1 & 0x3f);
}
while (1) {
puVar21 = puVar21 - 1;
uVar10 = *puVar21;
iVar16 = iVar16 - 1;
iVar7 = (uVar10 & 0x3fff) * 2;
if ((uVar10 & 0x8000) == 0) {
stackPtr = stackPtr - 1;
nextNode = *stackPtr;
stackDepth = stackDepth - 1;
needBits = (nextNode & 0x3fff) * 2;
if ((nextNode & 0x8000) == 0) {
break;
}
*(u16*)(&work[0x7fe] + iVar7) = (u16)uVar4;
uVar4 = uVar10 & 0x3fff;
if (iVar16 == 0) {
uVar8 = 0x800;
iVar16 = 0;
uVar10 = 0x800;
*(u16*)(&work[0x7fe] + needBits) = (u16)sym9;
sym9 = nextNode & 0x3fff;
if (stackDepth == 0) {
nodeCount = 0x800;
stackDepth = 0;
nextNode = 0x800;
do {
while (1) {
if (uVar18 == 0x1f) {
uVar13 = *(u32*)(in + iVar17);
uVar18 = 0;
iVar17 = iVar17 + 4;
if (bitPos2 == 0x1f) {
shifted = *(u32*)(in + bitOff2);
bitPos2 = 0;
bitOff2 = bitOff2 + 4;
} else {
uVar18 = uVar18 + 1;
uVar13 = uVar19 << 1;
bitPos2 = bitPos2 + 1;
shifted = bitWord2 << 1;
}
if (-1 < (int)uVar19) {
if (-1 < (int)bitWord2) {
break;
}
*puVar21 = uVar10 | 0x8000;
puVar21[1] = uVar10 | 0x4000;
puVar21 = puVar21 + 2;
iVar16 = iVar16 + 2;
uVar8 = uVar8 + 1;
uVar19 = uVar13;
uVar10 = uVar10 + 1;
*stackPtr = nextNode | 0x8000;
stackPtr[1] = nextNode | 0x4000;
stackPtr = stackPtr + 2;
stackDepth = stackDepth + 2;
nodeCount = nodeCount + 1;
bitWord2 = shifted;
nextNode = nextNode + 1;
}
iVar7 = uVar18 + 0xb;
if (iVar7 < 0x21) {
uVar5 = uVar13 >> 0x15;
if (iVar7 == 0x20) {
uVar19 = *(u32*)(in + iVar17);
uVar18 = 0;
iVar17 = iVar17 + 4;
needBits = bitPos2 + 0xb;
if (needBits < 0x21) {
sym11 = shifted >> 0x15;
if (needBits == 0x20) {
bitWord2 = *(u32*)(in + bitOff2);
bitPos2 = 0;
bitOff2 = bitOff2 + 4;
} else {
uVar19 = uVar13 << 0xb;
uVar18 = uVar18 + 0xb;
bitWord2 = shifted << 0xb;
bitPos2 = bitPos2 + 0xb;
}
} else {
puVar2 = (u32*)(in + iVar17);
iVar17 = iVar17 + 4;
uVar5 = uVar13 >> 0x15 | *puVar2 >> (0x40U - iVar7 & 0x3f);
uVar18 = uVar18 - 0x15;
uVar19 = *puVar2 << (uVar18 & 0x3f);
inWordPtr = (u32*)(in + bitOff2);
bitOff2 = bitOff2 + 4;
sym11 = shifted >> 0x15 | *inWordPtr >> (0x40U - needBits & 0x3f);
bitPos2 = bitPos2 - 0x15;
bitWord2 = *inWordPtr << (bitPos2 & 0x3f);
}
while (1) {
puVar21 = puVar21 - 1;
uVar10 = *puVar21;
iVar16 = iVar16 - 1;
iVar7 = (uVar10 & 0x3fff) * 2;
if ((uVar10 & 0x8000) == 0) {
stackPtr = stackPtr - 1;
nextNode = *stackPtr;
stackDepth = stackDepth - 1;
needBits = (nextNode & 0x3fff) * 2;
if ((nextNode & 0x8000) == 0) {
break;
}
*(u16*)(&work[0x2ffa] + iVar7) = (u16)uVar5;
uVar5 = uVar10 & 0x3fff;
uVar6 = uVar4;
uVar13 = uVar3;
if (iVar16 == 0) {
*(u16*)(&work[0x2ffa] + needBits) = (u16)sym11;
sym11 = nextNode & 0x3fff;
nodeVal = sym9;
shifted = decodedSize;
if (stackDepth == 0) {
do {
while (0x1ff < uVar6) {
if (uVar12 == 0x1f) {
uVar15 = *(u32*)(in + iVar11);
iVar11 = iVar11 + 4;
uVar12 = 0;
while (0x1ff < nodeVal) {
if (bitPos1 == 0x1f) {
tmp15 = *(u32*)(in + bitOff1);
bitOff1 = bitOff1 + 4;
bitPos1 = 0;
} else {
uVar12 = uVar12 + 1;
uVar15 = uVar14 << 1;
bitPos1 = bitPos1 + 1;
tmp15 = bitWord1 << 1;
}
if ((int)uVar14 < 0) {
uVar6 = *(u16*)(&work[0x7fe] + uVar6 * 2);
uVar14 = uVar15;
if ((int)bitWord1 < 0) {
nodeVal = *(u16*)(&work[0x7fe] + nodeVal * 2);
bitWord1 = tmp15;
} else {
uVar6 = *(u16*)((u8*)work + uVar6 * 2);
uVar14 = uVar15;
nodeVal = *(u16*)((u8*)work + nodeVal * 2);
bitWord1 = tmp15;
}
}
uVar15 = uVar5;
if (uVar6 < 0x100) {
*out = (char)uVar6;
tmp15 = sym11;
if (nodeVal < 0x100) {
*out = (char)nodeVal;
out = out + 1;
uVar13 = uVar13 - 1;
shifted = shifted - 1;
} else {
while (0x7ff < uVar15) {
if (uVar18 == 0x1f) {
uVar20 = *(u32*)(in + iVar17);
iVar17 = iVar17 + 4;
uVar18 = 0;
while (0x7ff < tmp15) {
if (bitPos2 == 0x1f) {
tmp20 = *(u32*)(in + bitOff2);
bitOff2 = bitOff2 + 4;
bitPos2 = 0;
} else {
uVar18 = uVar18 + 1;
uVar20 = uVar19 << 1;
bitPos2 = bitPos2 + 1;
tmp20 = bitWord2 << 1;
}
if ((int)uVar19 < 0) {
uVar15 = *(u16*)(&work[0x2ffa] + uVar15 * 2);
uVar19 = uVar20;
if ((int)bitWord2 < 0) {
tmp15 = *(u16*)(&work[0x2ffa] + tmp15 * 2);
bitWord2 = tmp20;
} else {
uVar15 = *(u16*)(&work[0xffc] + uVar15 * 2);
uVar19 = uVar20;
tmp15 = *(u16*)(&work[0xffc] + tmp15 * 2);
bitWord2 = tmp20;
}
}
uVar6 = uVar6 - 0xfd;
puVar9 = out - uVar15;
uVar13 = uVar13 - uVar6;
uVar15 = uVar6 >> 3;
if (uVar15 == 0) {
nodeVal = nodeVal - 0xfd;
litPtr = out - tmp15;
shifted = shifted - nodeVal;
tmp15 = nodeVal >> 3;
if (tmp15 == 0) {
goto LAB_813325b8;
}
do {
*out = puVar9[-1];
out[1] = *puVar9;
out[2] = puVar9[1];
out[3] = puVar9[2];
out[4] = puVar9[3];
out[5] = puVar9[4];
out[6] = puVar9[5];
out[7] = puVar9[6];
puVar9 = puVar9 + 8;
*out = litPtr[-1];
out[1] = *litPtr;
out[2] = litPtr[1];
out[3] = litPtr[2];
out[4] = litPtr[3];
out[5] = litPtr[4];
out[6] = litPtr[5];
out[7] = litPtr[6];
litPtr = litPtr + 8;
out = out + 8;
uVar15 = uVar15 - 1;
} while (uVar15 != 0);
for (uVar6 = uVar6 & 7; uVar6 != 0; uVar6 = uVar6 - 1) {
tmp15 = tmp15 - 1;
} while (tmp15 != 0);
for (nodeVal = nodeVal & 7; nodeVal != 0; nodeVal = nodeVal - 1) {
LAB_813325b8:
puVar1 = puVar9 - 1;
puVar9 = puVar9 + 1;
*out = *puVar1;
dst = litPtr - 1;
litPtr = litPtr + 1;
*out = *dst;
out = out + 1;
}
}
uVar6 = uVar4;
} while (uVar13 != 0);
return uVar3;
nodeVal = sym9;
} while (shifted != 0);
return decodedSize;
}
}
*(u16*)(&work[0xffc] + iVar7) = (u16)uVar5;
uVar10 = uVar8;
*(u16*)(&work[0xffc] + needBits) = (u16)sym11;
nextNode = nodeCount;
} while (1);
}
}
*(u16*)((u8*)work + iVar7) = (u16)uVar4;
uVar10 = uVar8;
*(u16*)((u8*)work + needBits) = (u16)sym9;
nextNode = nodeCount;
} while (1);
}
#endif