diff options
Diffstat (limited to 'include/SDK')
-rw-r--r-- | include/SDK/DVD/dvdfs.h | 10 | ||||
-rw-r--r-- | include/SDK/DWC/gamespy/darray.h | 40 | ||||
-rw-r--r-- | include/SDK/DWC/gamespy/hashtable.h | 34 | ||||
-rw-r--r-- | include/SDK/DWC/gamespy/nonport.h | 16 | ||||
-rw-r--r-- | include/SDK/NAND/NANDOpenClose.h | 17 | ||||
-rw-r--r-- | include/SDK/NAND/nand.h | 38 | ||||
-rw-r--r-- | include/SDK/nand.h | 4 |
7 files changed, 152 insertions, 7 deletions
diff --git a/include/SDK/DVD/dvdfs.h b/include/SDK/DVD/dvdfs.h index a5283eb..8687730 100644 --- a/include/SDK/DVD/dvdfs.h +++ b/include/SDK/DVD/dvdfs.h @@ -9,14 +9,12 @@ typedef struct DVDFileInfo DVDFileInfo; typedef void (*DVDCallback)(s32 result, DVDFileInfo* fileInfo);
+// sizeof DVDFileInfo >= 0x3C
struct DVDFileInfo
{
u8 unk0[0x34];
- size_t unk34;
- u8 unk38[0x8];
- void (*unk40)(s32, void*);
- void* unk44;
- u32 unk48;
+ size_t fileSz;
+ u8 unk38[0x4];
};
BOOL DVDOpen(const char*, DVDFileInfo*);
@@ -26,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/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 <DWC/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/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..2b5f52f --- /dev/null +++ b/include/SDK/NAND/NANDOpenClose.h @@ -0,0 +1,17 @@ +#ifndef POKEREVO_NANDOPENCLOSE_H
+#define POKEREVO_NANDOPENCLOSE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <SDK/NAND/nand.h>
+
+s32 NANDOpen(const char* path, NANDFileInfo* info, u8 accType);
+s32 NANDClose(NANDFileInfo* info);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //POKEREVO_NANDOPENCLOSE_H
diff --git a/include/SDK/NAND/nand.h b/include/SDK/NAND/nand.h new file mode 100644 index 0000000..ac2f655 --- /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
+
+// NOTE: size >= 0x8B, putting 0x8C for now
+typedef struct NANDFileInfo
+{
+ u8 unk0[0x8C];
+} NANDFileInfo;
+
+// TODO: placeholder size
+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 c20ee68..1e055e2 100644 --- a/include/SDK/nand.h +++ b/include/SDK/nand.h @@ -5,7 +5,9 @@ extern "C" {
#endif
-#include "SDK/NAND/NANDCore.h"
+#include <SDK/NAND/nand.h>
+#include <SDK/NAND/NANDCore.h>
+#include <SDK/NAND/NANDOpenClose.h>
#ifdef __cplusplus
}
|