mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2024-11-23 04:59:41 +00:00
f9feecf70b
Decided to tackle this whole file. It mostly matches with the existing DRA, so I've been back-porting the required changes to get the matches. Everything here matches in both. The only issue is the deadstripping, which we still need to figure out. I'm not sure why there's a file split at the end of this PSP file, where there isn't one in the PS1 game. I'll try removing the split once the functions are done on each side of the split. Also adjusted the makefile filter logic so that we only need to give the name of the file, rather than the full path. This makes the file list more concise. If we run into collisions (two files of the same name, in different overlays, which need different optimizations) we can revisit this.
123 lines
5.9 KiB
Makefile
123 lines
5.9 KiB
Makefile
LD := $(CROSS)ld
|
|
|
|
# flags
|
|
AS_FLAGS += -Iinclude -march=r3000 -mtune=r3000 -no-pad-sections -O1 -G0
|
|
PSXCC_FLAGS := -quiet -mcpu=3000 -fgnu-linker -mgas -gcoff
|
|
|
|
# configuration
|
|
PSX_OVLS := dra ric weapon
|
|
PSX_KSTAGES := cen dre mad no0 no3 np3 nz0 sel st0 wrp
|
|
PSX_RSTAGES := rwrp
|
|
PSX_BOSTAGES := mar
|
|
PSX_RBOSTAGES := rbo3
|
|
PSX_ALLSTAGES := $(addprefix st,$(PSX_KSTAGES)) $(addprefix st,$(PSX_RSTAGES)) $(addprefix bo,$(PSX_BOSTAGES)) $(addprefix bo,$(PSX_RBOSTAGES))
|
|
PSX_SERVANTS := tt_000 tt_001 tt_002
|
|
PSX_US_TARGETS := main $(PSX_OVLS) $(PSX_ALLSTAGES) $(PSX_SERVANTS)
|
|
PSX_HD_TARGETS := dra ric tt_000 stcen stwrp
|
|
|
|
# immovable
|
|
PSX_BASE_SYMS := $(CONFIG_DIR)/symbols.$(VERSION).txt
|
|
|
|
extract_us: $(addprefix $(BUILD_DIR)/,$(addsuffix .ld,$(PSX_US_TARGETS)))
|
|
$(PNG2S) bdecode config/gfx.game.json disks/us assets/game
|
|
make extract_assets
|
|
make build_assets
|
|
extract_hd: $(addprefix $(BUILD_DIR)/,$(addsuffix .ld,$(PSX_HD_TARGETS)))
|
|
make extract_assets
|
|
make build_assets
|
|
|
|
extract_disk_us: extract_disk_psxus
|
|
extract_disk_hd: extract_disk_pspeu
|
|
extract_disk_psx%: $(SOTNDISK)
|
|
$(SOTNDISK) extract disks/sotn.$*.cue disks/$*
|
|
|
|
# todo: these should have an explicit dependency on extract disk
|
|
$(BUILD_DIR)/main.ld: $(CONFIG_DIR)/splat.$(VERSION).main.yaml | main_dirs
|
|
$(SPLAT) $<
|
|
touch $@
|
|
# todo: these should have an explicit dependency on extract disk
|
|
$(BUILD_DIR)/dra.ld: $(CONFIG_DIR)/splat.$(VERSION).dra.yaml $(PSX_BASE_SYMS) $(CONFIG_DIR)/symbols.$(VERSION).dra.txt | dra_dirs
|
|
$(SPLAT) $<
|
|
touch $@
|
|
# todo: these should have an explicit dependency on extract disk
|
|
$(BUILD_DIR)/ric.ld: $(CONFIG_DIR)/splat.$(VERSION).ric.yaml $(PSX_BASE_SYMS) $(CONFIG_DIR)/symbols.$(VERSION).ric.txt | ric_dirs
|
|
$(SPLAT) $<
|
|
touch $@
|
|
# todo: these should have an explicit dependency on extract disk
|
|
$(BUILD_DIR)/stmad.ld: $(CONFIG_DIR)/splat.$(VERSION).stmad.yaml $(CONFIG_DIR)/symbols.beta.txt $(CONFIG_DIR)/symbols.stmad.txt | stmad_dirs
|
|
$(SPLAT) $<
|
|
$(GFXSTAGE) d disks/$(VERSION)/ST/MAD/F_MAD.BIN $(ASSETS_DIR)/st/mad
|
|
# todo: these should have an explicit dependency on extract disk
|
|
$(BUILD_DIR)/st%.ld: $(CONFIG_DIR)/splat.$(VERSION).st%.yaml $(PSX_BASE_SYMS) $(CONFIG_DIR)/symbols.$(VERSION).st%.txt | st%_dirs
|
|
$(SPLAT) $<
|
|
$(GFXSTAGE) d disks/$(VERSION)/ST/$$(echo '$*' | tr '[:lower:]' '[:upper:]')/F_$$(echo '$*' | tr '[:lower:]' '[:upper:]').BIN $(ASSETS_DIR)/st/$*
|
|
$(BUILD_DIR)/bo%.ld: $(CONFIG_DIR)/splat.$(VERSION).bo%.yaml $(PSX_BASE_SYMS) $(CONFIG_DIR)/symbols.$(VERSION).bo%.txt | bo%_dirs
|
|
$(SPLAT) $<
|
|
$(GFXSTAGE) d disks/$(VERSION)/BOSS/$$(echo '$*' | tr '[:lower:]' '[:upper:]')/F_$$(echo '$*' | tr '[:lower:]' '[:upper:]').BIN $(ASSETS_DIR)/boss/$*
|
|
build/hd/st%.ld: $(CONFIG_DIR)/splat.$(VERSION).st%.yaml $(PSX_BASE_SYMS) $(CONFIG_DIR)/symbols.$(VERSION).st%.txt | st%_dirs
|
|
$(SPLAT) $<
|
|
$(GFXSTAGE) d disks/pspeu/PSP_GAME/USRDIR/res/ps/hdbin/f_$*.bin $(ASSETS_DIR)/st/$*
|
|
$(BUILD_DIR)/tt_%.ld: $(CONFIG_DIR)/splat.$(VERSION).tt_%.yaml $(PSX_BASE_SYMS) $(CONFIG_DIR)/symbols.$(VERSION).tt_%.txt | tt_%_dirs
|
|
$(SPLAT) $<
|
|
touch $@
|
|
$(BUILD_DIR)/weapon.ld: $(CONFIG_DIR)/splat.$(VERSION).weapon.yaml $(PSX_BASE_SYMS) $(CONFIG_DIR)/symbols.$(VERSION).weapon.txt $(CONFIG_DIR)/symbols.$(VERSION).weapon.txt.in
|
|
$(SPLAT) $<
|
|
touch $@
|
|
|
|
$(BUILD_DIR)/$(DRA).elf: $(call list_o_files,dra)
|
|
echo $(call list_o_files,dra)
|
|
$(call link,dra,$@)
|
|
|
|
$(BUILD_DIR)/src/st/sel/%.c.o: src/st/sel/%.c $(MASPSX_APP) $(CC1PSX) src/st/sel/sel.h | stsel_dirs
|
|
$(CPP) $(CPP_FLAGS) -lang-c $< | $(SOTNSTR) | $(ICONV) | $(CC) $(CC_FLAGS) $(PSXCC_FLAGS) | $(MASPSX) | $(AS) $(AS_FLAGS) -o $@
|
|
|
|
$(BUILD_DIR)/$(ASSETS_DIR)/weapon/%_1.animset.o: $(ASSETS_DIR)/weapon/%_1.animset.json
|
|
./tools/splat_ext/animset.py gen-asm $< $(BUILD_DIR)/$(ASSETS_DIR)/weapon/$*_1.animset.s -s g_Animset
|
|
$(AS) $(AS_FLAGS) -o $@ $(BUILD_DIR)/$(ASSETS_DIR)/weapon/$*_1.animset.s
|
|
$(BUILD_DIR)/$(ASSETS_DIR)/weapon/%_2.animset.o: $(ASSETS_DIR)/weapon/%_2.animset.json
|
|
./tools/splat_ext/animset.py gen-asm $< $(BUILD_DIR)/$(ASSETS_DIR)/weapon/$*_2.animset.s -s g_Animset2
|
|
$(AS) $(AS_FLAGS) -o $@ $(BUILD_DIR)/$(ASSETS_DIR)/weapon/$*_2.animset.s
|
|
|
|
# assembly and c files
|
|
$(BUILD_DIR)/%.s.o: %.s
|
|
mkdir -p $(dir $@)
|
|
$(AS) $(AS_FLAGS) -o $@ $<
|
|
|
|
$(BUILD_DIR)/%.c.o: %.c $(MASPSX_APP) $(CC1PSX)
|
|
mkdir -p $(dir $@)
|
|
$(CPP) $(CPP_FLAGS) -lang-c $< | $(SOTNSTR) | $(ICONV) | $(CC) $(CC_FLAGS) $(PSXCC_FLAGS) | $(MASPSX) | $(AS) $(AS_FLAGS) -o $@
|
|
|
|
$(BUILD_DIR)/$(SRC_DIR)/main/psxsdk/libgpu/sys.c.o: $(SRC_DIR)/main/psxsdk/libgpu/sys.c $(MASPSX_APP) $(CC1PSX)
|
|
$(CPP) $(CPP_FLAGS) -lang-c $< | $(SOTNSTR) | $(ICONV) | $(CC) $(CC_FLAGS) $(PSXCC_FLAGS) | $(MASPSX_21) | $(AS) $(AS_FLAGS) -o $@
|
|
|
|
extract_assets: $(SOTNASSETS)
|
|
cd tools/sotn-assets; $(GO) install
|
|
$(SOTNASSETS) extract config/assets.$(VERSION).yaml
|
|
build_assets: $(SOTNASSETS)
|
|
$(SOTNASSETS) build config/assets.$(VERSION).yaml
|
|
|
|
$(BUILD_DIR)/assets/dra/memcard_%.png.o: assets/dra/memcard_%.png
|
|
mkdir -p $(dir $@)
|
|
$(PNG2S) encode $< \
|
|
$(BUILD_DIR)/assets/dra/memcard_$*.png.s g_saveIcon$* \
|
|
$(BUILD_DIR)/assets/dra/memcard_$*.pal.s g_saveIconPal$*
|
|
$(AS) $(AS_FLAGS) -o $(BUILD_DIR)/assets/dra/memcard_$*.png.o $(BUILD_DIR)/assets/dra/memcard_$*.png.s
|
|
rm $(BUILD_DIR)/assets/dra/memcard_$*.png.s
|
|
$(AS) $(AS_FLAGS) -o $(BUILD_DIR)/assets/dra/memcard_$*.pal.o $(BUILD_DIR)/assets/dra/memcard_$*.pal.s
|
|
rm $(BUILD_DIR)/assets/dra/memcard_$*.pal.s
|
|
$(BUILD_DIR)/assets/st/sel/memcard_%.png.o: assets/st/sel/memcard_%.png
|
|
mkdir -p $(dir $@)
|
|
$(PNG2S) encode $< \
|
|
$(BUILD_DIR)/assets/st/sel/memcard_$*.png.s g_saveIcon$* \
|
|
$(BUILD_DIR)/assets/st/sel/memcard_$*.pal.s g_saveIconPal$*
|
|
$(AS) $(AS_FLAGS) -o $(BUILD_DIR)/assets/st/sel/memcard_$*.png.o $(BUILD_DIR)/assets/st/sel/memcard_$*.png.s
|
|
rm $(BUILD_DIR)/assets/st/sel/memcard_$*.png.s
|
|
$(AS) $(AS_FLAGS) -o $(BUILD_DIR)/assets/st/sel/memcard_$*.pal.o $(BUILD_DIR)/assets/st/sel/memcard_$*.pal.s
|
|
rm $(BUILD_DIR)/assets/st/sel/memcard_$*.pal.s
|
|
|
|
|
|
# anything from MAD is an exception and it should be ignored
|
|
$(BUILD_DIR)/$(ASSETS_DIR)/st/mad/%.o:
|
|
touch $@
|
|
|