mirror of
https://github.com/zeldaret/oot.git
synced 2024-11-27 20:30:31 +00:00
Split z64.h: move various things, state, sram, gfx, jpeg, prerender, speedmeter (#1487)
* Split z64.h more * fix speedmeter.h (expect this kind of issue resolution to pop up eventually) * fix z64object.h * fix z64state.h * fix (probably only partially) z64play.h * fix fix speedmeter.h :) * revert making a play header (sadge), add/split transition & transition_instances * move stuff to cutscene, interface * Move `TransitionCircle%` enums to `z64transition_instances.h` * z64state.h -> z64game.h with a "this is not final" comment * forward declare GraphicsContext in z64game.h instead of including the header file for it * don't comment on where the forward declarations are from reasoning: 1) it's easy to go out of sync (like this comment, it was outdated anyway) 2) any IDE can easily find the struct anyway
This commit is contained in:
parent
b8aa2a251e
commit
ccae1f7387
@ -1365,14 +1365,6 @@ void ListAlloc_Free(ListAlloc* this, void* data);
|
||||
void ListAlloc_FreeAll(ListAlloc* this);
|
||||
void Main_LogSystemHeap(void);
|
||||
void Main(void* arg);
|
||||
void SpeedMeter_InitImpl(SpeedMeter* this, u32 arg1, u32 y);
|
||||
void SpeedMeter_Init(SpeedMeter* this);
|
||||
void SpeedMeter_Destroy(SpeedMeter* this);
|
||||
void SpeedMeter_DrawTimeEntries(SpeedMeter* this, GraphicsContext* gfxCtx);
|
||||
void SpeedMeter_InitAllocEntry(SpeedMeterAllocEntry* this, u32 maxval, u32 val, u16 backColor, u16 foreColor, u32 ulx,
|
||||
u32 lrx, u32 uly, u32 lry);
|
||||
void SpeedMeter_DrawAllocEntry(SpeedMeterAllocEntry* this, GraphicsContext* gfxCtx);
|
||||
void SpeedMeter_DrawAllocEntries(SpeedMeter* meter, GraphicsContext* gfxCtx, GameState* state);
|
||||
void SysCfb_Init(s32 n64dd);
|
||||
void* SysCfb_GetFbPtr(s32 idx);
|
||||
void* SysCfb_GetFbEnd(void);
|
||||
|
164
include/gfx.h
Normal file
164
include/gfx.h
Normal file
@ -0,0 +1,164 @@
|
||||
#ifndef GFX_H
|
||||
#define GFX_H
|
||||
|
||||
#include "ultra64.h"
|
||||
#include "ultra64/gbi.h"
|
||||
#include "sched.h"
|
||||
#include "thga.h"
|
||||
|
||||
// Texture memory size, 4 KiB
|
||||
#define TMEM_SIZE 0x1000
|
||||
|
||||
typedef struct {
|
||||
/* 0x00000 */ u16 headMagic; // GFXPOOL_HEAD_MAGIC
|
||||
/* 0x00008 */ Gfx polyOpaBuffer[0x17E0];
|
||||
/* 0x0BF08 */ Gfx polyXluBuffer[0x800];
|
||||
/* 0x0FF08 */ Gfx overlayBuffer[0x400];
|
||||
/* 0x11F08 */ Gfx workBuffer[0x80];
|
||||
/* 0x11308 */ Gfx unusedBuffer[0x20];
|
||||
/* 0x12408 */ u16 tailMagic; // GFXPOOL_TAIL_MAGIC
|
||||
} GfxPool; // size = 0x12410
|
||||
|
||||
typedef struct GraphicsContext {
|
||||
/* 0x0000 */ Gfx* polyOpaBuffer; // Pointer to "Zelda 0"
|
||||
/* 0x0004 */ Gfx* polyXluBuffer; // Pointer to "Zelda 1"
|
||||
/* 0x0008 */ char unk_008[0x08]; // Unused, could this be pointers to "Zelda 2" / "Zelda 3"
|
||||
/* 0x0010 */ Gfx* overlayBuffer; // Pointer to "Zelda 4"
|
||||
/* 0x0014 */ u32 unk_014;
|
||||
/* 0x0018 */ char unk_018[0x20];
|
||||
/* 0x0038 */ OSMesg msgBuff[0x08];
|
||||
/* 0x0058 */ OSMesgQueue* schedMsgQueue;
|
||||
/* 0x005C */ OSMesgQueue queue;
|
||||
/* 0x0078 */ OSScTask task;
|
||||
/* 0x00E0 */ char unk_0E0[0xD0];
|
||||
/* 0x01B0 */ Gfx* workBuffer;
|
||||
/* 0x01B4 */ TwoHeadGfxArena work;
|
||||
/* 0x01C4 */ char unk_01C4[0xC0];
|
||||
/* 0x0284 */ OSViMode* viMode;
|
||||
/* 0x0288 */ char unk_0288[0x20]; // Unused, could this be Zelda 2/3 ?
|
||||
/* 0x02A8 */ TwoHeadGfxArena overlay; // "Zelda 4"
|
||||
/* 0x02B8 */ TwoHeadGfxArena polyOpa; // "Zelda 0"
|
||||
/* 0x02C8 */ TwoHeadGfxArena polyXlu; // "Zelda 1"
|
||||
/* 0x02D8 */ u32 gfxPoolIdx;
|
||||
/* 0x02DC */ u16* curFrameBuffer;
|
||||
/* 0x02E0 */ char unk_2E0[0x04];
|
||||
/* 0x02E4 */ u32 viFeatures;
|
||||
/* 0x02E8 */ s32 fbIdx;
|
||||
/* 0x02EC */ void (*callback)(struct GraphicsContext*, void*);
|
||||
/* 0x02F0 */ void* callbackParam;
|
||||
/* 0x02F4 */ f32 xScale;
|
||||
/* 0x02F8 */ f32 yScale;
|
||||
/* 0x02FC */ char unk_2FC[0x04];
|
||||
} GraphicsContext; // size = 0x300
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ SETUPDL_0,
|
||||
/* 1 */ SETUPDL_1,
|
||||
/* 2 */ SETUPDL_2,
|
||||
/* 3 */ SETUPDL_3,
|
||||
/* 4 */ SETUPDL_4,
|
||||
/* 5 */ SETUPDL_5,
|
||||
/* 6 */ SETUPDL_6,
|
||||
/* 7 */ SETUPDL_7,
|
||||
/* 8 */ SETUPDL_8,
|
||||
/* 9 */ SETUPDL_9,
|
||||
/* 10 */ SETUPDL_10,
|
||||
/* 11 */ SETUPDL_11,
|
||||
/* 12 */ SETUPDL_12,
|
||||
/* 13 */ SETUPDL_13,
|
||||
/* 14 */ SETUPDL_14,
|
||||
/* 15 */ SETUPDL_15,
|
||||
/* 16 */ SETUPDL_16,
|
||||
/* 17 */ SETUPDL_17,
|
||||
/* 18 */ SETUPDL_18,
|
||||
/* 19 */ SETUPDL_19,
|
||||
/* 20 */ SETUPDL_20,
|
||||
/* 21 */ SETUPDL_21,
|
||||
/* 22 */ SETUPDL_22,
|
||||
/* 23 */ SETUPDL_23,
|
||||
/* 24 */ SETUPDL_24,
|
||||
/* 25 */ SETUPDL_25,
|
||||
/* 26 */ SETUPDL_26,
|
||||
/* 27 */ SETUPDL_27,
|
||||
/* 28 */ SETUPDL_28,
|
||||
/* 29 */ SETUPDL_29,
|
||||
/* 30 */ SETUPDL_30,
|
||||
/* 31 */ SETUPDL_31,
|
||||
/* 32 */ SETUPDL_32,
|
||||
/* 33 */ SETUPDL_33,
|
||||
/* 34 */ SETUPDL_34,
|
||||
/* 35 */ SETUPDL_35,
|
||||
/* 36 */ SETUPDL_36,
|
||||
/* 37 */ SETUPDL_37,
|
||||
/* 38 */ SETUPDL_38,
|
||||
/* 39 */ SETUPDL_39,
|
||||
/* 40 */ SETUPDL_40,
|
||||
/* 41 */ SETUPDL_41,
|
||||
/* 42 */ SETUPDL_42,
|
||||
/* 43 */ SETUPDL_43,
|
||||
/* 44 */ SETUPDL_44,
|
||||
/* 45 */ SETUPDL_45,
|
||||
/* 46 */ SETUPDL_46,
|
||||
/* 47 */ SETUPDL_47,
|
||||
/* 48 */ SETUPDL_48,
|
||||
/* 49 */ SETUPDL_49,
|
||||
/* 50 */ SETUPDL_50,
|
||||
/* 51 */ SETUPDL_51,
|
||||
/* 52 */ SETUPDL_52,
|
||||
/* 53 */ SETUPDL_53,
|
||||
/* 54 */ SETUPDL_54,
|
||||
/* 55 */ SETUPDL_55,
|
||||
/* 56 */ SETUPDL_56,
|
||||
/* 57 */ SETUPDL_57,
|
||||
/* 58 */ SETUPDL_58,
|
||||
/* 59 */ SETUPDL_59,
|
||||
/* 60 */ SETUPDL_60,
|
||||
/* 61 */ SETUPDL_61,
|
||||
/* 62 */ SETUPDL_62,
|
||||
/* 63 */ SETUPDL_63,
|
||||
/* 64 */ SETUPDL_64,
|
||||
/* 65 */ SETUPDL_65,
|
||||
/* 66 */ SETUPDL_66,
|
||||
/* 67 */ SETUPDL_67,
|
||||
/* 68 */ SETUPDL_68,
|
||||
/* 69 */ SETUPDL_69,
|
||||
/* 70 */ SETUPDL_70,
|
||||
/* 71 */ SETUPDL_MAX
|
||||
} SetupDL;
|
||||
|
||||
#define UCODE_NULL 0
|
||||
#define UCODE_F3DZEX 1
|
||||
#define UCODE_UNK 2
|
||||
#define UCODE_S2DEX 3
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 type;
|
||||
/* 0x04 */ void* ptr;
|
||||
} UCodeInfo; // size = 0x8
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ uintptr_t segments[NUM_SEGMENTS];
|
||||
/* 0x40 */ Gfx* dlStack[18];
|
||||
/* 0x88 */ s32 dlDepth;
|
||||
/* 0x8C */ u32 dlCnt;
|
||||
/* 0x90 */ u32 vtxCnt;
|
||||
/* 0x94 */ u32 spvtxCnt;
|
||||
/* 0x98 */ u32 tri1Cnt;
|
||||
/* 0x9C */ u32 tri2Cnt;
|
||||
/* 0xA0 */ u32 quadCnt;
|
||||
/* 0xA4 */ u32 lineCnt;
|
||||
/* 0xA8 */ u32 loaducodeCnt;
|
||||
/* 0xAC */ u32 pipeSyncRequired;
|
||||
/* 0xB0 */ u32 tileSyncRequired;
|
||||
/* 0xB4 */ u32 loadSyncRequired;
|
||||
/* 0xB8 */ u32 syncErr;
|
||||
/* 0xBC */ s32 enableLog;
|
||||
/* 0xC0 */ s32 ucodeType;
|
||||
/* 0xC4 */ s32 ucodeInfoCount;
|
||||
/* 0xC8 */ UCodeInfo* ucodeInfo;
|
||||
/* 0xCC */ u32 modeH;
|
||||
/* 0xD0 */ u32 modeL;
|
||||
/* 0xD4 */ u32 geometryMode;
|
||||
} UCodeDisas; // size = 0xD8
|
||||
|
||||
#endif
|
80
include/jpeg.h
Normal file
80
include/jpeg.h
Normal file
@ -0,0 +1,80 @@
|
||||
#ifndef JPEG_H
|
||||
#define JPEG_H
|
||||
|
||||
#include "ultra64.h"
|
||||
#include "sched.h"
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u16 table[8*8];
|
||||
} JpegQuantizationTable; // size = 0x80
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 codeOffs[16];
|
||||
/* 0x10 */ u16 codesA[16];
|
||||
/* 0x30 */ u16 codesB[16];
|
||||
/* 0x50 */ u8* symbols;
|
||||
} JpegHuffmanTable; // size = 0x54
|
||||
|
||||
// this struct might be inaccurate but it's not used outside jpegutils.c anyways
|
||||
typedef struct {
|
||||
/* 0x000 */ u8 codeOffs[16];
|
||||
/* 0x010 */ u16 dcCodes[120];
|
||||
/* 0x100 */ u16 acCodes[256];
|
||||
} JpegHuffmanTableOld; // size = 0x300
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
/* 0x00 */ u32 address;
|
||||
/* 0x04 */ u32 mbCount;
|
||||
/* 0x08 */ u32 mode;
|
||||
/* 0x0C */ u32 qTableYPtr;
|
||||
/* 0x10 */ u32 qTableUPtr;
|
||||
/* 0x14 */ u32 qTableVPtr;
|
||||
/* 0x18 */ u32 mbSize; // This field is used by the microcode to save the macroblock size during a yield
|
||||
};
|
||||
long long int force_structure_alignment;
|
||||
} JpegTaskData; // size = 0x20
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ JpegTaskData taskData;
|
||||
/* 0x020 */ u64 yieldData[0x200 / sizeof(u64)];
|
||||
/* 0x220 */ JpegQuantizationTable qTableY;
|
||||
/* 0x2A0 */ JpegQuantizationTable qTableU;
|
||||
/* 0x320 */ JpegQuantizationTable qTableV;
|
||||
/* 0x3A0 */ u8 codesLengths[0x110];
|
||||
/* 0x4B0 */ u16 codes[0x108];
|
||||
/* 0x6C0 */ u16 data[4][0x180];
|
||||
} JpegWork; // size = 0x12C0
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ void* imageData;
|
||||
/* 0x04 */ u8 mode;
|
||||
/* 0x05 */ u8 unk_05;
|
||||
/* 0x08 */ JpegHuffmanTable* hTablePtrs[4];
|
||||
/* 0x18 */ u8 unk_18;
|
||||
} JpegDecoder; // size = 0x1C
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 dqtCount;
|
||||
/* 0x04 */ u8* dqtPtr[3];
|
||||
/* 0x10 */ u8 dhtCount;
|
||||
/* 0x14 */ u8* dhtPtr[4];
|
||||
/* 0x24 */ void* imageData;
|
||||
/* 0x28 */ u32 mode; // 0 if Y V0 is 1 and 2 if Y V0 is 2
|
||||
/* 0x30 */ OSScTask scTask;
|
||||
/* 0x98 */ OSMesgQueue mq;
|
||||
/* 0xB0 */ OSMesg msg;
|
||||
/* 0xB4 */ JpegWork* workBuf;
|
||||
} JpegContext; // size = 0xB8
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 byteIdx;
|
||||
/* 0x04 */ u8 bitIdx;
|
||||
/* 0x05 */ u8 dontSkip;
|
||||
/* 0x08 */ u32 curWord;
|
||||
/* 0x0C */ s16 unk_0C;
|
||||
/* 0x0E */ s16 unk_0E;
|
||||
/* 0x10 */ s16 unk_10;
|
||||
} JpegDecoderState; // size = 0x14
|
||||
|
||||
#endif
|
33
include/prerender.h
Normal file
33
include/prerender.h
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef PRERENDER_H
|
||||
#define PRERENDER_H
|
||||
|
||||
#include "ultra64/ultratypes.h"
|
||||
|
||||
typedef struct ListAlloc {
|
||||
/* 0x00 */ struct ListAlloc* prev;
|
||||
/* 0x04 */ struct ListAlloc* next;
|
||||
} ListAlloc; // size = 0x8
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ s32 width;
|
||||
/* 0x04 */ s32 height;
|
||||
/* 0x08 */ s32 widthSave;
|
||||
/* 0x0C */ s32 heightSave;
|
||||
/* 0x10 */ u16* fbuf;
|
||||
/* 0x14 */ u16* fbufSave;
|
||||
/* 0x18 */ u8* cvgSave;
|
||||
/* 0x1C */ u16* zbuf;
|
||||
/* 0x20 */ u16* zbufSave;
|
||||
/* 0x24 */ s32 ulxSave;
|
||||
/* 0x28 */ s32 ulySave;
|
||||
/* 0x2C */ s32 lrxSave;
|
||||
/* 0x30 */ s32 lrySave;
|
||||
/* 0x34 */ s32 ulx;
|
||||
/* 0x38 */ s32 uly;
|
||||
/* 0x3C */ s32 lrx;
|
||||
/* 0x40 */ s32 lry;
|
||||
/* 0x44 */ ListAlloc alloc;
|
||||
/* 0x4C */ u32 unk_4C;
|
||||
} PreRender; // size = 0x50
|
||||
|
||||
#endif
|
35
include/speedmeter.h
Normal file
35
include/speedmeter.h
Normal file
@ -0,0 +1,35 @@
|
||||
#ifndef SPEEDMETER_H
|
||||
#define SPEEDMETER_H
|
||||
|
||||
#include "ultra64/ultratypes.h"
|
||||
|
||||
struct GraphicsContext;
|
||||
struct GameState;
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ char unk_00[0x18];
|
||||
/* 0x18 */ s32 unk_18;
|
||||
/* 0x1C */ s32 y;
|
||||
} SpeedMeter; // size = 0x20
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ s32 maxval;
|
||||
/* 0x04 */ s32 val;
|
||||
/* 0x08 */ u16 backColor;
|
||||
/* 0x0A */ u16 foreColor;
|
||||
/* 0x0C */ s32 ulx;
|
||||
/* 0x10 */ s32 lrx;
|
||||
/* 0x14 */ s32 uly;
|
||||
/* 0x18 */ s32 lry;
|
||||
} SpeedMeterAllocEntry; // size = 0x1C
|
||||
|
||||
void SpeedMeter_InitImpl(SpeedMeter* this, u32 arg1, u32 y);
|
||||
void SpeedMeter_Init(SpeedMeter* this);
|
||||
void SpeedMeter_Destroy(SpeedMeter* this);
|
||||
void SpeedMeter_DrawTimeEntries(SpeedMeter* this, struct GraphicsContext* gfxCtx);
|
||||
void SpeedMeter_InitAllocEntry(SpeedMeterAllocEntry* this, u32 maxval, u32 val, u16 backColor, u16 foreColor, u32 ulx,
|
||||
u32 lrx, u32 uly, u32 lry);
|
||||
void SpeedMeter_DrawAllocEntry(SpeedMeterAllocEntry* this, struct GraphicsContext* gfxCtx);
|
||||
void SpeedMeter_DrawAllocEntries(SpeedMeter* meter, struct GraphicsContext* gfxCtx, struct GameState* state);
|
||||
|
||||
#endif
|
630
include/z64.h
630
include/z64.h
@ -27,9 +27,12 @@
|
||||
#include "z64message.h"
|
||||
#include "z64pause.h"
|
||||
#include "z64skin.h"
|
||||
#include "z64game.h"
|
||||
#include "z64transition.h"
|
||||
#include "z64transition_instances.h"
|
||||
#include "z64interface.h"
|
||||
#include "z64skybox.h"
|
||||
#include "z64sram.h"
|
||||
#include "z64view.h"
|
||||
#include "alignment.h"
|
||||
#include "seqcmd.h"
|
||||
@ -47,6 +50,10 @@
|
||||
#include "mempak.h"
|
||||
#include "tha.h"
|
||||
#include "thga.h"
|
||||
#include "speedmeter.h"
|
||||
#include "gfx.h"
|
||||
#include "jpeg.h"
|
||||
#include "prerender.h"
|
||||
|
||||
#define SCREEN_WIDTH 320
|
||||
#define SCREEN_HEIGHT 240
|
||||
@ -85,17 +92,9 @@
|
||||
#define STACK_TOP(stack) \
|
||||
((u8*)(stack) + sizeof(stack))
|
||||
|
||||
// Texture memory size, 4 KiB
|
||||
#define TMEM_SIZE 0x1000
|
||||
|
||||
// NOTE: Once we start supporting other builds, this can be changed with an ifdef
|
||||
#define REGION_NATIVE REGION_EU
|
||||
|
||||
typedef struct{
|
||||
/* 0x00 */ char unk[0x4];
|
||||
/* 0x04 */ MtxF mf;
|
||||
} HorseStruct;
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ s32 regPage; // 0: no page selected (reg editor is not active); 1: first page; `REG_PAGES`: last page
|
||||
/* 0x04 */ s32 regGroup; // Indexed from 0 to `REG_GROUPS`-1. Each group has its own character to identify it.
|
||||
@ -105,123 +104,6 @@ typedef struct {
|
||||
/* 0x14 */ s16 data[REG_GROUPS * REGS_PER_GROUP]; // Accessed through *REG macros, see regs.h
|
||||
} RegEditor; // size = 0x15D4
|
||||
|
||||
typedef struct {
|
||||
/* 0x00000 */ u16 headMagic; // GFXPOOL_HEAD_MAGIC
|
||||
/* 0x00008 */ Gfx polyOpaBuffer[0x17E0];
|
||||
/* 0x0BF08 */ Gfx polyXluBuffer[0x800];
|
||||
/* 0x0FF08 */ Gfx overlayBuffer[0x400];
|
||||
/* 0x11F08 */ Gfx workBuffer[0x80];
|
||||
/* 0x11308 */ Gfx unusedBuffer[0x20];
|
||||
/* 0x12408 */ u16 tailMagic; // GFXPOOL_TAIL_MAGIC
|
||||
} GfxPool; // size = 0x12410
|
||||
|
||||
typedef struct GraphicsContext {
|
||||
/* 0x0000 */ Gfx* polyOpaBuffer; // Pointer to "Zelda 0"
|
||||
/* 0x0004 */ Gfx* polyXluBuffer; // Pointer to "Zelda 1"
|
||||
/* 0x0008 */ char unk_008[0x08]; // Unused, could this be pointers to "Zelda 2" / "Zelda 3"
|
||||
/* 0x0010 */ Gfx* overlayBuffer; // Pointer to "Zelda 4"
|
||||
/* 0x0014 */ u32 unk_014;
|
||||
/* 0x0018 */ char unk_018[0x20];
|
||||
/* 0x0038 */ OSMesg msgBuff[0x08];
|
||||
/* 0x0058 */ OSMesgQueue* schedMsgQueue;
|
||||
/* 0x005C */ OSMesgQueue queue;
|
||||
/* 0x0078 */ OSScTask task;
|
||||
/* 0x00E0 */ char unk_0E0[0xD0];
|
||||
/* 0x01B0 */ Gfx* workBuffer;
|
||||
/* 0x01B4 */ TwoHeadGfxArena work;
|
||||
/* 0x01C4 */ char unk_01C4[0xC0];
|
||||
/* 0x0284 */ OSViMode* viMode;
|
||||
/* 0x0288 */ char unk_0288[0x20]; // Unused, could this be Zelda 2/3 ?
|
||||
/* 0x02A8 */ TwoHeadGfxArena overlay; // "Zelda 4"
|
||||
/* 0x02B8 */ TwoHeadGfxArena polyOpa; // "Zelda 0"
|
||||
/* 0x02C8 */ TwoHeadGfxArena polyXlu; // "Zelda 1"
|
||||
/* 0x02D8 */ u32 gfxPoolIdx;
|
||||
/* 0x02DC */ u16* curFrameBuffer;
|
||||
/* 0x02E0 */ char unk_2E0[0x04];
|
||||
/* 0x02E4 */ u32 viFeatures;
|
||||
/* 0x02E8 */ s32 fbIdx;
|
||||
/* 0x02EC */ void (*callback)(struct GraphicsContext*, void*);
|
||||
/* 0x02F0 */ void* callbackParam;
|
||||
/* 0x02F4 */ f32 xScale;
|
||||
/* 0x02F8 */ f32 yScale;
|
||||
/* 0x02FC */ char unk_2FC[0x04];
|
||||
} GraphicsContext; // size = 0x300
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ SETUPDL_0,
|
||||
/* 1 */ SETUPDL_1,
|
||||
/* 2 */ SETUPDL_2,
|
||||
/* 3 */ SETUPDL_3,
|
||||
/* 4 */ SETUPDL_4,
|
||||
/* 5 */ SETUPDL_5,
|
||||
/* 6 */ SETUPDL_6,
|
||||
/* 7 */ SETUPDL_7,
|
||||
/* 8 */ SETUPDL_8,
|
||||
/* 9 */ SETUPDL_9,
|
||||
/* 10 */ SETUPDL_10,
|
||||
/* 11 */ SETUPDL_11,
|
||||
/* 12 */ SETUPDL_12,
|
||||
/* 13 */ SETUPDL_13,
|
||||
/* 14 */ SETUPDL_14,
|
||||
/* 15 */ SETUPDL_15,
|
||||
/* 16 */ SETUPDL_16,
|
||||
/* 17 */ SETUPDL_17,
|
||||
/* 18 */ SETUPDL_18,
|
||||
/* 19 */ SETUPDL_19,
|
||||
/* 20 */ SETUPDL_20,
|
||||
/* 21 */ SETUPDL_21,
|
||||
/* 22 */ SETUPDL_22,
|
||||
/* 23 */ SETUPDL_23,
|
||||
/* 24 */ SETUPDL_24,
|
||||
/* 25 */ SETUPDL_25,
|
||||
/* 26 */ SETUPDL_26,
|
||||
/* 27 */ SETUPDL_27,
|
||||
/* 28 */ SETUPDL_28,
|
||||
/* 29 */ SETUPDL_29,
|
||||
/* 30 */ SETUPDL_30,
|
||||
/* 31 */ SETUPDL_31,
|
||||
/* 32 */ SETUPDL_32,
|
||||
/* 33 */ SETUPDL_33,
|
||||
/* 34 */ SETUPDL_34,
|
||||
/* 35 */ SETUPDL_35,
|
||||
/* 36 */ SETUPDL_36,
|
||||
/* 37 */ SETUPDL_37,
|
||||
/* 38 */ SETUPDL_38,
|
||||
/* 39 */ SETUPDL_39,
|
||||
/* 40 */ SETUPDL_40,
|
||||
/* 41 */ SETUPDL_41,
|
||||
/* 42 */ SETUPDL_42,
|
||||
/* 43 */ SETUPDL_43,
|
||||
/* 44 */ SETUPDL_44,
|
||||
/* 45 */ SETUPDL_45,
|
||||
/* 46 */ SETUPDL_46,
|
||||
/* 47 */ SETUPDL_47,
|
||||
/* 48 */ SETUPDL_48,
|
||||
/* 49 */ SETUPDL_49,
|
||||
/* 50 */ SETUPDL_50,
|
||||
/* 51 */ SETUPDL_51,
|
||||
/* 52 */ SETUPDL_52,
|
||||
/* 53 */ SETUPDL_53,
|
||||
/* 54 */ SETUPDL_54,
|
||||
/* 55 */ SETUPDL_55,
|
||||
/* 56 */ SETUPDL_56,
|
||||
/* 57 */ SETUPDL_57,
|
||||
/* 58 */ SETUPDL_58,
|
||||
/* 59 */ SETUPDL_59,
|
||||
/* 60 */ SETUPDL_60,
|
||||
/* 61 */ SETUPDL_61,
|
||||
/* 62 */ SETUPDL_62,
|
||||
/* 63 */ SETUPDL_63,
|
||||
/* 64 */ SETUPDL_64,
|
||||
/* 65 */ SETUPDL_65,
|
||||
/* 66 */ SETUPDL_66,
|
||||
/* 67 */ SETUPDL_67,
|
||||
/* 68 */ SETUPDL_68,
|
||||
/* 69 */ SETUPDL_69,
|
||||
/* 70 */ SETUPDL_70,
|
||||
/* 71 */ SETUPDL_MAX
|
||||
} SetupDL;
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 seqId;
|
||||
/* 0x01 */ u8 natureAmbienceId;
|
||||
@ -300,143 +182,12 @@ typedef struct {
|
||||
/* 0x013C */ void* absoluteSpace; // Space used to allocate actor overlays with alloc type ACTOROVL_ALLOC_ABSOLUTE
|
||||
} ActorContext; // size = 0x140
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ char unk_00[0x4];
|
||||
/* 0x04 */ void* script;
|
||||
/* 0x08 */ u8 state;
|
||||
/* 0x0C */ f32 timer;
|
||||
/* 0x10 */ u16 curFrame; // current frame of the script that is running
|
||||
/* 0x12 */ u16 unk_12; // set but never used
|
||||
/* 0x14 */ s32 subCamId;
|
||||
/* 0x18 */ u16 camEyeSplinePointsAppliedFrame; // stores the frame the cam eye spline points data was last applied on
|
||||
/* 0x1A */ u8 camAtReady; // cam `at` data is ready to be applied
|
||||
/* 0x1B */ u8 camEyeReady; // cam `eye` data is ready to be applied
|
||||
/* 0x1C */ CutsceneCameraPoint* camAtPoints;
|
||||
/* 0x20 */ CutsceneCameraPoint* camEyePoints;
|
||||
/* 0x24 */ CsCmdActorCue* playerCue;
|
||||
/* 0x28 */ CsCmdActorCue* actorCues[10]; // "npcdemopnt"
|
||||
} CutsceneContext; // size = 0x50
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u16 countdown;
|
||||
/* 0x04 */ Vec3f worldPos;
|
||||
/* 0x10 */ Vec3f projectedPos;
|
||||
} SfxSource; // size = 0x1C
|
||||
|
||||
typedef enum {
|
||||
/* 0x00 */ DO_ACTION_ATTACK,
|
||||
/* 0x01 */ DO_ACTION_CHECK,
|
||||
/* 0x02 */ DO_ACTION_ENTER,
|
||||
/* 0x03 */ DO_ACTION_RETURN,
|
||||
/* 0x04 */ DO_ACTION_OPEN,
|
||||
/* 0x05 */ DO_ACTION_JUMP,
|
||||
/* 0x06 */ DO_ACTION_DECIDE,
|
||||
/* 0x07 */ DO_ACTION_DIVE,
|
||||
/* 0x08 */ DO_ACTION_FASTER,
|
||||
/* 0x09 */ DO_ACTION_THROW,
|
||||
/* 0x0A */ DO_ACTION_NONE, // in do_action_static, the texture at this position is NAVI, however this value is in practice the "No Action" value
|
||||
/* 0x0B */ DO_ACTION_CLIMB,
|
||||
/* 0x0C */ DO_ACTION_DROP,
|
||||
/* 0x0D */ DO_ACTION_DOWN,
|
||||
/* 0x0E */ DO_ACTION_SAVE,
|
||||
/* 0x0F */ DO_ACTION_SPEAK,
|
||||
/* 0x10 */ DO_ACTION_NEXT,
|
||||
/* 0x11 */ DO_ACTION_GRAB,
|
||||
/* 0x12 */ DO_ACTION_STOP,
|
||||
/* 0x13 */ DO_ACTION_PUTAWAY,
|
||||
/* 0x14 */ DO_ACTION_REEL,
|
||||
/* 0x15 */ DO_ACTION_1,
|
||||
/* 0x16 */ DO_ACTION_2,
|
||||
/* 0x17 */ DO_ACTION_3,
|
||||
/* 0x18 */ DO_ACTION_4,
|
||||
/* 0x19 */ DO_ACTION_5,
|
||||
/* 0x1A */ DO_ACTION_6,
|
||||
/* 0x1B */ DO_ACTION_7,
|
||||
/* 0x1C */ DO_ACTION_8,
|
||||
/* 0x1D */ DO_ACTION_MAX
|
||||
} DoAction;
|
||||
|
||||
// TODO extract this information from the texture definitions themselves
|
||||
#define DO_ACTION_TEX_WIDTH 48
|
||||
#define DO_ACTION_TEX_HEIGHT 16
|
||||
#define DO_ACTION_TEX_SIZE ((DO_ACTION_TEX_WIDTH * DO_ACTION_TEX_HEIGHT) / 2) // (sizeof(gCheckDoActionENGTex))
|
||||
|
||||
typedef struct {
|
||||
/* 0x0000 */ View view;
|
||||
/* 0x0128 */ Vtx* actionVtx;
|
||||
/* 0x012C */ Vtx* beatingHeartVtx;
|
||||
/* 0x0130 */ u8* parameterSegment;
|
||||
/* 0x0134 */ u8* doActionSegment;
|
||||
/* 0x0138 */ u8* iconItemSegment;
|
||||
/* 0x013C */ u8* mapSegment;
|
||||
/* 0x0140 */ u8 mapPalette[32];
|
||||
/* 0x0160 */ DmaRequest dmaRequest_160;
|
||||
/* 0x0180 */ DmaRequest dmaRequest_180;
|
||||
/* 0x01A0 */ char unk_1A0[0x20];
|
||||
/* 0x01C0 */ OSMesgQueue loadQueue;
|
||||
/* 0x01D8 */ OSMesg loadMsg;
|
||||
/* 0x01DC */ Viewport viewport;
|
||||
/* 0x01EC */ s16 unk_1EC;
|
||||
/* 0x01EE */ u16 unk_1EE;
|
||||
/* 0x01F0 */ u16 unk_1F0;
|
||||
/* 0x01F4 */ f32 unk_1F4;
|
||||
/* 0x01F8 */ s16 naviCalling;
|
||||
/* 0x01FA */ s16 unk_1FA;
|
||||
/* 0x01FC */ s16 unk_1FC;
|
||||
/* 0x01FE */ s16 heartColorOscillator;
|
||||
/* 0x0200 */ s16 heartColorOscillatorDirection;
|
||||
/* 0x0202 */ s16 beatingHeartPrim[3];
|
||||
/* 0x0208 */ s16 beatingHeartEnv[3];
|
||||
/* 0x020E */ s16 heartsPrimR[2];
|
||||
/* 0x0212 */ s16 heartsPrimG[2];
|
||||
/* 0x0216 */ s16 heartsPrimB[2];
|
||||
/* 0x021A */ s16 heartsEnvR[2];
|
||||
/* 0x021E */ s16 heartsEnvG[2];
|
||||
/* 0x0222 */ s16 heartsEnvB[2];
|
||||
/* 0x0226 */ s16 unk_226; // Used only in unused functions
|
||||
/* 0x0228 */ s16 unk_228; // Used only in unused functions
|
||||
/* 0x022A */ s16 beatingHeartOscillator;
|
||||
/* 0x022C */ s16 beatingHeartOscillatorDirection;
|
||||
/* 0x022E */ s16 unk_22E;
|
||||
/* 0x0230 */ s16 lensMagicConsumptionTimer; // When lens is active, 1 unit of magic is consumed every time the timer reaches 0
|
||||
/* 0x0232 */ s16 counterDigits[4]; // used for key and rupee counters
|
||||
/* 0x023A */ u8 numHorseBoosts;
|
||||
/* 0x023C */ u16 unk_23C;
|
||||
/* 0x023E */ u16 hbaAmmo; // ammo while playing the horseback archery minigame
|
||||
/* 0x0240 */ u16 unk_240;
|
||||
/* 0x0242 */ u16 unk_242;
|
||||
/* 0x0224 */ u16 unk_244; // screen fill alpha?
|
||||
/* 0x0246 */ u16 aAlpha; // also carrots alpha
|
||||
/* 0x0248 */ u16 bAlpha; // also HBA score alpha
|
||||
/* 0x024A */ u16 cLeftAlpha;
|
||||
/* 0x024C */ u16 cDownAlpha;
|
||||
/* 0x024E */ u16 cRightAlpha;
|
||||
/* 0x0250 */ u16 healthAlpha; // also max C-Up alpha
|
||||
/* 0x0252 */ u16 magicAlpha; // also Rupee and Key counters alpha
|
||||
/* 0x0254 */ u16 minimapAlpha;
|
||||
/* 0x0256 */ s16 startAlpha;
|
||||
/* 0x0258 */ s16 unk_258;
|
||||
/* 0x025A */ s16 unk_25A;
|
||||
/* 0x025C */ s16 mapRoomNum;
|
||||
/* 0x025E */ s16 mapPaletteIndex; // "map_palete_no"
|
||||
/* 0x0260 */ u8 unk_260;
|
||||
/* 0x0261 */ u8 unk_261;
|
||||
struct {
|
||||
/* 0x0262 */ u8 hGauge; // "h_gage"; unknown?
|
||||
/* 0x0263 */ u8 bButton; // "b_button"
|
||||
/* 0x0264 */ u8 aButton; // "a_button"
|
||||
/* 0x0265 */ u8 bottles; // "c_bottle"
|
||||
/* 0x0266 */ u8 tradeItems; // "c_warasibe"
|
||||
/* 0x0267 */ u8 hookshot; // "c_hook"
|
||||
/* 0x0268 */ u8 ocarina; // "c_ocarina"
|
||||
/* 0x0269 */ u8 warpSongs; // "c_warp"
|
||||
/* 0x026A */ u8 sunsSong; // "m_sunmoon"
|
||||
/* 0x026B */ u8 farores; // "m_wind"
|
||||
/* 0x026C */ u8 dinsNayrus; // "m_magic"; din's fire and nayru's love
|
||||
/* 0x026D */ u8 all; // "another"; enables all item restrictions
|
||||
} restrictions;
|
||||
} InterfaceContext; // size = 0x270
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ void* loadedRamAddr;
|
||||
/* 0x04 */ uintptr_t vromStart;
|
||||
@ -470,24 +221,6 @@ typedef struct {
|
||||
/* 0x00 */ u16 state;
|
||||
} GameOverContext; // size = 0x2
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ s16 id;
|
||||
/* 0x04 */ void* segment;
|
||||
/* 0x08 */ DmaRequest dmaRequest;
|
||||
/* 0x28 */ OSMesgQueue loadQueue;
|
||||
/* 0x40 */ OSMesg loadMsg;
|
||||
} ObjectStatus; // size = 0x44
|
||||
|
||||
typedef struct {
|
||||
/* 0x0000 */ void* spaceStart;
|
||||
/* 0x0004 */ void* spaceEnd; // original name: "endSegment"
|
||||
/* 0x0008 */ u8 num; // number of objects in bank
|
||||
/* 0x0009 */ u8 unk_09;
|
||||
/* 0x000A */ u8 mainKeepIndex; // "gameplay_keep" index in bank
|
||||
/* 0x000B */ u8 subKeepIndex; // "gameplay_field_keep" or "gameplay_dangeon_keep" index in bank
|
||||
/* 0x000C */ ObjectStatus status[OBJECT_EXCHANGE_BANK_MAX];
|
||||
} ObjectContext; // size = 0x518
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ LENS_MODE_HIDE_ACTORS, // lens actors are visible by default, and hidden by using lens (for example, fake walls)
|
||||
/* 1 */ LENS_MODE_SHOW_ACTORS // lens actors are invisible by default, and shown by using lens (for example, invisible enemies)
|
||||
@ -549,182 +282,6 @@ typedef struct {
|
||||
/* 0x290 */ OcLine* colLine[COLLISION_CHECK_OC_LINE_MAX];
|
||||
} CollisionCheckContext; // size = 0x29C
|
||||
|
||||
typedef struct ListAlloc {
|
||||
/* 0x00 */ struct ListAlloc* prev;
|
||||
/* 0x04 */ struct ListAlloc* next;
|
||||
} ListAlloc; // size = 0x8
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ s32 width;
|
||||
/* 0x04 */ s32 height;
|
||||
/* 0x08 */ s32 widthSave;
|
||||
/* 0x0C */ s32 heightSave;
|
||||
/* 0x10 */ u16* fbuf;
|
||||
/* 0x14 */ u16* fbufSave;
|
||||
/* 0x18 */ u8* cvgSave;
|
||||
/* 0x1C */ u16* zbuf;
|
||||
/* 0x20 */ u16* zbufSave;
|
||||
/* 0x24 */ s32 ulxSave;
|
||||
/* 0x28 */ s32 ulySave;
|
||||
/* 0x2C */ s32 lrxSave;
|
||||
/* 0x30 */ s32 lrySave;
|
||||
/* 0x34 */ s32 ulx;
|
||||
/* 0x38 */ s32 uly;
|
||||
/* 0x3C */ s32 lrx;
|
||||
/* 0x40 */ s32 lry;
|
||||
/* 0x44 */ ListAlloc alloc;
|
||||
/* 0x4C */ u32 unk_4C;
|
||||
} PreRender; // size = 0x50
|
||||
|
||||
#define TRANS_TRIGGER_OFF 0 // transition is not active
|
||||
#define TRANS_TRIGGER_START 20 // start transition (exiting an area)
|
||||
#define TRANS_TRIGGER_END -20 // transition is ending (arriving in a new area)
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ TRANS_MODE_OFF,
|
||||
/* 1 */ TRANS_MODE_SETUP,
|
||||
/* 2 */ TRANS_MODE_INSTANCE_INIT,
|
||||
/* 3 */ TRANS_MODE_INSTANCE_RUNNING,
|
||||
/* 4 */ TRANS_MODE_FILL_WHITE_INIT,
|
||||
/* 5 */ TRANS_MODE_FILL_IN,
|
||||
/* 6 */ TRANS_MODE_FILL_OUT,
|
||||
/* 7 */ TRANS_MODE_FILL_BROWN_INIT,
|
||||
/* 8 */ TRANS_MODE_08, // unused
|
||||
/* 9 */ TRANS_MODE_09, // unused
|
||||
/* 10 */ TRANS_MODE_INSTANT,
|
||||
/* 11 */ TRANS_MODE_INSTANCE_WAIT,
|
||||
/* 12 */ TRANS_MODE_SANDSTORM_INIT,
|
||||
/* 13 */ TRANS_MODE_SANDSTORM,
|
||||
/* 14 */ TRANS_MODE_SANDSTORM_END_INIT,
|
||||
/* 15 */ TRANS_MODE_SANDSTORM_END,
|
||||
/* 16 */ TRANS_MODE_CS_BLACK_FILL_INIT,
|
||||
/* 17 */ TRANS_MODE_CS_BLACK_FILL
|
||||
} TransitionMode;
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ TRANS_TYPE_WIPE,
|
||||
/* 1 */ TRANS_TYPE_TRIFORCE,
|
||||
/* 2 */ TRANS_TYPE_FADE_BLACK,
|
||||
/* 3 */ TRANS_TYPE_FADE_WHITE,
|
||||
/* 4 */ TRANS_TYPE_FADE_BLACK_FAST,
|
||||
/* 5 */ TRANS_TYPE_FADE_WHITE_FAST,
|
||||
/* 6 */ TRANS_TYPE_FADE_BLACK_SLOW,
|
||||
/* 7 */ TRANS_TYPE_FADE_WHITE_SLOW,
|
||||
/* 8 */ TRANS_TYPE_WIPE_FAST,
|
||||
/* 9 */ TRANS_TYPE_FILL_WHITE2,
|
||||
/* 10 */ TRANS_TYPE_FILL_WHITE,
|
||||
/* 11 */ TRANS_TYPE_INSTANT,
|
||||
/* 12 */ TRANS_TYPE_FILL_BROWN,
|
||||
/* 13 */ TRANS_TYPE_FADE_WHITE_CS_DELAYED,
|
||||
/* 14 */ TRANS_TYPE_SANDSTORM_PERSIST,
|
||||
/* 15 */ TRANS_TYPE_SANDSTORM_END,
|
||||
/* 16 */ TRANS_TYPE_CS_BLACK_FILL,
|
||||
/* 17 */ TRANS_TYPE_FADE_WHITE_INSTANT,
|
||||
/* 18 */ TRANS_TYPE_FADE_GREEN,
|
||||
/* 19 */ TRANS_TYPE_FADE_BLUE,
|
||||
// transition types 20 - 31 are unused
|
||||
// transition types 32 - 55 are constructed using the TRANS_TYPE_CIRCLE macro
|
||||
/* 56 */ TRANS_TYPE_MAX = 56
|
||||
} TransitionType;
|
||||
|
||||
#define TRANS_NEXT_TYPE_DEFAULT 0xFF // when `nextTransitionType` is set to default, the type will be taken from the entrance table for the ending transition
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ TCA_NORMAL,
|
||||
/* 1 */ TCA_WAVE,
|
||||
/* 2 */ TCA_RIPPLE,
|
||||
/* 3 */ TCA_STARBURST
|
||||
} TransitionCircleAppearance;
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ TCC_BLACK,
|
||||
/* 1 */ TCC_WHITE,
|
||||
/* 2 */ TCC_GRAY,
|
||||
/* 3 */ TCC_SPECIAL // color varies depending on appearance. unused and appears broken
|
||||
} TransitionCircleColor;
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ TCS_FAST,
|
||||
/* 1 */ TCS_SLOW
|
||||
} TransitionCircleSpeed;
|
||||
|
||||
#define TC_SET_PARAMS (1 << 7)
|
||||
|
||||
#define TRANS_TYPE_CIRCLE(appearance, color, speed) ((1 << 5) | ((color & 3) << 3) | ((appearance & 3) << 1) | (speed & 1))
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
TransitionFade fade;
|
||||
TransitionCircle circle;
|
||||
TransitionTriforce triforce;
|
||||
TransitionWipe wipe;
|
||||
} instanceData;
|
||||
/* 0x228 */ s32 transitionType;
|
||||
/* 0x22C */ void* (*init)(void* transition);
|
||||
/* 0x230 */ void (*destroy)(void* transition);
|
||||
/* 0x234 */ void (*update)(void* transition, s32 updateRate);
|
||||
/* 0x238 */ void (*draw)(void* transition, Gfx** gfxP);
|
||||
/* 0x23C */ void (*start)(void* transition);
|
||||
/* 0x240 */ void (*setType)(void* transition, s32 type);
|
||||
/* 0x244 */ void (*setColor)(void* transition, u32 color);
|
||||
/* 0x248 */ void (*setUnkColor)(void* transition, u32 color);
|
||||
/* 0x24C */ s32 (*isDone)(void* transition);
|
||||
} TransitionContext; // size = 0x250
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8* readBuff;
|
||||
} SramContext; // size = 0x4
|
||||
|
||||
#define SRAM_SIZE 0x8000
|
||||
#define SRAM_HEADER_SIZE 0x10
|
||||
|
||||
typedef enum {
|
||||
/* 0x00 */ SRAM_HEADER_SOUND,
|
||||
/* 0x01 */ SRAM_HEADER_ZTARGET,
|
||||
/* 0x02 */ SRAM_HEADER_LANGUAGE,
|
||||
/* 0x03 */ SRAM_HEADER_MAGIC // must be the value of `sZeldaMagic` for save to be considered valid
|
||||
} SramHeaderField;
|
||||
|
||||
typedef struct GameAllocEntry {
|
||||
/* 0x00 */ struct GameAllocEntry* next;
|
||||
/* 0x04 */ struct GameAllocEntry* prev;
|
||||
/* 0x08 */ u32 size;
|
||||
/* 0x0C */ u32 unk_0C;
|
||||
} GameAllocEntry; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ GameAllocEntry base;
|
||||
/* 0x10 */ GameAllocEntry* head;
|
||||
} GameAlloc; // size = 0x14
|
||||
|
||||
// Used in Graph_GetNextGameState in graph.c
|
||||
#define DEFINE_GAMESTATE_INTERNAL(typeName, enumName) enumName,
|
||||
#define DEFINE_GAMESTATE(typeName, enumName, name) DEFINE_GAMESTATE_INTERNAL(typeName, enumName)
|
||||
typedef enum {
|
||||
#include "tables/gamestate_table.h"
|
||||
GAMESTATE_ID_MAX
|
||||
} GameStateId;
|
||||
#undef DEFINE_GAMESTATE
|
||||
#undef DEFINE_GAMESTATE_INTERNAL
|
||||
|
||||
struct GameState;
|
||||
|
||||
typedef void (*GameStateFunc)(struct GameState* gameState);
|
||||
|
||||
typedef struct GameState {
|
||||
/* 0x00 */ GraphicsContext* gfxCtx;
|
||||
/* 0x04 */ GameStateFunc main;
|
||||
/* 0x08 */ GameStateFunc destroy; // "cleanup"
|
||||
/* 0x0C */ GameStateFunc init;
|
||||
/* 0x10 */ u32 size;
|
||||
/* 0x14 */ Input input[MAXCONTROLLERS];
|
||||
/* 0x74 */ TwoHeadArena tha;
|
||||
/* 0x84 */ GameAlloc alloc;
|
||||
/* 0x98 */ u32 running;
|
||||
/* 0x9C */ u32 frames;
|
||||
/* 0xA0 */ u32 inPreNMIState;
|
||||
} GameState; // size = 0xA4
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ GameState state;
|
||||
} SetupState; // size = 0xA4
|
||||
@ -1212,114 +769,6 @@ typedef struct {
|
||||
/* 0x10 */ OSTime resetTime;
|
||||
} PreNmiBuff; // size = 0x18 (actually osAppNMIBuffer is 0x40 bytes large but the rest is unused)
|
||||
|
||||
#define UCODE_NULL 0
|
||||
#define UCODE_F3DZEX 1
|
||||
#define UCODE_UNK 2
|
||||
#define UCODE_S2DEX 3
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 type;
|
||||
/* 0x04 */ void* ptr;
|
||||
} UCodeInfo; // size = 0x8
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ uintptr_t segments[NUM_SEGMENTS];
|
||||
/* 0x40 */ Gfx* dlStack[18];
|
||||
/* 0x88 */ s32 dlDepth;
|
||||
/* 0x8C */ u32 dlCnt;
|
||||
/* 0x90 */ u32 vtxCnt;
|
||||
/* 0x94 */ u32 spvtxCnt;
|
||||
/* 0x98 */ u32 tri1Cnt;
|
||||
/* 0x9C */ u32 tri2Cnt;
|
||||
/* 0xA0 */ u32 quadCnt;
|
||||
/* 0xA4 */ u32 lineCnt;
|
||||
/* 0xA8 */ u32 loaducodeCnt;
|
||||
/* 0xAC */ u32 pipeSyncRequired;
|
||||
/* 0xB0 */ u32 tileSyncRequired;
|
||||
/* 0xB4 */ u32 loadSyncRequired;
|
||||
/* 0xB8 */ u32 syncErr;
|
||||
/* 0xBC */ s32 enableLog;
|
||||
/* 0xC0 */ s32 ucodeType;
|
||||
/* 0xC4 */ s32 ucodeInfoCount;
|
||||
/* 0xC8 */ UCodeInfo* ucodeInfo;
|
||||
/* 0xCC */ u32 modeH;
|
||||
/* 0xD0 */ u32 modeL;
|
||||
/* 0xD4 */ u32 geometryMode;
|
||||
} UCodeDisas; // size = 0xD8
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u16 table[8*8];
|
||||
} JpegQuantizationTable; // size = 0x80
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 codeOffs[16];
|
||||
/* 0x10 */ u16 codesA[16];
|
||||
/* 0x30 */ u16 codesB[16];
|
||||
/* 0x50 */ u8* symbols;
|
||||
} JpegHuffmanTable; // size = 0x54
|
||||
|
||||
// this struct might be inaccurate but it's not used outside jpegutils.c anyways
|
||||
typedef struct {
|
||||
/* 0x000 */ u8 codeOffs[16];
|
||||
/* 0x010 */ u16 dcCodes[120];
|
||||
/* 0x100 */ u16 acCodes[256];
|
||||
} JpegHuffmanTableOld; // size = 0x300
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
/* 0x00 */ u32 address;
|
||||
/* 0x04 */ u32 mbCount;
|
||||
/* 0x08 */ u32 mode;
|
||||
/* 0x0C */ u32 qTableYPtr;
|
||||
/* 0x10 */ u32 qTableUPtr;
|
||||
/* 0x14 */ u32 qTableVPtr;
|
||||
/* 0x18 */ u32 mbSize; // This field is used by the microcode to save the macroblock size during a yield
|
||||
};
|
||||
long long int force_structure_alignment;
|
||||
} JpegTaskData; // size = 0x20
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ JpegTaskData taskData;
|
||||
/* 0x020 */ u64 yieldData[0x200 / sizeof(u64)];
|
||||
/* 0x220 */ JpegQuantizationTable qTableY;
|
||||
/* 0x2A0 */ JpegQuantizationTable qTableU;
|
||||
/* 0x320 */ JpegQuantizationTable qTableV;
|
||||
/* 0x3A0 */ u8 codesLengths[0x110];
|
||||
/* 0x4B0 */ u16 codes[0x108];
|
||||
/* 0x6C0 */ u16 data[4][0x180];
|
||||
} JpegWork; // size = 0x12C0
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ void* imageData;
|
||||
/* 0x04 */ u8 mode;
|
||||
/* 0x05 */ u8 unk_05;
|
||||
/* 0x08 */ JpegHuffmanTable* hTablePtrs[4];
|
||||
/* 0x18 */ u8 unk_18;
|
||||
} JpegDecoder; // size = 0x1C
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 dqtCount;
|
||||
/* 0x04 */ u8* dqtPtr[3];
|
||||
/* 0x10 */ u8 dhtCount;
|
||||
/* 0x14 */ u8* dhtPtr[4];
|
||||
/* 0x24 */ void* imageData;
|
||||
/* 0x28 */ u32 mode; // 0 if Y V0 is 1 and 2 if Y V0 is 2
|
||||
/* 0x30 */ OSScTask scTask;
|
||||
/* 0x98 */ OSMesgQueue mq;
|
||||
/* 0xB0 */ OSMesg msg;
|
||||
/* 0xB4 */ JpegWork* workBuf;
|
||||
} JpegContext; // size = 0xB8
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 byteIdx;
|
||||
/* 0x04 */ u8 bitIdx;
|
||||
/* 0x05 */ u8 dontSkip;
|
||||
/* 0x08 */ u32 curWord;
|
||||
/* 0x0C */ s16 unk_0C;
|
||||
/* 0x0E */ s16 unk_0E;
|
||||
/* 0x10 */ s16 unk_10;
|
||||
} JpegDecoderState; // size = 0x14
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ VI_MODE_EDIT_STATE_INACTIVE,
|
||||
/* 1 */ VI_MODE_EDIT_STATE_ACTIVE,
|
||||
@ -1370,69 +819,4 @@ typedef struct {
|
||||
/* 0x08 */ Color_RGBA8_u32 envColor;
|
||||
} struct_80166500; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ char unk_00[0x18];
|
||||
/* 0x18 */ s32 unk_18;
|
||||
/* 0x1C */ s32 y;
|
||||
} SpeedMeter; // size = 0x20
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ s32 maxval;
|
||||
/* 0x04 */ s32 val;
|
||||
/* 0x08 */ u16 backColor;
|
||||
/* 0x0A */ u16 foreColor;
|
||||
/* 0x0C */ s32 ulx;
|
||||
/* 0x10 */ s32 lrx;
|
||||
/* 0x14 */ s32 uly;
|
||||
/* 0x18 */ s32 lry;
|
||||
} SpeedMeterAllocEntry; // size = 0x1C
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ volatile OSTime* time;
|
||||
/* 0x04 */ u8 x;
|
||||
/* 0x05 */ u8 y;
|
||||
/* 0x06 */ u16 color;
|
||||
} SpeedMeterTimeEntry; // size = 0x08
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 value;
|
||||
/* 0x04 */ const char* name;
|
||||
} F3dzexConst; // size = 0x8
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 value;
|
||||
/* 0x04 */ const char* setName;
|
||||
/* 0x08 */ const char* unsetName;
|
||||
} F3dzexFlag; // size = 0x0C
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ const char* name;
|
||||
/* 0x04 */ u32 value;
|
||||
/* 0x08 */ u32 mask;
|
||||
} F3dzexRenderMode; // size = 0x0C
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ const char* name;
|
||||
/* 0x04 */ u32 value;
|
||||
} F3dzexSetModeMacroValue; // size = 0x8
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ const char* name;
|
||||
/* 0x04 */ u32 shift;
|
||||
/* 0x08 */ u32 len;
|
||||
/* 0x0C */ F3dzexSetModeMacroValue values[4];
|
||||
} F3dzexSetModeMacro; // size = 0x2C
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u16* value;
|
||||
/* 0x04 */ const char* name;
|
||||
} FlagSetEntry; // size = 0x08
|
||||
|
||||
#define ROM_FILE(name) \
|
||||
{ (uintptr_t)_##name##SegmentRomStart, (uintptr_t)_##name##SegmentRomEnd }
|
||||
#define ROM_FILE_EMPTY(name) \
|
||||
{ (uintptr_t)_##name##SegmentRomStart, (uintptr_t)_##name##SegmentRomStart }
|
||||
#define ROM_FILE_UNSET \
|
||||
{ 0 }
|
||||
|
||||
#endif
|
||||
|
@ -6,7 +6,6 @@
|
||||
#define COLLISION_CHECK_OC_MAX 50
|
||||
#define COLLISION_CHECK_OC_LINE_MAX 3
|
||||
|
||||
// From z64.h
|
||||
struct Actor;
|
||||
|
||||
typedef struct {
|
||||
|
@ -513,4 +513,21 @@ typedef struct {
|
||||
/* 0x8 */ s16 relativeToPlayer;
|
||||
} CutsceneCameraMove; // size = 0xC
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ char unk_00[0x4];
|
||||
/* 0x04 */ void* script;
|
||||
/* 0x08 */ u8 state;
|
||||
/* 0x0C */ f32 timer;
|
||||
/* 0x10 */ u16 curFrame; // current frame of the script that is running
|
||||
/* 0x12 */ u16 unk_12; // set but never used
|
||||
/* 0x14 */ s32 subCamId;
|
||||
/* 0x18 */ u16 camEyeSplinePointsAppliedFrame; // stores the frame the cam eye spline points data was last applied on
|
||||
/* 0x1A */ u8 camAtReady; // cam `at` data is ready to be applied
|
||||
/* 0x1B */ u8 camEyeReady; // cam `eye` data is ready to be applied
|
||||
/* 0x1C */ CutsceneCameraPoint* camAtPoints;
|
||||
/* 0x20 */ CutsceneCameraPoint* camEyePoints;
|
||||
/* 0x24 */ CsCmdActorCue* playerCue;
|
||||
/* 0x28 */ CsCmdActorCue* actorCues[10]; // "npcdemopnt"
|
||||
} CutsceneContext; // size = 0x50
|
||||
|
||||
#endif
|
||||
|
@ -22,6 +22,18 @@ typedef struct {
|
||||
/* 0x0C */ uintptr_t romEnd;
|
||||
} DmaEntry;
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ uintptr_t vromStart;
|
||||
/* 0x04 */ uintptr_t vromEnd;
|
||||
} RomFile; // size = 0x8
|
||||
|
||||
#define ROM_FILE(name) \
|
||||
{ (uintptr_t)_##name##SegmentRomStart, (uintptr_t)_##name##SegmentRomEnd }
|
||||
#define ROM_FILE_EMPTY(name) \
|
||||
{ (uintptr_t)_##name##SegmentRomStart, (uintptr_t)_##name##SegmentRomStart }
|
||||
#define ROM_FILE_UNSET \
|
||||
{ 0 }
|
||||
|
||||
extern DmaEntry gDmaDataTable[];
|
||||
|
||||
extern u32 gDmaMgrVerbose;
|
||||
|
51
include/z64game.h
Normal file
51
include/z64game.h
Normal file
@ -0,0 +1,51 @@
|
||||
#ifndef Z64GAME_H
|
||||
#define Z64GAME_H
|
||||
// This file is named "game" after game.c for now, this may change later with the system name
|
||||
|
||||
#include "ultra64/ultratypes.h"
|
||||
#include "padmgr.h"
|
||||
#include "tha.h"
|
||||
|
||||
struct GraphicsContext;
|
||||
|
||||
typedef struct GameAllocEntry {
|
||||
/* 0x00 */ struct GameAllocEntry* next;
|
||||
/* 0x04 */ struct GameAllocEntry* prev;
|
||||
/* 0x08 */ u32 size;
|
||||
/* 0x0C */ u32 unk_0C;
|
||||
} GameAllocEntry; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ GameAllocEntry base;
|
||||
/* 0x10 */ GameAllocEntry* head;
|
||||
} GameAlloc; // size = 0x14
|
||||
|
||||
// Used in Graph_GetNextGameState in graph.c
|
||||
#define DEFINE_GAMESTATE_INTERNAL(typeName, enumName) enumName,
|
||||
#define DEFINE_GAMESTATE(typeName, enumName, name) DEFINE_GAMESTATE_INTERNAL(typeName, enumName)
|
||||
typedef enum {
|
||||
#include "tables/gamestate_table.h"
|
||||
GAMESTATE_ID_MAX
|
||||
} GameStateId;
|
||||
#undef DEFINE_GAMESTATE
|
||||
#undef DEFINE_GAMESTATE_INTERNAL
|
||||
|
||||
struct GameState;
|
||||
|
||||
typedef void (*GameStateFunc)(struct GameState* gameState);
|
||||
|
||||
typedef struct GameState {
|
||||
/* 0x00 */ struct GraphicsContext* gfxCtx;
|
||||
/* 0x04 */ GameStateFunc main;
|
||||
/* 0x08 */ GameStateFunc destroy; // "cleanup"
|
||||
/* 0x0C */ GameStateFunc init;
|
||||
/* 0x10 */ u32 size;
|
||||
/* 0x14 */ Input input[MAXCONTROLLERS];
|
||||
/* 0x74 */ TwoHeadArena tha;
|
||||
/* 0x84 */ GameAlloc alloc;
|
||||
/* 0x98 */ u32 running;
|
||||
/* 0x9C */ u32 frames;
|
||||
/* 0xA0 */ u32 inPreNMIState;
|
||||
} GameState; // size = 0xA4
|
||||
|
||||
#endif
|
@ -29,6 +29,120 @@ extern u8 _icon_item_24_staticSegmentRomStart[];
|
||||
#define GET_QUEST_ICON_VROM(itemId) \
|
||||
((uintptr_t)_icon_item_24_staticSegmentRomStart + (((itemId)-ITEM_MEDALLION_FOREST) * QUEST_ICON_SIZE))
|
||||
|
||||
typedef enum {
|
||||
/* 0x00 */ DO_ACTION_ATTACK,
|
||||
/* 0x01 */ DO_ACTION_CHECK,
|
||||
/* 0x02 */ DO_ACTION_ENTER,
|
||||
/* 0x03 */ DO_ACTION_RETURN,
|
||||
/* 0x04 */ DO_ACTION_OPEN,
|
||||
/* 0x05 */ DO_ACTION_JUMP,
|
||||
/* 0x06 */ DO_ACTION_DECIDE,
|
||||
/* 0x07 */ DO_ACTION_DIVE,
|
||||
/* 0x08 */ DO_ACTION_FASTER,
|
||||
/* 0x09 */ DO_ACTION_THROW,
|
||||
/* 0x0A */ DO_ACTION_NONE, // in do_action_static, the texture at this position is NAVI, however this value is in practice the "No Action" value
|
||||
/* 0x0B */ DO_ACTION_CLIMB,
|
||||
/* 0x0C */ DO_ACTION_DROP,
|
||||
/* 0x0D */ DO_ACTION_DOWN,
|
||||
/* 0x0E */ DO_ACTION_SAVE,
|
||||
/* 0x0F */ DO_ACTION_SPEAK,
|
||||
/* 0x10 */ DO_ACTION_NEXT,
|
||||
/* 0x11 */ DO_ACTION_GRAB,
|
||||
/* 0x12 */ DO_ACTION_STOP,
|
||||
/* 0x13 */ DO_ACTION_PUTAWAY,
|
||||
/* 0x14 */ DO_ACTION_REEL,
|
||||
/* 0x15 */ DO_ACTION_1,
|
||||
/* 0x16 */ DO_ACTION_2,
|
||||
/* 0x17 */ DO_ACTION_3,
|
||||
/* 0x18 */ DO_ACTION_4,
|
||||
/* 0x19 */ DO_ACTION_5,
|
||||
/* 0x1A */ DO_ACTION_6,
|
||||
/* 0x1B */ DO_ACTION_7,
|
||||
/* 0x1C */ DO_ACTION_8,
|
||||
/* 0x1D */ DO_ACTION_MAX
|
||||
} DoAction;
|
||||
|
||||
// TODO extract this information from the texture definitions themselves
|
||||
#define DO_ACTION_TEX_WIDTH 48
|
||||
#define DO_ACTION_TEX_HEIGHT 16
|
||||
#define DO_ACTION_TEX_SIZE ((DO_ACTION_TEX_WIDTH * DO_ACTION_TEX_HEIGHT) / 2) // (sizeof(gCheckDoActionENGTex))
|
||||
|
||||
typedef struct {
|
||||
/* 0x0000 */ View view;
|
||||
/* 0x0128 */ Vtx* actionVtx;
|
||||
/* 0x012C */ Vtx* beatingHeartVtx;
|
||||
/* 0x0130 */ u8* parameterSegment;
|
||||
/* 0x0134 */ u8* doActionSegment;
|
||||
/* 0x0138 */ u8* iconItemSegment;
|
||||
/* 0x013C */ u8* mapSegment;
|
||||
/* 0x0140 */ u8 mapPalette[32];
|
||||
/* 0x0160 */ DmaRequest dmaRequest_160;
|
||||
/* 0x0180 */ DmaRequest dmaRequest_180;
|
||||
/* 0x01A0 */ char unk_1A0[0x20];
|
||||
/* 0x01C0 */ OSMesgQueue loadQueue;
|
||||
/* 0x01D8 */ OSMesg loadMsg;
|
||||
/* 0x01DC */ Viewport viewport;
|
||||
/* 0x01EC */ s16 unk_1EC;
|
||||
/* 0x01EE */ u16 unk_1EE;
|
||||
/* 0x01F0 */ u16 unk_1F0;
|
||||
/* 0x01F4 */ f32 unk_1F4;
|
||||
/* 0x01F8 */ s16 naviCalling;
|
||||
/* 0x01FA */ s16 unk_1FA;
|
||||
/* 0x01FC */ s16 unk_1FC;
|
||||
/* 0x01FE */ s16 heartColorOscillator;
|
||||
/* 0x0200 */ s16 heartColorOscillatorDirection;
|
||||
/* 0x0202 */ s16 beatingHeartPrim[3];
|
||||
/* 0x0208 */ s16 beatingHeartEnv[3];
|
||||
/* 0x020E */ s16 heartsPrimR[2];
|
||||
/* 0x0212 */ s16 heartsPrimG[2];
|
||||
/* 0x0216 */ s16 heartsPrimB[2];
|
||||
/* 0x021A */ s16 heartsEnvR[2];
|
||||
/* 0x021E */ s16 heartsEnvG[2];
|
||||
/* 0x0222 */ s16 heartsEnvB[2];
|
||||
/* 0x0226 */ s16 unk_226; // Used only in unused functions
|
||||
/* 0x0228 */ s16 unk_228; // Used only in unused functions
|
||||
/* 0x022A */ s16 beatingHeartOscillator;
|
||||
/* 0x022C */ s16 beatingHeartOscillatorDirection;
|
||||
/* 0x022E */ s16 unk_22E;
|
||||
/* 0x0230 */ s16 lensMagicConsumptionTimer; // When lens is active, 1 unit of magic is consumed every time the timer reaches 0
|
||||
/* 0x0232 */ s16 counterDigits[4]; // used for key and rupee counters
|
||||
/* 0x023A */ u8 numHorseBoosts;
|
||||
/* 0x023C */ u16 unk_23C;
|
||||
/* 0x023E */ u16 hbaAmmo; // ammo while playing the horseback archery minigame
|
||||
/* 0x0240 */ u16 unk_240;
|
||||
/* 0x0242 */ u16 unk_242;
|
||||
/* 0x0224 */ u16 unk_244; // screen fill alpha?
|
||||
/* 0x0246 */ u16 aAlpha; // also carrots alpha
|
||||
/* 0x0248 */ u16 bAlpha; // also HBA score alpha
|
||||
/* 0x024A */ u16 cLeftAlpha;
|
||||
/* 0x024C */ u16 cDownAlpha;
|
||||
/* 0x024E */ u16 cRightAlpha;
|
||||
/* 0x0250 */ u16 healthAlpha; // also max C-Up alpha
|
||||
/* 0x0252 */ u16 magicAlpha; // also Rupee and Key counters alpha
|
||||
/* 0x0254 */ u16 minimapAlpha;
|
||||
/* 0x0256 */ s16 startAlpha;
|
||||
/* 0x0258 */ s16 unk_258;
|
||||
/* 0x025A */ s16 unk_25A;
|
||||
/* 0x025C */ s16 mapRoomNum;
|
||||
/* 0x025E */ s16 mapPaletteIndex; // "map_palete_no"
|
||||
/* 0x0260 */ u8 unk_260;
|
||||
/* 0x0261 */ u8 unk_261;
|
||||
struct {
|
||||
/* 0x0262 */ u8 hGauge; // "h_gage"; unknown?
|
||||
/* 0x0263 */ u8 bButton; // "b_button"
|
||||
/* 0x0264 */ u8 aButton; // "a_button"
|
||||
/* 0x0265 */ u8 bottles; // "c_bottle"
|
||||
/* 0x0266 */ u8 tradeItems; // "c_warasibe"
|
||||
/* 0x0267 */ u8 hookshot; // "c_hook"
|
||||
/* 0x0268 */ u8 ocarina; // "c_ocarina"
|
||||
/* 0x0269 */ u8 warpSongs; // "c_warp"
|
||||
/* 0x026A */ u8 sunsSong; // "m_sunmoon"
|
||||
/* 0x026B */ u8 farores; // "m_wind"
|
||||
/* 0x026C */ u8 dinsNayrus; // "m_magic"; din's fire and nayru's love
|
||||
/* 0x026D */ u8 all; // "another"; enables all item restrictions
|
||||
} restrictions;
|
||||
} InterfaceContext; // size = 0x270
|
||||
|
||||
/**
|
||||
* Button HUD Positions (Upper Left)
|
||||
*/
|
||||
|
@ -1,8 +1,29 @@
|
||||
#ifndef Z64OBJECT_H
|
||||
#define Z64OBJECT_H
|
||||
|
||||
#include "ultra64.h"
|
||||
#include "z64dma.h"
|
||||
|
||||
#define OBJECT_EXCHANGE_BANK_MAX 19
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ s16 id;
|
||||
/* 0x04 */ void* segment;
|
||||
/* 0x08 */ DmaRequest dmaRequest;
|
||||
/* 0x28 */ OSMesgQueue loadQueue;
|
||||
/* 0x40 */ OSMesg loadMsg;
|
||||
} ObjectStatus; // size = 0x44
|
||||
|
||||
typedef struct {
|
||||
/* 0x0000 */ void* spaceStart;
|
||||
/* 0x0004 */ void* spaceEnd; // original name: "endSegment"
|
||||
/* 0x0008 */ u8 num; // number of objects in bank
|
||||
/* 0x0009 */ u8 unk_09;
|
||||
/* 0x000A */ u8 mainKeepIndex; // "gameplay_keep" index in bank
|
||||
/* 0x000B */ u8 subKeepIndex; // "gameplay_field_keep" or "gameplay_dangeon_keep" index in bank
|
||||
/* 0x000C */ ObjectStatus status[OBJECT_EXCHANGE_BANK_MAX];
|
||||
} ObjectContext; // size = 0x518
|
||||
|
||||
#define DEFINE_OBJECT(_0, enum) enum,
|
||||
#define DEFINE_OBJECT_NULL(_0, enum) enum,
|
||||
#define DEFINE_OBJECT_UNSET(enum) enum,
|
||||
|
@ -2,14 +2,10 @@
|
||||
#define Z64SCENE_H
|
||||
|
||||
#include "z64.h"
|
||||
#include "z64dma.h" // for RomFile
|
||||
|
||||
#include "command_macros_base.h"
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ uintptr_t vromStart;
|
||||
/* 0x04 */ uintptr_t vromEnd;
|
||||
} RomFile; // size = 0x8
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ RomFile sceneFile;
|
||||
/* 0x08 */ RomFile titleFile;
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "ultra64/gbi.h"
|
||||
|
||||
#include "z64math.h"
|
||||
#include "z64scene.h" // for RomFile
|
||||
#include "z64dma.h" // for RomFile
|
||||
|
||||
struct GameState;
|
||||
struct GraphicsContext;
|
||||
|
20
include/z64sram.h
Normal file
20
include/z64sram.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef Z64SRAM_H
|
||||
#define Z64SRAM_H
|
||||
|
||||
#include "ultra64/ultratypes.h"
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8* readBuff;
|
||||
} SramContext; // size = 0x4
|
||||
|
||||
#define SRAM_SIZE 0x8000
|
||||
#define SRAM_HEADER_SIZE 0x10
|
||||
|
||||
typedef enum {
|
||||
/* 0x00 */ SRAM_HEADER_SOUND,
|
||||
/* 0x01 */ SRAM_HEADER_ZTARGET,
|
||||
/* 0x02 */ SRAM_HEADER_LANGUAGE,
|
||||
/* 0x03 */ SRAM_HEADER_MAGIC // must be the value of `sZeldaMagic` for save to be considered valid
|
||||
} SramHeaderField;
|
||||
|
||||
#endif
|
@ -1,85 +1,84 @@
|
||||
#ifndef Z64TRANSITION_H
|
||||
#define Z64TRANSITION_H
|
||||
|
||||
#include "ultra64.h"
|
||||
#include "color.h"
|
||||
#include "ultra64/ultratypes.h"
|
||||
#include "ultra64/gbi.h" // for Gfx
|
||||
#include "z64transition_instances.h"
|
||||
|
||||
typedef struct {
|
||||
/* 0x0 */ f32 x;
|
||||
/* 0x4 */ f32 y;
|
||||
} TransitionTileVtxData; // size = 0x8
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ s32 cols;
|
||||
/* 0x04 */ s32 rows;
|
||||
/* 0x08 */ s32 frame;
|
||||
/* 0x0C */ TransitionTileVtxData* vtxData;
|
||||
/* 0x10 */ Vtx* vtxFrame1;
|
||||
/* 0x14 */ Vtx* vtxFrame2;
|
||||
/* 0x18 */ Mtx projection;
|
||||
/* 0x58 */ Mtx modelView;
|
||||
/* 0x98 */ Mtx unk_98;
|
||||
/* 0xD8 */ Gfx* gfx; // "gfxtbl"
|
||||
/* 0xDC */ u16* zBuffer;
|
||||
} TransitionTile; // size = 0xE0
|
||||
#define TRANS_TRIGGER_OFF 0 // transition is not active
|
||||
#define TRANS_TRIGGER_START 20 // start transition (exiting an area)
|
||||
#define TRANS_TRIGGER_END -20 // transition is ending (arriving in a new area)
|
||||
|
||||
typedef enum {
|
||||
/* 1 */ TRANS_INSTANCE_TYPE_FILL_OUT = 1,
|
||||
/* 2 */ TRANS_INSTANCE_TYPE_FILL_IN
|
||||
} TransitionInstanceType;
|
||||
/* 0 */ TRANS_MODE_OFF,
|
||||
/* 1 */ TRANS_MODE_SETUP,
|
||||
/* 2 */ TRANS_MODE_INSTANCE_INIT,
|
||||
/* 3 */ TRANS_MODE_INSTANCE_RUNNING,
|
||||
/* 4 */ TRANS_MODE_FILL_WHITE_INIT,
|
||||
/* 5 */ TRANS_MODE_FILL_IN,
|
||||
/* 6 */ TRANS_MODE_FILL_OUT,
|
||||
/* 7 */ TRANS_MODE_FILL_BROWN_INIT,
|
||||
/* 8 */ TRANS_MODE_08, // unused
|
||||
/* 9 */ TRANS_MODE_09, // unused
|
||||
/* 10 */ TRANS_MODE_INSTANT,
|
||||
/* 11 */ TRANS_MODE_INSTANCE_WAIT,
|
||||
/* 12 */ TRANS_MODE_SANDSTORM_INIT,
|
||||
/* 13 */ TRANS_MODE_SANDSTORM,
|
||||
/* 14 */ TRANS_MODE_SANDSTORM_END_INIT,
|
||||
/* 15 */ TRANS_MODE_SANDSTORM_END,
|
||||
/* 16 */ TRANS_MODE_CS_BLACK_FILL_INIT,
|
||||
/* 17 */ TRANS_MODE_CS_BLACK_FILL
|
||||
} TransitionMode;
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ TRANS_TYPE_WIPE,
|
||||
/* 1 */ TRANS_TYPE_TRIFORCE,
|
||||
/* 2 */ TRANS_TYPE_FADE_BLACK,
|
||||
/* 3 */ TRANS_TYPE_FADE_WHITE,
|
||||
/* 4 */ TRANS_TYPE_FADE_BLACK_FAST,
|
||||
/* 5 */ TRANS_TYPE_FADE_WHITE_FAST,
|
||||
/* 6 */ TRANS_TYPE_FADE_BLACK_SLOW,
|
||||
/* 7 */ TRANS_TYPE_FADE_WHITE_SLOW,
|
||||
/* 8 */ TRANS_TYPE_WIPE_FAST,
|
||||
/* 9 */ TRANS_TYPE_FILL_WHITE2,
|
||||
/* 10 */ TRANS_TYPE_FILL_WHITE,
|
||||
/* 11 */ TRANS_TYPE_INSTANT,
|
||||
/* 12 */ TRANS_TYPE_FILL_BROWN,
|
||||
/* 13 */ TRANS_TYPE_FADE_WHITE_CS_DELAYED,
|
||||
/* 14 */ TRANS_TYPE_SANDSTORM_PERSIST,
|
||||
/* 15 */ TRANS_TYPE_SANDSTORM_END,
|
||||
/* 16 */ TRANS_TYPE_CS_BLACK_FILL,
|
||||
/* 17 */ TRANS_TYPE_FADE_WHITE_INSTANT,
|
||||
/* 18 */ TRANS_TYPE_FADE_GREEN,
|
||||
/* 19 */ TRANS_TYPE_FADE_BLUE,
|
||||
// transition types 20 - 31 are unused
|
||||
// transition types 32 - 55 are constructed using the TRANS_TYPE_CIRCLE macro
|
||||
/* 56 */ TRANS_TYPE_MAX = 56
|
||||
} TransitionType;
|
||||
|
||||
#define TRANS_NEXT_TYPE_DEFAULT 0xFF // when `nextTransitionType` is set to default, the type will be taken from the entrance table for the ending transition
|
||||
|
||||
#define TC_SET_PARAMS (1 << 7)
|
||||
|
||||
#define TRANS_TYPE_CIRCLE(appearance, color, speed) ((1 << 5) | ((color & 3) << 3) | ((appearance & 3) << 1) | (speed & 1))
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ Color_RGBA8_u32 color;
|
||||
/* 0x004 */ Color_RGBA8_u32 unkColor;
|
||||
/* 0x008 */ u8 direction;
|
||||
/* 0x009 */ u8 frame;
|
||||
/* 0x00A */ u8 isDone;
|
||||
/* 0x00C */ u16 texX;
|
||||
/* 0x00E */ u16 texY;
|
||||
/* 0x010 */ u16 normal;
|
||||
/* 0x018 */ Mtx projection;
|
||||
/* 0x058 */ Mtx lookAt;
|
||||
/* 0x098 */ Mtx modelView[2][3];
|
||||
} TransitionWipe; // size = 0x218
|
||||
|
||||
#define TRANS_INSTANCE_TYPE_FADE_FLASH 3
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ u8 type;
|
||||
/* 0x001 */ u8 isDone;
|
||||
/* 0x002 */ u8 direction;
|
||||
/* 0x004 */ Color_RGBA8_u32 color;
|
||||
/* 0x008 */ u16 timer;
|
||||
} TransitionFade; // size = 0xC
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ Color_RGBA8_u32 color;
|
||||
/* 0x004 */ Color_RGBA8_u32 unkColor;
|
||||
/* 0x008 */ s32 texX;
|
||||
/* 0x00C */ s32 texY;
|
||||
/* 0x010 */ s32 speed;
|
||||
/* 0x014 */ u8 direction;
|
||||
/* 0x015 */ u8 colorType;
|
||||
/* 0x016 */ u8 speedType;
|
||||
/* 0x017 */ u8 appearanceType;
|
||||
/* 0x018 */ u8 isDone;
|
||||
/* 0x019 */ u8 frame;
|
||||
/* 0x01A */ u16 normal;
|
||||
/* 0x020 */ Mtx projection;
|
||||
/* 0x060 */ Mtx lookAt;
|
||||
/* 0x0A0 */ void* texture;
|
||||
/* 0x0A8 */ Mtx modelView[2][3];
|
||||
} TransitionCircle; // size = 0x228;
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ Color_RGBA8_u32 color;
|
||||
/* 0x004 */ f32 transPos;
|
||||
/* 0x008 */ f32 step;
|
||||
/* 0x00C */ s32 state;
|
||||
/* 0x010 */ s32 type;
|
||||
/* 0x018 */ Mtx projection;
|
||||
/* 0x058 */ s32 frame;
|
||||
/* 0x060 */ Mtx modelView[2][3];
|
||||
} TransitionTriforce; // size = 0x1E0;
|
||||
union {
|
||||
TransitionFade fade;
|
||||
TransitionCircle circle;
|
||||
TransitionTriforce triforce;
|
||||
TransitionWipe wipe;
|
||||
} instanceData;
|
||||
/* 0x228 */ s32 transitionType;
|
||||
/* 0x22C */ void* (*init)(void* transition);
|
||||
/* 0x230 */ void (*destroy)(void* transition);
|
||||
/* 0x234 */ void (*update)(void* transition, s32 updateRate);
|
||||
/* 0x238 */ void (*draw)(void* transition, Gfx** gfxP);
|
||||
/* 0x23C */ void (*start)(void* transition);
|
||||
/* 0x240 */ void (*setType)(void* transition, s32 type);
|
||||
/* 0x244 */ void (*setColor)(void* transition, u32 color);
|
||||
/* 0x248 */ void (*setUnkColor)(void* transition, u32 color);
|
||||
/* 0x24C */ s32 (*isDone)(void* transition);
|
||||
} TransitionContext; // size = 0x250
|
||||
|
||||
#endif
|
||||
|
104
include/z64transition_instances.h
Normal file
104
include/z64transition_instances.h
Normal file
@ -0,0 +1,104 @@
|
||||
#ifndef Z64TRANSITION_INSTANCES_H
|
||||
#define Z64TRANSITION_INSTANCES_H
|
||||
|
||||
#include "ultra64.h"
|
||||
#include "color.h"
|
||||
|
||||
typedef struct {
|
||||
/* 0x0 */ f32 x;
|
||||
/* 0x4 */ f32 y;
|
||||
} TransitionTileVtxData; // size = 0x8
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ s32 cols;
|
||||
/* 0x04 */ s32 rows;
|
||||
/* 0x08 */ s32 frame;
|
||||
/* 0x0C */ TransitionTileVtxData* vtxData;
|
||||
/* 0x10 */ Vtx* vtxFrame1;
|
||||
/* 0x14 */ Vtx* vtxFrame2;
|
||||
/* 0x18 */ Mtx projection;
|
||||
/* 0x58 */ Mtx modelView;
|
||||
/* 0x98 */ Mtx unk_98;
|
||||
/* 0xD8 */ Gfx* gfx; // "gfxtbl"
|
||||
/* 0xDC */ u16* zBuffer;
|
||||
} TransitionTile; // size = 0xE0
|
||||
|
||||
typedef enum {
|
||||
/* 1 */ TRANS_INSTANCE_TYPE_FILL_OUT = 1,
|
||||
/* 2 */ TRANS_INSTANCE_TYPE_FILL_IN
|
||||
} TransitionInstanceType;
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ Color_RGBA8_u32 color;
|
||||
/* 0x004 */ Color_RGBA8_u32 unkColor;
|
||||
/* 0x008 */ u8 direction;
|
||||
/* 0x009 */ u8 frame;
|
||||
/* 0x00A */ u8 isDone;
|
||||
/* 0x00C */ u16 texX;
|
||||
/* 0x00E */ u16 texY;
|
||||
/* 0x010 */ u16 normal;
|
||||
/* 0x018 */ Mtx projection;
|
||||
/* 0x058 */ Mtx lookAt;
|
||||
/* 0x098 */ Mtx modelView[2][3];
|
||||
} TransitionWipe; // size = 0x218
|
||||
|
||||
#define TRANS_INSTANCE_TYPE_FADE_FLASH 3
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ u8 type;
|
||||
/* 0x001 */ u8 isDone;
|
||||
/* 0x002 */ u8 direction;
|
||||
/* 0x004 */ Color_RGBA8_u32 color;
|
||||
/* 0x008 */ u16 timer;
|
||||
} TransitionFade; // size = 0xC
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ TCA_NORMAL,
|
||||
/* 1 */ TCA_WAVE,
|
||||
/* 2 */ TCA_RIPPLE,
|
||||
/* 3 */ TCA_STARBURST
|
||||
} TransitionCircleAppearance;
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ TCC_BLACK,
|
||||
/* 1 */ TCC_WHITE,
|
||||
/* 2 */ TCC_GRAY,
|
||||
/* 3 */ TCC_SPECIAL // color varies depending on appearance. unused and appears broken
|
||||
} TransitionCircleColor;
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ TCS_FAST,
|
||||
/* 1 */ TCS_SLOW
|
||||
} TransitionCircleSpeed;
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ Color_RGBA8_u32 color;
|
||||
/* 0x004 */ Color_RGBA8_u32 unkColor;
|
||||
/* 0x008 */ s32 texX;
|
||||
/* 0x00C */ s32 texY;
|
||||
/* 0x010 */ s32 speed;
|
||||
/* 0x014 */ u8 direction;
|
||||
/* 0x015 */ u8 colorType;
|
||||
/* 0x016 */ u8 speedType;
|
||||
/* 0x017 */ u8 appearanceType;
|
||||
/* 0x018 */ u8 isDone;
|
||||
/* 0x019 */ u8 frame;
|
||||
/* 0x01A */ u16 normal;
|
||||
/* 0x020 */ Mtx projection;
|
||||
/* 0x060 */ Mtx lookAt;
|
||||
/* 0x0A0 */ void* texture;
|
||||
/* 0x0A8 */ Mtx modelView[2][3];
|
||||
} TransitionCircle; // size = 0x228;
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ Color_RGBA8_u32 color;
|
||||
/* 0x004 */ f32 transPos;
|
||||
/* 0x008 */ f32 step;
|
||||
/* 0x00C */ s32 state;
|
||||
/* 0x010 */ s32 type;
|
||||
/* 0x018 */ Mtx projection;
|
||||
/* 0x058 */ s32 frame;
|
||||
/* 0x060 */ Mtx modelView[2][3];
|
||||
} TransitionTriforce; // size = 0x1E0;
|
||||
|
||||
#endif
|
@ -1,5 +1,10 @@
|
||||
#include "global.h"
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u16* value;
|
||||
/* 0x04 */ const char* name;
|
||||
} FlagSetEntry; // size = 0x08
|
||||
|
||||
void FlagSet_Update(PlayState* play) {
|
||||
static s32 entryIdx = 0;
|
||||
static u32 curBit = 0;
|
||||
|
@ -56,6 +56,13 @@ volatile OSTime D_8016A578;
|
||||
// Accumulator for `gRDPTimeTotal`
|
||||
volatile OSTime gRDPTimeAcc;
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ volatile OSTime* time;
|
||||
/* 0x04 */ u8 x;
|
||||
/* 0x05 */ u8 y;
|
||||
/* 0x06 */ u16 color;
|
||||
} SpeedMeterTimeEntry; // size = 0x08
|
||||
|
||||
SpeedMeterTimeEntry* sSpeedMeterTimeEntryPtr;
|
||||
|
||||
SpeedMeterTimeEntry sSpeedMeterTimeEntryArray[] = {
|
||||
|
@ -1,5 +1,34 @@
|
||||
#include "global.h"
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 value;
|
||||
/* 0x04 */ const char* name;
|
||||
} F3dzexConst; // size = 0x8
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 value;
|
||||
/* 0x04 */ const char* setName;
|
||||
/* 0x08 */ const char* unsetName;
|
||||
} F3dzexFlag; // size = 0x0C
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ const char* name;
|
||||
/* 0x04 */ u32 value;
|
||||
/* 0x08 */ u32 mask;
|
||||
} F3dzexRenderMode; // size = 0x0C
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ const char* name;
|
||||
/* 0x04 */ u32 value;
|
||||
} F3dzexSetModeMacroValue; // size = 0x8
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ const char* name;
|
||||
/* 0x04 */ u32 shift;
|
||||
/* 0x08 */ u32 len;
|
||||
/* 0x0C */ F3dzexSetModeMacroValue values[4];
|
||||
} F3dzexSetModeMacro; // size = 0x2C
|
||||
|
||||
typedef void (*UcodeDisasCallback)(UCodeDisas*, u32);
|
||||
|
||||
#define F3DZEX_CONST(name) \
|
||||
|
Loading…
Reference in New Issue
Block a user