mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2024-10-07 02:24:01 +00:00
de46f99e2e
This aims to deprecate all the Splat tools in `tools/splat_ext` in favour of a more centralised asset manager. This brings the following advantages: * Much faster extraction * Faster build * Automatically define `static` symbols or unique names whenever `static` is not possible * Allow to embed assets into the output binary * Drastically simplify `Makefile` by removing all the asset build rules * Avoid situations where it is not possible to extract and build assets that is not 4-byte aligned This is achieved by having the splat YAML targeting a normal C file as data and have an external tool to take care of the following: 1. Extract asset files straight from the overlay binary file into human readable file in `assets/st/STAGE_NAME` 2. Build assets as header files that go into `src/st/STAGE_NAME` to just include them from any C file This requires each stage header to have the following new format: please see `src/st/nz0/header.c` Built assets in `src/st` are ignored by Git. As for now, for simplicity sake, the steps `make extract_assets` and `make build_assets` are just executed within `make extract` exclusively for the US version. I plan to auto-generate files such as `src/st/nz0/tile_data.c`. For a first iteration I am aiming to handle the following: * [X] Extract rooms: `assets/st/*/rooms.json` * [X] Extract room layers: `assets/st/*/entity_layouts.json` * [X] Extract tilemap data: `assets/st/*/tilemap_*.bin` * [X] Extract tilemap definitions: `assets/st/*/tiledef_*.json` * [X] Extract sprites: `assets/st/*/sprites.json` * [x] Extract entity layouts * [X] Build rooms: `src/st/*/rooms.h` * [X] Build room layers: `src/st/*/layers.h` * [X] Build tilemap data: `src/st/*/tilemap_*.h` * [X] Build tilemap definitions: `src/st/*/tiledef_*.h` * [x] Build sprites (aka `g_SpriteBanks`) * [x] Build entity layouts * [x] Allow the tool to suggest how to adjust the Splat config for each overlay I want the tool to cover the following stages: * [x] CEN * [x] DRE * ~MAD~ I do not think this can be done, it is way too different from the other overlays * [x] NO3 * [x] NP3 * [X] NZ0 * [x] ST0 * [X] WRP * [x] RWRP * ~WRP (PSP)~ Maybe in a follow-up PR For a later iteration I plan on extracting and build: * Entity GFX thingie * The CLUT thingie in the header * Uncompressed GFX data * Cutscene data * Blueprints * The `src/config_us.h` thingie --------- Co-authored-by: Josh Lory <josh.lory@outlook.com>
88 lines
4.5 KiB
Makefile
88 lines
4.5 KiB
Makefile
# configuration
|
|
PSX_OVLS := dra ric weapon
|
|
PSX_KSTAGES := cen dre mad no3 np3 nz0 sel st0 wrp
|
|
PSX_RSTAGES := rwrp
|
|
PSX_ALLSTAGES := $(addprefix st,$(PSX_KSTAGES)) $(addprefix st,$(PSX_RSTAGES))
|
|
PSX_SERVANTS := tt_000
|
|
PSX_US_TARGETS := main $(PSX_OVLS) $(PSX_ALLSTAGES) $(PSX_SERVANTS)
|
|
PSX_HD_TARGETS := dra tt_000
|
|
|
|
# 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)))
|
|
|
|
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)/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 $@
|
|
|
|
extract_assets: $(SOTNASSETS)
|
|
$(SOTNASSETS) extract -stage_ovl disks/$(VERSION)/ST/CEN/CEN.BIN -o assets/st/cen
|
|
$(SOTNASSETS) extract -stage_ovl disks/$(VERSION)/ST/DRE/DRE.BIN -o assets/st/dre
|
|
$(SOTNASSETS) extract -stage_ovl disks/$(VERSION)/ST/NO3/NO3.BIN -o assets/st/no3
|
|
$(SOTNASSETS) extract -stage_ovl disks/$(VERSION)/ST/NP3/NP3.BIN -o assets/st/np3
|
|
$(SOTNASSETS) extract -stage_ovl disks/$(VERSION)/ST/NZ0/NZ0.BIN -o assets/st/nz0
|
|
$(SOTNASSETS) extract -stage_ovl disks/$(VERSION)/ST/ST0/ST0.BIN -o assets/st/st0
|
|
$(SOTNASSETS) extract -stage_ovl disks/$(VERSION)/ST/WRP/WRP.BIN -o assets/st/wrp
|
|
$(SOTNASSETS) extract -stage_ovl disks/$(VERSION)/ST/RWRP/RWRP.BIN -o assets/st/rwrp
|
|
build_assets: $(SOTNASSETS)
|
|
$(SOTNASSETS) build_all -i assets/st/cen -o src/st/cen/
|
|
$(SOTNASSETS) build_all -i assets/st/dre -o src/st/dre/
|
|
$(SOTNASSETS) build_all -i assets/st/no3 -o src/st/no3/
|
|
$(SOTNASSETS) build_all -i assets/st/np3 -o src/st/np3/
|
|
$(SOTNASSETS) build_all -i assets/st/nz0 -o src/st/nz0/
|
|
$(SOTNASSETS) build_all -i assets/st/st0 -o src/st/st0/
|
|
$(SOTNASSETS) build_all -i assets/st/wrp -o src/st/wrp/
|
|
$(SOTNASSETS) build_all -i assets/st/rwrp -o src/st/rwrp/
|
|
|
|
$(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
|