Compare commits

...

2 Commits

Author SHA1 Message Date
coah
302504e198 cleanup(MemoryCardManager): rename qsort comparator
iplMemoryCardManager_813CD034 → compareMemoryCardSortEntries

DOL sha1 unchanged.
2026-10-01 18:45:44 -05:00
coah
9f4a70db74 match(pf_fat): PFFAT_GetSectorSpecified (#658)
Rewrite the error cleanup as switch(error) so MWCC emits the
target beq/b/li epilogue instead of a collapsed bne/li.

Unit pf_fat: 30/35 -> 31/35 funcs; 9900 -> 9968 / 12572 code bytes.
DOL sha1: 26116613f624061ba99c8d1a299aaa6efa85670d
2026-10-01 18:45:26 -05:00
3 changed files with 9 additions and 7 deletions

View File

@@ -4290,7 +4290,7 @@ __dt__Q43ipl5scene10MemoryBase9AnmButtonFv = .text:0x813CCF34; // type:function
__dt__Q43ipl5scene10MemoryBase6ButtonFv = .text:0x813CCF74; // type:function size:0x40
__dt__Q43ipl5scene10MemoryBase3AnmFv = .text:0x813CCFB4; // type:function size:0x40
__dt__Q33ipl5scene15MemoryBaseEventFv = .text:0x813CCFF4; // type:function size:0x40
iplMemoryCardManager_813CD034 = .text:0x813CD034; // type:function size:0x78
compareMemoryCardSortEntries = .text:0x813CD034; // type:function size:0x78
calc__Q33ipl5scene17MemoryCardManagerFv = .text:0x813CD0AC; // type:function size:0x4C
isSlotReady__Q33ipl5scene17MemoryCardManagerFUc = .text:0x813CD0F8; // type:function size:0x44
isSlotNoCard__Q33ipl5scene17MemoryCardManagerFUc = .text:0x813CD13C; // type:function size:0x40

View File

@@ -1282,11 +1282,13 @@ s32 PFFAT_GetSectorSpecified(PFFAT_FFD* file, u32 fileSectorIndex,
error = PFFAT_GetSector(file, fileSectorIndex, clusterIndex != 0, 0,
sector);
if (error != 0) {
goto done;
switch (error) {
case 0:
error = 0;
break;
default:
break;
}
error = 0;
done:
return error;
}

View File

@@ -11,7 +11,7 @@ struct MemoryCardSortEntry {
s64 key;
};
extern "C" int iplMemoryCardManager_813CD034(const void* first, const void* second) {
extern "C" int compareMemoryCardSortEntries(const void* first, const void* second) {
const MemoryCardSortEntry* a = static_cast<const MemoryCardSortEntry*>(first);
const MemoryCardSortEntry* b = static_cast<const MemoryCardSortEntry*>(second);
s64 bKey = b->key;
@@ -92,7 +92,7 @@ void MemoryCardManager::sort_file_array(u8 slot) {
mFile[slot][file].unk_0x08 = 0;
}
}
qsort(mFile[slot], 0x7f, sizeof(MCFile), iplMemoryCardManager_813CD034);
qsort(mFile[slot], 0x7f, sizeof(MCFile), compareMemoryCardSortEntries);
}
void MemoryCardManager::sendCardCmdMove(u8 slot, s16 index) {