Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split vanillla object from levels allowing pruning vanilla assets on fast64 imports and managing vanilla objects independently of levels #796

Open
wants to merge 6 commits into
base: develop/3.0.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
135 changes: 75 additions & 60 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -528,21 +528,26 @@ assets/demos/pss.bin
assets/demos/unused.bin
assets/demos/wf.bin
levels/bbh/0.rgba16.png
actors/vanilla_actors/bbh/0.rgba16.png
levels/bbh/1.rgba16.png
levels/bbh/2.rgba16.png
levels/bbh/3.rgba16.png
levels/bbh/4.rgba16.png
levels/bbh/5.rgba16.png
levels/bbh/6.rgba16.png
actors/vanilla_actors/bbh/4.rgba16.png
actors/vanilla_actors/bbh/5.rgba16.png
actors/vanilla_actors/bbh/6.rgba16.png
actors/vanilla_actors/bitdw/0.rgba16.png
levels/bitdw/0.rgba16.png
levels/bitdw/1.rgba16.png
levels/bitdw/2.rgba16.png
levels/bitdw/3.rgba16.png
actors/vanilla_actors/bitfs/0.rgba16.png
levels/bitfs/0.rgba16.png
actors/vanilla_actors/bitfs/1.rgba16.png
levels/bitfs/1.rgba16.png
levels/bitfs/2.rgba16.png
levels/bits/0.rgba16.png
levels/bits/1.rgba16.png
actors/vanilla_actors/bits/2.rgba16.png
levels/bits/2.rgba16.png
levels/bob/0.rgba16.png
levels/bob/1.rgba16.png
Expand All @@ -559,9 +564,9 @@ levels/bowser_3/2.rgba16.png
levels/castle_grounds/0.rgba16.png
levels/castle_grounds/1.rgba16.png
levels/castle_grounds/2.rgba16.png
levels/castle_grounds/3.rgba16.png
levels/castle_grounds/4.rgba16.png
levels/castle_grounds/5.ia8.png
actors/vanilla_actors/castle_grounds/3.rgba16.png
actors/vanilla_actors/castle_grounds/4.rgba16.png
actors/vanilla_actors/castle_grounds/5.ia8.png
levels/castle_inside/1.rgba16.png
levels/castle_inside/10.rgba16.png
levels/castle_inside/11.rgba16.png
Expand Down Expand Up @@ -599,22 +604,25 @@ levels/castle_inside/38.rgba16.png
levels/castle_inside/39.rgba16.png
levels/castle_inside/4.rgba16.png
levels/castle_inside/40.rgba16.png
levels/castle_inside/5.rgba16.png
levels/castle_inside/6.rgba16.png
levels/castle_inside/7.rgba16.png
actors/vanilla_actors/castle_inside/5.rgba16.png
actors/vanilla_actors/castle_inside/6.rgba16.png
actors/vanilla_actors/castle_inside/7.rgba16.png
levels/castle_inside/8.rgba16.png
levels/castle_inside/9.rgba16.png
actors/vanilla_actors/castle_inside/castle_light.ia16.png
levels/castle_inside/castle_light.ia16.png
levels/ccm/0.rgba16.png
levels/ccm/1.rgba16.png
actors/vanilla_actors/ccm/1.rgba16.png
levels/ccm/10.rgba16.png
levels/ccm/11.rgba16.png
levels/ccm/12.rgba16.png
actors/vanilla_actors/ccm/12.rgba16.png
levels/ccm/2.rgba16.png
levels/ccm/3.rgba16.png
actors/vanilla_actors/ccm/2.rgba16.png
actors/vanilla_actors/ccm/3.rgba16.png
levels/ccm/4.rgba16.png
levels/ccm/5.rgba16.png
levels/ccm/6.rgba16.png
actors/vanilla_actors/ccm/5.rgba16.png
actors/vanilla_actors/ccm/6.rgba16.png
levels/ccm/7.rgba16.png
levels/ccm/8.ia16.png
levels/ccm/9.ia16.png
Expand All @@ -623,11 +631,12 @@ levels/cotmc/1.rgba16.png
levels/cotmc/2.rgba16.png
levels/cotmc/3.rgba16.png
levels/cotmc/4.rgba16.png
levels/ddd/0.rgba16.png
actors/vanilla_actors/ddd/0.rgba16.png
levels/ddd/1.rgba16.png
levels/ddd/2.rgba16.png
actors/vanilla_actors/ddd/2.rgba16.png
levels/ddd/3.rgba16.png
levels/ddd/4.rgba16.png
actors/vanilla_actors/ddd/4.rgba16.png
levels/ending/cake.png
levels/ending/cake_eu.png
levels/ending/eu_023000.rgba16.png
Expand All @@ -639,10 +648,10 @@ levels/ending/eu_028000.rgba16.png
levels/hmc/0.rgba16.png
levels/hmc/1.rgba16.png
levels/hmc/2.rgba16.png
levels/hmc/3.rgba16.png
levels/hmc/4.rgba16.png
levels/hmc/5.rgba16.png
levels/hmc/6.rgba16.png
actors/vanilla_actors/hmc/3.rgba16.png
actors/vanilla_actors/hmc/4.rgba16.png
actors/vanilla_actors/hmc/5.rgba16.png
actors/vanilla_actors/hmc/6.rgba16.png
levels/hmc/7.rgba16.png
levels/intro/0.rgba16.png
levels/intro/1.rgba16.png
Expand All @@ -653,40 +662,41 @@ levels/intro/3_sh_tm.rgba16.png
levels/intro/3_tm.rgba16.png
levels/jrb/0.rgba16.png
levels/jrb/1.rgba16.png
levels/jrb/2.rgba16.png
levels/jrb/3.rgba16.png
levels/lll/0.rgba16.png
levels/lll/1.rgba16.png
levels/lll/10.rgba16.png
levels/lll/11.rgba16.png
levels/lll/12.rgba16.png
levels/lll/13.rgba16.png
levels/lll/14.rgba16.png
levels/lll/15.rgba16.png
levels/lll/16.rgba16.png
levels/lll/17.rgba16.png
levels/lll/18.rgba16.png
levels/lll/19.rgba16.png
levels/lll/2.rgba16.png
levels/lll/20.rgba16.png
levels/lll/21.rgba16.png
levels/lll/22.rgba16.png
levels/lll/23.rgba16.png
levels/lll/24.rgba16.png
levels/lll/25.rgba16.png
actors/vanilla_actors/jrb/2.rgba16.png
actors/vanilla_actors/jrb/3.rgba16.png
actors/vanilla_actors/lll/0.rgba16.png
actors/vanilla_actors/lll/1.rgba16.png
actors/vanilla_actors/lll/10.rgba16.png
actors/vanilla_actors/lll/11.rgba16.png
actors/vanilla_actors/lll/12.rgba16.png
actors/vanilla_actors/lll/13.rgba16.png
actors/vanilla_actors/lll/14.rgba16.png
actors/vanilla_actors/lll/15.rgba16.png
actors/vanilla_actors/lll/16.rgba16.png
actors/vanilla_actors/lll/17.rgba16.png
actors/vanilla_actors/lll/18.rgba16.png
actors/vanilla_actors/lll/19.rgba16.png
actors/vanilla_actors/lll/2.rgba16.png
actors/vanilla_actors/lll/20.rgba16.png
actors/vanilla_actors/lll/21.rgba16.png
actors/vanilla_actors/lll/22.rgba16.png
actors/vanilla_actors/lll/23.rgba16.png
actors/vanilla_actors/lll/24.rgba16.png
actors/vanilla_actors/lll/25.rgba16.png
levels/lll/26.rgba16.png
levels/lll/27.ia16.png
levels/lll/28.rgba16.png
levels/lll/29.rgba16.png
actors/vanilla_actors/lll/29.rgba16.png
levels/lll/3.rgba16.png
levels/lll/30.rgba16.png
levels/lll/31.rgba16.png
levels/lll/32.rgba16.png
levels/lll/4.rgba16.png
levels/lll/5.rgba16.png
levels/lll/6.rgba16.png
actors/vanilla_actors/lll/6.rgba16.png
levels/lll/7.rgba16.png
levels/lll/8.rgba16.png
actors/vanilla_actors/lll/8.rgba16.png
levels/lll/9.rgba16.png
levels/menu/main_menu_seg7.00018.rgba16.png
levels/menu/main_menu_seg7.00818.rgba16.png
Expand Down Expand Up @@ -921,59 +931,64 @@ levels/menu/main_menu_seg7_us.0B800.ia8.png
levels/pss/0.rgba16.png
levels/pss/1.ia16.png
levels/pss/2.rgba16.png
levels/rr/1.rgba16.png
actors/vanilla_actors/rr/1.rgba16.png
levels/rr/2.rgba16.png
levels/rr/quarter_flying_carpet.rgba16.png
actors/vanilla_actors/rr/quarter_flying_carpet.rgba16.png
levels/sl/0.rgba16.png
levels/sl/1.rgba16.png
levels/sl/2.rgba16.png
actors/vanilla_actors/sl/2.rgba16.png
levels/sl/3.rgba16.png
levels/sl/4.rgba16.png
levels/ssl/0.rgba16.png
levels/ssl/1.ia16.png
levels/ssl/10.rgba16.png
levels/ssl/11.rgba16.png
actors/vanilla_actors/ssl/10.rgba16.png
actors/vanilla_actors/ssl/11.rgba16.png
levels/ssl/2.rgba16.png
levels/ssl/3.rgba16.png
levels/ssl/4.rgba16.png
levels/ssl/5.rgba16.png
levels/ssl/6.rgba16.png
actors/vanilla_actors/ssl/5.rgba16.png
actors/vanilla_actors/ssl/6.rgba16.png
levels/ssl/7.rgba16.png
levels/ssl/8.rgba16.png
levels/ssl/9.rgba16.png
actors/vanilla_actors/ssl/8.rgba16.png
actors/vanilla_actors/ssl/9.rgba16.png
levels/thi/0.rgba16.png
levels/thi/1.rgba16.png
actors/vanilla_actors/thi/1.rgba16.png
levels/totwc/0.rgba16.png
levels/totwc/1.rgba16.png
levels/totwc/2.rgba16.png
levels/totwc/3.ia16.png
levels/ttc/0.rgba16.png
actors/vanilla_actors/ttc/0.rgba16.png
actors/vanilla_actors/ttc/1.rgba16.png
levels/ttc/1.rgba16.png
levels/ttc/2.rgba16.png
levels/ttm/0.ia16.png
levels/ttm/1.rgba16.png
levels/ttm/2.rgba16.png
levels/ttm/3.rgba16.png
levels/ttm/4.rgba16.png
actors/vanilla_actors/ttm/4.rgba16.png
levels/ttm/5.rgba16.png
levels/ttm/6.rgba16.png
levels/ttm/7.rgba16.png
levels/ttm/8.rgba16.png
actors/vanilla_actors/ttm/8.rgba16.png
levels/vcutm/0.rgba16.png
levels/vcutm/1.rgba16.png
levels/vcutm/2.rgba16.png
actors/vanilla_actors/vcutm/2.rgba16.png
levels/vcutm/3.rgba16.png
levels/wdw/0.rgba16.png
levels/wdw/1.rgba16.png
levels/wdw/2.rgba16.png
levels/wdw/3.rgba16.png
actors/vanilla_actors/wdw/1.rgba16.png
actors/vanilla_actors/wdw/2.rgba16.png
actors/vanilla_actors/wdw/3.rgba16.png
levels/wdw/4.rgba16.png
actors/vanilla_actors/wf/0.rgba16.png
levels/wf/0.rgba16.png
levels/wf/1.rgba16.png
actors/vanilla_actors/wf/2.rgba16.png
levels/wf/2.rgba16.png
levels/wf/3.rgba16.png
levels/wf/4.rgba16.png
levels/wf/5.ia8.png
actors/vanilla_actors/wf/3.rgba16.png
actors/vanilla_actors/wf/4.rgba16.png
actors/vanilla_actors/wf/5.ia8.png
levels/wmotr/0.rgba16.png
levels/wmotr/1.rgba16.png
levels/wmotr/2.rgba16.png
Expand Down
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ SOUND_BIN_DIR := $(BUILD_DIR)/sound
TEXTURE_DIR := textures
ACTOR_DIR := actors
LEVEL_DIRS := $(patsubst levels/%,%,$(dir $(wildcard levels/*/header.h)))
VNL_ACTRS_DIRS := $(patsubst actors/vanilla_actors/%,%,$(dir $(wildcard actors/vanilla_actors/*/header.h)))

