More header cleanup (#1604)

* low hanging fruits on variables.h

* z_actor functions

* Move RomFile to z64object.h

* Revert "z_actor functions"

This reverts commit aa99967d16.

* yeet

* z64actor_dlftbls.h

* Move object segment declarations to object_table.c

* Move Camera functions

* z64nmi_buff.h

* fix merge

* su_mtx.h, sys_cmpdma.h and sys_initial_check.h

* sys_ucode.h

* sys_flashrom.h

* Remove unnecessary includes

* z64kanfont.h

* flg_set.h

* z64DLF.h

* z64lifemeter.h

* z64path.h

* format

* ObjectOverlay

* bss

* Yeet ObjectOverlay

* review

* review

* format

* bss

* z64font.h
This commit is contained in:
Anghelo Carvajal 2024-04-25 21:16:47 -04:00 committed by GitHub
parent 654fc4fd74
commit 666cb6ad4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
70 changed files with 434 additions and 310 deletions

9
include/flg_set.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef FLG_SET_H
#define FLG_SET_H
struct GameState;
void FlagSet_Update(struct GameState* gameState);
void FlagSet_Draw(struct GameState* gameState);
#endif

View File

@ -3,21 +3,6 @@
#include "z64.h"
// void EnItem00_SetObject(EnItem00* this, PlayState* play, f32* shadowOffset, f32* shadowScale);
// void EnItem00_Init(Actor* thisx, PlayState* play);
// void EnItem00_Destroy(Actor* thisx, PlayState* play);
// void EnItem00_WaitForHeartObject(EnItem00* this, PlayState* play);
// void func_800A640C(EnItem00* this, PlayState* play);
// void func_800A6650(EnItem00* this, PlayState* play);
// void func_800A6780(EnItem00* this, PlayState* play);
// void func_800A6A40(EnItem00* this, PlayState* play);
// void EnItem00_Update(Actor* thisx, PlayState* play);
// void EnItem00_Draw(Actor* thisx, PlayState* play);
// void EnItem00_DrawRupee(EnItem00* this, PlayState* play);
// void EnItem00_DrawSprite(EnItem00* this, PlayState* play);
// void EnItem00_DrawHeartContainer(EnItem00* this, PlayState* play);
// void EnItem00_DrawHeartPiece(EnItem00* this, PlayState* play);
// s16 func_800A7650(s16 dropId);
Actor* Item_DropCollectible(PlayState* play, Vec3f* spawnPos, u32 params);
Actor* Item_DropCollectible2(PlayState* play, Vec3f* spawnPos, s32 params);
void Item_DropCollectibleRandom(PlayState* play, Actor* fromActor, Vec3f* spawnPos, s16 params);
@ -25,11 +10,6 @@ s32 func_800A8150(s32 index);
s32 func_800A817C(s32 index);
bool Item_CanDropBigFairy(PlayState* play, s32 index, s32 collectibleFlag);
void FlagSet_Update(GameState* gameState);
void FlagSet_Draw(GameState* gameState);
void Overlay_LoadGameState(GameStateOverlay* overlayEntry);
void Overlay_FreeGameState(GameStateOverlay* overlayEntry);
void ActorShape_Init(ActorShape* actorShape, f32 yOffset, ActorShadowFunc shadowDraw, f32 shadowScale);
void ActorShadow_DrawCircle(Actor* actor, Lights* lights, PlayState* play);
void ActorShadow_DrawSquare(Actor* actor, Lights* lights, PlayState* play);
@ -211,11 +191,6 @@ s32 Actor_IsSmallChest(struct EnBox* chest);
void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f bodyPartsPos[], s16 bodyPartsCount, f32 effectScale, f32 frozenSteamScale, f32 effectAlpha, u8 type);
void Actor_SpawnIceEffects(PlayState* play, Actor* actor, Vec3f bodyPartsPos[], s32 bodyPartsCount, s32 effectsPerBodyPart, f32 scale, f32 scaleRange);
void ActorOverlayTable_FaultClient(void* arg0, void* arg1);
uintptr_t ActorOverlayTable_FaultAddrConv(uintptr_t address, void* param);
void ActorOverlayTable_Init(void);
void ActorOverlayTable_Cleanup(void);
void DynaPolyActor_UpdateCarriedActorPos(CollisionContext* colCtx, s32 bgId, Actor* carriedActor);
void DynaPolyActor_UpdateCarriedActorRotY(CollisionContext* colCtx, s32 bgId, Actor* carriedActor);
void DynaPolyActor_AttachCarriedActor(CollisionContext* colCtx, Actor* carriedActor, s32 bgId);
@ -237,49 +212,6 @@ s32 DynaPolyActor_IsSwitchPressed(DynaPolyActor* dynaActor);
s32 DynaPolyActor_IsHeavySwitchPressed(DynaPolyActor* dynaActor);
s32 DynaPolyActor_ValidateMove(PlayState* play, DynaPolyActor* dynaActor, s16 startRadius, s16 endRadius, s16 startHeight);
Camera* Camera_Create(View* view, CollisionContext* colCtx, PlayState* play);
void Camera_Destroy(Camera* camera);
void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, PlayState* play);
void func_800DDFE0(Camera* camera);
void Camera_InitFocalActorSettings(Camera* camera, Actor* focalActor);
s32 Camera_ChangeStatus(Camera* camera, s16 status);
s32 Camera_UpdateWater(Camera* camera);
void Camera_EarthquakeDay3(Camera* camera);
s32 Camera_UpdateHotRoom(Camera* camera);
s32 Camera_SetSwordDistortion(Camera* camera);
s32 Camera_RequestGiantsMaskSetting(Camera* camera);
Vec3s Camera_Update(Camera* camera);
s32 func_800DF498(Camera* camera);
s32 Camera_ChangeModeFlags(Camera* camera, s16 mode, u8 forceChange);
s32 Camera_ChangeMode(Camera* camera, s16 mode);
s32 Camera_CheckValidMode(Camera* camera, s16 mode);
s16 Camera_ChangeSettingFlags(Camera* camera, s16 setting, s16 flags);
s32 Camera_ChangeSetting(Camera* camera, s16 setting);
s32 Camera_ChangeActorCsCamIndex(Camera* camera, s32 bgCamIndex);
Vec3s Camera_GetInputDir(Camera* camera);
s16 Camera_GetInputDirPitch(Camera* camera);
s16 Camera_GetInputDirYaw(Camera* camera);
Vec3s Camera_GetCamDir(Camera* camera);
s16 Camera_GetCamDirPitch(Camera* camera);
s16 Camera_GetCamDirYaw(Camera* camera);
s32 Camera_AddQuake(Camera* camera, s32 arg1, s16 y, s32 countdown);
s32 Camera_SetViewParam(Camera* camera, s32 viewFlag, void* param);
s32 Camera_UnsetViewFlag(Camera* camera, s16 viewFlag);
s32 Camera_OverwriteStateFlags(Camera* camera, s16 stateFlags);
s16 Camera_SetStateFlag(Camera* camera, s16 flags);
s16 Camera_UnsetStateFlag(Camera* camera, s16 flags);
s32 Camera_ChangeDoorCam(Camera* camera, Actor* doorActor, s16 bgCamIndex, f32 arg3, s16 timer1, s16 timer2, s16 timer3);
s32 Camera_Copy(Camera* dstCam, Camera* srcCam);
s32 Camera_IsDbgCamEnabled(void);
Vec3f Camera_GetQuakeOffset(Camera* camera);
void Camera_SetCameraData(Camera* camera, s16 setDataFlags, void* data0, void* data1, s16 data2, s16 data3);
s32 Camera_GetNegOne(void);
s16 func_800E0238(Camera* camera);
void Camera_SetFocalActor(Camera* camera, Actor* actor);
void Camera_SetTargetActor(Camera* camera, Actor* actor);
f32 Camera_GetWaterYPos(Camera* camera);
void func_800E0348(Camera* camera);
void Actor_ContinueText(PlayState* play, Actor* actor, u16 textId);
s32 Flags_GetEventChkInf(s32 flag);
void Flags_SetEventChkInf(s32 flag);
@ -294,20 +226,6 @@ void GetItem_Draw(PlayState* play, s16 drawId);
u16 QuestHint_GetTatlTextId(PlayState* play);
void Font_LoadChar(PlayState* play, u16 codePointIndex, s32 offset);
void Font_LoadCharNES(PlayState* play, u8 codePointIndex, s32 offset);
void Font_LoadMessageBoxEndIcon(Font* font, u16 icon);
void Font_LoadOrderedFont(Font* font);
void LifeMeter_Init(PlayState* play);
void LifeMeter_UpdateColors(PlayState* play);
s32 LifeMeter_SaveInterfaceHealth(PlayState* play);
s32 LifeMeter_IncreaseInterfaceHealth(PlayState* play);
s32 LifeMeter_DecreaseInterfaceHealth(PlayState* play);
void LifeMeter_Draw(PlayState* play);
void LifeMeter_UpdateSizeAndBeep(PlayState* play);
u32 LifeMeter_IsCritical(void);
// void func_80102E40(void);
// void func_80102E90(void);
// void func_80102EA4(void);
@ -468,9 +386,7 @@ void Map_Update(PlayState* play);
// void func_8010BEF0(void);
// void func_8010BF24(void);
s32 func_8010BF58(Actor* actor, PlayState* play, void* param_3, UNK_PTR param_4, s32* param_5);
void Nmi_Init(void);
void Nmi_SetPrenmiStart(void);
// s32 Nmi_GetPrenmiHasStarted(void);
f32 OLib_Vec3fDist(Vec3f* a, Vec3f* b);
f32 OLib_Vec3fDistOutDiff(Vec3f* a, Vec3f* b, Vec3f* dest);
f32 OLib_Vec3fDistXZ(Vec3f* a, Vec3f* b);
@ -490,10 +406,6 @@ Vec3s OLib_Vec3fDiffBinAng(Vec3f* a, Vec3f* b);
void OLib_Vec3fDiff(PosRot* a, Vec3f* b, Vec3f* dest, s16 mode);
void OLib_Vec3fAdd(PosRot* a, Vec3f* b, Vec3f* dest, s16 mode);
Path* Path_GetByIndex(PlayState* play, s16 index, s16 indexNone);
f32 Path_OrientAndGetDistSq(Actor* actor, Path* path, s16 waypoint, s16* yaw);
void Path_CopyLastPoint(Path* path, Vec3f* dest);
void Room_Noop(PlayState* play, Room* room, Input* input, s32 arg3);
void Room_Init(PlayState* play, RoomContext* roomCtx);
size_t Room_AllocateAndLoad(PlayState* play, RoomContext* roomCtx);
@ -580,21 +492,6 @@ Gfx* Gfx_Open(Gfx* gfx);
Gfx* Gfx_Close(Gfx* gfx, Gfx* dst);
void* Gfx_Alloc(Gfx** gfxP, size_t size);
void Mtx_SetTranslateScaleMtx(Mtx* mtx, f32 scaleX, f32 scaleY, f32 scaleZ, f32 translateX, f32 translateY, f32 translateZ);
void Mtx_SetRotationMtx(Mtx* mtx, s32 angle, f32 axisX, f32 axisY, f32 axisZ);
void Mtx_SetTranslationRotationScaleMtx(Mtx* mtx, f32 scaleX, f32 scaleY, f32 scaleZ, s32 angle, f32 axisX, f32 axisY, f32 axisZ,f32 translateX, f32 translateY, f32 translateZ);
void CmpDma_LoadFile(uintptr_t segmentVrom, s32 id, void* dst, size_t size);
void CmpDma_LoadAllFiles(uintptr_t segmentVrom, void* dst, size_t size);
// void Check_WriteRGBA16Pixel(u16* buffer, u32 x, u32 y, u32 value);
// void Check_WriteI4Pixel(u16* buffer, u32 x, u32 y, u32 value);
// void Check_DrawI4Texture(u16* buffer, u32 x, u32 y, u32 width, u32 height, u8* texture);
// void Check_ClearRGBA16(u16* buffer);
// void Check_DrawExpansionPakErrorMessage(void);
// void Check_DrawRegionLockErrorMessage(void);
void Check_ExpansionPak(void);
void Check_RegionIsSupported(void);
f32 Math3D_Normalize(Vec3f* vec);
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);
s32 func_80179798(Vec3f* param_1, Vec3f* param_2, Vec3f* param_3, Vec3f* param_4, Vec3f* param_5, Vec3f* param_6);
@ -690,11 +587,6 @@ s32 Math3D_YZInSphere(Sphere16* sphere, f32 y, f32 z);
// void func_8017FB1C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10, UNK_TYPE4 param_11);
// void func_8017FD44(void);
u64* SysUcode_GetUCodeBoot(void);
size_t SysUcode_GetUCodeBootSize(void);
u64* SysUcode_GetUCode(void);
u64* SysUcode_GetUCodeData(void);
void func_80183070(void);
// void func_801830A0(void);
// void func_801830C8(void);
@ -738,13 +630,6 @@ void func_8018450C(PlayState* play, SkeletonInfo* skeleton, Mtx* mtx, OverrideKe
// void func_801853C8(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
// void func_80185460(void);
s32 SysFlashrom_InitFlash(void);
s32 SysFlashrom_ReadData(void* addr, u32 pageNum, u32 pageCount);
void SysFlashrom_WriteDataAsync(u8* addr, u32 pageNum, u32 pageCount);
s32 SysFlashrom_IsBusy(void);
s32 SysFlashrom_AwaitResult(void);
void SysFlashrom_WriteDataSync(void* addr, u32 pageNum, u32 pageCount);
AudioTask* AudioThread_Update(void);
void AudioThread_QueueCmdF32(u32 opArgs, f32 data);
void AudioThread_QueueCmdS32(u32 opArgs, s32 data);

View File

@ -35,9 +35,11 @@
#define SEGMENT_BSS_SIZE(segment) ((uintptr_t)SEGMENT_BSS_END(segment) - (uintptr_t)SEGMENT_BSS_START(segment))
#define ROM_FILE(name) \
{ (uintptr_t)SEGMENT_ROM_START(name), (uintptr_t)SEGMENT_ROM_END(name) }
{ SEGMENT_ROM_START(name), SEGMENT_ROM_END(name) }
#define ROM_FILE_EMPTY(name) \
{ SEGMENT_ROM_START(name), SEGMENT_ROM_START(name) }
#define ROM_FILE_UNSET \
{ 0 }
{ 0, 0 }
DECLARE_SEGMENT(framebuffer_lo)
@ -85,26 +87,6 @@ DECLARE_SEGMENT(system_heap)
DECLARE_OVERLAY_SEGMENT(kaleido_scope)
DECLARE_OVERLAY_SEGMENT(player_actor)
#define DEFINE_ACTOR(name, _enumValue, _allocType, _debugName) DECLARE_OVERLAY_SEGMENT(name)
#define DEFINE_ACTOR_INTERNAL(_name, _enumValue, _allocType, _debugName)
#define DEFINE_ACTOR_UNSET(_enumValue)
#include "tables/actor_table.h"
#undef DEFINE_ACTOR
#undef DEFINE_ACTOR_INTERNAL
#undef DEFINE_ACTOR_UNSET
#define DEFINE_OBJECT(name, _enumValue) DECLARE_ROM_SEGMENT(name)
#define DEFINE_OBJECT_UNSET(_enumValue)
#define DEFINE_OBJECT_SIZE_ZERO(_name, _enumValue)
#include "tables/object_table.h"
#undef DEFINE_OBJECT
#undef DEFINE_OBJECT_UNSET
#undef DEFINE_OBJECT_SIZE_ZERO
DECLARE_ROM_SEGMENT(scene_texture_01)
DECLARE_ROM_SEGMENT(scene_texture_02)
DECLARE_ROM_SEGMENT(scene_texture_03)

10
include/su_mtx.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef SU_MTX_H
#define SU_MTX_H
#include "ultra64.h"
void Mtx_SetTranslateScaleMtx(Mtx* mtx, f32 scaleX, f32 scaleY, f32 scaleZ, f32 translateX, f32 translateY, f32 translateZ);
void Mtx_SetRotationMtx(Mtx* mtx, s32 angle, f32 axisX, f32 axisY, f32 axisZ);
void Mtx_SetTranslationRotationScaleMtx(Mtx* mtx, f32 scaleX, f32 scaleY, f32 scaleZ, s32 angle, f32 axisX, f32 axisY, f32 axisZ,f32 translateX, f32 translateY, f32 translateZ);
#endif

10
include/sys_cmpdma.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef SYS_CPMDMA_H
#define SYS_CPMDMA_H
#include "PR/ultratypes.h"
#include "libc/stdint.h"
void CmpDma_LoadFile(uintptr_t segmentVrom, s32 id, void* dst, size_t size);
void CmpDma_LoadAllFiles(uintptr_t segmentVrom, void* dst, size_t size);
#endif

View File

@ -3,7 +3,7 @@
#include "ultra64.h"
typedef struct {
typedef struct FlashromRequest {
/* 0x00 */ s32 requestType;
/* 0x04 */ s32 response;
/* 0x08 */ void* addr;
@ -17,4 +17,11 @@ typedef struct {
#define FLASH_TYPE_MAGIC 0x11118001
s32 SysFlashrom_InitFlash(void);
s32 SysFlashrom_ReadData(void* addr, u32 pageNum, u32 pageCount);
void SysFlashrom_WriteDataAsync(u8* addr, u32 pageNum, u32 pageCount);
s32 SysFlashrom_IsBusy(void);
s32 SysFlashrom_AwaitResult(void);
void SysFlashrom_WriteDataSync(void* addr, u32 pageNum, u32 pageCount);
#endif

View File

@ -0,0 +1,7 @@
#ifndef SYS_INITIAL_CHECK_H
#define SYS_INITIAL_CHECK_H
void Check_ExpansionPak(void);
void Check_RegionIsSupported(void);
#endif

11
include/sys_ucode.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef SYS_UCODE_H
#define SYS_UCODE_H
#include "ultra64.h"
u64* SysUcode_GetUCodeBoot(void);
size_t SysUcode_GetUCodeBootSize(void);
u64* SysUcode_GetUCode(void);
u64* SysUcode_GetUCodeData(void);
#endif

View File

@ -5,12 +5,12 @@
* - Argument 0: Name of the object segment in spec
* - Argument 1: Enum value for this object
*
* DEFINE_OBJECT_UNSET and DEFINE_OBJECT_SIZE_ZERO are needed to define empty entries from the original game
* DEFINE_OBJECT_UNSET and DEFINE_OBJECT_EMPTY are needed to define empty entries from the original game
*
* DEFINE_OBJECT_UNSET is used to declare a placeholder enum value which maps to an entry with zeroes in `gObjectTable`
* - Argument 0: Enum value for this object
*
* DEFINE_OBJECT_SIZE_ZERO is used to declare a placeholder enum value which maps to a zero-size entry in `gObjectTable`, with no corresponding segment in the rom.
* DEFINE_OBJECT_EMPTY is used to declare a placeholder enum value which maps to a zero-size entry in `gObjectTable`, with no corresponding segment in the rom.
* - Argument 0: Name of the object segment in spec
* - Argument 1: Enum value for this object
*/
@ -365,7 +365,7 @@
/* 0x15C */ DEFINE_OBJECT(object_boss03, OBJECT_BOSS03)
/* 0x15D */ DEFINE_OBJECT(object_boss04, OBJECT_BOSS04)
/* 0x15E */ DEFINE_OBJECT(object_boss05, OBJECT_BOSS05)
/* 0x15F */ DEFINE_OBJECT_SIZE_ZERO(object_boss07, OBJECT_UNSET_15F) // unused duplicate with size 0
/* 0x15F */ DEFINE_OBJECT_EMPTY(object_boss07, OBJECT_UNSET_15F) // unused duplicate with size 0
/* 0x160 */ DEFINE_OBJECT(object_boss07, OBJECT_BOSS07)
/* 0x161 */ DEFINE_OBJECT(object_raf, OBJECT_RAF)
/* 0x162 */ DEFINE_OBJECT(object_funen, OBJECT_FUNEN)

View File

@ -6,15 +6,6 @@
#include "macros.h"
// data
extern ActorOverlay gActorOverlayTable[ACTOR_ID_MAX];
extern ActorId gMaxActorId;
extern FlexSkeletonHeader* gPlayerSkeletons[PLAYER_FORM_MAX];
extern PlayerModelIndices gPlayerModelTypes[];
extern struct_80124618 D_801C03A0[];
extern struct_80124618 D_801C0490[];
extern Gfx gCullBackDList[];
extern Gfx gCullFrontDList[];
extern u32 gBitFlags[32];
extern u16 gEquipMasks[];
@ -32,12 +23,6 @@ extern s16 gItemPrices[];
extern u16 gSceneIdsPerRegion[11][27];
extern u8 gPlayerFormItemRestrictions[PLAYER_FORM_MAX][114];
extern s16 gPlayerFormObjectIds[PLAYER_FORM_MAX];
extern ObjectId gObjectTableSize;
extern RomFile gObjectTable[OBJECT_ID_MAX];
extern SceneTableEntry gSceneTable[SCENE_MAX];
extern s32 gDbgCamEnabled;
extern Vec3f gZeroVec3f;

9
include/z64DLF.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef Z64DLF_H
#define Z64DLF_H
struct GameStateOverlay;
void Overlay_LoadGameState(struct GameStateOverlay* overlayEntry);
void Overlay_FreeGameState(struct GameStateOverlay* overlayEntry);
#endif

View File

@ -4,14 +4,12 @@
#include "PR/ultratypes.h"
#include "color.h"
#include "padutils.h"
#include "z64actor_dlftbls.h"
#include "z64math.h"
#include "z64animation.h"
#include "z64collision_check.h"
#include "unk.h"
// This value is hardcoded to be the size of ovl_Arrow_Fire which currently is the biggest actor that uses the AM_FIELD.
#define AM_FIELD_SIZE SEGMENT_SIZE(ovl_Arrow_Fire)
#define MASS_IMMOVABLE 0xFF // Cannot be pushed by OC collisions
#define MASS_HEAVY 0xFE // Can only be pushed by OC collisions with IMMOVABLE and HEAVY objects.
@ -49,24 +47,6 @@ typedef struct ActorInit {
/* 0x1C */ ActorFunc draw;
} ActorInit; // size = 0x20
typedef enum AllocType {
/* 0 */ ALLOCTYPE_NORMAL,
/* 1 */ ALLOCTYPE_ABSOLUTE,
/* 2 */ ALLOCTYPE_PERMANENT
} AllocType;
typedef struct ActorOverlay {
/* 0x00 */ uintptr_t vromStart;
/* 0x04 */ uintptr_t vromEnd;
/* 0x08 */ void* vramStart;
/* 0x0C */ void* vramEnd;
/* 0x10 */ void* loadedRamAddr; // original name: "allocp"
/* 0x14 */ ActorInit* initInfo;
/* 0x18 */ char* name;
/* 0x1C */ u16 allocType; // bit 0: don't allocate memory, use actorContext->0x250? bit 1: Always keep loaded?
/* 0x1E */ s8 numLoaded; // original name: "clients"
} ActorOverlay; // size = 0x20
typedef void (*ActorShadowFunc)(struct Actor* actor, struct Lights* mapper, struct PlayState* play);
typedef struct {
@ -169,7 +149,7 @@ typedef struct Actor {
/* 0x134 */ ActorFunc destroy; // Destruction Routine. Called by `Actor_Destroy`
/* 0x138 */ ActorFunc update; // Update Routine. Called by `Actor_UpdateAll`
/* 0x13C */ ActorFunc draw; // Draw Routine. Called by `Actor_Draw`
/* 0x140 */ ActorOverlay* overlayEntry; // Pointer to the overlay table entry for this actor
/* 0x140 */ struct ActorOverlay* overlayEntry; // Pointer to the overlay table entry for this actor
} Actor; // size = 0x144
typedef enum {
@ -450,19 +430,6 @@ typedef enum {
/* 32 */ ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_LARGE
} ActorDrawDamageEffectType;
#define DEFINE_ACTOR(_name, enumValue, _allocType, _debugName) enumValue,
#define DEFINE_ACTOR_INTERNAL(_name, enumValue, _allocType, _debugName) enumValue,
#define DEFINE_ACTOR_UNSET(enumValue) enumValue,
typedef enum ActorId {
#include "tables/actor_table.h"
/* 0x2B2 */ ACTOR_ID_MAX // originally "ACTOR_DLF_MAX"
} ActorId;
#undef DEFINE_ACTOR
#undef DEFINE_ACTOR_INTERNAL
#undef DEFINE_ACTOR_UNSET
typedef enum DoorLockType {
/* 0 */ DOORLOCK_NORMAL,
/* 1 */ DOORLOCK_BOSS,

View File

@ -0,0 +1,51 @@
#ifndef Z64ACTOR_DLFTBLS_H
#define Z64ACTOR_DLFTBLS_H
#include "PR/ultratypes.h"
#include "libc/stdint.h"
#include "segment_symbols.h"
// This value is hardcoded to be the size of ovl_Arrow_Fire which currently is the biggest actor that uses the AM_FIELD.
DECLARE_OVERLAY_SEGMENT(Arrow_Fire)
#define AM_FIELD_SIZE SEGMENT_SIZE(ovl_Arrow_Fire)
struct ActorInit;
#define DEFINE_ACTOR(_name, enumValue, _allocType, _debugName) enumValue,
#define DEFINE_ACTOR_INTERNAL(_name, enumValue, _allocType, _debugName) enumValue,
#define DEFINE_ACTOR_UNSET(enumValue) enumValue,
typedef enum ActorId {
#include "tables/actor_table.h"
/* 0x2B2 */ ACTOR_ID_MAX // originally "ACTOR_DLF_MAX"
} ActorId;
#undef DEFINE_ACTOR
#undef DEFINE_ACTOR_INTERNAL
#undef DEFINE_ACTOR_UNSET
typedef enum AllocType {
/* 0 */ ALLOCTYPE_NORMAL,
/* 1 */ ALLOCTYPE_ABSOLUTE,
/* 2 */ ALLOCTYPE_PERMANENT
} AllocType;
typedef struct ActorOverlay {
/* 0x00 */ uintptr_t vromStart;
/* 0x04 */ uintptr_t vromEnd;
/* 0x08 */ void* vramStart;
/* 0x0C */ void* vramEnd;
/* 0x10 */ void* loadedRamAddr; // original name: "allocp"
/* 0x14 */ struct ActorInit* initInfo;
/* 0x18 */ char* name;
/* 0x1C */ u16 allocType; // bit 0: don't allocate memory, use actorContext->0x250? bit 1: Always keep loaded?
/* 0x1E */ s8 numLoaded; // original name: "clients"
} ActorOverlay; // size = 0x20
void ActorOverlayTable_Init(void);
void ActorOverlayTable_Cleanup(void);
extern ActorOverlay gActorOverlayTable[ACTOR_ID_MAX];
extern ActorId gMaxActorId;
#endif

View File

@ -6,7 +6,10 @@
#include "z64save.h"
#include "unk.h"
struct CollisionContext;
struct CollisionPoly;
struct PlayState;
struct View;
// these two angle conversion macros are slightly inaccurate
#define CAM_DEG_TO_BINANG(degrees) (s16)((degrees) * ((f32)0xFFFF / 360) + .5f)
@ -1612,4 +1615,47 @@ typedef struct Camera {
/* 0x16C */ Vec3f meshActorPos;
} Camera; // size = 0x178
Camera* Camera_Create(struct View* view, struct CollisionContext* colCtx, struct PlayState* play);
void Camera_Destroy(Camera* camera);
void Camera_Init(Camera* camera, struct View* view, struct CollisionContext* colCtx, struct PlayState* play);
void func_800DDFE0(Camera* camera);
void Camera_InitFocalActorSettings(Camera* camera, struct Actor* focalActor);
s32 Camera_ChangeStatus(Camera* camera, s16 status);
s32 Camera_UpdateWater(Camera* camera);
void Camera_EarthquakeDay3(Camera* camera);
s32 Camera_UpdateHotRoom(Camera* camera);
s32 Camera_SetSwordDistortion(Camera* camera);
s32 Camera_RequestGiantsMaskSetting(Camera* camera);
Vec3s Camera_Update(Camera* camera);
s32 func_800DF498(Camera* camera);
s32 Camera_ChangeModeFlags(Camera* camera, s16 mode, u8 forceChange);
s32 Camera_ChangeMode(Camera* camera, s16 mode);
s32 Camera_CheckValidMode(Camera* camera, s16 mode);
s16 Camera_ChangeSettingFlags(Camera* camera, s16 setting, s16 flags);
s32 Camera_ChangeSetting(Camera* camera, s16 setting);
s32 Camera_ChangeActorCsCamIndex(Camera* camera, s32 bgCamIndex);
Vec3s Camera_GetInputDir(Camera* camera);
s16 Camera_GetInputDirPitch(Camera* camera);
s16 Camera_GetInputDirYaw(Camera* camera);
Vec3s Camera_GetCamDir(Camera* camera);
s16 Camera_GetCamDirPitch(Camera* camera);
s16 Camera_GetCamDirYaw(Camera* camera);
s32 Camera_AddQuake(Camera* camera, s32 arg1, s16 y, s32 countdown);
s32 Camera_SetViewParam(Camera* camera, s32 viewFlag, void* param);
s32 Camera_UnsetViewFlag(Camera* camera, s16 viewFlag);
s32 Camera_OverwriteStateFlags(Camera* camera, s16 stateFlags);
s16 Camera_SetStateFlag(Camera* camera, s16 flags);
s16 Camera_UnsetStateFlag(Camera* camera, s16 flags);
s32 Camera_ChangeDoorCam(Camera* camera, struct Actor* doorActor, s16 bgCamIndex, f32 arg3, s16 timer1, s16 timer2, s16 timer3);
s32 Camera_Copy(Camera* dstCam, Camera* srcCam);
s32 Camera_IsDbgCamEnabled(void);
Vec3f Camera_GetQuakeOffset(Camera* camera);
void Camera_SetCameraData(Camera* camera, s16 setDataFlags, void* data0, void* data1, s16 data2, s16 data3);
s32 Camera_GetNegOne(void);
s16 func_800E0238(Camera* camera);
void Camera_SetFocalActor(Camera* camera, struct Actor* actor);
void Camera_SetTargetActor(Camera* camera, struct Actor* actor);
f32 Camera_GetWaterYPos(Camera* camera);
void func_800E0348(Camera* camera);
#endif

View File

@ -15,6 +15,11 @@ typedef struct {
/* 0x1C */ OSMesg notifyMsg; // Completion notification message
} DmaRequest; // size = 0x20
typedef struct RomFile {
/* 0x0 */ uintptr_t vromStart;
/* 0x4 */ uintptr_t vromEnd;
} RomFile; // size = 0x8
typedef struct {
/* 0x0 */ uintptr_t vromStart;
/* 0x4 */ uintptr_t vromEnd;

43
include/z64font.h Normal file
View File

@ -0,0 +1,43 @@
#ifndef Z64FONT_H
#define Z64FONT_H
#include "PR/ultratypes.h"
#include "libc/stdint.h"
struct PlayState;
#define FONT_CHAR_TEX_WIDTH 16
#define FONT_CHAR_TEX_HEIGHT 16
//! TODO: Make this use `sizeof(AnyFontTextureSymbol)`
#define FONT_CHAR_TEX_SIZE ((16 * 16) / 2) // 16x16 I4 texture
// Font textures are loaded into here
typedef struct Font {
/* 0x00000 */ union {
u8 charBuf[2][FONT_CHAR_TEX_SIZE * 120];
u64 force_structure_alignment_charTex;
};
/* 0x07800 */ union {
u8 iconBuf[FONT_CHAR_TEX_SIZE];
u64 force_structure_alignment_icon;
};
/* 0x07880 */ union {
u8 fontBuf[FONT_CHAR_TEX_SIZE * 320];
u64 force_structure_alignment_font;
};
/* 0x11880 */ union {
char schar[1280]; // msgBuf
u16 wchar[640]; // msgBufWide
u64 force_structure_alignment_msg;
} msgBuf;
/* 0x11D80 */ uintptr_t messageStart;
/* 0x11D84 */ uintptr_t messageEnd;
/* 0x11D88 */ u8 unk_11D88; // current Char Buffer ?
} Font; // size = 0x11D90
void Font_LoadChar(struct PlayState* play, u16 codePointIndex, s32 offset);
void Font_LoadCharNES(struct PlayState* play, u8 codePointIndex, s32 offset);
void Font_LoadMessageBoxEndIcon(Font* font, u16 icon);
void Font_LoadOrderedFont(Font* font);
#endif

View File

@ -29,7 +29,7 @@ typedef enum GameStateId {
typedef void (*GameStateFunc)(struct GameState* gameState);
typedef struct {
typedef struct GameStateOverlay {
/* 0x00 */ void* loadedRamAddr;
/* 0x04 */ uintptr_t vromStart; // if applicable
/* 0x08 */ uintptr_t vromEnd; // if applicable

17
include/z64lifemeter.h Normal file
View File

@ -0,0 +1,17 @@
#ifndef Z64LIFEMETER_H
#define Z64LIFEMETER_H
#include "PR/ultratypes.h"
struct PlayState;
void LifeMeter_Init(struct PlayState* play);
void LifeMeter_UpdateColors(struct PlayState* play);
s32 LifeMeter_SaveInterfaceHealth(struct PlayState* play);
s32 LifeMeter_IncreaseInterfaceHealth(struct PlayState* play);
s32 LifeMeter_DecreaseInterfaceHealth(struct PlayState* play);
void LifeMeter_Draw(struct PlayState* play);
void LifeMeter_UpdateSizeAndBeep(struct PlayState* play);
u32 LifeMeter_IsCritical(void);
#endif

View File

@ -4,9 +4,10 @@
#include "PR/ultratypes.h"
#include "libc/stdbool.h"
#include "unk.h"
#include "z64bombers_notebook.h"
#include "z64font.h"
#include "z64view.h"
#include "unk.h"
struct Actor;
struct MessageTableEntry;
@ -177,36 +178,6 @@ typedef enum TextState {
/* 18 */ TEXT_STATE_18
} TextState;
#define FONT_CHAR_TEX_WIDTH 16
#define FONT_CHAR_TEX_HEIGHT 16
//! TODO: Make this use `sizeof(AnyFontTextureSymbol)`
#define FONT_CHAR_TEX_SIZE ((16 * 16) / 2) // 16x16 I4 texture
// TODO: should Font be in its own header or is it fine to have it here?
// Font textures are loaded into here
typedef struct {
/* 0x00000 */ union {
u8 charBuf[2][FONT_CHAR_TEX_SIZE * 120];
u64 force_structure_alignment_charTex;
};
/* 0x07800 */ union {
u8 iconBuf[FONT_CHAR_TEX_SIZE];
u64 force_structure_alignment_icon;
};
/* 0x07880 */ union {
u8 fontBuf[FONT_CHAR_TEX_SIZE * 320];
u64 force_structure_alignment_font;
};
/* 0x11880 */ union {
char schar[1280]; // msgBuf
u16 wchar[640]; // msgBufWide
u64 force_structure_alignment_msg;
} msgBuf;
/* 0x11D80 */ uintptr_t messageStart;
/* 0x11D84 */ uintptr_t messageEnd;
/* 0x11D88 */ u8 unk_11D88; // current Char Buffer ?
} Font; // size = 0x11D90
typedef struct MessageContext {
/* 0x00000 */ View view;
/* 0x00168 */ Font font;

10
include/z64nmi_buff.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef Z64NMI_BUFF_H
#define Z64NMI_BUFF_H
#include "PR/ultratypes.h"
void Nmi_Init(void);
void Nmi_SetPrenmiStart(void);
s32 Nmi_GetPrenmiHasStarted(void);
#endif

View File

@ -1,9 +1,11 @@
#ifndef Z64OBJECT_H
#define Z64OBJECT_H
#include "libc/stdint.h"
#define DEFINE_OBJECT(_name, enumValue) enumValue,
#define DEFINE_OBJECT_UNSET(enumValue) enumValue,
#define DEFINE_OBJECT_SIZE_ZERO(_name, enumValue) enumValue,
#define DEFINE_OBJECT_EMPTY(_name, enumValue) enumValue,
typedef enum ObjectId {
#include "tables/object_table.h"
@ -12,6 +14,9 @@ typedef enum ObjectId {
#undef DEFINE_OBJECT
#undef DEFINE_OBJECT_UNSET
#undef DEFINE_OBJECT_SIZE_ZERO
#undef DEFINE_OBJECT_EMPTY
extern ObjectId gObjectTableSize;
extern RomFile gObjectTable[OBJECT_ID_MAX];
#endif

24
include/z64path.h Normal file
View File

@ -0,0 +1,24 @@
#ifndef Z64PATH_H
#define Z64PATH_H
#include "PR/ultratypes.h"
#include "z64math.h"
struct PlayState;
struct Actor;
#define PATH_INDEX_NONE -1
#define ADDITIONAL_PATH_INDEX_NONE (u8)-1
typedef struct Path {
/* 0x0 */ u8 count; // Number of points in the path
/* 0x1 */ u8 additionalPathIndex;
/* 0x2 */ s16 customValue; // Path specific to help distinguish different paths
/* 0x4 */ Vec3s* points; // Segment Address to the array of points
} Path; // size = 0x8
Path* Path_GetByIndex(struct PlayState* play, s16 index, s16 indexNone);
f32 Path_OrientAndGetDistSq(struct Actor* actor, Path* path, s16 waypoint, s16* yaw);
void Path_CopyLastPoint(Path* path, Vec3f* dest);
#endif

View File

@ -1423,4 +1423,14 @@ s32 func_80128640(struct PlayState* play, Player* player, Gfx* dList);
void Player_SetFeetPos(struct PlayState* play, Player* player, s32 limbIndex);
void Player_PostLimbDrawGameplay(struct PlayState* play, s32 limbIndex, Gfx** dList1, Gfx** dList2, Vec3s* rot, Actor* actor);
extern FlexSkeletonHeader* gPlayerSkeletons[PLAYER_FORM_MAX];
extern PlayerModelIndices gPlayerModelTypes[];
extern struct_80124618 D_801C03A0[];
extern struct_80124618 D_801C0490[];
extern Gfx gCullBackDList[];
extern Gfx gCullFrontDList[];
// object_table.c
extern s16 gPlayerFormObjectIds[PLAYER_FORM_MAX];
#endif

View File

@ -2,8 +2,9 @@
#define Z64SCENE_H
#include "ultra64.h"
#include "z64dma.h"
#include "z64cutscene.h"
#include "z64dma.h"
#include "z64path.h"
#include "unk.h"
struct GameState;
@ -11,11 +12,6 @@ struct PlayState;
#define SPAWN_ROT_FLAGS(rotation, flags) (((rotation) << 7) | (flags))
typedef struct {
/* 0x0 */ uintptr_t vromStart;
/* 0x4 */ uintptr_t vromEnd;
} RomFile; // size = 0x8
#define ROOM_DRAW_OPA (1 << 0)
#define ROOM_DRAW_XLU (1 << 1)
@ -477,16 +473,6 @@ typedef struct {
/* 0x00C */ ObjectEntry slots[35];
} ObjectContext; // size = 0x958
#define PATH_INDEX_NONE -1
#define ADDITIONAL_PATH_INDEX_NONE (u8)-1
typedef struct {
/* 0x0 */ u8 count; // Number of points in the path
/* 0x1 */ u8 additionalPathIndex;
/* 0x2 */ s16 customValue; // Path specific to help distinguish different paths
/* 0x4 */ Vec3s* points; // Segment Address to the array of points
} Path; // size = 0x8
typedef struct {
/* 0x0 */ UNK_TYPE2 unk0;
/* 0x2 */ UNK_TYPE2 unk2;
@ -975,4 +961,6 @@ s32 Entrance_GetSceneIdAbsolute(u16 entrance);
s32 Entrance_GetSpawnNum(u16 entrance);
s32 Entrance_GetTransitionFlags(u16 entrance);
extern SceneTableEntry gSceneTable[SCENE_MAX];
#endif

View File

@ -18,6 +18,7 @@
#include "slowly.h"
#include "stack.h"
#include "stackcheck.h"
#include "sys_ucode.h"
/**
* Assigns the "save" values in PreRender

View File

@ -12,7 +12,6 @@
#include "tha.h"
#include "alignment.h"
#include "functions.h"
void* THA_GetHead(TwoHeadArena* tha) {
return tha->head;

View File

@ -11,7 +11,6 @@
#include "thga.h"
#include "alignment.h"
#include "functions.h"
void THGA_Init(TwoHeadGfxArena* thga, void* start, size_t size) {
THA_Init(&thga->tha, start, size);

View File

@ -1,7 +1,8 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "libc/string.h"
static CutsceneCamera* sCurCsCamera;
CutsceneCamera* sCurCsCamera;
typedef s16 (*CsCamInterpolateCallback)(Vec3f*, f32*, s16*, CsCmdCamPoint*, CsCmdCamMisc*, CutsceneCameraInterp*);
@ -789,16 +790,16 @@ s16 CutsceneCamera_Interp_MultiPointCubic(Vec3f* camPos, f32* camFov, s16* camRo
return 0;
}
static f32 sKnots[38];
f32 sCsCamKnots[38];
// Only used by unused CutsceneCamera_Interp_Unused
void func_80162FF8(s16 arg0) {
f32 val = 0.0f;
s32 i;
sKnots[0] = 0.0f;
sKnots[1] = 0.0f;
sKnots[2] = 0.0f;
sCsCamKnots[0] = 0.0f;
sCsCamKnots[1] = 0.0f;
sCsCamKnots[2] = 0.0f;
for (i = 3; i < arg0; i++) {
if (i == 3) {
@ -809,13 +810,13 @@ void func_80162FF8(s16 arg0) {
val += 0.3f;
}
sKnots[i] = val;
sCsCamKnots[i] = val;
}
val += 0.9f;
sKnots[i++] = val;
sKnots[i++] = val;
sKnots[i++] = val;
sCsCamKnots[i++] = val;
sCsCamKnots[i++] = val;
sCsCamKnots[i++] = val;
}
#define FUNC_801631DC_ORDER 3
@ -837,15 +838,17 @@ void func_801631DC(f32 progress, s32 arg2, f32* coeff) {
for (i = 1; i < FUNC_801631DC_ORDER; i++) {
for (j = arg2 - i, k = (FUNC_801631DC_ORDER - 1) - i; j <= arg2; j++, k++) {
if (sKnots[j + i] != sKnots[j]) {
coeffTemp[i][k] = ((progress - sKnots[j]) / (sKnots[j + i] - sKnots[j])) * coeffTemp[i - 1][k];
if (sCsCamKnots[j + i] != sCsCamKnots[j]) {
coeffTemp[i][k] =
((progress - sCsCamKnots[j]) / (sCsCamKnots[j + i] - sCsCamKnots[j])) * coeffTemp[i - 1][k];
} else {
coeffTemp[i][k] = 0.0f;
}
if (sKnots[j + i + 1] != sKnots[j + 1]) {
if (sCsCamKnots[j + i + 1] != sCsCamKnots[j + 1]) {
coeffTemp[i][k] +=
((sKnots[j + i + 1] - progress) / (sKnots[j + i + 1] - sKnots[j + 1])) * coeffTemp[i - 1][k + 1];
((sCsCamKnots[j + i + 1] - progress) / (sCsCamKnots[j + i + 1] - sCsCamKnots[j + 1])) *
coeffTemp[i - 1][k + 1];
}
}
}
@ -869,7 +872,7 @@ s16 CutsceneCamera_Interp_Unused(Vec3f* camPos, f32* camFov, s16* camRoll, CsCmd
}
index = interpState->waypoint + 2;
func_801631DC(F32_LERPIMP(sKnots[index], sKnots[index + 1],
func_801631DC(F32_LERPIMP(sCsCamKnots[index], sCsCamKnots[index + 1],
(f32)interpState->curFrame / miscCmd[interpState->waypoint].unused0),
index, coeff);

View File

@ -10,8 +10,11 @@
* Hold Start and press B: clear all weekEventReg and eventInf flags
*/
#include "flg_set.h"
#include "global.h"
#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h"
typedef struct FlagSetEntry {
/* 0x0 */ u8* value;
/* 0x4 */ const char* name;

View File

@ -1,6 +1,5 @@
#include "z64.h"
#include "regs.h"
#include "functions.h"
#include "fault.h"
// Variables are put before most headers as a hacky way to bypass bss reordering
@ -10,13 +9,15 @@ GfxMasterList* gGfxMasterDL;
CfbInfo sGraphCfbInfos[3];
OSTime sGraphPrevUpdateEndTime;
#include "variables.h"
#include "macros.h"
#include "buffers.h"
#include "idle.h"
#include "sys_cfb.h"
#include "sys_ucode.h"
#include "libc64/malloc.h"
#include "z64DLF.h"
#include "z64speed_meter.h"
#include "overlays/gamestates/ovl_daytelop/z_daytelop.h"
#include "overlays/gamestates/ovl_file_choose/z_file_select.h"
#include "overlays/gamestates/ovl_opening/z_opening.h"

View File

@ -32,7 +32,9 @@ PadMgr gPadMgr;
#include "main.h"
#include "buffers.h"
#include "global.h"
#include "sys_initial_check.h"
#include "system_heap.h"
#include "z64nmi_buff.h"
#include "z64thread.h"
s32 gScreenWidth = SCREEN_WIDTH;

View File

@ -10,10 +10,21 @@ s16 gPlayerFormObjectIds[PLAYER_FORM_MAX] = {
ObjectId gObjectTableSize = OBJECT_ID_MAX;
// Segment declarations (also used in the table below)
#define DEFINE_OBJECT(name, _enumValue) DECLARE_ROM_SEGMENT(name)
#define DEFINE_OBJECT_UNSET(_enumValue)
#define DEFINE_OBJECT_EMPTY(_name, _enumValue)
#include "tables/object_table.h"
#undef DEFINE_OBJECT
#undef DEFINE_OBJECT_UNSET
#undef DEFINE_OBJECT_EMPTY
// Object Table definition
#define DEFINE_OBJECT(name, _enumValue) { SEGMENT_ROM_START(name), SEGMENT_ROM_END(name) },
#define DEFINE_OBJECT_UNSET(_enumValue) { 0, 0 },
#define DEFINE_OBJECT_SIZE_ZERO(name, _enumValue) { SEGMENT_ROM_START(name), SEGMENT_ROM_START(name) },
#define DEFINE_OBJECT(name, _enumValue) ROM_FILE(name),
#define DEFINE_OBJECT_UNSET(_enumValue) ROM_FILE_UNSET,
#define DEFINE_OBJECT_EMPTY(name, _enumValue) ROM_FILE_EMPTY(name),
RomFile gObjectTable[] = {
#include "tables/object_table.h"
@ -21,4 +32,4 @@ RomFile gObjectTable[] = {
#undef DEFINE_OBJECT
#undef DEFINE_OBJECT_UNSET
#undef DEFINE_OBJECT_SIZE_ZERO
#undef DEFINE_OBJECT_EMPTY

View File

@ -49,7 +49,8 @@
* @remark Name inferred from shared Animal Forest functions, meaning of "su" is unclear.
*/
#include "global.h"
#include "su_mtx.h"
#include "z64math.h"
/**
* Constructs a matrix \$f ST \$f, i.e. a scaling \$f S \$f followed by a translation \$f T \$f.

View File

@ -1,7 +1,6 @@
#include "z64.h"
#include "buffers.h"
#include "regs.h"
#include "functions.h"
#include "macros.h"
// Variables are put before most headers as a hacky way to bypass bss reordering
@ -34,7 +33,6 @@ s16 gCfbUpperAdjust;
u8 gSysCfbHiResEnabled;
#include "variables.h"
#include "sys_cfb.h"
#include "libc/stdbool.h"
#include "buffers.h"

View File

@ -1,7 +1,7 @@
#include "global.h"
#include "libc64/malloc.h"
#include "yaz0.h"
#include "sys_cmpdma.h"
#include "libc64/malloc.h"
#include "color.h"
#include "yaz0.h"
#include "z64dma.h"

View File

@ -6,8 +6,14 @@
* These checks are some of the first functions run in Main, before even setting up the system heap, and any image files
* are DMA'd directly to fixed RAM addresses.
*/
#include "sys_initial_check.h"
#include "global.h"
#include "color.h"
#include "fault.h"
#include "segment_symbols.h"
#include "misc/locerrmsg/locerrmsg.h"
#include "misc/memerrmsg/memerrmsg.h"
@ -28,7 +34,7 @@
void Check_WriteRGBA16Pixel(u16* buffer, u32 x, u32 y, u32 value) {
if (value & RGBA16_PIXEL_OPAQUE) {
(&buffer[x])[y * SCREEN_WIDTH] = value;
buffer[x + y * SCREEN_WIDTH] = value;
}
}

View File

@ -2,7 +2,8 @@
* File: sys_ucode.c
* Description: Functions for obtaining locations and sizes of microcode
*/
#include "global.h"
#include "sys_ucode.h"
u64* initialgspUcodeText = gspF3DZEX2_NoN_PosLight_fifoTextStart;
u64* initialgspUcodeData = gspF3DZEX2_NoN_PosLight_fifoDataStart;

View File

@ -1,4 +1,6 @@
#include "z_title_setup.h"
#include "sys_flashrom.h"
#include "overlays/gamestates/ovl_title/z_title.h"
void Setup_InitRegs(void) {

View File

@ -1,4 +1,6 @@
#include "z64DLF.h"
#include "global.h"
#include "libc64/malloc.h"
#include "loadfragment.h"

View File

@ -2,6 +2,7 @@
* File: z_actor.c
* Description:
*/
#include "fault.h"
#include "sys_cfb.h"
#include "loadfragment.h"

View File

@ -1,9 +1,12 @@
#include "global.h"
#include "z64actor_dlftbls.h"
#include "fault.h"
// Init Vars declarations (also used in the table below)
#define DEFINE_ACTOR(name, _enumValue, _allocType, _debugName) extern ActorInit name##_InitVars;
#define DEFINE_ACTOR_INTERNAL(name, _enumValue, _allocType, _debugName) extern ActorInit name##_InitVars;
// Segment and InitVars declarations (also used in the table below)
#define DEFINE_ACTOR(name, _enumValue, _allocType, _debugName) \
extern struct ActorInit name##_InitVars; \
DECLARE_OVERLAY_SEGMENT(name)
#define DEFINE_ACTOR_INTERNAL(name, _enumValue, _allocType, _debugName) extern struct ActorInit name##_InitVars;
#define DEFINE_ACTOR_UNSET(_enumValue)
#include "tables/actor_table.h"

View File

@ -1,3 +1,5 @@
#include "prevent_bss_reordering.h"
#include "z64bgcheck.h"
#include "global.h"

View File

@ -43,6 +43,7 @@
*
*/
#include "prevent_bss_reordering.h"
#include "global.h"
#include "libc/string.h"
#include "z64malloc.h"

View File

@ -1,7 +1,7 @@
#include "z64eff_footmark.h"
#include "z64.h"
#include "macros.h"
#include "functions.h"
#include "assets/code/eff_footmark/eff_footmark.c"

View File

@ -1,4 +1,5 @@
#include "z64game_over.h"
#include "z64rumble.h"
#include "z64shrink_window.h"
#include "z64.h"

View File

@ -1,7 +1,9 @@
#include "z64jpeg.h"
#include "libc/stdbool.h"
#include "variables.h"
#include "functions.h"
#include "main.h"
#include "sys_ucode.h"
#include "macros.h"
#define MARKER_ESCAPE 0x00
#define MARKER_SOI 0xD8
@ -107,7 +109,7 @@ void Jpeg_CopyToZbuffer(u16* src, u16* zbuffer, s32 x, s32 y) {
* unaligned values in JPEG header files.
*/
u16 Jpeg_GetUnalignedU16(u8* ptr) {
if (((u32)ptr & 1) == 0) {
if (((uintptr_t)ptr & 1) == 0) {
// Read the value normally if it's aligned to a 16-bit address.
return *(u16*)ptr;
} else {

View File

@ -1,3 +1,4 @@
#include "prevent_bss_reordering.h"
#include "z64pause_menu.h"
#include "z64.h"

View File

@ -1,4 +1,9 @@
#include "global.h"
#include "z64font.h"
#include "segment_symbols.h"
#include "z64message.h"
#include "z64.h"
// stubbed in NTSC-U
void Font_LoadChar(PlayState* play, u16 codePointIndex, s32 offset) {

View File

@ -1,5 +1,11 @@
#include "prevent_bss_reordering.h"
#include "z64lifemeter.h"
#include "global.h"
#include "su_mtx.h"
#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h"
#include "interface/parameter_static/parameter_static.h"
s16 sHeartsPrimColors[3][3] = { { 255, 70, 50 }, { 255, 190, 0 }, { 100, 100, 255 } };

View File

@ -3,6 +3,7 @@
#include "message_data_static.h"
#include "padmgr.h"
#include "sys_cmpdma.h"
#include "segment_symbols.h"
#include "z64actor.h"
#include "z64horse.h"

View File

@ -4,8 +4,8 @@
#define NMI 1
typedef struct {
/* 0x00 */ u32 resetting;
/* 0x04 */ u32 resetCount;
/* 0x00 */ s32 resetting;
/* 0x04 */ s32 resetCount;
/* 0x08 */ OSTime duration;
/* 0x10 */ OSTime resetTime;
} NmiBuff; // size >= 0x18
@ -32,6 +32,6 @@ void Nmi_SetPrenmiStart(void) {
gNMIBuffer->resetTime = osGetTime();
}
u32 Nmi_GetPrenmiHasStarted(void) {
s32 Nmi_GetPrenmiHasStarted(void) {
return gNMIBuffer->resetting;
}

View File

@ -1,6 +1,8 @@
#include "global.h"
#include "PR/gs2dex.h"
#include "sys_cfb.h"
#include "sys_ucode.h"
#include "z64lifemeter.h"
#include "z64malloc.h"
#include "z64snap.h"
#include "z64view.h"

View File

@ -1,5 +1,8 @@
#include "z64path.h"
#include "global.h"
#include "z64lib.h"
Path* Path_GetByIndex(PlayState* play, s16 index, s16 indexNone) {
Path* path;

View File

@ -1,6 +1,5 @@
#include "z64.h"
#include "regs.h"
#include "functions.h"
#include "z64malloc.h"
#include "z64vis.h"
#include "z64visfbuf.h"
@ -18,7 +17,6 @@ BombersNotebook sBombersNotebook;
u8 sBombersNotebookOpen;
u8 sMotionBlurStatus;
#include "variables.h"
#include "macros.h"
#include "buffers.h"
#include "idle.h"

View File

@ -1,5 +1,6 @@
#include "global.h"
#include "sys_cfb.h"
#include "sys_cmpdma.h"
#include "z64bombers_notebook.h"
#include "z64malloc.h"

View File

@ -1,6 +1,7 @@
#include "global.h"
#include "PR/gs2dex.h"
#include "debug.h"
#include "sys_ucode.h"
void Room_Noop(PlayState* play, Room* room, Input* input, s32 arg3) {
}

View File

@ -233,9 +233,9 @@ void Scene_CommandEntranceList(PlayState* play, SceneCmd* cmd) {
void Scene_CommandSpecialFiles(PlayState* play, SceneCmd* cmd) {
// @note These quest hint files are identical to OoT's.
// They are not relevant in this game and the system to process these scripts has been removed.
static RomFile naviQuestHintFiles[2] = {
{ SEGMENT_ROM_START(elf_message_field), SEGMENT_ROM_END(elf_message_field) },
{ SEGMENT_ROM_START(elf_message_ydan), SEGMENT_ROM_END(elf_message_ydan) },
static RomFile sNaviQuestHintFiles[2] = {
ROM_FILE(elf_message_field),
ROM_FILE(elf_message_ydan),
};
if (cmd->specialFiles.subKeepId != 0) {
@ -245,7 +245,7 @@ void Scene_CommandSpecialFiles(PlayState* play, SceneCmd* cmd) {
}
if (cmd->specialFiles.naviQuestHintFileId != NAVI_QUEST_HINTS_NONE) {
play->naviQuestHints = Play_LoadFile(play, &naviQuestHintFiles[cmd->specialFiles.naviQuestHintFileId - 1]);
play->naviQuestHints = Play_LoadFile(play, &sNaviQuestHintFiles[cmd->specialFiles.naviQuestHintFileId - 1]);
}
}
@ -356,19 +356,19 @@ void Scene_CommandEnvLightSettings(PlayState* play, SceneCmd* cmd) {
* These later are stored in segment 0x06, and used in maps.
*/
void Scene_LoadAreaTextures(PlayState* play, s32 fileIndex) {
static RomFile sceneTextureFiles[9] = {
{ 0, 0 }, // Default
{ SEGMENT_ROM_START(scene_texture_01), SEGMENT_ROM_END(scene_texture_01) },
{ SEGMENT_ROM_START(scene_texture_02), SEGMENT_ROM_END(scene_texture_02) },
{ SEGMENT_ROM_START(scene_texture_03), SEGMENT_ROM_END(scene_texture_03) },
{ SEGMENT_ROM_START(scene_texture_04), SEGMENT_ROM_END(scene_texture_04) },
{ SEGMENT_ROM_START(scene_texture_05), SEGMENT_ROM_END(scene_texture_05) },
{ SEGMENT_ROM_START(scene_texture_06), SEGMENT_ROM_END(scene_texture_06) },
{ SEGMENT_ROM_START(scene_texture_07), SEGMENT_ROM_END(scene_texture_07) },
{ SEGMENT_ROM_START(scene_texture_08), SEGMENT_ROM_END(scene_texture_08) },
static RomFile sSceneTextureFiles[9] = {
ROM_FILE_UNSET, // Default
ROM_FILE(scene_texture_01),
ROM_FILE(scene_texture_02),
ROM_FILE(scene_texture_03),
ROM_FILE(scene_texture_04),
ROM_FILE(scene_texture_05),
ROM_FILE(scene_texture_06),
ROM_FILE(scene_texture_07),
ROM_FILE(scene_texture_08),
};
uintptr_t vromStart = sceneTextureFiles[fileIndex].vromStart;
size_t size = sceneTextureFiles[fileIndex].vromEnd - vromStart;
uintptr_t vromStart = sSceneTextureFiles[fileIndex].vromStart;
size_t size = sSceneTextureFiles[fileIndex].vromEnd - vromStart;
if (size != 0) {
play->roomCtx.unk74 = THA_AllocTailAlign16(&play->state.tha, size);

View File

@ -1,4 +1,7 @@
#include "z64save.h"
#include "global.h"
#include "sys_flashrom.h"
#include "z64horse.h"
#include "overlays/gamestates/ovl_file_choose/z_file_select.h"

View File

@ -13,6 +13,7 @@
#include "global.h"
#include "z64visfbuf.h"
#include "sys_cfb.h"
#include "sys_ucode.h"
#define SCALE_MIN 0.032f
#define SCALE_MAX 1.0f //!< also unchanged scale

View File

@ -4,7 +4,6 @@
* Description: Great Bay Temple - Waterwheels, push switches, gear shafts, and whirlpools
*/
#include "prevent_bss_reordering.h"
#include "z_bg_dblue_movebg.h"
#include "objects/object_dblue_object/object_dblue_object.h"
#include "overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.h"

View File

@ -25,6 +25,7 @@
* to randomly select; these new wait actions are what allow him to summon a ring of fire, drop falling blocks, etc.
*/
#include "prevent_bss_reordering.h"
#include "z_boss_01.h"
#include "z64rumble.h"
#include "z64shrink_window.h"

View File

@ -3,6 +3,8 @@
* Overlay: ovl_En_Fishing
* Description: Fishing Pond Elements (Owner, Fish, Props, Effects...)
*/
#include "prevent_bss_reordering.h"
#include "z_en_fishing.h"
#include "z64rumble.h"
#include "z64shrink_window.h"

View File

@ -9,6 +9,8 @@
*/
#include "z_en_paper.h"
#include "su_mtx.h"
#include "objects/object_bal/object_bal.h"
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_100000 | ACTOR_FLAG_2000000)

View File

@ -4,6 +4,7 @@
* Description: Trees, shrubs
*/
#include "prevent_bss_reordering.h"
#include "z_en_wood02.h"
#include "objects/object_wood02/object_wood02.h"

View File

@ -6,7 +6,6 @@
* Instances of ObjGrass must be spawned by ObjGrassUnit to function correctly.
*/
#include "prevent_bss_reordering.h"
#include "z_obj_grass.h"
#include "overlays/actors/ovl_Obj_Grass_Carry/z_obj_grass_carry.h"
#include "objects/gameplay_keep/gameplay_keep.h"

View File

@ -4,8 +4,10 @@
* Description: Player
*/
#include "prevent_bss_reordering.h"
#include "global.h"
#include "z64horse.h"
#include "z64lifemeter.h"
#include "z64malloc.h"
#include "z64quake.h"
#include "z64rumble.h"

View File

@ -7,6 +7,7 @@
#include "global.h"
#include "PR/gs2dex.h"
#include "sys_cfb.h"
#include "sys_ucode.h"
#include "z_fbdemo_wipe5.h"
#define THIS ((TransitionWipe5*)thisx)

View File

@ -4,9 +4,13 @@
* Description: Pause Menu
*/
#include "prevent_bss_reordering.h"
#include "z_kaleido_scope.h"
#include "sys_cmpdma.h"
#include "z64skybox.h"
#include "z64view.h"
#include "overlays/gamestates/ovl_opening/z_opening.h"
#include "archives/icon_item_static/icon_item_static_yar.h"

View File

@ -1313,8 +1313,8 @@
0x801C212C:("gSceneIdsPerRegion","SceneIdList","[]",0x252),
0x801C2380:("sSceneIdsPerTingleMap","u16","[]",0x90),
0x801C2410:("gPlayerFormItemRestrictions","UNK_TYPE1","",0x1),
0x801C2650:("naviQuestHintFiles","RomFile","[2]",0x10),
0x801C2660:("sceneTextureFiles","RomFile","[9]",0x48),
0x801C2650:("sNaviQuestHintFiles","RomFile","[2]",0x10),
0x801C2660:("sSceneTextureFiles","RomFile","[9]",0x48),
0x801C26A8:("sSceneCmdHandlers","scene_header_func","[31]",0x7c),
0x801C2730:("gPlayerFormObjectIds","s16","[5]",0xA),
0x801C273C:("gObjectTableSize","ObjectId","",0x4),
@ -3964,7 +3964,7 @@
0x801F6B40:("sShrinkWindow","ShrinkWindow","",0x4),
0x801F6B44:("sShrinkWindowPtr","ShrinkWindow*","",0x4),
0x801F6B50:("sCurCsCamera","UNK_TYPE4","",0x4),
0x801F6B58:("sKnots","UNK_TYPE1","",0x1),
0x801F6B58:("sCsCamKnots","UNK_TYPE1","",0x1),
0x801F6BF0:("sKaleidoMgrFaultAddrConvClient","FaultAddrConvClient","",0xC),
0x801F6C00:("sKaleidoScopeUpdateFunc","void*","",0x4),
0x801F6C04:("sKaleidoScopeDrawFunc","void*","",0x4),

View File

@ -1372,9 +1372,9 @@ asm/non_matchings/code/z_lib/Lib_VirtualToPhysical.s,Lib_VirtualToPhysical,0x801
asm/non_matchings/code/z_lib/Lib_PhysicalToVirtual.s,Lib_PhysicalToVirtual,0x801005A0,0x8
asm/non_matchings/code/z_lifemeter/LifeMeter_Init.s,LifeMeter_Init,0x801005C0,0x37
asm/non_matchings/code/z_lifemeter/LifeMeter_UpdateColors.s,LifeMeter_UpdateColors,0x8010069C,0xF9
asm/non_matchings/code/z_lifemeter/func_80100A80.s,func_80100A80,0x80100A80,0x8
asm/non_matchings/code/z_lifemeter/func_80100AA0.s,func_80100AA0,0x80100AA0,0x14
asm/non_matchings/code/z_lifemeter/func_80100AF0.s,func_80100AF0,0x80100AF0,0x27
asm/non_matchings/code/z_lifemeter/LifeMeter_SaveInterfaceHealth.s,LifeMeter_SaveInterfaceHealth,0x80100A80,0x8
asm/non_matchings/code/z_lifemeter/LifeMeter_IncreaseInterfaceHealth.s,LifeMeter_IncreaseInterfaceHealth,0x80100AA0,0x14
asm/non_matchings/code/z_lifemeter/LifeMeter_DecreaseInterfaceHealth.s,LifeMeter_DecreaseInterfaceHealth,0x80100AF0,0x27
asm/non_matchings/code/z_lifemeter/LifeMeter_Draw.s,LifeMeter_Draw,0x80100B8C,0x32E
asm/non_matchings/code/z_lifemeter/LifeMeter_UpdateSizeAndBeep.s,LifeMeter_UpdateSizeAndBeep,0x80101844,0x3B
asm/non_matchings/code/z_lifemeter/LifeMeter_IsCritical.s,LifeMeter_IsCritical,0x80101930,0x1C

1 asm/non_matchings/code/z_en_a_keep/EnAObj_Init.s EnAObj_Init 0x800A5AC0 0x2B
1372 asm/non_matchings/code/z_lib/Lib_PhysicalToVirtual.s Lib_PhysicalToVirtual 0x801005A0 0x8
1373 asm/non_matchings/code/z_lifemeter/LifeMeter_Init.s LifeMeter_Init 0x801005C0 0x37
1374 asm/non_matchings/code/z_lifemeter/LifeMeter_UpdateColors.s LifeMeter_UpdateColors 0x8010069C 0xF9
1375 asm/non_matchings/code/z_lifemeter/func_80100A80.s asm/non_matchings/code/z_lifemeter/LifeMeter_SaveInterfaceHealth.s func_80100A80 LifeMeter_SaveInterfaceHealth 0x80100A80 0x8
1376 asm/non_matchings/code/z_lifemeter/func_80100AA0.s asm/non_matchings/code/z_lifemeter/LifeMeter_IncreaseInterfaceHealth.s func_80100AA0 LifeMeter_IncreaseInterfaceHealth 0x80100AA0 0x14
1377 asm/non_matchings/code/z_lifemeter/func_80100AF0.s asm/non_matchings/code/z_lifemeter/LifeMeter_DecreaseInterfaceHealth.s func_80100AF0 LifeMeter_DecreaseInterfaceHealth 0x80100AF0 0x27
1378 asm/non_matchings/code/z_lifemeter/LifeMeter_Draw.s LifeMeter_Draw 0x80100B8C 0x32E
1379 asm/non_matchings/code/z_lifemeter/LifeMeter_UpdateSizeAndBeep.s LifeMeter_UpdateSizeAndBeep 0x80101844 0x3B
1380 asm/non_matchings/code/z_lifemeter/LifeMeter_IsCritical.s LifeMeter_IsCritical 0x80101930 0x1C