From ea89aaf475abc54488c2334fd02db031da286baf Mon Sep 17 00:00:00 2001 From: Pablo <72659707+Pepe20129@users.noreply.github.com> Date: Sat, 26 Oct 2024 15:18:14 +0200 Subject: [PATCH] Reduce header interdependency --- include/cic6105.h | 2 +- include/fault.h | 3 +- include/functions.h | 1 - include/gfx.h | 7 +- include/gfx_setupdl.h | 2 +- include/gfxalloc.h | 3 +- include/gfxprint.h | 3 +- include/ichain.h | 2 +- include/irqmgr.h | 5 +- include/jpeg.h | 3 +- include/kaleido_manager.h | 2 +- include/letterbox.h | 2 +- include/main.h | 2 +- include/map.h | 2 +- include/mempak.h | 2 +- include/message_data_static.h | 2 +- include/n64dd.h | 24 ++-- include/one_point_cutscene.h | 2 +- include/padmgr.h | 5 +- include/quake.h | 7 +- include/romfile.h | 2 +- include/rumble.h | 2 +- include/sched.h | 10 +- include/segment_symbols.h | 2 +- include/segmented_address.h | 2 +- include/sequence.h | 2 +- include/sfx.h | 17 +-- include/stackcheck.h | 2 +- include/sys_math.h | 2 +- include/sys_math3d.h | 118 +++++++++--------- include/sys_matrix.h | 19 +-- include/tha.h | 4 +- include/ucode_disas.h | 9 +- include/variables.h | 2 - include/z64.h | 1 - include/z64animation.h | 25 ++-- include/z64animation_legacy.h | 8 +- include/z64audio.h | 14 ++- include/z64camera.h | 1 - include/z64collision_check.h | 2 +- include/z64curve.h | 2 +- include/z64cutscene.h | 2 +- include/z64dma.h | 9 +- include/z64frame_advance.h | 2 +- include/z64game_over.h | 2 +- include/z64inventory.h | 3 +- include/z64light.h | 7 +- include/z64map_mark.h | 2 +- include/z64math.h | 2 +- include/z64object.h | 3 +- include/z64ocarina.h | 2 +- include/z64player.h | 1 - include/z64quest_hint_commands.h | 2 - include/z64save.h | 2 +- include/z64scene.h | 3 +- include/z64sfx_source.h | 2 +- include/z64skin_matrix.h | 8 +- include/z64skybox.h | 2 +- include/z64transition_instances.h | 3 +- include/z64vis.h | 12 +- include/z_lib.h | 36 +++--- include/zelda_arena.h | 2 +- src/audio/lib/load.c | 1 + src/boot/boot_main.c | 1 + src/boot/idle.c | 2 + src/boot/z_std_dma.c | 1 + src/code/object_table.c | 1 + src/code/sched.c | 1 + src/code/sys_math.c | 2 + src/code/z_actor_dlftbls.c | 1 + src/code/z_construct.c | 1 + src/code/z_effect_soft_sprite_dlftbls.c | 1 + src/code/z_fbdemo_fade.c | 1 + src/code/z_game_dlftbls.c | 1 + src/code/z_kaleido_manager.c | 1 + src/code/z_kanfont.c | 1 + src/code/z_kankyo.c | 1 + src/code/z_lib.c | 3 + src/code/z_map_exp.c | 1 + src/code/z_map_mark.c | 1 + src/code/z_message.c | 1 + src/code/z_parameter.c | 2 + src/code/z_rcp.c | 1 + src/code/z_sample.c | 1 + src/code/z_scene.c | 1 + src/code/z_scene_table.c | 1 + src/code/z_skelanime.c | 1 + src/code/z_view.c | 1 + src/code/z_vimode.c | 1 + src/code/z_vr_box.c | 1 + src/libc64/math64.c | 3 + src/overlays/actors/ovl_Fishing/z_fishing.c | 2 + .../ovl_file_choose/z_file_choose.c | 2 + src/overlays/gamestates/ovl_select/z_select.c | 1 + src/overlays/gamestates/ovl_title/z_title.c | 1 + .../misc/ovl_kaleido_scope/z_kaleido_scope.c | 1 + 96 files changed, 283 insertions(+), 194 deletions(-) diff --git a/include/cic6105.h b/include/cic6105.h index 43ffcc4f98..a2395337a6 100644 --- a/include/cic6105.h +++ b/include/cic6105.h @@ -1,7 +1,7 @@ #ifndef CIC6105_H #define CIC6105_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" extern s32 B_80008EE0; diff --git a/include/fault.h b/include/fault.h index a95ae59064..af01529479 100644 --- a/include/fault.h +++ b/include/fault.h @@ -1,7 +1,8 @@ #ifndef FAULT_H #define FAULT_H -#include "ultra64.h" +#include "ultra64/message.h" +#include "ultra64/ultratypes.h" #include "attributes.h" #include "padmgr.h" diff --git a/include/functions.h b/include/functions.h index 292d8bde5d..afbd102408 100644 --- a/include/functions.h +++ b/include/functions.h @@ -251,7 +251,6 @@ ListAlloc* ListAlloc_Init(ListAlloc* this); void* ListAlloc_Alloc(ListAlloc* this, u32 size); void ListAlloc_Free(ListAlloc* this, void* data); void ListAlloc_FreeAll(ListAlloc* this); -void Main(void* arg); void SysCfb_Init(s32 n64dd); void* SysCfb_GetFbPtr(s32 idx); void* SysCfb_GetFbEnd(void); diff --git a/include/gfx.h b/include/gfx.h index 2c3d2b0a87..9f617d5c0f 100644 --- a/include/gfx.h +++ b/include/gfx.h @@ -1,12 +1,15 @@ #ifndef GFX_H #define GFX_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" #include "ultra64/gbi.h" +#include "ultra64/message.h" #include "sched.h" #include "thga.h" #include "versions.h" +struct OSViMode; + // Texture memory size, 4 KiB #define TMEM_SIZE 0x1000 @@ -35,7 +38,7 @@ typedef struct GraphicsContext { /* 0x01B0 */ Gfx* workBuffer; /* 0x01B4 */ TwoHeadGfxArena work; /* 0x01C4 */ char unk_01C4[0xC0]; - /* 0x0284 */ OSViMode* viMode; + /* 0x0284 */ struct OSViMode* viMode; /* 0x0288 */ char unk_0288[0x20]; // Unused, could this be Zelda 2/3 ? /* 0x02A8 */ TwoHeadGfxArena overlay; // "Zelda 4" /* 0x02B8 */ TwoHeadGfxArena polyOpa; // "Zelda 0" diff --git a/include/gfx_setupdl.h b/include/gfx_setupdl.h index 1ba9ba06f5..d7480a22ff 100644 --- a/include/gfx_setupdl.h +++ b/include/gfx_setupdl.h @@ -1,7 +1,7 @@ #ifndef GFX_SETUPDL_H #define GFX_SETUPDL_H -#include "ultra64.h" +#include "ultra64/gbi.h" struct GraphicsContext; struct PlayState; diff --git a/include/gfxalloc.h b/include/gfxalloc.h index 158a2a9f58..5ffac43451 100644 --- a/include/gfxalloc.h +++ b/include/gfxalloc.h @@ -1,7 +1,8 @@ #ifndef GFXALLOC_H #define GFXALLOC_H -#include "ultra64.h" +#include "ultra64/gbi.h" +#include "ultra64/ultratypes.h" Gfx* Gfx_Open(Gfx* gfx); Gfx* Gfx_Close(Gfx* gfx, Gfx* dst); diff --git a/include/gfxprint.h b/include/gfxprint.h index 039b564b4b..8f52956597 100644 --- a/include/gfxprint.h +++ b/include/gfxprint.h @@ -1,7 +1,8 @@ #ifndef GFXPRINT_H #define GFXPRINT_H -#include "ultra64.h" +#include "ultra64/gbi.h" +#include "ultra64/ultratypes.h" #include "color.h" typedef struct GfxPrint { diff --git a/include/ichain.h b/include/ichain.h index a77ed379ad..c732841250 100644 --- a/include/ichain.h +++ b/include/ichain.h @@ -1,7 +1,7 @@ #ifndef ICHAIN_H #define ICHAIN_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" struct Actor; diff --git a/include/irqmgr.h b/include/irqmgr.h index b931977ab0..883fe6bf81 100644 --- a/include/irqmgr.h +++ b/include/irqmgr.h @@ -1,7 +1,10 @@ #ifndef IRQMGR_H #define IRQMGR_H -#include "ultra64.h" +#include "ultra64/message.h" +#include "ultra64/time.h" +#include "ultra64/thread.h" +#include "ultra64/ultratypes.h" #define OS_SC_RETRACE_MSG 1 #define OS_SC_DONE_MSG 2 diff --git a/include/jpeg.h b/include/jpeg.h index 4dab27632a..522361d979 100644 --- a/include/jpeg.h +++ b/include/jpeg.h @@ -1,8 +1,9 @@ #ifndef JPEG_H #define JPEG_H -#include "ultra64.h" #include "sched.h" +#include "ultra64/message.h" +#include "ultra64/ultratypes.h" typedef struct JpegQuantizationTable { /* 0x00 */ u16 table[8*8]; diff --git a/include/kaleido_manager.h b/include/kaleido_manager.h index ce116752a4..8a3af45b86 100644 --- a/include/kaleido_manager.h +++ b/include/kaleido_manager.h @@ -1,7 +1,7 @@ #ifndef KALEIDO_MANAGER_H #define KALEIDO_MANAGER_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" #include "romfile.h" struct PlayState; diff --git a/include/letterbox.h b/include/letterbox.h index 48d6ea7c13..6696216a21 100644 --- a/include/letterbox.h +++ b/include/letterbox.h @@ -1,7 +1,7 @@ #ifndef LETTERBOX_H #define LETTERBOX_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" void Letterbox_SetSizeTarget(s32 target); u32 Letterbox_GetSizeTarget(void); diff --git a/include/main.h b/include/main.h index 495a0b9a9c..5d25f3751e 100644 --- a/include/main.h +++ b/include/main.h @@ -1,7 +1,7 @@ #ifndef MAIN_H #define MAIN_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" extern s32 gScreenWidth; extern s32 gScreenHeight; diff --git a/include/map.h b/include/map.h index 23d3eb3c88..08801d9915 100644 --- a/include/map.h +++ b/include/map.h @@ -1,7 +1,7 @@ #ifndef MAP_H #define MAP_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" struct PlayState; diff --git a/include/mempak.h b/include/mempak.h index 767b3966d4..8a9fc46dbb 100644 --- a/include/mempak.h +++ b/include/mempak.h @@ -1,7 +1,7 @@ #ifndef MEMPAK_H #define MEMPAK_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" s32 Mempak_Init(s32 controllerNum); s32 Mempak_GetFreeBytes(s32 controllerNum); diff --git a/include/message_data_static.h b/include/message_data_static.h index 2b08302731..cc4b5383bb 100644 --- a/include/message_data_static.h +++ b/include/message_data_static.h @@ -1,7 +1,7 @@ #ifndef MESSAGE_DATA_STATIC_H #define MESSAGE_DATA_STATIC_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" #include "message_data_fmt.h" #include "versions.h" diff --git a/include/n64dd.h b/include/n64dd.h index 6a353c3172..2f8dc59336 100644 --- a/include/n64dd.h +++ b/include/n64dd.h @@ -1,11 +1,13 @@ #ifndef N64DD_H #define N64DD_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" +#include "ultra64/gbi.h" +#include "ultra64/message.h" +#include "stddef.h" #include "ultra64/leo.h" -#include "z64pause.h" -#include "z64scene.h" -#include "z64map_mark.h" +#include "stdint.h" +#include "unk.h" #include "versions.h" struct Font; @@ -17,6 +19,10 @@ struct RegEditor; struct RoomContext; struct SaveContext; struct Scene; +struct MapMarkData; +struct PauseMapMarksData; +struct SceneDrawConfigFunc; +struct DmaRequest; // TODO Use the specific pointer types instead of void* typedef struct n64ddStruct_800FEE70_pointers { @@ -40,10 +46,10 @@ typedef struct n64ddStruct_80121220 { s32 (*unk_20)(struct MapData*); s32 (*unk_24)(void); s32 (*unk_28)(struct PlayState*); - s32 (*unk_2C)(MapMarkData***); - s32 (*unk_30)(MapMarkData***); - void (*unk_34)(PauseMapMarksData**); - void (*unk_38)(PauseMapMarksData**); + s32 (*unk_2C)(struct MapMarkData***); + s32 (*unk_30)(struct MapMarkData***); + void (*unk_34)(struct PauseMapMarksData**); + void (*unk_38)(struct PauseMapMarksData**); void (*unk_3C)(void); void (*unk_40)(void); s32 (*unk_44)(struct PlayState*); @@ -62,7 +68,7 @@ typedef struct n64ddStruct_80121220 { #if OOT_PAL s32 (*unk_6C_PAL)(struct Font*); #endif - void (*unk_6C)(struct PlayState*, SceneDrawConfigFunc*); + void (*unk_6C)(struct PlayState*, struct SceneDrawConfigFunc*); s32 (*unk_70)(struct DmaRequest* req, void* ram, uintptr_t vrom, size_t size, u32 unk, OSMesgQueue* queue, OSMesg msg); void (*unk_74)(struct GameState*); s32 (*unk_78)(struct PlayState*, void*, void*); diff --git a/include/one_point_cutscene.h b/include/one_point_cutscene.h index 2c829ba642..d2c4624b0d 100644 --- a/include/one_point_cutscene.h +++ b/include/one_point_cutscene.h @@ -1,7 +1,7 @@ #ifndef ONE_POINT_CUTSCENE_H #define ONE_POINT_CUTSCENE_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" struct Actor; struct PlayState; diff --git a/include/padmgr.h b/include/padmgr.h index 5bfa98308d..bcb3480d21 100644 --- a/include/padmgr.h +++ b/include/padmgr.h @@ -1,7 +1,10 @@ #ifndef PADMGR_H #define PADMGR_H -#include "ultra64.h" +#include "ultra64/controller.h" +#include "ultra64/message.h" +#include "ultra64/pfs.h" +#include "ultra64/ultratypes.h" #include "irqmgr.h" #include "versions.h" diff --git a/include/quake.h b/include/quake.h index 0d97a5bf45..43699b1bad 100644 --- a/include/quake.h +++ b/include/quake.h @@ -1,7 +1,6 @@ #ifndef QUAKE_H #define QUAKE_H -#include "z64camera.h" #include "z64math.h" typedef struct ShakeInfo { @@ -28,7 +27,9 @@ typedef enum QuakeType { // continues indefinitely i.e. does not terminate when the timer reaches 0 // must be manually removed -s16 Quake_Request(Camera* camera, u32 type); +struct Camera; + +s16 Quake_Request(struct Camera* camera, u32 type); u32 Quake_SetSpeed(s16 index, s16 speed); u32 Quake_SetPerturbations(s16 index, s16 y, s16 x, s16 fov, s16 roll); @@ -39,6 +40,6 @@ s16 Quake_GetTimeLeft(s16 index); u32 Quake_RemoveRequest(s16 index); void Quake_Init(void); -s16 Quake_Update(Camera* camera, ShakeInfo* camShake); +s16 Quake_Update(struct Camera* camera, ShakeInfo* camShake); #endif diff --git a/include/romfile.h b/include/romfile.h index 49b5f202dc..31edd72f33 100644 --- a/include/romfile.h +++ b/include/romfile.h @@ -1,7 +1,7 @@ #ifndef ROMFILE_H #define ROMFILE_H -#include "ultra64.h" +#include "stdint.h" typedef struct RomFile { /* 0x00 */ uintptr_t vromStart; diff --git a/include/rumble.h b/include/rumble.h index f8e0b82cb7..b90689cb25 100644 --- a/include/rumble.h +++ b/include/rumble.h @@ -1,7 +1,7 @@ #ifndef RUMBLE_H #define RUMBLE_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" #define RUMBLE_MAX_REQUESTS 64 diff --git a/include/sched.h b/include/sched.h index 2d20e7ec09..bcb9c20a5c 100644 --- a/include/sched.h +++ b/include/sched.h @@ -1,10 +1,16 @@ #ifndef SCHED_H #define SCHED_H -#include "ultra64.h" +#include "ultra64/message.h" +#include "ultra64/sptask.h" +#include "ultra64/time.h" +#include "ultra64/ultratypes.h" #include "irqmgr.h" +#include "unk.h" #include "versions.h" +struct OSViMode; + #define OS_SC_NEEDS_RDP 0x0001 // Task uses the RDP #define OS_SC_NEEDS_RSP 0x0002 // Task uses the RSP #define OS_SC_DRAM_DLIST 0x0004 // Unimplemented @@ -23,7 +29,7 @@ typedef struct CfbInfo { /* 0x00 */ u16* framebuffer; // current framebuffer /* 0x04 */ u16* swapBuffer; // framebuffer to swap to - /* 0x08 */ OSViMode* viMode; + /* 0x08 */ struct OSViMode* viMode; /* 0x0C */ u32 viFeatures; /* 0x10 */ u8 unk_10; // set to 0, never read /* 0x11 */ s8 updateRate; // how many VIs should elapse before next swap diff --git a/include/segment_symbols.h b/include/segment_symbols.h index 95e44a51b5..06982f485e 100644 --- a/include/segment_symbols.h +++ b/include/segment_symbols.h @@ -2,7 +2,7 @@ #define SEGMENT_SYMBOLS_H #include "versions.h" -#include "z64.h" +#include "ultra64/ultratypes.h" #define DECLARE_SEGMENT(name) \ extern u8 _##name##SegmentStart[]; \ diff --git a/include/segmented_address.h b/include/segmented_address.h index a4d05c74f3..1233183bdb 100644 --- a/include/segmented_address.h +++ b/include/segmented_address.h @@ -1,7 +1,7 @@ #ifndef SEGMENTED_ADDRESS_H #define SEGMENTED_ADDRESS_H -#include "ultra64.h" +#include "ultra64/mbi.h" #include "stdint.h" extern uintptr_t gSegments[NUM_SEGMENTS]; diff --git a/include/sequence.h b/include/sequence.h index d405e32362..8d1d5f7a2b 100644 --- a/include/sequence.h +++ b/include/sequence.h @@ -1,7 +1,7 @@ #ifndef SEQUENCE_H #define SEQUENCE_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" #include "versions.h" #define DEFINE_SEQUENCE(_0, seqId, _2, _3, _4) seqId, diff --git a/include/sfx.h b/include/sfx.h index 4d90cf5a6a..2ac61d8294 100644 --- a/include/sfx.h +++ b/include/sfx.h @@ -1,9 +1,8 @@ #ifndef SFX_H #define SFX_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" #include "versions.h" -#include "z64math.h" typedef enum SfxBankType { /* 0 */ BANK_PLAYER, @@ -129,18 +128,20 @@ typedef struct SfxParams { #define SFX_DIST_SCALING 10.0f #endif +struct Vec3f; + void Audio_SetSfxBanksMute(u16 muteMask); void Audio_QueueSeqCmdMute(u8 channelIndex); void Audio_ClearBGMMute(u8 channelIndex); -void Audio_PlaySfxGeneral(u16 sfxId, Vec3f* pos, u8 token, f32* freqScale, f32* vol, s8* reverbAdd); +void Audio_PlaySfxGeneral(u16 sfxId, struct Vec3f* pos, u8 token, f32* freqScale, f32* vol, s8* reverbAdd); void Audio_ProcessSfxRequest(void); void Audio_ChooseActiveSfx(u8 bankId); void Audio_PlayActiveSfx(u8 bankId); void Audio_StopSfxByBank(u8 bankId); -void Audio_RemoveSfxFromBankByPos(u8 bankId, Vec3f* pos); -void Audio_StopSfxByPosAndBank(u8 bankId, Vec3f* pos); -void Audio_StopSfxByPos(Vec3f* pos); -void Audio_StopSfxByPosAndId(Vec3f* pos, u16 sfxId); +void Audio_RemoveSfxFromBankByPos(u8 bankId, struct Vec3f* pos); +void Audio_StopSfxByPosAndBank(u8 bankId, struct Vec3f* pos); +void Audio_StopSfxByPos(struct Vec3f* pos); +void Audio_StopSfxByPosAndId(struct Vec3f* pos, u16 sfxId); void Audio_StopSfxByTokenAndId(u8 token, u16 sfxId); void Audio_StopSfxById(u32 sfxId); void Audio_ProcessSfxRequests(void); @@ -148,7 +149,7 @@ void func_800F8F88(void); u8 Audio_IsSfxPlaying(u32 sfxId); void Audio_ResetSfx(void); -extern Vec3f gSfxDefaultPos; +extern struct Vec3f gSfxDefaultPos; extern f32 gSfxDefaultFreqAndVolScale; extern s8 gSfxDefaultReverb; diff --git a/include/stackcheck.h b/include/stackcheck.h index 33b4a674c9..5960754ddb 100644 --- a/include/stackcheck.h +++ b/include/stackcheck.h @@ -1,7 +1,7 @@ #ifndef STACKCHECK_H #define STACKCHECK_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" typedef enum StackStatus { /* 0 */ STACK_STATUS_OK, diff --git a/include/sys_math.h b/include/sys_math.h index 0da5df8902..527b107a68 100644 --- a/include/sys_math.h +++ b/include/sys_math.h @@ -1,7 +1,7 @@ #ifndef SYS_MATH_H #define SYS_MATH_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" f32 Math_FactorialF(f32 n); f32 Math_Factorial(s32 n); diff --git a/include/sys_math3d.h b/include/sys_math3d.h index deeb093f4e..a0a70aecff 100644 --- a/include/sys_math3d.h +++ b/include/sys_math3d.h @@ -1,78 +1,84 @@ #ifndef SYS_MATH3D_H #define SYS_MATH3D_H -#include "ultra64.h" -#include "z64math.h" +#include "ultra64/ultratypes.h" struct PlayState; +struct Vec3f; +struct InfiniteLine; +struct TriNorm; +struct Sphere16; +struct Cylinder16; +struct Linef; +struct Plane; s32 Math3D_PlaneVsLineSegClosestPoint(f32 planeAA, f32 planeAB, f32 planeAC, f32 planeADist, f32 planeBA, f32 planeBB, - f32 planeBC, f32 planeBDist, Vec3f* linePointA, Vec3f* linePointB, - Vec3f* closestPoint); -void Math3D_LineClosestToPoint(InfiniteLine* line, Vec3f* pos, Vec3f* closestPoint); + f32 planeBC, f32 planeBDist, struct Vec3f* linePointA, struct Vec3f* linePointB, + struct Vec3f* closestPoint); +void Math3D_LineClosestToPoint(struct InfiniteLine* line, struct Vec3f* pos, struct Vec3f* closestPoint); s32 Math3D_PlaneVsPlaneVsLineClosestPoint(f32 planeAA, f32 planeAB, f32 planeAC, f32 planeADist, f32 planeBA, - f32 planeBB, f32 planeBC, f32 planeBDist, Vec3f* point, Vec3f* closestPoint); -void Math3D_LineSplitRatio(Vec3f* v0, Vec3f* v1, f32 ratio, Vec3f* ret); -f32 Math3D_Cos(Vec3f* a, Vec3f* b); -s32 Math3D_CosOut(Vec3f* a, Vec3f* b, f32* dst); -void Math3D_Vec3fReflect(Vec3f* vec, Vec3f* normal, Vec3f* reflVec); + f32 planeBB, f32 planeBC, f32 planeBDist, struct Vec3f* point, struct Vec3f* closestPoint); +void Math3D_LineSplitRatio(struct Vec3f* v0, struct Vec3f* v1, f32 ratio, struct Vec3f* ret); +f32 Math3D_Cos(struct Vec3f* a, struct Vec3f* b); +s32 Math3D_CosOut(struct Vec3f* a, struct Vec3f* b, f32* dst); +void Math3D_Vec3fReflect(struct Vec3f* vec, struct Vec3f* normal, struct Vec3f* reflVec); s32 Math3D_PointInSquare2D(f32 upperLeftX, f32 lowerRightX, f32 upperLeftY, f32 lowerRightY, f32 x, f32 y); f32 Math3D_Dist1DSq(f32 a, f32 b); f32 Math3D_Dist2DSq(f32 x0, f32 y0, f32 x1, f32 y1); -f32 Math3D_Vec3fMagnitudeSq(Vec3f* vec); -f32 Math3D_Vec3fMagnitude(Vec3f* vec); -f32 Math3D_Vec3fDistSq(Vec3f* a, Vec3f* b); -void Math3D_Vec3f_Cross(Vec3f* a, Vec3f* b, Vec3f* ret); -void Math3D_SurfaceNorm(Vec3f* va, Vec3f* vb, Vec3f* vc, Vec3f* normal); -f32 Math3D_Vec3f_DistXYZ(Vec3f* a, Vec3f* b); -s32 Math3D_PointRelativeToCubeFaces(Vec3f* point, Vec3f* min, Vec3f* max); -s32 Math3D_PointRelativeToCubeEdges(Vec3f* point, Vec3f* min, Vec3f* max); -s32 Math3D_PointRelativeToCubeVertices(Vec3f* point, Vec3f* min, Vec3f* max); -s32 Math3D_LineVsCube(Vec3f* min, Vec3f* max, Vec3f* a, Vec3f* b); -void Math3D_RotateXZPlane(Vec3f* pointOnPlane, s16 angle, f32* a, f32* c, f32* d); -void Math3D_DefPlane(Vec3f* va, Vec3f* vb, Vec3f* vc, f32* nx, f32* ny, f32* nz, f32* originDist); -f32 Math3D_UDistPlaneToPos(f32 nx, f32 ny, f32 nz, f32 originDist, Vec3f* p); -f32 Math3D_DistPlaneToPos(f32 nx, f32 ny, f32 nz, f32 originDist, Vec3f* p); -s32 Math3D_TriChkPointParaYSlopedY(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 z, f32 x); -s32 Math3D_TriChkPointParaYIntersectDist(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 nx, f32 ny, f32 nz, f32 originDist, f32 z, +f32 Math3D_Vec3fMagnitudeSq(struct Vec3f* vec); +f32 Math3D_Vec3fMagnitude(struct Vec3f* vec); +f32 Math3D_Vec3fDistSq(struct Vec3f* a, struct Vec3f* b); +void Math3D_Vec3f_Cross(struct Vec3f* a, struct Vec3f* b, struct Vec3f* ret); +void Math3D_SurfaceNorm(struct Vec3f* va, struct Vec3f* vb, struct Vec3f* vc, struct Vec3f* normal); +f32 Math3D_Vec3f_DistXYZ(struct Vec3f* a, struct Vec3f* b); +s32 Math3D_PointRelativeToCubeFaces(struct Vec3f* point, struct Vec3f* min, struct Vec3f* max); +s32 Math3D_PointRelativeToCubeEdges(struct Vec3f* point, struct Vec3f* min, struct Vec3f* max); +s32 Math3D_PointRelativeToCubeVertices(struct Vec3f* point, struct Vec3f* min, struct Vec3f* max); +s32 Math3D_LineVsCube(struct Vec3f* min, struct Vec3f* max, struct Vec3f* a, struct Vec3f* b); +void Math3D_RotateXZPlane(struct Vec3f* pointOnPlane, s16 angle, f32* a, f32* c, f32* d); +void Math3D_DefPlane(struct Vec3f* va, struct Vec3f* vb, struct Vec3f* vc, f32* nx, f32* ny, f32* nz, f32* originDist); +f32 Math3D_UDistPlaneToPos(f32 nx, f32 ny, f32 nz, f32 originDist, struct Vec3f* p); +f32 Math3D_DistPlaneToPos(f32 nx, f32 ny, f32 nz, f32 originDist, struct Vec3f* p); +s32 Math3D_TriChkPointParaYSlopedY(struct Vec3f* v0, struct Vec3f* v1, struct Vec3f* v2, f32 z, f32 x); +s32 Math3D_TriChkPointParaYIntersectDist(struct Vec3f* v0, struct Vec3f* v1, struct Vec3f* v2, f32 nx, f32 ny, f32 nz, f32 originDist, f32 z, f32 x, f32* yIntersect, f32 chkDist); -s32 Math3D_TriChkPointParaYIntersectInsideTri(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 nx, f32 ny, f32 nz, f32 originDist, +s32 Math3D_TriChkPointParaYIntersectInsideTri(struct Vec3f* v0, struct Vec3f* v1, struct Vec3f* v2, f32 nx, f32 ny, f32 nz, f32 originDist, f32 z, f32 x, f32* yIntersect, f32 chkDist); -s32 Math3D_TriChkLineSegParaYIntersect(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 nx, f32 ny, f32 nz, f32 originDist, f32 z, +s32 Math3D_TriChkLineSegParaYIntersect(struct Vec3f* v0, struct Vec3f* v1, struct Vec3f* v2, f32 nx, f32 ny, f32 nz, f32 originDist, f32 z, f32 x, f32* yIntersect, f32 y0, f32 y1); -s32 Math3D_TriChkPointParaYDist(Vec3f* v0, Vec3f* v1, Vec3f* v2, Plane* plane, f32 z, f32 x, f32 chkDist); -s32 Math3D_TriChkPointParaXIntersect(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 nx, f32 ny, f32 nz, f32 originDist, f32 y, +s32 Math3D_TriChkPointParaYDist(struct Vec3f* v0, struct Vec3f* v1, struct Vec3f* v2, struct Plane* plane, f32 z, f32 x, f32 chkDist); +s32 Math3D_TriChkPointParaXIntersect(struct Vec3f* v0, struct Vec3f* v1, struct Vec3f* v2, f32 nx, f32 ny, f32 nz, f32 originDist, f32 y, f32 z, f32* xIntersect); -s32 Math3D_TriChkLineSegParaXIntersect(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 nx, f32 ny, f32 nz, f32 originDist, f32 y, +s32 Math3D_TriChkLineSegParaXIntersect(struct Vec3f* v0, struct Vec3f* v1, struct Vec3f* v2, f32 nx, f32 ny, f32 nz, f32 originDist, f32 y, f32 z, f32* xIntersect, f32 x0, f32 x1); -s32 Math3D_TriChkPointParaXDist(Vec3f* v0, Vec3f* v1, Vec3f* v2, Plane* plane, f32 y, f32 z, f32 chkDist); -s32 Math3D_TriChkPointParaZIntersect(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 nx, f32 ny, f32 nz, f32 originDist, f32 x, +s32 Math3D_TriChkPointParaXDist(struct Vec3f* v0, struct Vec3f* v1, struct Vec3f* v2, struct Plane* plane, f32 y, f32 z, f32 chkDist); +s32 Math3D_TriChkPointParaZIntersect(struct Vec3f* v0, struct Vec3f* v1, struct Vec3f* v2, f32 nx, f32 ny, f32 nz, f32 originDist, f32 x, f32 y, f32* zIntersect); -s32 Math3D_TriChkLineSegParaZIntersect(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 nx, f32 ny, f32 nz, f32 originDist, f32 x, +s32 Math3D_TriChkLineSegParaZIntersect(struct Vec3f* v0, struct Vec3f* v1, struct Vec3f* v2, f32 nx, f32 ny, f32 nz, f32 originDist, f32 x, f32 y, f32* zIntersect, f32 z0, f32 z1); -s32 Math3D_TriChkLineSegParaZDist(Vec3f* v0, Vec3f* v1, Vec3f* v2, Plane* plane, f32 x, f32 y, f32 chkDist); -s32 Math3D_LineSegVsPlane(f32 nx, f32 ny, f32 nz, f32 originDist, Vec3f* linePointA, Vec3f* linePointB, - Vec3f* intersect, s32 fromFront); -void Math3D_TriNorm(TriNorm* tri, Vec3f* va, Vec3f* vb, Vec3f* vc); +s32 Math3D_TriChkLineSegParaZDist(struct Vec3f* v0, struct Vec3f* v1, struct Vec3f* v2, struct Plane* plane, f32 x, f32 y, f32 chkDist); +s32 Math3D_LineSegVsPlane(f32 nx, f32 ny, f32 nz, f32 originDist, struct Vec3f* linePointA, struct Vec3f* linePointB, + struct Vec3f* intersect, s32 fromFront); +void Math3D_TriNorm(struct TriNorm* tri, struct Vec3f* va, struct Vec3f* vb, struct Vec3f* vc); s32 Math3D_PointDistSqToLine2D(f32 x0, f32 y0, f32 x1, f32 y1, f32 x2, f32 y2, f32* lineLenSq); -s32 Math3D_LineVsSph(Sphere16* sphere, Linef* line); -s32 Math3D_TriVsSphIntersect(Sphere16* sphere, TriNorm* tri, Vec3f* intersectPoint); -s32 Math3D_CylVsLineSeg(Cylinder16* cyl, Vec3f* linePointA, Vec3f* linePointB, Vec3f* intersectA, Vec3f* intersectB); -s32 Math3D_CylVsTri(Cylinder16* cyl, TriNorm* tri); -s32 Math3D_CylTriVsIntersect(Cylinder16* cyl, TriNorm* tri, Vec3f* intersect); -s32 Math3D_SphVsSph(Sphere16* sphereA, Sphere16* sphereB); -s32 Math3D_SphVsSphOverlap(Sphere16* sphereA, Sphere16* sphereB, f32* overlapSize); -s32 Math3D_SphVsSphOverlapCenterDist(Sphere16* sphereA, Sphere16* sphereB, f32* overlapSize, f32* centerDist); -s32 Math3D_SphVsCylOverlap(Sphere16* sph, Cylinder16* cyl, f32* overlapSize); -s32 Math3D_SphVsCylOverlapCenterDist(Sphere16* sph, Cylinder16* cyl, f32* overlapSize, f32* centerDist); -s32 Math3D_CylVsCylOverlap(Cylinder16* ca, Cylinder16* cb, f32* overlapSize); -s32 Math3D_CylVsCylOverlapCenterDist(Cylinder16* ca, Cylinder16* cb, f32* overlapSize, f32* centerDist); -s32 Math3D_TriVsTriIntersect(TriNorm* ta, TriNorm* tb, Vec3f* intersect); -s32 Math3D_XZInSphere(Sphere16* sphere, f32 x, f32 z); -s32 Math3D_XYInSphere(Sphere16* sphere, f32 x, f32 y); -s32 Math3D_YZInSphere(Sphere16* sphere, f32 y, f32 z); +s32 Math3D_LineVsSph(struct Sphere16* sphere, struct Linef* line); +s32 Math3D_TriVsSphIntersect(struct Sphere16* sphere, struct TriNorm* tri, struct Vec3f* intersectPoint); +s32 Math3D_CylVsLineSeg(struct Cylinder16* cyl, struct Vec3f* linePointA, struct Vec3f* linePointB, struct Vec3f* intersectA, struct Vec3f* intersectB); +s32 Math3D_CylVsTri(struct Cylinder16* cyl, struct TriNorm* tri); +s32 Math3D_CylTriVsIntersect(struct Cylinder16* cyl, struct TriNorm* tri, struct Vec3f* intersect); +s32 Math3D_SphVsSph(struct Sphere16* sphereA, struct Sphere16* sphereB); +s32 Math3D_SphVsSphOverlap(struct Sphere16* sphereA, struct Sphere16* sphereB, f32* overlapSize); +s32 Math3D_SphVsSphOverlapCenterDist(struct Sphere16* sphereA, struct Sphere16* sphereB, f32* overlapSize, f32* centerDist); +s32 Math3D_SphVsCylOverlap(struct Sphere16* sph, struct Cylinder16* cyl, f32* overlapSize); +s32 Math3D_SphVsCylOverlapCenterDist(struct Sphere16* sph, struct Cylinder16* cyl, f32* overlapSize, f32* centerDist); +s32 Math3D_CylVsCylOverlap(struct Cylinder16* ca, struct Cylinder16* cb, f32* overlapSize); +s32 Math3D_CylVsCylOverlapCenterDist(struct Cylinder16* ca, struct Cylinder16* cb, f32* overlapSize, f32* centerDist); +s32 Math3D_TriVsTriIntersect(struct TriNorm* ta, struct TriNorm* tb, struct Vec3f* intersect); +s32 Math3D_XZInSphere(struct Sphere16* sphere, f32 x, f32 z); +s32 Math3D_XYInSphere(struct Sphere16* sphere, f32 x, f32 y); +s32 Math3D_YZInSphere(struct Sphere16* sphere, f32 y, f32 z); -void Math3D_DrawSphere(struct PlayState* play, Sphere16* sph); -void Math3D_DrawCylinder(struct PlayState* play, Cylinder16* cyl); +void Math3D_DrawSphere(struct PlayState* play, struct Sphere16* sph); +void Math3D_DrawCylinder(struct PlayState* play, struct Cylinder16* cyl); #endif diff --git a/include/sys_matrix.h b/include/sys_matrix.h index daf3aa39ca..b9eed00c9b 100644 --- a/include/sys_matrix.h +++ b/include/sys_matrix.h @@ -1,10 +1,13 @@ #ifndef SYS_MATRIX_H #define SYS_MATRIX_H -#include "z64math.h" +#include "ultra64/gbi.h" +#include "ultra64/ultratypes.h" struct GraphicsContext; struct GameState; +struct Vec3f; +struct Vec3s; typedef enum MatrixMode { /* 0 */ MTXMODE_NEW, // generates a new matrix @@ -34,8 +37,8 @@ void Matrix_RotateZ(f32 z, u8 mode); /* Compound operations */ void Matrix_RotateZYX(s16 x, s16 y, s16 z, u8 mode); -void Matrix_TranslateRotateZYX(Vec3f* translation, Vec3s* rotation); -void Matrix_SetTranslateRotateYXZ(f32 translateX, f32 translateY, f32 translateZ, Vec3s* rot); +void Matrix_TranslateRotateZYX(struct Vec3f* translation, struct Vec3s* rotation); +void Matrix_SetTranslateRotateYXZ(f32 translateX, f32 translateY, f32 translateZ, struct Vec3s* rot); void Matrix_SetTranslateScaleMtx2(Mtx* mtx, f32 scaleX, f32 scaleY, f32 scaleZ, f32 translateX, f32 translateY, f32 translateZ); @@ -66,8 +69,8 @@ Mtx* Matrix_Finalize(struct GraphicsContext* gfxCtx); /* Vector operations */ -void Matrix_MultVec3f(Vec3f* src, Vec3f* dest); -void Matrix_MultVec3fExt(Vec3f* src, Vec3f* dest, MtxF* mf); +void Matrix_MultVec3f(struct Vec3f* src, struct Vec3f* dest); +void Matrix_MultVec3fExt(struct Vec3f* src, struct Vec3f* dest, MtxF* mf); /* Copy and another conversion */ @@ -78,8 +81,8 @@ void Matrix_MtxToMtxF(Mtx* src, MtxF* dest); void Matrix_Transpose(MtxF* mf); void Matrix_ReplaceRotation(MtxF* mf); -void Matrix_MtxFToYXZRotS(MtxF* mf, Vec3s* rotDest, s32 flag); -void Matrix_MtxFToZYXRotS(MtxF* mf, Vec3s* rotDest, s32 flag); -void Matrix_RotateAxis(f32 angle, Vec3f* axis, u8 mode); +void Matrix_MtxFToYXZRotS(MtxF* mf, struct Vec3s* rotDest, s32 flag); +void Matrix_MtxFToZYXRotS(MtxF* mf, struct Vec3s* rotDest, s32 flag); +void Matrix_RotateAxis(f32 angle, struct Vec3f* axis, u8 mode); #endif diff --git a/include/tha.h b/include/tha.h index 941321b820..cd25f6d5fc 100644 --- a/include/tha.h +++ b/include/tha.h @@ -1,8 +1,8 @@ #ifndef THA_H #define THA_H -#include "ultra64.h" -#include "alignment.h" +#include "stddef.h" +#include "stdint.h" typedef struct TwoHeadArena { /* 0x00 */ size_t size; diff --git a/include/ucode_disas.h b/include/ucode_disas.h index d1fc901335..3829740831 100644 --- a/include/ucode_disas.h +++ b/include/ucode_disas.h @@ -1,7 +1,10 @@ #ifndef UCODE_DISAS_H #define UCODE_DISAS_H -#include "ultra64.h" +#include "stdint.h" +#include "ultra64/ultratypes.h" + +union Gfx; typedef enum UcodeType { /* 0 */ UCODE_TYPE_NULL, @@ -17,7 +20,7 @@ typedef struct UCodeInfo { typedef struct UCodeDisas { /* 0x00 */ uintptr_t segments[NUM_SEGMENTS]; - /* 0x40 */ Gfx* dlStack[18]; + /* 0x40 */ union Gfx* dlStack[18]; /* 0x88 */ s32 dlDepth; /* 0x8C */ u32 dlCnt; /* 0x90 */ u32 vtxCnt; @@ -42,7 +45,7 @@ typedef struct UCodeDisas { void UCodeDisas_Init(UCodeDisas*); void UCodeDisas_Destroy(UCodeDisas*); -void UCodeDisas_Disassemble(UCodeDisas*, Gfx*); +void UCodeDisas_Disassemble(UCodeDisas*, union Gfx*); void UCodeDisas_RegisterUCode(UCodeDisas*, s32, UCodeInfo*); void UCodeDisas_SetCurUCode(UCodeDisas*, void*); diff --git a/include/variables.h b/include/variables.h index b2f8039759..7bcd6592b5 100644 --- a/include/variables.h +++ b/include/variables.h @@ -2,8 +2,6 @@ #define VARIABLES_H #include "z64.h" -#include "libc64/os_malloc.h" -#include "segment_symbols.h" extern Mtx D_01000000; diff --git a/include/z64.h b/include/z64.h index 5779205b38..6db96d5410 100644 --- a/include/z64.h +++ b/include/z64.h @@ -78,7 +78,6 @@ #include "sys_math3d.h" #include "libc64/math64.h" #include "sys_matrix.h" -#include "main.h" #include "segmented_address.h" #include "stackcheck.h" #include "kaleido_manager.h" diff --git a/include/z64animation.h b/include/z64animation.h index 17b42e1a0f..0cb3c6c49b 100644 --- a/include/z64animation.h +++ b/include/z64animation.h @@ -1,7 +1,7 @@ #ifndef Z64_ANIMATION_H #define Z64_ANIMATION_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" #include "z64dma.h" #include "z64math.h" #include "macros.h" @@ -9,6 +9,7 @@ struct PlayState; struct Actor; struct SkelAnime; +union Gfx; /* * Skeletons and limbs @@ -20,14 +21,14 @@ typedef struct StandardLimb { /* 0x00 */ Vec3s jointPos; // Root is position in model space, children are relative to parent /* 0x06 */ u8 child; /* 0x07 */ u8 sibling; - /* 0x08 */ Gfx* dList; + /* 0x08 */ union Gfx* dList; } StandardLimb; // size = 0xC typedef struct LodLimb { /* 0x00 */ Vec3s jointPos; // Root is position in model space, children are relative to parent /* 0x06 */ u8 child; /* 0x07 */ u8 sibling; - /* 0x08 */ Gfx* dLists[2]; // Near and far + /* 0x08 */ union Gfx* dLists[2]; // Near and far } LodLimb; // size = 0x10 // Model has limbs with only rigid meshes @@ -204,20 +205,20 @@ s32 SkelAnime_Update(SkelAnime* skelAnime); // Draw -typedef s32 (*OverrideLimbDraw)(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void*, - Gfx** gfx); -typedef void (*PostLimbDraw)(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void*, Gfx** gfx); +typedef s32 (*OverrideLimbDraw)(struct PlayState* play, s32 limbIndex, union Gfx** dList, Vec3f* pos, Vec3s* rot, void*, + union Gfx** gfx); +typedef void (*PostLimbDraw)(struct PlayState* play, s32 limbIndex, union Gfx** dList, Vec3s* rot, void*, union Gfx** gfx); -typedef s32 (*OverrideLimbDrawOpa)(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void*); -typedef void (*PostLimbDrawOpa)(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void*); +typedef s32 (*OverrideLimbDrawOpa)(struct PlayState* play, s32 limbIndex, union Gfx** dList, Vec3f* pos, Vec3s* rot, void*); +typedef void (*PostLimbDrawOpa)(struct PlayState* play, s32 limbIndex, union Gfx** dList, Vec3s* rot, void*); -Gfx* SkelAnime_Draw(struct PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, - PostLimbDraw postLimbDraw, void* arg, Gfx* gfx); +union Gfx* SkelAnime_Draw(struct PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, + PostLimbDraw postLimbDraw, void* arg, union Gfx* gfx); void SkelAnime_DrawOpa(struct PlayState* play, void** skeleton, Vec3s* jointTable, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg); -Gfx* SkelAnime_DrawFlex(struct PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, - OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, void* arg, Gfx* gfx); +union Gfx* SkelAnime_DrawFlex(struct PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, + OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, void* arg, union Gfx* gfx); void SkelAnime_DrawFlexOpa(struct PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* arg); diff --git a/include/z64animation_legacy.h b/include/z64animation_legacy.h index 066a8faa33..c713ddd27f 100644 --- a/include/z64animation_legacy.h +++ b/include/z64animation_legacy.h @@ -1,11 +1,13 @@ #ifndef Z64_ANIMATION_LEGACY_H #define Z64_ANIMATION_LEGACY_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" #include "z64math.h" +union Gfx; + typedef struct LegacyLimb { - /* 0x000 */ Gfx* dList; + /* 0x000 */ union Gfx* dList; /* 0x004 */ Vec3f trans; /* 0x010 */ Vec3s rot; /* 0x018 */ struct LegacyLimb* sibling; @@ -28,7 +30,7 @@ typedef struct LegacyAnimationHeader { /* 0x08 */ LegacyJointKey* jointKey; } LegacyAnimationHeader; // size = 0xC -s32 SkelAnime_GetFrameDataLegacy(LegacyAnimationHeader* animation, s32 frame, Vec3s* frameTable); +s32 SkelAnime_GetFrameDataLegacy(LegacyAnimationHeader* animation, s32 frame, struct Vec3s* frameTable); s16 Animation_GetLimbCountLegacy(LegacyAnimationHeader* animation); s16 Animation_GetLengthLegacy(LegacyAnimationHeader* animation); s16 Animation_GetLastFrameLegacy(LegacyAnimationHeader* animation); diff --git a/include/z64audio.h b/include/z64audio.h index 86e2860db6..f800f48285 100644 --- a/include/z64audio.h +++ b/include/z64audio.h @@ -1,11 +1,17 @@ #ifndef Z64_AUDIO_H #define Z64_AUDIO_H -#include "ultra64.h" +#include "ultra64/message.h" +#include "stddef.h" +#include "ultra64/pi.h" +#include "ultra64/sptask.h" +#include "ultra64/ultratypes.h" #include "sequence.h" +#include "stdint.h" #include "z64math.h" struct GfxPrint; +union Acmd; typedef void (*AudioCustomUpdateFunction)(void); @@ -936,8 +942,8 @@ typedef struct AudioContext { /* 0x28A0 */ s32 curAudioFrameDmaCount; /* 0x28A4 */ s32 rspTaskIndex; /* 0x28A8 */ s32 curAiBufIndex; - /* 0x28AC */ Acmd* abiCmdBufs[2]; // Pointer to audio heap where the audio binary interface command lists (for the rsp) are stored. Two lists that alternate every frame - /* 0x28B4 */ Acmd* curAbiCmdBuf; // Pointer to the currently active abiCmdBufs + /* 0x28AC */ union Acmd* abiCmdBufs[2]; // Pointer to audio heap where the audio binary interface command lists (for the rsp) are stored. Two lists that alternate every frame + /* 0x28B4 */ union Acmd* curAbiCmdBuf; // Pointer to the currently active abiCmdBufs /* 0x28B8 */ AudioTask* curTask; /* 0x28BC */ char unk_28BC[0x4]; /* 0x28C0 */ AudioTask rspTask[2]; @@ -1026,7 +1032,7 @@ typedef struct AudioHeapInitSizes { // TODO these prototypes should be sorted into the relevant audio header files -Acmd* AudioSynth_Update(Acmd* cmdStart, s32* cmdCnt, s16* aiStart, s32 aiBufLen); +union Acmd* AudioSynth_Update(union Acmd* cmdStart, s32* cmdCnt, s16* aiStart, s32 aiBufLen); void AudioHeap_DiscardFont(s32 fontId); void AudioHeap_ReleaseNotesForFont(s32 fontId); void AudioHeap_DiscardSequence(s32 seqId); diff --git a/include/z64camera.h b/include/z64camera.h index 1e831a909e..a8b9ebc4a5 100644 --- a/include/z64camera.h +++ b/include/z64camera.h @@ -4,7 +4,6 @@ #include "ultra64.h" #include "z64cutscene.h" #include "z64math.h" -#include "z64save.h" struct CollisionContext; struct View; diff --git a/include/z64collision_check.h b/include/z64collision_check.h index 1b96c4a46e..9ecaa33e3c 100644 --- a/include/z64collision_check.h +++ b/include/z64collision_check.h @@ -1,7 +1,7 @@ #ifndef Z64COLLISION_CHECK_H #define Z64COLLISION_CHECK_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" #include "z64math.h" #define COLLISION_CHECK_AT_MAX 50 diff --git a/include/z64curve.h b/include/z64curve.h index 2f35aec967..4eb55b89cf 100644 --- a/include/z64curve.h +++ b/include/z64curve.h @@ -1,8 +1,8 @@ #ifndef Z64_CURVE_H #define Z64_CURVE_H +#include "ultra64/gbi.h" #include "ultra64/ultratypes.h" -#include "z64math.h" struct PlayState; diff --git a/include/z64cutscene.h b/include/z64cutscene.h index d73cb6a47a..78d7c9215e 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -1,7 +1,7 @@ #ifndef Z64CUTSCENE_H #define Z64CUTSCENE_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" #include "z64math.h" struct PlayState; diff --git a/include/z64dma.h b/include/z64dma.h index aab5556d7c..c7ad84a7f4 100755 --- a/include/z64dma.h +++ b/include/z64dma.h @@ -1,9 +1,14 @@ #ifndef Z64_DMA_H #define Z64_DMA_H -#include "ultra64.h" #include "alignment.h" #include "romfile.h" +#include "stddef.h" +#include "stdint.h" +#include "ultra64/message.h" + +struct OSPiHandle; +struct OSIoMesg; typedef struct DmaRequest { /* 0x00 */ uintptr_t vromAddr; // VROM address (source) @@ -44,7 +49,7 @@ s32 DmaMgr_RequestSyncDebug(void* ram, uintptr_t vrom, size_t size, const char* s32 DmaMgr_DmaRomToRam(uintptr_t rom, void* ram, size_t size); void DmaMgr_DmaFromDriveRom(void* ram, uintptr_t rom, size_t size); -s32 DmaMgr_AudioDmaHandler(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction); +s32 DmaMgr_AudioDmaHandler(struct OSPiHandle* pihandle, struct OSIoMesg* mb, s32 direction); // Initialization diff --git a/include/z64frame_advance.h b/include/z64frame_advance.h index edefb0b47d..16f58fc132 100644 --- a/include/z64frame_advance.h +++ b/include/z64frame_advance.h @@ -1,7 +1,7 @@ #ifndef Z64FRAME_ADVANCE_H #define Z64FRAME_ADVANCE_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" struct Input; struct PlayState; diff --git a/include/z64game_over.h b/include/z64game_over.h index 03697c1f50..0e99d1f6c1 100644 --- a/include/z64game_over.h +++ b/include/z64game_over.h @@ -1,7 +1,7 @@ #ifndef Z64GAME_OVER_H #define Z64GAME_OVER_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" struct PlayState; diff --git a/include/z64inventory.h b/include/z64inventory.h index 9a8133b3da..2366ccd0df 100644 --- a/include/z64inventory.h +++ b/include/z64inventory.h @@ -1,9 +1,8 @@ #ifndef Z64INVENTORY_H #define Z64INVENTORY_H -#include "ultra64.h" #include "z64item.h" -#include "z64save.h" +#include "ultra64/ultratypes.h" struct PlayState; diff --git a/include/z64light.h b/include/z64light.h index cb666ff752..6dca809791 100644 --- a/include/z64light.h +++ b/include/z64light.h @@ -1,10 +1,7 @@ #ifndef Z64LIGHT_H #define Z64LIGHT_H -#include "ultra64.h" #include "ultra64/gbi.h" -#include "z64math.h" -#include "color.h" struct GraphicsContext; struct PlayState; @@ -63,7 +60,7 @@ typedef enum LightType { /* 0x02 */ LIGHT_POINT_GLOW } LightType; -typedef void (*LightsBindFunc)(Lights* lights, LightParams* params, Vec3f* vec); +typedef void (*LightsBindFunc)(Lights* lights, LightParams* params, struct Vec3f* vec); void Lights_PointSetInfo(LightInfo* info, s16 x, s16 y, s16 z, u8 r, u8 g, u8 b, s16 radius, s32 type); void Lights_PointNoGlowSetInfo(LightInfo* info, s16 x, s16 y, s16 z, u8 r, u8 g, u8 b, s16 radius); @@ -72,7 +69,7 @@ void Lights_PointSetColorAndRadius(LightInfo* info, u8 r, u8 g, u8 b, s16 radius void Lights_DirectionalSetInfo(LightInfo* info, s8 x, s8 y, s8 z, u8 r, u8 g, u8 b); void Lights_Reset(Lights* lights, u8 ambentR, u8 ambentG, u8 ambentB); void Lights_Draw(Lights* lights, struct GraphicsContext* gfxCtx); -void Lights_BindAll(Lights* lights, LightNode* listHead, Vec3f* vec); +void Lights_BindAll(Lights* lights, LightNode* listHead, struct Vec3f* vec); void LightContext_Init(struct PlayState* play, LightContext* lightCtx); void LightContext_SetAmbientColor(LightContext* lightCtx, u8 r, u8 g, u8 b); void LightContext_SetFog(LightContext* lightCtx, u8 r, u8 g, u8 b, s16 fogNear, s16 zFar); diff --git a/include/z64map_mark.h b/include/z64map_mark.h index 0c55efa3ae..c90c77a509 100644 --- a/include/z64map_mark.h +++ b/include/z64map_mark.h @@ -1,7 +1,7 @@ #ifndef Z64MAP_MARK_H #define Z64MAP_MARK_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" #define MAP_MARK_NONE -1 #define MAP_MARK_CHEST 0 diff --git a/include/z64math.h b/include/z64math.h index 95a494a693..54e10090bf 100644 --- a/include/z64math.h +++ b/include/z64math.h @@ -1,7 +1,7 @@ #ifndef Z64MATH_H #define Z64MATH_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" #include "math.h" #define SQ(x) ((x)*(x)) diff --git a/include/z64object.h b/include/z64object.h index 016eda00d7..7e892c557f 100644 --- a/include/z64object.h +++ b/include/z64object.h @@ -1,7 +1,8 @@ #ifndef Z64OBJECT_H #define Z64OBJECT_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" +#include "ultra64/message.h" #include "z64dma.h" struct PlayState; diff --git a/include/z64ocarina.h b/include/z64ocarina.h index afad53811b..6a8ad12e98 100644 --- a/include/z64ocarina.h +++ b/include/z64ocarina.h @@ -1,7 +1,7 @@ #ifndef Z64OCARINA_H #define Z64OCARINA_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" typedef enum OcarinaSongId { /* 0 */ OCARINA_SONG_MINUET, diff --git a/include/z64player.h b/include/z64player.h index d135c57413..d94f60e2c6 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -2,7 +2,6 @@ #define Z64PLAYER_H #include "z64actor.h" -#include "alignment.h" #include "face_change.h" struct Player; diff --git a/include/z64quest_hint_commands.h b/include/z64quest_hint_commands.h index 62f262f39b..78c5fce9c1 100644 --- a/include/z64quest_hint_commands.h +++ b/include/z64quest_hint_commands.h @@ -1,8 +1,6 @@ #ifndef Z64QUEST_HINT_COMMANDS_H #define Z64QUEST_HINT_COMMANDS_H -#include "ultra64.h" - /* * Hint Command Types */ diff --git a/include/z64save.h b/include/z64save.h index 2c10d76bc6..6898ab651f 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -1,7 +1,7 @@ #ifndef Z64SAVE_H #define Z64SAVE_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" #include "versions.h" #include "z64inventory.h" #include "z64math.h" diff --git a/include/z64scene.h b/include/z64scene.h index a9bd01bae0..92336d71c3 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -2,11 +2,10 @@ #define Z64SCENE_H #include "macros.h" -#include "ultra64.h" +#include "ultra64/ultratypes.h" #include "z64bgcheck.h" #include "z64dma.h" #include "z64environment.h" -#include "z64light.h" #include "z64math.h" #include "command_macros_base.h" diff --git a/include/z64sfx_source.h b/include/z64sfx_source.h index 0034bc90aa..dcba6c1370 100644 --- a/include/z64sfx_source.h +++ b/include/z64sfx_source.h @@ -1,7 +1,7 @@ #ifndef Z64SFX_SOURCE_H #define Z64SFX_SOURCE_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" #include "z64math.h" struct PlayState; diff --git a/include/z64skin_matrix.h b/include/z64skin_matrix.h index 647790abff..8506c48adf 100644 --- a/include/z64skin_matrix.h +++ b/include/z64skin_matrix.h @@ -1,13 +1,13 @@ #ifndef Z64SKIN_MATRIX_H #define Z64SKIN_MATRIX_H -#include "ultra64.h" -#include "z64math.h" +#include "ultra64/ultratypes.h" +struct Vec3f; struct GraphicsContext; -void SkinMatrix_Vec3fMtxFMultXYZW(MtxF* mf, Vec3f* src, Vec3f* xyzDest, f32* wDest); -void SkinMatrix_Vec3fMtxFMultXYZ(MtxF* mf, Vec3f* src, Vec3f* dest); +void SkinMatrix_Vec3fMtxFMultXYZW(MtxF* mf, struct Vec3f* src, struct Vec3f* xyzDest, f32* wDest); +void SkinMatrix_Vec3fMtxFMultXYZ(MtxF* mf, struct Vec3f* src, struct Vec3f* dest); void SkinMatrix_MtxFMtxFMult(MtxF* mfA, MtxF* mfB, MtxF* dest); void SkinMatrix_GetClear(MtxF** mfp); void SkinMatrix_MtxFCopy(MtxF* src, MtxF* dest); diff --git a/include/z64skybox.h b/include/z64skybox.h index e0ebcf0c03..887da1db55 100644 --- a/include/z64skybox.h +++ b/include/z64skybox.h @@ -5,7 +5,7 @@ #include "ultra64/gbi.h" #include "z64math.h" -#include "z64dma.h" // for RomFile +#include "romfile.h" struct GameState; struct GraphicsContext; diff --git a/include/z64transition_instances.h b/include/z64transition_instances.h index 154b98d008..910004dcb7 100644 --- a/include/z64transition_instances.h +++ b/include/z64transition_instances.h @@ -1,7 +1,8 @@ #ifndef Z64TRANSITION_INSTANCES_H #define Z64TRANSITION_INSTANCES_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" +#include "ultra64/gbi.h" #include "color.h" typedef struct TransitionTileVtxData { diff --git a/include/z64vis.h b/include/z64vis.h index fcd24d1b76..7954590cc5 100644 --- a/include/z64vis.h +++ b/include/z64vis.h @@ -1,9 +1,11 @@ #ifndef Z64_VIS_H #define Z64_VIS_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" #include "color.h" +union Gfx; + typedef enum FramebufferFilterType { /* 0 */ FB_FILTER_NONE, /* 1 */ FB_FILTER_CVG_RGB, @@ -47,7 +49,7 @@ typedef struct VisCvg { void VisCvg_Init(VisCvg* this); void VisCvg_Destroy(VisCvg* this); -void VisCvg_Draw(VisCvg* this, Gfx** gfxP); +void VisCvg_Draw(VisCvg* this, union Gfx** gfxP); @@ -58,12 +60,12 @@ void VisCvg_Draw(VisCvg* this, Gfx** gfxP); typedef struct VisMono { /* 0x00 */ Vis vis; /* 0x10 */ u16* tlut; - /* 0x14 */ Gfx* dList; + /* 0x14 */ union Gfx* dList; } VisMono; // size = 0x18 void VisMono_Init(VisMono* this); void VisMono_Destroy(VisMono* this); -void VisMono_Draw(VisMono* this, Gfx** gfxP); +void VisMono_Draw(VisMono* this, union Gfx** gfxP); @@ -82,6 +84,6 @@ typedef struct VisZBuf { void VisZBuf_Init(VisZBuf* this); void VisZBuf_Destroy(VisZBuf* this); -void VisZBuf_Draw(VisZBuf* this, Gfx** gfxP); +void VisZBuf_Draw(VisZBuf* this, union Gfx** gfxP); #endif diff --git a/include/z_lib.h b/include/z_lib.h index 34581da982..5dd3049514 100644 --- a/include/z_lib.h +++ b/include/z_lib.h @@ -2,9 +2,11 @@ #define Z_LIB_H #include "libc/stddef.h" -#include "padmgr.h" -#include "z64math.h" -#include "color.h" + +struct Input; +struct Vec3f; +struct Vec3s; +struct Color_RGBA8; void Lib_MemSet(u8* dest, size_t len, u8 val); f32 Math_CosS(s16 angle); @@ -17,28 +19,28 @@ s32 Math_StepUntilS(s16* pValue, s16 limit, s16 step); s32 Math_StepToAngleS(s16* pValue, s16 target, s16 step); s32 Math_StepUntilF(f32* pValue, f32 limit, f32 step); s32 Math_AsymStepToF(f32* pValue, f32 target, f32 incrStep, f32 decrStep); -void Lib_GetControlStickData(f32* outMagnitude, s16* outAngle, Input* input); +void Lib_GetControlStickData(f32* outMagnitude, s16* outAngle, struct Input* input); s16 Rand_S16Offset(s16 base, s16 range); -void Math_Vec3f_Copy(Vec3f* dest, Vec3f* src); -void Math_Vec3s_ToVec3f(Vec3f* dest, Vec3s* src); -void Math_Vec3f_Sum(Vec3f* a, Vec3f* b, Vec3f* dest); -void Math_Vec3f_Diff(Vec3f* a, Vec3f* b, Vec3f* dest); -void Math_Vec3s_DiffToVec3f(Vec3f* dest, Vec3s* a, Vec3s* b); -void Math_Vec3f_Scale(Vec3f* vec, f32 scaleF); -f32 Math_Vec3f_DistXYZ(Vec3f* a, Vec3f* b); -f32 Math_Vec3f_DistXYZAndStoreDiff(Vec3f* a, Vec3f* b, Vec3f* dest); -f32 Math_Vec3f_DistXZ(Vec3f* a, Vec3f* b); -s16 Math_Vec3f_Yaw(Vec3f* origin, Vec3f* point); -s16 Math_Vec3f_Pitch(Vec3f* a, Vec3f* b); +void Math_Vec3f_Copy(struct Vec3f* dest, struct Vec3f* src); +void Math_Vec3s_ToVec3f(struct Vec3f* dest, struct Vec3s* src); +void Math_Vec3f_Sum(struct Vec3f* a, struct Vec3f* b, struct Vec3f* dest); +void Math_Vec3f_Diff(struct Vec3f* a, struct Vec3f* b, struct Vec3f* dest); +void Math_Vec3s_DiffToVec3f(struct Vec3f* dest, struct Vec3s* a, struct Vec3s* b); +void Math_Vec3f_Scale(struct Vec3f* vec, f32 scaleF); +f32 Math_Vec3f_DistXYZ(struct Vec3f* a, struct Vec3f* b); +f32 Math_Vec3f_DistXYZAndStoreDiff(struct Vec3f* a, struct Vec3f* b, struct Vec3f* dest); +f32 Math_Vec3f_DistXZ(struct Vec3f* a, struct Vec3f* b); +s16 Math_Vec3f_Yaw(struct Vec3f* origin, struct Vec3f* point); +s16 Math_Vec3f_Pitch(struct Vec3f* a, struct Vec3f* b); f32 Math_SmoothStepToF(f32* pValue, f32 target, f32 fraction, f32 step, f32 minStep); void Math_ApproachF(f32* pValue, f32 target, f32 fraction, f32 step); void Math_ApproachZeroF(f32* pValue, f32 fraction, f32 step); f32 Math_SmoothStepToDegF(f32* pValue, f32 target, f32 fraction, f32 step, f32 minStep); s16 Math_SmoothStepToS(s16* pValue, s16 target, s16 scale, s16 step, s16 minStep); void Math_ApproachS(s16* pValue, s16 target, s16 scale, s16 step); -void Color_RGBA8_Copy(Color_RGBA8* dst, Color_RGBA8* src); +void Color_RGBA8_Copy(struct Color_RGBA8* dst, struct Color_RGBA8* src); void Sfx_PlaySfxCentered(u16 sfxId); void Sfx_PlaySfxCentered2(u16 sfxId); -void Sfx_PlaySfxAtPos(Vec3f* projectedPos, u16 sfxId); +void Sfx_PlaySfxAtPos(struct Vec3f* projectedPos, u16 sfxId); #endif diff --git a/include/zelda_arena.h b/include/zelda_arena.h index 6bec3e4f02..a6a1240fcf 100644 --- a/include/zelda_arena.h +++ b/include/zelda_arena.h @@ -1,7 +1,7 @@ #ifndef ZELDA_ARENA_H #define ZELDA_ARENA_H -#include "ultra64.h" +#include "ultra64/ultratypes.h" void* ZeldaArena_Malloc(u32 size); void* ZeldaArena_MallocR(u32 size); diff --git a/src/audio/lib/load.c b/src/audio/lib/load.c index 99217c61fc..853952ea36 100644 --- a/src/audio/lib/load.c +++ b/src/audio/lib/load.c @@ -1,6 +1,7 @@ #include "ultra64.h" #include "global.h" #include "versions.h" +#include "segment_symbols.h" #define MK_ASYNC_MSG(retData, tableType, id, loadStatus) \ (((retData) << 24) | ((tableType) << 16) | ((id) << 8) | (loadStatus)) diff --git a/src/boot/boot_main.c b/src/boot/boot_main.c index d485a5b1f9..a939d79479 100644 --- a/src/boot/boot_main.c +++ b/src/boot/boot_main.c @@ -1,6 +1,7 @@ #include "global.h" #include "boot.h" #include "stack.h" +#include "segment_symbols.h" #if PLATFORM_N64 #include "cic6105.h" #endif diff --git a/src/boot/idle.c b/src/boot/idle.c index 7128309e00..800dd96b74 100644 --- a/src/boot/idle.c +++ b/src/boot/idle.c @@ -2,6 +2,8 @@ #include "stack.h" #include "terminal.h" #include "versions.h" +#include "segment_symbols.h" +#include "main.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" diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index d609ce6f10..57f21cff79 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -22,6 +22,7 @@ #include "fault.h" #include "stack.h" #include "terminal.h" +#include "segment_symbols.h" #if PLATFORM_N64 #include "n64dd.h" #endif diff --git a/src/code/object_table.c b/src/code/object_table.c index d0f9e936dc..f45b8dc568 100644 --- a/src/code/object_table.c +++ b/src/code/object_table.c @@ -1,4 +1,5 @@ #include "global.h" +#include "segment_symbols.h" s16 gLinkObjectIds[] = { OBJECT_LINK_BOY, OBJECT_LINK_CHILD }; diff --git a/src/code/sched.c b/src/code/sched.c index 3374da65e6..7f9f47e3b0 100644 --- a/src/code/sched.c +++ b/src/code/sched.c @@ -41,6 +41,7 @@ */ #include "global.h" #include "fault.h" +#include "main.h" #include "versions.h" #define RSP_DONE_MSG 667 diff --git a/src/code/sys_math.c b/src/code/sys_math.c index 6a7344baad..05348de3f4 100644 --- a/src/code/sys_math.c +++ b/src/code/sys_math.c @@ -1,4 +1,6 @@ #include "sys_math.h" +#include "math.h" +#include "ultra64/gu.h" f32 sFactorialTbl[] = { 1.0f, 1.0f, 2.0f, 6.0f, 24.0f, 120.0f, 720.0f, 5040.0f, 40320.0f, 362880.0f, 3628800.0f, 39916800.0f, 479001600.0f }; diff --git a/src/code/z_actor_dlftbls.c b/src/code/z_actor_dlftbls.c index 6e1fdb97cf..a8c067e66b 100644 --- a/src/code/z_actor_dlftbls.c +++ b/src/code/z_actor_dlftbls.c @@ -1,5 +1,6 @@ #include "global.h" #include "fault.h" +#include "segment_symbols.h" // Linker symbol declarations (used in the table below) #define DEFINE_ACTOR(name, _1, _2, _3) DECLARE_OVERLAY_SEGMENT(name) diff --git a/src/code/z_construct.c b/src/code/z_construct.c index 374665d385..11e3e2bd72 100644 --- a/src/code/z_construct.c +++ b/src/code/z_construct.c @@ -1,5 +1,6 @@ #include "global.h" #include "versions.h" +#include "segment_symbols.h" void Interface_Destroy(PlayState* play) { Map_Destroy(play); diff --git a/src/code/z_effect_soft_sprite_dlftbls.c b/src/code/z_effect_soft_sprite_dlftbls.c index cb24257c87..fbb8d335dc 100644 --- a/src/code/z_effect_soft_sprite_dlftbls.c +++ b/src/code/z_effect_soft_sprite_dlftbls.c @@ -1,4 +1,5 @@ #include "global.h" +#include "segment_symbols.h" // Linker symbol declarations (used in the table below) #define DEFINE_EFFECT_SS(name, _1) DECLARE_OVERLAY_SEGMENT(name) diff --git a/src/code/z_fbdemo_fade.c b/src/code/z_fbdemo_fade.c index d2cb382f05..b5fc498545 100644 --- a/src/code/z_fbdemo_fade.c +++ b/src/code/z_fbdemo_fade.c @@ -1,3 +1,4 @@ +#include "main.h" #include "global.h" #include "terminal.h" diff --git a/src/code/z_game_dlftbls.c b/src/code/z_game_dlftbls.c index 2cad84089d..67a4529261 100644 --- a/src/code/z_game_dlftbls.c +++ b/src/code/z_game_dlftbls.c @@ -1,4 +1,5 @@ #include "global.h" +#include "segment_symbols.h" // Linker symbol declarations (used in the table below) #define DEFINE_GAMESTATE(typeName, enumName, name) DECLARE_OVERLAY_SEGMENT(name) diff --git a/src/code/z_kaleido_manager.c b/src/code/z_kaleido_manager.c index 761d1fb9ec..8cf0ca5fe0 100644 --- a/src/code/z_kaleido_manager.c +++ b/src/code/z_kaleido_manager.c @@ -1,5 +1,6 @@ #include "global.h" #include "terminal.h" +#include "segment_symbols.h" #define KALEIDO_OVERLAY(name, nameString) \ { NULL, ROM_FILE(ovl_##name), _ovl_##name##SegmentStart, _ovl_##name##SegmentEnd, 0, nameString, } diff --git a/src/code/z_kanfont.c b/src/code/z_kanfont.c index a4ae98c5b1..3a81813915 100644 --- a/src/code/z_kanfont.c +++ b/src/code/z_kanfont.c @@ -1,6 +1,7 @@ #include "global.h" #include "message_data_static.h" #include "versions.h" +#include "segment_symbols.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 8fbbfd6623..cf490526af 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -5,6 +5,7 @@ #include "ultra64.h" #include "terminal.h" #include "versions.h" +#include "segment_symbols.h" #include "z64frame_advance.h" diff --git a/src/code/z_lib.c b/src/code/z_lib.c index d5f59a2a86..11910ed6e7 100644 --- a/src/code/z_lib.c +++ b/src/code/z_lib.c @@ -6,6 +6,9 @@ #include "sys_math.h" #include "rand.h" #include "sfx.h" +#include "color.h" +#include "padmgr.h" +#include "z64math.h" /** * memset: sets `len` bytes to `val` starting at address `dest`. diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c index ee72c9a501..92373ec659 100644 --- a/src/code/z_map_exp.c +++ b/src/code/z_map_exp.c @@ -1,5 +1,6 @@ #include "global.h" #include "terminal.h" +#include "segment_symbols.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/textures/parameter_static/parameter_static.h" #if PLATFORM_N64 diff --git a/src/code/z_map_mark.c b/src/code/z_map_mark.c index ae654c22d3..4483a32faf 100644 --- a/src/code/z_map_mark.c +++ b/src/code/z_map_mark.c @@ -1,5 +1,6 @@ #include "global.h" #include "terminal.h" +#include "segment_symbols.h" #include "assets/textures/parameter_static/parameter_static.h" #if PLATFORM_N64 #include "n64dd.h" diff --git a/src/code/z_message.c b/src/code/z_message.c index 1bd060944f..88829803d0 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -2,6 +2,7 @@ #include "message_data_static.h" #include "terminal.h" #include "versions.h" +#include "segment_symbols.h" #include "assets/textures/parameter_static/parameter_static.h" #if PLATFORM_N64 #include "n64dd.h" diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 1662361771..b2d48889c2 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -1,6 +1,8 @@ #include "global.h" #include "terminal.h" #include "versions.h" +#include "segment_symbols.h" +#include "main.h" #include "assets/textures/parameter_static/parameter_static.h" #include "assets/textures/do_action_static/do_action_static.h" #include "assets/textures/icon_item_static/icon_item_static.h" diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c index 1e85a8c7e2..1299e57da5 100644 --- a/src/code/z_rcp.c +++ b/src/code/z_rcp.c @@ -1,4 +1,5 @@ #include "global.h" +#include "main.h" Gfx sSetupDL[SETUPDL_MAX][6] = { { diff --git a/src/code/z_sample.c b/src/code/z_sample.c index 541771432b..26f009f173 100644 --- a/src/code/z_sample.c +++ b/src/code/z_sample.c @@ -1,4 +1,5 @@ #include "global.h" +#include "segment_symbols.h" void Sample_HandleStateChange(SampleState* this) { if (CHECK_BTN_ALL(this->state.input[0].press.button, BTN_START)) { diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 22d99dda9d..00d15706fc 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -1,6 +1,7 @@ #include "global.h" #include "terminal.h" #include "versions.h" +#include "segment_symbols.h" SceneCmdHandlerFunc sSceneCmdHandlers[SCENE_CMD_ID_MAX]; RomFile sNaviQuestHintFiles[]; diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c index d9e238e759..f326727074 100644 --- a/src/code/z_scene_table.c +++ b/src/code/z_scene_table.c @@ -1,6 +1,7 @@ #include "global.h" #include "quake.h" #include "versions.h" +#include "segment_symbols.h" #include "z64frame_advance.h" #if PLATFORM_N64 #include "n64dd.h" diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index a953bdb214..bf98db4c1b 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -1,5 +1,6 @@ #include "global.h" #include "terminal.h" +#include "segment_symbols.h" #define ANIM_INTERP 1 diff --git a/src/code/z_view.c b/src/code/z_view.c index 1c27679e20..27efc24822 100644 --- a/src/code/z_view.c +++ b/src/code/z_view.c @@ -1,5 +1,6 @@ #include "global.h" #include "terminal.h" +#include "main.h" vu32 sLogOnNextViewInit = true; diff --git a/src/code/z_vimode.c b/src/code/z_vimode.c index a971810758..dda2f07933 100644 --- a/src/code/z_vimode.c +++ b/src/code/z_vimode.c @@ -1,6 +1,7 @@ #include "global.h" #include "ultra64/viint.h" #include "versions.h" +#include "main.h" void ViMode_LogPrint(OSViMode* osViMode) { LOG_ADDRESS("osvimodep", osViMode, "../z_vimode.c", 87); diff --git a/src/code/z_vr_box.c b/src/code/z_vr_box.c index d2aac8c1f3..83aa10f6dd 100644 --- a/src/code/z_vr_box.c +++ b/src/code/z_vr_box.c @@ -1,6 +1,7 @@ #include "global.h" #include "terminal.h" #include "z64environment.h" +#include "segment_symbols.h" typedef struct SkyboxFaceParams { /* 0x000 */ s32 xStart; diff --git a/src/libc64/math64.c b/src/libc64/math64.c index 85fb4cedf3..1a0542742c 100644 --- a/src/libc64/math64.c +++ b/src/libc64/math64.c @@ -1,5 +1,8 @@ #include "z64math.h" #include "macros.h" +#include "segment_symbols.h" +#include "ultra64/gu.h" +#include "stdbool.h" #if !PLATFORM_N64 s32 gUseAtanContFrac; diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index 255d5fc336..2c6355ff22 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -27,8 +27,10 @@ #include "terminal.h" #include "versions.h" #include "z64audio.h" +#include "z64item.h" #include "z64play.h" #include "z64player.h" +#include "z64save.h" #include "z64skin_matrix.h" #include "z_lib.h" #if PLATFORM_N64 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 ef4d6cd779..5d82368b93 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -1,6 +1,8 @@ #include "file_select.h" #include "terminal.h" #include "versions.h" +#include "segment_symbols.h" +#include "main.h" #if OOT_PAL_N64 #include "assets/objects/object_mag/object_mag.h" #endif diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index 6ccf547b91..f5048d73ff 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -9,6 +9,7 @@ #include "terminal.h" #include "alloca.h" #include "z64.h" +#include "segment_symbols.h" #if PLATFORM_N64 #include "n64dd.h" diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index 6814e24da8..2e93e264b8 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -7,6 +7,7 @@ #include "global.h" #include "alloca.h" #include "versions.h" +#include "segment_symbols.h" #if PLATFORM_N64 #include "cic6105.h" diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c index 71104dd545..86e42b7bb9 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c @@ -15,6 +15,7 @@ #include "assets/textures/icon_item_gameover_static/icon_item_gameover_static.h" #include "terminal.h" #include "versions.h" +#include "segment_symbols.h" #pragma increment_block_number "ntsc-1.2:128 pal-1.0:128 pal-1.1:128"