Match most of data.c

This commit is contained in:
gamemasterplc 2023-11-24 12:29:41 -06:00
parent cb6805a852
commit 7dbf748078
10 changed files with 761 additions and 38 deletions

View file

@ -3,7 +3,6 @@
#include "dolphin/os.h"
extern u32 DirDataSize;
extern void HuDataDirReadAsyncCallBack(s32 result, DVDFileInfo* fileInfo);
static DVDDiskID correctDiskID = {
{ 'M', 'P', 'G', 'C' }, //gameName
@ -68,7 +67,7 @@ void *HuDvdDataRead(char *path)
if(!DVDOpen(path, &file)) {
OSPanic("dvd.c", 146, "dvd.c: File Open Error");
} else {
data = HuDvdDataReadWait(&file, 3, 0, 0, HuDVDReadAsyncCallBack, FALSE);
data = HuDvdDataReadWait(&file, HEAP_DVD, 0, 0, HuDVDReadAsyncCallBack, FALSE);
DVDClose(&file);
}
return data;
@ -84,20 +83,20 @@ void **HuDvdDataReadMulti(char **paths)
while(paths[count]) {
count++;
}
file_ptrs = HuMemDirectMalloc(0, count*4);
file_ptrs = HuMemDirectMalloc(0, count*sizeof(void *));
for(i=0; i<count; i++) {
if(!DVDOpen(paths[i], &file)) {
OSPanic("dvd.c", 183, "dvd.c: File Open Error");
return NULL;
} else {
file_ptrs[i] = HuDvdDataReadWait(&file, 3, 0, 0, HuDVDReadAsyncCallBack, FALSE);
file_ptrs[i] = HuDvdDataReadWait(&file, HEAP_DVD, 0, 0, HuDVDReadAsyncCallBack, FALSE);
DVDClose(&file);
}
}
return file_ptrs;
}
void *HuDvdDataReadDirect(char *path, int heap)
void *HuDvdDataReadDirect(char *path, HeapID heap)
{
DVDFileInfo file;
void *data = NULL;
@ -117,7 +116,7 @@ void *HuDvdDataFastRead(s32 entrynum)
if(!DVDFastOpen(entrynum, &file)) {
OSPanic("dvd.c", 243, "dvd.c: File Open Error");
} else {
data = HuDvdDataReadWait(&file, 3, 0, 0, HuDVDReadAsyncCallBack, FALSE);
data = HuDvdDataReadWait(&file, HEAP_DVD, 0, 0, HuDVDReadAsyncCallBack, FALSE);
DVDClose(&file);
}
return data;
@ -131,7 +130,7 @@ void *HuDvdDataFastReadNum(s32 entrynum, s32 num)
(void)num;
OSPanic("dvd.c", 258, "dvd.c: File Open Error");
} else {
data = HuDvdDataReadWait(&file, 3, 1, num, HuDVDReadAsyncCallBack, FALSE);
data = HuDvdDataReadWait(&file, HEAP_DVD, 1, num, HuDVDReadAsyncCallBack, FALSE);
DVDClose(&file);
}
return data;
@ -144,7 +143,7 @@ void *HuDvdDataFastReadAsync(s32 entrynum, DataStat *stat)
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);
data = HuDvdDataReadWait(&stat->file_info, HEAP_DVD, 0, 0, HuDataDirReadAsyncCallBack, TRUE);
}
return data;
}