# Directories containing source files
SRC_DIRS += src src/boot src/game src/engine src/audio src/menu src/buffers actors levels bin data assets asm lib sound
Expand All @@ -392,7 +393,8 @@ include Makefile.split

# Source code files
LEVEL_C_FILES := $(wildcard levels/*/leveldata.c) $(wildcard levels/*/script.c) $(wildcard levels/*/geo.c)
C_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c)) $(LEVEL_C_FILES)
VNL_ACTRS_C_FILES := $(wildcard actors/vanilla_actors/*/data.c) $(wildcard actors/vanilla_actors/*/geo.c)
C_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c)) $(LEVEL_C_FILES) $(VNL_ACTRS_C_FILES)
CPP_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.cpp))
LIBZ_C_FILES := $(foreach dir,$(LIBZ_SRC_DIRS),$(wildcard $(dir)/*.c))
GODDARD_C_FILES := $(foreach dir,$(GODDARD_SRC_DIRS),$(wildcard $(dir)/*.c))
Expand Down Expand Up @@ -662,7 +664,7 @@ $(BUILD_DIR)/src/game/rendering_graph_node.o: OPT_FLAGS := $(GRAPH_NODE_OPT_FLAG
# $(info MATH_UTIL_OPT_FLAGS: $(MATH_UTIL_OPT_FLAGS))
# $(info GRAPH_NODE_OPT_FLAGS: $(GRAPH_NODE_OPT_FLAGS))

ALL_DIRS := $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(SRC_DIRS) asm/debug $(GODDARD_SRC_DIRS) $(LIBZ_SRC_DIRS) $(ULTRA_BIN_DIRS) $(BIN_DIRS) $(TEXTURE_DIRS) $(SOUND_SAMPLE_DIRS) $(addprefix levels/,$(LEVEL_DIRS)) rsp include) $(YAY0_DIR) $(addprefix $(YAY0_DIR)/,$(VERSION)) $(SOUND_BIN_DIR) $(SOUND_BIN_DIR)/sequences/$(VERSION)
ALL_DIRS := $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(SRC_DIRS) asm/debug $(GODDARD_SRC_DIRS) $(LIBZ_SRC_DIRS) $(ULTRA_BIN_DIRS) $(BIN_DIRS) $(TEXTURE_DIRS) $(SOUND_SAMPLE_DIRS) $(addprefix levels/,$(LEVEL_DIRS)) $(addprefix actors/vanilla_actors/,$(VNL_ACTRS_DIRS)) rsp include) $(YAY0_DIR) $(addprefix $(YAY0_DIR)/,$(VERSION)) $(SOUND_BIN_DIR) $(SOUND_BIN_DIR)/sequences/$(VERSION)

# Make sure build directory exists before compiling anything
DUMMY != mkdir -p $(ALL_DIRS)
Expand Down Expand Up @@ -711,6 +713,11 @@ $(LEVEL_ELF_FILES): $(BUILD_DIR)/levels/%/leveldata.elf: $(BUILD_DIR)/levels/%/l
$(call print,Linking ELF file:,$<,$@)
$(V)$(LD) -e 0 -Ttext=$(SEGMENT_ADDRESS) -Map [email protected] --just-symbols=$(BUILD_DIR)/bin/$(TEXTURE_BIN).elf -o $@ $<

.SECONDEXPANSION:
$(VANILLA_ACTORS_ELF_FILES): $(BUILD_DIR)/actors/vanilla_actors/%/data.elf: $(BUILD_DIR)/actors/vanilla_actors/%/data.o $(BUILD_DIR)/bin/$$(TEXTURE_BIN).elf
$(call print,Linking ELF file:,$<,$@)
$(V)$(LD) -e 0 -Ttext=$(SEGMENT_ADDRESS) -Map [email protected] --just-symbols=$(BUILD_DIR)/bin/$(TEXTURE_BIN).elf -o $@ $<

$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf
$(call print,Extracting compressible data from:,$<,$@)
$(V)$(EXTRACT_DATA_FOR_MIO) $< $@
Expand Down
53 changes: 46 additions & 7 deletions Makefile.split
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,21 @@ LEVEL_FILES := $(addsuffix leveldata,$(LEVEL_DIRS))

LEVEL_ELF_FILES := $(foreach level_dir,$(LEVEL_DIRS),$(BUILD_DIR)/levels/$(level_dir)leveldata.elf)

VANILLA_ACTORS_FILES := $(addsuffix data,$(VNL_ACTRS_DIRS))

VANILLA_ACTORS_ELF_FILES := $(foreach level_dir,$(VNL_ACTRS_DIRS),$(BUILD_DIR)/actors/vanilla_actors/$(level_dir)data.elf)

SEG_FILES := \
$(SEGMENTS:%=$(BUILD_DIR)/bin/%.elf) \
$(ACTOR_GROUPS:%=$(BUILD_DIR)/actors/%.elf) \
$(LEVEL_FILES:%=$(BUILD_DIR)/levels/%.elf)
$(LEVEL_FILES:%=$(BUILD_DIR)/levels/%.elf) \
$(VANILLA_ACTORS_FILES:%=$(BUILD_DIR)/actors/vanilla_actors/%.elf)

YAY0_FILES := \
$(SEGMENTS:%=$(BUILD_DIR)/bin/%.szp) \
$(ACTOR_GROUPS:%=$(BUILD_DIR)/actors/%.szp) \
$(LEVEL_FILES:%=$(BUILD_DIR)/levels/%.szp)
$(LEVEL_FILES:%=$(BUILD_DIR)/levels/%.szp) \
$(VANILLA_ACTORS_FILES:%=$(BUILD_DIR)/actors/vanilla_actors/%.szp)

YAY0_OBJ_FILES := $(YAY0_FILES:.szp=.szp.o)

Expand Down Expand Up @@ -243,11 +249,11 @@ $(BUILD_DIR)/bin/machine.elf: SEGMENT_ADDRESS := 0x09000000
$(BUILD_DIR)/bin/mountain.elf: SEGMENT_ADDRESS := 0x09000000
$(BUILD_DIR)/bin/grass.elf: SEGMENT_ADDRESS := 0x09000000
# EU segment 19 translations
$(BUILD_DIR)/bin/translation_de.elf: SEGMENT_ADDRESS := 0x19000000
$(BUILD_DIR)/bin/translation_en.elf: SEGMENT_ADDRESS := 0x19000000
$(BUILD_DIR)/bin/translation_fr.elf: SEGMENT_ADDRESS := 0x19000000
$(BUILD_DIR)/bin/translation_jp.elf: SEGMENT_ADDRESS := 0x19000000
$(BUILD_DIR)/bin/translation_es.elf: SEGMENT_ADDRESS := 0x19000000
$(BUILD_DIR)/bin/translation_de.elf: SEGMENT_ADDRESS := 0x1B000000
$(BUILD_DIR)/bin/translation_en.elf: SEGMENT_ADDRESS := 0x1B000000
$(BUILD_DIR)/bin/translation_fr.elf: SEGMENT_ADDRESS := 0x1B000000
$(BUILD_DIR)/bin/translation_jp.elf: SEGMENT_ADDRESS := 0x1B000000
$(BUILD_DIR)/bin/translation_es.elf: SEGMENT_ADDRESS := 0x1B000000

# --------------------------------------
# Skybox Rules
Expand All @@ -272,3 +278,36 @@ IPL3_RAW_FILES := $(addprefix $(BUILD_DIR)/,$(patsubst %.png,%,$(IP

CRASH_TEXTURE_FILES := $(wildcard $(TEXTURE_DIR)/crash_custom/*.png)
CRASH_TEXTURE_C_FILES := $(addprefix $(BUILD_DIR)/,$(patsubst %.png,%.inc.c,$(CRASH_TEXTURE_FILES)))

# --------------------------------------
# Vanilla Objects Rules
# --------------------------------------

define vanilla_objects_rules =
VANILLA_ACTORS_$(1)_TEXTURE_FILES := $$(patsubst %.png,%.inc.c,$$(wildcard actors/vanilla_actors/$(1)/*.png))
$$(BUILD_DIR)/actors/vanilla_actors/$(1)/data.o: $$(addprefix $$(BUILD_DIR)/,$$(VANILLA_ACTORS_$(1)_TEXTURE_FILES))
$$(BUILD_DIR)/actors/vanilla_actors/$(1)/data.elf: SEGMENT_ADDRESS := 0x0e000000
$$(BUILD_DIR)/actors/vanilla_actors/$(1)/data.elf: TEXTURE_BIN := $(2)
endef

$(eval $(call vanilla_objects_rules,bob,generic))
$(eval $(call vanilla_objects_rules,wf,grass))
$(eval $(call vanilla_objects_rules,jrb,water))
$(eval $(call vanilla_objects_rules,ccm,snow))
$(eval $(call vanilla_objects_rules,bbh,spooky))
$(eval $(call vanilla_objects_rules,hmc,cave))
$(eval $(call vanilla_objects_rules,lll,fire))
$(eval $(call vanilla_objects_rules,ssl,generic))
$(eval $(call vanilla_objects_rules,ddd,water))
$(eval $(call vanilla_objects_rules,sl,snow))
$(eval $(call vanilla_objects_rules,wdw,grass))
$(eval $(call vanilla_objects_rules,ttm,mountain))
$(eval $(call vanilla_objects_rules,thi,grass))
$(eval $(call vanilla_objects_rules,ttc,machine))
$(eval $(call vanilla_objects_rules,rr,sky))
$(eval $(call vanilla_objects_rules,bitdw,sky))
$(eval $(call vanilla_objects_rules,bitfs,sky))
$(eval $(call vanilla_objects_rules,bits,sky))
$(eval $(call vanilla_objects_rules,vcutm,outside))
$(eval $(call vanilla_objects_rules,castle_inside,inside))
$(eval $(call vanilla_objects_rules,castle_grounds,outside))
3 changes: 3 additions & 0 deletions actors/group4.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,7 @@ extern const struct Animation *const unagi_seg5_anims_05012824[];
extern const Gfx whirlpool_seg5_dl_05013B58[];
extern const Gfx whirlpool_seg5_dl_05013CB8[];

extern const Trajectory jrb_seg7_trajectory_unagi_1[];
extern const Trajectory jrb_seg7_trajectory_unagi_2[];

#endif
Loading