summaryrefslogtreecommitdiff
path: root/src/file_system.c
diff options
context:
space:
mode:
authorsceptillion <33798691+sceptillion@users.noreply.github.com>2017-12-12 00:50:47 -0800
committersceptillion <33798691+sceptillion@users.noreply.github.com>2017-12-12 00:50:47 -0800
commitc418a4585f727f334ed3625cc656764b0c345589 (patch)
tree60cc49a0bea7f9e0176266fe274e9dd53cec7e7a /src/file_system.c
parentd08ba1f0231ea44410601aebfd1b8e43a4ba8042 (diff)
decompile rest of file_system
Diffstat (limited to 'src/file_system.c')
-rw-r--r--src/file_system.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/file_system.c b/src/file_system.c
index adddb5e..296478d 100644
--- a/src/file_system.c
+++ b/src/file_system.c
@@ -19,6 +19,12 @@ struct FileArchive
struct File *entries;
};
+struct SiroArchive
+{
+ u32 magic;
+ u8 *data;
+};
+
extern struct OpenedFile gUnknown_202D2A8[];
extern u32 gUnknown_203B094;
@@ -27,6 +33,7 @@ extern u32 gUnknown_202D2A4;
extern int sprintf(char *, const char *, ...);
u8 *GetSiroPtr(struct OpenedFile *);
+void NDS_DecompressRLE(void *);
void InitFileSystem(void)
{
@@ -143,3 +150,50 @@ struct OpenedFile *Call_OpenFileAndGetFileDataPtr(char *filename, struct FileArc
{
return OpenFileAndGetFileDataPtr(filename, arc);
}
+
+void CloseFile(struct OpenedFile *openedFile)
+{
+ s32 i;
+
+ for (i = 0; i < 64; i++)
+ {
+ if (&gUnknown_202D2A8[i] == openedFile)
+ {
+ gUnknown_202D2A8[i].file = NULL;
+ gUnknown_202D2A8[i].data = NULL;
+ gUnknown_203B094 = i;
+ return;
+ }
+ }
+}
+
+u8 *GetSiroPtr(struct OpenedFile *openedFile)
+{
+ struct SiroArchive *siro = (struct SiroArchive *)openedFile->data;
+
+ if (siro->magic == 0x30524953)
+ {
+ NDS_DecompressRLE(openedFile->data);
+ }
+ else if (siro->magic != 0x4F524953)
+ {
+ return openedFile->data;
+ }
+
+ openedFile->data = siro->data;
+
+ return openedFile->data;
+}
+
+void *UnusedGetSir0Ptr(struct SiroArchive *siro)
+{
+ if (siro->magic != 0x30524953)
+ return siro;
+
+ NDS_DecompressRLE(siro);
+ return siro->data;
+}
+
+void NDS_DecompressRLE(void *unused)
+{
+}