diff options
author | red031000 <rubenru09@aol.com> | 2020-05-12 23:12:35 +0100 |
---|---|---|
committer | red031000 <rubenru09@aol.com> | 2020-05-12 23:12:35 +0100 |
commit | 59171916421e659bcb35b1b47eaf748fac2fea6d (patch) | |
tree | fd5886b4a76002766c94a5d33a1a42fd14335e0e /arm9/lib/include/FS_overlay.h | |
parent | 26b7a78d02b261256e420f149bb7bae66e392ee7 (diff) | |
parent | f4ea052ed0b4e3b0d6a3c12bce46ee53228a9bc0 (diff) |
Merge branch 'master' of https://github.com/martmists/pokediamond into overlay69
Diffstat (limited to 'arm9/lib/include/FS_overlay.h')
-rw-r--r-- | arm9/lib/include/FS_overlay.h | 71 |
1 files changed, 71 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..14c7ce66 --- /dev/null +++ b/arm9/lib/include/FS_overlay.h @@ -0,0 +1,71 @@ +#ifndef NITRO_FS_OVERLAY_H_ +#define NITRO_FS_OVERLAY_H_ + +#if defined(__cplusplus) +extern "C" { +#endif + +#include "nitro.h" +#include "MI_exMemory.h" +#include "FS_file.h" +#include "CARD_rom.h" + +typedef u32 FSOverlayID; + +#define FS_EXTERN_OVERLAY(name) extern u32 SDK_OVERLAY_ ## name ## _ID[1] +#define FS_OVERLAY_ID(name) ((u32)&(SDK_OVERLAY_ ## name ## _ID)) + +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); + +#if defined(__cplusplus) +}; +#endif + +#endif //NITRO_FS_OVERLAY_H_ |