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
parent 8fa6cb6ff9
commit b95643b397
182 changed files with 2249 additions and 1472 deletions

7
.gitignore vendored
View File

@@ -44,8 +44,15 @@ tools/*dSYM/
*.i8.png
*.ia4.png
*.ia8.png
*.ia16.png
*.ci4.png
*.ci8.png
*.mdli
*.anmi
*.obj
*.mtl
*.fbx
!*_custom*
# Per-user configuration
.python-version

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 $@

View File

@@ -529,8 +529,8 @@ glabel func_8002FBAC
/* AA746C 800302CC 0C0346A2 */ jal Matrix_NewMtx
/* AA7470 800302D0 AFA20058 */ sw $v0, 0x58($sp)
/* AA7474 800302D4 8FA30058 */ lw $v1, 0x58($sp)
/* AA7478 800302D8 3C040401 */ lui $a0, %hi(D_04010130) # $a0, 0x401
/* AA747C 800302DC 24840130 */ addiu $a0, %lo(D_04010130) # addiu $a0, $a0, 0x130
/* AA7478 800302D8 3C040401 */ lui $a0, %hi(gGameKeepMoteDL0) # $a0, 0x401
/* AA747C 800302DC 24840130 */ addiu $a0, %lo(gGameKeepMoteDL0) # addiu $a0, $a0, 0x130
/* AA7480 800302E0 AC620004 */ sw $v0, 4($v1)
/* AA7484 800302E4 8FA500EC */ lw $a1, 0xec($sp)
/* AA7488 800302E8 3C18DE00 */ li $t8, 0xDE000000 # 0.000000

View File

@@ -43,11 +43,11 @@ glabel func_8096865C
/* 01D4C 8096869C 8FAA0064 */ lw $t2, 0x0064($sp)
/* 01D50 809686A0 8459001C */ lh $t9, 0x001C($v0) ## 0000001C
/* 01D54 809686A4 3C090401 */ lui $t1, %hi(D_040101A8) ## $t1 = 04010000
/* 01D58 809686A8 3C080401 */ lui $t0, %hi(D_04010130) ## $t0 = 04010000
/* 01D58 809686A8 3C080401 */ lui $t0, %hi(gGameKeepMoteDL0) ## $t0 = 04010000
/* 01D5C 809686AC 2B210009 */ slti $at, $t9, 0x0009
/* 01D60 809686B0 14200004 */ bne $at, $zero, .L809686C4
/* 01D64 809686B4 252901A8 */ addiu $t1, $t1, %lo(D_040101A8) ## $t1 = 040101A8
/* 01D68 809686B8 25080130 */ addiu $t0, $t0, %lo(D_04010130) ## $t0 = 04010130
/* 01D68 809686B8 25080130 */ addiu $t0, $t0, %lo(gGameKeepMoteDL0) ## $t0 = 04010130
/* 01D6C 809686BC 10000002 */ beq $zero, $zero, .L809686C8
/* 01D70 809686C0 AFA80054 */ sw $t0, 0x0054($sp)
.L809686C4:

View File

@@ -79,10 +79,10 @@ glabel func_809688C4
/* 0205C 809689AC 46083302 */ mul.s $f12, $f6, $f8
/* 02060 809689B0 0C034348 */ jal Matrix_RotateY
/* 02064 809689B4 00000000 */ nop
/* 02068 809689B8 3C0F0401 */ lui $t7, %hi(D_04010130) ## $t7 = 04010000
/* 02068 809689B8 3C0F0401 */ lui $t7, %hi(gGameKeepMoteDL0) ## $t7 = 04010000
/* 0206C 809689BC 3C010001 */ lui $at, 0x0001 ## $at = 00010000
/* 02070 809689C0 34211DA0 */ ori $at, $at, 0x1DA0 ## $at = 00011DA0
/* 02074 809689C4 25EF0130 */ addiu $t7, $t7, %lo(D_04010130) ## $t7 = 04010130
/* 02074 809689C4 25EF0130 */ addiu $t7, $t7, %lo(gGameKeepMoteDL0) ## $t7 = 04010130
/* 02078 809689C8 4480A000 */ mtc1 $zero, $f20 ## $f20 = 0.00
/* 0207C 809689CC AFAF0058 */ sw $t7, 0x0058($sp)
/* 02080 809689D0 02E1F021 */ addu $s8, $s7, $at

View File

@@ -390,8 +390,8 @@ glabel func_8098ABC0
/* 02274 8098B0F4 93AF00B7 */ lbu $t7, 0x00B7($sp)
/* 02278 8098B0F8 3C010001 */ lui $at, 0x0001 ## $at = 00010000
/* 0227C 8098B0FC 34211DA0 */ ori $at, $at, 0x1DA0 ## $at = 00011DA0
/* 02280 8098B100 3C0D0401 */ lui $t5, %hi(D_04010130) ## $t5 = 04010000
/* 02284 8098B104 25AD0130 */ addiu $t5, $t5, %lo(D_04010130) ## $t5 = 04010130
/* 02280 8098B100 3C0D0401 */ lui $t5, %hi(gGameKeepMoteDL0) ## $t5 = 04010000
/* 02284 8098B104 25AD0130 */ addiu $t5, $t5, %lo(gGameKeepMoteDL0) ## $t5 = 04010130
/* 02288 8098B108 02417021 */ addu $t6, $s2, $at
/* 0228C 8098B10C AFAE0078 */ sw $t6, 0x0078($sp)
/* 02290 8098B110 11E00007 */ beq $t7, $zero, .L8098B130

View File

@@ -309,8 +309,8 @@ glabel func_8098B354
/* 028E4 8098B764 3C010001 */ lui $at, 0x0001 ## $at = 00010000
/* 028E8 8098B768 34211DA0 */ ori $at, $at, 0x1DA0 ## $at = 00011DA0
/* 028EC 8098B76C 44060000 */ mfc1 $a2, $f0
/* 028F0 8098B770 3C150401 */ lui $s5, %hi(D_04010130) ## $s5 = 04010000
/* 028F4 8098B774 26B50130 */ addiu $s5, $s5, %lo(D_04010130) ## $s5 = 04010130
/* 028F0 8098B770 3C150401 */ lui $s5, %hi(gGameKeepMoteDL0) ## $s5 = 04010000
/* 028F4 8098B774 26B50130 */ addiu $s5, $s5, %lo(gGameKeepMoteDL0) ## $s5 = 04010130
/* 028F8 8098B778 02C19021 */ addu $s2, $s6, $at
/* 028FC 8098B77C 0C034261 */ jal Matrix_Translate
/* 02900 8098B780 00003825 */ or $a3, $zero, $zero ## $a3 = 00000000

3
assets/.gitignore vendored
View File

@@ -1,3 +1,4 @@
*.bin
*.c
*.h
*.h
*.cfg

View File

View File

Some files were not shown because too many files have changed in this diff Show More