From 47a1bdea8872c79dd2cd7d75ca7f254b9ed13170 Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 29 Oct 2020 14:27:37 -0400 Subject: match up to func_801DCFE4, add string.h and stdlib.h, add types.h to Makefile include path, and move GameSpy under DWC --- include/GameSpy/darray.h | 40 ------------------------------------- include/GameSpy/hashtable.h | 34 ------------------------------- include/GameSpy/nonport.h | 16 --------------- include/MSL_C/MSL_Common/qsort.h | 15 ++++++++++++++ include/MSL_C/stdlib.h | 15 ++++++++++++++ include/MSL_C/string.h | 18 +++++++++++++++++ include/Runtime/MWCPlusLib.h | 14 +++++++++++++ include/SDK/DVD/dvdfs.h | 15 +++++++++++++- include/SDK/DWC/gamespy/darray.h | 40 +++++++++++++++++++++++++++++++++++++ include/SDK/DWC/gamespy/hashtable.h | 34 +++++++++++++++++++++++++++++++ include/SDK/DWC/gamespy/nonport.h | 16 +++++++++++++++ include/SDK/NAND/NANDOpenClose.h | 19 ++++++++++++++++++ include/SDK/nand.h | 3 ++- include/code_801DCE6C.h | 12 +++++------ include/libstdc++/CPlusLib.h | 14 ------------- include/libstdc++/qsort.h | 15 -------------- 16 files changed, 193 insertions(+), 127 deletions(-) delete mode 100644 include/GameSpy/darray.h delete mode 100644 include/GameSpy/hashtable.h delete mode 100644 include/GameSpy/nonport.h create mode 100644 include/MSL_C/MSL_Common/qsort.h create mode 100644 include/MSL_C/stdlib.h create mode 100644 include/MSL_C/string.h create mode 100644 include/Runtime/MWCPlusLib.h create mode 100644 include/SDK/DWC/gamespy/darray.h create mode 100644 include/SDK/DWC/gamespy/hashtable.h create mode 100644 include/SDK/DWC/gamespy/nonport.h create mode 100644 include/SDK/NAND/NANDOpenClose.h delete mode 100644 include/libstdc++/CPlusLib.h delete mode 100644 include/libstdc++/qsort.h (limited to 'include') diff --git a/include/GameSpy/darray.h b/include/GameSpy/darray.h deleted file mode 100644 index 5c7c170..0000000 --- a/include/GameSpy/darray.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef POKEREVO_DARRAY_H -#define POKEREVO_DARRAY_H - -#ifdef __cplusplus -extern "C" { -#endif - -typedef s32 (*CompareFunction)(const void *, const void *); -typedef BOOL (*MapFunction)(const void *, s32); -typedef void (*DtorFunction)(void *); - -typedef struct DArray { - s32 size; - s32 capacity; - u32 elemSz; - s32 growAmount; - DtorFunction elemDtor; - char *buf; -} DArray; - -DArray *ArrayNew(u32 elemSz, s32 initialCap, DtorFunction dtor); -void ArrayFree(DArray *d); -s32 ArrayLength(DArray *d); -void *ArrayNth(DArray *d, s32 n); -void ArrayAppend(DArray *d, void *elem); -void ArrayInsertSorted(DArray *d, void *elem, CompareFunction compar); -void ArrayRemoveAt(DArray *d, s32 n); -void ArrayDeleteAt(DArray *d, s32 n); -void ArrayReplaceAt(DArray *d, void *elem, s32 n); -void ArraySort(DArray *d, CompareFunction compar); -s32 ArraySearch(DArray *d, void *elem, CompareFunction cmp, s32 start, s32 doBinarySearch); -void ArrayMapBackwards(DArray *d, MapFunction map, s32 p3); -void *ArrayMapBackwards2(DArray *d, MapFunction map, s32 p3); -void ArrayClear(DArray *d); - -#ifdef __cplusplus -} -#endif - -#endif //POKEREVO_DARRAY_H diff --git a/include/GameSpy/hashtable.h b/include/GameSpy/hashtable.h deleted file mode 100644 index 26e0b6d..0000000 --- a/include/GameSpy/hashtable.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef POKEREVO_HASHTABLE_H -#define POKEREVO_HASHTABLE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "GameSpy/darray.h" - -typedef s32 (*HashFunction)(void *, s32); - -typedef struct HashTable { - DArray **chains; - s32 size; - DtorFunction dtor; - HashFunction hashFunc; - CompareFunction compar; -} HashTable; - -HashTable *TableNew(u32 p1, s32 p2, HashFunction hf, CompareFunction cmp, DtorFunction dtor); -HashTable *TableNew2(u32 p1, s32 size, s32 p3, HashFunction hf, CompareFunction cmp, DtorFunction dtor); -void TableFree(HashTable *table); -s32 TableCount(HashTable *table); -void TableEnter(HashTable *table, void *elem); -BOOL TableRemove(HashTable *table, void *elem); -void *TableLookup(HashTable *table, void *elem); -void TableMapSafe(HashTable *table, MapFunction p2, s32 p3); -void *TableMapSafe2(HashTable *table, MapFunction p2, s32 p3); - -#ifdef __cplusplus -} -#endif - -#endif //POKEREVO_HASHTABLE_H diff --git a/include/GameSpy/nonport.h b/include/GameSpy/nonport.h deleted file mode 100644 index c1ed0e7..0000000 --- a/include/GameSpy/nonport.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEREVO_NONPORT_H -#define POKEREVO_NONPORT_H - -#ifdef __cplusplus -extern "C" { -#endif - -void *gsimalloc(u32 sz); -void *gsirealloc(void *ptr, u32 sz); -void gsifree(void *ptr); - -#ifdef __cplusplus -} -#endif - -#endif //POKEREVO_NONPORT_H diff --git a/include/MSL_C/MSL_Common/qsort.h b/include/MSL_C/MSL_Common/qsort.h new file mode 100644 index 0000000..c13ae0e --- /dev/null +++ b/include/MSL_C/MSL_Common/qsort.h @@ -0,0 +1,15 @@ +#ifndef POKEREVO_QSORT_H +#define POKEREVO_QSORT_H + +#ifdef __cplusplus +extern "C" { +#endif + +void qsort(void *base, u32 nmemb, u32 size, + s32 (*compar)(const void *, const void *)); + +#ifdef __cplusplus +} +#endif + +#endif //POKEREVO_QSORT_H diff --git a/include/MSL_C/stdlib.h b/include/MSL_C/stdlib.h new file mode 100644 index 0000000..bf86bca --- /dev/null +++ b/include/MSL_C/stdlib.h @@ -0,0 +1,15 @@ +#ifndef POKEREVO_STDLIB_H +#define POKEREVO_STDLIB_H + +#ifdef __cplusplus +extern "C" { +#endif + +void qsort(void *base, u32 nmemb, u32 size, + s32 (*compar)(const void *, const void *)); + +#ifdef __cplusplus +} +#endif + +#endif //POKEREVO_STDLIB_H diff --git a/include/MSL_C/string.h b/include/MSL_C/string.h new file mode 100644 index 0000000..83b7bd0 --- /dev/null +++ b/include/MSL_C/string.h @@ -0,0 +1,18 @@ +#ifndef POKEREVO_STRING_H +#define POKEREVO_STRING_H + +#ifdef __cplusplus +extern "C" { +#endif + +void *memset(void *s, int c, size_t n); +void *memmove(void *dest, const void *src, size_t n); +void *memcpy(void *dest, const void *src, size_t n); +int strcmp(const char *s1, const char *s2); +int strncmp(const char *s1, const char *s2, size_t n); + +#ifdef __cplusplus +} +#endif + +#endif //POKEREVO_STRING_H diff --git a/include/Runtime/MWCPlusLib.h b/include/Runtime/MWCPlusLib.h new file mode 100644 index 0000000..819c0a9 --- /dev/null +++ b/include/Runtime/MWCPlusLib.h @@ -0,0 +1,14 @@ +#ifndef POKEREVO_CPLUSLIB_H +#define POKEREVO_CPLUSLIB_H + +#ifdef __cplusplus +extern "C" { +#endif + +void __ptmf_scall(...); + +#ifdef __cplusplus +} +#endif + +#endif //POKEREVO_CPLUSLIB_H diff --git a/include/SDK/DVD/dvdfs.h b/include/SDK/DVD/dvdfs.h index a5283eb..444ae92 100644 --- a/include/SDK/DVD/dvdfs.h +++ b/include/SDK/DVD/dvdfs.h @@ -5,6 +5,18 @@ extern "C" { #endif +// TODO: not a nested class, but a struct from the SDK. Referenced +// by DVDFileInfo +struct gUnkClass6 +{ + u8 unk0; + u8 unk1; + char unk2[0x5]; + char unk7[0x41]; + NANDFileInfo unk48; + u8 unkD3[0xBD]; +}; + typedef struct DVDFileInfo DVDFileInfo; typedef void (*DVDCallback)(s32 result, DVDFileInfo* fileInfo); @@ -13,7 +25,8 @@ struct DVDFileInfo { u8 unk0[0x34]; size_t unk34; - u8 unk38[0x8]; + u8 unk38[0x4]; + gUnkClass6* unk3C; // TODO: determine type void (*unk40)(s32, void*); void* unk44; u32 unk48; diff --git a/include/SDK/DWC/gamespy/darray.h b/include/SDK/DWC/gamespy/darray.h new file mode 100644 index 0000000..5c7c170 --- /dev/null +++ b/include/SDK/DWC/gamespy/darray.h @@ -0,0 +1,40 @@ +#ifndef POKEREVO_DARRAY_H +#define POKEREVO_DARRAY_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef s32 (*CompareFunction)(const void *, const void *); +typedef BOOL (*MapFunction)(const void *, s32); +typedef void (*DtorFunction)(void *); + +typedef struct DArray { + s32 size; + s32 capacity; + u32 elemSz; + s32 growAmount; + DtorFunction elemDtor; + char *buf; +} DArray; + +DArray *ArrayNew(u32 elemSz, s32 initialCap, DtorFunction dtor); +void ArrayFree(DArray *d); +s32 ArrayLength(DArray *d); +void *ArrayNth(DArray *d, s32 n); +void ArrayAppend(DArray *d, void *elem); +void ArrayInsertSorted(DArray *d, void *elem, CompareFunction compar); +void ArrayRemoveAt(DArray *d, s32 n); +void ArrayDeleteAt(DArray *d, s32 n); +void ArrayReplaceAt(DArray *d, void *elem, s32 n); +void ArraySort(DArray *d, CompareFunction compar); +s32 ArraySearch(DArray *d, void *elem, CompareFunction cmp, s32 start, s32 doBinarySearch); +void ArrayMapBackwards(DArray *d, MapFunction map, s32 p3); +void *ArrayMapBackwards2(DArray *d, MapFunction map, s32 p3); +void ArrayClear(DArray *d); + +#ifdef __cplusplus +} +#endif + +#endif //POKEREVO_DARRAY_H diff --git a/include/SDK/DWC/gamespy/hashtable.h b/include/SDK/DWC/gamespy/hashtable.h new file mode 100644 index 0000000..beb4812 --- /dev/null +++ b/include/SDK/DWC/gamespy/hashtable.h @@ -0,0 +1,34 @@ +#ifndef POKEREVO_HASHTABLE_H +#define POKEREVO_HASHTABLE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +typedef s32 (*HashFunction)(void *, s32); + +typedef struct HashTable { + DArray **chains; + s32 size; + DtorFunction dtor; + HashFunction hashFunc; + CompareFunction compar; +} HashTable; + +HashTable *TableNew(u32 p1, s32 p2, HashFunction hf, CompareFunction cmp, DtorFunction dtor); +HashTable *TableNew2(u32 p1, s32 size, s32 p3, HashFunction hf, CompareFunction cmp, DtorFunction dtor); +void TableFree(HashTable *table); +s32 TableCount(HashTable *table); +void TableEnter(HashTable *table, void *elem); +BOOL TableRemove(HashTable *table, void *elem); +void *TableLookup(HashTable *table, void *elem); +void TableMapSafe(HashTable *table, MapFunction p2, s32 p3); +void *TableMapSafe2(HashTable *table, MapFunction p2, s32 p3); + +#ifdef __cplusplus +} +#endif + +#endif //POKEREVO_HASHTABLE_H diff --git a/include/SDK/DWC/gamespy/nonport.h b/include/SDK/DWC/gamespy/nonport.h new file mode 100644 index 0000000..c1ed0e7 --- /dev/null +++ b/include/SDK/DWC/gamespy/nonport.h @@ -0,0 +1,16 @@ +#ifndef POKEREVO_NONPORT_H +#define POKEREVO_NONPORT_H + +#ifdef __cplusplus +extern "C" { +#endif + +void *gsimalloc(u32 sz); +void *gsirealloc(void *ptr, u32 sz); +void gsifree(void *ptr); + +#ifdef __cplusplus +} +#endif + +#endif //POKEREVO_NONPORT_H diff --git a/include/SDK/NAND/NANDOpenClose.h b/include/SDK/NAND/NANDOpenClose.h new file mode 100644 index 0000000..2a93acd --- /dev/null +++ b/include/SDK/NAND/NANDOpenClose.h @@ -0,0 +1,19 @@ +#ifndef POKEREVO_NANDOPENCLOSE_H +#define POKEREVO_NANDOPENCLOSE_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct NANDFileInfo +{ + u8 unk0[0x8B]; // TODO: determine actual size +} NANDFileInfo; + +s32 NANDOpen(const char* path, NANDFileInfo* info, u8 accType); + +#ifdef __cplusplus +} +#endif + +#endif //POKEREVO_NANDOPENCLOSE_H diff --git a/include/SDK/nand.h b/include/SDK/nand.h index c20ee68..463ef89 100644 --- a/include/SDK/nand.h +++ b/include/SDK/nand.h @@ -5,7 +5,8 @@ extern "C" { #endif -#include "SDK/NAND/NANDCore.h" +#include +#include #ifdef __cplusplus } diff --git a/include/code_801DCE6C.h b/include/code_801DCE6C.h index f06b185..de1243f 100644 --- a/include/code_801DCE6C.h +++ b/include/code_801DCE6C.h @@ -5,19 +5,19 @@ extern "C" { #endif +#include #include "code_801DBE90.h" +// array of 8 0x190 byte structs struct gUnkClass4 { - u8 unk0[0x2]; - char unk2[0x5]; - char unk7[0xC79]; - + gUnkClass6 arr[0x8]; + gUnkClass4(void); }; -u32 func_801DCF74(gUnkClass4*, const char*, gUnkClass5*); -u32 func_801DCF48(gUnkClass4*, const char*); +BOOL func_801DCF74(gUnkClass4*, const char*, gUnkClass5*); +BOOL func_801DCF48(gUnkClass4*, const char*); s32 func_801DD084(gUnkClass4* p1, gUnkClass5* p2, void* addr, s32 length, s32 offset); void* func_801DD220(gUnkClass4*, gUnkClass5*, void*, u32, s32); u32 func_801DCFE4(gUnkClass4*, gUnkClass5*); diff --git a/include/libstdc++/CPlusLib.h b/include/libstdc++/CPlusLib.h deleted file mode 100644 index 819c0a9..0000000 --- a/include/libstdc++/CPlusLib.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef POKEREVO_CPLUSLIB_H -#define POKEREVO_CPLUSLIB_H - -#ifdef __cplusplus -extern "C" { -#endif - -void __ptmf_scall(...); - -#ifdef __cplusplus -} -#endif - -#endif //POKEREVO_CPLUSLIB_H diff --git a/include/libstdc++/qsort.h b/include/libstdc++/qsort.h deleted file mode 100644 index c13ae0e..0000000 --- a/include/libstdc++/qsort.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef POKEREVO_QSORT_H -#define POKEREVO_QSORT_H - -#ifdef __cplusplus -extern "C" { -#endif - -void qsort(void *base, u32 nmemb, u32 size, - s32 (*compar)(const void *, const void *)); - -#ifdef __cplusplus -} -#endif - -#endif //POKEREVO_QSORT_H -- cgit v1.2.3 From d96e18f2d6f0c92639929523051d3bd2c787333b Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 30 Oct 2020 02:05:35 -0400 Subject: match up to func_801DD294 --- include/MSL_C/string.h | 4 ++++ include/SDK/DVD/dvdfs.h | 21 +++------------------ include/SDK/NAND/NANDOpenClose.h | 6 ++---- include/SDK/NAND/nand.h | 38 ++++++++++++++++++++++++++++++++++++++ include/SDK/nand.h | 1 + include/code_801DBE90.h | 23 ++++++++++++++++++++--- include/code_801DCE6C.h | 8 ++++---- 7 files changed, 72 insertions(+), 29 deletions(-) create mode 100644 include/SDK/NAND/nand.h (limited to 'include') diff --git a/include/MSL_C/string.h b/include/MSL_C/string.h index 83b7bd0..7b4755c 100644 --- a/include/MSL_C/string.h +++ b/include/MSL_C/string.h @@ -10,6 +10,10 @@ void *memmove(void *dest, const void *src, size_t n); void *memcpy(void *dest, const void *src, size_t n); int strcmp(const char *s1, const char *s2); int strncmp(const char *s1, const char *s2, size_t n); +char *strcpy(char *dest, const char *src); +char *strncpy(char *dest, const char *src, size_t n); +char *strcat(char *dest, const char *src); +char *strncat(char *dest, const char *src, size_t n); #ifdef __cplusplus } diff --git a/include/SDK/DVD/dvdfs.h b/include/SDK/DVD/dvdfs.h index 444ae92..8687730 100644 --- a/include/SDK/DVD/dvdfs.h +++ b/include/SDK/DVD/dvdfs.h @@ -5,31 +5,16 @@ extern "C" { #endif -// TODO: not a nested class, but a struct from the SDK. Referenced -// by DVDFileInfo -struct gUnkClass6 -{ - u8 unk0; - u8 unk1; - char unk2[0x5]; - char unk7[0x41]; - NANDFileInfo unk48; - u8 unkD3[0xBD]; -}; - typedef struct DVDFileInfo DVDFileInfo; typedef void (*DVDCallback)(s32 result, DVDFileInfo* fileInfo); +// sizeof DVDFileInfo >= 0x3C struct DVDFileInfo { u8 unk0[0x34]; - size_t unk34; + size_t fileSz; u8 unk38[0x4]; - gUnkClass6* unk3C; // TODO: determine type - void (*unk40)(s32, void*); - void* unk44; - u32 unk48; }; BOOL DVDOpen(const char*, DVDFileInfo*); @@ -39,7 +24,7 @@ s32 DVDReadPrio(DVDFileInfo* fileInfo, void* addr, s32 length, s32 offset, s32 p s32 DVDReadAsyncPrio(DVDFileInfo* fileInfo, void* addr, s32 length, s32 offset, DVDCallback callback, s32 prio); s32 DVDSeekAsyncPrio(DVDFileInfo* fileInfo, s32 offset, DVDCallback callback, s32 prio); - +#define DVDGetLength(info) ((info)->fileSz) #ifdef __cplusplus } diff --git a/include/SDK/NAND/NANDOpenClose.h b/include/SDK/NAND/NANDOpenClose.h index 2a93acd..2b5f52f 100644 --- a/include/SDK/NAND/NANDOpenClose.h +++ b/include/SDK/NAND/NANDOpenClose.h @@ -5,12 +5,10 @@ extern "C" { #endif -typedef struct NANDFileInfo -{ - u8 unk0[0x8B]; // TODO: determine actual size -} NANDFileInfo; +#include s32 NANDOpen(const char* path, NANDFileInfo* info, u8 accType); +s32 NANDClose(NANDFileInfo* info); #ifdef __cplusplus } diff --git a/include/SDK/NAND/nand.h b/include/SDK/NAND/nand.h new file mode 100644 index 0000000..bc22279 --- /dev/null +++ b/include/SDK/NAND/nand.h @@ -0,0 +1,38 @@ +#ifndef POKEREVO_NAND_NAND_H +#define POKEREVO_NAND_NAND_H + +#ifdef __cplusplus +extern "C" { +#endif + +// TODO: size >= 0x8B +typedef struct NANDFileInfo +{ + u8 unk0[0x8C]; +} NANDFileInfo; + +// TODO: no idea of size yet +typedef struct NANDCommandBlock +{ + u8 unk0[0x4]; +} NANDCommandBlock; + +typedef void (*NANDCallback)(s32 result, NANDCommandBlock* block); + +s32 NANDGetLength(NANDFileInfo* info, u32* length); +s32 NANDSeek(NANDFileInfo* info, s32 offset, s32 whence); +s32 NANDSeekAsync(NANDFileInfo* info, s32 offset, s32 whence, NANDCallback cb, NANDCommandBlock* block); +s32 NANDRead(NANDFileInfo* info, void* buf, u32 length); +s32 NANDReadAsync(NANDFileInfo* info, void* buf, u32 length, NANDCallback cb, NANDCommandBlock* block); +void* NANDGetUserData(const NANDCommandBlock* block); +void NANDSetUserData(NANDCommandBlock* block, void* data); +s32 NANDCreate(const char* fileName, u8 perm, u8 attr); +s32 NANDWrite(NANDFileInfo* info, const void* buf, u32 length); + + + +#ifdef __cplusplus +} +#endif + +#endif //POKEREVO_NAND_NAND_H diff --git a/include/SDK/nand.h b/include/SDK/nand.h index 463ef89..1e055e2 100644 --- a/include/SDK/nand.h +++ b/include/SDK/nand.h @@ -5,6 +5,7 @@ extern "C" { #endif +#include #include #include diff --git a/include/code_801DBE90.h b/include/code_801DBE90.h index 49889e7..bc026d9 100644 --- a/include/code_801DBE90.h +++ b/include/code_801DBE90.h @@ -8,12 +8,29 @@ extern "C" { #include "SDK/dvd.h" #include "SDK/mem.h" -struct gUnkClass5 +// TODO: nested class? +// move to code_801DCE6C header? +struct gUnkClass6 { u8 unk0; u8 unk1; + char unk2[0x5]; + char unk7[0x41]; + NANDFileInfo unk48; + NANDCommandBlock block; + u8 unkD8[0xB8]; +}; + +struct gUnkClass5 +{ + u8 unk0; + u8 unk1; // flag: indicates NAND file opened/closed? u8 unk2[0x2]; DVDFileInfo unk4; + gUnkClass6* unk40; // TODO: determine type + void (*unk44)(s32, void*); + void* unk48; // NANDReadAsync addr + u32 unk4C; // NANDReadAsync size }; BOOL func_801DC0C8(size_t p1, u32 p2); @@ -26,12 +43,12 @@ BOOL func_801DC6C4(gUnkClass5* p1); size_t func_801DC760(gUnkClass5* p1); BOOL func_801DC7F8(gUnkClass5* p1, s32 offset, void (*p3)(s32, void*)); u8* func_801DCBC0(const char* fileName, u32* fileSz); -void* func_801DCCAC(const char* fileName, MEMHeapHandle heap, u32* fileSz); +u8* func_801DCCAC(const char* fileName, MEMHeapHandle heap, u32* fileSz); BOOL func_801DCD94(const char* fileName); void func_801DCDB8(void (*p1)(u32), void (*p2)(void)); u32 func_801DCDC4(void); void func_801DCE38(void); -u8 func_801DCE44(void); +BOOL func_801DCE44(void); #ifdef __cplusplus } diff --git a/include/code_801DCE6C.h b/include/code_801DCE6C.h index de1243f..b6f1130 100644 --- a/include/code_801DCE6C.h +++ b/include/code_801DCE6C.h @@ -18,10 +18,10 @@ struct gUnkClass4 BOOL func_801DCF74(gUnkClass4*, const char*, gUnkClass5*); BOOL func_801DCF48(gUnkClass4*, const char*); -s32 func_801DD084(gUnkClass4* p1, gUnkClass5* p2, void* addr, s32 length, s32 offset); -void* func_801DD220(gUnkClass4*, gUnkClass5*, void*, u32, s32); -u32 func_801DCFE4(gUnkClass4*, gUnkClass5*); -u32 func_801DD03C(gUnkClass4*, gUnkClass5*, u32*); +s32 func_801DD084(gUnkClass4* p1, gUnkClass5* fp, void* addr, s32 length, s32 offset); +BOOL func_801DD220(gUnkClass4*, gUnkClass5*, void*, u32, s32); +BOOL func_801DCFE4(gUnkClass4*, gUnkClass5* fp); +BOOL func_801DD03C(gUnkClass4* p1, gUnkClass5* fp, u32* fileSz); BOOL func_801DD294(gUnkClass4*, const char*, s32); #ifdef __cplusplus -- cgit v1.2.3 From e5e4451cfcf8b03153fd11a620460f66b4840ba6 Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 31 Oct 2020 18:08:27 -0400 Subject: refactor as code_801DCE6C to C++ --- include/SDK/NAND/nand.h | 4 ++-- include/code_801DBE90.h | 14 +------------- include/code_801DCE6C.h | 39 +++++++++++++++++++++++++++------------ 3 files changed, 30 insertions(+), 27 deletions(-) (limited to 'include') diff --git a/include/SDK/NAND/nand.h b/include/SDK/NAND/nand.h index bc22279..ac2f655 100644 --- a/include/SDK/NAND/nand.h +++ b/include/SDK/NAND/nand.h @@ -5,13 +5,13 @@ extern "C" { #endif -// TODO: size >= 0x8B +// NOTE: size >= 0x8B, putting 0x8C for now typedef struct NANDFileInfo { u8 unk0[0x8C]; } NANDFileInfo; -// TODO: no idea of size yet +// TODO: placeholder size typedef struct NANDCommandBlock { u8 unk0[0x4]; diff --git a/include/code_801DBE90.h b/include/code_801DBE90.h index bc026d9..3531815 100644 --- a/include/code_801DBE90.h +++ b/include/code_801DBE90.h @@ -7,19 +7,7 @@ extern "C" { #include "SDK/dvd.h" #include "SDK/mem.h" - -// TODO: nested class? -// move to code_801DCE6C header? -struct gUnkClass6 -{ - u8 unk0; - u8 unk1; - char unk2[0x5]; - char unk7[0x41]; - NANDFileInfo unk48; - NANDCommandBlock block; - u8 unkD8[0xB8]; -}; +#include "code_801DCE6C.h" struct gUnkClass5 { diff --git a/include/code_801DCE6C.h b/include/code_801DCE6C.h index b6f1130..9a9515c 100644 --- a/include/code_801DCE6C.h +++ b/include/code_801DCE6C.h @@ -6,24 +6,39 @@ extern "C" { #endif #include -#include "code_801DBE90.h" -// array of 8 0x190 byte structs -struct gUnkClass4 +struct gUnkClass5; + +struct gUnkClass6 { - gUnkClass6 arr[0x8]; + u8 unk0; + u8 unk1; + char unk2[0x46]; + NANDFileInfo unk48; + NANDCommandBlock block; + u8 unkD8[0xB8]; + + const char* func_801DCE6C(void) const; + const char* func_801DCE74(void) const; +}; +class gUnkClass4 +{ + enum { ArrLength_ = 8 }; + gUnkClass6 arr_[ArrLength_]; + + gUnkClass6* func_801DCEB4(const char* p2); +public: gUnkClass4(void); + BOOL func_801DCF48(const char* p2); + BOOL func_801DCF74(const char* fileName, gUnkClass5* fp); + BOOL func_801DCFE4(gUnkClass5* fp) const; + BOOL func_801DD03C(gUnkClass5* fp, u32* fileSz) const; + s32 func_801DD084(gUnkClass5* fp, void* addr, s32 length, s32 offset) const; + BOOL func_801DD220(gUnkClass5* fp, void*, u32, s32 offset) const; + BOOL func_801DD294(const char *fileName, s32); }; -BOOL func_801DCF74(gUnkClass4*, const char*, gUnkClass5*); -BOOL func_801DCF48(gUnkClass4*, const char*); -s32 func_801DD084(gUnkClass4* p1, gUnkClass5* fp, void* addr, s32 length, s32 offset); -BOOL func_801DD220(gUnkClass4*, gUnkClass5*, void*, u32, s32); -BOOL func_801DCFE4(gUnkClass4*, gUnkClass5* fp); -BOOL func_801DD03C(gUnkClass4* p1, gUnkClass5* fp, u32* fileSz); -BOOL func_801DD294(gUnkClass4*, const char*, s32); - #ifdef __cplusplus } #endif -- cgit v1.2.3 From 19716fa67dc6c35ba300304733f2269dbed59bd2 Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 31 Oct 2020 18:10:41 -0400 Subject: add include to ptmf.c --- include/Runtime/MWCPlusLib.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/Runtime/MWCPlusLib.h b/include/Runtime/MWCPlusLib.h index 819c0a9..f8ede23 100644 --- a/include/Runtime/MWCPlusLib.h +++ b/include/Runtime/MWCPlusLib.h @@ -1,5 +1,5 @@ -#ifndef POKEREVO_CPLUSLIB_H -#define POKEREVO_CPLUSLIB_H +#ifndef POKEREVO_MWCPLUSLIB_H +#define POKEREVO_MWCPLUSLIB_H #ifdef __cplusplus extern "C" { @@ -11,4 +11,4 @@ void __ptmf_scall(...); } #endif -#endif //POKEREVO_CPLUSLIB_H +#endif //POKEREVO_MWCPLUSLIB_H -- cgit v1.2.3 From 9ba8186ce645c468f66eed98034db0127f3e3199 Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 31 Oct 2020 18:16:42 -0400 Subject: remove unneeded extern C --- include/code_801DCE6C.h | 8 -------- 1 file changed, 8 deletions(-) (limited to 'include') diff --git a/include/code_801DCE6C.h b/include/code_801DCE6C.h index 9a9515c..a9e90cb 100644 --- a/include/code_801DCE6C.h +++ b/include/code_801DCE6C.h @@ -1,10 +1,6 @@ #ifndef POKEREVO_CODE_801DCE6C_H #define POKEREVO_CODE_801DCE6C_H -#ifdef __cplusplus -extern "C" { -#endif - #include struct gUnkClass5; @@ -39,8 +35,4 @@ public: BOOL func_801DD294(const char *fileName, s32); }; -#ifdef __cplusplus -} -#endif - #endif //POKEREVO_CODE_801DCE6C_H -- cgit v1.2.3