mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-02 22:14:33 +00:00
Set up multiversion assets with ZAPD and match gc-eu (#1967)
* Add ZAPD hack to deal with extracted/VERSION/ in include paths
* Extract assets to extracted/VERSION
* Add ZAPD flags to override virtual address / start offset / end offset
* Configure offsets for code and overlay assets
* Reorganize ZAPD configs
* Match gc-eu-mq
* Match gc-eu
* Remove old asset dirs during distclean
* Revert "Remove old asset dirs during distclean"
This reverts commit fc8027a75f
.
* make zapd addresses globals int64_t so they can store uint32_t addresses and -1
* slight cleanup extract_assets.py
* git subrepo pull --force tools/ZAPD
subrepo:
subdir: "tools/ZAPD"
merged: "0285e11f0"
upstream:
origin: "https://github.com/zeldaret/ZAPD.git"
branch: "master"
commit: "0285e11f0"
git-subrepo:
version: "0.4.6"
origin: "git@github.com:ingydotnet/git-subrepo.git"
commit: "110b9eb"
---------
Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
This commit is contained in:
parent
b2d80568b9
commit
9def6f4d0d
92 changed files with 4911 additions and 487 deletions
47
Makefile
47
Makefile
|
@ -15,10 +15,11 @@ ORIG_COMPILER := 0
|
|||
# If COMPILER is "gcc", compile with GCC instead of IDO.
|
||||
COMPILER := ido
|
||||
# Target game version. Currently the following versions are supported:
|
||||
# gc-eu GameCube Europe/PAL
|
||||
# gc-eu-mq GameCube Europe/PAL Master Quest
|
||||
# gc-eu-mq-dbg GameCube Europe/PAL Master Quest Debug (default)
|
||||
# The following versions are work-in-progress and not yet matching:
|
||||
# gc-eu GameCube Europe/PAL
|
||||
# (none currently)
|
||||
VERSION := gc-eu-mq-dbg
|
||||
# Number of threads to extract and compress with
|
||||
N_THREADS := $(shell nproc)
|
||||
|
@ -53,7 +54,6 @@ endif
|
|||
# Version-specific settings
|
||||
ifeq ($(VERSION),gc-eu)
|
||||
DEBUG := 0
|
||||
COMPARE := 0
|
||||
else ifeq ($(VERSION),gc-eu-mq)
|
||||
DEBUG := 0
|
||||
CPP_DEFINES += -DOOT_MQ
|
||||
|
@ -211,11 +211,12 @@ else
|
|||
SRC_DIRS := $(shell find src -type d)
|
||||
endif
|
||||
|
||||
ASSET_BIN_DIRS := $(shell find assets/* -type d -not -path "assets/xml*" -not -path "assets/text")
|
||||
ASSET_FILES_XML := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.xml))
|
||||
# create extracted directories
|
||||
$(shell mkdir -p $(EXTRACTED_DIR) $(EXTRACTED_DIR)/assets $(EXTRACTED_DIR)/text)
|
||||
|
||||
ASSET_BIN_DIRS := $(shell find $(EXTRACTED_DIR)/assets -type d)
|
||||
ASSET_FILES_BIN := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.bin))
|
||||
ASSET_FILES_OUT := $(foreach f,$(ASSET_FILES_XML:.xml=.c),$f) \
|
||||
$(foreach f,$(ASSET_FILES_BIN:.bin=.bin.inc.c),$(BUILD_DIR)/$f) \
|
||||
ASSET_FILES_OUT := $(foreach f,$(ASSET_FILES_BIN:.bin=.bin.inc.c),$(f:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%)) \
|
||||
$(foreach f,$(wildcard assets/text/*.c),$(BUILD_DIR)/$(f:.c=.o))
|
||||
|
||||
UNDECOMPILED_DATA_DIRS := $(shell find data -type d)
|
||||
|
@ -223,10 +224,12 @@ UNDECOMPILED_DATA_DIRS := $(shell find data -type d)
|
|||
BASEROM_BIN_FILES := $(wildcard $(EXTRACTED_DIR)/baserom/*)
|
||||
|
||||
# source files
|
||||
C_FILES := $(filter-out %.inc.c,$(foreach dir,$(SRC_DIRS) $(ASSET_BIN_DIRS),$(wildcard $(dir)/*.c)))
|
||||
SRC_C_FILES := $(filter-out %.inc.c,$(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c)))
|
||||
ASSET_C_FILES := $(filter-out %.inc.c,$(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.c)))
|
||||
S_FILES := $(foreach dir,$(SRC_DIRS) $(UNDECOMPILED_DATA_DIRS),$(wildcard $(dir)/*.s))
|
||||
O_FILES := $(foreach f,$(S_FILES:.s=.o),$(BUILD_DIR)/$f) \
|
||||
$(foreach f,$(C_FILES:.c=.o),$(BUILD_DIR)/$f) \
|
||||
$(foreach f,$(SRC_C_FILES:.c=.o),$(BUILD_DIR)/$f) \
|
||||
$(foreach f,$(ASSET_C_FILES:.c=.o),$(f:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%)) \
|
||||
$(foreach f,$(BASEROM_BIN_FILES),$(BUILD_DIR)/baserom/$(notdir $f).o)
|
||||
|
||||
OVL_RELOC_FILES := $(shell $(CPP) $(CPPFLAGS) $(SPEC) | $(SPEC_REPLACE_VARS) | grep -o '[^"]*_reloc.o' )
|
||||
|
@ -238,11 +241,11 @@ DEP_FILES := $(O_FILES:.o=.asmproc.d) $(OVL_RELOC_FILES:.o=.d)
|
|||
|
||||
TEXTURE_FILES_PNG := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.png))
|
||||
TEXTURE_FILES_JPG := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.jpg))
|
||||
TEXTURE_FILES_OUT := $(foreach f,$(TEXTURE_FILES_PNG:.png=.inc.c),$(BUILD_DIR)/$f) \
|
||||
$(foreach f,$(TEXTURE_FILES_JPG:.jpg=.jpg.inc.c),$(BUILD_DIR)/$f) \
|
||||
TEXTURE_FILES_OUT := $(foreach f,$(TEXTURE_FILES_PNG:.png=.inc.c),$(f:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%)) \
|
||||
$(foreach f,$(TEXTURE_FILES_JPG:.jpg=.jpg.inc.c),$(f:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%))
|
||||
|
||||
# create build directories
|
||||
$(shell mkdir -p $(BUILD_DIR)/baserom $(EXTRACTED_DIR)/text $(BUILD_DIR)/assets/text $(foreach dir,$(SRC_DIRS) $(UNDECOMPILED_DATA_DIRS) $(ASSET_BIN_DIRS),$(BUILD_DIR)/$(dir)))
|
||||
$(shell mkdir -p $(BUILD_DIR)/baserom $(BUILD_DIR)/assets/text $(foreach dir,$(SRC_DIRS) $(UNDECOMPILED_DATA_DIRS),$(BUILD_DIR)/$(dir)) $(foreach dir,$(ASSET_BIN_DIRS),$(dir:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%)))
|
||||
|
||||
ifeq ($(COMPILER),ido)
|
||||
$(BUILD_DIR)/src/boot/stackcheck.o: OPTFLAGS := -O2
|
||||
|
@ -356,12 +359,9 @@ clean:
|
|||
$(RM) -r $(BUILD_DIR)
|
||||
|
||||
assetclean:
|
||||
$(RM) -r $(ASSET_BIN_DIRS)
|
||||
$(RM) -r $(EXTRACTED_DIR)
|
||||
$(RM) -r $(BUILD_DIR)/assets
|
||||
$(RM) -r .extracted-assets.json
|
||||
|
||||
distclean: assetclean
|
||||
distclean:
|
||||
$(RM) -r extracted/
|
||||
$(RM) -r build/
|
||||
$(MAKE) -C tools distclean
|
||||
|
@ -378,10 +378,7 @@ setup: venv
|
|||
$(PYTHON) tools/decompress_baserom.py $(VERSION)
|
||||
$(PYTHON) tools/extract_baserom.py $(BASEROM_DIR)/baserom-decompressed.z64 --oot-version $(VERSION) -o $(EXTRACTED_DIR)/baserom
|
||||
$(PYTHON) tools/msgdis.py --oot-version $(VERSION) --text-out $(EXTRACTED_DIR)/text/message_data.h --staff-text-out $(EXTRACTED_DIR)/text/message_data_staff.h
|
||||
# TODO: for now, we only extract assets from the Debug ROM
|
||||
ifeq ($(VERSION),gc-eu-mq-dbg)
|
||||
$(PYTHON) extract_assets.py -j$(N_THREADS)
|
||||
endif
|
||||
$(PYTHON) extract_assets.py -v $(VERSION) -j$(N_THREADS)
|
||||
|
||||
disasm:
|
||||
$(RM) -r $(EXPECTED_DIR)
|
||||
|
@ -447,7 +444,11 @@ $(BUILD_DIR)/assets/text/nes_message_data_static.o: $(BUILD_DIR)/assets/text/mes
|
|||
$(BUILD_DIR)/assets/text/staff_message_data_static.o: $(BUILD_DIR)/assets/text/message_data_staff.enc.h
|
||||
$(BUILD_DIR)/src/code/z_message_PAL.o: $(BUILD_DIR)/assets/text/message_data.enc.h $(BUILD_DIR)/assets/text/message_data_staff.enc.h
|
||||
|
||||
$(BUILD_DIR)/assets/%.o: assets/%.c
|
||||
$(BUILD_DIR)/assets/text/%.o: assets/text/%.c
|
||||
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
|
||||
$(OBJCOPY) -O binary $@ $@.bin
|
||||
|
||||
$(BUILD_DIR)/assets/%.o: $(EXTRACTED_DIR)/assets/%.c
|
||||
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
|
||||
$(OBJCOPY) -O binary $@ $@.bin
|
||||
|
||||
|
@ -498,13 +499,13 @@ $(BUILD_DIR)/src/overlays/%_reloc.o: $(BUILD_DIR)/$(SPEC)
|
|||
$(FADO) $$(tools/reloc_prereq $< $(notdir $*)) -n $(notdir $*) -o $(@:.o=.s) -M $(@:.o=.d)
|
||||
$(AS) $(ASFLAGS) $(@:.o=.s) -o $@
|
||||
|
||||
$(BUILD_DIR)/%.inc.c: %.png
|
||||
$(BUILD_DIR)/assets/%.inc.c: $(EXTRACTED_DIR)/assets/%.png
|
||||
$(ZAPD) btex -eh -tt $(subst .,,$(suffix $*)) -i $< -o $@
|
||||
|
||||
$(BUILD_DIR)/assets/%.bin.inc.c: assets/%.bin
|
||||
$(BUILD_DIR)/assets/%.bin.inc.c: $(EXTRACTED_DIR)/assets/%.bin
|
||||
$(ZAPD) bblb -eh -i $< -o $@
|
||||
|
||||
$(BUILD_DIR)/assets/%.jpg.inc.c: assets/%.jpg
|
||||
$(BUILD_DIR)/assets/%.jpg.inc.c: $(EXTRACTED_DIR)/assets/%.jpg
|
||||
$(ZAPD) bren -eh -i $< -o $@
|
||||
|
||||
-include $(DEP_FILES)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue