Starship/include/sf64dma.h
Alejandro Asenjo Nitti 1cc17481e9
File splits and names (#82)
* working file splits

* ovl_i2

* func_E08400_80187520

* working so far

* resolve conflicts

* .

* i2 working

* i1 working

* i1

* ovl_i1

* fox_i2

* i5 split

* i5 good

* ovl_i6

* split bss in ovl_menu

* so far, so good

* maaaan...

* ovl_unused

* ovl_i4 bss split

* ovl_i4

* ovl_i2

* foxmat!

* import more data and bss

* renamings
2024-01-14 01:30:21 -03:00

190 lines
6.2 KiB
C

#ifndef SF64_DMA
#define SF64_DMA
#include "PR/ultratypes.h"
#include "libc/stdbool.h"
#define DECLARE_VRAM_SEGMENT(name) \
extern u8 name ## _VRAM[]; \
extern u8 name ## _VRAM_END[]
#define DECLARE_ROM_SEGMENT(name) \
extern u8 name ## _ROM_START[]; \
extern u8 name ## _ROM_END[]
#define DECLARE_TEXT_SEGMENT(name) \
extern u8 name ## _TEXT_START[]; \
extern u8 name ## _TEXT_END[]
#define DECLARE_DATA_SEGMENT(name) \
extern u8 name ## _DATA_START[]; \
extern u8 name ## _DATA_END[]; \
extern u8 name ## _DATA_SIZE[]
#define DECLARE_RODATA_SEGMENT(name) \
extern u8 name ## _RODATA_START[]; \
extern u8 name ## _RODATA_END[]
#define DECLARE_BSS_SEGMENT(name) \
extern u8 name ## _BSS_START[]; \
extern u8 name ## _BSS_END[]
#define DECLARE_SEGMENT(name) \
DECLARE_VRAM_SEGMENT(name); \
DECLARE_ROM_SEGMENT(name); \
DECLARE_TEXT_SEGMENT(name); \
DECLARE_DATA_SEGMENT(name); \
DECLARE_RODATA_SEGMENT(name); \
DECLARE_BSS_SEGMENT(name)
#define SEGMENT_VRAM_START(segment) (segment ## _VRAM)
#define SEGMENT_VRAM_END(segment) (segment ## _VRAM_END)
#define SEGMENT_VRAM_SIZE(segment) ((uintptr_t)SEGMENT_VRAM_END(segment) - (uintptr_t)SEGMENT_VRAM_START(segment))
#define SEGMENT_ROM_START(segment) (segment ## _ROM_START)
#define SEGMENT_ROM_END(segment) (segment ## _ROM_END)
#define SEGMENT_ROM_SIZE(segment) ((uintptr_t)SEGMENT_ROM_END(segment) - (uintptr_t)SEGMENT_ROM_START(segment))
#define SEGMENT_TEXT_START(segment) (segment ## _TEXT_START)
#define SEGMENT_TEXT_END(segment) (segment ## _TEXT_END)
#define SEGMENT_TEXT_SIZE(segment) ((uintptr_t)SEGMENT_TEXT_END(segment) - (uintptr_t)SEGMENT_TEXT_START(segment))
#define SEGMENT_DATA_START(segment) (segment ## _DATA_START)
#define SEGMENT_DATA_END(segment) (segment ## _DATA_END)
#define SEGMENT_DATA_SIZE(segment) ((uintptr_t)SEGMENT_DATA_END(segment) - (uintptr_t)SEGMENT_DATA_START(segment))
#define SEGMENT_DATA_SIZE_CONST(segment) (segment ## _DATA_SIZE)
#define SEGMENT_RODATA_START(segment) (segment ## _RODATA_START)
#define SEGMENT_RODATA_END(segment) (segment ## _RODATA_END)
#define SEGMENT_RODATA_SIZE(segment) ((uintptr_t)SEGMENT_RODATA_END(segment) - (uintptr_t)SEGMENT_RODATA_START(segment))
#define SEGMENT_RODATA_SIZE_CONST(segment) (segment ## _RODATA_SIZE)
#define SEGMENT_BSS_START(segment) (segment ## _BSS_START)
#define SEGMENT_BSS_END(segment) (segment ## _BSS_END)
#define SEGMENT_BSS_SIZE(segment) ((uintptr_t)SEGMENT_BSS_END(segment) - (uintptr_t)SEGMENT_BSS_START(segment))
u8 Overlay_Load(u8, u8);
void Overlay_InitDma(void);
typedef struct {
/* 0x0 */ void* start;
/* 0x4 */ void* end;
} SegmentOffset; // size = 0x8
typedef struct {
/* 0x00 */ SegmentOffset rom;
/* 0x08 */ SegmentOffset bss;
/* 0x10 */ SegmentOffset text;
/* 0x18 */ SegmentOffset data;
} OverlayOffsets; // size = 0x20
typedef struct {
/* 0x00 */ OverlayOffsets ovl;
/* 0x20 */ SegmentOffset assets[15];
} OverlayInit; // size = 0x98
typedef struct {
/* 0x0 */ void* vRomAddress;
/* 0x8 */ SegmentOffset pRom;
/* 0xC */ s32 compFlag;
} DmaEntry; // size = 0x10;
extern DmaEntry gDmaTable[]; // 178A70
extern OverlayInit sNoOvl_Logo[1]; // sets segment 15 with no overlay
extern OverlayInit sOvlEF0260_Credits[6]; // overlay EF0260
extern OverlayInit sOvlmenu_Title[1]; // EBFBE0
extern OverlayInit sOvlmenu_Menu[1]; // EBFBE0
extern OverlayInit sOvlmenu_Map[1]; // EBFBE0
extern OverlayInit sOvlmenu_State5[1]; // EBFBE0
extern OverlayInit sOvli1_Corneria[1]; // fox_i1
extern OverlayInit sOvli2_Meteo[2]; // fox_i2
extern OverlayInit sOvli5_Titania[6]; // E6A810
extern OverlayInit sOvli2_SectorX[2]; // fox_i2
extern OverlayInit sOvli4_SectorZ[1]; // i4
extern OverlayInit sOvli3_Aquas[1]; // i3
extern OverlayInit sOvli3_Area6[1]; // i3
extern OverlayInit sOvli4_Fortuna[2]; // i4
extern OverlayInit sOvli3_Unk4[1]; // i3
extern OverlayInit sOvlE9F1D0_SectorY[1]; // E9F1D0
extern OverlayInit sOvli3_Solar[1]; // i3
extern OverlayInit sOvli3_Zoness[1]; // i3
extern OverlayInit sOvli1_Venom1[1]; // fox_i1
extern OverlayInit sOvlE9F1D0_Venom2[1]; // E9F1D0
extern OverlayInit sOvlE9F1D0_VenomSW[2]; // E9F1D0
extern OverlayInit sOvli2_Setup20[1]; // fox_i2
extern OverlayInit sOvli4_Bolse[1]; // i4
extern OverlayInit sOvli4_Katina[1]; // i4
extern OverlayInit sOvli5_Macbeth[2]; // E6A810
extern OverlayInit sOvli1_Training[1]; // fox_i1
extern OverlayInit sOvli2_Versus[2]; // fox_i2
extern OverlayInit sEFFA40_Overlay[1]; // EFFA40
DECLARE_SEGMENT(makerom);
DECLARE_SEGMENT(main);
DECLARE_SEGMENT(dma_table);
DECLARE_SEGMENT(audio_seq);
DECLARE_SEGMENT(audio_bank);
DECLARE_SEGMENT(audio_table);
DECLARE_SEGMENT(ast_873CB0);
DECLARE_SEGMENT(ast_8A68C0);
DECLARE_SEGMENT(ast_8AE0A0);
DECLARE_SEGMENT(ast_8BFC00);
DECLARE_SEGMENT(ast_8D99F0);
DECLARE_SEGMENT(ast_8E1F80);
DECLARE_SEGMENT(ast_8E92D0);
DECLARE_SEGMENT(ast_918430);
DECLARE_SEGMENT(ast_922730);
DECLARE_SEGMENT(ast_92EC40);
DECLARE_SEGMENT(ast_940AD0);
DECLARE_SEGMENT(ast_955270);
DECLARE_SEGMENT(ast_961CE0);
DECLARE_SEGMENT(ast_9A1460);
DECLARE_SEGMENT(ast_9D2FD0);
DECLARE_SEGMENT(ast_9DD390);
DECLARE_SEGMENT(ast_9EB5E0);
DECLARE_SEGMENT(ast_9F4880);
DECLARE_SEGMENT(ast_A049A0);
DECLARE_SEGMENT(ast_A0E340);
DECLARE_SEGMENT(ast_A1D0F0);
DECLARE_SEGMENT(ast_A4FBB0);
DECLARE_SEGMENT(ast_A58F60);
DECLARE_SEGMENT(ast_A8B470);
DECLARE_SEGMENT(ast_AB4000);
DECLARE_SEGMENT(ast_ACF960);
DECLARE_SEGMENT(ast_AE60A0);
DECLARE_SEGMENT(ast_B0AA00);
DECLARE_SEGMENT(ast_B1CA50);
DECLARE_SEGMENT(ast_B2CA50);
DECLARE_SEGMENT(ast_B612E0);
DECLARE_SEGMENT(ast_B84560);
DECLARE_SEGMENT(ast_BB11D0);
DECLARE_SEGMENT(ast_BC23D0);
DECLARE_SEGMENT(ast_BFA740);
DECLARE_SEGMENT(ast_BFC510);
DECLARE_SEGMENT(ast_C48F40);
DECLARE_SEGMENT(ast_CA9DE0);
DECLARE_SEGMENT(ast_CBFE70);
DECLARE_SEGMENT(ast_CD2410);
DECLARE_SEGMENT(ast_CDDCA0);
DECLARE_SEGMENT(ast_CE9E70);
DECLARE_SEGMENT(ast_D25100);
DECLARE_SEGMENT(ast_D27600);
DECLARE_SEGMENT(ast_D43400);
DECLARE_SEGMENT(ast_D68480);
DECLARE_SEGMENT(ast_D91F10);
DECLARE_SEGMENT(ast_DDC010);
DECLARE_SEGMENT(ast_DE5D50);
DECLARE_SEGMENT(ovl_i1);
DECLARE_SEGMENT(ovl_i2);
DECLARE_SEGMENT(ovl_i3);
DECLARE_SEGMENT(ovl_i4);
DECLARE_SEGMENT(ovl_i5);
DECLARE_SEGMENT(ovl_i6);
DECLARE_SEGMENT(ovl_menu);
DECLARE_SEGMENT(ovl_ending);
DECLARE_SEGMENT(ovl_unused);
#endif