Skip to content

Commit

Permalink
extract assets from rom at runtime (coop-deluxe#4)
Browse files Browse the repository at this point in the history
* Proof of concept for loading rom assets at runtime

* Added skybox textures

* Adjusted format

* Load all texture assets from rom

* Adjusted rom asset loading

* Load all Vtx lists from rom

* clean up toad, wario and his cap conflicts

* Load sound samples from rom

* fix toad sounds

* Loaded sequences from rom

* Load collisions from rom

* Object animations are now loaded from the rom

* Load player animations from rom

* Load goddard anims from rom

* whoops

* fix some compile errors

* drag and drop rom checker, everything works now.

* fix errors due to merge conflicts

* fix compile errors on windows, switch to md5

* fix vertex colors during load

Co-Authored-By: Agent X <[email protected]>

* Load dialogs from rom

* Loaded course/act names from rom

* Loaded ingame text from rom

* rerun autogen & blacklist smlua_text_utils_init

* fix ttc_seg7_vertex_0700B238 colors

---------

Co-authored-by: MysterD <myster@d>
Co-authored-by: Agent X <[email protected]>
  • Loading branch information
3 people authored Mar 23, 2024
1 parent cdafb80 commit 663e454
Show file tree
Hide file tree
Showing 1,483 changed files with 16,588 additions and 288,426 deletions.
32 changes: 12 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -512,9 +512,9 @@ GODDARD_C_FILES := $(foreach dir,$(GODDARD_SRC_DIRS),$(wildcard $(dir)/*.c))
ULTRA_S_FILES := $(foreach dir,$(ULTRA_SRC_DIRS),$(wildcard $(dir)/*.s))
GENERATED_C_FILES := $(BUILD_DIR)/assets/mario_anim_data.c $(BUILD_DIR)/assets/demo_data.c

ifeq ($(TARGET_N64),0)
GENERATED_C_FILES += $(addprefix $(BUILD_DIR)/bin/,$(addsuffix _skybox.c,$(notdir $(basename $(wildcard textures/skyboxes/*.png)))))
endif
#ifeq ($(TARGET_N64),0)
# GENERATED_C_FILES += $(addprefix $(BUILD_DIR)/bin/,$(addsuffix _skybox.c,$(notdir $(basename $(wildcard textures/skyboxes/*.png)))))
#endif

# "If we're N64, use the above"
ifeq ($(TARGET_N64),0)
Expand Down Expand Up @@ -988,6 +988,7 @@ endif
# Prevent a crash with -sopt
export LANG := C


#==============================================================================#
# Extra CC Flags #
#==============================================================================#
Expand Down Expand Up @@ -1172,6 +1173,8 @@ endif

$(BUILD_DIR)/src/game/characters.o: $(SOUND_SAMPLE_TABLES)
$(SOUND_BIN_DIR)/sound_data.o: $(SOUND_BIN_DIR)/sound_data.ctl.inc.c $(SOUND_BIN_DIR)/sound_data.tbl.inc.c $(SOUND_BIN_DIR)/sequences.bin.inc.c $(SOUND_BIN_DIR)/bank_sets.inc.c
$(SOUND_BIN_DIR)/samples_assets.o: $(SOUND_BIN_DIR)/samples_offsets.inc.c
$(SOUND_BIN_DIR)/sequences_assets.o: $(SOUND_BIN_DIR)/sequences_offsets.inc.c
$(BUILD_DIR)/levels/scripts.o: $(BUILD_DIR)/include/level_headers.h

ifeq ($(VERSION),sh)
Expand All @@ -1192,11 +1195,9 @@ ifeq ($(VERSION),eu)
$(BUILD_DIR)/bin/eu/translation_en.o: $(BUILD_DIR)/text/us/define_text.inc.c
$(BUILD_DIR)/bin/eu/translation_de.o: $(BUILD_DIR)/text/de/define_text.inc.c
$(BUILD_DIR)/bin/eu/translation_fr.o: $(BUILD_DIR)/text/fr/define_text.inc.c
$(BUILD_DIR)/levels/menu/leveldata.o: $(BUILD_DIR)/include/text_strings.h
$(BUILD_DIR)/levels/menu/leveldata.o: $(BUILD_DIR)/text/us/define_courses.inc.c
$(BUILD_DIR)/levels/menu/leveldata.o: $(BUILD_DIR)/text/de/define_courses.inc.c
$(BUILD_DIR)/levels/menu/leveldata.o: $(BUILD_DIR)/text/fr/define_courses.inc.c
$(BUILD_DIR)/src/game/level_info.o: $(BUILD_DIR)/include/text_strings.h
$(BUILD_DIR)/src/game/level_info.o: $(BUILD_DIR)/text/us/define_courses.inc.c
$(BUILD_DIR)/src/game/level_info.o: $(BUILD_DIR)/text/de/define_courses.inc.c
$(BUILD_DIR)/src/game/level_info.o: $(BUILD_DIR)/text/fr/define_courses.inc.c
Expand All @@ -1218,13 +1219,6 @@ ALL_DIRS := $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(SRC_DIRS) $(GODDARD_SRC_DIR
# Make sure build directory exists before compiling anything
DUMMY != mkdir -p $(ALL_DIRS)

$(BUILD_DIR)/include/text_strings.h: $(BUILD_DIR)/include/text_menu_strings.h
$(BUILD_DIR)/src/menu/file_select.o: $(BUILD_DIR)/include/text_strings.h
$(BUILD_DIR)/src/menu/star_select.o: $(BUILD_DIR)/include/text_strings.h
$(BUILD_DIR)/src/game/camera.o: $(BUILD_DIR)/include/text_strings.h
$(BUILD_DIR)/src/game/ingame_menu.o: $(BUILD_DIR)/include/text_strings.h


#==============================================================================#
# Texture Generation #
#==============================================================================#
Expand Down Expand Up @@ -1296,8 +1290,6 @@ $(BUILD_DIR)/%.table: %.aiff
$(call print,Extracting codebook:,$<,$@)
$(V)$(AIFF_EXTRACT_CODEBOOK) $< >$@
$(call print,Piping:,$<,$@.inc.c)
$(V)hexdump -v -e '1/1 "0x%X,"' $< > $@.inc.c
$(V)echo >> $@.inc.c

$(BUILD_DIR)/%.aifc: $(BUILD_DIR)/%.table %.aiff
$(call print,Encoding VADPCM:,$<,$@)
Expand All @@ -1324,6 +1316,12 @@ $(SOUND_BIN_DIR)/ctl_header: $(SOUND_BIN_DIR)/sound_data.ctl
$(SOUND_BIN_DIR)/tbl_header: $(SOUND_BIN_DIR)/sound_data.ctl
@true

$(SOUND_BIN_DIR)/samples_offsets.inc.c: $(SOUND_BIN_DIR)/sound_data.ctl
@true

$(SOUND_BIN_DIR)/sequences_offsets.inc.c: $(SOUND_BIN_DIR)/sound_data.ctl
@true

$(SOUND_BIN_DIR)/sequences.bin: $(SOUND_BANK_FILES) sound/sequences.json $(SOUND_SEQUENCE_DIRS) $(SOUND_SEQUENCE_FILES) $(ENDIAN_BITWIDTH)
@$(PRINT) "$(GREEN)Generating: $(BLUE)$@ $(NO_COL)\n"
$(V)$(PYTHON) $(TOOLS_DIR)/assemble_sound.py --sequences $@ $(SOUND_BIN_DIR)/sequences_header $(SOUND_BIN_DIR)/bank_sets sound/sound_banks/ sound/sequences.json $(SOUND_SEQUENCE_FILES) $(C_DEFINES) $$(cat $(ENDIAN_BITWIDTH))
Expand Down Expand Up @@ -1360,12 +1358,6 @@ $(BUILD_DIR)/assets/demo_data.c: assets/demo_data.json $(wildcard assets/demos/*
$(V)$(PYTHON) $(TOOLS_DIR)/demo_data_converter.py assets/demo_data.json $(DEF_INC_CFLAGS) > $@

# Encode in-game text strings
$(BUILD_DIR)/include/text_strings.h: include/text_strings.h.in
$(call print,Encoding:,$<,$@)
$(V)$(TEXTCONV) charmap.txt $< $@
$(BUILD_DIR)/include/text_menu_strings.h: include/text_menu_strings.h.in
$(call print,Encoding:,$<,$@)
$(V)$(TEXTCONV) charmap_menu.txt $< $@
$(BUILD_DIR)/text/%/define_courses.inc.c: text/define_courses.inc.c text/%/courses.h
@$(PRINT) "$(GREEN)Preprocessing: $(BLUE)$@ $(NO_COL)\n"
$(V)$(CPP) $(PROF_FLAGS) $(CPPFLAGS) $< -o - -I text/$*/ | $(TEXTCONV) charmap.txt - $@
Expand Down
6 changes: 3 additions & 3 deletions Makefile.split
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@ $(eval $(call level_rules,menu,generic)) # Menu (File Select)
$(BUILD_DIR)/levels/ending/cake_eu.inc.c: levels/ending/cake_eu.png
@$(PRINT) "$(GREEN)Splitting $(YELLOW)$< $(GREEN)to: $(BLUE)$@ $(NO_COL)\n"
$(V)$(SKYCONV) $(SKYCONV_ARGS) --type cake-eu --split $^ $(BUILD_DIR)/levels/ending
$(BUILD_DIR)/levels/ending/cake.inc.c: levels/ending/cake.png
@$(PRINT) "$(GREEN)Splitting $(YELLOW)$< $(GREEN)to: $(BLUE)$@ $(NO_COL)\n"
$(V)$(SKYCONV) $(SKYCONV_ARGS) --type cake --split $^ $(BUILD_DIR)/levels/ending
#$(BUILD_DIR)/levels/ending/cake.inc.c: levels/ending/cake.png
# @$(PRINT) "$(GREEN)Splitting $(YELLOW)$< $(GREEN)to: $(BLUE)$@ $(NO_COL)\n"
# $(V)$(SKYCONV) $(SKYCONV_ARGS) --type cake --split $^ $(BUILD_DIR)/levels/ending

# --------------------------------------
# Texture Bin Rules
Expand Down
41 changes: 3 additions & 38 deletions actors/amp/anims/anim_0800401C.inc.c
Original file line number Diff line number Diff line change
@@ -1,44 +1,9 @@
#include "pc/rom_assets.h"
// 0x08003E30
static const s16 amp_seg8_animvalue_08003E30[] = {
0x0000, 0x0000, 0x0D79, 0x1AF2, 0x286B, 0x35E4, 0x435D, 0x50D6,
0x5E50, 0x6BC9, 0x7942, 0x86BE, 0x9437, 0xA1B0, 0xAF2A, 0xBCA3,
0xCA1C, 0xD795, 0xE50E, 0xF287, 0x1872, 0x0000, 0x1AF2, 0x35E4,
0x50D6, 0x6BC9, 0x86BE, 0xA1B0, 0xBCA3, 0xD795, 0xF287, 0x0D79,
0x286B, 0x435D, 0x5E50, 0x7942, 0x9437, 0xAF2A, 0xCA1C, 0xE50E,
0x0000, 0x1AF2, 0x35E4, 0x50D6, 0x6BC9, 0x86BE, 0xA1B0, 0xBCA3,
0xD795, 0xF287, 0x0D79, 0x286B, 0x435D, 0x5E50, 0x7942, 0x9437,
0xAF2A, 0xCA1C, 0xE50E, 0x8001, 0x5793, 0x2F28, 0x06BC, 0xDE52,
0xB5E6, 0x8D7B, 0x650C, 0x3CA1, 0x1435, 0xEBCB, 0xC35F, 0x9AF4,
0x7285, 0x4A1A, 0x21AE, 0xF944, 0xD0D8, 0xA86D, 0x3FFF, 0x0000,
0x0D7C, 0x1AF9, 0x2876, 0x35F3, 0x4370, 0x50ED, 0x5E6A, 0x6BE7,
0x7964, 0x86E3, 0x9460, 0xA1DD, 0xAF5A, 0xBCD7, 0xCA54, 0xD7D1,
0xE54E, 0xF2CB, 0xC001, 0x3FFF, 0x0000, 0x0D7B, 0x1AF7, 0x2873,
0x35EF, 0x436B, 0x50E6, 0x5E62, 0x6BDE, 0x795A, 0x86D9, 0x9455,
0xA1D0, 0xAF4C, 0xBCC8, 0xCA44, 0xD7C0, 0xE53B, 0xF2B7, 0xC001,
0x3FFF, 0xC001, 0xCD7A, 0xDAF2, 0xE86B, 0xF5E3, 0x035B, 0x10D3,
0x1E4C, 0x2BC4, 0x393D, 0x46B5, 0x542E, 0x61A6, 0x6F1F, 0x7C97,
0x8A13, 0x978B, 0xA504, 0xB27D, 0xC001, 0x3FFF, 0x4D79, 0x5AF2,
0x686C, 0x75E5, 0x8362, 0x90DB, 0x9E55, 0xABCF, 0xB948, 0xC6C2,
0xD43B, 0xE1B5, 0xEF2F, 0xFCA8, 0x0A21, 0x179A, 0x2514, 0x328D,
0xC001, 0x3FFF,
};
ROM_ASSET_LOAD_ANIM(amp_seg8_animvalue_08003E30, 0x001f2200, 59076, 0x00003e30, 324);

// 0x08003F74
static const u16 amp_seg8_animindex_08003F74[] = {
0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000,
0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x00A1,
0x0001, 0x0000, 0x0013, 0x008D, 0x0001, 0x00A0,
0x0001, 0x0000, 0x0001, 0x0000, 0x0013, 0x0001,
0x0001, 0x0000, 0x0013, 0x0079, 0x0001, 0x008C,
0x0001, 0x0014, 0x0001, 0x0000, 0x0013, 0x0015,
0x0001, 0x0000, 0x0013, 0x0064, 0x0001, 0x0077,
0x0001, 0x0000, 0x0001, 0x0000, 0x0013, 0x0028,
0x0001, 0x0000, 0x0013, 0x004F, 0x0001, 0x0062,
0x0001, 0x0000, 0x0001, 0x0000, 0x0013, 0x003B,
0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0078,
0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0063,
0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x004E,
};
ROM_ASSET_LOAD_ANIM(amp_seg8_animindex_08003F74, 0x001f2200, 59076, 0x00003f74, 168);

// 0x0800401C
static const struct Animation amp_seg8_anim_0800401C = {
Expand Down
Loading

0 comments on commit 663e454

Please sign in to comment.