summaryrefslogtreecommitdiff
path: root/arm9/lib/include/FS_overlay.h
diff options
context:
space:
mode:
authorPikalaxALT <PikalaxALT@users.noreply.github.com>2020-05-09 12:19:21 -0400
committerGitHub <noreply@github.com>2020-05-09 12:19:21 -0400
commit4a32bb288b5af3333a47e33d1ba9a83485ff1052 (patch)
treebb77ed81792d2e4dfe4370eb45ee0a53a3f02626 /arm9/lib/include/FS_overlay.h
parentf76cec09f8a2995244256d4b097d9eed2bebd34a (diff)
parente660f7a7f749242dc73851d47e806b96783bc47d (diff)
Merge pull request #65 from PikalaxALT/libfs
Libfs
Diffstat (limited to 'arm9/lib/include/FS_overlay.h')
-rw-r--r--arm9/lib/include/FS_overlay.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/arm9/lib/include/FS_overlay.h b/arm9/lib/include/FS_overlay.h
new file mode 100644
index 00000000..6025d04a
--- /dev/null
+++ b/arm9/lib/include/FS_overlay.h
@@ -0,0 +1,55 @@
+#ifndef NITRO_FS_OVERLAY_H_
+#define NITRO_FS_OVERLAY_H_
+
+#include "nitro.h"
+#include "MI_exMemory.h"
+#include "FS_file.h"
+#include "CARD_rom.h"
+
+typedef u32 FSOverlayID;
+
+typedef void (*FSOverlayInitFunc) (void);
+
+typedef struct FSOverlayInfoHeader
+{
+ u32 id;
+ u8 *ram_address;
+ u32 ram_size;
+ u32 bss_size;
+ FSOverlayInitFunc *sinit_init;
+ FSOverlayInitFunc *sinit_init_end;
+ u32 file_id;
+ u32 compressed:24;
+ u32 flag:8;
+} FSOverlayInfoHeader;
+
+typedef struct FSOverlayInfo
+{
+ FSOverlayInfoHeader header;
+ MIProcessor target;
+ CARDRomRegion file_pos;
+} FSOverlayInfo;
+
+static inline u8 *const FS_GetOverlayAddress(FSOverlayInfo * p_ovi)
+{
+ return p_ovi->header.ram_address;
+}
+
+static inline u32 const FS_GetOverlayImageSize(FSOverlayInfo * p_ovi)
+{
+ return p_ovi->header.ram_size;
+}
+
+static inline u32 const FS_GetOverlayTotalSize(FSOverlayInfo * p_ovi)
+{
+ return p_ovi->header.ram_size + p_ovi->header.bss_size;
+}
+
+BOOL FS_LoadOverlayInfo(FSOverlayInfo *p_ovi, MIProcessor target, FSOverlayID id);
+BOOL FS_LoadOverlay(MIProcessor target, FSOverlayID id);
+BOOL FS_UnloadOverlay(MIProcessor target, FSOverlayID id);
+BOOL FS_LoadOverlayImage(FSOverlayInfo *p_ovi);
+void FS_StartOverlay(FSOverlayInfo *p_ovi);
+BOOL FS_LoadOverlayImageAsync(FSOverlayInfo *p_ovi, FSFile *p_file);
+
+#endif //NITRO_FS_OVERLAY_H_