diff --git a/Makefile b/Makefile index eefa9831..d29ef0f6 100644 --- a/Makefile +++ b/Makefile @@ -153,7 +153,7 @@ CHECK_WARNINGS := -Wall -Wextra -Wimplicit-fallthrough -Wno-unknown-pragmas -Wno MIPS_BUILTIN_DEFS := -DMIPSEB -D_MIPS_FPSET=16 -D_MIPS_ISA=2 -D_ABIO32=1 -D_MIPS_SIM=_ABIO32 -D_MIPS_SZINT=32 -D_MIPS_SZPTR=32 ifneq ($(RUN_CC_CHECK),0) # The -MMD flags additionaly creates a .d file with the same name as the .o file. - CHECK_WARNINGS := -Wno-unused-variable + CHECK_WARNINGS := -Wno-unused-variable -Wno-int-conversion CC_CHECK := $(CC_CHECK_COMP) CC_CHECK_FLAGS := -MMD -MP -fno-builtin -fsyntax-only -funsigned-char -fdiagnostics-color -std=gnu89 -DNON_MATCHING -DAVOID_UB -DCC_CHECK=1 @@ -173,7 +173,7 @@ endif CFLAGS += -G 0 -non_shared -Xcpluscomm -nostdinc -Wab,-r4300_mul -WARNINGS := -fullwarn -verbose -woff 624,649,838,712,516,513,596,564,594 +WARNINGS := -fullwarn -verbose -woff 624,649,838,712,516,513,596,564,594,709 ASFLAGS := -march=vr4300 -32 -G0 COMMON_DEFINES := -D_MIPS_SZLONG=32 GBI_DEFINES := -DF3DEX_GBI @@ -272,12 +272,14 @@ build/src/libultra/libc/ll.o: CC := $(IDO) all: uncompressed +tools: + @$(MAKE) -s -C tools + init: @$(MAKE) clean - @$(MAKE) -s -C tools @$(MAKE) decompress @$(MAKE) extract -j $(N_THREADS) - @$(MAKE) all -j $(N_THREADS) + @$(MAKE) uncompressed -j $(N_THREADS) @$(MAKE) compressed SF := ___ ___\n/ __|| _|\n\__ \| _|\n|___/|_|\n diff --git a/README.md b/README.md index eeaeb2dc..1c68276f 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ python3 -m pip install -r ./tools/requirements-python.txt --break-system-package ```bash git submodule update --init --recursive -make -s -C tools +make tools ``` #### 5. Prepare a base ROM diff --git a/include/functions.h b/include/functions.h index c8eb773f..557d5df3 100644 --- a/include/functions.h +++ b/include/functions.h @@ -174,6 +174,7 @@ void func_80042FD0(Object_408 *); void func_80042FDC(Object*); void func_80042FE8(Object*); void func_800444BC(UnkStruct_D_80178280 *); +void func_800515C4(void); // sf_496E0 void func_8004F8AC(Object*); diff --git a/include/gfx.h b/include/gfx.h index a48e344e..47f4b6ef 100644 --- a/include/gfx.h +++ b/include/gfx.h @@ -185,7 +185,7 @@ void TextureRect_32bRGBA(Gfx **gfxPtr, void* texture, u32 width, u32 height, f32 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); -s32* func_8009F7B4(Gfx **gfxPtr, u8 width, u8 height); +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); diff --git a/include/structs.h b/include/structs.h index 99a3fa15..ab09fcdd 100644 --- a/include/structs.h +++ b/include/structs.h @@ -316,9 +316,16 @@ typedef struct { } Object; // size = 0x1C typedef struct { - /* 0x00 */ void (*draw)(); // argument must have object type. Can be dlist. + union { + /* 0x00 */ void* drawVoid; // Have the first option be a void type to silence warnings about the wrong type in the initialization of this object. + /* 0x00 */ void (*draw)(Object*); // argument must have object type. + /* 0x00 */ Gfx* drawGfx; //Can be dlist. + }; /* 0x00 */ u8 drawType; - /* 0x08 */ void (*action)(); // argument must have object type. + union { + /* 0x08 */ void* actionVoid; // Have the first option be a void type to silence warnings about the wrong type in the initialization of this object. + /* 0x08 */ void (*action)(Object*); // argument must have object type. But it can be one of many different types of objects. + }; /* 0x0C */ f32* unk_0C; // some sort of script? /* 0x10 */ f32 unk_10; // z coordinate of something /* 0x14 */ s16 unk_14; // can be -1, 0, 1 diff --git a/include/variables.h b/include/variables.h index 07ecdf92..8c5586a4 100644 --- a/include/variables.h +++ b/include/variables.h @@ -629,7 +629,7 @@ extern u8 D_80281400[0xC00]; extern FrameBuffer gZBuffer; // z buffer extern u8 D_802A7800; extern u8 D_802D7800; -extern s32 D_80387800; +extern u16 D_80387800; extern u16 D_8038F080[]; extern u16 D_8038F300[]; extern FrameBuffer gFrameBuffers[3]; // 8038F800 diff --git a/src/main/fox_display.c b/src/main/fox_display.c index 74c3e036..c782101f 100644 --- a/src/main/fox_display.c +++ b/src/main/fox_display.c @@ -287,7 +287,7 @@ void Animation_FindBoundingBox(Gfx* dList, s32 len, Vec3f* min, Vec3f* max, s32* for (var_s0 = sp44; (s32) (*var_s0 >> 0x38) != G_ENDDL && var_s0 - sp44 < len; var_s0++) { switch ((s32) (*var_s0 >> 0x38)) { case G_DL: - Animation_FindBoundingBox((Gfx*) (*var_s0 & 0xFFFFFFFF), (*var_s0 >> 0x20) & 0xFFFF, min, max, vtxFound, + Animation_FindBoundingBox(*var_s0 & 0xFFFFFFFF, (*var_s0 >> 0x20) & 0xFFFF, min, max, vtxFound, vtxCount, vtxList); break; case G_VTX: @@ -719,7 +719,7 @@ f32 Math_RadToDeg(f32 rAngle) { return rAngle; } -s32* func_8009F7B4(Gfx** gfxPtr, u8 width, u8 height) { +u16* func_8009F7B4(Gfx** gfxPtr, u8 width, u8 height) { u16* spB4; u16 norm; diff --git a/src/main/main.c b/src/main/main.c index 14b525db..2fe65ecf 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -213,7 +213,7 @@ void Graphics_SetTask(void) { gGfxTask->task.t.ucode_size = SP_UCODE_SIZE; gGfxTask->task.t.ucode_data = (u64*) &gF3dexData; gGfxTask->task.t.ucode_data_size = SP_UCODE_DATA_SIZE; - gGfxTask->task.t.dram_stack = &D_80281000; + gGfxTask->task.t.dram_stack = D_80281000; gGfxTask->task.t.dram_stack_size = SP_DRAM_STACK_SIZE8; gGfxTask->task.t.output_buff = (u64*) &D_802A7800; gGfxTask->task.t.output_buff_size = (u64*) &D_802D7800; diff --git a/src/main/sf_A4B50.c b/src/main/sf_A4B50.c index 51a027ba..0c0a7c88 100644 --- a/src/main/sf_A4B50.c +++ b/src/main/sf_A4B50.c @@ -240,7 +240,7 @@ void func_800A4C40(UnkStruct_D_80178280* arg0) { } } else { D_80161A64 = 0; - func_8001A55C(&arg0->unk_460[0], 0x1100000B); + func_8001A55C(&arg0->unk_460[0].x, 0x1100000B); } } } @@ -336,7 +336,7 @@ void func_800A5338(void) { var_s0->obj.rot.y = D_80178310[j].unk_C; func_800612B8(&var_s0->unk_1C, var_s0->obj.id); if (var_s0->obj.id == 1) { - var_s0->unk_1C.draw = D_6020760; + var_s0->unk_1C.drawGfx = D_6020760; } var_s0++; } diff --git a/src/overlays/ovl_EBFBE0/fox_title.c b/src/overlays/ovl_EBFBE0/fox_title.c index bc7de6b8..3a7008ac 100644 --- a/src/overlays/ovl_EBFBE0/fox_title.c +++ b/src/overlays/ovl_EBFBE0/fox_title.c @@ -19,10 +19,10 @@ s32 pad_D_EBFBE0_801AD9F0[4] = { 0, 0, 0, 0 }; //! TODO: Symbols for segmented addresses Animation D_EBFBE0_801ADA00[4] = { - { 0x0602F8E0, 0x06035024, 0x0602FBAC }, - { 0x060305C0, 0x060338DC, 0x0603088C }, - { 0x06031DB8, 0x0603531C, 0x06032084 }, - { 0x06031120, 0x06036278, 0x060313AC }, + { (AnimationHeader*) 0x0602F8E0, (AnimationHeader*) 0x06035024, (SkelAnime*) 0x0602FBAC }, + { (AnimationHeader*) 0x060305C0, (AnimationHeader*) 0x060338DC, (SkelAnime*) 0x0603088C }, + { (AnimationHeader*) 0x06031DB8, (AnimationHeader*) 0x0603531C, (SkelAnime*) 0x06032084 }, + { (AnimationHeader*) 0x06031120, (AnimationHeader*) 0x06036278, (SkelAnime*) 0x060313AC }, }; u16* D_EBFBE0_801ADA30[5] = { @@ -1249,7 +1249,7 @@ void func_EBFBE0_8018A644(void) { if (D_EBFBE0_801B7BEC == 795) { func_8001A838(0x49000014); - func_8001A55C(&D_EBFBE0_801B84D8, 0x0140001C); + func_8001A55C(&D_EBFBE0_801B84D8.x, 0x0140001C); D_EBFBE0_801B82C0 = 0; @@ -2033,7 +2033,7 @@ void func_EBFBE0_8018CC30(UnkStruct_D_EBFBE0_801B8294* arg0, s32 arg1, f32 arg2) var_a3 = 2; } - func_EBFBE0_8018CD9C(&pos, &arg0[D_EBFBE0_801B8298], D_EBFBE0_801B828C, var_a3); + func_EBFBE0_8018CD9C(&pos[0], &arg0[D_EBFBE0_801B8298], D_EBFBE0_801B828C, var_a3); D_80177978 = pos[0].x; D_80177980 = pos[0].y; D_80177988 = pos[0].z; @@ -2450,8 +2450,8 @@ void func_EBFBE0_8018E67C(s32 arg0) { gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); } - Animation_GetFrameData(D_EBFBE0_801ADA00[arg0].unk_0, sp5C, &sp60); - Animation_DrawSkeleton(0, D_EBFBE0_801ADA00[arg0].skelanime, &sp60, NULL, NULL, NULL, &gIdentityMatrix); + Animation_GetFrameData(D_EBFBE0_801ADA00[arg0].unk_0, sp5C, sp60); + Animation_DrawSkeleton(0, D_EBFBE0_801ADA00[arg0].skelanime, sp60, NULL, NULL, NULL, &gIdentityMatrix); if (arg0 == 2) { gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK); @@ -2515,7 +2515,7 @@ void func_EBFBE0_8018EA78(s32 arg0) { Matrix_SetGfxMtx(&gMasterDisp); Math_SmoothStepToVec3fArray(sp48, D_EBFBE0_801B86E0[arg0], 1, - Animation_GetFrameData(D_EBFBE0_801ADA00[arg0].unk_4, sp44, &sp48), 0.2f, 100.0f, + Animation_GetFrameData(D_EBFBE0_801ADA00[arg0].unk_4, sp44, sp48), 0.2f, 100.0f, 0.0001f); Animation_DrawSkeleton(1, D_EBFBE0_801ADA00[arg0].skelanime, D_EBFBE0_801B86E0[arg0], func_EBFBE0_8018EDC8, NULL, &arg0, &gIdentityMatrix); @@ -3350,7 +3350,7 @@ void func_EBFBE0_801918FC(void) { } void func_EBFBE0_801919C4(u16** arg0, s32 arg1) { - D_80178720 = (s32) arg0; + D_80178720 = arg0; D_80178724 = 0; D_80178308 = arg0[D_80178724]; D_80177D68 = arg1;