Decomped trophy & podium models. Modified gbi.h (#28)

* Decompiled trophy & podium models, fixed mk_gbi.h
This commit is contained in:
CoderStig 2021-07-31 18:39:06 -06:00 committed by GitHub
parent f5b22811bb
commit e69d8ba395
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 2846 additions and 642 deletions

View File

@ -39,7 +39,7 @@ COURSE_DIRS := \
TEXTURES_DIR = textures
ALL_DIRS = $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(SRC_DIRS) $(COURSE_DIRS) $(INCLUDE_DIRS) $(ASM_DIRS) $(ALL_KARTS_DIRS) $(TEXTURES_DIR)/raw $(TEXTURES_DIR)/standalone $(TEXTURES_DIR)/startup_logo $(TEXTURES_DIR)/crash_screen)
ALL_DIRS = $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(SRC_DIRS) $(COURSE_DIRS) $(INCLUDE_DIRS) $(ASM_DIRS) $(ALL_KARTS_DIRS) $(TEXTURES_DIR)/raw $(TEXTURES_DIR)/standalone $(TEXTURES_DIR)/startup_logo $(TEXTURES_DIR)/crash_screen $(TEXTURES_DIR)/trophy)
################### Universal Dependencies ###################
@ -166,6 +166,7 @@ MIO0TOOL = $(TOOLS_DIR)/mio0
N64CKSUM = $(TOOLS_DIR)/n64cksum
N64GRAPHICS = $(TOOLS_DIR)/n64graphics
EXTRACT_DATA_FOR_MIO := $(TOOLS_DIR)/extract_data_for_mio
REMOVE_BYTES := $(PYTHON) $(TOOLS_DIR)/remove_bytes.py
EMULATOR = mupen64plus
EMU_FLAGS = --noosd
LOADER = loader64
@ -224,8 +225,19 @@ $(BUILD_DIR)/src/crash_screen.o: src/crash_screen.c
$(CC) -c $(CFLAGS) -o $@ $<
$(PYTHON) tools/set_o32abi_bit.py $@
$(BUILD_DIR)/src/trophy_model.inc.o: src/trophy_model.inc.c
$(N64GRAPHICS) -i $(BUILD_DIR)/textures/trophy/reflection_map_brass.rgba16.inc.c -g textures/trophy/reflection_map_brass.rgba16.png -f rgba16 -s u8
$(N64GRAPHICS) -i $(BUILD_DIR)/textures/trophy/reflection_map_silver.rgba16.inc.c -g textures/trophy/reflection_map_silver.rgba16.png -f rgba16 -s u8
$(N64GRAPHICS) -i $(BUILD_DIR)/textures/trophy/reflection_map_gold.rgba16.inc.c -g textures/trophy/reflection_map_gold.rgba16.png -f rgba16 -s u8
$(N64GRAPHICS) -i $(BUILD_DIR)/textures/trophy/podium1.rgba16.inc.c -g textures/trophy/podium1.rgba16.png -f rgba16 -s u8
$(N64GRAPHICS) -i $(BUILD_DIR)/textures/trophy/podium2.rgba16.inc.c -g textures/trophy/podium2.rgba16.png -f rgba16 -s u8
$(N64GRAPHICS) -i $(BUILD_DIR)/textures/trophy/podium3.rgba16.inc.c -g textures/trophy/podium3.rgba16.png -f rgba16 -s u8
@$(CC_CHECK) -MMD -MP -MT $@ -MF $(BUILD_DIR)/$*.d $<
$(CC) -c $(CFLAGS) -o $@ $<
$(PYTHON) tools/set_o32abi_bit.py $@
$(BUILD_DIR)/src/startup_logo.inc.o: src/startup_logo.inc.c
$(N64GRAPHICS) -i $(BUILD_DIR)/textures/startup_logo/startup_logo.rgba16.inc.c -g textures/startup_logo/startup_logo.rgba16.png -f rgba16 -s u8
$(N64GRAPHICS) -i $(BUILD_DIR)/textures/startup_logo/reflection_map_gold.rgba16.inc.c -g textures/startup_logo/reflection_map_gold.rgba16.png -f rgba16 -s u8
@$(CC_CHECK) -MMD -MP -MT $@ -MF $(BUILD_DIR)/$*.d $<
$(CC) -c $(CFLAGS) -o $@ $<
$(PYTHON) tools/set_o32abi_bit.py $@
@ -433,9 +445,38 @@ $(BUILD_DIR)/src/startup_logo.inc.mio0.o: src/startup_logo.inc.c
printf ".include \"macros.inc\"\n\n.data\n\n.align 2, 0x00\n\n.balign 4\n\nglabel startup_logo\n\n.incbin \"build/us/src/startup_logo.inc.mio0\"\n" > build/us/src/startup_logo.inc.mio0.s
$(AS) $(ASFLAGS) -o $(BUILD_DIR)/src/startup_logo.inc.mio0.o $(BUILD_DIR)/src/startup_logo.inc.mio0.s
# trophy_model.inc.c
$(BUILD_DIR)/src/trophy_model.inc.mio0.o: src/trophy_model.inc.c
$(LD) -t -e 0 -Ttext=0B000000 -Map $(BUILD_DIR)/src/trophy_model.inc.elf.map -o $(BUILD_DIR)/src/trophy_model.inc.elf $(BUILD_DIR)/src/trophy_model.inc.o --no-check-sections
$(V)$(EXTRACT_DATA_FOR_MIO) $(BUILD_DIR)/src/trophy_model.inc.elf $(BUILD_DIR)/src/trophy_model.inc.bin
#$(REMOVE_BYTES) $(BUILD_DIR)/src/trophy_model.inc.bin 8
$(MIO0TOOL) -c $(BUILD_DIR)/src/trophy_model.inc.bin $(BUILD_DIR)/src/trophy_model.inc.mio0
printf ".include \"macros.inc\"\n\n.data\n\n.align 2, 0x00\n\nglabel trophy_model\n\n.incbin \"build/us/src/trophy_model.inc.mio0\"\n" > build/us/src/trophy_model.inc.mio0.s
$(AS) $(ASFLAGS) -o $(BUILD_DIR)/src/trophy_model.inc.mio0.o $(BUILD_DIR)/src/trophy_model.inc.mio0.s
#$(BUILD_DIR)/src/trophy_model.inc.bin: src/trophy_model.inc.c
# $(LD) -t -e 0 -Ttext=0B000000 -Map $(BUILD_DIR)/src/trophy_model.inc.elf.map -o $(BUILD_DIR)/src/trophy_model.inc.elf $(BUILD_DIR)/src/trophy_model.inc.o --no-check-sections
# $(V)$(EXTRACT_DATA_FOR_MIO) $(BUILD_DIR)/src/trophy_model.inc.elf $(BUILD_DIR)/src/trophy_model.inc.bin
#$(BUILD_DIR)/data/trophy_path_data.inc.bin: data/trophy_path_data.inc.s
# $(AS) $(ASFLAGS) -o $(BUILD_DIR)/data/trophy_path_data.inc.o data/trophy_path_data.inc.s
# $(LD) -t -e 0 -Ttext=0B000000 -Map $(BUILD_DIR)/data/trophy_path_data.inc.elf.map -o $(BUILD_DIR)/data/trophy_path_data.inc.elf $(BUILD_DIR)/data/trophy_path_data.inc.o --no-check-sections
# $(V)$(EXTRACT_DATA_FOR_MIO) $(BUILD_DIR)/data/trophy_path_data.inc.elf $(BUILD_DIR)/data/trophy_path_data.inc.bin
#$(BUILD_DIR)/src/trophy_model.inc.mio0.o: $(BUILD_DIR)/src/trophy_model.inc.bin $(BUILD_DIR)/data/trophy_path_data.inc.bin
# printf ".include \"macros.inc\"\n\n.data\n\n\n\nglabel trophy_model\n\n.incbin \"build/us/src/trophy_model.inc.bin\"\n\n\n\n.incbin \"build/us/data/trophy_path_data.inc.bin\"\n" > build/us/src/trophy_model_combined.inc.s
# $(AS) $(ASFLAGS) -o $(BUILD_DIR)/src/trophy_model_combined.inc.o $(BUILD_DIR)/src/trophy_model_combined.inc.s
# $(LD) -t -e 0 -Ttext=0B000000 -Map $(BUILD_DIR)/src/trophy_model_combined.inc.elf.map -o $(BUILD_DIR)/src/trophy_model_combined.inc.elf $(BUILD_DIR)/src/trophy_model_combined.inc.o --no-check-sections
# $(V)$(EXTRACT_DATA_FOR_MIO) $(BUILD_DIR)/src/trophy_model_combined.inc.elf $(BUILD_DIR)/src/trophy_model_combined.inc.bin
# $(REMOVE_BYTES) $(BUILD_DIR)/src/trophy_model_combined.inc.bin 8
# $(MIO0TOOL) -c $(BUILD_DIR)/src/trophy_model_combined.inc.bin $(BUILD_DIR)/src/trophy_model_combined.inc.mio0
# printf ".include \"macros.inc\"\n\n.data\n\n.align 2, 0x00\n\nglabel trophy_model\n\n.incbin \"build/us/src/trophy_model_combined.inc.mio0\"\n" > build/us/src/trophy_model.inc.mio0.s
# $(AS) $(ASFLAGS) -o $(BUILD_DIR)/src/trophy_model.inc.mio0.o $(BUILD_DIR)/src/trophy_model.inc.mio0.s
$(BUILD_DIR)/$(TARGET).elf: $(O_FILES) $(COURSE_MIO0_OBJ_FILES) $(BUILD_DIR)/$(LD_SCRIPT) $(BUILD_DIR)/src/startup_logo.inc.mio0.o $(LD_COURSE_VERTEX_DEPENDENCIES) undefined_syms.txt
$(BUILD_DIR)/$(TARGET).elf: $(O_FILES) $(COURSE_MIO0_OBJ_FILES) $(BUILD_DIR)/$(LD_SCRIPT) $(BUILD_DIR)/src/startup_logo.inc.mio0.o $(BUILD_DIR)/src/trophy_model.inc.mio0.o $(LD_COURSE_VERTEX_DEPENDENCIES) undefined_syms.txt
$(LD) $(LDFLAGS) -o $@
# -R $(mushroom_cup)/luigi_raceway/model.inc.elf -R $(mushroom_cup)/moo_moo_farm/model.inc.elf -R $(mushroom_cup)/koopa_beach/model.inc.elf -R $(mushroom_cup)/kalimari_desert/model.inc.elf \

