Compare commits

...

4 Commits

Author SHA1 Message Date
asm2c
30cb4063b8 match(CDBDatabase): decompile CDBDatabaseCreateRecordAtOnceEx
Exact match (51/51, diffs 0). DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d.
2026-10-01 17:54:12 -05:00
github-actions[bot]
1802d45758 docs: update progress [skip ci] 2026-10-01 22:48:56 +00:00
coah
130cc9e88e match(pf_fat): PFFAT_GetClusterAllocated (#570)
Reorder locals so p_start_cluster lands in r7 and p_vol in r8.

Co-authored-by: matcher <matcher@local>
2026-10-01 17:47:34 -05:00
coah
a801d1c5d6 cleanup(CXStreamingUncompression): rename Huffman init dest param (#568)
Match the Huffman prototype to the .c and the RL/LZ decls (param_2 → data).
2026-10-01 17:47:08 -05:00
4 changed files with 32 additions and 61 deletions

View File

@@ -53,9 +53,9 @@ Progress
<!-- progress:start -->
| Decompiled | Matched | Linked | Data |
|:---:|:---:|:---:|:---:|
| 99.37% | 87.71% | 62.05% | 92.06% |
| 99.37% | 87.72% | 62.05% | 92.06% |
units 918/1027 complete, functions 12214/12563 matched.
units 918/1027 complete, functions 12215/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

@@ -64,7 +64,7 @@ typedef struct CXUncompContextHuffman {
void CXInitUncompContextRL(CXUncompContextRL* context, u8* data);
void CXInitUncompContextLZ(CXUncompContextLZ* context, u8* data);
void CXInitUncompContextHuffman(CXUncompContextHuffman* context, u8* param_2);
void CXInitUncompContextHuffman(CXUncompContextHuffman* context, u8* data);
CXStreamingResult CXReadUncompRL(CXUncompContextRL* context, const void* src, u32 size);
CXStreamingResult CXReadUncompLZ(CXUncompContextLZ* context, const void* src, u32 size);

View File

@@ -1180,20 +1180,24 @@ s32 PFFAT_GetClusterSpecified(PFFAT_FFD* file, u32 chainIndex,
s32 PFFAT_GetClusterAllocated(PFFAT_FFD* file, u32 chainIndex,
u32 numClusters, u32* cluster)
{
u32* start;
PF_VOLUME* vol;
PFFAT_HINT* hint;
u32 fatType;
u32 locateStart;
u32 locateEnd;
s32 error;
fatType = file->p_vol->bpb.fat_type;
start = file->p_start_cluster;
vol = file->p_vol;
fatType = vol->bpb.fat_type;
hint = file->p_hint;
if (*file->p_start_cluster == 1) {
if (*start == 1) {
if (fatType <= FAT_16) {
*cluster = -1;
return 0;
}
*file->p_start_cluster = file->p_vol->bpb.root_dir_cluster;
*start = vol->bpb.root_dir_cluster;
}
*cluster = -1;
error = find_cluster_in_chain(file, chainIndex, 2, numClusters, 1, cluster);

View File

@@ -249,61 +249,28 @@ asm CDBErr CDBDatabaseCreateRecordAtOnce(CDBDatabase* database, CDBRecord* recor
#endif
}
asm CDBErr CDBDatabaseCreateRecordAtOnceEx(CDBDatabase* database, CDBRecord* record, const char* typeStr, const char* fileTypeStr, u8* recordData, u32 recordDataSize, int year, int month, int day, int hour, int min, int sec) {
#ifdef __MWERKS__
nofralloc
stwu r1, -0x60(r1)
mflr r0
stw r0, 0x64(r1)
addi r11, r1, 0x60
bl _savegpr_22
lwz r28, 0x68(r1)
mr r23, r4
li r0, 0x0
lwz r12, 0x6c(r1)
lwz r11, 0x70(r1)
mr r22, r3
lwz r4, 0x74(r1)
mr r24, r5
stw r9, 0x24(r1)
mr r25, r6
mr r26, r7
mr r27, r8
stw r10, 0x20(r1)
addi r3, r1, 0x10
stw r28, 0x1c(r1)
stw r12, 0x18(r1)
stw r11, 0x14(r1)
stw r4, 0x10(r1)
stw r0, 0x30(r1)
stw r0, 0x34(r1)
bl OSCalendarTimeToTicks
lhz r30, 0x0(r22)
mr r28, r4
lwz r31, 0x4(r22)
mr r29, r3
bl CDBLock
stw r26, 0x8(r1)
mr r3, r22
mr r4, r23
mr r5, r24
stw r27, 0xc(r1)
mr r6, r25
mr r8, r28
mr r7, r29
mr r9, r31
mr r10, r30
bl CDBDatabaseCreateRecordImAtOnce_
mr r30, r3
bl CDBUnlock
addi r11, r1, 0x60
mr r3, r30
bl _restgpr_22
lwz r0, 0x64(r1)
mtlr r0
addi r1, r1, 0x60
blr
#endif
CDBErr CDBDatabaseCreateRecordAtOnceEx(CDBDatabase* database, CDBRecord* record, const char* typeStr, const char* fileTypeStr, u8* recordData, u32 recordDataSize, int year, int month, int day, int hour, int min, int sec) {
u32 gameCode;
u16 makerCode;
CDBErr result;
OSTime time;
OSCalendarTime cal;
cal.year = year;
cal.mon = month;
cal.mday = day;
cal.hour = hour;
cal.min = min;
cal.sec = sec;
cal.msec = 0;
cal.usec = 0;
time = OSCalendarTimeToTicks(&cal);
makerCode = database->makerCode;
gameCode = database->gameCode;
CDBLock();
result = CDBDatabaseCreateRecordImAtOnce_(database, record, typeStr, fileTypeStr, time, gameCode, makerCode, recordData, recordDataSize);
CDBUnlock();
return result;
}
CDBErr CDBDatabasePrivateCreateRecordAtOnceEx(CDBDatabase* database, CDBRecord* record, const char* typeStr, const char* fileTypeStr, int year, int month, int day, int hour, int min, int sec, u8* recordData, u32 recordDataSize, char* makerCode, char* gameCode) {