From 5001e49b8db79757d29f42d3326019e12682760b Mon Sep 17 00:00:00 2001 From: gamemasterplc Date: Fri, 24 Nov 2023 00:18:52 -0600 Subject: [PATCH] Decompile HuDVDReadAsyncCallBack --- include/common_structs.h | 13 +++++++++++++ src/game/dvd.c | 18 +++++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/include/common_structs.h b/include/common_structs.h index ab27ba9d..81bf2467 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -2,6 +2,7 @@ #define _COMMON_STRUCTS_H #include "types.h" +#include "dolphin/dvd.h" typedef struct UnkOvl { s32 unk0; @@ -62,4 +63,16 @@ typedef struct file_list_entry { s32 file_id; } FileListEntry; +typedef struct data_stat { + s32 dir_id; + void *dir; + void *data; + u32 raw_len; + u32 comp_type; + BOOL used; + s32 num; + u32 status; + DVDFileInfo file_info; +} DataStat; + #endif diff --git a/src/game/dvd.c b/src/game/dvd.c index dfc4b976..78f0e752 100644 --- a/src/game/dvd.c +++ b/src/game/dvd.c @@ -3,6 +3,7 @@ #include "dolphin/os.h" extern u32 DirDataSize; +extern void HuDataDirReadAsyncCallBack(s32 result, DVDFileInfo* fileInfo); static DVDDiskID correctDiskID = { { 'M', 'P', 'G', 'C' }, //gameName @@ -18,7 +19,7 @@ void HuDvdErrorWatch(); static s32 beforeDvdStatus; static int CallBackStatus; -static void HuDVDReadAsyncCallBack() +static void HuDVDReadAsyncCallBack(s32 result, DVDFileInfo* fileInfo) { CallBackStatus = 1; } @@ -125,9 +126,8 @@ void *HuDvdDataFastReadNum(s32 entrynum, s32 num) DVDFileInfo file; void *data = NULL; if(!DVDFastOpen(entrynum, &file)) { - OSPanic("dvd.c", 258, "dvd.c: File Open Error"); (void)num; - (void)data; + OSPanic("dvd.c", 258, "dvd.c: File Open Error"); } else { data = HuDvdDataReadWait(&file, 3, 1, num, HuDVDReadAsyncCallBack, FALSE); DVDClose(&file); @@ -135,6 +135,18 @@ void *HuDvdDataFastReadNum(s32 entrynum, s32 num) return data; } +void *HuDvdDataFastReadAsync(s32 entrynum, DataStat *stat) +{ + DVDFileInfo file; + void *data = NULL; + if(!DVDFastOpen(entrynum, &stat->file_info)) { + OSPanic("dvd.c", 274, "dvd.c: File Open Error"); + } else { + data = HuDvdDataReadWait(&stat->file_info, 3, 0, 0, HuDataDirReadAsyncCallBack, TRUE); + } + return data; +} + void HuDvdDataClose(void *ptr) { if(ptr) {