View File

@ -163,4 +163,5 @@ $(MUSIC_DIR)/seq_21.m64
# SEGMENTED ADDRESSES
$(BUILD_DIR)/src/startup_logo.elf: SEGMENT_ADDRESS := 0x06000000
$(BUILD_DIR)/src/startup_logo.inc.elf: SEGMENT_ADDRESS := 0x06000000
$(BUILD_DIR)/src/trophy_model.inc.elf: SEGMENT_ADDRESS := 0x0B000000

View File

@ -64,8 +64,14 @@
"bin/mk64.u.6A0ABC.bin": {"meta":{"size": "0x72304"}, "offsets":{"us":["0x6A0ABC","0x0"]}},
"bin/mk64.u.724220.bin": {"meta":{"size": "0x5810"}, "offsets":{"us":["0x724220","0x0"]}},
"bin/data_821D10.bin": {"meta":{"size": "0x8D88"}, "offsets":{"us":["0x821D10","0x0"]}},
"textures/trophy/reflection_map_brass.rgba16.png": {"meta":{"dims":[32,32]}, "offsets":{"us":["0x821D10", "0x4670"]}},
"textures/trophy/reflection_map_silver.rgba16.png": {"meta":{"dims":[32,32]}, "offsets":{"us":["0x821D10", "0x4E70"]}},
"textures/trophy/reflection_map_gold.rgba16.png": {"meta":{"dims":[32,32]}, "offsets":{"us":["0x821D10", "0x5670"]}},
"textures/trophy/podium1.rgba16.png": {"meta":{"dims":[32,32]}, "offsets":{"us":["0x821D10", "0x6BD0"]}},
"textures/trophy/podium2.rgba16.png": {"meta":{"dims":[32,32]}, "offsets":{"us":["0x821D10", "0x7760"]}},
"textures/trophy/podium3.rgba16.png": {"meta":{"dims":[32,32]}, "offsets":{"us":["0x821D10", "0x8070"]}},
"bin/data_825800.bin": {"meta":{"size": "0x9480"}, "offsets":{"us":["0x825800","0x0"]}},
"textures/startup_logo/startup_logo.rgba16.png": {"meta":{"dims":[32,32]}, "offsets":{"us":["0x825800", "0x8A48"]}},
"textures/startup_logo/reflection_map_gold.rgba16.png": {"meta":{"dims":[32,32]}, "offsets":{"us":["0x825800", "0x8A48"]}},
"bin/course_mario_raceway_dl.bin": {"meta":{"size": "0x3150"}, "offsets":{"us":["0x8284D0","0x0"]}},
"bin/course_choco_mountain_dl.bin": {"meta":{"size": "0x2920"}, "offsets":{"us":["0x82B620","0x0"]}},
"bin/course_bowsers_castle_dl.bin": {"meta":{"size": "0x3E80"}, "offsets":{"us":["0x82DF40","0x0"]}},

