Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce header interdependency #2281

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/cic6105.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef CIC6105_H
#define CIC6105_H

#include "ultra64.h"
#include "ultra64/ultratypes.h"

extern s32 B_80008EE0;

Expand Down
3 changes: 2 additions & 1 deletion include/fault.h
Original file line number Diff line number Diff line change
@@ -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"

Expand Down
1 change: 0 additions & 1 deletion include/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 5 additions & 2 deletions include/gfx.h
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion include/gfx_setupdl.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef GFX_SETUPDL_H
#define GFX_SETUPDL_H

#include "ultra64.h"
#include "ultra64/gbi.h"

struct GraphicsContext;
struct PlayState;
Expand Down
3 changes: 2 additions & 1 deletion include/gfxalloc.h
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
3 changes: 2 additions & 1 deletion include/gfxprint.h
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion include/ichain.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef ICHAIN_H
#define ICHAIN_H

#include "ultra64.h"
#include "ultra64/ultratypes.h"

struct Actor;

Expand Down
5 changes: 4 additions & 1 deletion include/irqmgr.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion include/jpeg.h
Original file line number Diff line number Diff line change
@@ -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];
Expand Down
2 changes: 1 addition & 1 deletion include/kaleido_manager.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef KALEIDO_MANAGER_H
#define KALEIDO_MANAGER_H

#include "ultra64.h"
#include "ultra64/ultratypes.h"
#include "romfile.h"

struct PlayState;
Expand Down
2 changes: 1 addition & 1 deletion include/letterbox.h
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
2 changes: 1 addition & 1 deletion include/main.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef MAIN_H
#define MAIN_H

#include "ultra64.h"
#include "ultra64/ultratypes.h"

extern s32 gScreenWidth;
extern s32 gScreenHeight;
Expand Down
2 changes: 1 addition & 1 deletion include/map.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef MAP_H
#define MAP_H

#include "ultra64.h"
#include "ultra64/ultratypes.h"

struct PlayState;

Expand Down
2 changes: 1 addition & 1 deletion include/mempak.h
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
2 changes: 1 addition & 1 deletion include/message_data_static.h
Original file line number Diff line number Diff line change
@@ -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"

Expand Down
23 changes: 14 additions & 9 deletions include/n64dd.h
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -17,6 +19,9 @@ struct RegEditor;
struct RoomContext;
struct SaveContext;
struct Scene;
struct MapMarkIconData;
struct PauseMapMarkData;
struct DmaRequest;

// TODO Use the specific pointer types instead of void*
typedef struct n64ddStruct_800FEE70_pointers {
Expand All @@ -40,10 +45,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 MapMarkIconData***[3]);
s32 (*unk_30)(struct MapMarkIconData***[3]);
void (*unk_34)(struct PauseMapMarkData**[3]);
void (*unk_38)(struct PauseMapMarkData**[3]);
Comment on lines +48 to +51
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find these and the void(**)(struct PlayState*) below much less readable than with the typedef. Is it really worth it?

void (*unk_3C)(void);
void (*unk_40)(void);
s32 (*unk_44)(struct PlayState*);
Expand All @@ -62,7 +67,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*, void(**)(struct PlayState*));
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*);
Expand Down
2 changes: 1 addition & 1 deletion include/one_point_cutscene.h
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
5 changes: 4 additions & 1 deletion include/padmgr.h
Original file line number Diff line number Diff line change
@@ -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"

Expand Down
7 changes: 4 additions & 3 deletions include/quake.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#ifndef QUAKE_H
#define QUAKE_H

#include "z64camera.h"
#include "z64math.h"

typedef struct ShakeInfo {
Expand All @@ -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);
Expand All @@ -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
2 changes: 1 addition & 1 deletion include/romfile.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef ROMFILE_H
#define ROMFILE_H

#include "ultra64.h"
#include "stdint.h"

typedef struct RomFile {
/* 0x00 */ uintptr_t vromStart;
Expand Down
2 changes: 1 addition & 1 deletion include/rumble.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef RUMBLE_H
#define RUMBLE_H

#include "ultra64.h"
#include "ultra64/ultratypes.h"

#define RUMBLE_MAX_REQUESTS 64

Expand Down
10 changes: 8 additions & 2 deletions include/sched.h
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/segment_symbols.h
Original file line number Diff line number Diff line change
Expand Up @@ -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[]; \
Expand Down
2 changes: 1 addition & 1 deletion include/segmented_address.h
Original file line number Diff line number Diff line change
@@ -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];
Expand Down
2 changes: 1 addition & 1 deletion include/sequence.h
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
17 changes: 9 additions & 8 deletions include/sfx.h
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -129,26 +128,28 @@ 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);
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;

Expand Down
2 changes: 1 addition & 1 deletion include/stackcheck.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef STACKCHECK_H
#define STACKCHECK_H

#include "ultra64.h"
#include "ultra64/ultratypes.h"

typedef enum StackStatus {
/* 0 */ STACK_STATUS_OK,
Expand Down
Loading