From 2e4c42719b4dd10b328810cd2c58391063497d41 Mon Sep 17 00:00:00 2001 From: mzxrules Date: Mon, 24 Feb 2025 20:55:55 -0500 Subject: [PATCH] Reduce dependencies on global.h (9) (#2488) * split game states * split all GameState headers * match fig names * deduplicate headers from bad merge * split z64actor.h into z64actor_profile.h, z_actor_dlftbls.h * fix compile error * .bss --- include/console_logo_state.h | 2 +- include/file_select_state.h | 10 +- include/functions.h | 12 -- include/libu64/overlay.h | 2 + include/macros.h | 8 -- include/variables.h | 5 - include/z64actor.h | 106 +----------------- include/z64actor_profile.h | 52 +++++++++ include/z64effect.h | 2 + include/z64game.h | 35 ++---- include/z64sram.h | 3 +- include/z_actor_dlftbls.h | 74 ++++++++++++ include/z_game_dlftbls.h | 37 ++++++ include/zelda_arena.h | 2 + src/boot/z_std_dma.c | 2 +- src/code/fault_gc.c | 4 +- src/code/graph.c | 5 +- src/code/main.c | 4 +- src/code/title_setup.c | 2 +- src/code/z_DLF.c | 7 +- src/code/z_actor.c | 4 +- src/code/z_actor_dlftbls.c | 5 +- src/code/z_bgcheck.c | 2 +- src/code/z_camera.c | 2 +- src/code/z_demo.c | 2 +- src/code/z_effect_soft_sprite.c | 6 +- src/code/z_en_item00.c | 2 +- src/code/z_game_dlftbls.c | 12 +- src/code/z_kaleido_manager.c | 8 +- src/code/z_kaleido_scope_call.c | 4 +- src/code/z_message.c | 2 +- src/code/z_play.c | 7 +- src/code/z_prenmi.c | 8 +- src/code/z_sample.c | 9 +- src/code/z_scene.c | 1 + src/code/z_sram.c | 10 +- src/libu64/load_gc.c | 4 +- src/libu64/loadfragment2_gc.c | 3 +- src/libu64/loadfragment2_n64.c | 4 +- src/libu64/logseverity_gc.c | 2 +- src/libu64/relocation_gc.c | 4 +- .../actors/ovl_Bg_Dodoago/z_bg_dodoago.c | 2 + .../ovl_file_choose/z_file_choose.c | 5 +- .../ovl_file_choose/z_file_copy_erase.c | 2 +- .../ovl_file_choose/z_file_nameset.c | 2 +- .../gamestates/ovl_opening/z_opening.c | 8 +- src/overlays/gamestates/ovl_select/z_select.c | 14 ++- src/overlays/gamestates/ovl_title/z_title.c | 23 ++-- 48 files changed, 310 insertions(+), 221 deletions(-) create mode 100644 include/z64actor_profile.h create mode 100644 include/z_actor_dlftbls.h create mode 100644 include/z_game_dlftbls.h diff --git a/include/console_logo_state.h b/include/console_logo_state.h index 56e8ece646..09b7d66546 100644 --- a/include/console_logo_state.h +++ b/include/console_logo_state.h @@ -3,8 +3,8 @@ #include "ultra64.h" #include "z64game.h" -#include "z64view.h" #include "z64sram.h" +#include "z64view.h" typedef struct ConsoleLogoState { /* 0x0000 */ GameState state; diff --git a/include/file_select_state.h b/include/file_select_state.h index 9a2df3f08e..0a831caa0f 100644 --- a/include/file_select_state.h +++ b/include/file_select_state.h @@ -2,12 +2,12 @@ #define FILE_SELECT_STATE_H #include "ultra64.h" -#include "z64game.h" -#include "z64view.h" -#include "z64sram.h" -#include "z64skybox.h" -#include "z64message.h" #include "z64environment.h" +#include "z64game.h" +#include "z64message.h" +#include "z64skybox.h" +#include "z64sram.h" +#include "z64view.h" typedef struct FileSelectState { /* 0x00000 */ GameState state; diff --git a/include/functions.h b/include/functions.h index 0a8af7f550..fbf16a1eab 100644 --- a/include/functions.h +++ b/include/functions.h @@ -28,12 +28,6 @@ OSPiHandle* osDriveRomInit(void); void Mio0_Decompress(u8* src, u8* dst); void FlagSet_Update(PlayState* play); -void Overlay_LoadGameState(GameStateOverlay* overlayEntry); -void Overlay_FreeGameState(GameStateOverlay* overlayEntry); - -void ActorOverlayTable_LogPrint(void); -void ActorOverlayTable_Init(void); -void ActorOverlayTable_Cleanup(void); void SaveContext_Init(void); @@ -102,12 +96,6 @@ void func_800C213C(PreRender* this, Gfx** gfxP); void PreRender_RestoreFramebuffer(PreRender* this, Gfx** gfxP); void PreRender_CopyImageRegion(PreRender* this, Gfx** gfxP); void PreRender_ApplyFilters(PreRender* this); -void Graph_InitTHGA(GraphicsContext* gfxCtx); -GameStateOverlay* Graph_GetNextGameState(GameState* gameState); -void Graph_Init(GraphicsContext* gfxCtx); -void Graph_Destroy(GraphicsContext* gfxCtx); -void Graph_TaskSet00(GraphicsContext* gfxCtx); -void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState); void Graph_ThreadEntry(void*); ListAlloc* ListAlloc_Init(ListAlloc* this); diff --git a/include/libu64/overlay.h b/include/libu64/overlay.h index 258dfba772..47f3276576 100644 --- a/include/libu64/overlay.h +++ b/include/libu64/overlay.h @@ -33,6 +33,8 @@ typedef struct OverlayRelocationSection { /* 0x14 */ u32 relocations[1]; // size is nRelocations } OverlayRelocationSection; // size >= 0x18 +extern s32 gOverlayLogSeverity; + void* Overlay_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd); void Overlay_Relocate(void* allocatedRamAddr, OverlayRelocationSection* ovlRelocs, void* vramStart); size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd, void* allocatedRamAddr); diff --git a/include/macros.h b/include/macros.h index 22f66810ec..aa81ef061b 100644 --- a/include/macros.h +++ b/include/macros.h @@ -89,14 +89,6 @@ #define PRINTF_RST() (void)0 #endif -#define SET_NEXT_GAMESTATE(curState, newInit, newStruct) \ - if (1) { \ - GameState* state = curState; \ - \ - (state)->init = newInit; \ - (state)->size = sizeof(newStruct); \ - } (void)0 - #if DEBUG_FEATURES #define DMA_REQUEST_SYNC(ram, vrom, size, file, line) DmaMgr_RequestSyncDebug(ram, vrom, size, file, line) #define DMA_REQUEST_ASYNC(req, ram, vrom, size, unk5, queue, msg, file, line) DmaMgr_RequestAsyncDebug(req, ram, vrom, size, unk5, queue, msg, file, line) diff --git a/include/variables.h b/include/variables.h index f4ecad468a..ea5d188a6e 100644 --- a/include/variables.h +++ b/include/variables.h @@ -65,10 +65,6 @@ extern OSTime __osCurrentTime; extern u32 __osBaseCounter; extern u32 __osViIntrCount; extern u32 __osTimerCounter; -extern EffectSsOverlay gEffectSsOverlayTable[EFFECT_SS_TYPE_MAX]; -extern ActorOverlay gActorOverlayTable[ACTOR_ID_MAX]; // original name: "actor_dlftbls" 801162A0 -extern s32 gMaxActorId; // original name: "MaxProfile" -extern s32 gZeldaArenaLogSeverity; extern MapData gMapDataTable; extern s16 gSpoilingItems[3]; extern s16 gSpoilingItemReverts[3]; @@ -134,7 +130,6 @@ extern u8 gSoundModeList[]; extern u8 gAudioSpecId; extern u8 D_80133418; extern AudioSpec gAudioSpecs[18]; -extern s32 gOverlayLogSeverity; extern s32 gSystemArenaLogSeverity; extern u8 __osPfsInodeCacheBank; extern s32 __osPfsLastChannel; diff --git a/include/z64actor.h b/include/z64actor.h index 0cd73a8310..8986c801ce 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -3,6 +3,7 @@ #include "color.h" #include "romfile.h" +#include "z64actor_profile.h" #include "z64animation.h" #include "z64math.h" #include "z64collision_check.h" @@ -23,88 +24,16 @@ struct Actor; struct ActorEntry; +struct ActorOverlay; struct CollisionPoly; struct Lights; struct Player; struct PlayState; -typedef void (*ActorFunc)(struct Actor*, struct PlayState*); typedef void (*ActorShadowFunc)(struct Actor*, struct Lights*, struct PlayState*); typedef u16 (*NpcGetTextIdFunc)(struct PlayState*, struct Actor*); typedef s16 (*NpcUpdateTalkStateFunc)(struct PlayState*, struct Actor*); -typedef struct ActorProfile { - /* 0x00 */ s16 id; - /* 0x02 */ u8 category; // Classifies actor and determines when it will update or draw - /* 0x04 */ u32 flags; - /* 0x08 */ s16 objectId; - /* 0x0C */ u32 instanceSize; - /* 0x10 */ ActorFunc init; // Constructor - /* 0x14 */ ActorFunc destroy; // Destructor - /* 0x18 */ ActorFunc update; // Update Function - /* 0x1C */ ActorFunc draw; // Draw function -} ActorProfile; // size = 0x20 - -/** - * @see ACTOROVL_ALLOC_ABSOLUTE - */ -#if DEBUG_FEATURES -#define ACTOROVL_ABSOLUTE_SPACE_SIZE 0x27A0 -#else -#define ACTOROVL_ABSOLUTE_SPACE_SIZE 0x24E0 -#endif - -/** - * The actor overlay should be allocated memory for when loading, - * and the memory deallocated when there is no more actor using the overlay. - * - * `ACTOROVL_ALLOC_` defines indicate how an actor overlay should be loaded. - * - * @note Bitwise or-ing `ACTOROVL_ALLOC_` types is not meaningful. - * The `ACTOROVL_ALLOC_` types are 0, 1, 2 but checked against with a bitwise and. - * - * @see ACTOROVL_ALLOC_ABSOLUTE - * @see ACTOROVL_ALLOC_PERSISTENT - * @see actor_table.h - */ -#define ACTOROVL_ALLOC_NORMAL 0 - -/** - * The actor overlay should be loaded to "absolute space". - * - * Absolute space is a fixed amount of memory allocated once. - * The overlay will still need to be loaded again if at some point there is no more actor using the overlay. - * - * @note Only one such overlay may be loaded at a time. - * This is not checked: a newly loaded overlay will overwrite the previous one in absolute space, - * even if actors are still relying on the previous one. Actors using absolute-allocated overlays should be deleted - * when another absolute-allocated overlay is about to be used. - * - * @see ACTOROVL_ABSOLUTE_SPACE_SIZE - * @see ActorContext.absoluteSpace - * @see ACTOROVL_ALLOC_NORMAL - */ -#define ACTOROVL_ALLOC_ABSOLUTE (1 << 0) - -/** - * The actor overlay should be loaded persistently. - * It will stay loaded until the current game state instance ends. - * - * @see ACTOROVL_ALLOC_NORMAL - */ -#define ACTOROVL_ALLOC_PERSISTENT (1 << 1) - -typedef struct ActorOverlay { - /* 0x00 */ RomFile file; - /* 0x08 */ void* vramStart; - /* 0x0C */ void* vramEnd; - /* 0x10 */ void* loadedRamAddr; // original name: "allocp" - /* 0x14 */ ActorProfile* profile; - /* 0x18 */ char* name; - /* 0x1C */ u16 allocType; // See `ACTOROVL_ALLOC_` defines - /* 0x1E */ s8 numLoaded; // original name: "clients" -} ActorOverlay; // size = 0x20 - typedef struct ActorShape { /* 0x00 */ Vec3s rot; // Current actor shape rotation /* 0x06 */ s16 face; // Used to index eyes and mouth textures. Only used by player @@ -309,7 +238,7 @@ typedef struct Actor { /* 0x12C */ ActorFunc destroy; // Destruction Routine. Called by `Actor_Destroy` /* 0x130 */ ActorFunc update; // Update Routine. Called by `Actor_UpdateAll` /* 0x134 */ ActorFunc draw; // Draw Routine. Called by `Actor_Draw` - /* 0x138 */ ActorOverlay* overlayEntry; // Pointer to the overlay table entry for this actor + /* 0x138 */ struct ActorOverlay* overlayEntry; // Pointer to the overlay table entry for this actor #if DEBUG_FEATURES /* 0x13C */ char dbgPad[0x10]; #endif @@ -396,35 +325,6 @@ typedef struct EnAObj { /* 0x17C */ ColliderCylinder collider; } EnAObj; // size = 0x1C8 -typedef enum ActorCategory { - /* 0x00 */ ACTORCAT_SWITCH, - /* 0x01 */ ACTORCAT_BG, - /* 0x02 */ ACTORCAT_PLAYER, - /* 0x03 */ ACTORCAT_EXPLOSIVE, - /* 0x04 */ ACTORCAT_NPC, - /* 0x05 */ ACTORCAT_ENEMY, - /* 0x06 */ ACTORCAT_PROP, - /* 0x07 */ ACTORCAT_ITEMACTION, - /* 0x08 */ ACTORCAT_MISC, - /* 0x09 */ ACTORCAT_BOSS, - /* 0x0A */ ACTORCAT_DOOR, - /* 0x0B */ ACTORCAT_CHEST, - /* 0x0C */ ACTORCAT_MAX -} ActorCategory; - -#define DEFINE_ACTOR(_0, enum, _2, _3) enum, -#define DEFINE_ACTOR_INTERNAL(_0, enum, _2, _3) enum, -#define DEFINE_ACTOR_UNSET(enum) enum, - -typedef enum ActorID { - #include "tables/actor_table.h" - /* 0x0192 */ ACTOR_ID_MAX // originally "ACTOR_DLF_MAX" -} ActorID; - -#undef DEFINE_ACTOR -#undef DEFINE_ACTOR_INTERNAL -#undef DEFINE_ACTOR_UNSET - typedef enum DoorLockType { DOORLOCK_NORMAL, DOORLOCK_BOSS, diff --git a/include/z64actor_profile.h b/include/z64actor_profile.h new file mode 100644 index 0000000000..82ec9f957b --- /dev/null +++ b/include/z64actor_profile.h @@ -0,0 +1,52 @@ +#ifndef Z64ACTOR_PROFILE_H +#define Z64ACTOR_PROFILE_H + +#include "ultra64.h" + +struct Actor; +struct PlayState; + +#define DEFINE_ACTOR(_0, enum, _2, _3) enum, +#define DEFINE_ACTOR_INTERNAL(_0, enum, _2, _3) enum, +#define DEFINE_ACTOR_UNSET(enum) enum, + +typedef enum ActorID { + #include "tables/actor_table.h" + /* 0x0192 */ ACTOR_ID_MAX // originally "ACTOR_DLF_MAX" +} ActorID; + +#undef DEFINE_ACTOR +#undef DEFINE_ACTOR_INTERNAL +#undef DEFINE_ACTOR_UNSET + +typedef enum ActorCategory { + /* 0x00 */ ACTORCAT_SWITCH, + /* 0x01 */ ACTORCAT_BG, + /* 0x02 */ ACTORCAT_PLAYER, + /* 0x03 */ ACTORCAT_EXPLOSIVE, + /* 0x04 */ ACTORCAT_NPC, + /* 0x05 */ ACTORCAT_ENEMY, + /* 0x06 */ ACTORCAT_PROP, + /* 0x07 */ ACTORCAT_ITEMACTION, + /* 0x08 */ ACTORCAT_MISC, + /* 0x09 */ ACTORCAT_BOSS, + /* 0x0A */ ACTORCAT_DOOR, + /* 0x0B */ ACTORCAT_CHEST, + /* 0x0C */ ACTORCAT_MAX +} ActorCategory; + +typedef void (*ActorFunc)(struct Actor*, struct PlayState*); + +typedef struct ActorProfile { + /* 0x00 */ s16 id; + /* 0x02 */ u8 category; // Classifies actor and determines when it will update or draw + /* 0x04 */ u32 flags; + /* 0x08 */ s16 objectId; + /* 0x0C */ u32 instanceSize; + /* 0x10 */ ActorFunc init; // Constructor + /* 0x14 */ ActorFunc destroy; // Destructor + /* 0x18 */ ActorFunc update; // Update Function + /* 0x1C */ ActorFunc draw; // Draw function +} ActorProfile; // size = 0x20 + +#endif diff --git a/include/z64effect.h b/include/z64effect.h index bad2b1d324..0c07cc5124 100644 --- a/include/z64effect.h +++ b/include/z64effect.h @@ -262,6 +262,8 @@ typedef enum EffectSsType { #undef DEFINE_EFFECT_SS #undef DEFINE_EFFECT_SS_UNSET +extern EffectSsOverlay gEffectSsOverlayTable[EFFECT_SS_TYPE_MAX]; + void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2); void EffectBlure_AddSpace(EffectBlure* this); void EffectBlure_Init1(void* thisx, void* initParamsx); diff --git a/include/z64game.h b/include/z64game.h index 72a8f501eb..fe683777b7 100644 --- a/include/z64game.h +++ b/include/z64game.h @@ -9,33 +9,6 @@ #include "tha.h" struct GraphicsContext; - -// Used in Graph_GetNextGameState in graph.c -#define DEFINE_GAMESTATE_INTERNAL(typeName, enumName) enumName, -#define DEFINE_GAMESTATE(typeName, enumName, name) DEFINE_GAMESTATE_INTERNAL(typeName, enumName) -typedef enum GameStateId { -#include "tables/gamestate_table.h" - GAMESTATE_ID_MAX -} GameStateId; -#undef DEFINE_GAMESTATE -#undef DEFINE_GAMESTATE_INTERNAL - -typedef struct GameStateOverlay { - /* 0x00 */ void* loadedRamAddr; - /* 0x04 */ RomFile file; // if applicable - /* 0x0C */ void* vramStart; // if applicable - /* 0x10 */ void* vramEnd; // if applicable - /* 0x14 */ void* unk_14; - /* 0x18 */ void* init; - /* 0x1C */ void* destroy; - /* 0x20 */ void* unk_20; - /* 0x24 */ void* unk_24; - /* 0x28 */ s32 unk_28; - /* 0x2C */ u32 instanceSize; -} GameStateOverlay; // size = 0x30 - -extern GameStateOverlay gGameStateOverlayTable[GAMESTATE_ID_MAX]; - struct GameState; typedef void (*GameStateFunc)(struct GameState* gameState); @@ -54,6 +27,14 @@ typedef struct GameState { /* 0xA0 */ u32 inPreNMIState; } GameState; // size = 0xA4 +#define SET_NEXT_GAMESTATE(curState, newInit, newStruct) \ + if (1) { \ + GameState* state = curState; \ + \ + (state)->init = newInit; \ + (state)->size = sizeof(newStruct); \ + } (void)0 + void GameState_ReqPadData(GameState* gameState); void GameState_Update(GameState* gameState); void GameState_InitArena(GameState* gameState, size_t size); diff --git a/include/z64sram.h b/include/z64sram.h index 9fcaf83b03..90617d1e6a 100644 --- a/include/z64sram.h +++ b/include/z64sram.h @@ -5,7 +5,6 @@ struct FileSelectState; struct GameState; -struct PlayState; typedef struct SramContext { /* 0x00 */ u8* readBuff; @@ -32,6 +31,6 @@ void Sram_CopySave(struct FileSelectState* fileSelect, SramContext* sramCtx); void Sram_WriteSramHeader(SramContext* sramCtx); void Sram_InitSram(struct GameState* gameState, SramContext* sramCtx); void Sram_Alloc(struct GameState* gameState, SramContext* sramCtx); -void Sram_Init(struct PlayState* play, SramContext* sramCtx); +void Sram_Init(struct GameState* play, SramContext* sramCtx); #endif diff --git a/include/z_actor_dlftbls.h b/include/z_actor_dlftbls.h new file mode 100644 index 0000000000..e9e2dc7d93 --- /dev/null +++ b/include/z_actor_dlftbls.h @@ -0,0 +1,74 @@ +#ifndef Z_ACTOR_DLFTBLS_H +#define Z_ACTOR_DLFTBLS_H + +#include "romfile.h" +#include "z64actor_profile.h" + +/** + * @see ACTOROVL_ALLOC_ABSOLUTE + */ +#if DEBUG_FEATURES +#define ACTOROVL_ABSOLUTE_SPACE_SIZE 0x27A0 +#else +#define ACTOROVL_ABSOLUTE_SPACE_SIZE 0x24E0 +#endif + +/** + * The actor overlay should be allocated memory for when loading, + * and the memory deallocated when there is no more actor using the overlay. + * + * `ACTOROVL_ALLOC_` defines indicate how an actor overlay should be loaded. + * + * @note Bitwise or-ing `ACTOROVL_ALLOC_` types is not meaningful. + * The `ACTOROVL_ALLOC_` types are 0, 1, 2 but checked against with a bitwise and. + * + * @see ACTOROVL_ALLOC_ABSOLUTE + * @see ACTOROVL_ALLOC_PERSISTENT + * @see actor_table.h + */ +#define ACTOROVL_ALLOC_NORMAL 0 + +/** + * The actor overlay should be loaded to "absolute space". + * + * Absolute space is a fixed amount of memory allocated once. + * The overlay will still need to be loaded again if at some point there is no more actor using the overlay. + * + * @note Only one such overlay may be loaded at a time. + * This is not checked: a newly loaded overlay will overwrite the previous one in absolute space, + * even if actors are still relying on the previous one. Actors using absolute-allocated overlays should be deleted + * when another absolute-allocated overlay is about to be used. + * + * @see ACTOROVL_ABSOLUTE_SPACE_SIZE + * @see ActorContext.absoluteSpace + * @see ACTOROVL_ALLOC_NORMAL + */ +#define ACTOROVL_ALLOC_ABSOLUTE (1 << 0) + +/** + * The actor overlay should be loaded persistently. + * It will stay loaded until the current game state instance ends. + * + * @see ACTOROVL_ALLOC_NORMAL + */ +#define ACTOROVL_ALLOC_PERSISTENT (1 << 1) + +typedef struct ActorOverlay { + /* 0x00 */ RomFile file; + /* 0x08 */ void* vramStart; + /* 0x0C */ void* vramEnd; + /* 0x10 */ void* loadedRamAddr; // original name: "allocp" + /* 0x14 */ ActorProfile* profile; + /* 0x18 */ char* name; + /* 0x1C */ u16 allocType; // See `ACTOROVL_ALLOC_` defines + /* 0x1E */ s8 numLoaded; // original name: "clients" +} ActorOverlay; // size = 0x20 + +extern ActorOverlay gActorOverlayTable[ACTOR_ID_MAX]; // original name: "actor_dlftbls" 801162A0 +extern s32 gMaxActorId; // original name: "MaxProfile" + +void ActorOverlayTable_LogPrint(void); +void ActorOverlayTable_Init(void); +void ActorOverlayTable_Cleanup(void); + +#endif diff --git a/include/z_game_dlftbls.h b/include/z_game_dlftbls.h new file mode 100644 index 0000000000..691cda27cb --- /dev/null +++ b/include/z_game_dlftbls.h @@ -0,0 +1,37 @@ +#ifndef Z_GAME_DLFTBLS_H +#define Z_GAME_DLFTBLS_H + +#include "ultra64.h" +#include "romfile.h" +#include "unk.h" + +typedef struct GameStateOverlay { + /* 0x00 */ void* loadedRamAddr; + /* 0x04 */ RomFile file; // if applicable + /* 0x0C */ void* vramStart; // if applicable + /* 0x10 */ void* vramEnd; // if applicable + /* 0x14 */ void* unk_14; + /* 0x18 */ void* init; // initializes and executes the given context + /* 0x1C */ void* destroy; // deconstructs the context, and sets the next context to load + /* 0x20 */ void* unk_20; + /* 0x24 */ void* unk_24; + /* 0x28 */ UNK_TYPE4 unk_28; + /* 0x2C */ u32 instanceSize; +} GameStateOverlay; // size = 0x30 + +// Used in Graph_GetNextGameState in graph.c +#define DEFINE_GAMESTATE_INTERNAL(typeName, enumName) enumName, +#define DEFINE_GAMESTATE(typeName, enumName, name) DEFINE_GAMESTATE_INTERNAL(typeName, enumName) +typedef enum GameStateId { +#include "tables/gamestate_table.h" + GAMESTATE_ID_MAX +} GameStateId; +#undef DEFINE_GAMESTATE +#undef DEFINE_GAMESTATE_INTERNAL + +extern GameStateOverlay gGameStateOverlayTable[GAMESTATE_ID_MAX]; + +void Overlay_LoadGameState(GameStateOverlay* overlayEntry); +void Overlay_FreeGameState(GameStateOverlay* overlayEntry); + +#endif diff --git a/include/zelda_arena.h b/include/zelda_arena.h index 1d035a0bbe..cf67406577 100644 --- a/include/zelda_arena.h +++ b/include/zelda_arena.h @@ -3,6 +3,8 @@ #include "ultra64.h" +extern s32 gZeldaArenaLogSeverity; + void* ZeldaArena_Malloc(u32 size); void* ZeldaArena_MallocR(u32 size); void* ZeldaArena_Realloc(void* ptr, u32 newSize); diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index 6d1d33cf69..b8d5276195 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -33,7 +33,7 @@ #include "global.h" #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:76 pal-1.0:74 pal-1.1:74" + "ntsc-1.2:86 pal-1.0:84 pal-1.1:84" StackEntry sDmaMgrStackInfo; OSMesgQueue sDmaMgrMsgQueue; diff --git a/src/code/fault_gc.c b/src/code/fault_gc.c index f1f1000715..c70503cddd 100644 --- a/src/code/fault_gc.c +++ b/src/code/fault_gc.c @@ -40,8 +40,8 @@ * DPad-Up may be pressed to enable sending fault pages over osSyncPrintf as well as displaying them on-screen. * DPad-Down disables sending fault pages over osSyncPrintf. */ -#pragma increment_block_number "gc-eu:160 gc-eu-mq:160 gc-eu-mq-dbg:160 gc-jp:160 gc-jp-ce:160 gc-jp-mq:160 gc-us:160" \ - "gc-us-mq:160 ique-cn:160" +#pragma increment_block_number "gc-eu:160 gc-eu-mq:160 gc-eu-mq-dbg:160 gc-jp:176 gc-jp-ce:176 gc-jp-mq:176 gc-us:176" \ + "gc-us-mq:176 ique-cn:176" #include "global.h" #include "libc64/sleep.h" diff --git a/src/code/graph.c b/src/code/graph.c index de9ecd9005..288a1cee7d 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -2,8 +2,8 @@ #include "libc64/sprintf.h" #include "libu64/debug.h" -#include "console_logo_state.h" #include "buffers.h" +#include "console_logo_state.h" #include "gfx.h" #include "fault.h" #include "file_select_state.h" @@ -14,10 +14,11 @@ #include "regs.h" #include "setup_state.h" #include "sys_ucode.h" -#include "title_setup_state.h" #include "terminal.h" +#include "title_setup_state.h" #include "ucode_disas.h" #include "versions.h" +#include "z_game_dlftbls.h" #include "z64save.h" #include "z64play.h" diff --git a/src/code/main.c b/src/code/main.c index 62cd22573e..32a543a9b4 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -28,8 +28,8 @@ extern struct IrqMgr gIrqMgr; #include "global.h" -#pragma increment_block_number "gc-eu:144 gc-eu-mq:144 gc-jp:144 gc-jp-ce:144 gc-jp-mq:144 gc-us:144 gc-us-mq:144" \ - "ique-cn:144 ntsc-1.0:129 ntsc-1.1:129 ntsc-1.2:129 pal-1.0:127 pal-1.1:127" +#pragma increment_block_number "gc-eu:160 gc-eu-mq:160 gc-jp:160 gc-jp-ce:160 gc-jp-mq:160 gc-us:160 gc-us-mq:160" \ + "ique-cn:160 ntsc-1.0:140 ntsc-1.1:140 ntsc-1.2:140 pal-1.0:138 pal-1.1:138" extern u8 _buffersSegmentEnd[]; diff --git a/src/code/title_setup.c b/src/code/title_setup.c index 8234a562b7..ba259e72a1 100644 --- a/src/code/title_setup.c +++ b/src/code/title_setup.c @@ -1,7 +1,7 @@ +#include "console_logo_state.h" #include "setup_state.h" #include "global.h" -#include "console_logo_state.h" void Setup_InitImpl(SetupState* this) { PRINTF(T("ゼルダ共通データ初期化\n", "Zelda common data initialization\n")); diff --git a/src/code/z_DLF.c b/src/code/z_DLF.c index 7934b77456..501fed21a6 100644 --- a/src/code/z_DLF.c +++ b/src/code/z_DLF.c @@ -1,7 +1,10 @@ +#include "libc64/malloc.h" #include "libu64/overlay.h" - -#include "global.h" #include "terminal.h" +#include "ultra64.h" +#include "z_game_dlftbls.h" + +#include "macros.h" void Overlay_LoadGameState(GameStateOverlay* overlayEntry) { if (overlayEntry->loadedRamAddr != NULL) { diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 7c62497590..54807627bf 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -13,8 +13,10 @@ #include "sys_matrix.h" #include "terminal.h" #include "versions.h" +#include "z_actor_dlftbls.h" #include "z_lib.h" #include "zelda_arena.h" +#include "z64actor.h" #include "z64effect.h" #include "z64light.h" #include "z64horse.h" @@ -32,7 +34,7 @@ #include "assets/objects/object_bdoor/object_bdoor.h" #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" + "ntsc-1.0:128 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" CollisionPoly* sCurCeilingPoly; s32 sCurCeilingBgId; diff --git a/src/code/z_actor_dlftbls.c b/src/code/z_actor_dlftbls.c index 52d8ad8556..accce471cb 100644 --- a/src/code/z_actor_dlftbls.c +++ b/src/code/z_actor_dlftbls.c @@ -1,5 +1,8 @@ -#include "global.h" #include "fault.h" +#include "segment_symbols.h" +#include "z_actor_dlftbls.h" + +#include "macros.h" // Linker symbol declarations (used in the table below) #define DEFINE_ACTOR(name, _1, _2, _3) DECLARE_OVERLAY_SEGMENT(name) diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index b54707fd6a..c5d22fd6a2 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -11,7 +11,7 @@ #include "z64player.h" #include "z64skin_matrix.h" -#pragma increment_block_number "ntsc-1.0:176 ntsc-1.1:176 ntsc-1.2:176" +#pragma increment_block_number "ntsc-1.0:184 ntsc-1.1:184 ntsc-1.2:184" u16 DynaSSNodeList_GetNextNodeIdx(DynaSSNodeList* nodeList); void BgCheck_GetStaticLookupIndicesFromPos(CollisionContext* colCtx, Vec3f* pos, Vec3i* sector); diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 142d23aed6..d36f36b9a5 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -3642,7 +3642,7 @@ s32 Camera_KeepOn3(Camera* camera) { } #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ique-cn:128 ntsc-1.0:109 ntsc-1.1:109 ntsc-1.2:109 pal-1.0:107 pal-1.1:107" + "ique-cn:128 ntsc-1.0:120 ntsc-1.1:120 ntsc-1.2:120 pal-1.0:118 pal-1.1:118" s32 Camera_KeepOn4(Camera* camera) { static Vec3f D_8015BD50; diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 50b049fc11..bd1c418574 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -144,7 +144,7 @@ u16 gCamAtSplinePointsAppliedFrame; u16 gCamEyePointAppliedFrame; u16 gCamAtPointAppliedFrame; -#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:0" \ +#pragma increment_block_number "gc-eu:0 gc-eu-mq:128 gc-jp:0 gc-jp-ce:0 gc-jp-mq:128 gc-us:0 gc-us-mq:128 ique-cn:0" \ "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" // Cam ID to return to when a scripted cutscene is finished diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c index d424191d29..2acddc4bf0 100644 --- a/src/code/z_effect_soft_sprite.c +++ b/src/code/z_effect_soft_sprite.c @@ -1,8 +1,10 @@ #include "libu64/overlay.h" -#include "global.h" +#include "sfx.h" #include "terminal.h" - +#include "zelda_arena.h" #include "z64frame_advance.h" +#include "z64effect.h" +#include "z64play.h" EffectSsInfo sEffectSsInfo = { 0 }; // "EffectSS2Info" diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index afd6a41f46..aa757f8643 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -22,7 +22,7 @@ #include "assets/objects/gameplay_keep/gameplay_keep.h" #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-eu-mq-dbg:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128" \ - "gc-us-mq:128 ntsc-1.2:128" + "gc-us-mq:128 ntsc-1.0:128 ntsc-1.2:128" #define FLAGS 0 diff --git a/src/code/z_game_dlftbls.c b/src/code/z_game_dlftbls.c index 95969c2914..57efe90dfc 100644 --- a/src/code/z_game_dlftbls.c +++ b/src/code/z_game_dlftbls.c @@ -1,11 +1,11 @@ -#include "setup_state.h" -#include "map_select_state.h" +#include "segment_symbols.h" #include "console_logo_state.h" -#include "z64play.h" -#include "title_setup_state.h" #include "file_select_state.h" - -#include "global.h" +#include "map_select_state.h" +#include "setup_state.h" +#include "title_setup_state.h" +#include "z_game_dlftbls.h" +#include "z64play.h" // Linker symbol declarations (used in the table below) #define DEFINE_GAMESTATE(typeName, enumName, name) DECLARE_OVERLAY_SEGMENT(name) diff --git a/src/code/z_kaleido_manager.c b/src/code/z_kaleido_manager.c index e1d7f55290..9fa8f5ebc3 100644 --- a/src/code/z_kaleido_manager.c +++ b/src/code/z_kaleido_manager.c @@ -1,7 +1,11 @@ +#include "libu64/debug.h" #include "libu64/overlay.h" - -#include "global.h" +#include "kaleido_manager.h" +#include "segment_symbols.h" #include "terminal.h" +#include "z64play.h" + +#include "macros.h" #define KALEIDO_OVERLAY(name, nameString) \ { NULL, ROM_FILE(ovl_##name), _ovl_##name##SegmentStart, _ovl_##name##SegmentEnd, 0, nameString, } diff --git a/src/code/z_kaleido_scope_call.c b/src/code/z_kaleido_scope_call.c index 35e14433a1..1d99a6f5c7 100644 --- a/src/code/z_kaleido_scope_call.c +++ b/src/code/z_kaleido_scope_call.c @@ -1,5 +1,5 @@ -#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ - "ique-cn:192 ntsc-1.0:224 ntsc-1.1:224 ntsc-1.2:224 pal-1.0:224 pal-1.1:224" +#pragma increment_block_number "gc-eu:224 gc-eu-mq:224 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224" \ + "ique-cn:224 ntsc-1.0:224 ntsc-1.1:224 ntsc-1.2:224 pal-1.0:224 pal-1.1:224" #include "libu64/debug.h" #include "kaleido_manager.h" diff --git a/src/code/z_message.c b/src/code/z_message.c index 68d2086234..1240cfed93 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -24,7 +24,7 @@ #include "assets/textures/parameter_static/parameter_static.h" #pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:128 pal-1.1:128" + "ntsc-1.0:208 ntsc-1.1:208 ntsc-1.2:208 pal-1.0:128 pal-1.1:128" #if !PLATFORM_IQUE #define MSG_BUF_DECODED (msgCtx->msgBufDecoded) diff --git a/src/code/z_play.c b/src/code/z_play.c index 095638be6b..d49ae40fe7 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -23,6 +23,7 @@ #include "terminal.h" #include "title_setup_state.h" #include "versions.h" +#include "z_actor_dlftbls.h" #include "zelda_arena.h" #include "z64cutscene_flags.h" #include "z64debug_display.h" @@ -35,8 +36,8 @@ #include "global.h" -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ique-cn:192 ntsc-1.0:144 ntsc-1.1:144 ntsc-1.2:144 pal-1.0:144 pal-1.1:144" +#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:192" \ + "ntsc-1.0:144 ntsc-1.1:144 ntsc-1.2:144 pal-1.0:144 pal-1.1:144" TransitionTile gTransitionTile; s32 gTransitionTileState; @@ -325,7 +326,7 @@ void Play_Init(GameState* thisx) { Camera_OverwriteStateFlags(&this->mainCamera, CAM_STATE_CHECK_BG_ALT | CAM_STATE_CHECK_WATER | CAM_STATE_CHECK_BG | CAM_STATE_EXTERNAL_FINISHED | CAM_STATE_CAM_FUNC_FINISH | CAM_STATE_LOCK_MODE | CAM_STATE_DISTORTION | CAM_STATE_PLAY_INIT); - Sram_Init(this, &this->sramCtx); + Sram_Init(&this->state, &this->sramCtx); Regs_InitData(this); Message_Init(this); GameOver_Init(this); diff --git a/src/code/z_prenmi.c b/src/code/z_prenmi.c index 34712be91a..bda115d462 100644 --- a/src/code/z_prenmi.c +++ b/src/code/z_prenmi.c @@ -1,9 +1,13 @@ +#include "gfx.h" +#include "gfx_setupdl.h" #include "prenmi_state.h" - -#include "global.h" +#include "regs.h" #include "terminal.h" #include "versions.h" +#include "macros.h" +#include "global.h" + void func_80092320(PreNMIState* this) { this->state.running = false; this->state.init = NULL; diff --git a/src/code/z_sample.c b/src/code/z_sample.c index 6a5b865294..63e0836bbc 100644 --- a/src/code/z_sample.c +++ b/src/code/z_sample.c @@ -1,6 +1,11 @@ +#include "gfx.h" +#include "gfx_setupdl.h" +#include "controller.h" +#include "regs.h" #include "sample_state.h" - -#include "global.h" +#include "segment_symbols.h" +#include "z64dma.h" +#include "z64play.h" void Sample_HandleStateChange(SampleState* this) { if (CHECK_BTN_ALL(this->state.input[0].press.button, BTN_START)) { diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 4b40a3b0ca..805141ade7 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -2,6 +2,7 @@ #include "seqcmd.h" #include "terminal.h" #include "versions.h" +#include "z_actor_dlftbls.h" #include "z64save.h" SceneCmdHandlerFunc sSceneCmdHandlers[SCENE_CMD_ID_MAX]; diff --git a/src/code/z_sram.c b/src/code/z_sram.c index 2f6a3b5dc3..de2f1ce72e 100644 --- a/src/code/z_sram.c +++ b/src/code/z_sram.c @@ -1,10 +1,16 @@ #include "file_select_state.h" -#include "global.h" +#include "controller.h" #include "terminal.h" #include "versions.h" +#include "z64game.h" +#include "z64message.h" #include "z64save.h" +#include "z64scene.h" +#include "z64sram.h" #include "z64ss_sram.h" +#include "global.h" + #define SLOT_SIZE (sizeof(SaveContext) + 0x28) #define CHECKSUM_SIZE (sizeof(Save) / 2) @@ -1060,5 +1066,5 @@ void Sram_Alloc(GameState* gameState, SramContext* sramCtx) { ASSERT(sramCtx->readBuff != NULL, "sram->read_buff != NULL", "../z_sram.c", 1295); } -void Sram_Init(PlayState* play, SramContext* sramCtx) { +void Sram_Init(GameState* gameState, SramContext* sramCtx) { } diff --git a/src/libu64/load_gc.c b/src/libu64/load_gc.c index 8d1ff315c5..6211d119b2 100644 --- a/src/libu64/load_gc.c +++ b/src/libu64/load_gc.c @@ -1,6 +1,8 @@ #include "libu64/overlay.h" +#include "ultra64.h" +#include "z64dma.h" -#include "global.h" +#include "macros.h" size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd, void* allocatedRamAddr) { s32 pad[3]; diff --git a/src/libu64/loadfragment2_gc.c b/src/libu64/loadfragment2_gc.c index 477b7d1c28..191b2ee076 100644 --- a/src/libu64/loadfragment2_gc.c +++ b/src/libu64/loadfragment2_gc.c @@ -1,6 +1,7 @@ +#include "libc64/malloc.h" #include "libu64/overlay.h" -#include "global.h" +#include "macros.h" void* Overlay_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd) { void* allocatedRamAddr = SYSTEM_ARENA_MALLOC_R((intptr_t)vramEnd - (intptr_t)vramStart, "../loadfragment2.c", 31); diff --git a/src/libu64/loadfragment2_n64.c b/src/libu64/loadfragment2_n64.c index b3d7751d8f..015e1d1d6b 100644 --- a/src/libu64/loadfragment2_n64.c +++ b/src/libu64/loadfragment2_n64.c @@ -6,9 +6,11 @@ * * @see Overlay_Relocate */ +#include "libc64/malloc.h" #include "libu64/overlay.h" +#include "z64dma.h" -#include "global.h" +#include "macros.h" s32 gOverlayLogSeverity = 2; diff --git a/src/libu64/logseverity_gc.c b/src/libu64/logseverity_gc.c index 940aa87cc8..50c2eb4ab8 100644 --- a/src/libu64/logseverity_gc.c +++ b/src/libu64/logseverity_gc.c @@ -1,3 +1,3 @@ -#include "global.h" +#include "libu64/overlay.h" s32 gOverlayLogSeverity = 2; diff --git a/src/libu64/relocation_gc.c b/src/libu64/relocation_gc.c index a2961bcc51..9307d67cc6 100644 --- a/src/libu64/relocation_gc.c +++ b/src/libu64/relocation_gc.c @@ -7,8 +7,10 @@ * @see Overlay_Relocate */ #include "libu64/overlay.h" +#include "attributes.h" +#include "ultra64.h" -#include "global.h" +#include "macros.h" // Extract MIPS register rs from an instruction word #define MIPS_REG_RS(insn) (((insn) >> 0x15) & 0x1F) diff --git a/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c b/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c index bf421ecd98..15adb7bf94 100644 --- a/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c +++ b/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c @@ -24,6 +24,8 @@ #include "assets/objects/object_ddan_objects/object_ddan_objects.h" +#pragma increment_block_number "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" + #define FLAGS 0 void BgDodoago_Init(Actor* thisx, PlayState* play); diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index 8388bd537d..1ebeaa882f 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -1,7 +1,8 @@ -#include "file_select_state.h" #include "file_select.h" +#include "file_select_state.h" #include "attributes.h" +#include "controller.h" #include "gfx.h" #include "gfx_setupdl.h" #include "letterbox.h" @@ -11,6 +12,8 @@ #include "n64dd.h" #endif #include "regs.h" +#include "rumble.h" +#include "segment_symbols.h" #include "seqcmd.h" #include "sequence.h" #include "sfx.h" diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c b/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c index 5386630662..8fe674c3a2 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c @@ -1,5 +1,5 @@ -#include "file_select_state.h" #include "file_select.h" +#include "file_select_state.h" #include "controller.h" #include "regs.h" diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c b/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c index 9418e67d01..aeee6539a6 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c @@ -1,5 +1,5 @@ -#include "file_select_state.h" #include "file_select.h" +#include "file_select_state.h" #include "controller.h" #include "gfx.h" diff --git a/src/overlays/gamestates/ovl_opening/z_opening.c b/src/overlays/gamestates/ovl_opening/z_opening.c index bcda61ce87..ad36b6e205 100644 --- a/src/overlays/gamestates/ovl_opening/z_opening.c +++ b/src/overlays/gamestates/ovl_opening/z_opening.c @@ -4,11 +4,15 @@ * Description: Initializes the game into the title screen */ +#include "gfx.h" +#include "regs.h" +#include "sys_matrix.h" #include "title_setup_state.h" - -#include "global.h" +#include "z64game.h" +#include "z64play.h" #include "z64save.h" #include "z64sram.h" +#include "z64view.h" void TitleSetup_SetupTitleScreen(TitleSetupState* this) { gSaveContext.gameMode = GAMEMODE_TITLE_SCREEN; diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index fea717fb71..633986cd66 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -4,21 +4,29 @@ * Description: Debug Scene Select Menu */ -#include "map_select_state.h" - +#include "libc64/qrand.h" +#include "libu64/gfxprint.h" #include "ultra64.h" #include "alloca.h" #include "console_logo_state.h" +#include "controller.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "map_select_state.h" #if PLATFORM_N64 #include "n64dd.h" #endif +#include "regs.h" +#include "segment_symbols.h" #include "seqcmd.h" #include "sequence.h" +#include "sfx.h" #include "terminal.h" +#include "z64play.h" #include "z64save.h" #include "z64sram.h" -#include "global.h" +#include "macros.h" void MapSelect_LoadTitle(MapSelectState* this) { this->state.running = false; diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index 727d49a339..0470a4f521 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -4,19 +4,28 @@ * Description: Displays the Nintendo Logo */ -#include "console_logo_state.h" - -#include "global.h" -#include "alloca.h" -#include "title_setup_state.h" -#include "versions.h" - +#include "libu64/gfxprint.h" #if PLATFORM_N64 #include "cic6105.h" #include "n64dd.h" #endif + +#include "alloca.h" +#include "console_logo_state.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "regs.h" +#include "segment_symbols.h" +#include "sequence.h" +#include "sys_matrix.h" +#include "title_setup_state.h" +#include "versions.h" +#include "z64actor.h" +#include "z64environment.h" #include "z64save.h" +#include "global.h" + #include "assets/textures/nintendo_rogo_static/nintendo_rogo_static.h" #if DEBUG_FEATURES