diff --git a/include/buffers.h b/include/buffers.h new file mode 100644 index 0000000000..e74719c440 --- /dev/null +++ b/include/buffers.h @@ -0,0 +1,15 @@ +#ifndef BUFFERS_H +#define BUFFERS_H + +#include "gfx.h" +#include "macros.h" +#include "ultra64.h" + +extern u16 gZBuffer[SCREEN_HEIGHT][SCREEN_WIDTH]; // 0x25800 bytes +extern u64 gGfxSPTaskOutputBuffer[0x3000]; // 0x18000 bytes +extern u64 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE / sizeof(u64)]; // 0xC00 bytes +extern u64 gGfxSPTaskStack[SP_DRAM_STACK_SIZE64]; // 0x400 bytes +extern GfxPool gGfxPools[2]; // 0x24820 bytes +extern u8 gAudioHeap[0x38000]; // 0x38000 bytes + +#endif diff --git a/include/debug_arena.h b/include/debug_arena.h new file mode 100644 index 0000000000..352a7f6dc6 --- /dev/null +++ b/include/debug_arena.h @@ -0,0 +1,38 @@ +#ifndef DEBUG_ARENA_H +#define DEBUG_ARENA_H + +#include "ultra64/ultratypes.h" + +void* DebugArena_Malloc(u32 size); +void* DebugArena_MallocR(u32 size); +void* DebugArena_Realloc(void* ptr, u32 newSize); +void DebugArena_Free(void* ptr); +void* DebugArena_Calloc(u32 num, u32 size); +void DebugArena_GetSizes(u32* outMaxFree, u32* outFree, u32* outAlloc); +void DebugArena_Check(void); +void DebugArena_Init(void* start, u32 size); +void DebugArena_Cleanup(void); +s32 DebugArena_IsInitialized(void); + +#if DEBUG_FEATURES + +#define DEBUG_ARENA_MALLOC(size, file, line) DebugArena_MallocDebug(size, file, line) +#define DEBUG_ARENA_MALLOC_R(size, file, line) DebugArena_MallocRDebug(size, file, line) +#define DEBUG_ARENA_FREE(size, file, line) DebugArena_FreeDebug(size, file, line) + +void DebugArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action); +void* DebugArena_MallocDebug(u32 size, const char* file, int line); +void* DebugArena_MallocRDebug(u32 size, const char* file, int line); +void* DebugArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line); +void DebugArena_FreeDebug(void* ptr, const char* file, int line); +void DebugArena_Display(void); + +#else + +#define DEBUG_ARENA_MALLOC(size, file, line) DebugArena_Malloc(size) +#define DEBUG_ARENA_MALLOC_R(size, file, line) DebugArena_MallocR(size) +#define DEBUG_ARENA_FREE(size, file, line) DebugArena_Free(size) + +#endif + +#endif diff --git a/include/functions.h b/include/functions.h index ba850129d5..71d747c7d7 100644 --- a/include/functions.h +++ b/include/functions.h @@ -36,32 +36,9 @@ void ActorOverlayTable_Init(void); void ActorOverlayTable_Cleanup(void); void SaveContext_Init(void); -s32 func_800635D0(s32); -void Regs_Init(void); -void DebugCamera_ScreenText(u8 x, u8 y, const char* text); -void DebugCamera_ScreenTextColored(u8 x, u8 y, u8 colorIndex, const char* text); -#if DEBUG_FEATURES -void Regs_UpdateEditor(Input* input); -#endif -void Debug_DrawText(GraphicsContext* gfxCtx); void* MemCpy(void* dest, const void* src, s32 len); -s32 Kanji_OffsetFromShiftJIS(s32 character); -#if PLATFORM_IQUE -void Font_LoadCharCHN(Font* font, u16 character, u16 codePointIndex); -#endif -void Font_LoadCharWide(Font* font, u16 character, u16 codePointIndex); -void Font_LoadChar(Font* font, u8 character, u16 codePointIndex); -void Font_LoadMessageBoxIcon(Font* font, u16 icon); -void Font_LoadOrderedFont(Font* font); - -void Health_InitMeter(PlayState* play); -void Health_UpdateMeter(PlayState* play); -void Health_DrawMeter(PlayState* play); -void Health_UpdateBeatingHeart(PlayState* play); -u32 Health_IsCritical(void); - void MapMark_Init(PlayState* play); void MapMark_ClearPointers(PlayState* play); void MapMark_Draw(PlayState* play); @@ -72,35 +49,9 @@ void Sched_FlushTaskQueue(void); void PreNMI_Init(GameState* thisx); -void func_80095AA0(PlayState* play, Room* room, Input* input, s32 arg3); -void Room_DrawBackground2D(Gfx** gfxP, void* tex, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 tlutMode, - u16 tlutCount, f32 offsetX, f32 offsetY); -void Room_Init(PlayState* play, Room* room); -u32 Room_SetupFirstRoom(PlayState* play, RoomContext* roomCtx); -s32 Room_RequestNewRoom(PlayState* play, RoomContext* roomCtx, s32 roomNum); -s32 Room_ProcessRoomRequest(PlayState* play, RoomContext* roomCtx); -void Room_Draw(PlayState* play, Room* room, u32 flags); -void Room_FinishRoomChange(PlayState* play, RoomContext* roomCtx); void Sample_Destroy(GameState* thisx); void Sample_Init(GameState* thisx); -void Sram_InitNewSave(void); -void Sram_InitDebugSave(void); -void Sram_OpenSave(SramContext* sramCtx); -void Sram_WriteSave(SramContext* sramCtx); -void Sram_VerifyAndLoadAllSaves(FileSelectState* fileSelect, SramContext* sramCtx); -void Sram_InitSave(FileSelectState* fileSelect, SramContext* sramCtx); -void Sram_EraseSave(FileSelectState* fileSelect, SramContext* sramCtx); -void Sram_CopySave(FileSelectState* fileSelect, SramContext* sramCtx); -void Sram_WriteSramHeader(SramContext* sramCtx); -void Sram_InitSram(GameState* gameState, SramContext* sramCtx); -void Sram_Alloc(GameState* gameState, SramContext* sramCtx); -void Sram_Init(PlayState* play, SramContext* sramCtx); -void SsSram_Init(s32 addr, u8 handleType, u8 handleDomain, u8 handleLatency, u8 handlePageSize, u8 handleRelDuration, - u8 handlePulse, u32 handleSpeed); -void SsSram_Dma(void* dramAddr, size_t size, s32 direction); -void SsSram_ReadWrite(s32 addr, void* dramAddr, size_t size, s32 direction); - void ViMode_LogPrint(OSViMode* osViMode); void ViMode_Configure(ViMode* viMode, s32 type, s32 tvType, s32 loRes, s32 antialiasOff, s32 modeN, s32 fb16Bit, s32 width, s32 height, s32 leftAdjust, s32 rightAdjust, s32 upperAdjust, s32 lowerAdjust); @@ -168,13 +119,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); -#if DEBUG_FEATURES -void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, int line); -#endif -void* GameAlloc_Malloc(GameAlloc* this, u32 size); -void GameAlloc_Free(GameAlloc* this, void* data); -void GameAlloc_Cleanup(GameAlloc* this); -void GameAlloc_Init(GameAlloc* this); void Graph_InitTHGA(GraphicsContext* gfxCtx); GameStateOverlay* Graph_GetNextGameState(GameState* gameState); void Graph_Init(GraphicsContext* gfxCtx); @@ -195,24 +139,6 @@ void* SysCfb_GetFbEnd(void); NORETURN void func_800D31A0(void); void func_800D31F0(void); void func_800D3210(void); -void* DebugArena_Malloc(u32 size); -void* DebugArena_MallocR(u32 size); -void* DebugArena_Realloc(void* ptr, u32 newSize); -void DebugArena_Free(void* ptr); -void* DebugArena_Calloc(u32 num, u32 size); -void DebugArena_GetSizes(u32* outMaxFree, u32* outFree, u32* outAlloc); -void DebugArena_Check(void); -void DebugArena_Init(void* start, u32 size); -void DebugArena_Cleanup(void); -s32 DebugArena_IsInitialized(void); -#if DEBUG_FEATURES -void DebugArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action); -void* DebugArena_MallocDebug(u32 size, const char* file, int line); -void* DebugArena_MallocRDebug(u32 size, const char* file, int line); -void* DebugArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line); -void DebugArena_FreeDebug(void* ptr, const char* file, int line); -void DebugArena_Display(void); -#endif void RcpUtils_PrintRegisterStatus(void); void RcpUtils_Reset(void); diff --git a/include/gamealloc.h b/include/gamealloc.h new file mode 100644 index 0000000000..c69ea35749 --- /dev/null +++ b/include/gamealloc.h @@ -0,0 +1,31 @@ +#ifndef GAMEALLOC_H +#define GAMEALLOC_H + +#include "ultra64/ultratypes.h" + +typedef struct GameAllocEntry { + /* 0x00 */ struct GameAllocEntry* next; + /* 0x04 */ struct GameAllocEntry* prev; + /* 0x08 */ u32 size; + /* 0x0C */ u32 unk_0C; +} GameAllocEntry; // size = 0x10 + +typedef struct GameAlloc { + /* 0x00 */ GameAllocEntry base; + /* 0x10 */ GameAllocEntry* head; +} GameAlloc; // size = 0x14 + +#if DEBUG_FEATURES + +#define GAME_ALLOC_MALLOC(alloc, size, file, line) GameAlloc_MallocDebug(alloc, size, file, line) +void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, int line); +#else +#define GAME_ALLOC_MALLOC(alloc, size, file, line) GameAlloc_Malloc(alloc, size) +#endif + +void* GameAlloc_Malloc(GameAlloc* this, u32 size); +void GameAlloc_Free(GameAlloc* this, void* data); +void GameAlloc_Cleanup(GameAlloc* this); +void GameAlloc_Init(GameAlloc* this); + +#endif diff --git a/include/kanread.h b/include/kanread.h new file mode 100644 index 0000000000..bea4831c81 --- /dev/null +++ b/include/kanread.h @@ -0,0 +1,8 @@ +#ifndef KANREAD_H +#define KANREAD_H + +#include "ultra64/ultratypes.h" + +s32 Kanji_OffsetFromShiftJIS(s32 sjis); + +#endif diff --git a/include/libc64/malloc.h b/include/libc64/malloc.h index 86b58d17ca..25233c51c5 100644 --- a/include/libc64/malloc.h +++ b/include/libc64/malloc.h @@ -16,11 +16,19 @@ void SystemArena_Cleanup(void); s32 SystemArena_IsInitialized(void); #if DEBUG_FEATURES +#define SYSTEM_ARENA_MALLOC(size, file, line) SystemArena_MallocDebug(size, file, line) +#define SYSTEM_ARENA_MALLOC_R(size, file, line) SystemArena_MallocRDebug(size, file, line) +#define SYSTEM_ARENA_FREE(size, file, line) SystemArena_FreeDebug(size, file, line) + void* SystemArena_MallocDebug(u32 size, const char* file, int line); void* SystemArena_MallocRDebug(u32 size, const char* file, int line); void* SystemArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line); void SystemArena_FreeDebug(void* ptr, const char* file, int line); void SystemArena_Display(void); +#else +#define SYSTEM_ARENA_MALLOC(size, file, line) SystemArena_Malloc(size) +#define SYSTEM_ARENA_MALLOC_R(size, file, line) SystemArena_MallocR(size) +#define SYSTEM_ARENA_FREE(size, file, line) SystemArena_Free(size) #endif extern Arena gSystemArena; diff --git a/include/libu64/debug.h b/include/libu64/debug.h index 598c901957..87015afde8 100644 --- a/include/libu64/debug.h +++ b/include/libu64/debug.h @@ -3,12 +3,33 @@ #include "ultra64.h" +#if DEBUG_FEATURES +#define LOG(exp, value, format, file, line) \ + do { \ + LogUtils_LogThreadId(file, line); \ + osSyncPrintf(exp " = " format "\n", value); \ + } while (0) +#else +#define LOG(exp, value, format, file, line) (void)(value) +#endif + +#define LOG_STRING(string, file, line) LOG(#string, string, "%s", file, line) +#define LOG_ADDRESS(exp, value, file, line) LOG(exp, value, "%08x", file, line) +#define LOG_TIME(exp, value, file, line) LOG(exp, value, "%lld", file, line) +#define LOG_NUM(exp, value, file, line) LOG(exp, value, "%d", file, line) +#define LOG_HEX(exp, value, file, line) LOG(exp, value, "%x", file, line) +#define LOG_HEX32(exp, value, file, line) LOG(exp, value, "%08x", file, line) +#define LOG_FLOAT(exp, value, file, line) LOG(exp, value, "%f", file, line) + #if PLATFORM_N64 || DEBUG_FEATURES f32 LogUtils_CheckFloatRange(const char* exp, int line, const char* valueName, f32 value, const char* minName, f32 min, const char* maxName, f32 max); #endif #if DEBUG_FEATURES +#define LOG_UTILS_CHECK_NULL_POINTER(exp, ptr, file, line) LogUtils_CheckNullPointer(exp, ptr, file, line) +#define LOG_UTILS_CHECK_VALID_POINTER(exp, ptr, file, line) LogUtils_CheckValidPointer(exp, ptr, file, line) + s32 LogUtils_CheckIntRange(const char* exp, int line, const char* valueName, s32 value, const char* minName, s32 min, const char* maxName, s32 max); void LogUtils_LogHexDump(void* ptr, s32 size0); @@ -17,6 +38,11 @@ void LogUtils_CheckBoundary(const char* name, s32 value, s32 unk, const char* fi void LogUtils_CheckNullPointer(const char* exp, void* ptr, const char* file, int line); void LogUtils_CheckValidPointer(const char* exp, void* ptr, const char* file, int line); void LogUtils_LogThreadId(const char* name, int line); +#else + +#define LOG_UTILS_CHECK_NULL_POINTER(exp, ptr, file, line) (void)0 +#define LOG_UTILS_CHECK_VALID_POINTER(exp, ptr, file, line) (void)0 + #endif void LogUtils_HungupThread(const char* name, int line); diff --git a/include/macros.h b/include/macros.h index 45cdf6935a..22f66810ec 100644 --- a/include/macros.h +++ b/include/macros.h @@ -89,24 +89,6 @@ #define PRINTF_RST() (void)0 #endif -#if DEBUG_FEATURES -#define LOG(exp, value, format, file, line) \ - do { \ - LogUtils_LogThreadId(file, line); \ - osSyncPrintf(exp " = " format "\n", value); \ - } while (0) -#else -#define LOG(exp, value, format, file, line) (void)(value) -#endif - -#define LOG_STRING(string, file, line) LOG(#string, string, "%s", file, line) -#define LOG_ADDRESS(exp, value, file, line) LOG(exp, value, "%08x", file, line) -#define LOG_TIME(exp, value, file, line) LOG(exp, value, "%lld", file, line) -#define LOG_NUM(exp, value, file, line) LOG(exp, value, "%d", file, line) -#define LOG_HEX(exp, value, file, line) LOG(exp, value, "%x", file, line) -#define LOG_HEX32(exp, value, file, line) LOG(exp, value, "%08x", file, line) -#define LOG_FLOAT(exp, value, file, line) LOG(exp, value, "%f", file, line) - #define SET_NEXT_GAMESTATE(curState, newInit, newStruct) \ if (1) { \ GameState* state = curState; \ @@ -116,33 +98,11 @@ } (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) -#define DEBUG_ARENA_MALLOC(size, file, line) DebugArena_MallocDebug(size, file, line) -#define DEBUG_ARENA_MALLOC_R(size, file, line) DebugArena_MallocRDebug(size, file, line) -#define DEBUG_ARENA_FREE(size, file, line) DebugArena_FreeDebug(size, file, line) -#define SYSTEM_ARENA_MALLOC(size, file, line) SystemArena_MallocDebug(size, file, line) -#define SYSTEM_ARENA_MALLOC_R(size, file, line) SystemArena_MallocRDebug(size, file, line) -#define SYSTEM_ARENA_FREE(size, file, line) SystemArena_FreeDebug(size, file, line) -#define LOG_UTILS_CHECK_NULL_POINTER(exp, ptr, file, line) LogUtils_CheckNullPointer(exp, ptr, file, line) -#define LOG_UTILS_CHECK_VALID_POINTER(exp, ptr, file, line) LogUtils_CheckValidPointer(exp, ptr, file, line) -#define GAME_ALLOC_MALLOC(alloc, size, file, line) GameAlloc_MallocDebug(alloc, size, file, line) - #else - #define DMA_REQUEST_SYNC(ram, vrom, size, file, line) DmaMgr_RequestSync(ram, vrom, size) #define DMA_REQUEST_ASYNC(req, ram, vrom, size, unk5, queue, msg, file, line) DmaMgr_RequestAsync(req, ram, vrom, size, unk5, queue, msg) -#define DEBUG_ARENA_MALLOC(size, file, line) DebugArena_Malloc(size) -#define DEBUG_ARENA_MALLOC_R(size, file, line) DebugArena_MallocR(size) -#define DEBUG_ARENA_FREE(size, file, line) DebugArena_Free(size) -#define SYSTEM_ARENA_MALLOC(size, file, line) SystemArena_Malloc(size) -#define SYSTEM_ARENA_MALLOC_R(size, file, line) SystemArena_MallocR(size) -#define SYSTEM_ARENA_FREE(size, file, line) SystemArena_Free(size) -#define LOG_UTILS_CHECK_NULL_POINTER(exp, ptr, file, line) (void)0 -#define LOG_UTILS_CHECK_VALID_POINTER(exp, ptr, file, line) (void)0 -#define GAME_ALLOC_MALLOC(alloc, size, file, line) GameAlloc_Malloc(alloc, size) - #endif #if PLATFORM_N64 || DEBUG_FEATURES diff --git a/include/variables.h b/include/variables.h index 4512c2f2c8..c6e70eb262 100644 --- a/include/variables.h +++ b/include/variables.h @@ -68,7 +68,6 @@ 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 gDebugCamEnabled; extern GameStateOverlay gGameStateOverlayTable[GAMESTATE_ID_MAX]; extern s32 gZeldaArenaLogSeverity; extern MapData gMapDataTable; @@ -149,18 +148,6 @@ extern u8 gSequenceFontTable[]; extern u8 gSequenceTable[]; extern AudioTable gSampleBankTable; -extern LightningStrike gLightningStrike; -// TODO: These variables are here for BSS ordering but ideally they should not -// be extern. This could be fixed by putting more stuff (e.g. struct definitions) -// between gLightningStrike and gCustomLensFlareOn. -extern s16 sLightningFlashAlpha; -extern s16 sSunDepthTestX; -extern s16 sSunDepthTestY; -extern u8 gCustomLensFlareOn; -extern Vec3f gCustomLensFlarePos; -extern s16 gLensFlareScale; -extern f32 gLensFlareColorIntensity; -extern s16 gLensFlareGlareStrength; extern MapData* gMapData; extern f32 gBossMarkScale; extern u32 D_8016139C; @@ -205,11 +192,5 @@ extern u8 __osContLastCmd; extern u8 __osMaxControllers; extern __OSInode __osPfsInodeCache; extern OSPifRam __osPfsPifRam; -extern u16 gZBuffer[SCREEN_HEIGHT][SCREEN_WIDTH]; // 0x25800 bytes -extern u64 gGfxSPTaskOutputBuffer[0x3000]; // 0x18000 bytes -extern u64 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE / sizeof(u64)]; // 0xC00 bytes -extern u64 gGfxSPTaskStack[SP_DRAM_STACK_SIZE64]; // 0x400 bytes -extern GfxPool gGfxPools[2]; // 0x24820 bytes -extern u8 gAudioHeap[0x38000]; // 0x38000 bytes #endif diff --git a/include/z64.h b/include/z64.h index 3e0f1e7e0b..d572fcfdbd 100644 --- a/include/z64.h +++ b/include/z64.h @@ -58,11 +58,6 @@ #include "libc64/sprintf.h" #include "libu64/debug.h" -typedef enum LensMode { - /* 0 */ LENS_MODE_SHOW_ACTORS, // lens actors are invisible by default, and shown by using lens (for example, invisible enemies) - /* 1 */ LENS_MODE_HIDE_ACTORS // lens actors are visible by default, and hidden by using lens (for example, fake walls) -} LensMode; - typedef struct SetupState { /* 0x00 */ GameState state; } SetupState; // size = 0xA4 diff --git a/include/z64camera.h b/include/z64camera.h index a8b9ebc4a5..f36cb8e075 100644 --- a/include/z64camera.h +++ b/include/z64camera.h @@ -1698,6 +1698,8 @@ typedef enum DebugCamTextColor { /* 7 */ DEBUG_CAM_TEXT_GREEN } DebugCamTextColor; +extern s32 gDebugCamEnabled; + void Camera_Init(Camera* camera, struct View* view, struct CollisionContext* colCtx, struct PlayState* play); void Camera_InitDataUsingPlayer(Camera* camera, struct Player* player); s16 Camera_ChangeStatus(Camera* camera, s16 status); diff --git a/include/z64debug.h b/include/z64debug.h new file mode 100644 index 0000000000..0e2c7334ee --- /dev/null +++ b/include/z64debug.h @@ -0,0 +1,17 @@ +#ifndef Z64DEBUG_H +#define Z64DEBUG_H + +#include "ultra64.h" + +struct GraphicsContext; +struct Input; + +void Regs_Init(void); +void DebugCamera_ScreenText(u8 x, u8 y, const char* text); +void DebugCamera_ScreenTextColored(u8 x, u8 y, u8 colorIndex, const char* text); +#if DEBUG_FEATURES +void Regs_UpdateEditor(struct Input* input); +#endif +void Debug_DrawText(struct GraphicsContext* gfxCtx); + +#endif diff --git a/include/z64environment.h b/include/z64environment.h index 598c4655a9..4c4bc770cd 100644 --- a/include/z64environment.h +++ b/include/z64environment.h @@ -242,6 +242,19 @@ extern u8 gLightConfigAfterUnderwater; extern u8 gInterruptSongOfStorms; extern u16 gTimeSpeed; +extern LightningStrike gLightningStrike; +// TODO: These variables are here for BSS ordering but ideally they should not +// be extern. This could be fixed by putting more stuff (e.g. struct definitions) +// between gLightningStrike and gCustomLensFlareOn. +extern s16 sLightningFlashAlpha; +extern s16 sSunDepthTestX; +extern s16 sSunDepthTestY; +extern u8 gCustomLensFlareOn; +extern Vec3f gCustomLensFlarePos; +extern s16 gLensFlareScale; +extern f32 gLensFlareColorIntensity; +extern s16 gLensFlareGlareStrength; + void Environment_UpdateSkybox(u8 skyboxId, EnvironmentContext* envCtx, struct SkyboxContext* skyboxCtx); void Environment_DrawSkyboxFilters(struct PlayState* play); diff --git a/include/z64font.h b/include/z64font.h new file mode 100644 index 0000000000..72f97fddd6 --- /dev/null +++ b/include/z64font.h @@ -0,0 +1,41 @@ +#ifndef Z64FONT_H +#define Z64FONT_H + +#include "ultra64.h" + +// TODO get these properties from the textures themselves +#define FONT_CHAR_TEX_WIDTH 16 +#define FONT_CHAR_TEX_HEIGHT 16 +#define FONT_CHAR_TEX_SIZE ((FONT_CHAR_TEX_WIDTH * FONT_CHAR_TEX_HEIGHT) / 2) // 16x16 I4 texture + +typedef struct Font { + /* 0x0000 */ u32 msgOffset; + /* 0x0004 */ u32 msgLength; + union { + /* 0x0008 */ u8 charTexBuf[FONT_CHAR_TEX_SIZE * 120]; + /* 0x0008 */ u64 force_structure_alignment_charTex; + }; + union { + /* 0x3C08 */ u8 iconBuf[FONT_CHAR_TEX_SIZE]; + /* 0x3C08 */ u64 force_structure_alignment_icon; + }; + union { + /* 0x3C88 */ u8 fontBuf[FONT_CHAR_TEX_SIZE * 320]; + /* 0x3C88 */ u64 force_structure_alignment_font; + }; + union { + /* 0xDC88 */ u8 msgBuf[1280]; + /* 0xDC88 */ u16 msgBufWide[640]; + /* 0xDC88 */ u64 force_structure_alignment_msg; + }; +} Font; // size = 0xE188 + +#if PLATFORM_IQUE +void Font_LoadCharCHN(Font* font, u16 character, u16 codePointIndex); +#endif +void Font_LoadCharWide(Font* font, u16 character, u16 codePointIndex); +void Font_LoadChar(Font* font, u8 character, u16 codePointIndex); +void Font_LoadMessageBoxIcon(Font* font, u16 icon); +void Font_LoadOrderedFont(Font* font); + +#endif diff --git a/include/z64game.h b/include/z64game.h index 918f73fb3d..32961fb453 100644 --- a/include/z64game.h +++ b/include/z64game.h @@ -4,22 +4,11 @@ #include "ultra64/ultratypes.h" #include "libu64/pad.h" +#include "gamealloc.h" #include "tha.h" struct GraphicsContext; -typedef struct GameAllocEntry { - /* 0x00 */ struct GameAllocEntry* next; - /* 0x04 */ struct GameAllocEntry* prev; - /* 0x08 */ u32 size; - /* 0x0C */ u32 unk_0C; -} GameAllocEntry; // size = 0x10 - -typedef struct GameAlloc { - /* 0x00 */ GameAllocEntry base; - /* 0x10 */ GameAllocEntry* head; -} GameAlloc; // size = 0x14 - // 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) diff --git a/include/z64lifemeter.h b/include/z64lifemeter.h new file mode 100644 index 0000000000..29b2656b88 --- /dev/null +++ b/include/z64lifemeter.h @@ -0,0 +1,14 @@ +#ifndef Z64LIFEMETER_H +#define Z64LIFEMETER_H + +#include "ultra64/ultratypes.h" + +struct PlayState; + +void Health_InitMeter(struct PlayState* play); +void Health_UpdateMeter(struct PlayState* play); +void Health_DrawMeter(struct PlayState* play); +void Health_UpdateBeatingHeart(struct PlayState* play); +u32 Health_IsCritical(void); + +#endif diff --git a/include/z64message.h b/include/z64message.h index d332ac4549..3758b690fd 100644 --- a/include/z64message.h +++ b/include/z64message.h @@ -3,6 +3,7 @@ #include "z64view.h" #include "versions.h" +#include "z64font.h" struct OcarinaStaff; struct Actor; @@ -14,11 +15,6 @@ typedef enum TextBoxIcon { /* 2 */ TEXTBOX_ICON_ARROW } TextBoxIcon; -// TODO get these properties from the textures themselves -#define FONT_CHAR_TEX_WIDTH 16 -#define FONT_CHAR_TEX_HEIGHT 16 -#define FONT_CHAR_TEX_SIZE ((FONT_CHAR_TEX_WIDTH * FONT_CHAR_TEX_HEIGHT) / 2) // 16x16 I4 texture - // TODO get these properties from the textures themselves #define MESSAGE_STATIC_TEX_SIZE 0x1000 @@ -129,28 +125,6 @@ typedef enum TextState { /* 10 */ TEXT_STATE_AWAITING_NEXT } TextState; -typedef struct Font { - /* 0x0000 */ u32 msgOffset; - /* 0x0004 */ u32 msgLength; - union { - /* 0x0008 */ u8 charTexBuf[FONT_CHAR_TEX_SIZE * 120]; - /* 0x0008 */ u64 force_structure_alignment_charTex; - }; - union { - /* 0x3C08 */ u8 iconBuf[FONT_CHAR_TEX_SIZE]; - /* 0x3C08 */ u64 force_structure_alignment_icon; - }; - union { - /* 0x3C88 */ u8 fontBuf[FONT_CHAR_TEX_SIZE * 320]; - /* 0x3C88 */ u64 force_structure_alignment_font; - }; - union { - /* 0xDC88 */ u8 msgBuf[1280]; - /* 0xDC88 */ u16 msgBufWide[640]; - /* 0xDC88 */ u64 force_structure_alignment_msg; - }; -} Font; // size = 0xE188 - #define TEXTBOX_ENDTYPE_DEFAULT 0x00 #define TEXTBOX_ENDTYPE_2_CHOICE 0x10 #define TEXTBOX_ENDTYPE_3_CHOICE 0x20 diff --git a/include/z64play.h b/include/z64play.h index 75360543d9..a0f5346e4b 100644 --- a/include/z64play.h +++ b/include/z64play.h @@ -17,6 +17,7 @@ #include "z64message.h" #include "z64object.h" #include "z64pause.h" +#include "z64room.h" #include "z64scene.h" #include "z64sfx_source.h" #include "z64skybox.h" diff --git a/include/z64room.h b/include/z64room.h new file mode 100644 index 0000000000..72c6f0982b --- /dev/null +++ b/include/z64room.h @@ -0,0 +1,174 @@ +#ifndef Z64ROOM_H +#define Z64ROOM_H + +#include "ultra64.h" +#include "z64dma.h" +#include "z64math.h" + +struct Input; +struct PlayState; + +// Room shapes + +typedef enum RoomShapeType { + /* 0 */ ROOM_SHAPE_TYPE_NORMAL, + /* 1 */ ROOM_SHAPE_TYPE_IMAGE, + /* 2 */ ROOM_SHAPE_TYPE_CULLABLE, + /* 3 */ ROOM_SHAPE_TYPE_MAX +} RoomShapeType; + +typedef struct RoomShapeBase { + /* 0x00 */ u8 type; +} RoomShapeBase; // size = 0x01 + +typedef struct RoomShapeDListsEntry { + /* 0x00 */ Gfx* opa; + /* 0x04 */ Gfx* xlu; +} RoomShapeDListsEntry; // size = 0x08 + +typedef struct RoomShapeNormal { + /* 0x00 */ RoomShapeBase base; + /* 0x01 */ u8 numEntries; + /* 0x04 */ RoomShapeDListsEntry* entries; + /* 0x08 */ RoomShapeDListsEntry* entriesEnd; +} RoomShapeNormal; // size = 0x0C + +typedef enum RoomShapeImageAmountType { + /* 1 */ ROOM_SHAPE_IMAGE_AMOUNT_SINGLE = 1, + /* 2 */ ROOM_SHAPE_IMAGE_AMOUNT_MULTI +} RoomShapeImageAmountType; + +typedef struct RoomShapeImageBase { + /* 0x00 */ RoomShapeBase base; + /* 0x01 */ u8 amountType; // RoomShapeImageAmountType + /* 0x04 */ RoomShapeDListsEntry* entry; +} RoomShapeImageBase; // size = 0x08 + +typedef struct RoomShapeImageSingle { + /* 0x00 */ RoomShapeImageBase base; + /* 0x08 */ void* source; + /* 0x0C */ u32 unk_0C; + /* 0x10 */ void* tlut; + /* 0x14 */ u16 width; + /* 0x16 */ u16 height; + /* 0x18 */ u8 fmt; + /* 0x19 */ u8 siz; + /* 0x1A */ u16 tlutMode; + /* 0x1C */ u16 tlutCount; +} RoomShapeImageSingle; // size = 0x20 + +typedef struct RoomShapeImageMultiBgEntry { + /* 0x00 */ u16 unk_00; + /* 0x02 */ u8 bgCamIndex; // for which bg cam index is this entry for + /* 0x04 */ void* source; + /* 0x08 */ u32 unk_0C; + /* 0x0C */ void* tlut; + /* 0x10 */ u16 width; + /* 0x12 */ u16 height; + /* 0x14 */ u8 fmt; + /* 0x15 */ u8 siz; + /* 0x16 */ u16 tlutMode; + /* 0x18 */ u16 tlutCount; +} RoomShapeImageMultiBgEntry; // size = 0x1C + +typedef struct RoomShapeImageMulti { + /* 0x00 */ RoomShapeImageBase base; + /* 0x08 */ u8 numBackgrounds; + /* 0x0C */ RoomShapeImageMultiBgEntry* backgrounds; +} RoomShapeImageMulti; // size = 0x10 + +typedef struct RoomShapeCullableEntry { + /* 0x00 */ Vec3s boundsSphereCenter; + /* 0x06 */ s16 boundsSphereRadius; + /* 0x08 */ Gfx* opa; + /* 0x0C */ Gfx* xlu; +} RoomShapeCullableEntry; // size = 0x10 + +#define ROOM_SHAPE_CULLABLE_MAX_ENTRIES 64 + +typedef struct RoomShapeCullable { + /* 0x00 */ RoomShapeBase base; + /* 0x01 */ u8 numEntries; + /* 0x04 */ RoomShapeCullableEntry* entries; + /* 0x08 */ RoomShapeCullableEntry* entriesEnd; +} RoomShapeCullable; // size = 0x0C + +typedef union RoomShape { + RoomShapeBase base; + RoomShapeNormal normal; + union { + RoomShapeImageBase base; + RoomShapeImageSingle single; + RoomShapeImageMulti multi; + } image; + RoomShapeCullable cullable; +} RoomShape; // "Ground Shape" + +typedef enum RoomType { + /* 0 */ ROOM_TYPE_NORMAL, + /* 1 */ ROOM_TYPE_DUNGEON, // Blocks Sun's Song's time advance effect. Not exclusively used by typical dungeon rooms. + /* 2 */ ROOM_TYPE_INDOORS, // Reduces player run speed and blocks player from attacking or jumping. + /* 3 */ ROOM_TYPE_3, // Unused. Color dithering is turned off when drawing the room and other things. + /* 4 */ ROOM_TYPE_4, // Unused. Prevents switching to CAM_SET_HORSE when mounting a horse. + /* 5 */ ROOM_TYPE_BOSS // Disables Environment_AdjustLights +} RoomType; + +typedef enum RoomEnvironmentType { + /* 0 */ ROOM_ENV_DEFAULT, + /* 1 */ ROOM_ENV_COLD, + /* 2 */ ROOM_ENV_WARM, + /* 3 */ ROOM_ENV_HOT, // Enables hot room timer for the current room + /* 4 */ ROOM_ENV_UNK_STRETCH_1, + /* 5 */ ROOM_ENV_UNK_STRETCH_2, + /* 6 */ ROOM_ENV_UNK_STRETCH_3 +} RoomEnvironmentType; + +typedef enum LensMode { + /* 0 */ LENS_MODE_SHOW_ACTORS, // lens actors are invisible by default, and shown by using lens (for example, invisible enemies) + /* 1 */ LENS_MODE_HIDE_ACTORS // lens actors are visible by default, and hidden by using lens (for example, fake walls) +} LensMode; + +typedef struct Room { + /* 0x00 */ s8 num; // -1 is invalid room + /* 0x01 */ u8 unk_01; + /* 0x02 */ u8 environmentType; + /* 0x03 */ u8 type; + /* 0x04 */ s8 echo; + /* 0x05 */ u8 lensMode; + /* 0x08 */ RoomShape* roomShape; // original name: "ground_shape" + /* 0x0C */ void* segment; + /* 0x10 */ char unk_10[0x4]; +} Room; // size = 0x14 + +typedef struct RoomContext { + /* 0x00 */ Room curRoom; + /* 0x14 */ Room prevRoom; + /* 0x28 */ void* bufPtrs[2]; // Start and end pointers for the room buffer. Can be split into two pages, where page 0 is allocated from the start pointer and page 1 is allocated from the end pointer. + /* 0x30 */ u8 activeBufPage; // 0 - First page in memory, 1 - Last page in memory + /* 0x31 */ s8 status; // 0 - Free for new room request, 1 - DmaRequest for a new room is in progress + /* 0x34 */ void* roomRequestAddr; // Pointer to where the requested room segment will be stored + /* 0x38 */ DmaRequest dmaRequest; + /* 0x58 */ OSMesgQueue loadQueue; + /* 0x70 */ OSMesg loadMsg; + /* 0x74 */ s16 drawParams[2]; // context-specific data used by the current scene draw config +} RoomContext; // size = 0x78 + +typedef struct RoomList { + /* 0x00 */ u8 count; + /* 0x04 */ RomFile* romFiles; // Array of rom addresses for each room in a scene +} RoomList; + +#define ROOM_DRAW_OPA (1 << 0) +#define ROOM_DRAW_XLU (1 << 1) + +void func_80095AA0(struct PlayState* play, Room* room, struct Input* input, s32 arg3); +void Room_DrawBackground2D(Gfx** gfxP, void* tex, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 tlutMode, + u16 tlutCount, f32 offsetX, f32 offsetY); +void Room_Init(struct PlayState* play, Room* room); +u32 Room_SetupFirstRoom(struct PlayState* play, RoomContext* roomCtx); +s32 Room_RequestNewRoom(struct PlayState* play, RoomContext* roomCtx, s32 roomNum); +s32 Room_ProcessRoomRequest(struct PlayState* play, RoomContext* roomCtx); +void Room_Draw(struct PlayState* play, Room* room, u32 flags); +void Room_FinishRoomChange(struct PlayState* play, RoomContext* roomCtx); + +#endif diff --git a/include/z64scene.h b/include/z64scene.h index c22dd95e8e..eacd62ed8a 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -4,7 +4,6 @@ #include "macros.h" #include "ultra64.h" #include "z64bgcheck.h" -#include "z64dma.h" #include "z64environment.h" #include "z64light.h" #include "z64math.h" @@ -14,6 +13,7 @@ struct GameState; struct PlayState; +struct RoomShapeBase; typedef struct SceneTableEntry { /* 0x00 */ RomFile sceneFile; @@ -52,154 +52,6 @@ typedef struct Spawn { /* 0x01 */ u8 room; } Spawn; -// Room shapes - -typedef enum RoomShapeType { - /* 0 */ ROOM_SHAPE_TYPE_NORMAL, - /* 1 */ ROOM_SHAPE_TYPE_IMAGE, - /* 2 */ ROOM_SHAPE_TYPE_CULLABLE, - /* 3 */ ROOM_SHAPE_TYPE_MAX -} RoomShapeType; - -typedef struct RoomShapeBase { - /* 0x00 */ u8 type; -} RoomShapeBase; // size = 0x01 - -typedef struct RoomShapeDListsEntry { - /* 0x00 */ Gfx* opa; - /* 0x04 */ Gfx* xlu; -} RoomShapeDListsEntry; // size = 0x08 - -typedef struct RoomShapeNormal { - /* 0x00 */ RoomShapeBase base; - /* 0x01 */ u8 numEntries; - /* 0x04 */ RoomShapeDListsEntry* entries; - /* 0x08 */ RoomShapeDListsEntry* entriesEnd; -} RoomShapeNormal; // size = 0x0C - -typedef enum RoomShapeImageAmountType { - /* 1 */ ROOM_SHAPE_IMAGE_AMOUNT_SINGLE = 1, - /* 2 */ ROOM_SHAPE_IMAGE_AMOUNT_MULTI -} RoomShapeImageAmountType; - -typedef struct RoomShapeImageBase { - /* 0x00 */ RoomShapeBase base; - /* 0x01 */ u8 amountType; // RoomShapeImageAmountType - /* 0x04 */ RoomShapeDListsEntry* entry; -} RoomShapeImageBase; // size = 0x08 - -typedef struct RoomShapeImageSingle { - /* 0x00 */ RoomShapeImageBase base; - /* 0x08 */ void* source; - /* 0x0C */ u32 unk_0C; - /* 0x10 */ void* tlut; - /* 0x14 */ u16 width; - /* 0x16 */ u16 height; - /* 0x18 */ u8 fmt; - /* 0x19 */ u8 siz; - /* 0x1A */ u16 tlutMode; - /* 0x1C */ u16 tlutCount; -} RoomShapeImageSingle; // size = 0x20 - -typedef struct RoomShapeImageMultiBgEntry { - /* 0x00 */ u16 unk_00; - /* 0x02 */ u8 bgCamIndex; // for which bg cam index is this entry for - /* 0x04 */ void* source; - /* 0x08 */ u32 unk_0C; - /* 0x0C */ void* tlut; - /* 0x10 */ u16 width; - /* 0x12 */ u16 height; - /* 0x14 */ u8 fmt; - /* 0x15 */ u8 siz; - /* 0x16 */ u16 tlutMode; - /* 0x18 */ u16 tlutCount; -} RoomShapeImageMultiBgEntry; // size = 0x1C - -typedef struct RoomShapeImageMulti { - /* 0x00 */ RoomShapeImageBase base; - /* 0x08 */ u8 numBackgrounds; - /* 0x0C */ RoomShapeImageMultiBgEntry* backgrounds; -} RoomShapeImageMulti; // size = 0x10 - -typedef struct RoomShapeCullableEntry { - /* 0x00 */ Vec3s boundsSphereCenter; - /* 0x06 */ s16 boundsSphereRadius; - /* 0x08 */ Gfx* opa; - /* 0x0C */ Gfx* xlu; -} RoomShapeCullableEntry; // size = 0x10 - -#define ROOM_SHAPE_CULLABLE_MAX_ENTRIES 64 - -typedef struct RoomShapeCullable { - /* 0x00 */ RoomShapeBase base; - /* 0x01 */ u8 numEntries; - /* 0x04 */ RoomShapeCullableEntry* entries; - /* 0x08 */ RoomShapeCullableEntry* entriesEnd; -} RoomShapeCullable; // size = 0x0C - -typedef union RoomShape { - RoomShapeBase base; - RoomShapeNormal normal; - union { - RoomShapeImageBase base; - RoomShapeImageSingle single; - RoomShapeImageMulti multi; - } image; - RoomShapeCullable cullable; -} RoomShape; // "Ground Shape" - -typedef enum RoomType { - /* 0 */ ROOM_TYPE_NORMAL, - /* 1 */ ROOM_TYPE_DUNGEON, // Blocks Sun's Song's time advance effect. Not exclusively used by typical dungeon rooms. - /* 2 */ ROOM_TYPE_INDOORS, // Reduces player run speed and blocks player from attacking or jumping. - /* 3 */ ROOM_TYPE_3, // Unused. Color dithering is turned off when drawing the room and other things. - /* 4 */ ROOM_TYPE_4, // Unused. Prevents switching to CAM_SET_HORSE when mounting a horse. - /* 5 */ ROOM_TYPE_BOSS // Disables Environment_AdjustLights -} RoomType; - -typedef enum RoomEnvironmentType { - /* 0 */ ROOM_ENV_DEFAULT, - /* 1 */ ROOM_ENV_COLD, - /* 2 */ ROOM_ENV_WARM, - /* 3 */ ROOM_ENV_HOT, // Enables hot room timer for the current room - /* 4 */ ROOM_ENV_UNK_STRETCH_1, - /* 5 */ ROOM_ENV_UNK_STRETCH_2, - /* 6 */ ROOM_ENV_UNK_STRETCH_3 -} RoomEnvironmentType; - -typedef struct Room { - /* 0x00 */ s8 num; // -1 is invalid room - /* 0x01 */ u8 unk_01; - /* 0x02 */ u8 environmentType; - /* 0x03 */ u8 type; - /* 0x04 */ s8 echo; - /* 0x05 */ u8 lensMode; - /* 0x08 */ RoomShape* roomShape; // original name: "ground_shape" - /* 0x0C */ void* segment; - /* 0x10 */ char unk_10[0x4]; -} Room; // size = 0x14 - -typedef struct RoomContext { - /* 0x00 */ Room curRoom; - /* 0x14 */ Room prevRoom; - /* 0x28 */ void* bufPtrs[2]; // Start and end pointers for the room buffer. Can be split into two pages, where page 0 is allocated from the start pointer and page 1 is allocated from the end pointer. - /* 0x30 */ u8 activeBufPage; // 0 - First page in memory, 1 - Last page in memory - /* 0x31 */ s8 status; // 0 - Free for new room request, 1 - DmaRequest for a new room is in progress - /* 0x34 */ void* roomRequestAddr; // Pointer to where the requested room segment will be stored - /* 0x38 */ DmaRequest dmaRequest; - /* 0x58 */ OSMesgQueue loadQueue; - /* 0x70 */ OSMesg loadMsg; - /* 0x74 */ s16 drawParams[2]; // context-specific data used by the current scene draw config -} RoomContext; // size = 0x78 - -typedef struct RoomList { - /* 0x00 */ u8 count; - /* 0x04 */ RomFile* romFiles; // Array of rom addresses for each room in a scene -} RoomList; - -#define ROOM_DRAW_OPA (1 << 0) -#define ROOM_DRAW_XLU (1 << 1) - // Scene commands typedef struct SCmdBase { @@ -269,7 +121,7 @@ typedef struct SCmdRoomBehavior { typedef struct SCmdMesh { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; - /* 0x04 */ RoomShapeBase* data; + /* 0x04 */ struct RoomShapeBase* data; } SCmdMesh; typedef struct SCmdObjectList { diff --git a/include/z64sram.h b/include/z64sram.h index 475b9fc5b9..9fcaf83b03 100644 --- a/include/z64sram.h +++ b/include/z64sram.h @@ -3,6 +3,10 @@ #include "ultra64/ultratypes.h" +struct FileSelectState; +struct GameState; +struct PlayState; + typedef struct SramContext { /* 0x00 */ u8* readBuff; } SramContext; // size = 0x4 @@ -17,4 +21,17 @@ typedef enum SramHeaderField { /* 0x03 */ SRAM_HEADER_MAGIC // must be the value in `sSramDefaultHeader` for save to be considered valid } SramHeaderField; +void Sram_InitNewSave(void); +void Sram_InitDebugSave(void); +void Sram_OpenSave(SramContext* sramCtx); +void Sram_WriteSave(SramContext* sramCtx); +void Sram_VerifyAndLoadAllSaves(struct FileSelectState* fileSelect, SramContext* sramCtx); +void Sram_InitSave(struct FileSelectState* fileSelect, SramContext* sramCtx); +void Sram_EraseSave(struct FileSelectState* fileSelect, SramContext* sramCtx); +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); + #endif diff --git a/include/z64ss_sram.h b/include/z64ss_sram.h new file mode 100644 index 0000000000..ffd628239d --- /dev/null +++ b/include/z64ss_sram.h @@ -0,0 +1,12 @@ +#ifndef Z64SS_SRAM_H +#define Z64SS_SRAM_H + +#include "libc/stddef.h" +#include "ultra64/ultratypes.h" + +void SsSram_Init(s32 addr, u8 handleType, u8 handleDomain, u8 handleLatency, u8 handlePageSize, u8 handleRelDuration, + u8 handlePulse, u32 handleSpeed); +void SsSram_Dma(void* dramAddr, size_t size, s32 direction); +void SsSram_ReadWrite(s32 addr, void* dramAddr, size_t size, s32 direction); + +#endif diff --git a/src/audio/lib/load.c b/src/audio/lib/load.c index 0aa3324d73..8ecf7f8886 100644 --- a/src/audio/lib/load.c +++ b/src/audio/lib/load.c @@ -1,7 +1,9 @@ #include "ultra64.h" -#include "global.h" +#include "buffers.h" #include "versions.h" +#include "global.h" + #define MK_ASYNC_MSG(retData, tableType, id, loadStatus) \ (((retData) << 24) | ((tableType) << 16) | ((id) << 8) | (loadStatus)) #define ASYNC_TBLTYPE(v) ((u8)(v >> 16)) diff --git a/src/audio/session_init.c b/src/audio/session_init.c index a6e67f40d4..d04a955bca 100644 --- a/src/audio/session_init.c +++ b/src/audio/session_init.c @@ -1,4 +1,8 @@ +#include "buffers.h" +#include "z64audio.h" + #include "global.h" + #include "assets/audio/sequence_sizes.h" #include "assets/audio/soundfont_sizes.h" diff --git a/src/boot/idle.c b/src/boot/idle.c index b1a6dd2c3b..ffc6de34b4 100644 --- a/src/boot/idle.c +++ b/src/boot/idle.c @@ -1,10 +1,15 @@ -#include "global.h" +#include "buffers.h" +#include "segment_symbols.h" #include "stack.h" +#include "stackcheck.h" #include "terminal.h" #include "versions.h" #include "z64thread.h" -#pragma increment_block_number "gc-eu:64 gc-eu-mq:64 gc-jp:64 gc-jp-ce:64 gc-jp-mq:64 gc-us:64 gc-us-mq:64 ntsc-1.2:64" +#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.0:138 ntsc-1.1:138 ntsc-1.2:138 pal-1.0:136 pal-1.1:136" OSThread sMainThread; #if OOT_VERSION < PAL_1_0 diff --git a/src/buffers/audio_heap.c b/src/buffers/audio_heap.c index b6474ccc6a..b8e0e336e7 100644 --- a/src/buffers/audio_heap.c +++ b/src/buffers/audio_heap.c @@ -1,3 +1,5 @@ -#include "z64.h" +#include "ultra64/ultratypes.h" +#include "alignment.h" +#include "buffers.h" ALIGNED(16) u8 gAudioHeap[0x38000]; diff --git a/src/buffers/gfxbuffers.c b/src/buffers/gfxbuffers.c index fa466bc829..1806570ae4 100644 --- a/src/buffers/gfxbuffers.c +++ b/src/buffers/gfxbuffers.c @@ -1,4 +1,7 @@ -#include "z64.h" +#include "alignment.h" +#include "buffers.h" +#include "gfx.h" +#include "ultra64.h" ALIGNED(16) u64 gGfxSPTaskOutputBuffer[0x3000]; diff --git a/src/buffers/zbuffer.c b/src/buffers/zbuffer.c index d9e5d2784a..0eda889219 100644 --- a/src/buffers/zbuffer.c +++ b/src/buffers/zbuffer.c @@ -1,3 +1,6 @@ -#include "z64.h" +#include "alignment.h" +#include "buffers.h" +#include "macros.h" +#include "ultra64/ultratypes.h" ALIGNED(64) u16 gZBuffer[SCREEN_HEIGHT][SCREEN_WIDTH]; diff --git a/src/code/db_camera.c b/src/code/db_camera.c index bc9fa468c1..5b997b490e 100644 --- a/src/code/db_camera.c +++ b/src/code/db_camera.c @@ -1,7 +1,7 @@ -#include "global.h" #include "libu64/gfxprint.h" #include "attributes.h" #include "controller.h" +#include "debug_arena.h" #include "letterbox.h" #include "mempak.h" #include "regs.h" @@ -10,6 +10,7 @@ #include "z64camera.h" #include "z64cutscene.h" #include "z64cutscene_spline.h" +#include "z64debug.h" #include "z64debug_display.h" #include "z64olib.h" #include "z64play.h" diff --git a/src/code/debug_malloc.c b/src/code/debug_malloc.c index b6aa81b329..acfca47ca5 100644 --- a/src/code/debug_malloc.c +++ b/src/code/debug_malloc.c @@ -1,5 +1,7 @@ -#include "global.h" #include "libc64/os_malloc.h" +#include "debug_arena.h" + +#include "macros.h" #define LOG_SEVERITY_NOLOG 0 #define LOG_SEVERITY_ERROR 2 diff --git a/src/code/game.c b/src/code/game.c index 4367839528..2e9e9e2d5b 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -1,12 +1,29 @@ -#include "global.h" +#include "libu64/debug.h" +#include "libu64/gfxprint.h" +#include "audiomgr.h" +#include "buffers.h" +#include "controller.h" +#include "debug_arena.h" +#include "gfx.h" +#include "gfxalloc.h" #include "fault.h" #include "libc64/os_malloc.h" -#include "terminal.h" -#include "versions.h" #include "line_numbers.h" #if PLATFORM_N64 #include "n64dd.h" #endif +#include "padmgr.h" +#include "regs.h" +#include "rumble.h" +#include "speed_meter.h" +#include "terminal.h" +#include "versions.h" +#include "z64debug.h" +#include "z64game.h" +#include "z64vis.h" + +#include "macros.h" +#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" diff --git a/src/code/gamealloc.c b/src/code/gamealloc.c index d625bc65f7..47591fd00b 100644 --- a/src/code/gamealloc.c +++ b/src/code/gamealloc.c @@ -1,4 +1,8 @@ -#include "global.h" +#include "libc64/malloc.h" +#include "libu64/debug.h" +#include "gamealloc.h" + +#include "macros.h" void GameAlloc_Log(GameAlloc* this) { GameAllocEntry* iter; diff --git a/src/code/graph.c b/src/code/graph.c index dfa1dc2f2a..650b7dd2ef 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -1,6 +1,7 @@ #include "libc64/malloc.h" #include "libc64/sprintf.h" #include "libu64/debug.h" +#include "buffers.h" #include "gfx.h" #include "fault.h" #include "line_numbers.h" diff --git a/src/code/main.c b/src/code/main.c index 4a55baf439..f930625013 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -12,7 +12,7 @@ extern struct Scheduler gScheduler; extern struct PadMgr gPadMgr; extern struct IrqMgr gIrqMgr; -#include "global.h" +#include "debug_arena.h" #include "fault.h" #include "segmented_address.h" #include "stack.h" @@ -22,10 +22,13 @@ extern struct IrqMgr gIrqMgr; #include "cic6105.h" #include "n64dd.h" #endif +#include "z64debug.h" #include "z64thread.h" +#include "global.h" + #pragma increment_block_number "gc-eu:96 gc-eu-mq:96 gc-jp:96 gc-jp-ce:96 gc-jp-mq:96 gc-us:96 gc-us-mq:96 ique-cn:96" \ - "ntsc-1.0:78 ntsc-1.1:78 ntsc-1.2:78 pal-1.0:76 pal-1.1:76" + "ntsc-1.0:79 ntsc-1.1:79 ntsc-1.2:79 pal-1.0:77 pal-1.1:77" extern u8 _buffersSegmentEnd[]; diff --git a/src/code/sched.c b/src/code/sched.c index 3c4199aefe..57eae69500 100644 --- a/src/code/sched.c +++ b/src/code/sched.c @@ -39,11 +39,16 @@ * * @see irqmgr.c */ -#include "global.h" +#include "libu64/debug.h" #include "fault.h" +#include "irqmgr.h" +#include "regs.h" +#include "sched.h" #include "versions.h" #include "z64thread.h" +#include "global.h" + #define RSP_DONE_MSG 667 #define RDP_DONE_MSG 668 #define NOTIFY_MSG 670 // original name: ENTRY_MSG diff --git a/src/code/sys_math3d_draw.c b/src/code/sys_math3d_draw.c index 76651c825e..7781a79e2e 100644 --- a/src/code/sys_math3d_draw.c +++ b/src/code/sys_math3d_draw.c @@ -1,4 +1,5 @@ -#include "z64.h" +#include "sys_math3d.h" +#include "z64play.h" void Math3D_DrawSphere(PlayState* play, Sphere16* sph) { } diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index f89840fb67..c5d22fd6a2 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -1,8 +1,17 @@ -#include "global.h" -#include "terminal.h" +#include "libu64/debug.h" +#include "attributes.h" #include "line_numbers.h" +#include "regs.h" +#include "segmented_address.h" +#include "sys_math3d.h" +#include "terminal.h" +#include "z_lib.h" +#include "z64bgcheck.h" +#include "z64play.h" +#include "z64player.h" +#include "z64skin_matrix.h" -#pragma increment_block_number "ntsc-1.0:64 ntsc-1.1:64 ntsc-1.2:64" +#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 21ba635c85..a5a18c29c4 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -2,6 +2,7 @@ #include "quake.h" #include "terminal.h" #include "z64cutscene_spline.h" +#include "z64debug.h" #include "z64olib.h" #include "z64save.h" #include "overlays/actors/ovl_En_Horse/z_en_horse.h" @@ -3641,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:117 ntsc-1.1:117 ntsc-1.2:117 pal-1.0:115 pal-1.1:115" + "ique-cn:128 ntsc-1.0:118 ntsc-1.1:118 ntsc-1.2:118 pal-1.0:116 pal-1.1:116" s32 Camera_KeepOn4(Camera* camera) { static Vec3f D_8015BD50; diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index e05bb44d17..5564b7ef36 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -15,7 +15,7 @@ #include "overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.h" #include "z_lib.h" -#pragma increment_block_number "ique-cn:0 ntsc-1.0:248 ntsc-1.1:248 ntsc-1.2:248 pal-1.0:248 pal-1.1:248" +#pragma increment_block_number "ique-cn:0 ntsc-1.0:232 ntsc-1.1:232 ntsc-1.2:232 pal-1.0:232 pal-1.1:232" typedef s32 (*ColChkResetFunc)(PlayState*, Collider*); typedef void (*ColChkApplyFunc)(PlayState*, CollisionCheckContext*, Collider*); diff --git a/src/code/z_construct.c b/src/code/z_construct.c index dacec26d9b..4696cb76e4 100644 --- a/src/code/z_construct.c +++ b/src/code/z_construct.c @@ -1,7 +1,9 @@ -#include "global.h" #include "map.h" #include "regs.h" +#include "segment_symbols.h" #include "versions.h" +#include "z64lifemeter.h" +#include "z64interface.h" #include "z64ocarina.h" #include "z64play.h" #include "z64save.h" diff --git a/src/code/z_debug.c b/src/code/z_debug.c index 70d108e167..ed02754fc1 100644 --- a/src/code/z_debug.c +++ b/src/code/z_debug.c @@ -8,6 +8,7 @@ #include "regs.h" #include "rumble.h" #include "ultra64.h" +#include "z64debug.h" #include "macros.h" diff --git a/src/code/z_kanfont.c b/src/code/z_kanfont.c index fa038276fe..21ba416b35 100644 --- a/src/code/z_kanfont.c +++ b/src/code/z_kanfont.c @@ -1,6 +1,12 @@ -#include "global.h" +#include "kanread.h" #include "message_data_static.h" +#include "segment_symbols.h" #include "versions.h" +#include "z64dma.h" +#include "z64font.h" +#include "z64message.h" + +#include "macros.h" /** * Loads a texture from kanji for the requested `character` into the character texture buffer diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 8e835bdd46..3656d71795 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -1,15 +1,32 @@ #pragma increment_block_number "gc-eu:64 gc-eu-mq:64 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:0" \ "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:64 pal-1.1:64" -#include "global.h" +#include "libc64/qrand.h" +#include "libu64/gfxprint.h" +#include "buffers.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "gfxalloc.h" #include "ultra64.h" +#include "regs.h" +#include "rumble.h" +#include "segment_symbols.h" +#include "segmented_address.h" #include "seqcmd.h" #include "sequence.h" +#include "sfx.h" +#include "sys_math.h" +#include "sys_math3d.h" +#include "sys_matrix.h" #include "terminal.h" #include "versions.h" - +#include "z_lib.h" +#include "z64audio.h" #include "z64cutscene.h" #include "z64frame_advance.h" +#include "z64environment.h" +#include "z64play.h" +#include "z64player.h" #include "z64save.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" @@ -218,8 +235,8 @@ s16 sLightningFlashAlpha; s16 sSunDepthTestX; s16 sSunDepthTestY; -#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:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" +#pragma increment_block_number "gc-eu:160 gc-eu-mq:160 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ + "ique-cn:128 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:192 pal-1.1:192" LightNode* sNGameOverLightNode; LightInfo sNGameOverLightInfo; diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c index 1395580d0e..cab9737ff7 100644 --- a/src/code/z_lifemeter.c +++ b/src/code/z_lifemeter.c @@ -3,12 +3,11 @@ #include "sfx.h" #include "sys_matrix.h" #include "z_lib.h" +#include "z64lifemeter.h" #include "z64play.h" #include "z64player.h" #include "z64save.h" -#include "global.h" - #include "assets/textures/parameter_static/parameter_static.h" static s16 sHeartsPrimColors[3][3] = { diff --git a/src/code/z_lights.c b/src/code/z_lights.c index 5ee208f705..e9f5338503 100644 --- a/src/code/z_lights.c +++ b/src/code/z_lights.c @@ -1,4 +1,10 @@ -#include "global.h" +#include "buffers.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sys_matrix.h" +#include "z64light.h" +#include "z64play.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define LIGHTS_BUFFER_SIZE 32 diff --git a/src/code/z_map_mark.c b/src/code/z_map_mark.c index 72d245ce8a..79e4f97ca3 100644 --- a/src/code/z_map_mark.c +++ b/src/code/z_map_mark.c @@ -1,4 +1,5 @@ #include "libu64/debug.h" +#include "regs.h" #include "romfile.h" #include "segment_symbols.h" #include "terminal.h" diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 1a25f67518..2c9b219501 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -13,6 +13,7 @@ #include "terminal.h" #include "versions.h" #include "z64audio.h" +#include "z64lifemeter.h" #include "z64horse.h" #include "z64ocarina.h" #include "z64play.h" diff --git a/src/code/z_play.c b/src/code/z_play.c index 4e724601f0..1e47fab380 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -1,4 +1,5 @@ #include "libu64/debug.h" +#include "buffers.h" #include "controller.h" #include "fault.h" #include "gfx.h" @@ -33,7 +34,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" \ - "ique-cn:192 ntsc-1.0:64 ntsc-1.1:64 ntsc-1.2:64 pal-1.0:64 pal-1.1:64" + "ique-cn:192 ntsc-1.0:96 ntsc-1.1:96 ntsc-1.2:96 pal-1.0:96 pal-1.1:96" TransitionTile gTransitionTile; s32 gTransitionTileState; diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c index 8f0f61ed34..eb9790a6e9 100644 --- a/src/code/z_rcp.c +++ b/src/code/z_rcp.c @@ -1,3 +1,11 @@ +#include "buffers.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "gfxalloc.h" +#include "letterbox.h" +#include "regs.h" +#include "z64play.h" + #include "global.h" Gfx sSetupDL[SETUPDL_MAX][6] = { diff --git a/src/code/z_room.c b/src/code/z_room.c index ce8f452f9e..a9daab2047 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -1,5 +1,6 @@ #include "libu64/debug.h" #include "ultra64/gs2dex.h" +#include "buffers.h" #include "fault.h" #include "gfx.h" #include "gfx_setupdl.h" @@ -18,11 +19,10 @@ #include "z64audio.h" #include "z64play.h" #include "z64player.h" +#include "z64room.h" #include "z64save.h" #include "z64skin_matrix.h" -#include "global.h" - Vec3f D_801270A0 = { 0.0f, 0.0f, 0.0f }; // unused diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c index 8b4a57e893..5e096a262e 100644 --- a/src/code/z_scene_table.c +++ b/src/code/z_scene_table.c @@ -16,8 +16,6 @@ #include "z64player.h" #include "z64save.h" -#include "global.h" - #include "assets/scenes/indoors/miharigoya/miharigoya_scene.h" #include "assets/scenes/indoors/souko/souko_scene.h" diff --git a/src/code/z_sram.c b/src/code/z_sram.c index ab25ffeb2e..c78c7ae253 100644 --- a/src/code/z_sram.c +++ b/src/code/z_sram.c @@ -2,6 +2,7 @@ #include "terminal.h" #include "versions.h" #include "z64save.h" +#include "z64ss_sram.h" #define SLOT_SIZE (sizeof(SaveContext) + 0x28) #define CHECKSUM_SIZE (sizeof(Save) / 2) diff --git a/src/code/z_ss_sram.c b/src/code/z_ss_sram.c index dd26d695cb..c2b7e2d34e 100644 --- a/src/code/z_ss_sram.c +++ b/src/code/z_ss_sram.c @@ -1,4 +1,6 @@ #include "ultra64.h" + +#include "macros.h" #include "global.h" typedef struct SsSramContext { diff --git a/src/libu64/mtxuty-cvt.c b/src/libu64/mtxuty-cvt.c index 6fa038be13..759c686d95 100644 --- a/src/libu64/mtxuty-cvt.c +++ b/src/libu64/mtxuty-cvt.c @@ -2,8 +2,6 @@ #include "libu64/debug.h" #include "libu64/mtxuty-cvt.h" -#include "macros.h" - void MtxConv_F2L(Mtx* m1, MtxF* m2) { s32 i; s32 j; diff --git a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c index c83de30010..3d67136b73 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c +++ b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c @@ -9,8 +9,6 @@ #include "ichain.h" #include "z64play.h" -#include "z64.h" - #include "assets/objects/object_hakach_objects/object_hakach_objects.h" #include "assets/objects/object_haka_objects/object_haka_objects.h" diff --git a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index a32ba565ce..97bf27b6f9 100644 --- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -25,8 +25,6 @@ #include "z64player.h" #include "z64save.h" -#include "global.h" - #include "assets/overlays/ovl_Boss_Ganon/ovl_Boss_Ganon.h" #include "assets/objects/object_ganon/object_ganon.h" #include "assets/objects/object_ganon_anime1/object_ganon_anime1.h" diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c index daad206320..3bf7e4b96f 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -28,6 +28,9 @@ #include "assets/objects/object_geff/object_geff.h" #include "assets/overlays/ovl_Boss_Ganon2/ovl_Boss_Ganon2.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:128" + #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ ACTOR_FLAG_DRAW_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index aff4f840d2..1252d7db59 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -23,8 +23,6 @@ #include "z64player.h" #include "z64save.h" -#include "global.h" - #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_gnd/object_gnd.h" #include "assets/objects/object_goma/object_goma.h" diff --git a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c index 5c619e6e48..308c9f5137 100644 --- a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c +++ b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c @@ -24,8 +24,6 @@ #include "z64play.h" #include "z64player.h" -#include "global.h" - #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_fhg/object_fhg.h" diff --git a/src/overlays/actors/ovl_En_Holl/z_en_holl.c b/src/overlays/actors/ovl_En_Holl/z_en_holl.c index ac7687eb14..c3f8fa40ad 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.c +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.c @@ -9,8 +9,6 @@ #include "z64player.h" #include "z64save.h" -#include "global.h" - #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED /* diff --git a/src/overlays/actors/ovl_En_Ko/z_en_ko.c b/src/overlays/actors/ovl_En_Ko/z_en_ko.c index 47ac6f1d54..4426d8c4f7 100644 --- a/src/overlays/actors/ovl_En_Ko/z_en_ko.c +++ b/src/overlays/actors/ovl_En_Ko/z_en_ko.c @@ -19,8 +19,6 @@ #include "z64player.h" #include "z64save.h" -#include "global.h" - #include "assets/objects/object_fa/object_fa.h" #include "assets/objects/object_os_anime/object_os_anime.h" #include "assets/objects/object_km1/object_km1.h" diff --git a/src/overlays/actors/ovl_En_Mag/z_en_mag.c b/src/overlays/actors/ovl_En_Mag/z_en_mag.c index 72ae7f7058..3431445989 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -20,8 +20,7 @@ #include "z64cutscene_flags.h" #include "z64play.h" #include "z64save.h" - -#include "global.h" +#include "z64ss_sram.h" #include "assets/objects/object_mag/object_mag.h" diff --git a/src/overlays/actors/ovl_En_Md/z_en_md.c b/src/overlays/actors/ovl_En_Md/z_en_md.c index 0f354ade29..296f4d42af 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -20,8 +20,6 @@ #include "z64player.h" #include "z64save.h" -#include "global.h" - #include "assets/objects/object_md/object_md.h" #define FLAGS \ diff --git a/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c b/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c index f601c64a72..30218e20e5 100644 --- a/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c +++ b/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c @@ -158,8 +158,8 @@ static EnPoFieldInfo sPoFieldInfo[2] = { static Vec3f D_80AD714C = { 0.0f, 1400.0f, 0.0f }; -#pragma increment_block_number "gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128 ntsc-1.2:128 pal-1.0:128" \ - "pal-1.1:128" +#pragma increment_block_number "gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128 ntsc-1.0:128 ntsc-1.1:128" \ + "ntsc-1.2:128 pal-1.0:128 pal-1.1:128" static Vec3s sSpawnPositions[10]; static u8 sSpawnSwitchFlags[10]; diff --git a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c index 93e21aa767..5db75cbfe2 100644 --- a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c +++ b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c @@ -24,8 +24,6 @@ #include "z64save.h" #include "z64skin.h" -#include "global.h" - #include "assets/objects/object_zl4/object_zl4.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_horse_zelda/object_horse_zelda.h" diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index 95ea420aec..1ec716f8cf 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -37,7 +37,7 @@ #endif #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:121 ntsc-1.1:121 ntsc-1.2:121 pal-1.0:121 pal-1.1:121" + "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c index b285bc8767..bdf1ff693c 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -20,8 +20,6 @@ #include "z64player.h" #include "z64save.h" -#include "global.h" - #include "assets/objects/object_demo_kekkai/object_demo_kekkai.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_spot02_objects/object_spot02_objects.h" diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 601cfabc5d..4d5a5f075f 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -40,14 +40,14 @@ #include "z_lib.h" #include "zelda_arena.h" #include "z64audio.h" +#include "z64debug.h" #include "z64effect.h" +#include "z64lifemeter.h" #include "z64ocarina.h" #include "z64play.h" #include "z64save.h" #include "z64skin_matrix.h" -#include "global.h" - #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_link_child/object_link_child.h" @@ -359,14 +359,14 @@ void Player_Action_CsAction(Player* this, PlayState* play); // .bss part 1 -#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:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" +#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" \ + "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" static s32 D_80858AA0; // TODO: There's probably a way to match BSS ordering with less padding by spreading the variables out and moving // data around. It would be easier if we had more options for controlling BSS ordering in debug. -#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" \ +#pragma increment_block_number "gc-eu:224 gc-eu-mq:224 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ "ique-cn:192 ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" static s32 sSavedCurrentMask; 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 1486c3ce7b..09f9eafc5a 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -20,6 +20,7 @@ #include "z64save.h" #include "z64skybox.h" #include "z64sram.h" +#include "z64ss_sram.h" #include "z64view.h" #include "global.h" diff --git a/src/overlays/gamestates/ovl_opening/z_opening.c b/src/overlays/gamestates/ovl_opening/z_opening.c index 636323b583..69931c93a1 100644 --- a/src/overlays/gamestates/ovl_opening/z_opening.c +++ b/src/overlays/gamestates/ovl_opening/z_opening.c @@ -6,6 +6,7 @@ #include "global.h" #include "z64save.h" +#include "z64sram.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 4bdccd5ae9..6048a614fb 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -13,6 +13,7 @@ #include "sequence.h" #include "terminal.h" #include "z64save.h" +#include "z64sram.h" #include "global.h" diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.c index a6e71fb408..ccd2bcee9a 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.c @@ -1,6 +1,7 @@ #include "z_kaleido_scope.h" #include "sys_ucode.h" #include "versions.h" +#include "z64play.h" #include "z64save.h" #include "assets/textures/icon_item_24_static/icon_item_24_static.h"