1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-10-20 13:40:02 +00:00

Updated Texture Asset Handling (#478)

* Auto stash before rebase of "upstream/master"

* A large number of scenes have been decompiled.

* Fixed makefile

* Decompiled around 40 scenes.

* Removed old file

* Finished matching remaining scenes.

* Removed old commented out spec lines

* Decompiled a few object files.

* Reorganized xmls a bit. Updated pu_box overlay to use proper symbol.

* Updated texture and object file decomp

* Fixed newline issue with ZAPD

* Moved scenes/ into the assets/ folder

* Fixed a few compile errors

* Auto stash before rebase of "upstream/master"

* A large number of scenes have been decompiled.

* Fixed makefile

* Decompiled around 40 scenes.

* Removed old file

* Finished matching remaining scenes.

* Removed old commented out spec lines

* Decompiled a few object files.

* Reorganized xmls a bit. Updated pu_box overlay to use proper symbol.

* Updated texture and object file decomp

* Moved scenes/ into the assets/ folder

* Fixed a few compile errors

* Fixed merge issues.

* Fixed makefile merge error

* Fixed additional merge error

* Fixed several more merge issues

* Commented out gameplay_keep and sk2 extraction, since currently unused.

* Reenabled gameplay_keep extraction since it's used in the spec

* Fixed build error

* Removed test struct

* Fixed makefile error that would happen on fresh builds

* Fixed merge issue

* Removed relative paths

* Multithreading on extraction, spec uses numbers, few changes to XMLs

* Removed redundant code from the extract_assets script

* object_sk2 and object_spot09_obj OK

* object_spot11_obj OK

* object_spot17_obj OK

* Test: One of the gameplay_keep dlists given a proper symbol

* Updated asset symbol names based on new naming scheme

* XMLs use "Offset" instead of "Address" now

* Fixed merge issues, updated ovl_Magic_Dark xml and gfx file

* Updated to use latest build of ZAPD

* Updated ZAPD again

* Updated ZAP to remove assimp dependency

* Jenkins Test: Added .gitkeep file

* Updated ZAP once more

* Updated png file name to comply with new naming scheme.

* Fixed bad include

Co-authored-by: Jack Walker <7463599+Jack-Walker@users.noreply.github.com>
This commit is contained in:
Nicholas Estelami 2020-12-26 06:39:52 -05:00 committed by GitHub
commit b95643b397
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
182 changed files with 2249 additions and 1472 deletions

134
Makefile
View file

@ -65,7 +65,7 @@ EMU_FLAGS = --noosd
# Check code syntax with host compiler
CHECK_WARNINGS := -Wall -Wextra -Wno-format-security -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-variable -Wno-missing-braces -Wno-int-conversion
CC_CHECK := gcc -fno-builtin -fsyntax-only -fsigned-char -std=gnu90 -D _LANGUAGE_C -D NON_MATCHING -Iinclude -Isrc -include stdarg.h $(CHECK_WARNINGS)
CC_CHECK := gcc -fno-builtin -fsyntax-only -fsigned-char -std=gnu90 -D _LANGUAGE_C -D NON_MATCHING -Iinclude -Isrc -Iassets -Ibuild -include stdarg.h $(CHECK_WARNINGS)
CPP := cpp
MKLDSCRIPT := tools/mkldscript
@ -77,7 +77,7 @@ ASFLAGS := -march=vr4300 -32 -Iinclude
MIPS_VERSION := -mips2
# we support Microsoft extensions such as anonymous structs, which the compiler does support but warns for their usage. Surpress the warnings with -woff.
CFLAGS += -G 0 -non_shared -Xfullwarn -Xcpluscomm -Iinclude -Isrc -Wab,-r4300_mul -woff 649,838,712
CFLAGS += -G 0 -non_shared -Xfullwarn -Xcpluscomm -Iinclude -Isrc -Iassets -Ibuild -Wab,-r4300_mul -woff 649,838,712
ifeq ($(shell getconf LONG_BIT), 32)
# Work around memory allocation bug in QEMU
@ -97,40 +97,46 @@ SPEC := spec
SRC_DIRS := $(shell find src -type d)
ASM_DIRS := $(shell find asm -type d -not -path "asm/non_matchings*") $(shell find data -type d)
SCENE_DIRS := $(shell find scenes -type d -not -path "scenes/xml*")
TEXTURE_DIRS := assets/textures
TEXTURE_BIN_DIRS := $(shell find assets/textures/* -type d -not -path "assets/textures/xml*")
ASSET_DIRS := assets/objects assets/textures assets/scenes assets/overlays
ASSET_BIN_DIRS := $(shell find assets/* -type d -not -path "assets/xml*")
ASSET_FILES_XML := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.xml))
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/$f)
TEXTURE_DIRS := assets/textures assets/scenes assets/objects assets/overlays
# source files
C_FILES := $(foreach dir,$(SRC_DIRS) $(TEXTURE_BIN_DIRS) $(SCENE_DIRS),$(wildcard $(dir)/*.c))
C_FILES := $(foreach dir,$(SRC_DIRS) $(ASSET_BIN_DIRS),$(wildcard $(dir)/*.c))
S_FILES := $(foreach dir,$(ASM_DIRS),$(wildcard $(dir)/*.s))
#TEXTURE_FILES := $(foreach dir,$(TEXTURE_DIRS),$(wildcard $(dir)/*.xml))
O_FILES := $(foreach f,$(S_FILES:.s=.o),build/$f) \
$(foreach f,$(C_FILES:.c=.o),build/$f) \
$(foreach f,$(wildcard baserom/*),build/$f.o)
# $(foreach f,$(TEXTURE_FILES:.xml=.o),build/$f)
#TEXTURE_FILES_RGBA32 := $(foreach dir,$(TEXTURE_BIN_DIRS),$(wildcard $(dir)/*.rgba32.png))
#TEXTURE_FILES_RGBA16 := $(foreach dir,$(TEXTURE_BIN_DIRS),$(wildcard $(dir)/*.rgb5a1.png))
#TEXTURE_FILES_GRAY4 := $(foreach dir,$(TEXTURE_BIN_DIRS),$(wildcard $(dir)/*.i4.png))
#TEXTURE_FILES_GRAY8 := $(foreach dir,$(TEXTURE_BIN_DIRS),$(wildcard $(dir)/*.i8.png))
#TEXTURE_FILES_GRAYA4 := $(foreach dir,$(TEXTURE_BIN_DIRS),$(wildcard $(dir)/*.ia4.png))
#TEXTURE_FILES_GRAYA8 := $(foreach dir,$(TEXTURE_BIN_DIRS),$(wildcard $(dir)/*.ia8.png))
#TEXTURE_FILES_GRAYA16 := $(foreach dir,$(TEXTURE_BIN_DIRS),$(wildcard $(dir)/*.ia16.png))
#TEXTURE_FILES_CI4 := $(foreach dir,$(TEXTURE_BIN_DIRS),$(wildcard $(dir)/*.ci4.png))
#TEXTURE_FILES_CI8 := $(foreach dir,$(TEXTURE_BIN_DIRS),$(wildcard $(dir)/*.ci8.png))
#TEXTURE_FILES_OUT := $(foreach f,$(TEXTURE_FILES_RGBA32:.rgba32.png=.rgba32),build/$f) \
# $(foreach f,$(TEXTURE_FILES_RGBA16:.rgb5a1.png=.rgb5a1),build/$f) \
# $(foreach f,$(TEXTURE_FILES_GRAY4:.i4.png=.i4),build/$f) \
# $(foreach f,$(TEXTURE_FILES_GRAY8:.i8.png=.i8),build/$f) \
# $(foreach f,$(TEXTURE_FILES_GRAYA4:.ia4.png=.ia4),build/$f) \
# $(foreach f,$(TEXTURE_FILES_GRAYA8:.ia8.png=.ia8),build/$f) \
# $(foreach f,$(TEXTURE_FILES_GRAYA16:.ia16.png=.ia16),build/$f) \
# $(foreach f,$(TEXTURE_FILES_CI4:.ci4.png=.ci4),build/$f) \
# $(foreach f,$(TEXTURE_FILES_CI8:.ci8.png=.ci8),build/$f) \
TEXTURE_BIN_DIRS := $(shell find assets/objects/* assets/textures/* assets/scenes/* assets/overlays/* -type d)
TEXTURE_FILES_RGBA32 := $(foreach dir,$(TEXTURE_BIN_DIRS),$(wildcard $(dir)/*.rgba32.png))
TEXTURE_FILES_RGBA16 := $(foreach dir,$(TEXTURE_BIN_DIRS),$(wildcard $(dir)/*.rgb5a1.png))
TEXTURE_FILES_GRAY4 := $(foreach dir,$(TEXTURE_BIN_DIRS),$(wildcard $(dir)/*.i4.png))
TEXTURE_FILES_GRAY8 := $(foreach dir,$(TEXTURE_BIN_DIRS),$(wildcard $(dir)/*.i8.png))
TEXTURE_FILES_GRAYA4 := $(foreach dir,$(TEXTURE_BIN_DIRS),$(wildcard $(dir)/*.ia4.png))
TEXTURE_FILES_GRAYA8 := $(foreach dir,$(TEXTURE_BIN_DIRS),$(wildcard $(dir)/*.ia8.png))
TEXTURE_FILES_GRAYA16 := $(foreach dir,$(TEXTURE_BIN_DIRS),$(wildcard $(dir)/*.ia16.png))
TEXTURE_FILES_CI4 := $(foreach dir,$(TEXTURE_BIN_DIRS),$(wildcard $(dir)/*.ci4.png))
TEXTURE_FILES_CI8 := $(foreach dir,$(TEXTURE_BIN_DIRS),$(wildcard $(dir)/*.ci8.png))
TEXTURE_FILES_OUT := $(foreach f,$(TEXTURE_FILES_RGBA32:.rgba32.png=.rgba32.inc.c),build/$f) \
$(foreach f,$(TEXTURE_FILES_RGBA16:.rgb5a1.png=.rgb5a1.inc.c),build/$f) \
$(foreach f,$(TEXTURE_FILES_GRAY4:.i4.png=.i4.inc.c),build/$f) \
$(foreach f,$(TEXTURE_FILES_GRAY8:.i8.png=.i8.inc.c),build/$f) \
$(foreach f,$(TEXTURE_FILES_GRAYA4:.ia4.png=.ia4.inc.c),build/$f) \
$(foreach f,$(TEXTURE_FILES_GRAYA8:.ia8.png=.ia8.inc.c),build/$f) \
$(foreach f,$(TEXTURE_FILES_GRAYA16:.ia16.png=.ia16.inc.c),build/$f) \
$(foreach f,$(TEXTURE_FILES_CI4:.ci4.png=.ci4.inc.c),build/$f) \
$(foreach f,$(TEXTURE_FILES_CI8:.ci8.png=.ci8.inc.c),build/$f) \
# create build directories
$(shell mkdir -p build/baserom $(foreach dir,$(SRC_DIRS) $(ASM_DIRS) $(TEXTURE_DIRS) $(TEXTURE_BIN_DIRS) $(SCENE_DIRS),build/$(dir)))
$(shell mkdir -p build/baserom)
$(foreach dir,$(SRC_DIRS) $(ASM_DIRS) $(TEXTURE_DIRS) $(ASSET_BIN_DIRS),$(shell mkdir -p build/$(dir)))
build/src/libultra_boot_O1/%.o: OPTFLAGS := -O1
build/src/libultra_boot_O2/%.o: OPTFLAGS := -O2
@ -175,7 +181,7 @@ endif
$(ROM): $(ELF)
$(ELF2ROM) -cic 6105 $< $@
$(ELF): $(TEXTURE_FILES_OUT) $(O_FILES) build/ldscript.txt build/undefined_syms.txt
$(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(O_FILES) build/ldscript.txt build/undefined_syms.txt
$(LD) -T build/undefined_syms.txt -T build/ldscript.txt --no-check-sections --accept-unknown-input-arch --emit-relocs -Map build/z64.map -o $@
build/ldscript.txt: $(SPEC)
@ -190,11 +196,12 @@ clean:
setup:
git submodule update --init --recursive
$(MAKE) -C tools
$(MAKE) -C tools -j
python3 fixbaserom.py
python3 extract_baserom.py
python3 extract_assets.py
resources: $(ASSET_FILES_OUT)
test: $(ROM)
$(EMULATOR) $(EMU_FLAGS) $<
@ -210,16 +217,6 @@ build/asm/%.o: asm/%.s
build/data/%.o: data/%.s
iconv --from UTF-8 --to EUC-JP $^ | $(AS) $(ASFLAGS) -o $@
#build/assets/%.o: assets/%.s
# $(AS) $(ASFLAGS) $^ -o $@
# $(OBJCOPY) -O binary $@ $@.bin
#build/assets/%.c: assets/%.xml
# cp $(<:.c=.xml) $@
build/scenes/%.o: scenes/%.c
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $^
$(OBJCOPY) -O binary $@ $@.bin
build/assets/%.o: assets/%.c
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $^
@ -243,38 +240,47 @@ build/src/libultra_code_O1/llcvt.o: src/libultra_code_O1/llcvt.c
python3 tools/set_o32abi_bit.py $@
@$(OBJDUMP) -d $@ > $(@:.o=.s)
#build/assets/textures/%.o: assets/textures/%.zdata
# $(OBJCOPY) -I binary -O elf32-big $< $@
assets/%.c: assets/%.xml
# $(ZAP2) bsf -i $< -o $(dir $@)
$(ZAP2) bsf -eh -i $< -o $(dir $<)
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o build/$(@:.c=.o) $@
#textures/%.zdata: textures/%
# $(ZAP2) $<.xml b
build/%.rgba32.inc.c: %.rgba32.png
python3 tools/touchasset.py $(addsuffix basefile.txt, $(dir $@))
$(ZAP2) btex -tt rgba32 -i $< -o $@
#build/assets/%.s: assets/%.xml
# $(ZAP2) e rgba32 $< $@
build/%.rgb5a1.inc.c: %.rgb5a1.png
python3 tools/touchasset.py $(addsuffix basefile.txt, $(dir $@))
$(ZAP2) btex -tt rgb5a1 -i $< -o $@
#build/assets/%.c: assets/%.xml
# cp $(<:.c=.xml) $@
build/%.i4.inc.c: %.i4.png
python3 tools/touchasset.py $(addsuffix basefile.txt, $(dir $@))
$(ZAP2) btex -tt i4 -i $< -o $@
#build/assets/%.rgba32: assets/%.rgba32.png
# $(ZAP2) btex rgba32 $< $@
build/%.i8.inc.c: %.i8.png
python3 tools/touchasset.py $(addsuffix basefile.txt, $(dir $@))
$(ZAP2) btex -tt i8 -i $< -o $@
#build/assets/%.rgb5a1: assets/%.rgb5a1.png
# $(ZAP2) btex rgb5a1 $< $@
build/%.ia4.inc.c: %.ia4.png
python3 tools/touchasset.py $(addsuffix basefile.txt, $(dir $@))
$(ZAP2) btex -tt ia4 -i $< -o $@
#build/assets/%.i4: assets/%.i4.png
# $(ZAP2) btex i4 $< $@
build/%.ia8.inc.c: %.ia8.png
python3 tools/touchasset.py $(addsuffix basefile.txt, $(dir $@))
$(ZAP2) btex -tt ia8 -i $< -o $@
#build/assets/%.i8: assets/%.i8.png
# $(ZAP2) btex i8 $< $@
build/%.ia16.inc.c: %.ia16.png
python3 tools/touchasset.py $(addsuffix basefile.txt, $(dir $@))
$(ZAP2) btex -tt ia16 -i $< -o $@
#build/assets/%.ia4: assets/%.ia4.png
# $(ZAP2) btex ia4 $< $@
build/assets/%.ci4.inc.c: assets/%.ci4.png
python3 tools/touchasset.py $(addsuffix basefile.txt, $(dir $@))
$(ZAP2) btex -tt ci4 -i $< -o $@
#build/assets/%.ia8: assets/%.ia8.png
# $(ZAP2) btex ia8 $< $@
build/%.ci8.inc.c: %.ci8.png
python3 tools/touchasset.py $(addsuffix basefile.txt, $(dir $@))
$(ZAP2) btex -tt ci8 -i $< -o $@
#build/assets/%.ci4: assets/%.ci4.png
# $(ZAP2) btex ci4 $< $@
#build/assets/%.ci8: assets/%.ci8.png
# $(ZAP2) btex ci8 $< $@
build/assets/%.bin.inc.c: assets/%.bin
python3 tools/touchasset.py $(addsuffix basefile.txt, $(dir $@))
$(ZAP2) bblb -i $< -o $@