fox_6B3B0 and a bunch of names for things (#50)

* stuff

* three whole files

* format

* format and such

* a switch in time

* merge prep

* nintendo switch

* format

* the great switch statement of our time

* 43AC0 matched

* stuff

* Enums everywhere

* oh god the switch

* knakyo

* new headers

* format

* fox

* everyone hates recursion

* format

* one more thing

* one more one more thing

* renames
This commit is contained in:
petrie911
2023-12-14 11:41:43 -03:00
committed by GitHub
parent 2b051a0828
commit 89ae8dff96
46 changed files with 9738 additions and 4714 deletions
+145 -176
View File
File diff suppressed because it is too large Load Diff
+148 -137
View File
@@ -7,12 +7,20 @@
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
#define FILL_COLOR(rgba) (((rgba) << 0x10) | (rgba))
#define RGBA16_RED(color16) (((color16) >> 0xB) & 0x1F)
#define RGBA16_GRN(color16) (((color16) >> 6) & 0x1F)
#define RGBA16_BLU(color16) (((color16) >> 1) & 0x1F)
// unclear what the right macro for this is
// #define RGBA16_PACK(r, g, b, a) (((u16) ((r) * 0x800) & 0xF800) | ((u16) ((g) * 0x40) & 0x7C0) | ((u16) ((b) * 2) & 0x3E) | ((a) & 1))
// used for convenience while decopming. You should find/replace them with the full macros before PRing
#define GDL(dl) gSPDisplayList(gMasterDisp++, dl) // 06000000 dl
#define GPC(r, g, b, a) gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, r, g, b, a) // FA000000 RRGGBBAA
#define GEC(r, g, b, a) gDPSetEnvColor(gMasterDisp++, r, g, b, a) // FB000000 RRGGBBAA
#define GSGM_BACK(mode) gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK) // B7000000 00002000, most common geometry mode changed
#define GCGM_BACK(mode) gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK) // B6000000 00002000
#define gSPSetOtherModeHi(pkt, settings) gSPSetOtherMode(pkt, G_SETOTHERMODE_H, G_MDSFT_BLENDMASK, 24, settings)
#define gsSPSetOtherModeHi(settings) gsSPSetOtherMode(G_SETOTHERMODE_H, G_MDSFT_BLENDMASK, 24, settings)
@@ -20,6 +28,146 @@
#define VTX_T(x,y,z,s,t,cr,cg,cb,a) { { x, y, z }, 0, { s, t }, { cr, cg, cb, a } }
typedef union {
u16 data[SCREEN_HEIGHT * SCREEN_WIDTH];
u16 array[SCREEN_HEIGHT][SCREEN_WIDTH];
} FrameBuffer; // size = 0x25800
typedef s32 (*OverrideLimbDraw)(s32, Gfx**, Vec3f*, Vec3f*, void*);
typedef void (*PostLimbDraw)(s32, Vec3f*, void*);
typedef struct {
/* 0x0 */ u16 xLen;
/* 0x2 */ u16 x;
/* 0x4 */ u16 yLen;
/* 0x6 */ u16 y;
/* 0x8 */ u16 zLen;
/* 0xA */ u16 z;
} JointKey; // size = 0xC
typedef struct {
/* 0x00 */ s16 frameCount;
/* 0x02 */ s16 limbCount;
/* 0x04 */ u16* frameData;
/* 0x08 */ JointKey* jointKey;
} AnimationHeader; // size = 0xC
typedef struct Limb {
/* 0x000 */ Gfx* dList;
/* 0x004 */ Vec3f trans;
/* 0x010 */ Vec3s rot;
/* 0x018 */ struct Limb* sibling;
/* 0x01C */ struct Limb* child;
} Limb; // size = 0x20
typedef Limb* SkelAnime;
typedef struct {
/* 0x00 */ AnimationHeader* unk_0;
/* 0x04 */ AnimationHeader* unk_4;
/* 0x08 */ SkelAnime* skelanime;
} Animation; // size = 0x0C
void Lights_SetOneLight(Gfx** dList, s32 dirX, s32 dirY, s32 dirZ, s32 colR, s32 colG, s32 colB, s32 ambR, s32 ambG, s32 ambB);
void Lights_SetTwoLights(Gfx** dList, s32 dir1x, s32 dir1y, s32 dir1z, s32 dir2x, s32 dir2y, s32 dir2z, s32 col1r, s32 col1g,
s32 col1b, s32 col2r, s32 col2g, s32 col2b, s32 ambR, s32 ambG, s32 ambB);
char* Graphics_ClearPrintBuffer(char *buf, s32 fill, s32 len);
s32 Graphics_Printf(const char *fmt, ...);
void Texture_Scroll(void *texture, s32 width, s32 height, u8 mode);
void Texture_Mottle(void *dst, void *src, u8 mode);
s32 Animation_GetLimbIndex(Limb* limb, Limb** skeleton);
void Animation_DrawLimb(s32 mode, Limb * limb, Limb* *skeleton, Vec3f* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, void* data);
void Animation_DrawSkeleton(s32 mode, Limb** skeletonSegment, Vec3f* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, void* data, Matrix* transform);
s16 Animation_GetFrameData(AnimationHeader *animationSegmemt, s32 frame, Vec3f *frameTable);
s16 Animation_GetFrameCount(AnimationHeader *animationSegment);
void Animation_FindBoundingBox(Gfx* dList, s32 len, Vec3f *min, Vec3f *max, s32 *vtxFound, s32 *vtxCount, Vtx* *vtxList);
void Animation_GetDListBoundingBox(Gfx *dList, s32 len, Vec3f *min, Vec3f *max);
void Animation_GetSkeletonBoundingBox(Limb **skeletonSegment, AnimationHeader *animationSegment, s32 frame, Vec3f *min, Vec3f* max);
void TextureRect_4bCI(Gfx **gfxPtr, void* texture, void* palette, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_4bCI_Flip(Gfx **gfxPtr, void* texture, void* palette, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_4bCI_MirX(Gfx **gfxPtr, void* texture, void* palette, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_4bCI_MirY(Gfx **gfxPtr, void* texture, void* palette, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_8bCI(Gfx **gfxPtr, void* texture, void* palette, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_16bRGBA(Gfx **gfxPtr, void* texture, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_16bRGBA_MirX(Gfx **gfxPtr, void* texture, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_8bIA(Gfx **gfxPtr, void* texture, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_8bIA_FilpMirX(Gfx **gfxPtr, void* texture, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_8bIA_FilpMirY(Gfx **gfxPtr, void* texture, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_8bIA_MirX(Gfx **gfxPtr, void* texture, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_8bIA_MirY(Gfx **gfxPtr, void* texture, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_16bIA(Gfx **gfxPtr, void* texture, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_16bIA_MirX(Gfx **gfxPtr, void* texture, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_16bIA_MirY(Gfx **gfxPtr, void* texture, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_16bIA_MirXY(Gfx **gfxPtr, void* texture, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_32bRGBA(Gfx **gfxPtr, void* texture, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void Graphics_FillRectangle(Gfx **gfxPtr, s32 ulx, s32 uly, s32 lrx, s32 lry, u8 r, u8 g, u8 b, u8 a);
u16* func_8009F7B4(Gfx **gfxPtr, u8 width, u8 height);
void Graphics_DisplayHUDNumber(s32 xPos, s32 yPos, s32 number);
void Graphics_DisplaySmallNumber(s32 xPos, s32 yPos, s32 number);
void Graphics_DisplayLargeText(s32 xPos, s32 yPos, f32 xScale, f32 yScale, char *text);
s32 Graphics_GetLargeTextWidth(char *text);
void Graphics_DisplayLargeNumber(s32 xPos, s32 yPos, s32 number);
void Graphics_DisplaySmallText(s32 xPos, s32 yPos, f32 xScale, f32 yScale, char *text);
s32 Graphics_GetSmallTextWidth(char *text);
void func_800A1540(s32 arg0, s32 arg1, s32 arg2, s32 arg3);
void func_800A1558(f32 weight, u16 size, void *src1, void *src2, void *dst);
void RCP_SetupDL(Gfx** gfxP, s16 i);
void RCP_SetFog(Gfx** gfxP, s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_0(void);
void RCP_SetupDL_1(void);
void RCP_SetupDL_11(void);
void RCP_SetupDL_12(void);
void RCP_SetupDL_2(void);
void RCP_SetupDL_3(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_4(void);
void RCP_SetupDL_7(void);
void RCP_SetupDL_9(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_8(void);
void RCP_SetupDL_13(void);
void RCP_SetupDL_14(void);
void RCP_SetupDL_17(void);
void RCP_SetupDL_36(void);
void RCP_SetupDL_52(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_62(void);
void RCP_SetupDL_37(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_18(void);
void RCP_SetupDL_20(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_19(void);
void RCP_SetupDL_21(void);
void RCP_SetupDL_33(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_34(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_40(void);
void RCP_SetupDL_42(void);
void RCP_SetupDL_43(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_60(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_47(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_66(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_55(void);
void RCP_SetupDL_57(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_45(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_46(void);
void RCP_SetupDL_41(void);
void RCP_SetupDL_64(void);
void RCP_SetupDL_64_2(void);
void RCP_SetupDL_23(void);
void RCP_SetupDL_29(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_30(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_27(void);
void RCP_SetupDL_32(void);
void RCP_SetupDL_73(void);
void RCP_SetupDL_76(void);
void RCP_SetupDL_74(void);
void RCP_SetupDL_78(void);
void RCP_SetupDL_81(void);
void RCP_SetupDL_48(void);
void RCP_SetupDL_68(void);
void RCP_SetupDL_49(void);
void RCP_SetupDL_44(void);
void RCP_SetupDL_50(void);
void RCP_SetupDL_61(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
typedef enum SetupDL {
/* 0x00 */ SETUPDL_0,
/* 0x01 */ SETUPDL_1,
@@ -114,141 +262,4 @@ typedef enum SetupDL {
extern Gfx gSetupDLs[SETUPDL_MAX][9]; // 0x800D31B0
typedef s32 (*OverrideLimbDraw)(s32, Gfx**, Vec3f*, Vec3f*, void*);
typedef void (*PostLimbDraw)(s32, Vec3f*, void*);
typedef struct {
/* 0x0 */ u16 xLen;
/* 0x2 */ u16 x;
/* 0x4 */ u16 yLen;
/* 0x6 */ u16 y;
/* 0x8 */ u16 zLen;
/* 0xA */ u16 z;
} JointKey; // size = 0xC
typedef struct {
/* 0x00 */ s16 frameCount;
/* 0x02 */ s16 limbCount;
/* 0x04 */ u16* frameData;
/* 0x08 */ JointKey* jointKey;
} AnimationHeader; // size = 0xC
typedef struct Limb {
/* 0x000 */ Gfx* dList;
/* 0x004 */ Vec3f trans;
/* 0x010 */ Vec3s rot;
/* 0x018 */ struct Limb* sibling;
/* 0x01C */ struct Limb* child;
} Limb; // size = 0x20
typedef Limb* SkelAnime;
typedef struct {
/* 0x00 */ AnimationHeader* unk_0;
/* 0x04 */ AnimationHeader* unk_4;
/* 0x08 */ SkelAnime* skelanime;
} Animation; // size = 0x0C
char* Graphics_ClearPrintBuffer(char *buf, s32 fill, s32 len);
s32 Graphics_Printf(const char *fmt, ...);
void Texture_Scroll(void *texture, s32 width, s32 height, u8 mode);
void Texture_Mottle(void *dst, void *src, u8 mode);
s32 Animation_GetLimbIndex(Limb* limb, Limb** skeleton);
void Animation_DrawLimb(s32 mode, Limb * limb, Limb* *skeleton, Vec3f* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, void* data);
void Animation_DrawSkeleton(s32 mode, Limb** skeletonSegment, Vec3f* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, void* data, Matrix* transform);
s16 Animation_GetFrameData(AnimationHeader *animationSegmemt, s32 frame, Vec3f *frameTable);
s16 Animation_GetFrameCount(AnimationHeader *animationSegment);
void Animation_FindBoundingBox(Gfx* dList, s32 len, Vec3f *min, Vec3f *max, s32 *vtxFound, s32 *vtxCount, Vtx* *vtxList);
void Animation_GetDListBoundingBox(Gfx *dList, s32 len, Vec3f *min, Vec3f *max);
void Animation_GetSkeletonBoundingBox(Limb **skeletonSegment, AnimationHeader *animationSegment, s32 frame, Vec3f *min, Vec3f* max);
f32 Math_SmoothStepToF(f32 *value, f32 target, f32 scale, f32 maxStep, f32 minStep);
f32 Math_SmoothStepToAngle(f32 *angle, f32 target, f32 scale, f32 maxStep, f32 minStep);
void Math_SmoothStepToVec3fArray(Vec3f *src, Vec3f *dst, s32 mode, s32 count, f32 scale, f32 maxStep, f32 minStep);
s32 Math_PursueVec3f(Vec3f *pos, Vec3f *target, Vec3f *rot, f32 stepSize, f32 scaleTurn, f32 maxTurn, f32 dist);
void TextureRect_4bCI(Gfx **gfxPtr, void* texture, void* palette, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_4bCI_Flip(Gfx **gfxPtr, void* texture, void* palette, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_4bCI_MirX(Gfx **gfxPtr, void* texture, void* palette, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_4bCI_MirY(Gfx **gfxPtr, void* texture, void* palette, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_8bCI(Gfx **gfxPtr, void* texture, void* palette, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_16bRGBA(Gfx **gfxPtr, void* texture, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_16bRGBA_MirX(Gfx **gfxPtr, void* texture, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_8bIA(Gfx **gfxPtr, void* texture, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_8bIA_FilpMirX(Gfx **gfxPtr, void* texture, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_8bIA_FilpMirY(Gfx **gfxPtr, void* texture, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_8bIA_MirX(Gfx **gfxPtr, void* texture, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_8bIA_MirY(Gfx **gfxPtr, void* texture, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_16bIA(Gfx **gfxPtr, void* texture, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_16bIA_MirX(Gfx **gfxPtr, void* texture, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_16bIA_MirY(Gfx **gfxPtr, void* texture, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_16bIA_MirXY(Gfx **gfxPtr, void* texture, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void TextureRect_32bRGBA(Gfx **gfxPtr, void* texture, u32 width, u32 height, f32 xPos, f32 yPos, f32 xScale, f32 yScale);
void Graphics_FillRectangle(Gfx **gfxPtr, s32 ulx, s32 uly, s32 lrx, s32 lry, u8 r, u8 g, u8 b, u8 a);
void Math_Vec3fFromAngles(Vec3f *step, f32 xRot, f32 yRot, f32 stepsize);
f32 Math_RadToDeg(f32 rAngle);
u16* func_8009F7B4(Gfx **gfxPtr, u8 width, u8 height);
void Graphics_DisplayHUDNumber(s32 xPos, s32 yPos, s32 number);
void Graphics_DisplaySmallNumber(s32 xPos, s32 yPos, s32 number);
void Graphics_DisplayLargeText(s32 xPos, s32 yPos, f32 xScale, f32 yScale, char *text);
s32 Graphics_GetLargeTextWidth(char *text);
void Graphics_DisplayLargeNumber(s32 xPos, s32 yPos, s32 number);
void Graphics_DisplaySmallText(s32 xPos, s32 yPos, f32 xScale, f32 yScale, char *text);
s32 Graphics_GetSmallTextWidth(char *text);
void func_800A1540(s32 arg0, s32 arg1, s32 arg2, s32 arg3);
void func_800A1558(f32 weight, u16 size, void *src1, void *src2, void *dst);
void RCP_SetupDL(Gfx** gfxP, s16 i);
void RCP_SetFog(Gfx** gfxP, s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_0(void);
void RCP_SetupDL_1(void);
void RCP_SetupDL_11(void);
void RCP_SetupDL_12(void);
void RCP_SetupDL_2(void);
void RCP_SetupDL_3(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_4(void);
void RCP_SetupDL_7(void);
void RCP_SetupDL_9(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_8(void);
void RCP_SetupDL_13(void);
void RCP_SetupDL_14(void);
void RCP_SetupDL_17(void);
void RCP_SetupDL_36(void);
void RCP_SetupDL_52(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_62(void);
void RCP_SetupDL_37(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_18(void);
void RCP_SetupDL_20(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_19(void);
void RCP_SetupDL_21(void);
void RCP_SetupDL_33(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_34(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_40(void);
void RCP_SetupDL_42(void);
void RCP_SetupDL_43(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_60(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_47(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_66(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_55(void);
void RCP_SetupDL_57(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_45(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_46(void);
void RCP_SetupDL_41(void);
void RCP_SetupDL_64(void);
void RCP_SetupDL_64_2(void);
void RCP_SetupDL_23(void);
void RCP_SetupDL_29(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_30(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
void RCP_SetupDL_27(void);
void RCP_SetupDL_32(void);
void RCP_SetupDL_73(void);
void RCP_SetupDL_76(void);
void RCP_SetupDL_74(void);
void RCP_SetupDL_78(void);
void RCP_SetupDL_81(void);
void RCP_SetupDL_48(void);
void RCP_SetupDL_68(void);
void RCP_SetupDL_49(void);
void RCP_SetupDL_44(void);
void RCP_SetupDL_50(void);
void RCP_SetupDL_61(s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
#endif
+3 -35
View File
@@ -17,41 +17,9 @@
#include "macros.h"
#include "sf64math.h"
#include "sf64mesg.h"
#include "sf64object.h"
#include "sf64level.h"
#include "sf64thread.h"
#include "gfx.h"
typedef enum {
SI_READ_CONTROLLER = 10,
SI_READ_SAVE,
SI_WRITE_SAVE,
SI_RUMBLE,
SI_SAVE_FAILED,
SI_SAVE_SUCCESS,
SI_CONT_READ_DONE,
} SerialMesg;
#define MSG_QUEUE_EMPTY -1
#define FAULT_MESG_BREAK 1
#define FAULT_MESG_FAULT 2
#define TASK_MESG_1 1
#define TASK_MESG_2 2
#define EVENT_MESG_SP 1
#define EVENT_MESG_DP 2
#define EVENT_MESG_VI 3
#define EVENT_MESG_PRENMI 4
typedef enum {
THREAD_ID_SYSTEM,
THREAD_ID_IDLE,
THREAD_ID_FAULT,
THREAD_ID_MAIN,
THREAD_ID_4,
THREAD_ID_AUDIO,
THREAD_ID_GRAPHICS,
THREAD_ID_7,
THREAD_ID_SERIAL,
} ThreadID;
#endif // GLOBAL_H
+2 -2
View File
@@ -64,7 +64,7 @@ extern s32 D_80161718;
extern s32 D_8016171C;
extern s32 D_801617E8[];
extern s32 D_801617FC;
extern s32 D_80161A98;
extern s32 gHitCount;
extern s32 D_80177838;
extern s32 D_80177854;
extern s32 D_80177880;
@@ -75,7 +75,7 @@ extern s32 D_80177B48;
extern s32 D_80177B50[];
extern s32 D_80177B70[];
extern s32 D_80177E7C;
extern s32 D_80178234;
extern s32 gCurrentLevel;
extern s32 D_80178750;
#endif
+27 -27
View File
@@ -92,33 +92,33 @@ typedef struct {
extern DmaEntry gDmaTable[]; // 178A70
extern OverlayInit sLogoOverlay[1]; // sets segment 15 with no overlay
extern OverlayInit sCreditsOverlay_6[6]; // overlay EF0260
extern OverlayInit sEBFBE0_Overlay1[1]; // EBFBE0
extern OverlayInit sEBFBE0_Overlay2[1]; // EBFBE0
extern OverlayInit sEBFBE0_Overlay3[1]; // EBFBE0
extern OverlayInit sEBFBE0_Overlay4[1]; // EBFBE0
extern OverlayInit sDF4260_Overlay1[1]; // DF4260
extern OverlayInit sE08400_Overlay1_2[2]; // E08400
extern OverlayInit sE6A810_Overlay1_6[6]; // E6A810
extern OverlayInit sE08400_Overlay2_2[2]; // E08400
extern OverlayInit sE51970_Overlay1[1]; // E51970
extern OverlayInit sE16C50_Overlay1[1]; // E16C50
extern OverlayInit sE16C50_Overlay2[1]; // E16C50
extern OverlayInit sE51970_Overlay2_2[2]; // E51970
extern OverlayInit sE16C50_Overlay3[1]; // E16C50
extern OverlayInit sE9F1D0_Overlay1[1]; // E9F1D0
extern OverlayInit sE16C50_Overlay4[1]; // E16C50
extern OverlayInit sE16C50_Overlay5[1]; // E16C50
extern OverlayInit sDF4260_Overlay2[1]; // DF4260
extern OverlayInit sE9F1D0_Overlay2[1]; // E9F1D0
extern OverlayInit sE9F1D0_Overlay3_2[2]; // E9F1D0
extern OverlayInit sE08400_Overlay3[1]; // E08400
extern OverlayInit sE51970_Overlay3[1]; // E51970
extern OverlayInit sE51970_Overlay4[1]; // E51970
extern OverlayInit sE6A810_Overlay2_2[2]; // E6A810
extern OverlayInit sDF4260_Overlay3[1]; // DF4260
extern OverlayInit sE08400_Overlay4_2[2]; // E08400
extern OverlayInit sNoOvl_Logo[1]; // sets segment 15 with no overlay
extern OverlayInit sOvlEF0260_Credits[6]; // overlay EF0260
extern OverlayInit sOvlEBFBE0_Title[1]; // EBFBE0
extern OverlayInit sOvlEBFBE0_Menu[1]; // EBFBE0
extern OverlayInit sOvlEBFBE0_Map[1]; // EBFBE0
extern OverlayInit sOvlEBFBE0_State5[1]; // EBFBE0
extern OverlayInit sOvlDF4260_Corneria[1]; // DF4260
extern OverlayInit sOvlE08400_Meteo[2]; // E08400
extern OverlayInit sOvlE6A810_Titania[6]; // E6A810
extern OverlayInit sOvlE08400_SectorX[2]; // E08400
extern OverlayInit sOvlE51970_SectorZ[1]; // E51970
extern OverlayInit sOvlE16C50_Aquas[1]; // E16C50
extern OverlayInit sOvlE16C50_Area6[1]; // E16C50
extern OverlayInit sOvlE51970_Fortuna[2]; // E51970
extern OverlayInit sOvlE16C50_Unk4[1]; // E16C50
extern OverlayInit sOvlE9F1D0_SectorY[1]; // E9F1D0
extern OverlayInit sOvlE16C50_Solar[1]; // E16C50
extern OverlayInit sOvlE16C50_Zoness[1]; // E16C50
extern OverlayInit sOvlDF4260_Venom1[1]; // DF4260
extern OverlayInit sOvlE9F1D0_Venom2[1]; // E9F1D0
extern OverlayInit sOvlE9F1D0_VenomSW[2]; // E9F1D0
extern OverlayInit sOvlE08400_Setup20[1]; // E08400
extern OverlayInit sOvlE51970_Bolse[1]; // E51970
extern OverlayInit sOvlE51970_Katina[1]; // E51970
extern OverlayInit sOvlE6A810_Macbeth[2]; // E6A810
extern OverlayInit sOvlDF4260_Training[1]; // DF4260
extern OverlayInit sOvlE08400_Versus[2]; // E08400
extern OverlayInit sEFFA40_Overlay[1]; // EFFA40
DECLARE_SEGMENT(makerom);
+86
View File
@@ -0,0 +1,86 @@
#ifndef SF64_LEVEL
#define SF64_LEVEL
#include "structs.h"
typedef enum {
LEVELTYPE_GROUND,
LEVELTYPE_SPACE,
LEVELTYPE_UNK2,
LEVELTYPE_UNK3,
} LevelType;
typedef struct {
/* 0x00 */ s32 type;
/* 0x04 */ s32 unk_04;
/* 0x08 */ u16 bgColor;
/* 0x0A */ u16 unk_0A;
/* 0x0C */ s32 fogR;
/* 0x10 */ s32 fogG;
/* 0x14 */ s32 fogB;
/* 0x18 */ s32 fogN;
/* 0x1C */ s32 fogF;
/* 0x20 */ Vec3f unk_20;
/* 0x2C */ s32 lightR;
/* 0x30 */ s32 lightG;
/* 0x34 */ s32 lightB;
/* 0x38 */ s32 ambR;
/* 0x3C */ s32 ambG;
/* 0x40 */ s32 ambB;
} EnvSettings; // size = 0x44?
typedef enum {
OVL_SETUP_TITLE,
OVL_SETUP_MENU,
OVL_SETUP_MAP,
OVL_SETUP_STATE_5,
OVL_SETUP_CREDITS,
OVL_SETUP_CORNERIA,
OVL_SETUP_METEO,
OVL_SETUP_TITANIA,
OVL_SETUP_SECTOR_X,
OVL_SETUP_AQUAS,
OVL_SETUP_AREA_6,
OVL_SETUP_FORTUNA,
OVL_SETUP_UNK_4,
OVL_SETUP_SECTOR_Y,
OVL_SETUP_SOLAR,
OVL_SETUP_ZONESS,
OVL_SETUP_VENOM_2,
OVL_SETUP_TRAINING,
OVL_SETUP_VENOM_1,
OVL_SETUP_KATINA,
OVL_SETUP_20,
OVL_SETUP_MACBETH,
OVL_SETUP_BOLSE,
OVL_SETUP_SECTOR_Z,
OVL_SETUP_VENOM_SW,
OVL_SETUP_VERSUS = 50,
OVL_SETUP_LOGO = 99,
} OverlaySetups;
typedef enum {
LEVEL_CORNERIA,
LEVEL_METEO,
LEVEL_SECTOR_X,
LEVEL_AREA_6,
LEVEL_UNK_4,
LEVEL_SECTOR_Y,
LEVEL_VENOM_1,
LEVEL_SOLAR,
LEVEL_ZONESS,
LEVEL_VENOM_2,
LEVEL_TRAINING,
LEVEL_MACBETH,
LEVEL_TITANIA,
LEVEL_AQUAS,
LEVEL_FORTUNA,
LEVEL_UNK_15,
LEVEL_KATINA,
LEVEL_BOLSE,
LEVEL_SECTOR_Z,
LEVEL_VENOM_SW,
LEVEL_VERSUS,
} LevelId;
#endif
+54
View File
@@ -9,6 +9,11 @@ typedef struct {
/* 0x8 */ f32 z;
} Vec3f; // size = 0xC
typedef struct {
Vec3f normal;
f32 dist;
} Plane;
typedef struct {
/* 0x0 */ s16 x;
/* 0x2 */ s16 y;
@@ -26,4 +31,53 @@ typedef union {
// u64 force_struct_alignment;
} Matrix; // size = 0x40
f32 Math_ModF(f32 value, f32 mod);
void Rand_Init(void);
f32 Rand_ZeroOne(void);
void Rand_SetSeed(s32 seed1, s32 seed2, s32 seed3);
f32 Rand_ZeroOneSeeded(void);
f32 Math_Atan2F(f32 y, f32 x);
f32 Math_Atan2F_XY(f32 x, f32 y);
f32 Math_Atan2F_XYAlt(f32 x, f32 y);
f32 Math_PowF(f32 base, s32 exp);
void Math_MinMax(s32* min, s32* max, s32 val1, s32 val2, s32 val3);
f32 Math_SmoothStepToF(f32 *value, f32 target, f32 scale, f32 maxStep, f32 minStep);
f32 Math_SmoothStepToAngle(f32 *angle, f32 target, f32 scale, f32 maxStep, f32 minStep);
void Math_SmoothStepToVec3fArray(Vec3f *src, Vec3f *dst, s32 mode, s32 count, f32 scale, f32 maxStep, f32 minStep);
s32 Math_PursueVec3f(Vec3f *pos, Vec3f *target, Vec3f *rot, f32 stepSize, f32 scaleTurn, f32 maxTurn, f32 dist);
void Math_Vec3fFromAngles(Vec3f *step, f32 xRot, f32 yRot, f32 stepsize);
f32 Math_RadToDeg(f32 rAngle);
void Matrix_Copy(Matrix*, Matrix*);
void Matrix_Push(Matrix** mtxStack);
void Matrix_Pop(Matrix** mtxStack);
void Matrix_Mult(Matrix*, Matrix*, u8);
void Matrix_Translate(Matrix*, f32, f32, f32, u8);
void Matrix_Scale(Matrix*, f32, f32, f32, u8);
void Matrix_RotateX(Matrix*, f32, u8);
void Matrix_RotateY(Matrix*, f32, u8);
void Matrix_RotateZ(Matrix*, f32, u8);
void Matrix_RotateAxis(Matrix*, f32, f32, f32, f32, u8);
void Matrix_ToMtx(Mtx *dest);
void Matrix_FromMtx(Mtx *src, Matrix *dest);
void Matrix_MultVec3f(Matrix*, Vec3f*, Vec3f*);
void Matrix_MultVec3fNoTranslate(Matrix*, Vec3f*, Vec3f*);
void Matrix_GetYRPAngles(Matrix*, Vec3f*);
void Matrix_GetXYZAngles(Matrix*, Vec3f*);
void Matrix_LookAt(Matrix*, f32, f32, f32, f32, f32, f32, f32, f32, f32, u8);
void Matrix_SetGfxMtx(Gfx**);
f32 Math_FAtanF(f32);
f32 Math_FAtan2F(f32, f32);
f32 Math_FAsinF(f32);
f32 Math_FAcosF(f32);
f32 __sinf(f32);
f32 __cosf(f32);
s64 __ull_div(s64, s64);
s64 __ll_mul(s64, s64);
s64 __ll_rshift(s64, s64);
#endif
+85 -4
View File
@@ -21,6 +21,87 @@ bool Message_DisplayText(Gfx** gfxPtr, u16* msgPtr, s32 xPos, s32 yPos, s32 len)
void Message_DisplayScrollingText(Gfx** gfxPtr, u16* msgPtr, s32 xPos, s32 yPos, s32 yRangeHi, s32 yRangeLo, s32 len);
bool Message_IsPrintingChar(u16* msgPtr, s32 charPos);
typedef enum {
RCID_FOX = 0,
RCID_FOX_OPEN,
RCID_FOX_RED = 5,
RCID_FOX_RED_OPEN,
RCID_STATIC = 2,
RCID_STATIC_FLIP,
RCID_FALCO = 10,
RCID_FALCO_OPEN,
RCID_FALCO_RED = 15,
RCID_FALCO_RED_OPEN,
RCID_SLIPPY = 20,
RCID_SLIPPY_OPEN,
RCID_SLIPPY_RED = 25,
RCID_SLIPPY_RED_OPEN,
RCID_PEPPY = 30,
RCID_PEPPY_OPEN,
RCID_PEPPY_RED = 35,
RCID_PEPPY_RED_OPEN,
RCID_KATT = 40,
RCID_KATT_OPEN,
RCID_ANDROSS = 50,
RCID_ANDROSS_OPEN,
RCID_ANDROSS_RED = 55,
RCID_ANDROSS_RED_OPEN,
RCID_JAMES = 60,
RCID_JAMES_OPEN,
RCID_PEPPER = 70,
RCID_PEPPER_OPEN,
RCID_BOSS_CORNERIA = 80,
RCID_BOSS_CORNERIA_OPEN,
RCID_ROB64 = 90,
RCID_ROB64_OPEN,
RCID_ROB64_RED = 95,
RCID_ROB64_RED_OPEN,
RCID_BOSS_METEO = 100,
RCID_BOSS_METEO_OPEN,
RCID_BOSS_CORNERIA2 = 110,
RCID_BOSS_CORNERIA2_OPEN,
RCID_BOSS_AREA6 = 120,
RCID_BOSS_AREA6_OPEN,
RCID_BOSS_ZONESS = 130,
RCID_BOSS_ZONESS_OPEN,
RCID_ROB64_2 = 140,
RCID_ROB64_2_OPEN,
RCID_BOSS_SECTORX = 150,
RCID_BOSS_SECTORX_OPEN,
RCID_BOSS_SECTORY = 160,
RCID_BOSS_SECTORY_OPEN,
RCID_BILL = 170,
RCID_BILL_OPEN,
RCID_CAIMAN_AREA6 = 180,
RCID_CAIMAN_AREA6_OPEN,
RCID_BOSS_MACBETH = 190,
RCID_BOSS_MACBETH_OPEN,
RCID_WOLF = 200,
RCID_WOLF_OPEN,
RCID_PIGMA = 210,
RCID_PIGMA_OPEN,
RCID_LEON = 220,
RCID_LEON_OPEN,
RCID_ANDREW = 230,
RCID_ANDREW_OPEN,
RCID_WOLF_2 = 240,
RCID_WOLF_2_OPEN,
RCID_PIGMA_2 = 250,
RCID_PIGMA_2_OPEN,
RCID_LEON_2 = 260,
RCID_LEON_2_OPEN,
RCID_ANDREW_2 = 270,
RCID_ANDREW_2_OPEN,
RCID_ROB64_TITLE = 300,
RCID_ROB64_TITLE_OPEN,
RCID_PEPPER_TITLE = 310,
RCID_PEPPER_TITLE_OPEN,
RCID_TRAINING = 350,
RCID_TRAINING_OPEN,
RCID_FOX_EXPERT = 400,
RCID_FOX_EXPERT_OPEN,
} RadioCharacterId;
typedef enum {
MSGCHAR_END,
MSGCHAR_NWL,
@@ -30,10 +111,10 @@ typedef enum {
MSGCHAR_NP5,
MSGCHAR_NP6,
MSGCHAR_NP7,
MSGCHAR_NP8,
MSGCHAR_NP9,
MSGCHAR_NPA,
MSGCHAR_NPB,
MSGCHAR_PRI0,
MSGCHAR_PRI1,
MSGCHAR_PRI2,
MSGCHAR_PRI3,
MSGCHAR_SPC,
MSGCHAR_QSP,
MSGCHAR_HSP,
File diff suppressed because it is too large Load Diff
+125
View File
@@ -0,0 +1,125 @@
#ifndef SF64_THREAD
#define SF64_THREAD
#include "libultra/ultra64.h"
#include "gfx.h"
typedef enum {
GSTATE_NONE,
GSTATE_INIT,
GSTATE_TITLE,
GSTATE_MENU,
GSTATE_MAP,
GSTATE_STATE_5,
GSTATE_VS_INIT,
GSTATE_PLAY,
GSTATE_CREDITS,
GSTATE_BOOT = 100,
GSTATE_BOOT_WAIT,
GSTATE_SHOW_LOGO,
GSTATE_CHECK_SAVE,
GSTATE_LOGO_WAIT,
GSTATE_START,
} GameStates;
typedef void (*TimerAction)(s32*, s32);
typedef struct {
/* 0x00 */ u8 active;
/* 0x08 */ OSTimer timer;
/* 0x28 */ TimerAction action;
/* 0x2C */ s32* address;
/* 0x30 */ s32 value;
} TimerTask; // size = 0x38, 0x8 aligned
typedef struct {
/* 0x000 */ OSThread thread;
/* 0x1B0 */ char stack[0x800];
/* 0x9B0 */ OSMesgQueue msgQueue;
/* 0x9C8 */ OSMesg msg;
/* 0x9CC */ FrameBuffer* fb;
/* 0x9D0 */ u16 width;
/* 0x9D2 */ u16 height;
} FaultMgr; // size = 0x9D8, 0x8 aligned
typedef enum {
SPTASK_STATE_NOT_STARTED,
SPTASK_STATE_RUNNING,
SPTASK_STATE_INTERRUPTED,
SPTASK_STATE_FINISHED,
SPTASK_STATE_FINISHED_DP
} SpTaskState;
typedef struct {
/* 0x00 */ OSTask task;
/* 0x40 */ OSMesgQueue* msgQueue;
/* 0x44 */ OSMesg msg;
/* 0x48 */ SpTaskState state;
} SPTask; // size = 0x50, 0x8 aligned
typedef struct {
/* 0x00000 */ SPTask task;
/* 0x00050 */ Vp viewports[0x10];
/* 0x00150 */ Mtx mtx[0x480];
/* 0x12150 */ Gfx unkDL1[0x180];
/* 0x12D50 */ Gfx masterDL[0x1380];
/* 0x1C950 */ Gfx unkDL2[0xD80];
/* 0x23550 */ Lightsn lights[0x100];
} GfxPool; // size = 0x2AD50, 0x8 aligned
void Controller_Init(void);
void Controller_UpdateInput(void);
void Controller_ReadData(void);
void Save_ReadData(void);
void Save_WriteData(void);
void Controller_Rumble(void);
s32 Timer_CreateTask(u64, TimerAction, s32*, s32);
void Timer_Increment(s32* address, s32 value);
void Timer_SetValue(s32* address, s32 value);
void Timer_CompleteTask(TimerTask*);
void Timer_Wait(u64);
s32 Save_WriteEeprom(SaveFile*);
s32 Save_ReadEeprom(SaveFile*);
void Fault_ThreadEntry(void*);
void func_80007FE4(FrameBuffer*, u16, u16);
void Fault_Init(void);
typedef enum {
SI_READ_CONTROLLER = 10,
SI_READ_SAVE,
SI_WRITE_SAVE,
SI_RUMBLE,
SI_SAVE_FAILED,
SI_SAVE_SUCCESS,
SI_CONT_READ_DONE,
} SerialMesg;
#define MSG_QUEUE_EMPTY -1
#define FAULT_MESG_BREAK 1
#define FAULT_MESG_FAULT 2
#define TASK_MESG_1 1
#define TASK_MESG_2 2
#define EVENT_MESG_SP 1
#define EVENT_MESG_DP 2
#define EVENT_MESG_VI 3
#define EVENT_MESG_PRENMI 4
typedef enum {
THREAD_ID_SYSTEM,
THREAD_ID_IDLE,
THREAD_ID_FAULT,
THREAD_ID_MAIN,
THREAD_ID_4,
THREAD_ID_AUDIO,
THREAD_ID_GRAPHICS,
THREAD_ID_7,
THREAD_ID_SERIAL,
} ThreadID;
#endif
+68 -391
View File
File diff suppressed because it is too large Load Diff
+196 -102
View File
File diff suppressed because it is too large Load Diff