View File

@ -1,12 +0,0 @@
# Mario Kart 64 (U) disassembly and split file
# generated by n64split v0.4a - N64 ROM splitter
.include "macros.inc"
.data
.align 2, 0x00
#.skip 1000
glabel data_821D10
.incbin "bin/data_821D10.mio0"
glabel data_821D10_end

View File

@ -153,6 +153,7 @@
# define G_TRI2 (G_IMMFIRST-14)
# define G_BRANCH_Z (G_IMMFIRST-15)
# define G_LOAD_UCODE (G_IMMFIRST-16)
# define G_QUAD (G_IMMFIRST-10)
#else
# define G_RDPHALF_CONT (G_IMMFIRST-13)
#endif
@ -2170,12 +2171,30 @@ typedef union {
_g->words.w1 = __gsSP1Quadrangle_w2f(v0, v1, v2, v3, flag); \
}
// unmodified gsSP1Quadrangle
#ifdef NON_MATCHING_GBI
#define gsSP1Quadrangle(v0, v1, v2, v3, flag) \
{{ \
{{ \
(_SHIFTL(G_TRI2, 24, 8)| \
__gsSP1Quadrangle_w1f(v0, v1, v2, v3, flag)), \
__gsSP1Quadrangle_w2f(v0, v1, v2, v3, flag) \
}}
#else
/**
* Modified to match startup_logo.inc.c
* Likely due to a development version of gbi.h
*/
#define __mk_gsSP1Triangle_w1(v0, v1, v2, v3) \
(_SHIFTL((v3)*2,24,8)|_SHIFTL((v0)*2,16,8)|_SHIFTL((v1)*2,8,8)|_SHIFTL((v2)*2,0,8))
#define gsSP1Quadrangle(v0, v1, v2, v3) \
{{ \
_SHIFTL(G_QUAD, 24, 8), \
__mk_gsSP1Triangle_w1(v0, v1, v2, v3) \
}}
#endif /* NON_MATCHING */
#endif /* F3DEX_GBI_2 */
#if (defined(F3DLP_GBI)||defined(F3DEX_GBI))

View File

@ -1,11 +0,0 @@
#include <PR/gbi.h>
#define __mk_gsSPLine3D_w1f(v0, v1, v2, v3) \
(_SHIFTR((v3), 0,8)|_SHIFTL((v2), 8, 8)| \
_SHIFTL((v1), 16, 8)|_SHIFTL((v0), 24, 8))
#define mk_Line3D(v0, v1, v2, v3) \
{{ \
_SHIFTL(G_LINE3D, 24, 8)|0, \
__mk_gsSPLine3D_w1f(v0, v1, v2, v3) \
}}

View File

@ -67,7 +67,12 @@ typedef struct {
s8 flag[2]; /* unk flag */
u8 ca[4]; /* color & alpha */
} mk_Vtx_Logo;
} mk_Vtx_Flag;
typedef struct {
s8 ob[3];
s8 unk;
} coursePath;
struct courseTable {
u32 *dlRomStart; // 0x00 ROM start for segment 6 DL data

View File

@ -374,7 +374,7 @@ SECTIONS
0x828400 -> 0x8028DE30 (0xD0) */
BEGIN_SEG(data_821D10, 0x0C000000)
{
BUILD_DIR/data/data_821D10.o(.data);
BUILD_DIR/src/trophy_model.inc.mio0.o(.data);
}
END_SEG(data_821D10)
BEGIN_SEG(data_825800, 0x06000000)

File diff suppressed because it is too large Load Diff

2158
src/trophy_model.inc.c Normal file

File diff suppressed because it is too large Load Diff