1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-02-21 22:35:23 +00:00

Reduce overlay dependencies on global.h (8) (#2478)

* move variables into z64environment.h

* z_room.h

* z64sram.h, z64ss_sram.h, z64font.h, kanread.h

* z64lifemeter.h, z64debug.h, debug_arena.h

* buffers.h

* remove z_bgcheck global

* gamealloc.h

* suggestions

* .bdd
This commit is contained in:
mzxrules 2025-02-19 05:54:39 -05:00 committed by GitHub
parent 3d61fb85ef
commit 981af4b6af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
72 changed files with 578 additions and 392 deletions

15
include/buffers.h Normal file
View file

@ -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

38
include/debug_arena.h Normal file
View file

@ -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

View file

@ -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);

31
include/gamealloc.h Normal file
View file

@ -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

8
include/kanread.h Normal file
View file

@ -0,0 +1,8 @@
#ifndef KANREAD_H
#define KANREAD_H
#include "ultra64/ultratypes.h"
s32 Kanji_OffsetFromShiftJIS(s32 sjis);
#endif

View file

@ -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;

View file

@ -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);

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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);

17
include/z64debug.h Normal file
View file

@ -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

View file

@ -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);

41
include/z64font.h Normal file
View file

@ -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

View file

@ -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)

14
include/z64lifemeter.h Normal file
View file

@ -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

View file

@ -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

View file

@ -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"

174
include/z64room.h Normal file
View file

@ -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

View file

@ -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 {

View file

@ -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

12
include/z64ss_sram.h Normal file
View file

@ -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

View file

@ -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))

View file

@ -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"

View file

@ -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

View file

@ -1,3 +1,5 @@
#include "z64.h"
#include "ultra64/ultratypes.h"
#include "alignment.h"
#include "buffers.h"
ALIGNED(16) u8 gAudioHeap[0x38000];

View file

@ -1,4 +1,7 @@
#include "z64.h"
#include "alignment.h"
#include "buffers.h"
#include "gfx.h"
#include "ultra64.h"
ALIGNED(16) u64 gGfxSPTaskOutputBuffer[0x3000];

View file

@ -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];

View file

@ -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"

View file

@ -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

View file

@ -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"

View file

@ -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;

View file

@ -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"

View file

@ -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[];

View file

@ -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

View file

@ -1,4 +1,5 @@
#include "z64.h"
#include "sys_math3d.h"
#include "z64play.h"
void Math3D_DrawSphere(PlayState* play, Sphere16* sph) {
}

View file

@ -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);

View file

@ -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;

View file

@ -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*);

View file

@ -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"

View file

@ -8,6 +8,7 @@
#include "regs.h"
#include "rumble.h"
#include "ultra64.h"
#include "z64debug.h"
#include "macros.h"

View file

@ -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

View file

@ -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;

View file

@ -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] = {

View file

@ -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

View file

@ -1,4 +1,5 @@
#include "libu64/debug.h"
#include "regs.h"
#include "romfile.h"
#include "segment_symbols.h"
#include "terminal.h"

View file

@ -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"

View file

@ -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;

View file

@ -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] = {

View file

@ -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

View file

@ -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"

View file

@ -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)

View file

@ -1,4 +1,6 @@
#include "ultra64.h"
#include "macros.h"
#include "global.h"
typedef struct SsSramContext {

View file

@ -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;

View file

@ -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"

View file

@ -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"

View file

@ -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)

View file

@ -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"

View file

@ -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"

View file

@ -9,8 +9,6 @@
#include "z64player.h"
#include "z64save.h"
#include "global.h"
#define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED
/*

View file

@ -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"

View file

@ -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"

View file

@ -20,8 +20,6 @@
#include "z64player.h"
#include "z64save.h"
#include "global.h"
#include "assets/objects/object_md/object_md.h"
#define FLAGS \

View file

@ -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];

View file

@ -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"

View file

@ -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

View file

@ -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"

View file

@ -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;

View file

@ -20,6 +20,7 @@
#include "z64save.h"
#include "z64skybox.h"
#include "z64sram.h"
#include "z64ss_sram.h"
#include "z64view.h"
#include "global.h"

View file

@ -6,6 +6,7 @@
#include "global.h"
#include "z64save.h"
#include "z64sram.h"
void TitleSetup_SetupTitleScreen(TitleSetupState* this) {
gSaveContext.gameMode = GAMEMODE_TITLE_SCREEN;

View file

@ -13,6 +13,7 @@
#include "sequence.h"
#include "terminal.h"
#include "z64save.h"
#include "z64sram.h"
#include "global.h"

View file

@ -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"