diff --git a/Makefile b/Makefile index bc37ffdb42..56134bd7fc 100644 --- a/Makefile +++ b/Makefile @@ -40,8 +40,6 @@ COMPILER ?= ido VERSION ?= gc-eu-mq-dbg # Number of threads to extract and compress with. N_THREADS ?= $(shell nproc) -# Check code syntax with host compiler. -RUN_CC_CHECK ?= 1 # If DEBUG_OBJECTS is 1, produce additional debugging files such as objdump output or raw binaries for assets DEBUG_OBJECTS ?= 0 # Set prefix to mips binutils binaries (mips-linux-gnu-ld => 'mips-linux-gnu-') - Change at your own risk! @@ -320,7 +318,8 @@ CPP := gcc -E MKLDSCRIPT := tools/mkldscript MKDMADATA := tools/mkdmadata ELF2ROM := tools/elf2rom -ZAPD := tools/ZAPD/ZAPD.out +BIN2C := tools/bin2c +N64TEXCONV := tools/assets/n64texconv/n64texconv FADO := tools/fado/fado.elf PYTHON ?= $(VENV)/bin/python3 @@ -367,8 +366,8 @@ CPPFLAGS += -P -xc -fno-dollars-in-identifiers $(CPP_DEFINES) ASFLAGS += -march=vr4300 -32 -no-pad-sections -Iinclude -I$(EXTRACTED_DIR) ifeq ($(COMPILER),gcc) - CFLAGS += $(CPP_DEFINES) $(GBI_DEFINES) -G 0 -nostdinc $(INC) -march=vr4300 -mfix4300 -mabi=32 -mno-abicalls -mdivide-breaks -fno-PIC -fno-common -ffreestanding -funsigned-char -fbuiltin -fno-builtin-sinf -fno-builtin-cosf $(CHECK_WARNINGS) - CCASFLAGS += $(CPP_DEFINES) $(GBI_DEFINES) -G 0 -nostdinc $(INC) -march=vr4300 -mfix4300 -mabi=32 -mno-abicalls -fno-PIC -fno-common -Wa,-no-pad-sections + CFLAGS += $(CPP_DEFINES) $(GBI_DEFINES) -G 0 -nostdinc -MD $(INC) -march=vr4300 -mfix4300 -mabi=32 -mno-abicalls -mdivide-breaks -fno-PIC -fno-common -ffreestanding -funsigned-char -fbuiltin -fno-builtin-sinf -fno-builtin-cosf $(CHECK_WARNINGS) + CCASFLAGS += $(CPP_DEFINES) $(GBI_DEFINES) -G 0 -nostdinc -MD $(INC) -march=vr4300 -mfix4300 -mabi=32 -mno-abicalls -fno-PIC -fno-common -Wa,-no-pad-sections MIPS_VERSION := -mips3 else # Suppress warnings for wrong number of macro arguments (to fake variadic @@ -386,7 +385,7 @@ endif ifeq ($(COMPILER),ido) # Have CC_CHECK pretend to be a MIPS compiler MIPS_BUILTIN_DEFS := -D_MIPS_ISA_MIPS2=2 -D_MIPS_ISA=_MIPS_ISA_MIPS2 -D_ABIO32=1 -D_MIPS_SIM=_ABIO32 -D_MIPS_SZINT=32 -D_MIPS_SZLONG=32 -D_MIPS_SZPTR=32 - CC_CHECK = gcc -fno-builtin -fsyntax-only -funsigned-char -std=gnu90 -D_LANGUAGE_C $(CPP_DEFINES) $(MIPS_BUILTIN_DEFS) $(GBI_DEFINES) $(INC) $(CHECK_WARNINGS) + CC_CHECK = gcc -nostdinc -MD -fno-builtin -fsyntax-only -funsigned-char -std=gnu90 -D_LANGUAGE_C $(CPP_DEFINES) $(MIPS_BUILTIN_DEFS) $(GBI_DEFINES) $(INC) $(CHECK_WARNINGS) ifeq ($(shell getconf LONG_BIT), 32) # Work around memory allocation bug in QEMU export QEMU_GUEST_BASE := 1 @@ -395,7 +394,7 @@ ifeq ($(COMPILER),ido) CC_CHECK += -m32 endif else - RUN_CC_CHECK := 0 + CC_CHECK = @: endif OBJDUMP_FLAGS := -d -r -z -Mreg-names=32 @@ -467,7 +466,7 @@ SOUNDFONT_EXTRACT_XMLS := $(foreach dir,$(SOUNDFONT_EXTRACT_DIRS),$(wildcard $(d SOUNDFONT_BUILD_XMLS := $(foreach f,$(SOUNDFONT_XMLS),$(BUILD_DIR)/$f) $(foreach f,$(SOUNDFONT_EXTRACT_XMLS),$(f:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%)) SOUNDFONT_O_FILES := $(foreach f,$(SOUNDFONT_BUILD_XMLS),$(f:.xml=.o)) SOUNDFONT_HEADERS := $(foreach f,$(SOUNDFONT_BUILD_XMLS),$(f:.xml=.h)) -SOUNDFONT_DEP_FILES := $(foreach f,$(SOUNDFONT_O_FILES),$(f:.o=.d)) +SOUNDFONT_DEP_FILES := $(foreach f,$(SOUNDFONT_O_FILES),$(f:.o=.c.d)) SEQUENCE_FILES := $(foreach dir,$(SEQUENCE_DIRS),$(wildcard $(dir)/*.seq)) SEQUENCE_EXTRACT_FILES := $(foreach dir,$(SEQUENCE_EXTRACT_DIRS),$(wildcard $(dir)/*.seq)) @@ -501,7 +500,7 @@ OVL_RELOC_FILES := $(filter %_reloc.o,$(SPEC_O_FILES)) # Automatic dependency files # (Only asm_processor dependencies and reloc dependencies are handled for now) -DEP_FILES := $(O_FILES:.o=.asmproc.d) $(OVL_RELOC_FILES:.o=.d) +DEP_FILES := $(O_FILES:.o=.d) $(O_FILES:.o=.asmproc.d) $(OVL_RELOC_FILES:.o=.d) $(BUILD_DIR)/spec.d TEXTURE_FILES_PNG_EXTRACTED := $(foreach dir,$(ASSET_BIN_DIRS_EXTRACTED),$(wildcard $(dir)/*.png)) TEXTURE_FILES_PNG_COMMITTED := $(foreach dir,$(ASSET_BIN_DIRS_COMMITTED),$(wildcard $(dir)/*.png)) @@ -537,6 +536,8 @@ endif $(BUILD_DIR)/src/boot/build.o: CPP_DEFINES += -DBUILD_CREATOR="\"$(BUILD_CREATOR)\"" -DBUILD_DATE="\"$(BUILD_DATE)\"" -DBUILD_TIME="\"$(BUILD_TIME)\"" +$(BUILD_DIR)/src/audio/internal/seqplayer.o: CPP_DEFINES += -DMML_VERSION=MML_VERSION_OOT + ifeq ($(COMPILER),ido) $(BUILD_DIR)/src/boot/driverominit.o: OPTFLAGS := -O2 @@ -619,15 +620,15 @@ $(BUILD_DIR)/src/libu64/%.o: OPTFLAGS := -O2 $(BUILD_DIR)/src/audio/%.o: OPTFLAGS := -O2 # Use signed chars instead of unsigned for this audio file (needed to match AudioDebug_ScrPrt) -$(BUILD_DIR)/src/audio/general.o: CFLAGS += -signed +$(BUILD_DIR)/src/audio/game/general.o: CFLAGS += -signed ifeq ($(PLATFORM),N64) -$(BUILD_DIR)/src/audio/general.o: CFLAGS += -DNO_SQRTF_INTRINSIC +$(BUILD_DIR)/src/audio/game/general.o: CFLAGS += -DNO_SQRTF_INTRINSIC endif # Put string literals in .data for some audio files (needed to match these files with literals) -$(BUILD_DIR)/src/audio/sfx.o: CFLAGS += -use_readwrite_const -$(BUILD_DIR)/src/audio/sequence.o: CFLAGS += -use_readwrite_const +$(BUILD_DIR)/src/audio/game/sfx.o: CFLAGS += -use_readwrite_const +$(BUILD_DIR)/src/audio/game/sequence.o: CFLAGS += -use_readwrite_const ifeq ($(PLATFORM),IQUE) $(BUILD_DIR)/src/libultra/%.o: CC := $(EGCS_CC) @@ -790,10 +791,10 @@ setup: venv $(MAKE) -C tools $(PYTHON) tools/decompress_baserom.py $(VERSION) $(PYTHON) tools/extract_baserom.py $(BASEROM_DIR)/baserom-decompressed.z64 $(EXTRACTED_DIR)/baserom -v $(VERSION) + $(PYTHON) -m tools.assets.extract $(EXTRACTED_DIR)/baserom $(EXTRACTED_DIR) -v $(VERSION) -j$(N_THREADS) $(PYTHON) tools/extract_incbins.py $(EXTRACTED_DIR)/baserom $(EXTRACTED_DIR)/incbin -v $(VERSION) $(PYTHON) tools/extract_text.py $(EXTRACTED_DIR)/baserom $(EXTRACTED_DIR)/text -v $(VERSION) - $(PYTHON) tools/extract_assets.py $(EXTRACTED_DIR)/baserom $(EXTRACTED_DIR)/assets -v $(VERSION) -j$(N_THREADS) - $(PYTHON) tools/extract_audio.py -o $(EXTRACTED_DIR) -v $(VERSION) --read-xml + $(PYTHON) tools/extract_audio.py -b $(EXTRACTED_DIR)/baserom -o $(EXTRACTED_DIR) -v $(VERSION) --read-xml disasm: $(RM) -r $(EXPECTED_DIR) @@ -811,9 +812,6 @@ endif #### Various Recipes #### -$(ROM): $(ELF) - $(ELF2ROM) -cic 6105 $< $@ - ifeq ($(PLATFORM),IQUE) COMPRESS_ARGS := --format gzip --pad-to 0x4000 CIC = 6102 @@ -822,6 +820,9 @@ else CIC = 6105 endif +$(ROM): $(ELF) + $(ELF2ROM) -cic $(CIC) $< $@ + $(ROMC): $(ROM) $(ELF) $(BUILD_DIR)/compress_ranges.txt $(PYTHON) tools/compress.py --in $(ROM) --out $@ --dmadata-start `./tools/dmadata_start.sh $(NM) $(ELF)` --compress `cat $(BUILD_DIR)/compress_ranges.txt` --threads $(N_THREADS) $(COMPRESS_ARGS) $(PYTHON) -m ipl3checksum sum --cic $(CIC) --update $@ @@ -830,8 +831,10 @@ COM_PLUGIN := tools/com-plugin/common-plugin.so LDFLAGS := -T $(LDSCRIPT) -T $(BUILD_DIR)/linker_scripts/makerom.ld -T $(BUILD_DIR)/undefined_syms.txt --no-check-sections --accept-unknown-input-arch --emit-relocs -Map $(MAP) ifeq ($(PLATFORM),IQUE) - LDFLAGS += -plugin $(COM_PLUGIN) -plugin-opt order=$(BASEROM_DIR)/bss-order.txt - $(ELF): $(BASEROM_DIR)/bss-order.txt + ifeq ($(NON_MATCHING),0) + LDFLAGS += -plugin $(COM_PLUGIN) -plugin-opt order=$(BASEROM_DIR)/bss-order.txt + $(ELF): $(BASEROM_DIR)/bss-order.txt + endif endif $(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(O_FILES) $(OVL_RELOC_FILES) $(LDSCRIPT) $(BUILD_DIR)/linker_scripts/makerom.ld $(BUILD_DIR)/undefined_syms.txt \ @@ -855,7 +858,7 @@ $(O_FILES): | asset_files .PHONY: o_files asset_files $(BUILD_DIR)/spec: $(SPEC) $(SPEC_INCLUDES) - $(CPP) $(CPPFLAGS) -I. $< | $(BUILD_DIR_REPLACE) > $@ + $(CPP) $(CPPFLAGS) -MD -MF $@.d -MT $@ -I. $< | $(BUILD_DIR_REPLACE) > $@ $(LDSCRIPT): $(BUILD_DIR)/spec $(MKLDSCRIPT) $< $@ @@ -867,7 +870,7 @@ $(BUILD_DIR)/baserom/%.o: $(EXTRACTED_DIR)/baserom/% $(OBJCOPY) -I binary -O elf32-big $< $@ $(BUILD_DIR)/data/%.o: data/%.s - $(CPP) $(CPPFLAGS) -Iinclude $< | $(AS) $(ASFLAGS) -o $@ + $(CPP) $(CPPFLAGS) -MD -MF $(@:.o=.d) -MT $@ -Iinclude $< | $(AS) $(ASFLAGS) -o $@ ifeq ($(PLATFORM),IQUE) NES_CHARMAP := assets/text/charmap.chn.txt @@ -876,24 +879,23 @@ else endif $(BUILD_DIR)/assets/text/%.enc.nes.h: assets/text/%.h $(EXTRACTED_DIR)/text/%.h $(NES_CHARMAP) - $(CPP) $(CPPFLAGS) -I$(EXTRACTED_DIR) $< | $(PYTHON) tools/msgenc.py --encoding utf-8 --charmap $(NES_CHARMAP) - $@ + $(CPP) $(CPPFLAGS) -I$(EXTRACTED_DIR) -MD -MF $(@:.o=.d) -MT $@ $< | $(PYTHON) tools/msgenc.py --encoding utf-8 --charmap $(NES_CHARMAP) - $@ $(BUILD_DIR)/assets/text/%.enc.jpn.h: assets/text/%.h $(EXTRACTED_DIR)/text/%.h assets/text/charmap.jpn.txt - $(CPP) $(CPPFLAGS) -I$(EXTRACTED_DIR) $< | $(PYTHON) tools/msgenc.py --encoding SHIFT-JIS --wchar --charmap assets/text/charmap.jpn.txt - $@ + $(CPP) $(CPPFLAGS) -I$(EXTRACTED_DIR) -MD -MF $(@:.o=.d) -MT $@ $< | $(PYTHON) tools/msgenc.py --encoding SHIFT-JIS --wchar --charmap assets/text/charmap.jpn.txt - $@ -# Dependencies for files including message data headers -# TODO remove when full header dependencies are used. +# Dependencies for encoded message headers. These dependencies are not automatic as these headers are generated +# as part of the build. A clean build must know to generate them before the relevant .d files are created. $(BUILD_DIR)/assets/text/jpn_message_data_static.o: $(BUILD_DIR)/assets/text/message_data.enc.jpn.h $(BUILD_DIR)/assets/text/nes_message_data_static.o: $(BUILD_DIR)/assets/text/message_data.enc.nes.h $(BUILD_DIR)/assets/text/ger_message_data_static.o: $(BUILD_DIR)/assets/text/message_data.enc.nes.h $(BUILD_DIR)/assets/text/fra_message_data_static.o: $(BUILD_DIR)/assets/text/message_data.enc.nes.h $(BUILD_DIR)/assets/text/staff_message_data_static.o: $(BUILD_DIR)/assets/text/message_data_staff.enc.nes.h -$(BUILD_DIR)/src/code/z_message.o: assets/text/message_data.h assets/text/message_data_staff.h $(BUILD_DIR)/assets/text/%.o: assets/text/%.c ifneq ($(COMPILER),gcc) # Preprocess text with modern cpp for varargs macros - $(CPP) -undef -D_LANGUAGE_C -D__sgi $(CPPFLAGS) $(INC) $< -o $(@:.o=.c) + $(CPP) -undef -D_LANGUAGE_C -D__sgi $(CPPFLAGS) -MD -MT $@ $(INC) $< -o $(@:.o=.c) $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $(@:.o=.c) else $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $< @@ -901,17 +903,19 @@ endif $(OBJCOPY) -O binary --only-section .rodata $@ $@.bin $(BUILD_DIR)/assets/%.o: assets/%.c + $(CC_CHECK) $< -o $@ $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $< $(OBJCOPY_CMD) $(BUILD_DIR)/assets/%.o: $(EXTRACTED_DIR)/assets/%.c + $(CC_CHECK) $< -o $@ $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $< $(OBJCOPY_CMD) # Assemble the ROM header with GNU AS always $(BUILD_DIR)/src/makerom/rom_header.o: src/makerom/rom_header.s ifeq ($(COMPILER),ido) - $(CPP) $(CPPFLAGS) $(MIPS_BUILTIN_DEFS) $(INC) $< | $(AS) $(ASFLAGS) -o $@ + $(CPP) $(CPPFLAGS) $(MIPS_BUILTIN_DEFS) $(INC) -MD -MF $(@:.o=.d) -MT $@ $< | $(AS) $(ASFLAGS) -o $@ else $(CCAS) -c $(CCASFLAGS) $(MIPS_VERSION) $(ASOPTFLAGS) -o $@ $< endif @@ -922,12 +926,15 @@ $(BUILD_DIR)/src/makerom/ipl3.o: $(EXTRACTED_DIR)/incbin/ipl3 $(BUILD_DIR)/src/%.o: src/%.s ifeq ($(COMPILER),ido) +# For header dependencies + $(CPP) $(MIPS_BUILTIN_DEFS) $(CPPFLAGS) -x assembler-with-cpp $(INC) -MD -MF $(@:.o=.d) -MT $@ $< -o /dev/null $(CCAS) -c $(CCASFLAGS) $(MIPS_VERSION) $(ASOPTFLAGS) -o $(@:.o=.tmp.o) $< # IDO generates bad symbol tables, fix the symbol table with strip.. $(STRIP) $(@:.o=.tmp.o) -N dummy-symbol-name # but strip doesn't know about file-relative offsets in .mdebug and doesn't relocate them, ld will # segfault unless .mdebug is removed $(OBJCOPY) --remove-section .mdebug $(@:.o=.tmp.o) $@ + @$(RM) $(@:.o=.tmp.o) else $(CCAS) -c $(CCASFLAGS) $(MIPS_VERSION) $(ASOPTFLAGS) -o $@ $< endif @@ -937,6 +944,9 @@ endif # Incremental link to move z_message and z_game_over data into rodata $(BUILD_DIR)/src/code/z_message_z_game_over.o: $(BUILD_DIR)/src/code/z_message.o $(BUILD_DIR)/src/code/z_game_over.o $(LD) -r -G 0 -T linker_scripts/data_with_rodata.ld -o $@ $^ + $(PYTHON) tools/patch_data_with_rodata_mdebug.py $@ + +DEP_FILES += $(BUILD_DIR)/src/code/z_message.d $(BUILD_DIR)/src/code/z_game_over.d $(BUILD_DIR)/dmadata_table_spec.h $(BUILD_DIR)/compress_ranges.txt: $(BUILD_DIR)/spec $(MKDMADATA) $< $(BUILD_DIR)/dmadata_table_spec.h $(BUILD_DIR)/compress_ranges.txt @@ -945,33 +955,18 @@ $(BUILD_DIR)/dmadata_table_spec.h $(BUILD_DIR)/compress_ranges.txt: $(BUILD_DIR) $(BUILD_DIR)/src/boot/z_std_dma.o: $(BUILD_DIR)/dmadata_table_spec.h $(BUILD_DIR)/src/dmadata/dmadata.o: $(BUILD_DIR)/dmadata_table_spec.h -# Dependencies for files including from include/tables/ -# TODO remove when full header dependencies are used. -$(BUILD_DIR)/src/code/graph.o: include/tables/gamestate_table.h -$(BUILD_DIR)/src/code/object_table.o: include/tables/object_table.h -$(BUILD_DIR)/src/code/z_actor.o: include/tables/actor_table.h # so uses of ACTOR_ID_MAX update when the table length changes -$(BUILD_DIR)/src/code/z_actor_dlftbls.o: include/tables/actor_table.h -$(BUILD_DIR)/src/code/z_effect_soft_sprite_dlftbls.o: include/tables/effect_ss_table.h -$(BUILD_DIR)/src/code/z_game_dlftbls.o: include/tables/gamestate_table.h -$(BUILD_DIR)/src/code/z_scene_table.o: include/tables/scene_table.h include/tables/entrance_table.h -$(BUILD_DIR)/src/audio/general.o: $(SEQUENCE_TABLE) include/tables/sfx/*.h -$(BUILD_DIR)/src/audio/sfx_params.o: include/tables/sfx/*.h - $(BUILD_DIR)/src/%.o: src/%.c -ifneq ($(RUN_CC_CHECK),0) - $(CC_CHECK) $< -endif + $(CC_CHECK) $< -o $@ $(PREPROCESS) $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $< $(POSTPROCESS_OBJ) $@ $(OBJDUMP_CMD) -$(BUILD_DIR)/src/audio/session_init.o: src/audio/session_init.c $(BUILD_DIR)/assets/audio/soundfont_sizes.h $(BUILD_DIR)/assets/audio/sequence_sizes.h -ifneq ($(RUN_CC_CHECK),0) - $(CC_CHECK) $< -endif +$(BUILD_DIR)/src/audio/game/session_init.o: src/audio/game/session_init.c $(BUILD_DIR)/assets/audio/soundfont_sizes.h $(BUILD_DIR)/assets/audio/sequence_sizes.h + $(CC_CHECK) $< -o $@ $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $(@:.o=.tmp) $< $(LD) -r -T linker_scripts/data_with_rodata.ld -o $@ $(@:.o=.tmp) - @$(OBJDUMP) $(OBJDUMP_FLAGS) $@ > $(@:.o=.s) + $(PYTHON) tools/patch_data_with_rodata_mdebug.py $@ + $(OBJDUMP_CMD) ifeq ($(PLATFORM),IQUE) ifneq ($(NON_MATCHING),1) @@ -984,23 +979,27 @@ $(BUILD_DIR)/src/overlays/%_reloc.o: $(BUILD_DIR)/spec $(POSTPROCESS_OBJ) $(@:.o=.s) $(AS) $(ASFLAGS) $(@:.o=.s) -o $@ -$(BUILD_DIR)/assets/%.inc.c: assets/%.png - $(ZAPD) btex -eh -tt $(subst .,,$(suffix $*)) -i $< -o $@ +# Assets from assets/ -$(BUILD_DIR)/assets/%.inc.c: $(EXTRACTED_DIR)/assets/%.png - $(ZAPD) btex -eh -tt $(subst .,,$(suffix $*)) -i $< -o $@ +$(BUILD_DIR)/assets/%.inc.c: assets/%.png + tools/assets/build_from_png/build_from_png $< $(dir $@) assets/$(dir $*) $(wildcard $(EXTRACTED_DIR)/assets/$(dir $*)) $(BUILD_DIR)/assets/%.bin.inc.c: assets/%.bin - $(ZAPD) bblb -eh -i $< -o $@ - -$(BUILD_DIR)/assets/%.bin.inc.c: $(EXTRACTED_DIR)/assets/%.bin - $(ZAPD) bblb -eh -i $< -o $@ + $(BIN2C) -t 1 $< $@ $(BUILD_DIR)/assets/%.jpg.inc.c: assets/%.jpg - $(ZAPD) bren -eh -i $< -o $@ + $(N64TEXCONV) JFIF "" $< $@ + +# Assets from extracted/ + +$(BUILD_DIR)/assets/%.inc.c: $(EXTRACTED_DIR)/assets/%.png + tools/assets/build_from_png/build_from_png $< $(dir $@) $(wildcard assets/$(dir $*)) $(EXTRACTED_DIR)/assets/$(dir $*) + +$(BUILD_DIR)/assets/%.bin.inc.c: $(EXTRACTED_DIR)/assets/%.bin + $(BIN2C) -t 1 $< $@ $(BUILD_DIR)/assets/%.jpg.inc.c: $(EXTRACTED_DIR)/assets/%.jpg - $(ZAPD) bren -eh -i $< -o $@ + $(N64TEXCONV) JFIF "" $< $@ # Audio @@ -1068,11 +1067,12 @@ $(BUILD_DIR)/assets/audio/soundfonts/%.xml: $(EXTRACTED_DIR)/assets/audio/soundf $(BUILD_DIR)/assets/audio/soundfonts/%.c $(BUILD_DIR)/assets/audio/soundfonts/%.h $(BUILD_DIR)/assets/audio/soundfonts/%.name: $(BUILD_DIR)/assets/audio/soundfonts/%.xml | $(SAMPLEBANK_BUILD_XMLS) $(AIFC_FILES) # This rule can be triggered for either the .c or .h file, so $@ may refer to either the .c or .h file. A simple # substitution $(@:.c=.h) will fail ~50% of the time with -j. Instead, don't assume anything about the suffix of $@. - $(SFC) $(SFCFLAGS) --makedepend $(basename $@).d $< $(basename $@).c $(basename $@).h $(basename $@).name + $(SFC) $(SFCFLAGS) --makedepend $(basename $@).c.d $< $(basename $@).c $(basename $@).h $(basename $@).name -include $(SOUNDFONT_DEP_FILES) $(BUILD_DIR)/assets/audio/soundfonts/%.o: $(BUILD_DIR)/assets/audio/soundfonts/%.c $(BUILD_DIR)/assets/audio/soundfonts/%.name + $(CPP) $(MIPS_BUILTIN_DEFS) $(CPPFLAGS) -x assembler-with-cpp $(INC) -I include/audio -MD -MF $(@:.o=.d) -MT $@ $< -o /dev/null # compile c to unlinked object $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -I include/audio -o $(@:.o=.tmp) $< # partial link @@ -1093,11 +1093,11 @@ endif # then assemble the sequences... $(BUILD_DIR)/assets/audio/sequences/%.o: assets/audio/sequences/%.seq include/audio/aseq.h $(SEQUENCE_TABLE) | $(SOUNDFONT_HEADERS) - $(SEQ_CPP) $(SEQ_CPPFLAGS) $< -o $(@:.o=.s) -MMD -MT $@ + $(SEQ_CPP) $(SEQ_CPPFLAGS) -MD -MT $@ $< -o $(@:.o=.s) $(AS) $(ASFLAGS) -I $(BUILD_DIR)/assets/audio/soundfonts -I include/audio -I $(dir $<) $(@:.o=.s) -o $@ $(BUILD_DIR)/assets/audio/sequences/%.o: $(EXTRACTED_DIR)/assets/audio/sequences/%.seq include/audio/aseq.h $(SEQUENCE_TABLE) | $(SOUNDFONT_HEADERS) - $(SEQ_CPP) $(SEQ_CPPFLAGS) $< -o $(@:.o=.s) -MMD -MT $@ + $(SEQ_CPP) $(SEQ_CPPFLAGS) -MD -MT $@ $< -o $(@:.o=.s) $(AS) $(ASFLAGS) -I $(BUILD_DIR)/assets/audio/soundfonts -I include/audio -I $(dir $<) $(@:.o=.s) -o $@ ifeq ($(AUDIO_BUILD_DEBUG),1) $(OBJCOPY) -O binary -j.data $@ $(@:.o=.aseq) @@ -1131,11 +1131,10 @@ $(BUILD_DIR)/src/audio/tables/sequence_table.o: src/audio/tables/sequence_table. $(BUILD_DIR)/src/audio/tables/sequence_table.o: CFLAGS += -I include/tables $(BUILD_DIR)/src/audio/tables/%.o: src/audio/tables/%.c -ifneq ($(RUN_CC_CHECK),0) - $(CC_CHECK) $< -endif + $(CC_CHECK) $< -o $@ $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $(@:.o=.tmp) $< $(LD) -r -T linker_scripts/data_with_rodata.ld $(@:.o=.tmp) -o $@ + $(PYTHON) tools/patch_data_with_rodata_mdebug.py $@ @$(RM) $(@:.o=.tmp) $(BUILD_DIR)/assets/audio/sequence_font_table.o: $(BUILD_DIR)/assets/audio/sequence_font_table.s diff --git a/assets/audio/sequences/seq_0.prg.seq b/assets/audio/sequences/seq_0.prg.seq index 602ed791c6..b5f8a2906d 100644 --- a/assets/audio/sequences/seq_0.prg.seq +++ b/assets/audio/sequences/seq_0.prg.seq @@ -1302,7 +1302,7 @@ CHAN_08EC: /* 0x08EE [0xC7 0x02 0x09 0x04 ] */ stseq 2, LAYER_0903 + STSEQ_NOTEDV_DELAY_HI /* 0x08F2 [0xC7 0x02 0x08 0xFD ] */ stseq 2, CHAN_08FC + STSEQ_LDI_IMM /* 0x08F6 [0xB8 0x0C ] */ rand 12 -/* 0x08F8 [0xC7 0x5C 0x09 0x03 ] */ stseq (NOTEDV_OPCODE | PITCH_DF3), LAYER_0903 + STSEQ_NOTEDV_OPCODE_PITCH +/* 0x08F8 [0xC7 0x5C 0x09 0x03 ] */ stseq (ASEQ_OP_LAYER_NOTEDV | PITCH_DF3), LAYER_0903 + STSEQ_NOTEDV_OPCODE_PITCH CHAN_08FC: /* 0x08FC [0xCC 0x01 ] */ ldi 1 /* 0x08FE [0xFC 0x00 0x48 ] */ call CHAN_0048 @@ -3022,10 +3022,10 @@ LAYER_140B: /* 0x1411 [0xCC 0x00 ] */ ldi 0 /* 0x1413 [0x76 ] */ stio IO_PORT_6 CHAN_1414: -/* 0x1414 [0xCB 0x14 0x2D ] */ ldseq UNK_142D +/* 0x1414 [0xCB 0x14 0x2D ] */ ldseq ARRAY_142D /* 0x1417 [0xC7 0x00 0x14 0x5B ] */ stseq 0, LAYER_145A + STSEQ_TRANSPOSITION /* 0x141B [0x66 ] */ ldio IO_PORT_6 -/* 0x141C [0xCB 0x14 0x31 ] */ ldseq UNK_1431 +/* 0x141C [0xCB 0x14 0x31 ] */ ldseq ARRAY_1431 /* 0x141F [0xC7 0x00 0x14 0x56 ] */ stseq 0, LAYER_1455 + STSEQ_NOTEDV_DELAY_HI /* 0x1423 [0xCC 0x18 ] */ ldi 24 /* 0x1425 [0x71 ] */ stio IO_PORT_1 @@ -3033,14 +3033,14 @@ CHAN_1414: /* 0x1429 [0x89 0x14 0x35 ] */ ldlayer 1, LAYER_1435 /* 0x142C [0xFF ] */ end -UNK_142D: - .byte 0x00, 0x04, 0x08, 0x00 +.array ARRAY_142D + .byte 0, 4, 8, 0 -UNK_1431: +.array ARRAY_1431 #if !OOT_PAL_N64 - .byte 0x60, 0x30, 0x18, 0x60 + .byte 96, 48, 24, 96 #else - .byte 0x73, 0x3A, 0x1D, 0x60 + .byte 115, 58, 29, 96 #endif .layer LAYER_1435 @@ -3943,15 +3943,15 @@ LAYER_1B5C: CHAN_1BA1: /* 0x1BA1 [0x66 ] */ ldio IO_PORT_6 /* 0x1BA2 [0xC9 0x03 ] */ and 3 -/* 0x1BA4 [0xCB 0x1B 0xB6 ] */ ldseq UNK_1BB6 +/* 0x1BA4 [0xCB 0x1B 0xB6 ] */ ldseq ARRAY_1BB6 /* 0x1BA7 [0xC7 0x00 0x1B 0xE7 ] */ stseq 0, LAYER_1BE6 + STSEQ_LDELAY /* 0x1BAB [0xC7 0x08 0x1B 0xB0 ] */ stseq 8, STSEQ_HERE + STSEQ_LDI_IMM /* 0x1BAF [0xCC 0x30 ] */ ldi 48 /* 0x1BB1 [0xFC 0x00 0x48 ] */ call CHAN_0048 /* 0x1BB4 [0xF4 0xEB ] */ rjump CHAN_1BA1 -UNK_1BB6: - .byte 0x20, 0x0E, 0x05, 0x20 +.array ARRAY_1BB6 + .byte 32, 14, 5, 32 .layer LAYER_1BBA /* 0x1BBA [0xC2 0x30 ] */ transpose 48 @@ -4031,16 +4031,16 @@ CHAN_1C3B: /* 0x1C3B [0x63 ] */ ldio IO_PORT_3 /* 0x1C3C [0xC9 0xF0 ] */ and 240 /* 0x1C3E [0xF3 0x0E ] */ rbeqz CHAN_1C4E -/* 0x1C40 [0xCE 0x00 0x00 ] */ ldptr SEQ_0000 +/* 0x1C40 [0xCE 0x00 0x00 ] */ ldptri 0 /* 0x1C43 [0xCF 0x1C 0x80 ] */ stptrtoseq ENVELOPE_1C7A + STSEQ_ENVELOPE_POINT(3) -/* 0x1C46 [0xCE 0x7F 0xBC ] */ ldptr SEQ_0_END + 0x1538 +/* 0x1C46 [0xCE 0x7F 0xBC ] */ ldptri 32700 /* 0x1C49 [0xCF 0x1C 0x8C ] */ stptrtoseq ENVELOPE_1C86 + STSEQ_ENVELOPE_POINT(3) /* 0x1C4C [0xF4 0x0C ] */ rjump CHAN_1C5A CHAN_1C4E: -/* 0x1C4E [0xCE 0x00 0x00 ] */ ldptr SEQ_0000 +/* 0x1C4E [0xCE 0x00 0x00 ] */ ldptri 0 /* 0x1C51 [0xCF 0x1C 0x8C ] */ stptrtoseq ENVELOPE_1C86 + STSEQ_ENVELOPE_POINT(3) -/* 0x1C54 [0xCE 0x7F 0xBC ] */ ldptr SEQ_0_END + 0x1538 +/* 0x1C54 [0xCE 0x7F 0xBC ] */ ldptri 32700 /* 0x1C57 [0xCF 0x1C 0x80 ] */ stptrtoseq ENVELOPE_1C7A + STSEQ_ENVELOPE_POINT(3) CHAN_1C5A: /* 0x1C5A [0xCC 0x01 ] */ ldi 1 @@ -4978,7 +4978,7 @@ CHAN_2274: /* 0x2284 [0x56 ] */ subio IO_PORT_6 /* 0x2285 [0xC9 0x07 ] */ and 7 CHAN_2287: -/* 0x2287 [0xC7 0x60 0x22 0x98 ] */ stseq (NOTEDV_OPCODE | PITCH_F3), LAYER_2298 + STSEQ_NOTEDV_OPCODE_PITCH +/* 0x2287 [0xC7 0x60 0x22 0x98 ] */ stseq (ASEQ_OP_LAYER_NOTEDV | PITCH_F3), LAYER_2298 + STSEQ_NOTEDV_OPCODE_PITCH /* 0x228B [0x66 ] */ ldio IO_PORT_6 /* 0x228C [0xC8 0xFC ] */ sub 252 /* 0x228E [0xC9 0x04 ] */ and 4 @@ -6529,7 +6529,7 @@ LAYER_2C4E: .channel CHAN_2C54 /* 0x2C54 [0x89 0x2C 0x62 ] */ ldlayer 1, LAYER_2C62 -/* 0x2C57 [0xCC 0x58 ] */ ldi (NOTEDV_OPCODE | PITCH_A2) +/* 0x2C57 [0xCC 0x58 ] */ ldi (ASEQ_OP_LAYER_NOTEDV | PITCH_A2) /* 0x2C59 [0xC7 0x00 0x22 0x88 ] */ stseq 0, CHAN_2287 + STSEQ_STSEQ_IMM /* 0x2C5D [0xFB 0x22 0x67 ] */ jump CHAN_2267 @@ -6649,7 +6649,7 @@ CHAN_2D01: .channel CHAN_2D13 /* 0x2D13 [0x89 0x2D 0x25 ] */ ldlayer 1, LAYER_2D25 /* 0x2D16 [0x8A 0x2D 0x23 ] */ ldlayer 2, LAYER_2D23 -/* 0x2D19 [0xCC 0x66 ] */ ldi (NOTEDV_OPCODE | PITCH_B3) +/* 0x2D19 [0xCC 0x66 ] */ ldi (ASEQ_OP_LAYER_NOTEDV | PITCH_B3) /* 0x2D1B [0xC7 0x00 0x22 0x88 ] */ stseq 0, CHAN_2287 + STSEQ_STSEQ_IMM /* 0x2D1F [0xFB 0x22 0x67 ] */ jump CHAN_2267 /* 0x2D22 [0xFF ] */ end @@ -7056,9 +7056,9 @@ CHAN_2F7D: /* 0x2F85 [0xB8 0x02 ] */ rand 2 /* 0x2F87 [0xC7 0x2F 0x2F 0xAC ] */ stseq 47, LAYER_2FAB + STSEQ_TRANSPOSITION /* 0x2F8B [0xBD 0x00 0x6A 0x00 0x96] */ randptr 106, 150 -/* 0x2F90 [0xCF 0x2F 0xB6 ] */ stptrtoseq UNK_2FB6 +/* 0x2F90 [0xCF 0x2F 0xB6 ] */ stptrtoseq BUF_2FB6 /* 0x2F93 [0xCC 0x01 ] */ ldi 1 -/* 0x2F95 [0xCB 0x2F 0xB6 ] */ ldseq UNK_2FB6 +/* 0x2F95 [0xCB 0x2F 0xB6 ] */ ldseq BUF_2FB6 /* 0x2F98 [0xC7 0x00 0x2F 0xA0 ] */ stseq 0, CHAN_2F9F + STSEQ_LDI_IMM /* 0x2F9C [0x88 0x2F 0xAB ] */ ldlayer 0, LAYER_2FAB CHAN_2F9F: @@ -7077,8 +7077,8 @@ CHAN_2F9F: /* 0x2FB2 [0xC0 0xFD 0x00 ] */ ldelay 32000 /* 0x2FB5 [0xFF ] */ end -UNK_2FB6: - .half 0x0000 +BUF_2FB6: + .half 0 .channel CHAN_2FB8 /* 0x2FB8 [0x88 0x2F 0xBF ] */ ldlayer 0, LAYER_2FBF @@ -9201,7 +9201,7 @@ CHAN_4162: /* 0x4164 [0xC7 0x03 0x41 0x7A ] */ stseq 3, LAYER_4179 + STSEQ_NOTEDV_DELAY_HI /* 0x4168 [0xC7 0x03 0x41 0x73 ] */ stseq 3, CHAN_4172 + STSEQ_LDI_IMM /* 0x416C [0xB8 0x08 ] */ rand 8 -/* 0x416E [0xC7 0x5B 0x41 0x79 ] */ stseq (NOTEDV_OPCODE | PITCH_C3), LAYER_4179 + STSEQ_NOTEDV_OPCODE_PITCH +/* 0x416E [0xC7 0x5B 0x41 0x79 ] */ stseq (ASEQ_OP_LAYER_NOTEDV | PITCH_C3), LAYER_4179 + STSEQ_NOTEDV_OPCODE_PITCH CHAN_4172: /* 0x4172 [0xCC 0x01 ] */ ldi 1 /* 0x4174 [0xFC 0x00 0x48 ] */ call CHAN_0048 @@ -9763,7 +9763,7 @@ LAYER_4245: /* 0x44C9 [0x88 0x44 0xD7 ] */ ldlayer 0, LAYER_44D7 /* 0x44CC [0xED 0x14 ] */ gain 20 /* 0x44CE [0xB8 0x04 ] */ rand 4 -/* 0x44D0 [0xC7 0x6B 0x44 0xD7 ] */ stseq (NOTEDV_OPCODE | PITCH_E4), LAYER_44D7 + STSEQ_NOTEDV_OPCODE_PITCH +/* 0x44D0 [0xC7 0x6B 0x44 0xD7 ] */ stseq (ASEQ_OP_LAYER_NOTEDV | PITCH_E4), LAYER_44D7 + STSEQ_NOTEDV_OPCODE_PITCH /* 0x44D4 [0xD9 0xE8 ] */ releaserate 232 /* 0x44D6 [0xFF ] */ end @@ -10353,7 +10353,7 @@ LAYER_47B3: /* 0x4860 [0x88 0x48 0x70 ] */ ldlayer 0, LAYER_4870 CHAN_4863: /* 0x4863 [0xB8 0x04 ] */ rand 4 -/* 0x4865 [0xC7 0x60 0x48 0x70 ] */ stseq (NOTEDV_OPCODE | PITCH_F3), LAYER_4870 + STSEQ_NOTEDV_OPCODE_PITCH +/* 0x4865 [0xC7 0x60 0x48 0x70 ] */ stseq (ASEQ_OP_LAYER_NOTEDV | PITCH_F3), LAYER_4870 + STSEQ_NOTEDV_OPCODE_PITCH /* 0x4869 [0xCC 0x12 ] */ ldi 18 /* 0x486B [0xFC 0x00 0x48 ] */ call CHAN_0048 /* 0x486E [0xF4 0xF3 ] */ rjump CHAN_4863 @@ -12265,9 +12265,9 @@ LAYER_53FD: .channel CHAN_5403 /* 0x5403 [0xC1 0x7E ] */ instr FONTANY_INSTR_SFX /* 0x5405 [0x64 ] */ ldio IO_PORT_SFX_INDEX_LOBITS -/* 0x5406 [0xC8 0xB0 ] */ sub 176 -/* 0x5408 [0xC7 0x00 0x54 0x17 ] */ stseq (NOTEDVG_OPCODE | PITCH_A0), LAYER_5417 + STSEQ_NOTEDVG_OPCODE_PITCH -/* 0x540C [0xCB 0x54 0x1C ] */ ldseq UNK_541C +/* 0x5406 [0xC8 0xB0 ] */ sub NA_SE_EN_TWINROBA_LAUGH & 0xFF +/* 0x5408 [0xC7 0x00 0x54 0x17 ] */ stseq (ASEQ_OP_LAYER_NOTEDVG | PITCH_A0), LAYER_5417 + STSEQ_NOTEDVG_OPCODE_PITCH +/* 0x540C [0xCB 0x54 0x1C ] */ ldseq ARRAY_541C /* 0x540F [0xC7 0x00 0x54 0x19 ] */ stseq 0, LAYER_5417 + STSEQ_NOTEDVG_DELAY_LO /* 0x5413 [0x88 0x54 0x17 ] */ ldlayer 0, LAYER_5417 /* 0x5416 [0xFF ] */ end @@ -12276,10 +12276,10 @@ LAYER_53FD: /* 0x5417 [0x00 0x00 0x64 0x00 ] */ notedvg PITCH_A0, 0, 100, 0 /* 0x541B [0xFF ] */ end -UNK_541C: - .byte 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64 - .byte 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64 - .byte 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64 +.array ARRAY_541C + .byte 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 + .byte 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 + .byte 100, 100, 100, 100, 100, 100, 100 .channel CHAN_5443 /* 0x5443 [0x88 0x42 0x20 ] */ ldlayer 0, LAYER_4220 @@ -12640,7 +12640,7 @@ CHAN_565E: /* 0x5660 [0xC7 0x28 0x56 0x76 ] */ stseq 40, LAYER_5675 + STSEQ_NOTEDV_DELAY_HI /* 0x5664 [0xC7 0x28 0x56 0x6F ] */ stseq 40, CHAN_566E + STSEQ_LDI_IMM /* 0x5668 [0xB8 0x06 ] */ rand 6 -/* 0x566A [0xC7 0x64 0x56 0x75 ] */ stseq (NOTEDV_OPCODE | PITCH_A3), LAYER_5675 + STSEQ_NOTEDV_OPCODE_PITCH +/* 0x566A [0xC7 0x64 0x56 0x75 ] */ stseq (ASEQ_OP_LAYER_NOTEDV | PITCH_A3), LAYER_5675 + STSEQ_NOTEDV_OPCODE_PITCH CHAN_566E: /* 0x566E [0xCC 0x01 ] */ ldi 1 /* 0x5670 [0xFC 0x00 0x48 ] */ call CHAN_0048 @@ -13861,11 +13861,11 @@ CHAN_5EE2: /* 0x5EF7 [0x71 ] */ stio IO_PORT_1 /* 0x5EF8 [0x67 ] */ ldio IO_PORT_7 /* 0x5EF9 [0xC9 0x07 ] */ and 7 -/* 0x5EFB [0xCB 0x5F 0x30 ] */ ldseq UNK_5F30 +/* 0x5EFB [0xCB 0x5F 0x30 ] */ ldseq ARRAY_5F30 /* 0x5EFE [0xC7 0x00 0x5F 0x0D ] */ stseq 0, CHAN_5F0C + STSEQ_INSTR /* 0x5F02 [0x67 ] */ ldio IO_PORT_7 /* 0x5F03 [0xC9 0x07 ] */ and 7 -/* 0x5F05 [0xCB 0x5F 0x38 ] */ ldseq UNK_5F38 +/* 0x5F05 [0xCB 0x5F 0x38 ] */ ldseq ARRAY_5F38 /* 0x5F08 [0xC7 0x00 0x5F 0x2E ] */ stseq 0, LAYER_5F2B + STSEQ_NOTEDV_VELOCITY CHAN_5F0C: /* 0x5F0C [0xC1 0x34 ] */ instr SF0_INST_52 @@ -13894,11 +13894,18 @@ LAYER_5F2B: /* 0x5F2B [0x67 0x81 0xE0 0x7F ] */ notedv PITCH_C4, 480, 127 /* 0x5F2F [0xFF ] */ end -UNK_5F30: - .byte 0x34, 0x55, 0x56, 0x59, 0x53, 0x52, 0x34, 0x34 +.array ARRAY_5F30 + .byte SF0_INST_52 + .byte SF0_INST_85 + .byte SF0_INST_86 + .byte SF0_INST_89 + .byte SF0_INST_83 + .byte SF0_INST_82 + .byte SF0_INST_52 + .byte SF0_INST_52 -UNK_5F38: - .byte 0x73, 0x73, 0x64, 0x73, 0x64, 0x73, 0x73, 0x73 +.array ARRAY_5F38 + .byte 115, 115, 100, 115, 100, 115, 115, 115 .channel CHAN_5F40 /* 0x5F40 [0xCC 0x81 ] */ ldi 129 @@ -14044,11 +14051,11 @@ CHAN_6116: /* 0x6116 [0x3E 0x06 ] */ stcio 14, IO_PORT_6 /* 0x6118 [0x3F 0x06 ] */ stcio 15, IO_PORT_6 CHAN_611A: -/* 0x611A [0xCB 0x61 0x6D ] */ ldseq UNK_616D -/* 0x611D [0xC7 0x40 0x61 0x2D ] */ stseq (NOTEDV_OPCODE | PITCH_A0), LAYER_612D + STSEQ_NOTEDV_OPCODE_PITCH +/* 0x611A [0xCB 0x61 0x6D ] */ ldseq ARRAY_616D +/* 0x611D [0xC7 0x40 0x61 0x2D ] */ stseq (ASEQ_OP_LAYER_NOTEDV | SF0_EFFECT_0), LAYER_612D + STSEQ_NOTEDV_OPCODE_PITCH /* 0x6121 [0x66 ] */ ldio IO_PORT_6 CHAN_6122: -/* 0x6122 [0xCB 0x61 0x71 ] */ ldseq UNK_6171 +/* 0x6122 [0xCB 0x61 0x71 ] */ ldseq ARRAY_6171 CHAN_6125: /* 0x6125 [0xC7 0x00 0x61 0x2F ] */ stseq 0, LAYER_612D + STSEQ_NOTEDV_VELOCITY_2 /* 0x6129 [0x88 0x61 0x2D ] */ ldlayer 0, LAYER_612D @@ -14079,8 +14086,8 @@ CHAN_613E: /* 0x6145 [0xCC 0x00 ] */ ldi 0 // Reads the byte at (PTR + 0) into TR (the note) /* 0x6147 [0xB6 ] */ dyntblv - // Store NOTEDV_OPCODE + TR into the pitch -/* 0x6148 [0xC7 0x40 0x61 0x2D ] */ stseq (NOTEDV_OPCODE | PITCH_A0), LAYER_612D + STSEQ_NOTEDV_OPCODE_PITCH + // Store ASEQ_OP_LAYER_NOTEDV + TR into the pitch +/* 0x6148 [0xC7 0x40 0x61 0x2D ] */ stseq (ASEQ_OP_LAYER_NOTEDV | SF0_EFFECT_0), LAYER_612D + STSEQ_NOTEDV_OPCODE_PITCH // Load 1 into TR /* 0x614C [0xCC 0x01 ] */ ldi 1 // Reads the byte at (PTR + 1) into TR (the velocity) @@ -14096,23 +14103,26 @@ CHAN_6151: /* 0x615B [0xF4 0xBD ] */ rjump CHAN_611A .channel CHAN_615D -/* 0x615D [0xCE 0x61 0x6D ] */ ldptr UNK_616D +/* 0x615D [0xCE 0x61 0x6D ] */ ldptr ARRAY_616D /* 0x6160 [0xCF 0x61 0x1B ] */ stptrtoseq CHAN_611A + STSEQ_PTR_LDSEQ -/* 0x6163 [0xCE 0x61 0x71 ] */ ldptr UNK_6171 +/* 0x6163 [0xCE 0x61 0x71 ] */ ldptr ARRAY_6171 /* 0x6166 [0xCF 0x61 0x23 ] */ stptrtoseq CHAN_6122 + STSEQ_PTR_LDSEQ /* 0x6169 [0xCC 0x04 ] */ ldi 4 /* 0x616B [0xF4 0x85 ] */ rjump CHAN_60F2 -UNK_616D: - .byte 0x00, 0x01, 0x02, 0x03 +.array ARRAY_616D + .byte SF0_EFFECT_0 + .byte SF0_EFFECT_1 + .byte SF0_EFFECT_2 + .byte SF0_EFFECT_3 -UNK_6171: - .byte 0x69, 0x69, 0x69, 0x69 +.array ARRAY_6171 + .byte 105, 105, 105, 105 .channel CHAN_6175 -/* 0x6175 [0xCE 0x61 0x97 ] */ ldptr UNK_6197 +/* 0x6175 [0xCE 0x61 0x97 ] */ ldptr ARRAY_6197 /* 0x6178 [0xCF 0x61 0x1B ] */ stptrtoseq CHAN_611A + STSEQ_PTR_LDSEQ -/* 0x617B [0xCE 0x61 0x99 ] */ ldptr UNK_6199 +/* 0x617B [0xCE 0x61 0x99 ] */ ldptr ARRAY_6199 /* 0x617E [0xCF 0x61 0x23 ] */ stptrtoseq CHAN_6122 + STSEQ_PTR_LDSEQ /* 0x6181 [0xB8 0x02 ] */ rand 2 /* 0x6183 [0xF4 0xAF ] */ rjump CHAN_6134 @@ -14132,16 +14142,17 @@ CHAN_618C: CHAN_6196: /* 0x6196 [0x76 ] */ stio IO_PORT_6 -UNK_6197: - .byte 0x04, 0x05 +.array ARRAY_6197 + .byte SF0_EFFECT_4 + .byte SF0_EFFECT_5 -UNK_6199: - .byte 0x6E, 0x6E +.array ARRAY_6199 + .byte 110, 110 .channel CHAN_619B -/* 0x619B [0xCE 0x61 0xBD ] */ ldptr UNK_61BD +/* 0x619B [0xCE 0x61 0xBD ] */ ldptr ARRAY_61BD /* 0x619E [0xCF 0x61 0x1B ] */ stptrtoseq CHAN_611A + STSEQ_PTR_LDSEQ -/* 0x61A1 [0xCE 0x61 0xBF ] */ ldptr UNK_61BF +/* 0x61A1 [0xCE 0x61 0xBF ] */ ldptr ARRAY_61BF /* 0x61A4 [0xCF 0x61 0x23 ] */ stptrtoseq CHAN_6122 + STSEQ_PTR_LDSEQ /* 0x61A7 [0xB8 0x02 ] */ rand 2 /* 0x61A9 [0xF4 0x89 ] */ rjump CHAN_6134 @@ -14161,109 +14172,119 @@ CHAN_61B2: CHAN_61BC: /* 0x61BC [0x76 ] */ stio IO_PORT_6 -UNK_61BD: - .byte 0x15, 0x16 +.array ARRAY_61BD + .byte SF0_EFFECT_21 + .byte SF0_EFFECT_22 -UNK_61BF: - .byte 0x69, 0x69 +.array ARRAY_61BF + .byte 105, 105 .channel CHAN_61C1 -/* 0x61C1 [0xCE 0x61 0xD1 ] */ ldptr UNK_61D1 +/* 0x61C1 [0xCE 0x61 0xD1 ] */ ldptr ARRAY_61D1 /* 0x61C4 [0xCF 0x61 0x1B ] */ stptrtoseq CHAN_611A + STSEQ_PTR_LDSEQ -/* 0x61C7 [0xCE 0x61 0xD3 ] */ ldptr UNK_61D3 +/* 0x61C7 [0xCE 0x61 0xD3 ] */ ldptr ARRAY_61D3 /* 0x61CA [0xCF 0x61 0x23 ] */ stptrtoseq CHAN_6122 + STSEQ_PTR_LDSEQ /* 0x61CD [0xCC 0x00 ] */ ldi 0 /* 0x61CF [0xF4 0x80 ] */ rjump CHAN_6151 -UNK_61D1: - .byte 0x06, 0x19 +.array ARRAY_61D1 + .byte SF0_EFFECT_6 + .byte SF0_EFFECT_25 -UNK_61D3: - .byte 0x5F, 0x69 +.array ARRAY_61D3 + .byte 95, 105 .channel CHAN_61D5 -/* 0x61D5 [0xCE 0x61 0xE6 ] */ ldptr UNK_61E6 +/* 0x61D5 [0xCE 0x61 0xE6 ] */ ldptr ARRAY_61E6 /* 0x61D8 [0xCF 0x61 0x1B ] */ stptrtoseq CHAN_611A + STSEQ_PTR_LDSEQ -/* 0x61DB [0xCE 0x61 0xE8 ] */ ldptr UNK_61E8 +/* 0x61DB [0xCE 0x61 0xE8 ] */ ldptr ARRAY_61E8 /* 0x61DE [0xCF 0x61 0x23 ] */ stptrtoseq CHAN_6122 + STSEQ_PTR_LDSEQ /* 0x61E1 [0xB8 0x02 ] */ rand 2 /* 0x61E3 [0xFB 0x61 0x34 ] */ jump CHAN_6134 -UNK_61E6: - .byte 0x07, 0x08 +.array ARRAY_61E6 + .byte SF0_EFFECT_7 + .byte SF0_EFFECT_8 -UNK_61E8: - .byte 0x48, 0x50 +.array ARRAY_61E8 + .byte 72, 80 .channel CHAN_61EA -/* 0x61EA [0xCE 0x61 0xFB ] */ ldptr UNK_61FB +/* 0x61EA [0xCE 0x61 0xFB ] */ ldptr ARRAY_61FB /* 0x61ED [0xCF 0x61 0x1B ] */ stptrtoseq CHAN_611A + STSEQ_PTR_LDSEQ -/* 0x61F0 [0xCE 0x61 0xFE ] */ ldptr UNK_61FE +/* 0x61F0 [0xCE 0x61 0xFE ] */ ldptr ARRAY_61FE /* 0x61F3 [0xCF 0x61 0x23 ] */ stptrtoseq CHAN_6122 + STSEQ_PTR_LDSEQ /* 0x61F6 [0xCC 0x03 ] */ ldi 3 /* 0x61F8 [0xFB 0x60 0xF2 ] */ jump CHAN_60F2 -UNK_61FB: - .byte 0x09, 0x0A, 0x0B +.array ARRAY_61FB + .byte SF0_EFFECT_9 + .byte SF0_EFFECT_10 + .byte SF0_EFFECT_11 -UNK_61FE: - .byte 0x75, 0x75, 0x75 +.array ARRAY_61FE + .byte 117, 117, 117 .channel CHAN_6201 -/* 0x6201 [0xCE 0x62 0x12 ] */ ldptr UNK_6212 +/* 0x6201 [0xCE 0x62 0x12 ] */ ldptr ARRAY_6212 /* 0x6204 [0xCF 0x61 0x1B ] */ stptrtoseq CHAN_611A + STSEQ_PTR_LDSEQ -/* 0x6207 [0xCE 0x62 0x15 ] */ ldptr UNK_6215 +/* 0x6207 [0xCE 0x62 0x15 ] */ ldptr ARRAY_6215 /* 0x620A [0xCF 0x61 0x23 ] */ stptrtoseq CHAN_6122 + STSEQ_PTR_LDSEQ /* 0x620D [0xCC 0x03 ] */ ldi 3 /* 0x620F [0xFB 0x60 0xF2 ] */ jump CHAN_60F2 -UNK_6212: - .byte 0x0C, 0x0D, 0x0E +.array ARRAY_6212 + .byte SF0_EFFECT_12 + .byte SF0_EFFECT_13 + .byte SF0_EFFECT_14 -UNK_6215: - .byte 0x71, 0x71, 0x71 +.array ARRAY_6215 + .byte 113, 113, 113 .channel CHAN_6218 -/* 0x6218 [0xCE 0x62 0x29 ] */ ldptr UNK_6229 +/* 0x6218 [0xCE 0x62 0x29 ] */ ldptr ARRAY_6229 /* 0x621B [0xCF 0x61 0x1B ] */ stptrtoseq CHAN_611A + STSEQ_PTR_LDSEQ -/* 0x621E [0xCE 0x62 0x2B ] */ ldptr UNK_622B +/* 0x621E [0xCE 0x62 0x2B ] */ ldptr ARRAY_622B /* 0x6221 [0xCF 0x61 0x23 ] */ stptrtoseq CHAN_6122 + STSEQ_PTR_LDSEQ /* 0x6224 [0xB8 0x02 ] */ rand 2 /* 0x6226 [0xFB 0x61 0x34 ] */ jump CHAN_6134 -UNK_6229: - .byte 0x11, 0x12 +.array ARRAY_6229 + .byte SF0_EFFECT_17 + .byte SF0_EFFECT_18 -UNK_622B: - .byte 0x64, 0x64 +.array ARRAY_622B + .byte 100, 100 .channel CHAN_622D -/* 0x622D [0xCE 0x62 0x3E ] */ ldptr UNK_623E +/* 0x622D [0xCE 0x62 0x3E ] */ ldptr ARRAY_623E /* 0x6230 [0xCF 0x61 0x1B ] */ stptrtoseq CHAN_611A + STSEQ_PTR_LDSEQ -/* 0x6233 [0xCE 0x62 0x40 ] */ ldptr UNK_6240 +/* 0x6233 [0xCE 0x62 0x40 ] */ ldptr ARRAY_6240 /* 0x6236 [0xCF 0x61 0x23 ] */ stptrtoseq CHAN_6122 + STSEQ_PTR_LDSEQ /* 0x6239 [0xB8 0x02 ] */ rand 2 /* 0x623B [0xFB 0x61 0x34 ] */ jump CHAN_6134 -UNK_623E: - .byte 0x0F, 0x10 +.array ARRAY_623E + .byte SF0_EFFECT_15 + .byte SF0_EFFECT_16 -UNK_6240: - .byte 0x6E, 0x6E +.array ARRAY_6240 + .byte 110, 110 .channel CHAN_6242 -/* 0x6242 [0xCE 0x62 0x53 ] */ ldptr UNK_6253 +/* 0x6242 [0xCE 0x62 0x53 ] */ ldptr ARRAY_6253 /* 0x6245 [0xCF 0x61 0x1B ] */ stptrtoseq CHAN_611A + STSEQ_PTR_LDSEQ -/* 0x6248 [0xCE 0x62 0x55 ] */ ldptr UNK_6255 +/* 0x6248 [0xCE 0x62 0x55 ] */ ldptr ARRAY_6255 /* 0x624B [0xCF 0x61 0x23 ] */ stptrtoseq CHAN_6122 + STSEQ_PTR_LDSEQ /* 0x624E [0xB8 0x02 ] */ rand 2 /* 0x6250 [0xFB 0x61 0x34 ] */ jump CHAN_6134 -UNK_6253: - .byte 0x13, 0x17 +.array ARRAY_6253 + .byte SF0_EFFECT_19 + .byte SF0_EFFECT_23 -UNK_6255: - .byte 0x5A, 0x5A +.array ARRAY_6255 + .byte 90, 90 .channel CHAN_6257 /* 0x6257 [0x88 0x62 0x5B ] */ ldlayer 0, LAYER_625B @@ -14285,18 +14306,19 @@ UNK_6255: /* 0x626E [0xFF ] */ end .channel CHAN_626F -/* 0x626F [0xCE 0x62 0x80 ] */ ldptr UNK_6280 +/* 0x626F [0xCE 0x62 0x80 ] */ ldptr ARRAY_6280 /* 0x6272 [0xCF 0x61 0x1B ] */ stptrtoseq CHAN_611A + STSEQ_PTR_LDSEQ -/* 0x6275 [0xCE 0x62 0x82 ] */ ldptr UNK_6282 +/* 0x6275 [0xCE 0x62 0x82 ] */ ldptr ARRAY_6282 /* 0x6278 [0xCF 0x61 0x23 ] */ stptrtoseq CHAN_6122 + STSEQ_PTR_LDSEQ /* 0x627B [0xB8 0x02 ] */ rand 2 /* 0x627D [0xFB 0x61 0x34 ] */ jump CHAN_6134 -UNK_6280: - .byte 0x0F, 0x10 +.array ARRAY_6280 + .byte SF0_EFFECT_15 + .byte SF0_EFFECT_16 -UNK_6282: - .byte 0x69, 0x69 +.array ARRAY_6282 + .byte 105, 105 .channel CHAN_6284 /* 0x6284 [0xFB 0x61 0xEA ] */ jump CHAN_61EA @@ -14343,37 +14365,40 @@ UNK_6282: /* 0x62C5 [0xFF ] */ end .channel CHAN_62C6 -/* 0x62C6 [0xCE 0x62 0xCC ] */ ldptr UNK_62CC +/* 0x62C6 [0xCE 0x62 0xCC ] */ ldptr ARRAY_62CC /* 0x62C9 [0xFB 0x61 0x3E ] */ jump CHAN_613E -UNK_62CC: - .byte 0x00, 0x64 +.array ARRAY_62CC + .byte SF0_EFFECT_0 + .byte 100 .channel CHAN_62CE /* 0x62CE [0x66 ] */ ldio IO_PORT_6 /* 0x62CF [0xC8 0xFF ] */ sub 255 /* 0x62D1 [0x76 ] */ stio IO_PORT_6 /* 0x62D2 [0xC9 0x01 ] */ and 1 -/* 0x62D4 [0xCB 0x62 0xE8 ] */ ldseq UNK_62E8 -/* 0x62D7 [0xC7 0x40 0x64 0xBF ] */ stseq (NOTEDV_OPCODE | PITCH_A0), LAYER_64BF + STSEQ_NOTEDV_OPCODE_PITCH +/* 0x62D4 [0xCB 0x62 0xE8 ] */ ldseq ARRAY_62E8 +/* 0x62D7 [0xC7 0x40 0x64 0xBF ] */ stseq (ASEQ_OP_LAYER_NOTEDV | SF0_EFFECT_0), LAYER_64BF + STSEQ_NOTEDV_OPCODE_PITCH /* 0x62DB [0xB8 0x02 ] */ rand 2 -/* 0x62DD [0xCB 0x62 0xEA ] */ ldseq UNK_62EA +/* 0x62DD [0xCB 0x62 0xEA ] */ ldseq ARRAY_62EA /* 0x62E0 [0xC7 0x00 0x64 0xC1 ] */ stseq 0, LAYER_64BF + STSEQ_NOTEDV_VELOCITY_2 /* 0x62E4 [0x88 0x64 0xBF ] */ ldlayer 0, LAYER_64BF /* 0x62E7 [0xFF ] */ end -UNK_62E8: - .byte 0x1A, 0x1B +.array ARRAY_62E8 + .byte SF0_EFFECT_26 + .byte SF0_EFFECT_27 -UNK_62EA: - .byte 0x50, 0x55 +.array ARRAY_62EA + .byte 80, 85 .channel CHAN_62EC -/* 0x62EC [0xCE 0x62 0xF2 ] */ ldptr UNK_62F2 +/* 0x62EC [0xCE 0x62 0xF2 ] */ ldptr ARRAY_62F2 /* 0x62EF [0xFB 0x61 0x3E ] */ jump CHAN_613E -UNK_62F2: - .byte 0x05, 0x6E +.array ARRAY_62F2 + .byte SF0_EFFECT_5 + .byte 110 .channel CHAN_62F4 /* 0x62F4 [0x88 0x62 0xF8 ] */ ldlayer 0, LAYER_62F8 @@ -14385,72 +14410,82 @@ UNK_62F2: /* 0x62FD [0xFF ] */ end .channel CHAN_62FE -/* 0x62FE [0xCE 0x63 0x04 ] */ ldptr UNK_6304 +/* 0x62FE [0xCE 0x63 0x04 ] */ ldptr ARRAY_6304 /* 0x6301 [0xFB 0x61 0x3E ] */ jump CHAN_613E -UNK_6304: - .byte 0x04, 0x5F +.array ARRAY_6304 + .byte SF0_EFFECT_4 + .byte 95 .channel CHAN_6306 -/* 0x6306 [0xCE 0x63 0x0C ] */ ldptr UNK_630C +/* 0x6306 [0xCE 0x63 0x0C ] */ ldptr ARRAY_630C /* 0x6309 [0xFB 0x61 0x3E ] */ jump CHAN_613E -UNK_630C: - .byte 0x07, 0x52 +.array ARRAY_630C + .byte SF0_EFFECT_7 + .byte 82 .channel CHAN_630E -/* 0x630E [0xCE 0x63 0x14 ] */ ldptr UNK_6314 +/* 0x630E [0xCE 0x63 0x14 ] */ ldptr ARRAY_6314 /* 0x6311 [0xFB 0x61 0x3E ] */ jump CHAN_613E -UNK_6314: - .byte 0x06, 0x5F +.array ARRAY_6314 + .byte SF0_EFFECT_6 + .byte 95 .channel CHAN_6316 -/* 0x6316 [0xCE 0x63 0x1C ] */ ldptr UNK_631C +/* 0x6316 [0xCE 0x63 0x1C ] */ ldptr ARRAY_631C /* 0x6319 [0xFB 0x61 0x3E ] */ jump CHAN_613E -UNK_631C: - .byte 0x18, 0x6E +.array ARRAY_631C + .byte SF0_EFFECT_24 + .byte 110 .channel CHAN_631E -/* 0x631E [0xCE 0x63 0x24 ] */ ldptr UNK_6324 +/* 0x631E [0xCE 0x63 0x24 ] */ ldptr ARRAY_6324 /* 0x6321 [0xFB 0x61 0x3E ] */ jump CHAN_613E -UNK_6324: - .byte 0x3C, 0x64 +.array ARRAY_6324 + .byte SF0_EFFECT_60 + .byte 100 .channel CHAN_6326 -/* 0x6326 [0xCE 0x63 0x2C ] */ ldptr UNK_632C +/* 0x6326 [0xCE 0x63 0x2C ] */ ldptr ARRAY_632C /* 0x6329 [0xFB 0x61 0x3E ] */ jump CHAN_613E -UNK_632C: - .byte 0x3D, 0x6E +.array ARRAY_632C + .byte SF0_EFFECT_61 + .byte 110 .channel CHAN_632E -/* 0x632E [0xCE 0x63 0x34 ] */ ldptr UNK_6334 +/* 0x632E [0xCE 0x63 0x34 ] */ ldptr ARRAY_6334 /* 0x6331 [0xFB 0x61 0x3E ] */ jump CHAN_613E -UNK_6334: - .byte 0x0D, 0x71 +.array ARRAY_6334 + .byte SF0_EFFECT_13 + .byte 113 .channel CHAN_6336 -/* 0x6336 [0xCE 0x63 0x47 ] */ ldptr UNK_6347 +/* 0x6336 [0xCE 0x63 0x47 ] */ ldptr ARRAY_6347 /* 0x6339 [0xCF 0x61 0x1B ] */ stptrtoseq CHAN_611A + STSEQ_PTR_LDSEQ -/* 0x633C [0xCE 0x63 0x4B ] */ ldptr UNK_634B +/* 0x633C [0xCE 0x63 0x4B ] */ ldptr ARRAY_634B /* 0x633F [0xCF 0x61 0x23 ] */ stptrtoseq CHAN_6122 + STSEQ_PTR_LDSEQ /* 0x6342 [0xCC 0x04 ] */ ldi 4 /* 0x6344 [0xFB 0x60 0xF2 ] */ jump CHAN_60F2 -UNK_6347: - .byte 0x1C, 0x1D, 0x1E, 0x1F +.array ARRAY_6347 + .byte SF0_EFFECT_28 + .byte SF0_EFFECT_29 + .byte SF0_EFFECT_30 + .byte SF0_EFFECT_31 -UNK_634B: - .byte 0x6E, 0x6E, 0x6E, 0x6E +.array ARRAY_634B + .byte 110, 110, 110, 110 .channel CHAN_634F -/* 0x634F [0xCE 0x63 0x72 ] */ ldptr UNK_6372 +/* 0x634F [0xCE 0x63 0x72 ] */ ldptr ARRAY_6372 /* 0x6352 [0xCF 0x61 0x1B ] */ stptrtoseq CHAN_611A + STSEQ_PTR_LDSEQ -/* 0x6355 [0xCE 0x63 0x74 ] */ ldptr UNK_6374 +/* 0x6355 [0xCE 0x63 0x74 ] */ ldptr ARRAY_6374 /* 0x6358 [0xCF 0x61 0x23 ] */ stptrtoseq CHAN_6122 + STSEQ_PTR_LDSEQ /* 0x635B [0xB8 0x02 ] */ rand 2 /* 0x635D [0xFB 0x61 0x34 ] */ jump CHAN_6134 @@ -14470,21 +14505,22 @@ CHAN_6367: CHAN_6371: /* 0x6371 [0x76 ] */ stio IO_PORT_6 -UNK_6372: - .byte 0x20, 0x21 +.array ARRAY_6372 + .byte SF0_EFFECT_32 + .byte SF0_EFFECT_33 -UNK_6374: - .byte 0x6E, 0x6E +.array ARRAY_6374 + .byte 110, 110 .channel CHAN_6376 /* 0x6376 [0x66 ] */ ldio IO_PORT_6 /* 0x6377 [0xC8 0xFF ] */ sub 255 /* 0x6379 [0x76 ] */ stio IO_PORT_6 /* 0x637A [0xC9 0x01 ] */ and 1 -/* 0x637C [0xCB 0x63 0x96 ] */ ldseq UNK_6396 -/* 0x637F [0xC7 0x40 0x63 0x90 ] */ stseq (NOTEDV_OPCODE | PITCH_A0), LAYER_6390 + STSEQ_NOTEDV_OPCODE_PITCH +/* 0x637C [0xCB 0x63 0x96 ] */ ldseq ARRAY_6396 +/* 0x637F [0xC7 0x40 0x63 0x90 ] */ stseq (ASEQ_OP_LAYER_NOTEDV | SF0_EFFECT_0), LAYER_6390 + STSEQ_NOTEDV_OPCODE_PITCH /* 0x6383 [0xB8 0x02 ] */ rand 2 -/* 0x6385 [0xCB 0x63 0x98 ] */ ldseq UNK_6398 +/* 0x6385 [0xCB 0x63 0x98 ] */ ldseq ARRAY_6398 /* 0x6388 [0xC7 0x00 0x63 0x92 ] */ stseq 0, LAYER_6390 + STSEQ_NOTEDV_VELOCITY_2 /* 0x638C [0x88 0x63 0x90 ] */ ldlayer 0, LAYER_6390 /* 0x638F [0xFF ] */ end @@ -14494,95 +14530,104 @@ UNK_6374: /* 0x6393 [0xC0 0x30 ] */ ldelay 48 /* 0x6395 [0xFF ] */ end -UNK_6396: - .byte 0x22, 0x32 +.array ARRAY_6396 + .byte SF0_EFFECT_34 + .byte SF0_EFFECT_50 -UNK_6398: - .byte 0x64, 0x64 +.array ARRAY_6398 + .byte 100, 100 .channel CHAN_639A -/* 0x639A [0xCE 0x63 0xAB ] */ ldptr UNK_63AB +/* 0x639A [0xCE 0x63 0xAB ] */ ldptr ARRAY_63AB /* 0x639D [0xCF 0x61 0x1B ] */ stptrtoseq CHAN_611A + STSEQ_PTR_LDSEQ -/* 0x63A0 [0xCE 0x63 0xAD ] */ ldptr UNK_63AD +/* 0x63A0 [0xCE 0x63 0xAD ] */ ldptr ARRAY_63AD /* 0x63A3 [0xCF 0x61 0x23 ] */ stptrtoseq CHAN_6122 + STSEQ_PTR_LDSEQ /* 0x63A6 [0xB8 0x02 ] */ rand 2 /* 0x63A8 [0xFB 0x61 0x34 ] */ jump CHAN_6134 -UNK_63AB: - .byte 0x23, 0x24 +.array ARRAY_63AB + .byte SF0_EFFECT_35 + .byte SF0_EFFECT_36 -UNK_63AD: - .byte 0x5A, 0x46 +.array ARRAY_63AD + .byte 90, 70 .channel CHAN_63AF -/* 0x63AF [0xCE 0x63 0xC0 ] */ ldptr UNK_63C0 +/* 0x63AF [0xCE 0x63 0xC0 ] */ ldptr ARRAY_63C0 /* 0x63B2 [0xCF 0x61 0x1B ] */ stptrtoseq CHAN_611A + STSEQ_PTR_LDSEQ -/* 0x63B5 [0xCE 0x63 0xC3 ] */ ldptr UNK_63C3 +/* 0x63B5 [0xCE 0x63 0xC3 ] */ ldptr ARRAY_63C3 /* 0x63B8 [0xCF 0x61 0x23 ] */ stptrtoseq CHAN_6122 + STSEQ_PTR_LDSEQ /* 0x63BB [0xCC 0x03 ] */ ldi 3 /* 0x63BD [0xFB 0x60 0xF2 ] */ jump CHAN_60F2 -UNK_63C0: - .byte 0x25, 0x26, 0x27 +.array ARRAY_63C0 + .byte SF0_EFFECT_37 + .byte SF0_EFFECT_38 + .byte SF0_EFFECT_39 -UNK_63C3: - .byte 0x6E, 0x6E, 0x6E +.array ARRAY_63C3 + .byte 110, 110, 110 .channel CHAN_63C6 -/* 0x63C6 [0xCE 0x63 0xD7 ] */ ldptr UNK_63D7 +/* 0x63C6 [0xCE 0x63 0xD7 ] */ ldptr ARRAY_63D7 /* 0x63C9 [0xCF 0x61 0x1B ] */ stptrtoseq CHAN_611A + STSEQ_PTR_LDSEQ -/* 0x63CC [0xCE 0x63 0xDA ] */ ldptr UNK_63DA +/* 0x63CC [0xCE 0x63 0xDA ] */ ldptr ARRAY_63DA /* 0x63CF [0xCF 0x61 0x23 ] */ stptrtoseq CHAN_6122 + STSEQ_PTR_LDSEQ /* 0x63D2 [0xCC 0x03 ] */ ldi 3 /* 0x63D4 [0xFB 0x60 0xF2 ] */ jump CHAN_60F2 -UNK_63D7: - .byte 0x28, 0x29, 0x2A +.array ARRAY_63D7 + .byte SF0_EFFECT_40 + .byte SF0_EFFECT_41 + .byte SF0_EFFECT_42 -UNK_63DA: - .byte 0x6E, 0x6E, 0x6E +.array ARRAY_63DA + .byte 110, 110, 110 .channel CHAN_63DD -/* 0x63DD [0xCE 0x63 0xEE ] */ ldptr UNK_63EE +/* 0x63DD [0xCE 0x63 0xEE ] */ ldptr ARRAY_63EE /* 0x63E0 [0xCF 0x61 0x1B ] */ stptrtoseq CHAN_611A + STSEQ_PTR_LDSEQ -/* 0x63E3 [0xCE 0x63 0xF0 ] */ ldptr UNK_63F0 +/* 0x63E3 [0xCE 0x63 0xF0 ] */ ldptr ARRAY_63F0 /* 0x63E6 [0xCF 0x61 0x23 ] */ stptrtoseq CHAN_6122 + STSEQ_PTR_LDSEQ /* 0x63E9 [0xB8 0x02 ] */ rand 2 /* 0x63EB [0xFB 0x61 0x34 ] */ jump CHAN_6134 -UNK_63EE: - .byte 0x2D, 0x2E +.array ARRAY_63EE + .byte SF0_EFFECT_45 + .byte SF0_EFFECT_46 -UNK_63F0: - .byte 0x64, 0x64 +.array ARRAY_63F0 + .byte 100, 100 .channel CHAN_63F2 -/* 0x63F2 [0xCE 0x64 0x03 ] */ ldptr UNK_6403 +/* 0x63F2 [0xCE 0x64 0x03 ] */ ldptr ARRAY_6403 /* 0x63F5 [0xCF 0x61 0x1B ] */ stptrtoseq CHAN_611A + STSEQ_PTR_LDSEQ -/* 0x63F8 [0xCE 0x64 0x05 ] */ ldptr UNK_6405 +/* 0x63F8 [0xCE 0x64 0x05 ] */ ldptr ARRAY_6405 /* 0x63FB [0xCF 0x61 0x23 ] */ stptrtoseq CHAN_6122 + STSEQ_PTR_LDSEQ /* 0x63FE [0xB8 0x02 ] */ rand 2 /* 0x6400 [0xFB 0x61 0x34 ] */ jump CHAN_6134 -UNK_6403: - .byte 0x2B, 0x2C +.array ARRAY_6403 + .byte SF0_EFFECT_43 + .byte SF0_EFFECT_44 -UNK_6405: - .byte 0x64, 0x64 +.array ARRAY_6405 + .byte 100, 100 .channel CHAN_6407 -/* 0x6407 [0xCE 0x64 0x18 ] */ ldptr UNK_6418 +/* 0x6407 [0xCE 0x64 0x18 ] */ ldptr ARRAY_6418 /* 0x640A [0xCF 0x61 0x1B ] */ stptrtoseq CHAN_611A + STSEQ_PTR_LDSEQ -/* 0x640D [0xCE 0x64 0x1A ] */ ldptr UNK_641A +/* 0x640D [0xCE 0x64 0x1A ] */ ldptr ARRAY_641A /* 0x6410 [0xCF 0x61 0x23 ] */ stptrtoseq CHAN_6122 + STSEQ_PTR_LDSEQ /* 0x6413 [0xB8 0x02 ] */ rand 2 /* 0x6415 [0xFB 0x61 0x34 ] */ jump CHAN_6134 -UNK_6418: - .byte 0x2F, 0x30 +.array ARRAY_6418 + .byte SF0_EFFECT_47 + .byte SF0_EFFECT_48 -UNK_641A: - .byte 0x55, 0x55 +.array ARRAY_641A + .byte 85, 85 .channel CHAN_641C /* 0x641C [0x88 0x64 0x20 ] */ ldlayer 0, LAYER_6420 @@ -14604,25 +14649,27 @@ UNK_641A: /* 0x6433 [0xFF ] */ end .channel CHAN_6434 -/* 0x6434 [0xCE 0x64 0x45 ] */ ldptr UNK_6445 +/* 0x6434 [0xCE 0x64 0x45 ] */ ldptr ARRAY_6445 /* 0x6437 [0xCF 0x61 0x1B ] */ stptrtoseq CHAN_611A + STSEQ_PTR_LDSEQ -/* 0x643A [0xCE 0x64 0x47 ] */ ldptr UNK_6447 +/* 0x643A [0xCE 0x64 0x47 ] */ ldptr ARRAY_6447 /* 0x643D [0xCF 0x61 0x23 ] */ stptrtoseq CHAN_6122 + STSEQ_PTR_LDSEQ /* 0x6440 [0xB8 0x02 ] */ rand 2 /* 0x6442 [0xFB 0x61 0x34 ] */ jump CHAN_6134 -UNK_6445: - .byte 0x2B, 0x2C +.array ARRAY_6445 + .byte SF0_EFFECT_43 + .byte SF0_EFFECT_44 -UNK_6447: - .byte 0x64, 0x64 +.array ARRAY_6447 + .byte 100, 100 .channel CHAN_6449 -/* 0x6449 [0xCE 0x64 0x4F ] */ ldptr UNK_644F +/* 0x6449 [0xCE 0x64 0x4F ] */ ldptr ARRAY_644F /* 0x644C [0xFB 0x61 0x3E ] */ jump CHAN_613E -UNK_644F: - .byte 0x14, 0x64 +.array ARRAY_644F + .byte SF0_EFFECT_20 + .byte 100 .channel CHAN_6451 /* 0x6451 [0x88 0x64 0x55 ] */ ldlayer 0, LAYER_6455 @@ -14667,11 +14714,12 @@ UNK_644F: /* 0x6492 [0xFF ] */ end .channel CHAN_6493 -/* 0x6493 [0xCE 0x64 0x99 ] */ ldptr UNK_6499 +/* 0x6493 [0xCE 0x64 0x99 ] */ ldptr ARRAY_6499 /* 0x6496 [0xFB 0x61 0x3E ] */ jump CHAN_613E -UNK_6499: - .byte 0x1C, 0x64 +.array ARRAY_6499 + .byte SF0_EFFECT_28 + .byte 100 .channel CHAN_649B /* 0x649B [0x88 0x64 0x9F ] */ ldlayer 0, LAYER_649F @@ -14687,10 +14735,10 @@ UNK_6499: /* 0x64A6 [0xC8 0xFF ] */ sub 255 /* 0x64A8 [0x76 ] */ stio IO_PORT_6 /* 0x64A9 [0xC9 0x01 ] */ and 1 -/* 0x64AB [0xCB 0x64 0xC5 ] */ ldseq UNK_64C5 -/* 0x64AE [0xC7 0x40 0x64 0xBF ] */ stseq (NOTEDV_OPCODE | PITCH_A0), LAYER_64BF + STSEQ_NOTEDV_OPCODE_PITCH +/* 0x64AB [0xCB 0x64 0xC5 ] */ ldseq ARRAY_64C5 +/* 0x64AE [0xC7 0x40 0x64 0xBF ] */ stseq (ASEQ_OP_LAYER_NOTEDV | SF0_EFFECT_0), LAYER_64BF + STSEQ_NOTEDV_OPCODE_PITCH /* 0x64B2 [0xB8 0x02 ] */ rand 2 -/* 0x64B4 [0xCB 0x64 0xC7 ] */ ldseq UNK_64C7 +/* 0x64B4 [0xCB 0x64 0xC7 ] */ ldseq ARRAY_64C7 /* 0x64B7 [0xC7 0x00 0x64 0xC1 ] */ stseq 0, LAYER_64BF + STSEQ_NOTEDV_VELOCITY_2 /* 0x64BB [0x88 0x64 0xBF ] */ ldlayer 0, LAYER_64BF /* 0x64BE [0xFF ] */ end @@ -14700,18 +14748,20 @@ UNK_6499: /* 0x64C2 [0xC0 0x30 ] */ ldelay 48 /* 0x64C4 [0xFF ] */ end -UNK_64C5: - .byte 0x35, 0x36 +.array ARRAY_64C5 + .byte SF0_EFFECT_53 + .byte SF0_EFFECT_54 -UNK_64C7: - .byte 0x50, 0x50 +.array ARRAY_64C7 + .byte 80, 80 .channel CHAN_64C9 -/* 0x64C9 [0xCE 0x64 0xCF ] */ ldptr UNK_64CF +/* 0x64C9 [0xCE 0x64 0xCF ] */ ldptr ARRAY_64CF /* 0x64CC [0xFB 0x61 0x3E ] */ jump CHAN_613E -UNK_64CF: - .byte 0x21, 0x6E +.array ARRAY_64CF + .byte SF0_EFFECT_33 + .byte 110 .channel CHAN_64D1 /* 0x64D1 [0x88 0x64 0xD5 ] */ ldlayer 0, LAYER_64D5 @@ -14723,53 +14773,60 @@ UNK_64CF: /* 0x64DA [0xFF ] */ end .channel CHAN_64DB -/* 0x64DB [0xCE 0x64 0xE1 ] */ ldptr UNK_64E1 +/* 0x64DB [0xCE 0x64 0xE1 ] */ ldptr ARRAY_64E1 /* 0x64DE [0xFB 0x61 0x3E ] */ jump CHAN_613E -UNK_64E1: - .byte 0x20, 0x5F +.array ARRAY_64E1 + .byte SF0_EFFECT_32 + .byte 95 .channel CHAN_64E3 -/* 0x64E3 [0xCE 0x64 0xE9 ] */ ldptr UNK_64E9 +/* 0x64E3 [0xCE 0x64 0xE9 ] */ ldptr ARRAY_64E9 /* 0x64E6 [0xFB 0x61 0x3E ] */ jump CHAN_613E -UNK_64E9: - .byte 0x23, 0x5A +.array ARRAY_64E9 + .byte SF0_EFFECT_35 + .byte 90 .channel CHAN_64EB -/* 0x64EB [0xCE 0x64 0xF1 ] */ ldptr UNK_64F1 +/* 0x64EB [0xCE 0x64 0xF1 ] */ ldptr ARRAY_64F1 /* 0x64EE [0xFB 0x61 0x3E ] */ jump CHAN_613E -UNK_64F1: - .byte 0x22, 0x64 +.array ARRAY_64F1 + .byte SF0_EFFECT_34 + .byte 100 .channel CHAN_64F3 -/* 0x64F3 [0xCE 0x64 0xF9 ] */ ldptr UNK_64F9 +/* 0x64F3 [0xCE 0x64 0xF9 ] */ ldptr ARRAY_64F9 /* 0x64F6 [0xFB 0x61 0x3E ] */ jump CHAN_613E -UNK_64F9: - .byte 0x31, 0x73 +.array ARRAY_64F9 + .byte SF0_EFFECT_49 + .byte 115 .channel CHAN_64FB -/* 0x64FB [0xCE 0x65 0x01 ] */ ldptr UNK_6501 +/* 0x64FB [0xCE 0x65 0x01 ] */ ldptr ARRAY_6501 /* 0x64FE [0xFB 0x61 0x3E ] */ jump CHAN_613E -UNK_6501: - .byte 0x3E, 0x64 +.array ARRAY_6501 + .byte SF0_EFFECT_62 + .byte 100 .channel CHAN_6503 -/* 0x6503 [0xCE 0x65 0x09 ] */ ldptr UNK_6509 +/* 0x6503 [0xCE 0x65 0x09 ] */ ldptr ARRAY_6509 /* 0x6506 [0xFB 0x61 0x3E ] */ jump CHAN_613E -UNK_6509: - .byte 0x3F, 0x6E +.array ARRAY_6509 + .byte SF0_EFFECT_63 + .byte 110 .channel CHAN_650B -/* 0x650B [0xCE 0x65 0x11 ] */ ldptr UNK_6511 +/* 0x650B [0xCE 0x65 0x11 ] */ ldptr ARRAY_6511 /* 0x650E [0xFB 0x61 0x3E ] */ jump CHAN_613E -UNK_6511: - .byte 0x2C, 0x64 +.array ARRAY_6511 + .byte SF0_EFFECT_44 + .byte 100 .channel CHAN_6513 /* 0x6513 [0xCC 0x20 ] */ ldi 32 @@ -14784,9 +14841,9 @@ UNK_6511: .channel CHAN_6520 /* 0x6520 [0x64 ] */ ldio IO_PORT_SFX_INDEX_LOBITS -/* 0x6521 [0xC8 0x50 ] */ sub 80 -/* 0x6523 [0xC7 0x19 0x65 0x36 ] */ stseq (NOTEDVG_OPCODE | PITCH_BF2), LAYER_6536 + STSEQ_NOTEDVG_OPCODE_PITCH -/* 0x6527 [0xCB 0x65 0x3B ] */ ldseq UNK_653B +/* 0x6521 [0xC8 0x50 ] */ sub NA_SE_VO_TA_SLEEP & 0xFF +/* 0x6523 [0xC7 0x19 0x65 0x36 ] */ stseq (ASEQ_OP_LAYER_NOTEDVG | PITCH_BF2), LAYER_6536 + STSEQ_NOTEDVG_OPCODE_PITCH +/* 0x6527 [0xCB 0x65 0x3B ] */ ldseq ARRAY_653B /* 0x652A [0xC7 0x00 0x65 0x38 ] */ stseq 0, LAYER_6536 + STSEQ_NOTEDVG_DELAY_LO /* 0x652E [0x88 0x65 0x34 ] */ ldlayer 0, LAYER_6534 /* 0x6531 [0xDC 0x60 ] */ panweight 96 @@ -14798,16 +14855,16 @@ LAYER_6536: /* 0x6536 [0x21 0x00 0x64 0x00 ] */ notedvg PITCH_GF3, 0, 100, 0 /* 0x653A [0xFF ] */ end -UNK_653B: - .byte 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x6E, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64 - .byte 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64 - .byte 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x6E +.array ARRAY_653B + .byte 100, 100, 100, 100, 100, 100, 100, 100, 110, 100, 100, 100, 100, 100, 100, 100 + .byte 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 + .byte 100, 100, 100, 100, 100, 100, 110 .channel CHAN_6562 /* 0x6562 [0x64 ] */ ldio IO_PORT_SFX_INDEX_LOBITS -/* 0x6563 [0xC8 0x77 ] */ sub 119 -/* 0x6565 [0xC7 0x00 0x65 0x76 ] */ stseq (NOTEDVG_OPCODE | PITCH_A0), LAYER_6576 + STSEQ_NOTEDVG_OPCODE_PITCH -/* 0x6569 [0xCB 0x65 0x7B ] */ ldseq UNK_657B +/* 0x6563 [0xC8 0x77 ] */ sub NA_SE_VO_Z1_OPENDOOR & 0xFF +/* 0x6565 [0xC7 0x00 0x65 0x76 ] */ stseq (ASEQ_OP_LAYER_NOTEDVG | PITCH_A0), LAYER_6576 + STSEQ_NOTEDVG_OPCODE_PITCH +/* 0x6569 [0xCB 0x65 0x7B ] */ ldseq ARRAY_657B /* 0x656C [0xC7 0x00 0x65 0x78 ] */ stseq 0, LAYER_6576 + STSEQ_NOTEDVG_DELAY_LO /* 0x6570 [0x88 0x65 0x74 ] */ ldlayer 0, LAYER_6574 /* 0x6573 [0xFF ] */ end @@ -14818,16 +14875,16 @@ LAYER_6576: /* 0x6576 [0x00 0x00 0x64 0x00 ] */ notedvg PITCH_A0, 0, 100, 0 /* 0x657A [0xFF ] */ end -UNK_657B: - .byte 0x64, 0x64, 0x64, 0x64, 0x64, 0x64 +.array ARRAY_657B + .byte 100, 100, 100, 100, 100, 100 .channel CHAN_6581 /* 0x6581 [0xCC 0x20 ] */ ldi 32 /* 0x6583 [0x71 ] */ stio IO_PORT_1 /* 0x6584 [0x89 0x65 0x98 ] */ ldlayer 1, LAYER_6598 -/* 0x6587 [0xCE 0x65 0xA7 ] */ ldptr UNK_65A7 +/* 0x6587 [0xCE 0x65 0xA7 ] */ ldptr ARRAY_65A7 /* 0x658A [0xCF 0x61 0x1B ] */ stptrtoseq CHAN_611A + STSEQ_PTR_LDSEQ -/* 0x658D [0xCE 0x65 0xAA ] */ ldptr UNK_65AA +/* 0x658D [0xCE 0x65 0xAA ] */ ldptr ARRAY_65AA /* 0x6590 [0xCF 0x61 0x23 ] */ stptrtoseq CHAN_6122 + STSEQ_PTR_LDSEQ /* 0x6593 [0xCC 0x03 ] */ ldi 3 /* 0x6595 [0xFB 0x60 0xF2 ] */ jump CHAN_60F2 @@ -14840,11 +14897,13 @@ UNK_657B: /* 0x65A3 [0x78 0x30 0x41 ] */ notedv PITCH_F5, 48, 65 /* 0x65A6 [0xFF ] */ end -UNK_65A7: - .byte 0x39, 0x3A, 0x3B +.array ARRAY_65A7 + .byte SF0_EFFECT_57 + .byte SF0_EFFECT_58 + .byte SF0_EFFECT_59 -UNK_65AA: - .byte 0x64, 0x5F, 0x69 +.array ARRAY_65AA + .byte 100, 95, 105 .balign 16 diff --git a/assets/audio/sequences/seq_1.prg.seq b/assets/audio/sequences/seq_1.prg.seq index 0babce8065..02994cf733 100644 --- a/assets/audio/sequences/seq_1.prg.seq +++ b/assets/audio/sequences/seq_1.prg.seq @@ -454,7 +454,7 @@ CHAN_0308: /* 0x0319 [0xC7 0x60 0x10 0x00 ] */ stseq 96, ENVELOPE_0FFA + STSEQ_ENVELOPE_POINT(3) CHAN_031D: /* 0x031D [0xB8 0x18 ] */ rand 24 -/* 0x031F [0xC7 0x62 0x03 0x6F ] */ stseq (NOTEDV_OPCODE | PITCH_G3), LAYER_036F + STSEQ_NOTEDV_OPCODE_PITCH +/* 0x031F [0xC7 0x62 0x03 0x6F ] */ stseq (ASEQ_OP_LAYER_NOTEDV | PITCH_G3), LAYER_036F + STSEQ_NOTEDV_OPCODE_PITCH /* 0x0323 [0xCC 0x40 ] */ ldi 64 /* 0x0325 [0x53 ] */ subio IO_PORT_3 /* 0x0326 [0xC7 0x00 0x03 0x2B ] */ stseq 0, STSEQ_HERE + STSEQ_RAND @@ -482,7 +482,7 @@ CHAN_0335: /* 0x034B [0xC8 0xFF ] */ sub 255 /* 0x034D [0xC7 0x64 0x03 0x87 ] */ stseq 100, LAYER_0385 + STSEQ_NOTEDV_VELOCITY_2 /* 0x0351 [0xC7 0x64 0x03 0x8A ] */ stseq 100, LAYER_0388 + STSEQ_NOTEDV_VELOCITY_2 -/* 0x0355 [0xC7 0x67 0x03 0x85 ] */ stseq (NOTEDV_OPCODE | PITCH_C4), LAYER_0385 + STSEQ_NOTEDV_OPCODE_PITCH +/* 0x0355 [0xC7 0x67 0x03 0x85 ] */ stseq (ASEQ_OP_LAYER_NOTEDV | PITCH_C4), LAYER_0385 + STSEQ_NOTEDV_OPCODE_PITCH /* 0x0359 [0xFF ] */ end UNK_035A: @@ -1664,7 +1664,7 @@ CHAN_0E72: /* 0x0E84 [0xB8 0x02 ] */ rand 2 /* 0x0E86 [0x73 ] */ stio IO_PORT_3 CHAN_0E87: -/* 0x0E87 [0xC7 0x67 0x0E 0xCF ] */ stseq (NOTEDV_OPCODE | PITCH_C4), LAYER_0ECF + STSEQ_NOTEDV_OPCODE_PITCH +/* 0x0E87 [0xC7 0x67 0x0E 0xCF ] */ stseq (ASEQ_OP_LAYER_NOTEDV | PITCH_C4), LAYER_0ECF + STSEQ_NOTEDV_OPCODE_PITCH /* 0x0E8B [0xB8 0x1E ] */ rand 30 /* 0x0E8D [0xC7 0x31 0x0E 0xCC ] */ stseq 49, LAYER_0ECB + STSEQ_NOTEPAN /* 0x0E91 [0x76 ] */ stio IO_PORT_6 diff --git a/assets/xml/code/fbdemo_circle.xml b/assets/xml/code/fbdemo_circle.xml index 530506369c..618c743314 100644 --- a/assets/xml/code/fbdemo_circle.xml +++ b/assets/xml/code/fbdemo_circle.xml @@ -7,7 +7,6 @@ - - + diff --git a/assets/xml/code/fbdemo_wipe1.xml b/assets/xml/code/fbdemo_wipe1.xml index 74f129776b..87f7e47b6f 100644 --- a/assets/xml/code/fbdemo_wipe1.xml +++ b/assets/xml/code/fbdemo_wipe1.xml @@ -4,7 +4,6 @@ - - + diff --git a/assets/xml/objects/gameplay_field_keep.xml b/assets/xml/objects/gameplay_field_keep.xml index 011e8f7fc7..3c0f18d74e 100644 --- a/assets/xml/objects/gameplay_field_keep.xml +++ b/assets/xml/objects/gameplay_field_keep.xml @@ -29,7 +29,7 @@ - + diff --git a/assets/xml/objects/gameplay_keep.xml b/assets/xml/objects/gameplay_keep.xml index dcb7e29605..1a1077f038 100644 --- a/assets/xml/objects/gameplay_keep.xml +++ b/assets/xml/objects/gameplay_keep.xml @@ -1,5 +1,5 @@ - + @@ -759,7 +759,7 @@ - + @@ -848,7 +848,7 @@ - + diff --git a/assets/xml/objects/gameplay_keep_pal.xml b/assets/xml/objects/gameplay_keep_pal.xml index fbea0efd0c..92a7bb06e0 100644 --- a/assets/xml/objects/gameplay_keep_pal.xml +++ b/assets/xml/objects/gameplay_keep_pal.xml @@ -1,5 +1,5 @@ - + @@ -753,7 +753,7 @@ - + @@ -843,7 +843,7 @@ - + diff --git a/assets/xml/objects/object_am.xml b/assets/xml/objects/object_am.xml index 0a4b88ddf8..2467baf6ab 100644 --- a/assets/xml/objects/object_am.xml +++ b/assets/xml/objects/object_am.xml @@ -5,5 +5,6 @@ + diff --git a/assets/xml/objects/object_ani.xml b/assets/xml/objects/object_ani.xml index 25ad7af354..d83aa7656a 100644 --- a/assets/xml/objects/object_ani.xml +++ b/assets/xml/objects/object_ani.xml @@ -51,6 +51,8 @@ + + diff --git a/assets/xml/objects/object_bdoor.xml b/assets/xml/objects/object_bdoor.xml index e926ae40bd..e15f0f6294 100644 --- a/assets/xml/objects/object_bdoor.xml +++ b/assets/xml/objects/object_bdoor.xml @@ -1,5 +1,5 @@ - + diff --git a/assets/xml/objects/object_box.xml b/assets/xml/objects/object_box.xml index 34162fc94f..7ab9d9e7f4 100644 --- a/assets/xml/objects/object_box.xml +++ b/assets/xml/objects/object_box.xml @@ -5,7 +5,9 @@ + + @@ -19,11 +21,7 @@ - + - - - - diff --git a/assets/xml/objects/object_bv.xml b/assets/xml/objects/object_bv.xml index e2c2ce9202..5a8e6c594d 100644 --- a/assets/xml/objects/object_bv.xml +++ b/assets/xml/objects/object_bv.xml @@ -7,7 +7,7 @@ - + diff --git a/assets/xml/objects/object_bv_pal.xml b/assets/xml/objects/object_bv_pal.xml index 204273fc01..8de7492663 100644 --- a/assets/xml/objects/object_bv_pal.xml +++ b/assets/xml/objects/object_bv_pal.xml @@ -7,7 +7,7 @@ - + diff --git a/assets/xml/objects/object_demo_6k.xml b/assets/xml/objects/object_demo_6k.xml index 73058d5e46..e2de93db2e 100644 --- a/assets/xml/objects/object_demo_6k.xml +++ b/assets/xml/objects/object_demo_6k.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_demo_kekkai.xml b/assets/xml/objects/object_demo_kekkai.xml index 1b9c9b4027..8b7b739c64 100644 --- a/assets/xml/objects/object_demo_kekkai.xml +++ b/assets/xml/objects/object_demo_kekkai.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_door_killer.xml b/assets/xml/objects/object_door_killer.xml index a37f590d60..fbee0e5f70 100644 --- a/assets/xml/objects/object_door_killer.xml +++ b/assets/xml/objects/object_door_killer.xml @@ -12,6 +12,6 @@ - + diff --git a/assets/xml/objects/object_efc_erupc.xml b/assets/xml/objects/object_efc_erupc.xml index 800d9535f1..13cc2ab033 100644 --- a/assets/xml/objects/object_efc_erupc.xml +++ b/assets/xml/objects/object_efc_erupc.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_fd.xml b/assets/xml/objects/object_fd.xml index a28919d8e8..4a5ce9fafa 100644 --- a/assets/xml/objects/object_fd.xml +++ b/assets/xml/objects/object_fd.xml @@ -19,9 +19,10 @@ - - - + + + + diff --git a/assets/xml/objects/object_fd2.xml b/assets/xml/objects/object_fd2.xml index b3fbdcb216..8d2b3dcdb6 100644 --- a/assets/xml/objects/object_fd2.xml +++ b/assets/xml/objects/object_fd2.xml @@ -21,9 +21,10 @@ - - - + + + + diff --git a/assets/xml/objects/object_fd_pal.xml b/assets/xml/objects/object_fd_pal.xml index 776a2ee494..be375399f6 100644 --- a/assets/xml/objects/object_fd_pal.xml +++ b/assets/xml/objects/object_fd_pal.xml @@ -19,9 +19,10 @@ - - - + + + + diff --git a/assets/xml/objects/object_fish.xml b/assets/xml/objects/object_fish.xml index f5ad4f6da0..2ce27bac3a 100644 --- a/assets/xml/objects/object_fish.xml +++ b/assets/xml/objects/object_fish.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_fz.xml b/assets/xml/objects/object_fz.xml index dad6fec5ce..bbed88b106 100644 --- a/assets/xml/objects/object_fz.xml +++ b/assets/xml/objects/object_fz.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_arrow.xml b/assets/xml/objects/object_gi_arrow.xml index 4b58787a9d..4ce9110cc1 100644 --- a/assets/xml/objects/object_gi_arrow.xml +++ b/assets/xml/objects/object_gi_arrow.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_arrowcase.xml b/assets/xml/objects/object_gi_arrowcase.xml index 267b0a734d..990576428d 100644 --- a/assets/xml/objects/object_gi_arrowcase.xml +++ b/assets/xml/objects/object_gi_arrowcase.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_bean.xml b/assets/xml/objects/object_gi_bean.xml index e74247816f..2c6ce0cf12 100644 --- a/assets/xml/objects/object_gi_bean.xml +++ b/assets/xml/objects/object_gi_bean.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_bomb_1.xml b/assets/xml/objects/object_gi_bomb_1.xml index bae86c11d8..5d7dab6d86 100644 --- a/assets/xml/objects/object_gi_bomb_1.xml +++ b/assets/xml/objects/object_gi_bomb_1.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_bomb_2.xml b/assets/xml/objects/object_gi_bomb_2.xml index 1400c4a4d4..01f3956803 100644 --- a/assets/xml/objects/object_gi_bomb_2.xml +++ b/assets/xml/objects/object_gi_bomb_2.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_bombpouch.xml b/assets/xml/objects/object_gi_bombpouch.xml index 07134748c3..42620ec94d 100644 --- a/assets/xml/objects/object_gi_bombpouch.xml +++ b/assets/xml/objects/object_gi_bombpouch.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_boomerang.xml b/assets/xml/objects/object_gi_boomerang.xml index 3c1a0fe7fc..fef261c489 100644 --- a/assets/xml/objects/object_gi_boomerang.xml +++ b/assets/xml/objects/object_gi_boomerang.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_boots_2.xml b/assets/xml/objects/object_gi_boots_2.xml index 8e9cd1028d..e172bd006c 100644 --- a/assets/xml/objects/object_gi_boots_2.xml +++ b/assets/xml/objects/object_gi_boots_2.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_bosskey.xml b/assets/xml/objects/object_gi_bosskey.xml index e5e4bc86c9..8e93c10d1a 100644 --- a/assets/xml/objects/object_gi_bosskey.xml +++ b/assets/xml/objects/object_gi_bosskey.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_bottle.xml b/assets/xml/objects/object_gi_bottle.xml index 3b0884a03f..0a27562954 100644 --- a/assets/xml/objects/object_gi_bottle.xml +++ b/assets/xml/objects/object_gi_bottle.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_bottle_letter.xml b/assets/xml/objects/object_gi_bottle_letter.xml index 443219caf5..04b08dd673 100644 --- a/assets/xml/objects/object_gi_bottle_letter.xml +++ b/assets/xml/objects/object_gi_bottle_letter.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_bow.xml b/assets/xml/objects/object_gi_bow.xml index 946e9c4965..6e9101b413 100644 --- a/assets/xml/objects/object_gi_bow.xml +++ b/assets/xml/objects/object_gi_bow.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_bracelet.xml b/assets/xml/objects/object_gi_bracelet.xml index 5a0b62a60a..da35c003f8 100644 --- a/assets/xml/objects/object_gi_bracelet.xml +++ b/assets/xml/objects/object_gi_bracelet.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_brokensword.xml b/assets/xml/objects/object_gi_brokensword.xml index 408741ac54..44cae3e100 100644 --- a/assets/xml/objects/object_gi_brokensword.xml +++ b/assets/xml/objects/object_gi_brokensword.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_butterfly.xml b/assets/xml/objects/object_gi_butterfly.xml index 76ac706096..9882d27954 100644 --- a/assets/xml/objects/object_gi_butterfly.xml +++ b/assets/xml/objects/object_gi_butterfly.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_coin.xml b/assets/xml/objects/object_gi_coin.xml index 22e29f255f..f65993465b 100644 --- a/assets/xml/objects/object_gi_coin.xml +++ b/assets/xml/objects/object_gi_coin.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_compass.xml b/assets/xml/objects/object_gi_compass.xml index 076229b11e..10c6fbb63a 100644 --- a/assets/xml/objects/object_gi_compass.xml +++ b/assets/xml/objects/object_gi_compass.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_dekupouch.xml b/assets/xml/objects/object_gi_dekupouch.xml index 3d6d95d98a..25cde931f2 100644 --- a/assets/xml/objects/object_gi_dekupouch.xml +++ b/assets/xml/objects/object_gi_dekupouch.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_egg.xml b/assets/xml/objects/object_gi_egg.xml index 2b2e2847db..ceae8be407 100644 --- a/assets/xml/objects/object_gi_egg.xml +++ b/assets/xml/objects/object_gi_egg.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_eye_lotion.xml b/assets/xml/objects/object_gi_eye_lotion.xml index 5128c5f6ff..86e053cd94 100644 --- a/assets/xml/objects/object_gi_eye_lotion.xml +++ b/assets/xml/objects/object_gi_eye_lotion.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_fire.xml b/assets/xml/objects/object_gi_fire.xml index a57fba6e86..3b81815d5f 100644 --- a/assets/xml/objects/object_gi_fire.xml +++ b/assets/xml/objects/object_gi_fire.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_fish.xml b/assets/xml/objects/object_gi_fish.xml index edb39dc297..75361b32da 100644 --- a/assets/xml/objects/object_gi_fish.xml +++ b/assets/xml/objects/object_gi_fish.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_frog.xml b/assets/xml/objects/object_gi_frog.xml index f180fd267b..8c5d616eb4 100644 --- a/assets/xml/objects/object_gi_frog.xml +++ b/assets/xml/objects/object_gi_frog.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_gerudo.xml b/assets/xml/objects/object_gi_gerudo.xml index 3be8d34620..26dc606ce0 100644 --- a/assets/xml/objects/object_gi_gerudo.xml +++ b/assets/xml/objects/object_gi_gerudo.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_ghost.xml b/assets/xml/objects/object_gi_ghost.xml index 186f4c74b7..e6c631c98e 100644 --- a/assets/xml/objects/object_gi_ghost.xml +++ b/assets/xml/objects/object_gi_ghost.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_glasses.xml b/assets/xml/objects/object_gi_glasses.xml index 63d32ab5ac..4a9cacf086 100644 --- a/assets/xml/objects/object_gi_glasses.xml +++ b/assets/xml/objects/object_gi_glasses.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_gloves.xml b/assets/xml/objects/object_gi_gloves.xml index 1b4282dcaa..fb273e95f4 100644 --- a/assets/xml/objects/object_gi_gloves.xml +++ b/assets/xml/objects/object_gi_gloves.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_goddess.xml b/assets/xml/objects/object_gi_goddess.xml index 50cbdd8918..6339012d47 100644 --- a/assets/xml/objects/object_gi_goddess.xml +++ b/assets/xml/objects/object_gi_goddess.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_grass.xml b/assets/xml/objects/object_gi_grass.xml index ae7834201a..2cc465c959 100644 --- a/assets/xml/objects/object_gi_grass.xml +++ b/assets/xml/objects/object_gi_grass.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_hammer.xml b/assets/xml/objects/object_gi_hammer.xml index feb5c8659d..49da345a93 100644 --- a/assets/xml/objects/object_gi_hammer.xml +++ b/assets/xml/objects/object_gi_hammer.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_heart.xml b/assets/xml/objects/object_gi_heart.xml index 48e78b1b5c..b3576efaad 100644 --- a/assets/xml/objects/object_gi_heart.xml +++ b/assets/xml/objects/object_gi_heart.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_hearts.xml b/assets/xml/objects/object_gi_hearts.xml index d2e763e631..122c898571 100644 --- a/assets/xml/objects/object_gi_hearts.xml +++ b/assets/xml/objects/object_gi_hearts.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_hookshot.xml b/assets/xml/objects/object_gi_hookshot.xml index a6b3b0fdac..513194fa7d 100644 --- a/assets/xml/objects/object_gi_hookshot.xml +++ b/assets/xml/objects/object_gi_hookshot.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_hoverboots.xml b/assets/xml/objects/object_gi_hoverboots.xml index c4a67877b2..9d710662e5 100644 --- a/assets/xml/objects/object_gi_hoverboots.xml +++ b/assets/xml/objects/object_gi_hoverboots.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_insect.xml b/assets/xml/objects/object_gi_insect.xml index 7af5b5b3b2..9467605ce2 100644 --- a/assets/xml/objects/object_gi_insect.xml +++ b/assets/xml/objects/object_gi_insect.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_jewel.xml b/assets/xml/objects/object_gi_jewel.xml index e83c651164..5dc87f53e2 100644 --- a/assets/xml/objects/object_gi_jewel.xml +++ b/assets/xml/objects/object_gi_jewel.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_key.xml b/assets/xml/objects/object_gi_key.xml index a37d45a71c..e38547a32c 100644 --- a/assets/xml/objects/object_gi_key.xml +++ b/assets/xml/objects/object_gi_key.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_ki_tan_mask.xml b/assets/xml/objects/object_gi_ki_tan_mask.xml index f66535af37..e447c8fadf 100644 --- a/assets/xml/objects/object_gi_ki_tan_mask.xml +++ b/assets/xml/objects/object_gi_ki_tan_mask.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_liquid.xml b/assets/xml/objects/object_gi_liquid.xml index 5eeeca0fd2..b3af2b2627 100644 --- a/assets/xml/objects/object_gi_liquid.xml +++ b/assets/xml/objects/object_gi_liquid.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_longsword.xml b/assets/xml/objects/object_gi_longsword.xml index 7161e42e38..bdfffe3b16 100644 --- a/assets/xml/objects/object_gi_longsword.xml +++ b/assets/xml/objects/object_gi_longsword.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_m_arrow.xml b/assets/xml/objects/object_gi_m_arrow.xml index 0fd659ae95..069a1bf1d4 100644 --- a/assets/xml/objects/object_gi_m_arrow.xml +++ b/assets/xml/objects/object_gi_m_arrow.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_magicpot.xml b/assets/xml/objects/object_gi_magicpot.xml index 7623e6353e..070de07fa0 100644 --- a/assets/xml/objects/object_gi_magicpot.xml +++ b/assets/xml/objects/object_gi_magicpot.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_map.xml b/assets/xml/objects/object_gi_map.xml index 8887dd22c9..619b0bc845 100644 --- a/assets/xml/objects/object_gi_map.xml +++ b/assets/xml/objects/object_gi_map.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_medal.xml b/assets/xml/objects/object_gi_medal.xml index 28e5b1e683..5676a9e316 100644 --- a/assets/xml/objects/object_gi_medal.xml +++ b/assets/xml/objects/object_gi_medal.xml @@ -1,11 +1,27 @@ + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_melody.xml b/assets/xml/objects/object_gi_melody.xml index b01fca9538..e028bc9463 100644 --- a/assets/xml/objects/object_gi_melody.xml +++ b/assets/xml/objects/object_gi_melody.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_milk.xml b/assets/xml/objects/object_gi_milk.xml index 00b9530d95..3e5cb0cb5a 100644 --- a/assets/xml/objects/object_gi_milk.xml +++ b/assets/xml/objects/object_gi_milk.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_mushroom.xml b/assets/xml/objects/object_gi_mushroom.xml index 5b19bca743..8ee686263c 100644 --- a/assets/xml/objects/object_gi_mushroom.xml +++ b/assets/xml/objects/object_gi_mushroom.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_niwatori.xml b/assets/xml/objects/object_gi_niwatori.xml index 713cc1ce5a..8af44b8708 100644 --- a/assets/xml/objects/object_gi_niwatori.xml +++ b/assets/xml/objects/object_gi_niwatori.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_nuts.xml b/assets/xml/objects/object_gi_nuts.xml index 5508fe8569..d1a8454dbc 100644 --- a/assets/xml/objects/object_gi_nuts.xml +++ b/assets/xml/objects/object_gi_nuts.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_ocarina.xml b/assets/xml/objects/object_gi_ocarina.xml index 7693cc122f..b8714d6e3c 100644 --- a/assets/xml/objects/object_gi_ocarina.xml +++ b/assets/xml/objects/object_gi_ocarina.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_ocarina_0.xml b/assets/xml/objects/object_gi_ocarina_0.xml index 336d338946..caca8f2002 100644 --- a/assets/xml/objects/object_gi_ocarina_0.xml +++ b/assets/xml/objects/object_gi_ocarina_0.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_pachinko.xml b/assets/xml/objects/object_gi_pachinko.xml index 5f808baf92..9967813b3d 100644 --- a/assets/xml/objects/object_gi_pachinko.xml +++ b/assets/xml/objects/object_gi_pachinko.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_powder.xml b/assets/xml/objects/object_gi_powder.xml index fb7dc0155d..4e33b58208 100644 --- a/assets/xml/objects/object_gi_powder.xml +++ b/assets/xml/objects/object_gi_powder.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_prescription.xml b/assets/xml/objects/object_gi_prescription.xml index 081de301c4..9fa16660c7 100644 --- a/assets/xml/objects/object_gi_prescription.xml +++ b/assets/xml/objects/object_gi_prescription.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_rabit_mask.xml b/assets/xml/objects/object_gi_rabit_mask.xml index 75f855550d..a3c07e469c 100644 --- a/assets/xml/objects/object_gi_rabit_mask.xml +++ b/assets/xml/objects/object_gi_rabit_mask.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_redead_mask.xml b/assets/xml/objects/object_gi_redead_mask.xml index 7de08487f8..fe601cab64 100644 --- a/assets/xml/objects/object_gi_redead_mask.xml +++ b/assets/xml/objects/object_gi_redead_mask.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_rupy.xml b/assets/xml/objects/object_gi_rupy.xml index 0a1af96d0f..07b18b82dd 100644 --- a/assets/xml/objects/object_gi_rupy.xml +++ b/assets/xml/objects/object_gi_rupy.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_saw.xml b/assets/xml/objects/object_gi_saw.xml index dcc038b7c1..999b818e8b 100644 --- a/assets/xml/objects/object_gi_saw.xml +++ b/assets/xml/objects/object_gi_saw.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_scale.xml b/assets/xml/objects/object_gi_scale.xml index 1cf5de5b99..c6794b6aea 100644 --- a/assets/xml/objects/object_gi_scale.xml +++ b/assets/xml/objects/object_gi_scale.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_seed.xml b/assets/xml/objects/object_gi_seed.xml index 82c15c82d2..5d3ef9c03f 100644 --- a/assets/xml/objects/object_gi_seed.xml +++ b/assets/xml/objects/object_gi_seed.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_shield_1.xml b/assets/xml/objects/object_gi_shield_1.xml index 2e93695699..867292a4c3 100644 --- a/assets/xml/objects/object_gi_shield_1.xml +++ b/assets/xml/objects/object_gi_shield_1.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_shield_2.xml b/assets/xml/objects/object_gi_shield_2.xml index 176ae025fe..364070d101 100644 --- a/assets/xml/objects/object_gi_shield_2.xml +++ b/assets/xml/objects/object_gi_shield_2.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_shield_3.xml b/assets/xml/objects/object_gi_shield_3.xml index 250bf7fea3..974a2539a9 100644 --- a/assets/xml/objects/object_gi_shield_3.xml +++ b/assets/xml/objects/object_gi_shield_3.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_skj_mask.xml b/assets/xml/objects/object_gi_skj_mask.xml index e6c90f76f1..6479015715 100644 --- a/assets/xml/objects/object_gi_skj_mask.xml +++ b/assets/xml/objects/object_gi_skj_mask.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_soul.xml b/assets/xml/objects/object_gi_soul.xml index 76ffc56852..ee9dbd9570 100644 --- a/assets/xml/objects/object_gi_soul.xml +++ b/assets/xml/objects/object_gi_soul.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_stick.xml b/assets/xml/objects/object_gi_stick.xml index fed89f4659..d974b7ac5d 100644 --- a/assets/xml/objects/object_gi_stick.xml +++ b/assets/xml/objects/object_gi_stick.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_sutaru.xml b/assets/xml/objects/object_gi_sutaru.xml index a2606afbe3..343d301868 100644 --- a/assets/xml/objects/object_gi_sutaru.xml +++ b/assets/xml/objects/object_gi_sutaru.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_sword_1.xml b/assets/xml/objects/object_gi_sword_1.xml index e1119abca0..3bc15dcaf3 100644 --- a/assets/xml/objects/object_gi_sword_1.xml +++ b/assets/xml/objects/object_gi_sword_1.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_ticketstone.xml b/assets/xml/objects/object_gi_ticketstone.xml index 0fa37fe11e..6cdd5ea2f0 100644 --- a/assets/xml/objects/object_gi_ticketstone.xml +++ b/assets/xml/objects/object_gi_ticketstone.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gi_truth_mask.xml b/assets/xml/objects/object_gi_truth_mask.xml index f28c7cbcad..64bd0939c6 100644 --- a/assets/xml/objects/object_gi_truth_mask.xml +++ b/assets/xml/objects/object_gi_truth_mask.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_gla.xml b/assets/xml/objects/object_gla.xml index ca4d9225da..dbbfcb58ff 100644 --- a/assets/xml/objects/object_gla.xml +++ b/assets/xml/objects/object_gla.xml @@ -58,7 +58,7 @@ - + diff --git a/assets/xml/objects/object_gnd.xml b/assets/xml/objects/object_gnd.xml index 53d2bbde4c..d073b8b973 100644 --- a/assets/xml/objects/object_gnd.xml +++ b/assets/xml/objects/object_gnd.xml @@ -44,11 +44,11 @@ - - - - - + + + + + diff --git a/assets/xml/objects/object_god_lgt.xml b/assets/xml/objects/object_god_lgt.xml index 60df9e4693..b630605364 100644 --- a/assets/xml/objects/object_god_lgt.xml +++ b/assets/xml/objects/object_god_lgt.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_hintnuts.xml b/assets/xml/objects/object_hintnuts.xml index f7da2e8f5c..d3595d85e8 100644 --- a/assets/xml/objects/object_hintnuts.xml +++ b/assets/xml/objects/object_hintnuts.xml @@ -1,7 +1,7 @@ - + diff --git a/assets/xml/objects/object_hni.xml b/assets/xml/objects/object_hni.xml index 6b317eb7a6..763f6892c0 100644 --- a/assets/xml/objects/object_hni.xml +++ b/assets/xml/objects/object_hni.xml @@ -16,7 +16,7 @@ - + diff --git a/assets/xml/objects/object_ik.xml b/assets/xml/objects/object_ik.xml index 5d86e1075a..50f47e9d7c 100644 --- a/assets/xml/objects/object_ik.xml +++ b/assets/xml/objects/object_ik.xml @@ -1,8 +1,8 @@  - - - + + + @@ -29,7 +29,10 @@ + + + diff --git a/assets/xml/objects/object_jya_obj.xml b/assets/xml/objects/object_jya_obj.xml index 4a203b0b92..50c2700db1 100644 --- a/assets/xml/objects/object_jya_obj.xml +++ b/assets/xml/objects/object_jya_obj.xml @@ -29,7 +29,7 @@ - + @@ -59,10 +59,10 @@ - + - - + + diff --git a/assets/xml/objects/object_kanban.xml b/assets/xml/objects/object_kanban.xml index 9ffc7a2ceb..b989d3572a 100644 --- a/assets/xml/objects/object_kanban.xml +++ b/assets/xml/objects/object_kanban.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_kingdodongo.xml b/assets/xml/objects/object_kingdodongo.xml index 32c28766b2..3ada2822c9 100644 --- a/assets/xml/objects/object_kingdodongo.xml +++ b/assets/xml/objects/object_kingdodongo.xml @@ -101,7 +101,15 @@ - + + + + + + + + + diff --git a/assets/xml/objects/object_kingdodongo_pal.xml b/assets/xml/objects/object_kingdodongo_pal.xml index 1aa1735cbe..a0790a6db5 100644 --- a/assets/xml/objects/object_kingdodongo_pal.xml +++ b/assets/xml/objects/object_kingdodongo_pal.xml @@ -101,7 +101,15 @@ - + + + + + + + + + diff --git a/assets/xml/objects/object_kusa.xml b/assets/xml/objects/object_kusa.xml index 67291a5543..5eaaa99c58 100644 --- a/assets/xml/objects/object_kusa.xml +++ b/assets/xml/objects/object_kusa.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_lightbox.xml b/assets/xml/objects/object_lightbox.xml index 552a79d7c7..c67059b89d 100644 --- a/assets/xml/objects/object_lightbox.xml +++ b/assets/xml/objects/object_lightbox.xml @@ -1,12 +1,11 @@ - - - + + - + - + diff --git a/assets/xml/objects/object_link_boy.xml b/assets/xml/objects/object_link_boy.xml index c5e11f54ce..14917fd165 100644 --- a/assets/xml/objects/object_link_boy.xml +++ b/assets/xml/objects/object_link_boy.xml @@ -1,4 +1,5 @@ + @@ -125,6 +126,14 @@ + + + + + + + + diff --git a/assets/xml/objects/object_link_child.xml b/assets/xml/objects/object_link_child.xml index 640228441a..85ed8de950 100644 --- a/assets/xml/objects/object_link_child.xml +++ b/assets/xml/objects/object_link_child.xml @@ -1,4 +1,5 @@ + @@ -123,8 +124,9 @@ - - + + + @@ -175,11 +177,12 @@ + + - diff --git a/assets/xml/objects/object_medal.xml b/assets/xml/objects/object_medal.xml index 533872a551..94976bd3f9 100644 --- a/assets/xml/objects/object_medal.xml +++ b/assets/xml/objects/object_medal.xml @@ -1,4 +1,5 @@ + @@ -6,7 +7,7 @@ - + diff --git a/assets/xml/objects/object_mo.xml b/assets/xml/objects/object_mo.xml index 68035c3844..ad84a14026 100644 --- a/assets/xml/objects/object_mo.xml +++ b/assets/xml/objects/object_mo.xml @@ -74,9 +74,5 @@ - - - - diff --git a/assets/xml/objects/object_mo_pal.xml b/assets/xml/objects/object_mo_pal.xml index b191e8395e..17cd4fc2f4 100644 --- a/assets/xml/objects/object_mo_pal.xml +++ b/assets/xml/objects/object_mo_pal.xml @@ -74,9 +74,5 @@ - - - - diff --git a/assets/xml/objects/object_mori_hineri1.xml b/assets/xml/objects/object_mori_hineri1.xml index a2033a6f97..572eb6e1f3 100644 --- a/assets/xml/objects/object_mori_hineri1.xml +++ b/assets/xml/objects/object_mori_hineri1.xml @@ -1,5 +1,5 @@ - + diff --git a/assets/xml/objects/object_mori_hineri1a.xml b/assets/xml/objects/object_mori_hineri1a.xml index d7e3489044..23e6f5e665 100644 --- a/assets/xml/objects/object_mori_hineri1a.xml +++ b/assets/xml/objects/object_mori_hineri1a.xml @@ -1,5 +1,5 @@ - + diff --git a/assets/xml/objects/object_mori_hineri2.xml b/assets/xml/objects/object_mori_hineri2.xml index 9f1c892afb..d539cd86f0 100644 --- a/assets/xml/objects/object_mori_hineri2.xml +++ b/assets/xml/objects/object_mori_hineri2.xml @@ -1,5 +1,5 @@ - + diff --git a/assets/xml/objects/object_mori_hineri2a.xml b/assets/xml/objects/object_mori_hineri2a.xml index 6fd6818562..0334488567 100644 --- a/assets/xml/objects/object_mori_hineri2a.xml +++ b/assets/xml/objects/object_mori_hineri2a.xml @@ -1,5 +1,5 @@ - + diff --git a/assets/xml/objects/object_mori_objects.xml b/assets/xml/objects/object_mori_objects.xml index aa24a38d70..1844cf6f69 100644 --- a/assets/xml/objects/object_mori_objects.xml +++ b/assets/xml/objects/object_mori_objects.xml @@ -1,5 +1,5 @@ - + diff --git a/assets/xml/objects/object_mori_tex.xml b/assets/xml/objects/object_mori_tex.xml index 79f1f0b4c0..756347bcc6 100644 --- a/assets/xml/objects/object_mori_tex.xml +++ b/assets/xml/objects/object_mori_tex.xml @@ -1,12 +1,12 @@ - + - + diff --git a/assets/xml/objects/object_nwc.xml b/assets/xml/objects/object_nwc.xml index 96ffa32383..abe2be092b 100644 --- a/assets/xml/objects/object_nwc.xml +++ b/assets/xml/objects/object_nwc.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_ny.xml b/assets/xml/objects/object_ny.xml index e2e8187ff8..c81d66ab56 100644 --- a/assets/xml/objects/object_ny.xml +++ b/assets/xml/objects/object_ny.xml @@ -1,10 +1,11 @@ + - - + + diff --git a/assets/xml/objects/object_oA3.xml b/assets/xml/objects/object_oA3.xml index a492bd8751..176ad09315 100644 --- a/assets/xml/objects/object_oA3.xml +++ b/assets/xml/objects/object_oA3.xml @@ -1,7 +1,6 @@ - - + diff --git a/assets/xml/objects/object_oE1.xml b/assets/xml/objects/object_oE1.xml index 4d5b1663fe..5b3234893e 100644 --- a/assets/xml/objects/object_oE1.xml +++ b/assets/xml/objects/object_oE1.xml @@ -56,7 +56,8 @@ - + + diff --git a/assets/xml/objects/object_oE11.xml b/assets/xml/objects/object_oE11.xml index 04f6f186da..26ff739cd0 100644 --- a/assets/xml/objects/object_oE11.xml +++ b/assets/xml/objects/object_oE11.xml @@ -3,7 +3,8 @@ - + + diff --git a/assets/xml/objects/object_oE12.xml b/assets/xml/objects/object_oE12.xml index a5fa39fd25..4b89954e0d 100644 --- a/assets/xml/objects/object_oE12.xml +++ b/assets/xml/objects/object_oE12.xml @@ -3,7 +3,8 @@ - + + diff --git a/assets/xml/objects/object_oE2.xml b/assets/xml/objects/object_oE2.xml index af62ad6d11..ea3ba91fc6 100644 --- a/assets/xml/objects/object_oE2.xml +++ b/assets/xml/objects/object_oE2.xml @@ -56,7 +56,8 @@ - + + diff --git a/assets/xml/objects/object_oE3.xml b/assets/xml/objects/object_oE3.xml index 95227da384..4a6cb3d926 100644 --- a/assets/xml/objects/object_oE3.xml +++ b/assets/xml/objects/object_oE3.xml @@ -56,13 +56,14 @@ - + + - + - + diff --git a/assets/xml/objects/object_oE5.xml b/assets/xml/objects/object_oE5.xml index 040fb8d733..c05917dc9a 100644 --- a/assets/xml/objects/object_oE5.xml +++ b/assets/xml/objects/object_oE5.xml @@ -52,9 +52,9 @@ - - - + + + diff --git a/assets/xml/objects/object_oE6.xml b/assets/xml/objects/object_oE6.xml index 95bb602b6b..d253130af1 100644 --- a/assets/xml/objects/object_oE6.xml +++ b/assets/xml/objects/object_oE6.xml @@ -3,7 +3,8 @@ - + + diff --git a/assets/xml/objects/object_oE7.xml b/assets/xml/objects/object_oE7.xml index b3e588d4c2..2b6b5cf316 100644 --- a/assets/xml/objects/object_oE7.xml +++ b/assets/xml/objects/object_oE7.xml @@ -7,7 +7,8 @@ - + + diff --git a/assets/xml/objects/object_oE8.xml b/assets/xml/objects/object_oE8.xml index be5de24947..8b1333fa9c 100644 --- a/assets/xml/objects/object_oE8.xml +++ b/assets/xml/objects/object_oE8.xml @@ -3,7 +3,8 @@ - + + diff --git a/assets/xml/objects/object_oE9.xml b/assets/xml/objects/object_oE9.xml index 8ea7ee18c7..e43cee426b 100644 --- a/assets/xml/objects/object_oE9.xml +++ b/assets/xml/objects/object_oE9.xml @@ -3,7 +3,8 @@ - + + diff --git a/assets/xml/objects/object_ossan.xml b/assets/xml/objects/object_ossan.xml index 963053f3f4..7e51c33bce 100644 --- a/assets/xml/objects/object_ossan.xml +++ b/assets/xml/objects/object_ossan.xml @@ -1,6 +1,9 @@ + + + diff --git a/assets/xml/objects/object_owl.xml b/assets/xml/objects/object_owl.xml index 24be378985..4ea2006678 100644 --- a/assets/xml/objects/object_owl.xml +++ b/assets/xml/objects/object_owl.xml @@ -61,7 +61,7 @@ - + diff --git a/assets/xml/objects/object_po_composer.xml b/assets/xml/objects/object_po_composer.xml index 2ab8d64d85..17c04fd18b 100644 --- a/assets/xml/objects/object_po_composer.xml +++ b/assets/xml/objects/object_po_composer.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_po_field.xml b/assets/xml/objects/object_po_field.xml index 10b402e2c7..43e1066e3b 100644 --- a/assets/xml/objects/object_po_field.xml +++ b/assets/xml/objects/object_po_field.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_poh.xml b/assets/xml/objects/object_poh.xml index 009d0fca3f..33517945e8 100644 --- a/assets/xml/objects/object_poh.xml +++ b/assets/xml/objects/object_poh.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_ps.xml b/assets/xml/objects/object_ps.xml index 043e232d64..98f548db1b 100644 --- a/assets/xml/objects/object_ps.xml +++ b/assets/xml/objects/object_ps.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_rl.xml b/assets/xml/objects/object_rl.xml index bbe0246ac8..8453935b1f 100644 --- a/assets/xml/objects/object_rl.xml +++ b/assets/xml/objects/object_rl.xml @@ -12,8 +12,6 @@ - - @@ -22,13 +20,12 @@ - - + diff --git a/assets/xml/objects/object_sa.xml b/assets/xml/objects/object_sa.xml index 8a63840409..e87cd793dd 100644 --- a/assets/xml/objects/object_sa.xml +++ b/assets/xml/objects/object_sa.xml @@ -66,7 +66,7 @@ - + diff --git a/assets/xml/objects/object_sb.xml b/assets/xml/objects/object_sb.xml index 64d3bb005a..57a0f7f8f7 100644 --- a/assets/xml/objects/object_sb.xml +++ b/assets/xml/objects/object_sb.xml @@ -1,11 +1,13 @@ + - - + + + diff --git a/assets/xml/objects/object_siofuki.xml b/assets/xml/objects/object_siofuki.xml index a23240a728..f8a9e50d83 100644 --- a/assets/xml/objects/object_siofuki.xml +++ b/assets/xml/objects/object_siofuki.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_skb.xml b/assets/xml/objects/object_skb.xml index 5b5efb4848..1220ddf6d9 100644 --- a/assets/xml/objects/object_skb.xml +++ b/assets/xml/objects/object_skb.xml @@ -55,10 +55,15 @@ - - - - + + + + + + + + + diff --git a/assets/xml/objects/object_skj.xml b/assets/xml/objects/object_skj.xml index 38636256fe..958301d2e8 100644 --- a/assets/xml/objects/object_skj.xml +++ b/assets/xml/objects/object_skj.xml @@ -41,27 +41,25 @@ + + + + + + + - - - - - - - - - diff --git a/assets/xml/objects/object_spot02_objects.xml b/assets/xml/objects/object_spot02_objects.xml index 65f45ff515..3dfaf227d3 100644 --- a/assets/xml/objects/object_spot02_objects.xml +++ b/assets/xml/objects/object_spot02_objects.xml @@ -3,7 +3,6 @@ - diff --git a/assets/xml/objects/object_spot17_obj.xml b/assets/xml/objects/object_spot17_obj.xml index d4239d8d28..73a4ca5203 100644 --- a/assets/xml/objects/object_spot17_obj.xml +++ b/assets/xml/objects/object_spot17_obj.xml @@ -7,6 +7,6 @@ - + diff --git a/assets/xml/objects/object_sst.xml b/assets/xml/objects/object_sst.xml index c142c50f43..66cf6c8e02 100644 --- a/assets/xml/objects/object_sst.xml +++ b/assets/xml/objects/object_sst.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_sst_pal.xml b/assets/xml/objects/object_sst_pal.xml index 9a9199b58f..138a320324 100644 --- a/assets/xml/objects/object_sst_pal.xml +++ b/assets/xml/objects/object_sst_pal.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_st.xml b/assets/xml/objects/object_st.xml index 983b9e2eab..e374b4cb4a 100644 --- a/assets/xml/objects/object_st.xml +++ b/assets/xml/objects/object_st.xml @@ -1,4 +1,5 @@ + @@ -22,7 +23,9 @@ - + + + diff --git a/assets/xml/objects/object_stream.xml b/assets/xml/objects/object_stream.xml index 59b0838e47..6c65f77c34 100644 --- a/assets/xml/objects/object_stream.xml +++ b/assets/xml/objects/object_stream.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_syokudai.xml b/assets/xml/objects/object_syokudai.xml index 11af7e9a3a..6434d923a5 100644 --- a/assets/xml/objects/object_syokudai.xml +++ b/assets/xml/objects/object_syokudai.xml @@ -1,5 +1,5 @@ - + diff --git a/assets/xml/objects/object_ta.xml b/assets/xml/objects/object_ta.xml index 5e446bf5c9..4f339fc951 100644 --- a/assets/xml/objects/object_ta.xml +++ b/assets/xml/objects/object_ta.xml @@ -66,7 +66,6 @@ - - + diff --git a/assets/xml/objects/object_tk.xml b/assets/xml/objects/object_tk.xml index 5b2fd13806..5c9d0a0a6f 100644 --- a/assets/xml/objects/object_tk.xml +++ b/assets/xml/objects/object_tk.xml @@ -4,10 +4,12 @@ + - + + diff --git a/assets/xml/objects/object_toki_objects.xml b/assets/xml/objects/object_toki_objects.xml index cd07e60d2b..917d239347 100644 --- a/assets/xml/objects/object_toki_objects.xml +++ b/assets/xml/objects/object_toki_objects.xml @@ -1,4 +1,5 @@  + @@ -12,7 +13,8 @@ - + + diff --git a/assets/xml/objects/object_tr.xml b/assets/xml/objects/object_tr.xml index 986a88cc5c..827b85bfe6 100644 --- a/assets/xml/objects/object_tr.xml +++ b/assets/xml/objects/object_tr.xml @@ -9,7 +9,9 @@ - + + + @@ -97,7 +99,9 @@ - + + + diff --git a/assets/xml/objects/object_trap.xml b/assets/xml/objects/object_trap.xml index 56195cf41b..1f8f4b5310 100644 --- a/assets/xml/objects/object_trap.xml +++ b/assets/xml/objects/object_trap.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_tw.xml b/assets/xml/objects/object_tw.xml index c6b9ec6099..c528fb4518 100644 --- a/assets/xml/objects/object_tw.xml +++ b/assets/xml/objects/object_tw.xml @@ -106,9 +106,11 @@ - - + + + + @@ -130,9 +132,11 @@ - - + + + + diff --git a/assets/xml/objects/object_wf.xml b/assets/xml/objects/object_wf.xml index 96ea841032..d5d70639d7 100644 --- a/assets/xml/objects/object_wf.xml +++ b/assets/xml/objects/object_wf.xml @@ -122,6 +122,7 @@ + diff --git a/assets/xml/objects/object_wood02.xml b/assets/xml/objects/object_wood02.xml index 5dd80a17b6..dcf6d21291 100644 --- a/assets/xml/objects/object_wood02.xml +++ b/assets/xml/objects/object_wood02.xml @@ -1,5 +1,5 @@ - + @@ -20,7 +20,7 @@ - + diff --git a/assets/xml/objects/object_ydan_objects.xml b/assets/xml/objects/object_ydan_objects.xml index baf7ca4c9c..70174a1e70 100644 --- a/assets/xml/objects/object_ydan_objects.xml +++ b/assets/xml/objects/object_ydan_objects.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/objects/object_zf.xml b/assets/xml/objects/object_zf.xml index 7f20eb7866..74e9d45915 100644 --- a/assets/xml/objects/object_zf.xml +++ b/assets/xml/objects/object_zf.xml @@ -1,4 +1,5 @@ + @@ -109,7 +110,7 @@ - + diff --git a/assets/xml/objects/object_zl2.xml b/assets/xml/objects/object_zl2.xml index 9af0a65270..2503b811d3 100644 --- a/assets/xml/objects/object_zl2.xml +++ b/assets/xml/objects/object_zl2.xml @@ -38,5 +38,7 @@ + + diff --git a/assets/xml/objects/object_zl4.xml b/assets/xml/objects/object_zl4.xml index e87a654656..99cc12ea2a 100644 --- a/assets/xml/objects/object_zl4.xml +++ b/assets/xml/objects/object_zl4.xml @@ -39,19 +39,21 @@ - - - - + + + + + - - - - - - - + + + + + + + + diff --git a/assets/xml/objects/object_zo.xml b/assets/xml/objects/object_zo.xml index 77465760ef..8872cc4c9f 100644 --- a/assets/xml/objects/object_zo.xml +++ b/assets/xml/objects/object_zo.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/overlays/ovl_Boss_Ganon.xml b/assets/xml/overlays/ovl_Boss_Ganon.xml index a6ed9c66eb..d09648d8d7 100644 --- a/assets/xml/overlays/ovl_Boss_Ganon.xml +++ b/assets/xml/overlays/ovl_Boss_Ganon.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/overlays/ovl_Boss_Ganon2.xml b/assets/xml/overlays/ovl_Boss_Ganon2.xml index 00f985786c..b922003dfa 100644 --- a/assets/xml/overlays/ovl_Boss_Ganon2.xml +++ b/assets/xml/overlays/ovl_Boss_Ganon2.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/overlays/ovl_En_Jsjutan.xml b/assets/xml/overlays/ovl_En_Jsjutan.xml index b3b012b1f5..13bbd82199 100644 --- a/assets/xml/overlays/ovl_En_Jsjutan.xml +++ b/assets/xml/overlays/ovl_En_Jsjutan.xml @@ -16,9 +16,6 @@ - - - diff --git a/assets/xml/overlays/ovl_Magic_Dark.xml b/assets/xml/overlays/ovl_Magic_Dark.xml index 965d140db4..37165cebc2 100644 --- a/assets/xml/overlays/ovl_Magic_Dark.xml +++ b/assets/xml/overlays/ovl_Magic_Dark.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/overlays/ovl_Oceff_Storm.xml b/assets/xml/overlays/ovl_Oceff_Storm.xml index 385f56dbff..d9e1f7e65a 100644 --- a/assets/xml/overlays/ovl_Oceff_Storm.xml +++ b/assets/xml/overlays/ovl_Oceff_Storm.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/overlays/ovl_Oceff_Wipe4.xml b/assets/xml/overlays/ovl_Oceff_Wipe4.xml index 6446beedb2..a4ec2c5def 100644 --- a/assets/xml/overlays/ovl_Oceff_Wipe4.xml +++ b/assets/xml/overlays/ovl_Oceff_Wipe4.xml @@ -1,4 +1,5 @@ + diff --git a/assets/xml/scenes/dungeons/MIZUsin.xml b/assets/xml/scenes/dungeons/MIZUsin.xml index e48f534d88..12a124cf09 100644 --- a/assets/xml/scenes/dungeons/MIZUsin.xml +++ b/assets/xml/scenes/dungeons/MIZUsin.xml @@ -7,6 +7,7 @@ + diff --git a/assets/xml/scenes/dungeons/MIZUsin_mq.xml b/assets/xml/scenes/dungeons/MIZUsin_mq.xml index bd0e260ace..cbbe48287e 100644 --- a/assets/xml/scenes/dungeons/MIZUsin_mq.xml +++ b/assets/xml/scenes/dungeons/MIZUsin_mq.xml @@ -7,6 +7,7 @@ + diff --git a/assets/xml/scenes/dungeons/ddan.xml b/assets/xml/scenes/dungeons/ddan.xml index a42e97cfc9..295f651739 100644 --- a/assets/xml/scenes/dungeons/ddan.xml +++ b/assets/xml/scenes/dungeons/ddan.xml @@ -1,5 +1,6 @@ + @@ -18,6 +19,7 @@ + diff --git a/assets/xml/scenes/dungeons/ddan_mq.xml b/assets/xml/scenes/dungeons/ddan_mq.xml index a42e97cfc9..295f651739 100644 --- a/assets/xml/scenes/dungeons/ddan_mq.xml +++ b/assets/xml/scenes/dungeons/ddan_mq.xml @@ -1,5 +1,6 @@ + @@ -18,6 +19,7 @@ + diff --git a/assets/xml/scenes/dungeons/ganon_boss.xml b/assets/xml/scenes/dungeons/ganon_boss.xml index c75914c29c..7c28b472d6 100644 --- a/assets/xml/scenes/dungeons/ganon_boss.xml +++ b/assets/xml/scenes/dungeons/ganon_boss.xml @@ -1,6 +1,9 @@ + + + diff --git a/assets/xml/scenes/indoors/tokinoma.xml b/assets/xml/scenes/indoors/tokinoma.xml index 4d83fe3908..fb62d9c2cc 100644 --- a/assets/xml/scenes/indoors/tokinoma.xml +++ b/assets/xml/scenes/indoors/tokinoma.xml @@ -1,5 +1,6 @@ + @@ -12,7 +13,6 @@ - diff --git a/assets/xml/scenes/indoors/tokinoma_pal_n64.xml b/assets/xml/scenes/indoors/tokinoma_pal_n64.xml index eb98a321af..9c0a970998 100644 --- a/assets/xml/scenes/indoors/tokinoma_pal_n64.xml +++ b/assets/xml/scenes/indoors/tokinoma_pal_n64.xml @@ -1,5 +1,6 @@ + diff --git a/assets/xml/scenes/overworld/spot20.xml b/assets/xml/scenes/overworld/spot20.xml index 3d305508ad..d3dd77a41e 100644 --- a/assets/xml/scenes/overworld/spot20.xml +++ b/assets/xml/scenes/overworld/spot20.xml @@ -1,5 +1,6 @@ + diff --git a/assets/xml/scenes/overworld/spot20_pal.xml b/assets/xml/scenes/overworld/spot20_pal.xml index 0ba9380e13..297b1c316e 100644 --- a/assets/xml/scenes/overworld/spot20_pal.xml +++ b/assets/xml/scenes/overworld/spot20_pal.xml @@ -1,5 +1,6 @@ + diff --git a/assets/xml/textures/map_48x85_static.xml b/assets/xml/textures/map_48x85_static.xml index 2788498a84..b8795bd07d 100644 --- a/assets/xml/textures/map_48x85_static.xml +++ b/assets/xml/textures/map_48x85_static.xml @@ -1,72 +1,74 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/baseroms/gc-eu-mq-dbg/config.yml b/baseroms/gc-eu-mq-dbg/config.yml index 09abaaf67a..e457028060 100644 --- a/baseroms/gc-eu-mq-dbg/config.yml +++ b/baseroms/gc-eu-mq-dbg/config.yml @@ -50,7 +50,7 @@ incbins: vram: 0x80157D30 size: 0x60 variables: - gMtxClear: 0x8012DB20 + gIdentityMtx: 0x8012DB20 sNesMessageEntryTable: 0x8014B320 sGerMessageEntryTable: 0x8014F548 sFraMessageEntryTable: 0x80151658 @@ -64,7 +64,7 @@ assets: - name: code/fbdemo_circle xml_path: assets/xml/code/fbdemo_circle.xml start_offset: 0x10ED48 - end_offset: 0x10FF68 + end_offset: 0x110038 - name: code/fbdemo_triforce xml_path: assets/xml/code/fbdemo_triforce.xml start_offset: 0x10E1D0 @@ -72,7 +72,7 @@ assets: - name: code/fbdemo_wipe1 xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0x10E2A0 - end_offset: 0x10EC30 + end_offset: 0x10ED28 - name: misc/link_animetion xml_path: assets/xml/misc/link_animetion.xml - name: misc/z_select_static diff --git a/baseroms/gc-eu-mq/config.yml b/baseroms/gc-eu-mq/config.yml index 62925ab3b4..0093015d7e 100644 --- a/baseroms/gc-eu-mq/config.yml +++ b/baseroms/gc-eu-mq/config.yml @@ -42,7 +42,7 @@ incbins: vram: 0x801130D0 size: 0x60 variables: - gMtxClear: 0x800FBC00 + gIdentityMtx: 0x800FBC00 sNesMessageEntryTable: 0x801077F0 sGerMessageEntryTable: 0x8010BA18 sFraMessageEntryTable: 0x8010DB28 @@ -56,7 +56,7 @@ assets: - name: code/fbdemo_circle xml_path: assets/xml/code/fbdemo_circle.xml start_offset: 0xE90A8 - end_offset: 0xEA2C8 + end_offset: 0xEA398 - name: code/fbdemo_triforce xml_path: assets/xml/code/fbdemo_triforce.xml start_offset: 0xE8530 @@ -64,7 +64,7 @@ assets: - name: code/fbdemo_wipe1 xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0xE8600 - end_offset: 0xE8F90 + end_offset: 0xE9088 - name: misc/link_animetion xml_path: assets/xml/misc/link_animetion.xml - name: misc/z_select_static diff --git a/baseroms/gc-eu/config.yml b/baseroms/gc-eu/config.yml index 278badfb80..9aef9891f9 100644 --- a/baseroms/gc-eu/config.yml +++ b/baseroms/gc-eu/config.yml @@ -42,7 +42,7 @@ incbins: vram: 0x801130F0 size: 0x60 variables: - gMtxClear: 0x800FBC20 + gIdentityMtx: 0x800FBC20 sNesMessageEntryTable: 0x80107810 sGerMessageEntryTable: 0x8010BA38 sFraMessageEntryTable: 0x8010DB48 @@ -56,7 +56,7 @@ assets: - name: code/fbdemo_circle xml_path: assets/xml/code/fbdemo_circle.xml start_offset: 0xE90C8 - end_offset: 0xEA2E8 + end_offset: 0xEA3B8 - name: code/fbdemo_triforce xml_path: assets/xml/code/fbdemo_triforce.xml start_offset: 0xE8550 @@ -64,7 +64,7 @@ assets: - name: code/fbdemo_wipe1 xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0xE8620 - end_offset: 0xE8FB0 + end_offset: 0xE90A8 - name: misc/link_animetion xml_path: assets/xml/misc/link_animetion.xml - name: misc/z_select_static diff --git a/baseroms/gc-jp-ce/config.yml b/baseroms/gc-jp-ce/config.yml index f73344d892..f3c0541a62 100644 --- a/baseroms/gc-jp-ce/config.yml +++ b/baseroms/gc-jp-ce/config.yml @@ -42,7 +42,7 @@ incbins: vram: 0x801158E0 size: 0x60 variables: - gMtxClear: 0x800FE2A0 + gIdentityMtx: 0x800FE2A0 sJpnMessageEntryTable: 0x80109E8C sNesMessageEntryTable: 0x8010DFCC sStaffMessageEntryTable: 0x801121EC @@ -55,7 +55,7 @@ assets: - name: code/fbdemo_circle xml_path: assets/xml/code/fbdemo_circle.xml start_offset: 0xEB768 - end_offset: 0xEC988 + end_offset: 0xECA58 - name: code/fbdemo_triforce xml_path: assets/xml/code/fbdemo_triforce.xml start_offset: 0xEABF0 @@ -63,7 +63,7 @@ assets: - name: code/fbdemo_wipe1 xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0xEACC0 - end_offset: 0xEB650 + end_offset: 0xEB748 - name: misc/link_animetion xml_path: assets/xml/misc/link_animetion.xml - name: misc/z_select_static diff --git a/baseroms/gc-jp-mq/config.yml b/baseroms/gc-jp-mq/config.yml index 81927277bd..41d1721f3d 100644 --- a/baseroms/gc-jp-mq/config.yml +++ b/baseroms/gc-jp-mq/config.yml @@ -42,7 +42,7 @@ incbins: vram: 0x801158E0 size: 0x60 variables: - gMtxClear: 0x800FE2A0 + gIdentityMtx: 0x800FE2A0 sJpnMessageEntryTable: 0x80109E8C sNesMessageEntryTable: 0x8010DFCC sStaffMessageEntryTable: 0x801121EC @@ -55,7 +55,7 @@ assets: - name: code/fbdemo_circle xml_path: assets/xml/code/fbdemo_circle.xml start_offset: 0xEB768 - end_offset: 0xEC988 + end_offset: 0xECA58 - name: code/fbdemo_triforce xml_path: assets/xml/code/fbdemo_triforce.xml start_offset: 0xEABF0 @@ -63,7 +63,7 @@ assets: - name: code/fbdemo_wipe1 xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0xEACC0 - end_offset: 0xEB650 + end_offset: 0xEB748 - name: misc/link_animetion xml_path: assets/xml/misc/link_animetion.xml - name: misc/z_select_static diff --git a/baseroms/gc-jp/config.yml b/baseroms/gc-jp/config.yml index 26e407d8c4..73285664c6 100644 --- a/baseroms/gc-jp/config.yml +++ b/baseroms/gc-jp/config.yml @@ -42,7 +42,7 @@ incbins: vram: 0x80115900 size: 0x60 variables: - gMtxClear: 0x800FE2C0 + gIdentityMtx: 0x800FE2C0 sJpnMessageEntryTable: 0x80109EAC sNesMessageEntryTable: 0x8010DFEC sStaffMessageEntryTable: 0x8011220C @@ -55,7 +55,7 @@ assets: - name: code/fbdemo_circle xml_path: assets/xml/code/fbdemo_circle.xml start_offset: 0xEB788 - end_offset: 0xEC9A8 + end_offset: 0xECA78 - name: code/fbdemo_triforce xml_path: assets/xml/code/fbdemo_triforce.xml start_offset: 0xEAC10 @@ -63,7 +63,7 @@ assets: - name: code/fbdemo_wipe1 xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0xEACE0 - end_offset: 0xEB670 + end_offset: 0xEB768 - name: misc/link_animetion xml_path: assets/xml/misc/link_animetion.xml - name: misc/z_select_static diff --git a/baseroms/gc-us-mq/config.yml b/baseroms/gc-us-mq/config.yml index 77f12ba8bd..1057e49b2e 100644 --- a/baseroms/gc-us-mq/config.yml +++ b/baseroms/gc-us-mq/config.yml @@ -42,7 +42,7 @@ incbins: vram: 0x801158C0 size: 0x60 variables: - gMtxClear: 0x800FE280 + gIdentityMtx: 0x800FE280 sJpnMessageEntryTable: 0x80109E6C sNesMessageEntryTable: 0x8010DFAC sStaffMessageEntryTable: 0x801121CC @@ -55,7 +55,7 @@ assets: - name: code/fbdemo_circle xml_path: assets/xml/code/fbdemo_circle.xml start_offset: 0xEB748 - end_offset: 0xEC968 + end_offset: 0xECA38 - name: code/fbdemo_triforce xml_path: assets/xml/code/fbdemo_triforce.xml start_offset: 0xEABD0 @@ -63,7 +63,7 @@ assets: - name: code/fbdemo_wipe1 xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0xEACA0 - end_offset: 0xEB630 + end_offset: 0xEB728 - name: misc/link_animetion xml_path: assets/xml/misc/link_animetion.xml - name: misc/z_select_static diff --git a/baseroms/gc-us/config.yml b/baseroms/gc-us/config.yml index c53cd1841a..620d550631 100644 --- a/baseroms/gc-us/config.yml +++ b/baseroms/gc-us/config.yml @@ -42,7 +42,7 @@ incbins: vram: 0x801158E0 size: 0x60 variables: - gMtxClear: 0x800FE2A0 + gIdentityMtx: 0x800FE2A0 sJpnMessageEntryTable: 0x80109E8C sNesMessageEntryTable: 0x8010DFCC sStaffMessageEntryTable: 0x801121EC @@ -55,7 +55,7 @@ assets: - name: code/fbdemo_circle xml_path: assets/xml/code/fbdemo_circle.xml start_offset: 0xEB768 - end_offset: 0xEC988 + end_offset: 0xECA58 - name: code/fbdemo_triforce xml_path: assets/xml/code/fbdemo_triforce.xml start_offset: 0xEABF0 @@ -63,7 +63,7 @@ assets: - name: code/fbdemo_wipe1 xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0xEACC0 - end_offset: 0xEB650 + end_offset: 0xEB748 - name: misc/link_animetion xml_path: assets/xml/misc/link_animetion.xml - name: misc/z_select_static diff --git a/baseroms/ique-cn/checksum.md5 b/baseroms/ique-cn/checksum.md5 index 82dfff85bf..6390fc95b9 100644 --- a/baseroms/ique-cn/checksum.md5 +++ b/baseroms/ique-cn/checksum.md5 @@ -1 +1 @@ -17a9f30d722c29e6912bd4b66713d2b0 build/ique-cn/oot-ique-cn.z64 +0238288a8e7c53b558b818865daf6ef3 build/ique-cn/oot-ique-cn.z64 diff --git a/baseroms/ique-cn/config.yml b/baseroms/ique-cn/config.yml index bcc6ca5b0c..6236b0cf51 100644 --- a/baseroms/ique-cn/config.yml +++ b/baseroms/ique-cn/config.yml @@ -42,7 +42,7 @@ incbins: vram: 0x80121EE0 size: 0x60 variables: - gMtxClear: 0x80106980 + gIdentityMtx: 0x80106980 sJpnMessageEntryTable: 0x80115838 sNesMessageEntryTable: 0x80119978 sStaffMessageEntryTable: 0x8011DB98 @@ -55,7 +55,7 @@ assets: - name: code/fbdemo_circle xml_path: assets/xml/code/fbdemo_circle.xml start_offset: 0xEBD88 - end_offset: 0xECFA8 + end_offset: 0xED078 - name: code/fbdemo_triforce xml_path: assets/xml/code/fbdemo_triforce.xml start_offset: 0xEB210 @@ -63,7 +63,7 @@ assets: - name: code/fbdemo_wipe1 xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0xEB2E0 - end_offset: 0xEBC70 + end_offset: 0xEBD68 - name: misc/link_animetion xml_path: assets/xml/misc/link_animetion.xml - name: misc/z_select_static diff --git a/baseroms/ntsc-1.0/config.yml b/baseroms/ntsc-1.0/config.yml index 2bdf99411a..948bbd179a 100644 --- a/baseroms/ntsc-1.0/config.yml +++ b/baseroms/ntsc-1.0/config.yml @@ -45,7 +45,7 @@ incbins: vram: 0x80114D70 size: 0x60 variables: - gMtxClear: 0x800FEDB0 + gIdentityMtx: 0x800FEDB0 sJpnMessageEntryTable: 0x8010A94C sNesMessageEntryTable: 0x8010EA8C sStaffMessageEntryTable: 0x80112CAC @@ -58,7 +58,7 @@ assets: - name: code/fbdemo_circle xml_path: assets/xml/code/fbdemo_circle.xml start_offset: 0xEC0A8 - end_offset: 0xED2C8 + end_offset: 0xED398 - name: code/fbdemo_triforce xml_path: assets/xml/code/fbdemo_triforce.xml start_offset: 0xEB530 @@ -66,7 +66,7 @@ assets: - name: code/fbdemo_wipe1 xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0xEB600 - end_offset: 0xEBF90 + end_offset: 0xEC088 - name: n64dd/error_textures xml_path: assets/xml/n64dd/error_textures.xml start_offset: 0xC160 diff --git a/baseroms/ntsc-1.1/config.yml b/baseroms/ntsc-1.1/config.yml index 1b110a84c8..2317ae2dac 100644 --- a/baseroms/ntsc-1.1/config.yml +++ b/baseroms/ntsc-1.1/config.yml @@ -45,7 +45,7 @@ incbins: vram: 0x80114F30 size: 0x60 variables: - gMtxClear: 0x800FEF70 + gIdentityMtx: 0x800FEF70 sJpnMessageEntryTable: 0x8010AB0C sNesMessageEntryTable: 0x8010EC4C sStaffMessageEntryTable: 0x80112E6C @@ -58,7 +58,7 @@ assets: - name: code/fbdemo_circle xml_path: assets/xml/code/fbdemo_circle.xml start_offset: 0xEC268 - end_offset: 0xED488 + end_offset: 0xED558 - name: code/fbdemo_triforce xml_path: assets/xml/code/fbdemo_triforce.xml start_offset: 0xEB6F0 @@ -66,7 +66,7 @@ assets: - name: code/fbdemo_wipe1 xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0xEB7C0 - end_offset: 0xEC150 + end_offset: 0xEC248 - name: n64dd/error_textures xml_path: assets/xml/n64dd/error_textures.xml start_offset: 0xC140 diff --git a/baseroms/ntsc-1.2/config.yml b/baseroms/ntsc-1.2/config.yml index a631ca5511..6fc7896db0 100644 --- a/baseroms/ntsc-1.2/config.yml +++ b/baseroms/ntsc-1.2/config.yml @@ -45,7 +45,7 @@ incbins: vram: 0x80115420 size: 0x60 variables: - gMtxClear: 0x800FF3F0 + gIdentityMtx: 0x800FF3F0 sJpnMessageEntryTable: 0x8010AFFC sNesMessageEntryTable: 0x8010F13C sStaffMessageEntryTable: 0x8011335C @@ -58,7 +58,7 @@ assets: - name: code/fbdemo_circle xml_path: assets/xml/code/fbdemo_circle.xml start_offset: 0xEC0B8 - end_offset: 0xED2D8 + end_offset: 0xED3A8 - name: code/fbdemo_triforce xml_path: assets/xml/code/fbdemo_triforce.xml start_offset: 0xEB540 @@ -66,7 +66,7 @@ assets: - name: code/fbdemo_wipe1 xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0xEB610 - end_offset: 0xEBFA0 + end_offset: 0xEC098 - name: n64dd/error_textures xml_path: assets/xml/n64dd/error_textures.xml start_offset: 0xC120 diff --git a/baseroms/pal-1.0/config.yml b/baseroms/pal-1.0/config.yml index a8ea60b79d..37ffb7500b 100644 --- a/baseroms/pal-1.0/config.yml +++ b/baseroms/pal-1.0/config.yml @@ -50,7 +50,7 @@ incbins: vram: 0x80112B70 size: 0x60 variables: - gMtxClear: 0x800FCD00 + gIdentityMtx: 0x800FCD00 sNesMessageEntryTable: 0x801088BC sGerMessageEntryTable: 0x8010CAE4 sFraMessageEntryTable: 0x8010EBF4 @@ -64,7 +64,7 @@ assets: - name: code/fbdemo_circle xml_path: assets/xml/code/fbdemo_circle.xml start_offset: 0xE99C8 - end_offset: 0xEABE8 + end_offset: 0xEACB8 - name: code/fbdemo_triforce xml_path: assets/xml/code/fbdemo_triforce.xml start_offset: 0xE8E50 @@ -72,7 +72,7 @@ assets: - name: code/fbdemo_wipe1 xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0xE8F20 - end_offset: 0xE98B0 + end_offset: 0xE99A8 - name: n64dd/error_textures xml_path: assets/xml/n64dd/error_textures.xml start_offset: 0xC0E0 diff --git a/baseroms/pal-1.1/config.yml b/baseroms/pal-1.1/config.yml index 4811f1cb93..45bf82b877 100644 --- a/baseroms/pal-1.1/config.yml +++ b/baseroms/pal-1.1/config.yml @@ -50,7 +50,7 @@ incbins: vram: 0x80112BB0 size: 0x60 variables: - gMtxClear: 0x800FCD40 + gIdentityMtx: 0x800FCD40 sNesMessageEntryTable: 0x801088FC sGerMessageEntryTable: 0x8010CB24 sFraMessageEntryTable: 0x8010EC34 @@ -64,7 +64,7 @@ assets: - name: code/fbdemo_circle xml_path: assets/xml/code/fbdemo_circle.xml start_offset: 0xE9A08 - end_offset: 0xEAC28 + end_offset: 0xEACF8 - name: code/fbdemo_triforce xml_path: assets/xml/code/fbdemo_triforce.xml start_offset: 0xE8E90 @@ -72,7 +72,7 @@ assets: - name: code/fbdemo_wipe1 xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0xE8F60 - end_offset: 0xE98F0 + end_offset: 0xE99E8 - name: n64dd/error_textures xml_path: assets/xml/n64dd/error_textures.xml start_offset: 0xC0E0 diff --git a/docs/BUILDING_MACOS.md b/docs/BUILDING_MACOS.md index d34035fcec..8d2f67458e 100644 --- a/docs/BUILDING_MACOS.md +++ b/docs/BUILDING_MACOS.md @@ -55,12 +55,12 @@ cd build-binutils Configure the build ```bash -../binutils-2.35/configure --target=mips-linux-gnu --prefix=/opt/cross --disable-gprof --disable-gdb --disable-werror +../binutils-2.35/configure --target=mips-linux-gnu --prefix=/opt/cross --with-system-zlib --disable-gprof --disable-gdb --disable-werror ``` Make and install binutils ```bash -make -j +make -j$(nproc) sudo make install ``` @@ -82,3 +82,44 @@ If this worked, you can now delete the temporary directory `~/binutils-tmp`. Apple's version of `make` is very out-of-date, so you should use the brew-installed `gmake` in place of `make` in this repo from now on. You should now be able to continue from [step 2](../README.md#2-clone-the-repository) of the Linux instructions. + + +## 4. Building GCC (optional) + +If you'd like to compile with GCC instead of IDO (e.g. for modding), you can build it from source similarly to how we built binutils: + +Install dependences +```bash +brew install gcc@14 gmp isl libmpc mpfr +``` + +Create and enter local working dir +```bash +mkdir ~/gcc-tmp +cd ~/gcc-tmp +``` + +Get and extract gcc source +```bash +curl -O https://ftp.gnu.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.xz +tar xvf gcc-14.2.0.tar.xz +``` + +Create and enter a build directory +```bash +mkdir build-gcc +cd build-gcc +``` + +Configure the build +```bash +CC=gcc-14 CXX=g++-14 ../gcc-14.2.0/configure --target=mips-linux-gnu --prefix=/opt/cross --disable-nls --enable-languages=c --with-gmp=$(brew --prefix)/opt/gmp --with-mpfr=$(brew --prefix)/opt/mpfr --with-mpc=$(brew --prefix)/opt/libmpc --with-isl=$(brew --prefix)/opt/isl +``` + +Make and install gcc +```bash +CC=gcc-14 CXX=g++-14 make all-gcc -j$(nproc) +sudo make install-gcc +``` + +If this worked, you can now delete the temporary directory `~/gcc-tmp`. diff --git a/docs/assets/extraction.md b/docs/assets/extraction.md new file mode 100644 index 0000000000..a4c342db3b --- /dev/null +++ b/docs/assets/extraction.md @@ -0,0 +1,18 @@ +Assets are not committed to the repo; instead, they are extracted from the ROM files as part of `make setup`. + +Assets are extracted to `extracted/VERSION/assets` (for example `extracted/ntsc-1.0/assets` for the `ntsc-1.0` version), based on the descriptions stored in xml files in `assets/xml/`. + +For details on the xml files contents, see [the assets xml specification file](../../tools/assets/descriptor/spec.md). + +The extraction tool can use [rich](https://github.com/Textualize/rich) if installed to make output prettier. +If you are looking at output or errors from during extraction, consider installing rich for a better experience: `.venv/bin/python3 -m pip install rich` + +To run the extraction outside of `make setup`, use `./tools/extract_assets.sh VERSION`. +- Pass `-f` to force extraction: otherwise only assets for which xmls were modified will be extracted. +- Pass `-j` to use multiprocessing, making extraction quicker. Note that this makes for less readable errors if any error happens. +- Pass `-s name` to extract assets using baserom file `name`. +- Pass `-r -s 'name.*'` to extract assets using baserom files whose name match regular expression `name.*`. + +There currently are various hacks in place in the extraction tool source code to make extraction of some corner cases possible, or to silence extraction warnings. +Some of these hacks check for the name of resources, so renaming a few specific resources may need updating the extraction tool's source too. +The plan is to eventually remove those hardcoded checks from the source and use a `HackMode` attribute in the xmls to trigger the hacks code paths. diff --git a/docs/assets/images.md b/docs/assets/images.md new file mode 100644 index 0000000000..e35e16201a --- /dev/null +++ b/docs/assets/images.md @@ -0,0 +1,72 @@ +# Images + +Images in the rom are in N64 image formats. +On extraction, they are converted to png and written to `extracted/VERSION/`. +On build, they are converted back to N64 formats and written as C arrays to `.inc.c` files in `build/VERSION/`. + +The build system will also pick up images in `assets/`, allowing modders to add or even [replace](#replacing-images) images. + +PNG files have suffixes indicating how they are to be converted. For example, a `gDekuStickTex.i8.png` file will be converted to `i8`. + +The valid formats are `rgba32`, `rgba16`, `i4`, `i8`, `ia4`, `ia8`, `ia16`, `ci4` and `ci8`. + +An optional suffix can be used to indicate the element type of the C array written out, for example `.u32` in `gHylianMan1ShirtTex.i8.u32.png`. The valid array element types are `u64` and `u32`. If omitted, the element type defaults to `u64`. `u32` is only used for unaligned textures. + +The tool implementing png->n64 conversion is [build_from_png](../../tools/assets/build_from_png/build_from_png.c), using [n64texconv](../../tools/assets/n64texconv/) as its backbone. + +# Replacing images + +The contents of `extracted/` are meant to hold the baserom assets and should not be modified. Instead, replacing an image can be done by creating a png file at the same relative path under `assets/` as the image to replace. + +For example, replacing `gLinkHairTex` (`extracted/VERSION/assets/objects/gameplay_keep/gLinkHairTex.rgba16.png`) with the texture for `gHylianMan1BeardedEyeOpenTex` (`extracted/VERSION/assets/objects/object_ahg/gHylianMan1BeardedEyeOpenTex.ci8.tlut_gHylianMan1TLUT_u32.u32.png`): + +```sh +# for VERSION=gc-eu-mq-dbg + +mkdir -p assets/objects/gameplay_keep/ +cp \ + extracted/gc-eu-mq-dbg/assets/objects/object_ahg/gHylianMan1BeardedEyeOpenTex.ci8.tlut_gHylianMan1TLUT_u32.u32.png \ + assets/objects/gameplay_keep/gLinkHairTex.rgba16.png + +# Cause make to rebuild gameplay_keep, where gLinkHairTex is +touch extracted/gc-eu-mq-dbg/assets/objects/gameplay_keep/gameplay_keep.c + +make VERSION=gc-eu-mq-dbg +``` + +# CI images + +CI (Color Indexed) images also have a palette or TLUT (Texture Look-Up Table). + +PNG images to be converted to CI formats may have a `.tlut_gNameTLUT[_]` suffix indicating the name and element type (optional, defaults to u64) of the TLUT `gNameTLUT.tlut.rgba16[.].inc.c` file to write the palette to. + +If this suffix is omitted, the TLUT will be written to a `gNameTex.tlut.rgba16.inc.c` file named after the CI image. + +For example without the `.tlut_` suffix, `gGanonHairFringeTex.ci8.png`: + +- extracted to `extracted/VERSION/assets/objects/object_ganon2/gGanonHairFringeTex.ci8.png` +- texture written to `build/VERSION/assets/objects/object_ganon2/gGanonHairFringeTex.ci8.inc.c` +- palette written to `build/VERSION/assets/objects/object_ganon2/gGanonHairFringeTex.tlut.rgba16.inc.c` + +For example with the `.tlut_` suffix, `gCowNoseTex.ci8.tlut_gCowTLUT.png`: + +- extracted to `extracted/gc-eu-mq-dbg/assets/objects/object_cow/gCowNoseTex.ci8.tlut_gCowTLUT.png` +- texture written to `build/gc-eu-mq-dbg/assets/objects/object_cow/gCowNoseTex.ci8.tlut_gCowTLUT.inc.c` +- palette written to `build/gc-eu-mq-dbg/assets/objects/object_cow/gCowTLUT.tlut.rgba16.bin` + +CI images with a `.tlut_` suffix have a shared palette: there are several CI images using the same palette. +The build system (`build_from_png`) will find images sharing the same palette by looking at the `.tlut_` suffixes of png files in the same folder and in the corresponding `assets/` folder. + +In the matching case of shared palettes, all png files have the same palette, which is written out. +Otherwise the images are automatically co-quantized and the resulting images and palette are written out. + +Note the N64 supports CI images with IA16 palettes instead of RGBA16 palettes, but OoT doesn't have such textures. +For simplicity, CI images with IA16 palettes are not supported in the build system, and all CI images are assumed to use RGBA16 palettes. + +# Skybox textures + +Skybox textures, located in (`extracted/VERSION/`)`assets/textures/skyboxes`, are ci8 images with the additional specificity of being limited to a palette of 128 colors that can be loaded as either the first or last 128 colors of a 256-colors palette, depending on the skybox. + +The build system identifies such textures with the additional "sub-format" suffix `.split_lo` or `.split_hi` right after the `.ci8` suffix. `split_lo` corresponds to textures where the half palette is mapped to the lower half, and `split_hi` to the higher half. + +Like for regular ci images, images are automatically converted, quantized and written within those restrictions by the build system. diff --git a/format.py b/format.py index f95885344e..b0043075d5 100755 --- a/format.py +++ b/format.py @@ -154,12 +154,22 @@ def format_files(src_files: List[str], extra_files: List[str], nb_jobs: int): def list_files_to_format(): - files = glob.glob("src/**/*.c", recursive=True) + files = ( + glob.glob("src/**/*.c", recursive=True) + + glob.glob("assets/**/*.c", recursive=True) + ) extra_files = ( glob.glob("assets/**/*.xml", recursive=True) + glob.glob("include/**/*.h", recursive=True) + glob.glob("src/**/*.h", recursive=True) + + glob.glob("assets/**/*.h", recursive=True) ) + + # Do not format assets/text/ files + for assets_text_f in glob.glob("assets/text/**/*.c", recursive=True): + if assets_text_f in files: + files.remove(assets_text_f) + return files, extra_files diff --git a/include/array_count.h b/include/array_count.h new file mode 100644 index 0000000000..9e5f6ed4ca --- /dev/null +++ b/include/array_count.h @@ -0,0 +1,8 @@ +#ifndef ARRAY_COUNT_H +#define ARRAY_COUNT_H + +#define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0])) +#define ARRAY_COUNTU(arr) (u32)(sizeof(arr) / sizeof(arr[0])) +#define ARRAY_COUNT_2D(arr) (s32)(sizeof(arr) / sizeof(arr[0][0])) + +#endif diff --git a/include/audio/aseq.h b/include/audio/aseq.h index 689c42664f..99df3248f7 100644 --- a/include/audio/aseq.h +++ b/include/audio/aseq.h @@ -52,7 +52,18 @@ #ifndef ASEQ_H #define ASEQ_H -#include "versions.h" +/** + * MML Version + */ + +#ifndef MML_VERSION + #error "MML version not defined, define MML_VERSION in the cpp invocation" +#endif + +#define MML_VERSION_OOT 0 +#define MML_VERSION_MM 1 + + /** * IO Ports @@ -220,21 +231,190 @@ #define FONTANY_INSTR_ASM_NOISE 136 - -#ifdef _LANGUAGE_ASEQ - /** - * MML Version + * Command Opcode IDs */ -#ifndef MML_VERSION - #error "MML version not defined, define MML_VERSION in the cpp invocation" +// control flow commands +#define ASEQ_OP_CONTROL_FLOW_FIRST 0xF2 +#define ASEQ_OP_RBLTZ 0xF2 +#define ASEQ_OP_RBEQZ 0xF3 +#define ASEQ_OP_RJUMP 0xF4 +#define ASEQ_OP_BGEZ 0xF5 +#define ASEQ_OP_BREAK 0xF6 +#define ASEQ_OP_LOOPEND 0xF7 +#define ASEQ_OP_LOOP 0xF8 +#define ASEQ_OP_BLTZ 0xF9 +#define ASEQ_OP_BEQZ 0xFA +#define ASEQ_OP_JUMP 0xFB +#define ASEQ_OP_CALL 0xFC +#define ASEQ_OP_DELAY 0xFD +#define ASEQ_OP_DELAY1 0xFE +#define ASEQ_OP_END 0xFF + +// sequence commands +#define ASEQ_OP_SEQ_TESTCHAN 0x00 // low nibble used as argument +#define ASEQ_OP_SEQ_STOPCHAN 0x40 // low nibble used as argument +#define ASEQ_OP_SEQ_SUBIO 0x50 // low nibble used as argument +#define ASEQ_OP_SEQ_LDRES 0x60 // low nibble used as argument +#define ASEQ_OP_SEQ_STIO 0x70 // low nibble used as argument +#define ASEQ_OP_SEQ_LDIO 0x80 // low nibble used as argument +#define ASEQ_OP_SEQ_LDCHAN 0x90 // low nibble used as argument +#define ASEQ_OP_SEQ_RLDCHAN 0xA0 // low nibble used as argument +#define ASEQ_OP_SEQ_LDSEQ 0xB0 // low nibble used as argument +#if (MML_VERSION == MML_VERSION_MM) +#define ASEQ_OP_SEQ_C2 0xC2 +#define ASEQ_OP_SEQ_C3 0xC3 +#endif +#define ASEQ_OP_SEQ_RUNSEQ 0xC4 +#define ASEQ_OP_SEQ_SCRIPTCTR 0xC5 +#define ASEQ_OP_SEQ_STOP 0xC6 +#define ASEQ_OP_SEQ_STSEQ 0xC7 +#define ASEQ_OP_SEQ_SUB 0xC8 +#define ASEQ_OP_SEQ_AND 0xC9 +#define ASEQ_OP_SEQ_LDI 0xCC +#define ASEQ_OP_SEQ_DYNCALL 0xCD +#define ASEQ_OP_SEQ_RAND 0xCE +#define ASEQ_OP_SEQ_NOTEALLOC 0xD0 +#define ASEQ_OP_SEQ_LDSHORTGATEARR 0xD1 +#define ASEQ_OP_SEQ_LDSHORTVELARR 0xD2 +#define ASEQ_OP_SEQ_MUTEBHV 0xD3 +#define ASEQ_OP_SEQ_MUTE 0xD4 +#define ASEQ_OP_SEQ_MUTESCALE 0xD5 +#define ASEQ_OP_SEQ_FREECHAN 0xD6 +#define ASEQ_OP_SEQ_INITCHAN 0xD7 +#define ASEQ_OP_SEQ_VOLSCALE 0xD9 +#define ASEQ_OP_SEQ_VOLMODE 0xDA +#define ASEQ_OP_SEQ_VOL 0xDB +#define ASEQ_OP_SEQ_TEMPOCHG 0xDC +#define ASEQ_OP_SEQ_TEMPO 0xDD +#define ASEQ_OP_SEQ_RTRANSPOSE 0xDE +#define ASEQ_OP_SEQ_TRANSPOSE 0xDF +#define ASEQ_OP_SEQ_EF 0xEF +#define ASEQ_OP_SEQ_FREENOTELIST 0xF0 +#define ASEQ_OP_SEQ_ALLOCNOTELIST 0xF1 + +// channel commands +#define ASEQ_OP_CHAN_CDELAY 0x00 // low nibble used as argument +#define ASEQ_OP_CHAN_LDSAMPLE 0x10 // low nibble used as argument +#define ASEQ_OP_CHAN_LDCHAN 0x20 // low nibble used as argument +#define ASEQ_OP_CHAN_STCIO 0x30 // low nibble used as argument +#define ASEQ_OP_CHAN_LDCIO 0x40 // low nibble used as argument +#define ASEQ_OP_CHAN_SUBIO 0x50 // low nibble used as argument +#define ASEQ_OP_CHAN_LDIO 0x60 // low nibble used as argument +#define ASEQ_OP_CHAN_STIO 0x70 // lower 3 bits used as argument +#define ASEQ_OP_CHAN_RLDLAYER 0x78 // lower 3 bits used as argument +#define ASEQ_OP_CHAN_TESTLAYER 0x80 // lower 3 bits used as argument +#define ASEQ_OP_CHAN_LDLAYER 0x88 // lower 3 bits used as argument +#define ASEQ_OP_CHAN_DELLAYER 0x90 // lower 3 bits used as argument +#define ASEQ_OP_CHAN_DYNLDLAYER 0x98 // lower 3 bits used as argument +#if (MML_VERSION == MML_VERSION_MM) +#define ASEQ_OP_CHAN_A0 0xA0 +#define ASEQ_OP_CHAN_A1 0xA1 +#define ASEQ_OP_CHAN_A2 0xA2 +#define ASEQ_OP_CHAN_A3 0xA3 +#define ASEQ_OP_CHAN_A4 0xA4 +#define ASEQ_OP_CHAN_A5 0xA5 +#define ASEQ_OP_CHAN_A6 0xA6 +#define ASEQ_OP_CHAN_A7 0xA7 +#define ASEQ_OP_CHAN_RANDPTR 0xA8 +#endif +#define ASEQ_OP_CHAN_LDFILTER 0xB0 +#define ASEQ_OP_CHAN_FREEFILTER 0xB1 +#define ASEQ_OP_CHAN_LDSEQTOPTR 0xB2 +#define ASEQ_OP_CHAN_FILTER 0xB3 +#define ASEQ_OP_CHAN_PTRTODYNTBL 0xB4 +#define ASEQ_OP_CHAN_DYNTBLTOPTR 0xB5 +#define ASEQ_OP_CHAN_DYNTBLV 0xB6 +#define ASEQ_OP_CHAN_RANDTOPTR 0xB7 +#define ASEQ_OP_CHAN_RAND 0xB8 +#define ASEQ_OP_CHAN_RANDVEL 0xB9 +#define ASEQ_OP_CHAN_RANDGATE 0xBA +#define ASEQ_OP_CHAN_COMBFILTER 0xBB +#define ASEQ_OP_CHAN_PTRADD 0xBC +#if (MML_VERSION == MML_VERSION_OOT) +#define ASEQ_OP_CHAN_RANDPTR 0xBD +#endif +#if (MML_VERSION == MML_VERSION_MM) +#define ASEQ_OP_CHAN_SAMPLESTART 0xBD +#define ASEQ_OP_CHAN_UNK_BE 0xBE +#endif +#define ASEQ_OP_CHAN_INSTR 0xC1 +#define ASEQ_OP_CHAN_DYNTBL 0xC2 +#define ASEQ_OP_CHAN_SHORT 0xC3 +#define ASEQ_OP_CHAN_NOSHORT 0xC4 +#define ASEQ_OP_CHAN_DYNTBLLOOKUP 0xC5 +#define ASEQ_OP_CHAN_FONT 0xC6 +#define ASEQ_OP_CHAN_STSEQ 0xC7 +#define ASEQ_OP_CHAN_SUB 0xC8 +#define ASEQ_OP_CHAN_AND 0xC9 +#define ASEQ_OP_CHAN_MUTEBHV 0xCA +#define ASEQ_OP_CHAN_LDSEQ 0xCB +#define ASEQ_OP_CHAN_LDI 0xCC +#define ASEQ_OP_CHAN_STOPCHAN 0xCD +#define ASEQ_OP_CHAN_LDPTR 0xCE +#define ASEQ_OP_CHAN_STPTRTOSEQ 0xCF +#define ASEQ_OP_CHAN_EFFECTS 0xD0 +#define ASEQ_OP_CHAN_NOTEALLOC 0xD1 +#define ASEQ_OP_CHAN_SUSTAIN 0xD2 +#define ASEQ_OP_CHAN_BEND 0xD3 +#define ASEQ_OP_CHAN_REVERB 0xD4 +#define ASEQ_OP_CHAN_VIBFREQ 0xD7 +#define ASEQ_OP_CHAN_VIBDEPTH 0xD8 +#define ASEQ_OP_CHAN_RELEASERATE 0xD9 +#define ASEQ_OP_CHAN_ENV 0xDA +#define ASEQ_OP_CHAN_TRANSPOSE 0xDB +#define ASEQ_OP_CHAN_PANWEIGHT 0xDC +#define ASEQ_OP_CHAN_PAN 0xDD +#define ASEQ_OP_CHAN_FREQSCALE 0xDE +#define ASEQ_OP_CHAN_VOL 0xDF +#define ASEQ_OP_CHAN_VOLEXP 0xE0 +#define ASEQ_OP_CHAN_VIBFREQGRAD 0xE1 +#define ASEQ_OP_CHAN_VIBDEPTHGRAD 0xE2 +#define ASEQ_OP_CHAN_VIBDELAY 0xE3 +#define ASEQ_OP_CHAN_DYNCALL 0xE4 +#define ASEQ_OP_CHAN_REVERBIDX 0xE5 +#define ASEQ_OP_CHAN_SAMPLEBOOK 0xE6 +#define ASEQ_OP_CHAN_LDPARAMS 0xE7 +#define ASEQ_OP_CHAN_PARAMS 0xE8 +#define ASEQ_OP_CHAN_NOTEPRI 0xE9 +#define ASEQ_OP_CHAN_STOP 0xEA +#define ASEQ_OP_CHAN_FONTINSTR 0xEB +#define ASEQ_OP_CHAN_VIBRESET 0xEC +#define ASEQ_OP_CHAN_GAIN 0xED +#define ASEQ_OP_CHAN_BENDFINE 0xEE +#define ASEQ_OP_CHAN_FREENOTELIST 0xF0 +#define ASEQ_OP_CHAN_ALLOCNOTELIST 0xF1 + +// layer commands +#define ASEQ_OP_LAYER_NOTEDVG 0x00 +#define ASEQ_OP_LAYER_NOTEDV 0x40 +#define ASEQ_OP_LAYER_NOTEVG 0x80 +#define ASEQ_OP_LAYER_LDELAY 0xC0 +#define ASEQ_OP_LAYER_SHORTVEL 0xC1 +#define ASEQ_OP_LAYER_TRANSPOSE 0xC2 +#define ASEQ_OP_LAYER_SHORTDELAY 0xC3 +#define ASEQ_OP_LAYER_LEGATO 0xC4 +#define ASEQ_OP_LAYER_NOLEGATO 0xC5 +#define ASEQ_OP_LAYER_INSTR 0xC6 +#define ASEQ_OP_LAYER_PORTAMENTO 0xC7 +#define ASEQ_OP_LAYER_NOPORTAMENTO 0xC8 +#define ASEQ_OP_LAYER_SHORTGATE 0xC9 +#define ASEQ_OP_LAYER_NOTEPAN 0xCA +#define ASEQ_OP_LAYER_ENV 0xCB +#define ASEQ_OP_LAYER_NODRUMPAN 0xCC +#define ASEQ_OP_LAYER_STEREO 0xCD +#define ASEQ_OP_LAYER_BENDFINE 0xCE +#define ASEQ_OP_LAYER_RELEASERATE 0xCF +#define ASEQ_OP_LAYER_LDSHORTVEL 0xD0 // low nibble used as an argument +#define ASEQ_OP_LAYER_LDSHORTGATE 0xE0 // low nibble used as an argument +#if (MML_VERSION == MML_VERSION_MM) +#define ASEQ_OP_LAYER_F0 0xF0 +#define ASEQ_OP_LAYER_F1 0xF1 #endif -#define MML_VERSION_OOT 0 -#define MML_VERSION_MM 1 - +#ifdef _LANGUAGE_ASEQ /** * IDENT @@ -391,7 +571,7 @@ _RESET_SECTION /* `ldseq` changes structure based on current section. */ .purgem ldseq .macro ldseq ioPortNum, seqId, label - _wr_cmd_id ldseq, 0xB0,,,,,,,, \ioPortNum, 4 + _wr_cmd_id ldseq, ASEQ_OP_SEQ_LDSEQ,,,,,,,, \ioPortNum, 4 _wr_u8 \seqId _wr_lbl \label .endm @@ -409,7 +589,7 @@ _RESET_SECTION /* `ldseq` changes structure based on current section. */ .purgem ldseq .macro ldseq label - _wr_cmd_id ldseq, ,0xCB,,,,,,, 0, 0 + _wr_cmd_id ldseq, ,ASEQ_OP_CHAN_LDSEQ,,,,,,, 0, 0 _wr_lbl \label .endm @@ -419,14 +599,14 @@ _RESET_SECTION _check_arg_bitwidth_u \lowpassCutoff, 4 _check_arg_bitwidth_u \highpassCutoff, 4 - _wr_cmd_id filter, ,0xB3,,,,,,, 0, 0 + _wr_cmd_id filter, ,ASEQ_OP_CHAN_FILTER,,,,,,, 0, 0 _wr_u8 (\lowpassCutoff << 4) | (\highpassCutoff) .endm /* `env` changes structure based on current section. */ .purgem env .macro env label - _wr_cmd_id env, ,0xDA,,,,,,, 0, 0 + _wr_cmd_id env, ,ASEQ_OP_CHAN_ENV,,,,,,, 0, 0 _wr_lbl \label .endm @@ -443,7 +623,7 @@ _RESET_SECTION /* `env` changes structure based on current section. */ .purgem env .macro env label, arg - _wr_cmd_id env, ,,0xCB,,,,,, 0, 0 + _wr_cmd_id env, ,,ASEQ_OP_LAYER_ENV,,,,,, 0, 0 _wr_lbl \label _wr_u8 \arg .endm @@ -561,6 +741,7 @@ _RESET_SECTION /* Write the sequence name into a special .note.name section */ .pushsection .note.name, "", @note .asciz "\name" + .balign 4 .popsection /* Reset section and write start symbol. */ @@ -646,7 +827,7 @@ _RESET_SECTION .macro _wr_s16 value /* Ensure the provided arg value fits in 16 bits (signed) */ _check_arg_bitwidth_s \value, 16 - _wr16 \value + _wr16 \value & 0xFFFF .endm .macro _wr_u16 value @@ -734,7 +915,7 @@ $reladdr\@: * closed, so are its layers. */ .macro end - _wr_cmd_id end, 0xFF,0xFF,0xFF,,,,,, 0, 0 + _wr_cmd_id end, ASEQ_OP_END,ASEQ_OP_END,ASEQ_OP_END,,,,,, 0, 0 .endm /** @@ -743,7 +924,7 @@ $reladdr\@: * Delays for one tick. */ .macro delay1 - _wr_cmd_id delay1, 0xFE,0xFE,,,,,,, 0, 0 + _wr_cmd_id delay1, ASEQ_OP_DELAY1,ASEQ_OP_DELAY1,,,,,,, 0, 0 .endm /** @@ -752,7 +933,7 @@ $reladdr\@: * Delays for `delay` ticks. */ .macro delay delay - _wr_cmd_id delay, 0xFD,0xFD,,,,,,, 0, 0 + _wr_cmd_id delay, ASEQ_OP_DELAY,ASEQ_OP_DELAY,,,,,,, 0, 0 _var \delay .endm @@ -763,7 +944,7 @@ $reladdr\@: * subroutine encounters an `end` instruction. */ .macro call label - _wr_cmd_id call, 0xFC,0xFC,0xFC,,,,,, 0, 0 + _wr_cmd_id call, ASEQ_OP_CALL,ASEQ_OP_CALL,ASEQ_OP_CALL,,,,,, 0, 0 _wr_lbl \label .endm @@ -773,7 +954,7 @@ $reladdr\@: * Branches to `label` unconditionally. */ .macro jump label - _wr_cmd_id jump, 0xFB,0xFB,0xFB,,,,,, 0, 0 + _wr_cmd_id jump, ASEQ_OP_JUMP,ASEQ_OP_JUMP,ASEQ_OP_JUMP,,,,,, 0, 0 _wr_lbl \label .endm @@ -783,7 +964,7 @@ $reladdr\@: * Branches to `label` if TR == 0. */ .macro beqz label - _wr_cmd_id beqz, 0xFA,0xFA,0xFA,,,,,, 0, 0 + _wr_cmd_id beqz, ASEQ_OP_BEQZ,ASEQ_OP_BEQZ,ASEQ_OP_BEQZ,,,,,, 0, 0 _wr_lbl \label .endm @@ -793,7 +974,7 @@ $reladdr\@: * Branches to `label` if TR < 0. */ .macro bltz label - _wr_cmd_id beqz, 0xF9,0xF9,0xF9,,,,,, 0, 0 + _wr_cmd_id beqz, ASEQ_OP_BLTZ,ASEQ_OP_BLTZ,ASEQ_OP_BLTZ,,,,,, 0, 0 _wr_lbl \label .endm @@ -807,7 +988,7 @@ $reladdr\@: * becomes full. */ .macro loop num - _wr_cmd_id loop, 0xF8,0xF8,0xF8,,,,,, 0, 0 + _wr_cmd_id loop, ASEQ_OP_LOOP,ASEQ_OP_LOOP,ASEQ_OP_LOOP,,,,,, 0, 0 _wr_u8 \num .endm @@ -821,7 +1002,7 @@ $reladdr\@: * stack is popped. */ .macro loopend - _wr_cmd_id loopend, 0xF7,0xF7,0xF7,,,,,, 0, 0 + _wr_cmd_id loopend, ASEQ_OP_LOOPEND,ASEQ_OP_LOOPEND,ASEQ_OP_LOOPEND,,,,,, 0, 0 .endm /** @@ -834,7 +1015,7 @@ $reladdr\@: * the call stack would be popped twice. */ .macro break - _wr_cmd_id break, 0xF6,0xF6,0xF6,,,,,, 0, 0 + _wr_cmd_id break, ASEQ_OP_BREAK,ASEQ_OP_BREAK,ASEQ_OP_BREAK,,,,,, 0, 0 .endm /** @@ -843,7 +1024,7 @@ $reladdr\@: * Branches to `label` if TR >= 0. */ .macro bgez label - _wr_cmd_id bgez, 0xF5,0xF5,0xF5,,,,,, 0, 0 + _wr_cmd_id bgez, ASEQ_OP_BGEZ,ASEQ_OP_BGEZ,ASEQ_OP_BGEZ,,,,,, 0, 0 _wr_lbl \label .endm @@ -857,7 +1038,7 @@ $reladdr\@: * signed 8-bit (+/-128) range are reachable. */ .macro rjump label - _wr_cmd_id rjump, 0xF4,0xF4,0xF4,,,,,, 0, 0 + _wr_cmd_id rjump, ASEQ_OP_RJUMP,ASEQ_OP_RJUMP,ASEQ_OP_RJUMP,,,,,, 0, 0 _wr_8_rel \label .endm @@ -871,7 +1052,7 @@ $reladdr\@: * signed 8-bit (+/-128) range are reachable. */ .macro rbeqz label - _wr_cmd_id rbeqz, 0xF3,0xF3,0xF3,,,,,, 0, 0 + _wr_cmd_id rbeqz, ASEQ_OP_RBEQZ,ASEQ_OP_RBEQZ,ASEQ_OP_RBEQZ,,,,,, 0, 0 _wr_8_rel \label .endm @@ -885,7 +1066,7 @@ $reladdr\@: * signed 8-bit (+/-128) range are reachable. */ .macro rbltz label - _wr_cmd_id rbltz, 0xF2,0xF2,0xF2,,,,,, 0, 0 + _wr_cmd_id rbltz, ASEQ_OP_RBLTZ,ASEQ_OP_RBLTZ,ASEQ_OP_RBLTZ,,,,,, 0, 0 _wr_8_rel \label .endm @@ -895,7 +1076,7 @@ $reladdr\@: * Clears the channel note pool and reallocates it with space for `num` notes. */ .macro allocnotelist num - _wr_cmd_id allocnotelist, 0xF1,0xF1,,,,,,, 0, 0 + _wr_cmd_id allocnotelist, ASEQ_OP_SEQ_ALLOCNOTELIST,ASEQ_OP_CHAN_ALLOCNOTELIST,,,,,,, 0, 0 _wr_u8 \num .endm @@ -905,7 +1086,7 @@ $reladdr\@: * Clears the channel note pool. */ .macro freenotelist - _wr_cmd_id freenotelist, 0xF0,0xF0,,,,,,, 0, 0 + _wr_cmd_id freenotelist, ASEQ_OP_SEQ_FREENOTELIST,ASEQ_OP_CHAN_FREENOTELIST,,,,,,, 0, 0 .endm /** @@ -914,7 +1095,7 @@ $reladdr\@: * Has no function. */ .macro unk_EF arg1, arg2 - _wr_cmd_id unk_EF, 0xEF,,,,,,,, 0, 0 + _wr_cmd_id unk_EF, ASEQ_OP_SEQ_EF,,,,,,,, 0, 0 _wr_s16 \arg1 _w_u8 \arg2 .endm @@ -925,7 +1106,7 @@ $reladdr\@: * Fine-tunes the pitch bend amount for the channel or layer. */ .macro bendfine amt - _wr_cmd_id bendfine, ,0xEE,0xCE,,,,,, 0, 0 + _wr_cmd_id bendfine, ,ASEQ_OP_CHAN_BENDFINE,ASEQ_OP_LAYER_BENDFINE,,,,,, 0, 0 _wr_s8 \amt .endm @@ -935,7 +1116,7 @@ $reladdr\@: * Sets the channel gain (multiplicative volume scale factor) to the provided qu4.4 fixed-point value. */ .macro gain value - _wr_cmd_id gain, ,0xED,,,,,,, 0, 0 + _wr_cmd_id gain, ,ASEQ_OP_CHAN_GAIN,,,,,,, 0, 0 _wr_u8 \value .endm @@ -945,7 +1126,7 @@ $reladdr\@: * Resets channel vibrato, filter, gain, sustain, etc. state. */ .macro vibreset - _wr_cmd_id vibreset, ,0xEC,,,,,,, 0, 0 + _wr_cmd_id vibreset, ,ASEQ_OP_CHAN_VIBRESET,,,,,,, 0, 0 .endm /** @@ -954,7 +1135,7 @@ $reladdr\@: * Updates the soundfont and instrument for the channel simultaneously. */ .macro fontinstr fontId, instId - _wr_cmd_id fontinstr, ,0xEB,,,,,,, 0, 0 + _wr_cmd_id fontinstr, ,ASEQ_OP_CHAN_FONTINSTR,,,,,,, 0, 0 _wr_u8 \fontId _wr_u8 \instId .endm @@ -967,7 +1148,7 @@ $reladdr\@: .macro notepri priority1, priority2 _check_arg_bitwidth_u \priority1, 4 _check_arg_bitwidth_u \priority2, 4 - _wr_cmd_id notepri, ,0xE9,,,,,,, 0, 0 + _wr_cmd_id notepri, ,ASEQ_OP_CHAN_NOTEPRI,,,,,,, 0, 0 _wr_u8 (\priority1 << 4) | \priority2 .endm @@ -978,7 +1159,7 @@ $reladdr\@: * Sets various channel parameters. */ .macro params muteBhv, noteAllocPolicy, channelPriority, transposition, pan, panWeight, reverb, reverbIndex - _wr_cmd_id params, ,0xE8,,,,,,, 0, 0 + _wr_cmd_id params, ,ASEQ_OP_CHAN_PARAMS,,,,,,, 0, 0 _wr_u8 \muteBhv _wr_u8 \noteAllocPolicy _wr_u8 \channelPriority @@ -996,7 +1177,7 @@ $reladdr\@: * is ordered in the same way as the arguments in `params`. */ .macro ldparams label - _wr_cmd_id ldparams, ,0xE7,,,,,,, 0, 0 + _wr_cmd_id ldparams, ,ASEQ_OP_CHAN_LDPARAMS,,,,,,, 0, 0 _wr_lbl \label .endm @@ -1006,7 +1187,7 @@ $reladdr\@: * Sets the sample book mode. */ .macro samplebook value - _wr_cmd_id samplebook, ,0xE6,,,,,,, 0, 0 + _wr_cmd_id samplebook, ,ASEQ_OP_CHAN_SAMPLEBOOK,,,,,,, 0, 0 _wr_u8 \value .endm @@ -1016,7 +1197,7 @@ $reladdr\@: * Sets the channel reverb. */ .macro reverbidx arg - _wr_cmd_id reverbidx, ,0xE5,,,,,,, 0, 0 + _wr_cmd_id reverbidx, ,ASEQ_OP_CHAN_REVERBIDX,,,,,,, 0, 0 _wr_u8 \arg .endm @@ -1026,7 +1207,7 @@ $reladdr\@: * Sets the channel vibrato delay. */ .macro vibdelay arg - _wr_cmd_id vibdelay, ,0xE3,,,,,,, 0, 0 + _wr_cmd_id vibdelay, ,ASEQ_OP_CHAN_VIBDELAY,,,,,,, 0, 0 _wr_u8 \arg .endm @@ -1036,7 +1217,7 @@ $reladdr\@: * Sets the vibrato extent. */ .macro vibdepthgrad arg0, arg1, arg2 - _wr_cmd_id vibdepthgrad, ,0xE2,,,,,,, 0, 0 + _wr_cmd_id vibdepthgrad, ,ASEQ_OP_CHAN_VIBDEPTHGRAD,,,,,,, 0, 0 _wr_u8 \arg0 _wr_u8 \arg1 _wr_u8 \arg2 @@ -1048,7 +1229,7 @@ $reladdr\@: * Sets the vibrato rate. */ .macro vibfreqgrad arg0, arg1, arg2 - _wr_cmd_id vibfreqgrad, ,0xE1,,,,,,, 0, 0 + _wr_cmd_id vibfreqgrad, ,ASEQ_OP_CHAN_VIBFREQGRAD,,,,,,, 0, 0 _wr_u8 \arg0 _wr_u8 \arg1 _wr_u8 \arg2 @@ -1060,7 +1241,7 @@ $reladdr\@: * Changes the expression amount for the channel. */ .macro volexp amt - _wr_cmd_id volexp, ,0xE0,,,,,,, 0, 0 + _wr_cmd_id volexp, ,ASEQ_OP_CHAN_VOLEXP,,,,,,, 0, 0 _wr_u8 \amt .endm @@ -1071,7 +1252,7 @@ $reladdr\@: * provided number of semitones. */ .macro transpose semitones - _wr_cmd_id transpose, 0xDF,0xDB,0xC2,,,,,, 0, 0 + _wr_cmd_id transpose, ASEQ_OP_SEQ_TRANSPOSE,ASEQ_OP_CHAN_TRANSPOSE,ASEQ_OP_LAYER_TRANSPOSE,,,,,, 0, 0 _wr_s8 \semitones .endm @@ -1081,7 +1262,7 @@ $reladdr\@: * Adjusts the transposition amount. This is only available at the top sequence level. */ .macro rtranspose semitones - _wr_cmd_id rtranspose, 0xDE,,,,,,,, 0, 0 + _wr_cmd_id rtranspose, ASEQ_OP_SEQ_RTRANSPOSE,,,,,,,, 0, 0 _wr_s8 \semitones .endm @@ -1091,7 +1272,7 @@ $reladdr\@: * Sets the freqScale for the current channel. */ .macro freqscale arg - _wr_cmd_id freqscale, ,0xDE,,,,,,, 0, 0 + _wr_cmd_id freqscale, ,ASEQ_OP_CHAN_FREQSCALE,,,,,,, 0, 0 _wr_s16 \arg .endm @@ -1101,7 +1282,7 @@ $reladdr\@: * Changes the tempo of the sequence. */ .macro tempo bpm - _wr_cmd_id tempo, 0xDD,,,,,,,, 0, 0 + _wr_cmd_id tempo, ASEQ_OP_SEQ_TEMPO,,,,,,,, 0, 0 _wr_u8 \bpm .endm @@ -1111,7 +1292,7 @@ $reladdr\@: * Sets the tempoChange for the sequence. */ .macro tempochg arg - _wr_cmd_id tempochg, 0xDC,,,,,,,, 0, 0 + _wr_cmd_id tempochg, ASEQ_OP_SEQ_TEMPOCHG,,,,,,,, 0, 0 _wr_s8 \arg .endm @@ -1123,7 +1304,7 @@ $reladdr\@: .macro pan pan /* pan can only take values in 0..127 */ _check_arg_bitwidth_u \pan, 7 - _wr_cmd_id pan, ,0xDD,,,,,,, 0, 0 + _wr_cmd_id pan, ,ASEQ_OP_CHAN_PAN,,,,,,, 0, 0 _wr_u8 \pan .endm @@ -1139,7 +1320,7 @@ $reladdr\@: .macro panweight weight /* weight can only take values in 0..127 */ _check_arg_bitwidth_u \weight, 7 - _wr_cmd_id panweight, ,0xDC,,,,,,, 0, 0 + _wr_cmd_id panweight, ,ASEQ_OP_CHAN_PANWEIGHT,,,,,,, 0, 0 _wr_u8 \weight .endm @@ -1149,7 +1330,7 @@ $reladdr\@: * Sets the volume amount for this sequence or channel. */ .macro vol amt - _wr_cmd_id vol, 0xDB,0xDF,,,,,,, 0, 0 + _wr_cmd_id vol, ASEQ_OP_SEQ_VOL,ASEQ_OP_CHAN_VOL,,,,,,, 0, 0 _wr_u8 \amt .endm @@ -1159,7 +1340,7 @@ $reladdr\@: * TODO DESCRIPTION */ .macro volmode mode, fadeTimer - _wr_cmd_id volmode, 0xDA,,,,,,,, 0, 0 + _wr_cmd_id volmode, ASEQ_OP_SEQ_VOLMODE,,,,,,,, 0, 0 _wr_u8 \mode _wr_u16 \fadeTimer .endm @@ -1170,7 +1351,7 @@ $reladdr\@: * Sets the fadeVolumeScale for the sequence. */ .macro volscale arg - _wr_cmd_id volscale, 0xD9,,,,,,,, 0, 0 + _wr_cmd_id volscale, ASEQ_OP_SEQ_VOLSCALE,,,,,,,, 0, 0 _wr_u8 \arg .endm @@ -1180,7 +1361,7 @@ $reladdr\@: * Sets the envelope release rate for this channel or layer. */ .macro releaserate release - _wr_cmd_id releaserate, ,0xD9,0xCF,,,,,, 0, 0 + _wr_cmd_id releaserate, ,ASEQ_OP_CHAN_RELEASERATE,ASEQ_OP_LAYER_RELEASERATE,,,,,, 0, 0 _wr_u8 \release .endm @@ -1190,7 +1371,7 @@ $reladdr\@: * Sets the vibrato depth for the channel. */ .macro vibdepth arg - _wr_cmd_id vibdepth, ,0xD8,,,,,,, 0, 0 + _wr_cmd_id vibdepth, ,ASEQ_OP_CHAN_VIBDEPTH,,,,,,, 0, 0 _wr_u8 \arg .endm @@ -1200,7 +1381,7 @@ $reladdr\@: * Sets the vibrato rate for the channel. */ .macro vibfreq arg - _wr_cmd_id vibfreq, ,0xD7,,,,,,, 0, 0 + _wr_cmd_id vibfreq, ,ASEQ_OP_CHAN_VIBFREQ,,,,,,, 0, 0 _wr_u8 \arg .endm @@ -1213,7 +1394,7 @@ $reladdr\@: * initchan 0b101 initializes channels 0 and 2. */ .macro initchan bitmask - _wr_cmd_id initchan, 0xD7,,,,,,,, 0, 0 + _wr_cmd_id initchan, ASEQ_OP_SEQ_INITCHAN,,,,,,,, 0, 0 _wr_u16 \bitmask .endm @@ -1223,7 +1404,7 @@ $reladdr\@: * Frees the channels marked in the provided bitmask. */ .macro freechan bitmask - _wr_cmd_id freechan, 0xD6,,,,,,,, 0, 0 + _wr_cmd_id freechan, ASEQ_OP_SEQ_FREECHAN,,,,,,,, 0, 0 _wr_u16 \bitmask .endm @@ -1233,7 +1414,7 @@ $reladdr\@: * Sets the muteVolumeScale for the sequence. */ .macro mutescale arg - _wr_cmd_id mutescale, 0xD5,,,,,,,, 0, 0 + _wr_cmd_id mutescale, ASEQ_OP_SEQ_MUTESCALE,,,,,,,, 0, 0 _wr_s8 \arg .endm @@ -1243,7 +1424,7 @@ $reladdr\@: * Mutes the sequence player. */ .macro mute - _wr_cmd_id mute, 0xD4,,,,,,,, 0, 0 + _wr_cmd_id mute, ASEQ_OP_SEQ_MUTE,,,,,,,, 0, 0 .endm /** @@ -1252,7 +1433,7 @@ $reladdr\@: * Sets the reverb amount for this channel. */ .macro reverb amt - _wr_cmd_id reverb, ,0xD4,,,,,,, 0, 0 + _wr_cmd_id reverb, ,ASEQ_OP_CHAN_REVERB,,,,,,, 0, 0 _wr_u8 \amt .endm @@ -1262,7 +1443,7 @@ $reladdr\@: * Sets mute behavior for this sequence or channel. */ .macro mutebhv flags - _wr_cmd_id mutebhv, 0xD3,0xCA,,,,,,, 0, 0 + _wr_cmd_id mutebhv, ASEQ_OP_SEQ_MUTEBHV,ASEQ_OP_CHAN_MUTEBHV,,,,,,, 0, 0 _wr_u8 \flags .endm @@ -1272,7 +1453,7 @@ $reladdr\@: * Sets the pitch bend amount for this channel. */ .macro bend amt - _wr_cmd_id bend, ,0xD3,,,,,,, 0, 0 + _wr_cmd_id bend, ,ASEQ_OP_CHAN_BEND,,,,,,, 0, 0 _wr_s8 \amt .endm @@ -1282,7 +1463,7 @@ $reladdr\@: * Sets the location of SHORTVELTBL. */ .macro ldshortvelarr label - _wr_cmd_id ldshortvelarr, 0xD2,,,,,,,, 0, 0 + _wr_cmd_id ldshortvelarr, ASEQ_OP_SEQ_LDSHORTVELARR,,,,,,,, 0, 0 _wr_lbl \label .endm @@ -1292,7 +1473,7 @@ $reladdr\@: * Sets the adsr sustain value for this channel. */ .macro sustain value - _wr_cmd_id sustain, ,0xD2,,,,,,, 0, 0 + _wr_cmd_id sustain, ,ASEQ_OP_CHAN_SUSTAIN,,,,,,, 0, 0 _wr_u8 \value .endm @@ -1302,7 +1483,7 @@ $reladdr\@: * Sets the location of SHORTGATETBL. */ .macro ldshortgatearr label - _wr_cmd_id ldshortgatearr, 0xD1,,,,,,,, 0, 0 + _wr_cmd_id ldshortgatearr, ASEQ_OP_SEQ_LDSHORTGATEARR,,,,,,,, 0, 0 _wr_lbl \label .endm @@ -1312,7 +1493,7 @@ $reladdr\@: * Sets the noteAllocPolicy for either the sequence or the current channel. */ .macro notealloc arg - _wr_cmd_id notealloc, 0xD0,0xD1,,,,,,, 0, 0 + _wr_cmd_id notealloc, ASEQ_OP_SEQ_NOTEALLOC,ASEQ_OP_CHAN_NOTEALLOC,,,,,,, 0, 0 _wr_u8 \arg .endm @@ -1329,7 +1510,7 @@ $reladdr\@: _check_arg_bitwidth_u \strongRvrbR, 1 _check_arg_bitwidth_u \strongRvrbL, 1 - _wr_cmd_id effects, ,0xD0,,,,,,, 0, 0 + _wr_cmd_id effects, ,ASEQ_OP_CHAN_EFFECTS,,,,,,, 0, 0 _wr_u8 (\headset << 7) | (\type << 4) | (\strongR << 3) | (\strongL << 2) | (\strongRvrbR << 1) | (\strongRvrbL << 0) .endm @@ -1339,7 +1520,7 @@ $reladdr\@: * Stores TP -> label */ .macro stptrtoseq label - _wr_cmd_id stptrtoseq, ,0xCF,,,,,,, 0, 0 + _wr_cmd_id stptrtoseq, ,ASEQ_OP_CHAN_STPTRTOSEQ,,,,,,, 0, 0 _wr_lbl \label .endm @@ -1349,7 +1530,7 @@ $reladdr\@: * Loads label -> TP */ .macro ldptr label - _wr_cmd_id ldptr, ,0xCE,,,,,,, 0, 0 + _wr_cmd_id ldptr, ,ASEQ_OP_CHAN_LDPTR,,,,,,, 0, 0 _wr_lbl \label .endm @@ -1359,7 +1540,7 @@ $reladdr\@: * Loads imm -> TP */ .macro ldptri imm - _wr_cmd_id ldptr, ,0xCE,,,,,,, 0, 0 + _wr_cmd_id ldptr, ,ASEQ_OP_CHAN_LDPTR,,,,,,, 0, 0 _wr_u16 \imm .endm @@ -1369,7 +1550,7 @@ $reladdr\@: * Stores a random number in the range [0, max) into TR. If max is 0 the range is [0, 255] */ .macro rand max - _wr_cmd_id rand, 0xCE,0xB8,,,,,,, 0, 0 + _wr_cmd_id rand, ASEQ_OP_SEQ_RAND,ASEQ_OP_CHAN_RAND,,,,,,, 0, 0 _wr_u8 \max .endm @@ -1384,9 +1565,9 @@ $reladdr\@: */ .macro dyncall table=-1 .if \table == -1 - _wr_cmd_id dyncall, ,0xE4,,,,,,, 0, 0 + _wr_cmd_id dyncall, ,ASEQ_OP_CHAN_DYNCALL,,,,,,, 0, 0 .else - _wr_cmd_id dyncall, 0xCD,,,,,,,, 0, 0 + _wr_cmd_id dyncall, ASEQ_OP_SEQ_DYNCALL,,,,,,,, 0, 0 _wr_lbl \table .endif .endm @@ -1397,7 +1578,7 @@ $reladdr\@: * Loads the immediate value `imm` into TR. */ .macro ldi imm - _wr_cmd_id ldi, 0xCC,0xCC,,,,,,, 0, 0 + _wr_cmd_id ldi, ASEQ_OP_SEQ_LDI,ASEQ_OP_CHAN_LDI,,,,,,, 0, 0 _wr_u8 \imm .endm @@ -1407,7 +1588,7 @@ $reladdr\@: * Computes TR = TR & imm */ .macro and imm - _wr_cmd_id and, 0xC9,0xC9,,,,,,, 0, 0 + _wr_cmd_id and, ASEQ_OP_SEQ_AND,ASEQ_OP_CHAN_AND,,,,,,, 0, 0 _wr_u8 \imm .endm @@ -1417,7 +1598,7 @@ $reladdr\@: * Computes TR = TR - imm */ .macro sub imm - _wr_cmd_id sub, 0xC8,0xC8,,,,,,, 0, 0 + _wr_cmd_id sub, ASEQ_OP_SEQ_SUB,ASEQ_OP_CHAN_SUB,,,,,,, 0, 0 _wr_u8 \imm .endm @@ -1427,7 +1608,7 @@ $reladdr\@: * Stores the u8 value `TR + imm` to the location specified by `label`. */ .macro stseq imm, label - _wr_cmd_id stseq, 0xC7,0xC7,,,,,,, 0, 0 + _wr_cmd_id stseq, ASEQ_OP_SEQ_STSEQ,ASEQ_OP_CHAN_STSEQ,,,,,,, 0, 0 _wr_u8 \imm _wr_lbl \label .endm @@ -1438,7 +1619,7 @@ $reladdr\@: * Immediately stops the sequence or channel. */ .macro stop - _wr_cmd_id stop, 0xC6,0xEA,,,,,,, 0, 0 + _wr_cmd_id stop, ASEQ_OP_SEQ_STOP,ASEQ_OP_CHAN_STOP,,,,,,, 0, 0 .endm /** @@ -1447,7 +1628,7 @@ $reladdr\@: * Set the current soundfont for this channel to `fontId`. */ .macro font fontId - _wr_cmd_id font, ,0xC6,,,,,,, 0, 0 + _wr_cmd_id font, ,ASEQ_OP_CHAN_FONT,,,,,,, 0, 0 _wr_u8 \fontId .endm @@ -1460,7 +1641,7 @@ $reladdr\@: * never used, so changing it with this instruction has no useful effects. */ .macro scriptctr arg - _wr_cmd_id scriptctr, 0xC5,,,,,,,, 0, 0 + _wr_cmd_id scriptctr, ASEQ_OP_SEQ_SCRIPTCTR,,,,,,,, 0, 0 _wr_u16 \arg .endm @@ -1471,7 +1652,7 @@ $reladdr\@: * unless TR is -1, in which case nothing happens. */ .macro dyntbllookup - _wr_cmd_id dyntbllookup, ,0xC5,,,,,,, 0, 0 + _wr_cmd_id dyntbllookup, ,ASEQ_OP_CHAN_DYNTBLLOOKUP,,,,,,, 0, 0 .endm /** @@ -1480,7 +1661,7 @@ $reladdr\@: * Plays the sequence seqId on seqPlayer. */ .macro runseq seqPlayer, seqId - _wr_cmd_id runseq, 0xC4,,,,,,,, 0, 0 + _wr_cmd_id runseq, ASEQ_OP_SEQ_RUNSEQ,,,,,,,, 0, 0 _wr_u8 \seqPlayer _wr_u8 \seqId .endm @@ -1493,7 +1674,7 @@ $reladdr\@: * TODO DESCRIPTION */ .macro mutechan arg0 - _wr_cmd_id mutechan, 0xC3,,,,,,,, 0, 0 + _wr_cmd_id mutechan, ASEQ_OP_SEQ_C3,,,,,,,, 0, 0 _wr_s16 \arg0 .endm @@ -1505,7 +1686,7 @@ $reladdr\@: * Disable short notes encoding. */ .macro noshort - _wr_cmd_id noshort, ,0xC4,,,,,,, 0, 0 + _wr_cmd_id noshort, ,ASEQ_OP_CHAN_NOSHORT,,,,,,, 0, 0 .endm /** @@ -1514,7 +1695,7 @@ $reladdr\@: * Enable short notes encoding. */ .macro short - _wr_cmd_id short, ,0xC3,,,,,,, 0, 0 + _wr_cmd_id short, ,ASEQ_OP_CHAN_SHORT,,,,,,, 0, 0 .endm /** @@ -1523,7 +1704,7 @@ $reladdr\@: * Loads label -> DYNTBL */ .macro dyntbl label - _wr_cmd_id dyntbl, ,0xC2,,,,,,, 0, 0 + _wr_cmd_id dyntbl, ,ASEQ_OP_CHAN_DYNTBL,,,,,,, 0, 0 _wr_lbl \label .endm @@ -1533,7 +1714,7 @@ $reladdr\@: * Set instrument `instNum` from the current soundfont as the active instrument for this channel or layer. */ .macro instr instNum - _wr_cmd_id instr, ,0xC1,0xC6,,,,,, 0, 0 + _wr_cmd_id instr, ,ASEQ_OP_CHAN_INSTR,ASEQ_OP_LAYER_INSTR,,,,,, 0, 0 _wr_u8 \instNum .endm @@ -1545,7 +1726,7 @@ $reladdr\@: * TODO DESCRIPTION */ .macro unk_BE arg0 - _wr_cmd_id unk_BE, ,0xBE,,,,,,, 0, 0 + _wr_cmd_id unk_BE, ,ASEQ_OP_CHAN_UNK_BE,,,,,,, 0, 0 _wr_u8 \arg0 .endm @@ -1559,13 +1740,9 @@ $reladdr\@: * If range is 0, it is treated as 65536. */ .macro randptr range, offset - #if (MML_VERSION == MML_VERSION_OOT) - _wr_cmd_id randptr, ,0xBD,,,,,,, 0, 0 - #else - _wr_cmd_id randptr, ,0xA8,,,,,,, 0, 0 - #endif - _wr_u16 \range - _wr_u16 \offset + _wr_cmd_id randptr, ,ASEQ_OP_CHAN_RANDPTR,,,,,,, 0, 0 + _wr_u16 \range + _wr_u16 \offset .endm #if (MML_VERSION == MML_VERSION_MM) @@ -1576,7 +1753,7 @@ $reladdr\@: * TODO DESCRIPTION */ .macro samplestart arg - _wr_cmd_id samplestart, ,0xBD,,,,,,, 0, 0 + _wr_cmd_id samplestart, ,ASEQ_OP_CHAN_SAMPLESTART,,,,,,, 0, 0 _wr_u8 \arg .endm @@ -1586,7 +1763,7 @@ $reladdr\@: * TODO DESCRIPTION */ .macro unk_A7 arg - _wr_cmd_id unk_A7, ,0xA7,,,,,,, 0, 0 + _wr_cmd_id unk_A7, ,ASEQ_OP_CHAN_A7,,,,,,, 0, 0 _wr_u8 \arg .endm @@ -1596,7 +1773,7 @@ $reladdr\@: * TODO DESCRIPTION */ .macro unk_A6 arg0, arg1 - _wr_cmd_id unk_A6, ,0xA6,,,,,,, 0, 0 + _wr_cmd_id unk_A6, ,ASEQ_OP_CHAN_A6,,,,,,, 0, 0 _wr_u8 \arg0 _wr_s16 \arg1 .endm @@ -1607,7 +1784,7 @@ $reladdr\@: * TODO DESCRIPTION */ .macro unk_A5 - _wr_cmd_id unk_A5, ,0xA5,,,,,,, 0, 0 + _wr_cmd_id unk_A5, ,ASEQ_OP_CHAN_A5,,,,,,, 0, 0 .endm /** @@ -1616,7 +1793,7 @@ $reladdr\@: * TODO DESCRIPTION */ .macro unk_A4 arg - _wr_cmd_id unk_A4, ,0xA4,,,,,,, 0, 0 + _wr_cmd_id unk_A4, ,ASEQ_OP_CHAN_A4,,,,,,, 0, 0 _wr_u8 \arg .endm @@ -1626,7 +1803,7 @@ $reladdr\@: * TODO DESCRIPTION */ .macro unk_A3 - _wr_cmd_id unk_A3, ,0xA3,,,,,,, 0, 0 + _wr_cmd_id unk_A3, ,ASEQ_OP_CHAN_A3,,,,,,, 0, 0 .endm /** @@ -1635,7 +1812,7 @@ $reladdr\@: * TODO DESCRIPTION */ .macro unk_A2 arg - _wr_cmd_id unk_A2, ,0xA2,,,,,,, 0, 0 + _wr_cmd_id unk_A2, ,ASEQ_OP_CHAN_A2,,,,,,, 0, 0 _wr_s16 \arg .endm @@ -1645,7 +1822,7 @@ $reladdr\@: * TODO DESCRIPTION */ .macro unk_A1 - _wr_cmd_id unk_A1, ,0xA1,,,,,,, 0, 0 + _wr_cmd_id unk_A1, ,ASEQ_OP_CHAN_A1,,,,,,, 0, 0 .endm /** @@ -1654,7 +1831,7 @@ $reladdr\@: * TODO DESCRIPTION */ .macro unk_A0 arg - _wr_cmd_id unk_A0, ,0xA0,,,,,,, 0, 0 + _wr_cmd_id unk_A0, ,ASEQ_OP_CHAN_A0,,,,,,, 0, 0 _wr_s16 \arg .endm @@ -1666,20 +1843,20 @@ $reladdr\@: * Computes TP += value */ .macro ptradd value - _wr_cmd_id ptradd, ,0xBC,,,,,,, 0, 0 + _wr_cmd_id ptradd, ,ASEQ_OP_CHAN_PTRADD,,,,,,, 0, 0 _wr_lbl \value .endm /** - * ptraddi + * ptraddi * * Like ptradd but for immediates instead of labels * * Computes TP += value */ .macro ptraddi value - _wr_cmd_id ptradd, ,0xBC,,,,,,, 0, 0 - _wr_u16 \value + _wr_cmd_id ptradd, ,ASEQ_OP_CHAN_PTRADD,,,,,,, 0, 0 + _wr_s16 \value .endm /** @@ -1689,7 +1866,7 @@ $reladdr\@: * TODO args? arg0=16,arg1=val<<8 maps well to midi chorus */ .macro combfilter arg0, arg1 - _wr_cmd_id combfilter, ,0xBB,,,,,,, 0, 0 + _wr_cmd_id combfilter, ,ASEQ_OP_CHAN_COMBFILTER,,,,,,, 0, 0 _wr_u8 \arg0 _wr_u16 \arg1 .endm @@ -1702,7 +1879,7 @@ $reladdr\@: * NOTE: This feature is bugged. If this is non-zero it will actually use the range set by randvel. */ .macro randgate range - _wr_cmd_id randgate, ,0xBA,,,,,,, 0, 0 + _wr_cmd_id randgate, ,ASEQ_OP_CHAN_RANDGATE,,,,,,, 0, 0 _wr_u8 \range .endm @@ -1712,7 +1889,7 @@ $reladdr\@: * Sets the range for random note velocity fluctuations. */ .macro randvel range - _wr_cmd_id randvel, ,0xB9,,,,,,, 0, 0 + _wr_cmd_id randvel, ,ASEQ_OP_CHAN_RANDVEL,,,,,,, 0, 0 _wr_u8 \range .endm @@ -1722,7 +1899,7 @@ $reladdr\@: * Stores a random number in the range [0, max) into TP. If max is 0 the range is [0, 65535] */ .macro randtoptr max - _wr_cmd_id randtoptr, ,0xB7,,,,,,, 0, 0 + _wr_cmd_id randtoptr, ,ASEQ_OP_CHAN_RANDTOPTR,,,,,,, 0, 0 _wr_u16 \max .endm @@ -1732,7 +1909,7 @@ $reladdr\@: * Loads DYNTBL8[TR] -> TR */ .macro dyntblv - _wr_cmd_id dyntblv, ,0xB6,,,,,,, 0, 0 + _wr_cmd_id dyntblv, ,ASEQ_OP_CHAN_DYNTBLV,,,,,,, 0, 0 .endm /** @@ -1741,7 +1918,7 @@ $reladdr\@: * Loads DYNTBL16[TR] -> TP */ .macro dyntbltoptr - _wr_cmd_id dyntbltoptr, ,0xB5,,,,,,, 0, 0 + _wr_cmd_id dyntbltoptr, ,ASEQ_OP_CHAN_DYNTBLTOPTR,,,,,,, 0, 0 .endm /** @@ -1750,7 +1927,7 @@ $reladdr\@: * Transfers TP -> DYNTBL */ .macro ptrtodyntbl - _wr_cmd_id ptrtodyntbl, ,0xB4,,,,,,, 0, 0 + _wr_cmd_id ptrtodyntbl, ,ASEQ_OP_CHAN_PTRTODYNTBL,,,,,,, 0, 0 .endm /** @@ -1761,7 +1938,7 @@ $reladdr\@: * Note that TR acts as an index into an array of u16 starting at label. */ .macro ldseqtoptr label - _wr_cmd_id ldseqtoptr, ,0xB2,,,,,,, 0, 0 + _wr_cmd_id ldseqtoptr, ,ASEQ_OP_CHAN_LDSEQTOPTR,,,,,,, 0, 0 _wr_lbl \label .endm @@ -1771,7 +1948,7 @@ $reladdr\@: * Invalidates the current active filter buffer. */ .macro freefilter - _wr_cmd_id freefilter, ,0xB1,,,,,,, 0, 0 + _wr_cmd_id freefilter, ,ASEQ_OP_CHAN_FREEFILTER,,,,,,, 0, 0 .endm /** @@ -1780,7 +1957,7 @@ $reladdr\@: * Sets the active filter buffer to the location specified by `filter`. */ .macro ldfilter filter - _wr_cmd_id ldfilter, ,0xB0,,,,,,, 0, 0 + _wr_cmd_id ldfilter, ,ASEQ_OP_CHAN_LDFILTER,,,,,,, 0, 0 _wr_lbl \filter .endm @@ -1791,7 +1968,7 @@ $reladdr\@: * Delays by `delay` ticks. */ .macro cdelay delay - _wr_cmd_id cdelay, ,0x00,,,,,,, \delay, 4 + _wr_cmd_id cdelay, ,ASEQ_OP_CHAN_CDELAY,,,,,,, \delay, 4 .endm /** @@ -1805,9 +1982,9 @@ $reladdr\@: */ .macro ldsample type, portNum .if \type == LDSAMPLE_INST - _wr_cmd_id ldsample, ,0x10,,,,,,, \portNum, 3 + _wr_cmd_id ldsample, ,ASEQ_OP_CHAN_LDSAMPLE,,,,,,, \portNum, 3 .elif \type == LDSAMPLE_SFX - _wr_cmd_id ldsample, ,0x18,,,,,,, \portNum, 3 + _wr_cmd_id ldsample, ,ASEQ_OP_CHAN_LDSAMPLE | 8,,,,,,, \portNum, 3 .else .error "ldsample: invalid type" .endif @@ -1821,7 +1998,7 @@ $reladdr\@: * Stores the contents of TR into CIO[channelNum][portNum] */ .macro stcio channelNum, portNum - _wr_cmd_id stcio, ,0x30,,,,,,, \channelNum, 4 + _wr_cmd_id stcio, ,ASEQ_OP_CHAN_STCIO,,,,,,, \channelNum, 4 _wr_u8 \portNum .endm @@ -1831,7 +2008,7 @@ $reladdr\@: * Loads the contents of CIO[channelNum][portNum] into TR. */ .macro ldcio channelNum, portNum - _wr_cmd_id ldcio, ,0x40,,,,,,, \channelNum, 4 + _wr_cmd_id ldcio, ,ASEQ_OP_CHAN_LDCIO,,,,,,, \channelNum, 4 _wr_u8 \portNum .endm @@ -1843,7 +2020,7 @@ $reladdr\@: * for use in position-independent code. */ .macro rldlayer layerNum, label - _wr_cmd_id rldlayer, ,0x78,,,,,,, \layerNum, 3 + _wr_cmd_id rldlayer, ,ASEQ_OP_CHAN_RLDLAYER,,,,,,, \layerNum, 3 _wr_16_rel \label .endm @@ -1857,7 +2034,7 @@ $reladdr\@: * - -1 if layer does not exist. */ .macro testlayer layerNum - _wr_cmd_id testlayer, ,0x80,,,,,,, \layerNum, 3 + _wr_cmd_id testlayer, ,ASEQ_OP_CHAN_TESTLAYER,,,,,,, \layerNum, 3 .endm /** @@ -1866,7 +2043,7 @@ $reladdr\@: * Opens the note layer at `label` for index `layerNum`. */ .macro ldlayer layerNum, label - _wr_cmd_id ldlayer, ,0x88,,,,,,, \layerNum, 3 + _wr_cmd_id ldlayer, ,ASEQ_OP_CHAN_LDLAYER,,,,,,, \layerNum, 3 _wr_lbl \label .endm @@ -1876,7 +2053,7 @@ $reladdr\@: * Deletes the layer specified by index `layerNum`. */ .macro dellayer arg - _wr_cmd_id dellayer, ,0x90,,,,,,, \arg, 3 + _wr_cmd_id dellayer, ,ASEQ_OP_CHAN_DELLAYER,,,,,,, \arg, 3 .endm /** @@ -1885,7 +2062,7 @@ $reladdr\@: * Allocates a new layer starting at the pointer read from DYNTBL16[TR] */ .macro dynldlayer arg - _wr_cmd_id dynldlayer, ,0x98,,,,,,, \arg, 3 + _wr_cmd_id dynldlayer, ,ASEQ_OP_CHAN_DYNLDLAYER,,,,,,, \arg, 3 .endm /** @@ -1897,7 +2074,7 @@ $reladdr\@: * - 1 if disabled */ .macro testchan channelNum - _wr_cmd_id testchan, 0x00,,,,,,,, \channelNum, 4 + _wr_cmd_id testchan, ASEQ_OP_SEQ_TESTCHAN,,,,,,,, \channelNum, 4 .endm /** @@ -1907,9 +2084,9 @@ $reladdr\@: */ .macro stopchan channelNum .if ASEQ_MODE == ASEQ_MODE_SEQUENCE - _wr_cmd_id stopchan, 0x40,,,,,,,, \channelNum, 4 + _wr_cmd_id stopchan, ASEQ_OP_SEQ_STOPCHAN,,,,,,,, \channelNum, 4 .else - _wr_cmd_id stopchan, ,0xCD,,,,,,, 0, 0 + _wr_cmd_id stopchan, ,ASEQ_OP_CHAN_STOPCHAN,,,,,,, 0, 0 _wr_u8 \channelNum .endif .endm @@ -1924,7 +2101,7 @@ $reladdr\@: * Computes TR = TR - CIO[CUR_CHANNEL][portNum] */ .macro subio portNum - _wr_cmd_id subio, 0x50,0x50,,,,,,, \portNum, 4 + _wr_cmd_id subio, ASEQ_OP_SEQ_SUBIO,ASEQ_OP_CHAN_SUBIO,,,,,,, \portNum, 4 .endm /** @@ -1941,7 +2118,7 @@ $reladdr\@: * Load status is made available in SIO[portNum]. */ .macro ldres portNum, resType, resId - _wr_cmd_id ldres, 0x60,,,,,,,, \portNum, 4 + _wr_cmd_id ldres, ASEQ_OP_SEQ_LDRES,,,,,,,, \portNum, 4 _wr_u8 \resType _wr_u8 \resId .endm @@ -1955,9 +2132,9 @@ $reladdr\@: */ .macro stio portNum .if ASEQ_MODE == ASEQ_MODE_CHANNEL - _wr_cmd_id stio, ,0x70,,,,,,, \portNum, 3 + _wr_cmd_id stio, ,ASEQ_OP_CHAN_STIO,,,,,,, \portNum, 3 .else - _wr_cmd_id stio, 0x70,,,,,,,, \portNum, 4 + _wr_cmd_id stio, ASEQ_OP_SEQ_STIO,,,,,,,, \portNum, 4 .endif .endm @@ -1968,7 +2145,7 @@ $reladdr\@: * depending on current section. */ .macro ldio portNum - _wr_cmd_id ldio, 0x80,0x60,,,,,,, \portNum, 4 + _wr_cmd_id ldio, ASEQ_OP_SEQ_LDIO,ASEQ_OP_CHAN_LDIO,,,,,,, \portNum, 4 .endm /** @@ -1977,7 +2154,7 @@ $reladdr\@: * Opens the sequence channel for index `channelNum` with data beginning at `label`. */ .macro ldchan channelNum, label - _wr_cmd_id ldchan, 0x90,0x20,,,,,,, \channelNum, 4 + _wr_cmd_id ldchan, ASEQ_OP_SEQ_LDCHAN,ASEQ_OP_CHAN_LDCHAN,,,,,,, \channelNum, 4 _wr_lbl \label .endm @@ -1989,7 +2166,7 @@ $reladdr\@: * for use in position-independent code. */ .macro rldchan channelNum, label - _wr_cmd_id rldchan, 0xA0,,,,,,,, \channelNum, 4 + _wr_cmd_id rldchan, ASEQ_OP_SEQ_RLDCHAN,,,,,,,, \channelNum, 4 _wr_16_rel \label .endm @@ -1999,7 +2176,7 @@ $reladdr\@: * Delay for `delay` ticks. */ .macro ldelay delay - _wr_cmd_id ldelay, ,,0xC0,,,,,, 0, 0 + _wr_cmd_id ldelay, ,,ASEQ_OP_LAYER_LDELAY,,,,,, 0, 0 _var \delay .endm @@ -2010,7 +2187,7 @@ $reladdr\@: * Should never be used when not required for matching purposes. */ .macro lldelay delay - _wr_cmd_id lldelay, ,0xFD,0xC0,,,,,, 0, 0 + _wr_cmd_id lldelay, ,ASEQ_OP_DELAY,ASEQ_OP_LAYER_LDELAY,,,,,, 0, 0 _var_long \delay .endm @@ -2020,7 +2197,7 @@ $reladdr\@: * Set velocity used by short notes. */ .macro shortvel velocity - _wr_cmd_id shortvel, ,,0xC1,,,,,, 0, 0 + _wr_cmd_id shortvel, ,,ASEQ_OP_LAYER_SHORTVEL,,,,,, 0, 0 _wr_u8 \velocity .endm @@ -2030,7 +2207,7 @@ $reladdr\@: * Set delay used by short notes. */ .macro shortdelay delay - _wr_cmd_id shortdelay, ,,0xC3,,,,,, 0, 0 + _wr_cmd_id shortdelay, ,,ASEQ_OP_LAYER_SHORTDELAY,,,,,, 0, 0 _var \delay .endm @@ -2040,7 +2217,7 @@ $reladdr\@: * Enables legato on the current layer. */ .macro legato - _wr_cmd_id legato, ,,0xC4,,,,,, 0, 0 + _wr_cmd_id legato, ,,ASEQ_OP_LAYER_LEGATO,,,,,, 0, 0 .endm /** @@ -2049,7 +2226,7 @@ $reladdr\@: * Disables legato on the current layer. */ .macro nolegato - _wr_cmd_id nolegato, ,,0xC5,,,,,, 0, 0 + _wr_cmd_id nolegato, ,,ASEQ_OP_LAYER_NOLEGATO,,,,,, 0, 0 .endm /** @@ -2058,7 +2235,7 @@ $reladdr\@: * The time argument is either a var or a u8 depending on mode */ .macro portamento mode, target, time - _wr_cmd_id portamento, ,,0xC7,,,,,, 0, 0 + _wr_cmd_id portamento, ,,ASEQ_OP_LAYER_PORTAMENTO,,,,,, 0, 0 _wr_u8 \mode _wr_u8 \target .if (\mode & 0x80) != 0 @@ -2074,7 +2251,7 @@ $reladdr\@: * Disables portamento on the current layer. */ .macro noportamento - _wr_cmd_id noportamento, ,,0xC8,,,,,, 0, 0 + _wr_cmd_id noportamento, ,,ASEQ_OP_LAYER_NOPORTAMENTO,,,,,, 0, 0 .endm /** @@ -2083,7 +2260,7 @@ $reladdr\@: * Sets gate time for short notes. */ .macro shortgate gateTime - _wr_cmd_id shortgate, ,,0xC9,,,,,, 0, 0 + _wr_cmd_id shortgate, ,,ASEQ_OP_LAYER_SHORTGATE,,,,,, 0, 0 _wr_u8 \gateTime .endm @@ -2095,7 +2272,7 @@ $reladdr\@: .macro notepan pan /* pan can only take values in 0..127 */ _check_arg_bitwidth_u \pan, 7 - _wr_cmd_id notepan, ,,0xCA,,,,,, 0, 0 + _wr_cmd_id notepan, ,,ASEQ_OP_LAYER_NOTEPAN,,,,,, 0, 0 _wr_u8 \pan .endm @@ -2106,7 +2283,7 @@ $reladdr\@: * use pan set in the layer. */ .macro nodrumpan - _wr_cmd_id nodrumpan, ,,0xCC,,,,,, 0, 0 + _wr_cmd_id nodrumpan, ,,ASEQ_OP_LAYER_NODRUMPAN,,,,,, 0, 0 .endm /** @@ -2114,7 +2291,6 @@ $reladdr\@: * * TODO DESCRIPTION */ -#define STEREO_OPCODE 0xCD .macro stereo type, strongR, strongL, strongRvrbR, strongRvrbL _check_arg_bitwidth_u \type, 2 _check_arg_bitwidth_u \strongR, 1 @@ -2122,7 +2298,7 @@ $reladdr\@: _check_arg_bitwidth_u \strongRvrbR, 1 _check_arg_bitwidth_u \strongRvrbL, 1 - _wr_cmd_id stereo, ,,STEREO_OPCODE,,,,,, 0, 0 + _wr_cmd_id stereo, ,,ASEQ_OP_LAYER_STEREO,,,,,, 0, 0 _wr_u8 (\type << 4) | (\strongR << 3) | (\strongL << 2) | (\strongRvrbR << 1) | (\strongRvrbL << 0) .endm @@ -2132,7 +2308,7 @@ $reladdr\@: * Sets the velocity used in short notes by reading from SHORTVELTBL[velocity] */ .macro ldshortvel velocity - _wr_cmd_id ldshortvel, ,,0xD0,,,,,, \velocity, 4 + _wr_cmd_id ldshortvel, ,,ASEQ_OP_LAYER_LDSHORTVEL,,,,,, \velocity, 4 .endm /** @@ -2141,7 +2317,7 @@ $reladdr\@: * Sets the gate time used in short notes by reading from SHORTGATETBL[gateTime] */ .macro ldshortgate gateTime - _wr_cmd_id ldshortgate, ,,0xE0,,,,,, \gateTime, 4 + _wr_cmd_id ldshortgate, ,,ASEQ_OP_LAYER_LDSHORTGATE,,,,,, \gateTime, 4 .endm #if (MML_VERSION == MML_VERSION_MM) @@ -2152,7 +2328,7 @@ $reladdr\@: * TODO DESCRIPTION */ .macro unk_F0 arg - _wr_cmd_id unk_F0, ,,0xF0,,,,,, 0, 0 + _wr_cmd_id unk_F0, ,,ASEQ_OP_LAYER_F0,,,,,, 0, 0 _wr_s16 \arg .endm @@ -2161,9 +2337,8 @@ $reladdr\@: * * TODO DESCRIPTION */ - #define SURROUNDEFFECT_OPCODE 0xF1 .macro surroundeffect arg - _wr_cmd_id surroundeffect, ,,SURROUNDEFFECT_OPCODE,,,,,, 0, 0 + _wr_cmd_id surroundeffect, ,,ASEQ_OP_LAYER_F1,,,,,, 0, 0 _wr_u8 \arg .endm @@ -2182,9 +2357,8 @@ $reladdr\@: * * This instruction must only be used when long notes are enabled with the noshort instruction. */ -#define NOTEDVG_OPCODE 0x00 .macro notedvg pitch, delay, velocity, gateTime - _wr_cmd_id notedvg, ,,0x00,,,,,, \pitch, 6 + _wr_cmd_id notedvg, ,,ASEQ_OP_LAYER_NOTEDVG,,,,,, \pitch, 6 _var \delay _wr_u8 \velocity _wr_u8 \gateTime @@ -2197,16 +2371,15 @@ $reladdr\@: * * This instruction must only be used when long notes are enabled with the noshort instruction. */ -#define NOTEDV_OPCODE 0x40 .macro notedv pitch, delay, velocity - _wr_cmd_id notedv, ,,NOTEDV_OPCODE,,,,,, \pitch, 6 + _wr_cmd_id notedv, ,,ASEQ_OP_LAYER_NOTEDV,,,,,, \pitch, 6 _var \delay _wr_u8 \velocity .endm /* Workaround for bugs in vanilla sequences, force long encoding for delay. This should not typically be used. */ .macro noteldv pitch, delay, velocity - _wr_cmd_id noteldv, ,,0x40,,,,,, \pitch, 6 + _wr_cmd_id noteldv, ,,ASEQ_OP_LAYER_NOTEDV,,,,,, \pitch, 6 _var_long \delay _wr_u8 \velocity .endm @@ -2219,7 +2392,7 @@ $reladdr\@: * This instruction must only be used when long notes are enabled with the noshort instruction. */ .macro notevg pitch, velocity, gateTime - _wr_cmd_id notevg, ,,0x80,,,,,, \pitch, 6 + _wr_cmd_id notevg, ,,ASEQ_OP_LAYER_NOTEVG,,,,,, \pitch, 6 _wr_u8 \velocity _wr_u8 \gateTime .endm @@ -2233,7 +2406,7 @@ $reladdr\@: * This instruction must only be used when short notes are enabled with the short instruction. */ .macro shortdvg pitch, delay - _wr_cmd_id shortdvg, ,,0x00,,,,,, \pitch, 6 + _wr_cmd_id shortdvg, ,,ASEQ_OP_LAYER_NOTEDVG,,,,,, \pitch, 6 _var \delay .endm @@ -2246,7 +2419,7 @@ $reladdr\@: * This instruction must only be used when short notes are enabled with the short instruction. */ .macro shortdv pitch - _wr_cmd_id shortdv, ,,0x40,,,,,, \pitch, 6 + _wr_cmd_id shortdv, ,,ASEQ_OP_LAYER_NOTEDV,,,,,, \pitch, 6 .endm /** @@ -2258,7 +2431,7 @@ $reladdr\@: * This instruction must only be used when short notes are enabled with the short instruction. */ .macro shortvg pitch - _wr_cmd_id shortvg, ,,0x80,,,,,, \pitch, 6 + _wr_cmd_id shortvg, ,,ASEQ_OP_LAYER_NOTEVG,,,,,, \pitch, 6 .endm /** diff --git a/include/audiothread_cmd.h b/include/audiothread_cmd.h index c0576b82b3..c4a3436311 100644 --- a/include/audiothread_cmd.h +++ b/include/audiothread_cmd.h @@ -44,7 +44,7 @@ typedef enum AudioThreadCmdOp { /* 0xE1 */ AUDIOCMD_OP_GLOBAL_SET_SFX_FONT, /* 0xE2 */ AUDIOCMD_OP_GLOBAL_SET_INSTRUMENT_FONT, /* 0xE3 */ AUDIOCMD_OP_GLOBAL_POP_PERSISTENT_CACHE, - /* 0xF0 */ AUDIOCMD_OP_GLOBAL_SET_SOUND_MODE = 0xF0, + /* 0xF0 */ AUDIOCMD_OP_GLOBAL_SET_SOUND_OUTPUT_MODE = 0xF0, /* 0xF1 */ AUDIOCMD_OP_GLOBAL_MUTE, /* 0xF2 */ AUDIOCMD_OP_GLOBAL_UNMUTE, /* 0xF3 */ AUDIOCMD_OP_GLOBAL_SYNC_LOAD_INSTRUMENT, @@ -412,12 +412,12 @@ typedef enum AudioThreadCmdOp { AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_POP_PERSISTENT_CACHE, 0, 0, 0), tableType) /** - * Change the sound mode of audio + * Change the sound output mode * - * @param soundMode (s32) see the `SoundMode` enum + * @param soundOutputMode (s32) see the `SoundOutputMode` enum */ -#define AUDIOCMD_GLOBAL_SET_SOUND_MODE(soundMode) \ - AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_SET_SOUND_MODE, 0, 0, 0), soundMode) +#define AUDIOCMD_GLOBAL_SET_SOUND_OUTPUT_MODE(soundOutputMode) \ + AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_SET_SOUND_OUTPUT_MODE, 0, 0, 0), soundOutputMode) /** * Mute all sequence players diff --git a/include/avoid_ub.h b/include/avoid_ub.h new file mode 100644 index 0000000000..4706f50ecf --- /dev/null +++ b/include/avoid_ub.h @@ -0,0 +1,13 @@ +#ifndef AVOID_UB_H +#define AVOID_UB_H + +/** + * This macro is used when the return type of a function is incorrect + */ +#ifndef AVOID_UB +#define BAD_RETURN(type) type +#else +#define BAD_RETURN(type) void +#endif + +#endif diff --git a/include/buffers.h b/include/buffers.h new file mode 100644 index 0000000000..2a690d2730 --- /dev/null +++ b/include/buffers.h @@ -0,0 +1,14 @@ +#ifndef BUFFERS_H +#define BUFFERS_H + +#include "gfx.h" +#include "ultra64.h" + +extern u16 gZBuffer[SCREEN_HEIGHT][SCREEN_WIDTH]; // 0x25800 bytes +extern u64 gGfxSPTaskOutputBuffer[0x3000]; // 0x18000 bytes +extern u64 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE / sizeof(u64)]; // 0xC00 bytes +extern u64 gGfxSPTaskStack[SP_DRAM_STACK_SIZE64]; // 0x400 bytes +extern GfxPool gGfxPools[2]; // 0x24820 bytes +extern u8 gAudioHeap[0x38000]; // 0x38000 bytes + +#endif diff --git a/include/build.h b/include/build.h new file mode 100644 index 0000000000..25afaaa811 --- /dev/null +++ b/include/build.h @@ -0,0 +1,8 @@ +#ifndef BUILD_H +#define BUILD_H + +extern const char gBuildCreator[]; +extern const char gBuildDate[]; +extern const char gBuildMakeOption[]; + +#endif diff --git a/include/carthandle.h b/include/carthandle.h new file mode 100644 index 0000000000..72d0821e56 --- /dev/null +++ b/include/carthandle.h @@ -0,0 +1,8 @@ +#ifndef CARTHANDLE_H +#define CARTHANDLE_H + +#include "ultra64.h" + +extern OSPiHandle* gCartHandle; + +#endif diff --git a/include/color.h b/include/color.h index 816d38349d..73fa5d63a0 100644 --- a/include/color.h +++ b/include/color.h @@ -33,4 +33,6 @@ typedef union Color_RGBA16 { u16 rgba; } Color_RGBA16; +#define RGBA8(r, g, b, a) ((((r) & 0xFF) << 24) | (((g) & 0xFF) << 16) | (((b) & 0xFF) << 8) | (((a) & 0xFF) << 0)) + #endif diff --git a/include/console_logo_state.h b/include/console_logo_state.h new file mode 100644 index 0000000000..09b7d66546 --- /dev/null +++ b/include/console_logo_state.h @@ -0,0 +1,28 @@ +#ifndef CONSOLE_LOGO_STATE_H +#define CONSOLE_LOGO_STATE_H + +#include "ultra64.h" +#include "z64game.h" +#include "z64sram.h" +#include "z64view.h" + +typedef struct ConsoleLogoState { + /* 0x0000 */ GameState state; + /* 0x00A4 */ u8* staticSegment; + /* 0x00A8 */ View view; + /* 0x01D0 */ SramContext sramCtx; + /* 0x01D4 */ s16 unk_1D4; + /* 0x01D6 */ s16 coverAlpha; + /* 0x01D8 */ s16 addAlpha; + /* 0x01DA */ s16 visibleDuration; + /* 0x01DC */ s16 ult; + /* 0x01DE */ s16 uls; + /* 0x01E0 */ u8 unk_1E0; + /* 0x01E1 */ u8 exit; + /* 0x01E2 */ char unk_1E2[0x06]; +} ConsoleLogoState; // size = 0x1E8 + +void ConsoleLogo_Init(GameState* thisx); +void ConsoleLogo_Destroy(GameState* thisx); + +#endif diff --git a/include/db_camera.h b/include/db_camera.h new file mode 100644 index 0000000000..81d8515d0b --- /dev/null +++ b/include/db_camera.h @@ -0,0 +1,88 @@ +#ifndef DB_CAMERA_H +#define DB_CAMERA_H + +#include "ultra64.h" +#include "z64cutscene.h" +#include "z64math.h" + +struct Camera; + +typedef struct DebugCamSub { + /* 0x0000 */ s16 mode; + /* 0x0002 */ s16 nFrames; + /* 0x0004 */ s16 nPoints; + /* 0x0006 */ s16 unkIdx; + /* 0x0008 */ s16 unk_08; + /* 0x000A */ s16 unk_0A; + /* 0x000C */ s32 unk_0C; // bool: indicates position vs lookAt? + /* 0x0010 */ char unk_10[0x14]; + /* 0x0024 */ CutsceneCameraPoint position[129]; + /* 0x0834 */ CutsceneCameraPoint lookAt[129]; + /* 0x1044 */ s16 demoCtrlMenu; + /* 0x1046 */ s16 demoCtrlActionIdx; // e (?), s (save), l (load), c (clear) + /* 0x1048 */ s16 demoCtrlToggleSwitch; + /* 0x104A */ Vec3s unk_104A; +} DebugCamSub; // size = 0x1050 + +typedef struct DebugCam { + /* 0x00 */ s32 unk_00; + /* 0x04 */ Vec3f at; + /* 0x10 */ Vec3f eye; + /* 0x1C */ Vec3f unk_1C; + /* 0x28 */ char unk_28[0xC]; + /* 0x34 */ s32 unk_34; + /* 0x38 */ s32 unk_38; + /* 0x3C */ s32 unk_3C; // bool + /* 0x40 */ s32 unk_40; + /* 0x44 */ s32 unk_44; + /* 0x48 */ f32 fov; + /* 0x4C */ s16 roll; + /* 0x4E */ char unk_4E[0x2]; + /* 0x50 */ f32 rollDegrees; + /* 0x54 */ Vec3f unk_54; + /* 0x60 */ Vec3f unk_60; + /* 0x6C */ Vec3f unk_6C; + /* 0x78 */ s16 unk_78; + /* 0x7A */ s16 unk_7A; + /* 0x7C */ DebugCamSub sub; +} DebugCam; // size = 0x10CC + +typedef struct DebugCamCut { + /* 0x00 */ char letter; + /* 0x01 */ u8 unk_01; + /* 0x02 */ s16 mode; + /* 0x04 */ CutsceneCameraPoint* position; + /* 0x08 */ CutsceneCameraPoint* lookAt; + /* 0x0C */ s16 nFrames; + /* 0x0E */ s16 nPoints; +} DebugCamCut; // size = 0x10 + +typedef struct DebugCamAnim { + /* 0x00 */ f32 curFrame; + /* 0x04 */ f32 unk_04; // frame count? + /* 0x08 */ s16 keyframe; + /* 0x0A */ s16 unk_0A; + /* 0x0C */ s16 unk_0C; + /* 0x10 */ Vec3f positionPos; // confusing name + /* 0x1C */ Vec3f lookAtPos; + /* 0x28 */ f32 roll; + /* 0x2C */ f32 fov; +} DebugCamAnim; // size = 0x30 + +typedef enum DebugCamTextColor { + /* 0 */ DEBUG_CAM_TEXT_YELLOW, + /* 1 */ DEBUG_CAM_TEXT_PEACH, + /* 2 */ DEBUG_CAM_TEXT_BROWN, + /* 3 */ DEBUG_CAM_TEXT_ORANGE, + /* 4 */ DEBUG_CAM_TEXT_GOLD, + /* 5 */ DEBUG_CAM_TEXT_WHITE, + /* 6 */ DEBUG_CAM_TEXT_BLUE, + /* 7 */ DEBUG_CAM_TEXT_GREEN +} DebugCamTextColor; + +void DebugCamera_Init(DebugCam* debugCam, struct Camera* cameraPtr); +void DebugCamera_Enable(DebugCam* debugCam, struct Camera* cam); +void DebugCamera_Update(DebugCam* debugCam, struct Camera* cam); +void DebugCamera_Reset(struct Camera* cam, DebugCam* debugCam); + +#endif diff --git a/include/debug_arena.h b/include/debug_arena.h new file mode 100644 index 0000000000..352a7f6dc6 --- /dev/null +++ b/include/debug_arena.h @@ -0,0 +1,38 @@ +#ifndef DEBUG_ARENA_H +#define DEBUG_ARENA_H + +#include "ultra64/ultratypes.h" + +void* DebugArena_Malloc(u32 size); +void* DebugArena_MallocR(u32 size); +void* DebugArena_Realloc(void* ptr, u32 newSize); +void DebugArena_Free(void* ptr); +void* DebugArena_Calloc(u32 num, u32 size); +void DebugArena_GetSizes(u32* outMaxFree, u32* outFree, u32* outAlloc); +void DebugArena_Check(void); +void DebugArena_Init(void* start, u32 size); +void DebugArena_Cleanup(void); +s32 DebugArena_IsInitialized(void); + +#if DEBUG_FEATURES + +#define DEBUG_ARENA_MALLOC(size, file, line) DebugArena_MallocDebug(size, file, line) +#define DEBUG_ARENA_MALLOC_R(size, file, line) DebugArena_MallocRDebug(size, file, line) +#define DEBUG_ARENA_FREE(size, file, line) DebugArena_FreeDebug(size, file, line) + +void DebugArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action); +void* DebugArena_MallocDebug(u32 size, const char* file, int line); +void* DebugArena_MallocRDebug(u32 size, const char* file, int line); +void* DebugArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line); +void DebugArena_FreeDebug(void* ptr, const char* file, int line); +void DebugArena_Display(void); + +#else + +#define DEBUG_ARENA_MALLOC(size, file, line) DebugArena_Malloc(size) +#define DEBUG_ARENA_MALLOC_R(size, file, line) DebugArena_MallocR(size) +#define DEBUG_ARENA_FREE(size, file, line) DebugArena_Free(size) + +#endif + +#endif diff --git a/include/fault.h b/include/fault.h index 8f1979520f..af895927d0 100644 --- a/include/fault.h +++ b/include/fault.h @@ -1,9 +1,10 @@ #ifndef FAULT_H #define FAULT_H -#include "ultra64.h" +#include "libu64/debug.h" +#include "libu64/pad.h" #include "attributes.h" -#include "padmgr.h" +#include "ultra64.h" #if !PLATFORM_N64 // These are the same as the 3-bit ansi color codes @@ -50,6 +51,12 @@ void Fault_Init(void); NORETURN void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2); NORETURN void Fault_AddHungupAndCrash(const char* file, int line); +#if PLATFORM_N64 || DEBUG_FEATURES +#define HUNGUP_AND_CRASH(file, line) Fault_AddHungupAndCrash(file, line) +#else +#define HUNGUP_AND_CRASH(file, line) LogUtils_HungupThread(file, line) +#endif + // Client Registration void Fault_AddClient(FaultClient* client, void* callback, void* arg0, void* arg1); diff --git a/include/file_select_state.h b/include/file_select_state.h new file mode 100644 index 0000000000..0a831caa0f --- /dev/null +++ b/include/file_select_state.h @@ -0,0 +1,97 @@ +#ifndef FILE_SELECT_STATE_H +#define FILE_SELECT_STATE_H + +#include "ultra64.h" +#include "z64environment.h" +#include "z64game.h" +#include "z64message.h" +#include "z64skybox.h" +#include "z64sram.h" +#include "z64view.h" + +typedef struct FileSelectState { + /* 0x00000 */ GameState state; + /* 0x000A4 */ Vtx* windowVtx; + /* 0x000A8 */ u8* staticSegment; + /* 0x000AC */ u8* parameterSegment; +#if OOT_PAL + /* 0x000B0 */ u8* objectMagSegment; +#endif + /* 0x000B8 */ View view; + /* 0x001E0 */ SramContext sramCtx; + /* 0x001E4 */ char unk_1E4[0x4]; + /* 0x001E8 */ SkyboxContext skyboxCtx; + /* 0x00348 */ MessageContext msgCtx; + /* 0x0E760 */ Font font; + /* 0x1C8E8 */ EnvironmentContext envCtx; + /* 0x1C9E4 */ char unk_1C9E4[0x4]; + /* 0x1C9E8 */ Vtx* windowContentVtx; + /* 0x1C9EC */ Vtx* keyboardVtx; + /* 0x1C9F0 */ Vtx* nameEntryVtx; + /* 0x1C9F4 */ u8 n64ddFlag; + /* 0x1C9F6 */ u16 deaths[3]; + /* 0x1C9FC */ u8 fileNames[3][8]; + /* 0x1CA14 */ u16 healthCapacities[3]; + /* 0x1CA1C */ u32 questItems[3]; + /* 0x1CA28 */ s16 n64ddFlags[3]; + /* 0x1CA2E */ s8 defense[3]; +#if OOT_PAL + /* 0x1CA32 */ u16 health[3]; +#endif + /* 0x1CA38 */ s16 buttonIndex; + /* 0x1CA3A */ s16 confirmButtonIndex; // 0: yes, 1: quit + /* 0x1CA3C */ s16 menuMode; + /* 0x1CA3E */ s16 configMode; + /* 0x1CA40 */ s16 prevConfigMode; + /* 0x1CA42 */ s16 nextConfigMode; + /* 0x1CA44 */ s16 selectMode; + /* 0x1CA46 */ s16 selectedFileIndex; + /* 0x1CA48 */ char unk_1CA48[0x2]; + /* 0x1CA4A */ s16 fileNamesY[3]; + /* 0x1CA50 */ s16 actionTimer; + /* 0x1CA52 */ s16 buttonYOffsets[6]; + /* 0x1CA5E */ s16 copyDestFileIndex; + /* 0x1CA60 */ s16 warningLabel; + /* 0x1CA62 */ s16 warningButtonIndex; + /* 0x1CA64 */ s16 titleLabel; + /* 0x1CA66 */ s16 nextTitleLabel; + /* 0x1CA68 */ s16 windowColor[3]; + /* 0x1CA6E */ s16 titleAlpha[2]; + /* 0x1CA72 */ s16 windowAlpha; + /* 0x1CA74 */ s16 fileButtonAlpha[3]; + /* 0x1CA7A */ s16 nameBoxAlpha[3]; + /* 0x1CA80 */ s16 nameAlpha[3]; + /* 0x1CA86 */ s16 connectorAlpha[3]; + /* 0x1CA8C */ s16 fileInfoAlpha[3]; + /* 0x1CA92 */ s16 actionButtonAlpha[4]; // also contains the alphas for the confirm buttons + /* 0x1CA9A */ s16 optionButtonAlpha; + /* 0x1CA9C */ s16 nameEntryBoxAlpha; + /* 0x1CA9E */ s16 controlsAlpha; + /* 0x1CAA0 */ s16 emptyFileTextAlpha; + /* 0x1CAA2 */ s16 highlightColor[4]; + /* 0x1CAAA */ s16 highlightPulseDir; // 0 fade out, 1 fade in + /* 0x1CAAC */ s16 unk_1CAAC; // initialized but never used + /* 0x1CAAE */ s16 confirmButtonTexIndices[2]; + /* 0x1CAB2 */ s16 inputTimerX; + /* 0x1CAB4 */ s16 inputTimerY; + /* 0x1CAB6 */ s16 stickXDir; + /* 0x1CAB8 */ s16 stickYDir; + /* 0x1CABA */ s16 stickAdjX; + /* 0x1CABC */ s16 stickAdjY; + /* 0x1CABE */ s16 nameEntryBoxPosX; + /* 0x1CAC0 */ s16 windowPosX; + /* 0x1CAC4 */ f32 windowRot; + /* 0x1CAC8 */ s16 kbdButton; // only for buttons, not characters + /* 0x1CACA */ s16 charPage; // 0: hiragana, 1: katakana, 2: alphabet + /* 0x1CACC */ s16 charBgAlpha; // square shape the letter sits in + /* 0x1CACE */ s16 charIndex; // 0 - 64, top left to bottom right + /* 0x1CAD0 */ s16 kbdX; // (0, 0) is top left character + /* 0x1CAD2 */ s16 kbdY; + /* 0x1CAD4 */ s16 newFileNameCharCount; + /* 0x1CAD6 */ s16 unk_1CAD6[5]; +} FileSelectState; // size = 0x1CAE0 + +void FileSelect_Init(GameState* thisx); +void FileSelect_Destroy(GameState* thisx); + +#endif diff --git a/include/flag_set.h b/include/flag_set.h new file mode 100644 index 0000000000..df9262ac7f --- /dev/null +++ b/include/flag_set.h @@ -0,0 +1,8 @@ +#ifndef FLAG_SET_H +#define FLAG_SET_H + +struct PlayState; + +void FlagSet_Update(struct PlayState* play); + +#endif diff --git a/include/functions.h b/include/functions.h deleted file mode 100644 index d861112d49..0000000000 --- a/include/functions.h +++ /dev/null @@ -1,291 +0,0 @@ -#ifndef FUNCTIONS_H -#define FUNCTIONS_H - -#include "z64.h" -#include "macros.h" - -void bootproc(void); -void Main_ThreadEntry(void* arg); -void Idle_ThreadEntry(void* arg); -void ViConfig_UpdateVi(u32 black); -void ViConfig_UpdateBlack(void); -#if !PLATFORM_IQUE -void Yaz0_Decompress(uintptr_t romStart, u8* dst, size_t size); -#else -void gzip_decompress(uintptr_t romStart, u8* dst, size_t size); -#endif -void Locale_Init(void); -void Locale_ResetRegion(void); -#if DEBUG_FEATURES -void isPrintfInit(void); -#endif -void rmonPrintf(const char* fmt, ...); -#if DEBUG_FEATURES -void* is_proutSyncPrintf(void* arg, const char* str, size_t count); -NORETURN void func_80002384(const char* exp, const char* file, int line); -#endif -OSPiHandle* osDriveRomInit(void); -void Mio0_Decompress(u8* src, u8* dst); - -void FlagSet_Update(PlayState* play); -void Overlay_LoadGameState(GameStateOverlay* overlayEntry); -void Overlay_FreeGameState(GameStateOverlay* overlayEntry); - -void ActorOverlayTable_LogPrint(void); -void ActorOverlayTable_Init(void); -void ActorOverlayTable_Cleanup(void); - -void SaveContext_Init(void); -s32 func_800635D0(s32); -void Regs_Init(void); -void DebugCamera_ScreenText(u8 x, u8 y, const char* text); -void DebugCamera_ScreenTextColored(u8 x, u8 y, u8 colorIndex, const char* text); -#if DEBUG_FEATURES -void Regs_UpdateEditor(Input* input); -#endif -void Debug_DrawText(GraphicsContext* gfxCtx); - -void* MemCpy(void* dest, const void* src, s32 len); - -u16 QuestHint_GetSariaTextId(PlayState* play); -u16 QuestHint_GetNaviTextId(PlayState* play); -u16 MaskReaction_GetTextId(PlayState* play, u32 maskReactionSet); -void CutsceneFlags_UnsetAll(PlayState* play); -void CutsceneFlags_Set(PlayState* play, s16 flag); -void CutsceneFlags_Unset(PlayState* play, s16 flag); -s32 CutsceneFlags_Get(PlayState* play, s16 flag); - -s32 Kanji_OffsetFromShiftJIS(s32 character); -#if PLATFORM_IQUE -void Font_LoadCharCHN(Font* font, u16 character, u16 codePointIndex); -#endif -void Font_LoadCharWide(Font* font, u16 character, u16 codePointIndex); -void Font_LoadChar(Font* font, u8 character, u16 codePointIndex); -void Font_LoadMessageBoxIcon(Font* font, u16 icon); -void Font_LoadOrderedFont(Font* font); - -void Health_InitMeter(PlayState* play); -void Health_UpdateMeter(PlayState* play); -void Health_DrawMeter(PlayState* play); -void Health_UpdateBeatingHeart(PlayState* play); -u32 Health_IsCritical(void); - -void MapMark_Init(PlayState* play); -void MapMark_ClearPointers(PlayState* play); -void MapMark_Draw(PlayState* play); -void PreNmiBuff_Init(PreNmiBuff* this); -void PreNmiBuff_SetReset(PreNmiBuff* this); -u32 PreNmiBuff_IsResetting(PreNmiBuff* this); -void Sched_FlushTaskQueue(void); - -Path* Path_GetByIndex(PlayState* play, s16 index, s16 max); -f32 Path_OrientAndGetDistSq(Actor* actor, Path* path, s16 waypoint, s16* yaw); -void Path_CopyLastPoint(Path* path, Vec3f* dest); - -void PreNMI_Init(GameState* thisx); - -void func_80095AA0(PlayState* play, Room* room, Input* input, s32 arg3); -void Room_DrawBackground2D(Gfx** gfxP, void* tex, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 tlutMode, - u16 tlutCount, f32 offsetX, f32 offsetY); -void Room_Init(PlayState* play, Room* room); -u32 Room_SetupFirstRoom(PlayState* play, RoomContext* roomCtx); -s32 Room_RequestNewRoom(PlayState* play, RoomContext* roomCtx, s32 roomNum); -s32 Room_ProcessRoomRequest(PlayState* play, RoomContext* roomCtx); -void Room_Draw(PlayState* play, Room* room, u32 flags); -void Room_FinishRoomChange(PlayState* play, RoomContext* roomCtx); -void Sample_Destroy(GameState* thisx); -void Sample_Init(GameState* thisx); - -void Skin_UpdateVertices(MtxF* mtx, SkinVertex* skinVertices, SkinLimbModif* modifEntry, Vtx* vtxBuf, Vec3f* pos); -void Skin_DrawAnimatedLimb(GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, s32 arg3, s32 drawFlags); -void Skin_DrawLimb(GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, Gfx* dlistOverride, s32 drawFlags); -void func_800A6330(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw, s32 setTranslation); -void func_800A6360(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw, - SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation); -void func_800A6394(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw, - SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6); -void func_800A63CC(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postDraw, - SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6, s32 drawFlags); -void Skin_GetLimbPos(Skin* skin, s32 limbIndex, Vec3f* offset, Vec3f* dst); -void Skin_Init(PlayState* play, Skin* skin, SkeletonHeader* skeletonHeader, AnimationHeader* animationHeader); -void Skin_Free(PlayState* play, Skin* skin); -s32 Skin_ApplyAnimTransformations(Skin* skin, MtxF* limbMatrices, Actor* actor, s32 setTranslation); - -void Sram_InitNewSave(void); -void Sram_InitDebugSave(void); -void Sram_OpenSave(SramContext* sramCtx); -void Sram_WriteSave(SramContext* sramCtx); -void Sram_VerifyAndLoadAllSaves(FileSelectState* fileSelect, SramContext* sramCtx); -void Sram_InitSave(FileSelectState* fileSelect, SramContext* sramCtx); -void Sram_EraseSave(FileSelectState* fileSelect, SramContext* sramCtx); -void Sram_CopySave(FileSelectState* fileSelect, SramContext* sramCtx); -void Sram_WriteSramHeader(SramContext* sramCtx); -void Sram_InitSram(GameState* gameState, SramContext* sramCtx); -void Sram_Alloc(GameState* gameState, SramContext* sramCtx); -void Sram_Init(PlayState* play, SramContext* sramCtx); -void SsSram_Init(s32 addr, u8 handleType, u8 handleDomain, u8 handleLatency, u8 handlePageSize, u8 handleRelDuration, - u8 handlePulse, u32 handleSpeed); -void SsSram_Dma(void* dramAddr, size_t size, s32 direction); -void SsSram_ReadWrite(s32 addr, void* dramAddr, size_t size, s32 direction); - -void ViMode_LogPrint(OSViMode* osViMode); -void ViMode_Configure(ViMode* viMode, s32 type, s32 tvType, s32 loRes, s32 antialiasOff, s32 modeN, s32 fb16Bit, - s32 width, s32 height, s32 leftAdjust, s32 rightAdjust, s32 upperAdjust, s32 lowerAdjust); -void ViMode_Save(ViMode* viMode); -void ViMode_Load(ViMode* viMode); -void ViMode_Init(ViMode* viMode); -void ViMode_Destroy(ViMode* viMode); -void ViMode_ConfigureFeatures(ViMode* viMode, s32 viFeatures); -void ViMode_Update(ViMode* viMode, Input* input); -void PlayerCall_InitFuncPtrs(void); -void TransitionTile_Destroy(TransitionTile* this); -TransitionTile* TransitionTile_Init(TransitionTile* this, s32 cols, s32 rows); -void TransitionTile_Draw(TransitionTile* this, Gfx** gfxP); -void TransitionTile_Update(TransitionTile* this); -void TransitionTriforce_Start(void* thisx); -void* TransitionTriforce_Init(void* thisx); -void TransitionTriforce_Destroy(void* thisx); -void TransitionTriforce_Update(void* thisx, s32 updateRate); -void TransitionTriforce_SetColor(void* thisx, u32 color); -void TransitionTriforce_SetType(void* thisx, s32 type); -void TransitionTriforce_Draw(void* thisx, Gfx** gfxP); -s32 TransitionTriforce_IsDone(void* thisx); -void TransitionWipe_Start(void* thisx); -void* TransitionWipe_Init(void* thisx); -void TransitionWipe_Destroy(void* thisx); -void TransitionWipe_Update(void* thisx, s32 updateRate); -void TransitionWipe_Draw(void* thisx, Gfx** gfxP); -s32 TransitionWipe_IsDone(void* thisx); -void TransitionWipe_SetType(void* thisx, s32 type); -void TransitionWipe_SetColor(void* thisx, u32 color); -void TransitionCircle_Start(void* thisx); -void* TransitionCircle_Init(void* thisx); -void TransitionCircle_Destroy(void* thisx); -void TransitionCircle_Update(void* thisx, s32 updateRate); -void TransitionCircle_Draw(void* thisx, Gfx** gfxP); -s32 TransitionCircle_IsDone(void* thisx); -void TransitionCircle_SetType(void* thisx, s32 type); -void TransitionCircle_SetColor(void* thisx, u32 color); -void TransitionCircle_SetUnkColor(void* thisx, u32 color); -void TransitionFade_Start(void* thisx); -void* TransitionFade_Init(void* thisx); -void TransitionFade_Destroy(void* thisx); -void TransitionFade_Update(void* thisx, s32 updateRate); -void TransitionFade_Draw(void* thisx, Gfx** gfxP); -s32 TransitionFade_IsDone(void* thisx); -void TransitionFade_SetColor(void* thisx, u32 color); -void TransitionFade_SetType(void* thisx, s32 type); - -void DebugCamera_Init(DebugCam* debugCam, Camera* cameraPtr); -void DebugCamera_Enable(DebugCam* debugCam, Camera* cam); -void DebugCamera_Update(DebugCam* debugCam, Camera* cam); -void DebugCamera_Reset(Camera* cam, DebugCam* debugCam); -void func_800BB0A0(f32 u, Vec3f* pos, f32* roll, f32* viewAngle, f32* point0, f32* point1, f32* point2, f32* point3); -s32 func_800BB2B4(Vec3f* pos, f32* roll, f32* fov, CutsceneCameraPoint* point, s16* keyFrame, f32* curFrame); - -s32 func_800C0D34(PlayState* this, Actor* actor, s16* yaw); -s32 func_800C0DB4(PlayState* this, Vec3f* pos); -void PreRender_SetValuesSave(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf, void* cvg); -void PreRender_Init(PreRender* this); -void PreRender_SetValues(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf); -void PreRender_Destroy(PreRender* this); -void func_800C170C(PreRender* this, Gfx** gfxP, void* buf, void* bufSave, u32 r, u32 g, u32 b, u32 a); -void func_800C1AE8(PreRender* this, Gfx** gfxP, void* fbuf, void* fbufSave); -void PreRender_SaveZBuffer(PreRender* this, Gfx** gfxP); -void PreRender_SaveFramebuffer(PreRender* this, Gfx** gfxP); -void PreRender_DrawCoverage(PreRender* this, Gfx** gfxP); -void PreRender_RestoreZBuffer(PreRender* this, Gfx** gfxP); -void func_800C213C(PreRender* this, Gfx** gfxP); -void PreRender_RestoreFramebuffer(PreRender* this, Gfx** gfxP); -void PreRender_CopyImageRegion(PreRender* this, Gfx** gfxP); -void PreRender_ApplyFilters(PreRender* this); -void GameState_SetFBFilter(Gfx** gfxP); -void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx); -void GameState_SetFrameBuffer(GraphicsContext* gfxCtx); -void GameState_ReqPadData(GameState* gameState); -void GameState_Update(GameState* gameState); -void GameState_InitArena(GameState* gameState, size_t size); -void GameState_Realloc(GameState* gameState, size_t size); -void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* gfxCtx); -void GameState_Destroy(GameState* gameState); -GameStateFunc GameState_GetInit(GameState* gameState); -u32 GameState_IsRunning(GameState* gameState); -#if DEBUG_FEATURES -void* GameState_Alloc(GameState* gameState, size_t size, const char* file, int line); -void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, int line); -#endif -void* GameAlloc_Malloc(GameAlloc* this, u32 size); -void GameAlloc_Free(GameAlloc* this, void* data); -void GameAlloc_Cleanup(GameAlloc* this); -void GameAlloc_Init(GameAlloc* this); -void Graph_InitTHGA(GraphicsContext* gfxCtx); -GameStateOverlay* Graph_GetNextGameState(GameState* gameState); -void Graph_Init(GraphicsContext* gfxCtx); -void Graph_Destroy(GraphicsContext* gfxCtx); -void Graph_TaskSet00(GraphicsContext* gfxCtx); -void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState); -void Graph_ThreadEntry(void*); - -ListAlloc* ListAlloc_Init(ListAlloc* this); -void* ListAlloc_Alloc(ListAlloc* this, u32 size); -void ListAlloc_Free(ListAlloc* this, void* data); -void ListAlloc_FreeAll(ListAlloc* this); -void Main(void* arg); -void SysCfb_Init(s32 n64dd); -void* SysCfb_GetFbPtr(s32 idx); -void* SysCfb_GetFbEnd(void); - -u64* SysUcode_GetUCodeBoot(void); -size_t SysUcode_GetUCodeBootSize(void); -u64* SysUcode_GetUCode(void); -u64* SysUcode_GetUCodeData(void); -NORETURN void func_800D31A0(void); -void func_800D31F0(void); -void func_800D3210(void); -void* DebugArena_Malloc(u32 size); -void* DebugArena_MallocR(u32 size); -void* DebugArena_Realloc(void* ptr, u32 newSize); -void DebugArena_Free(void* ptr); -void* DebugArena_Calloc(u32 num, u32 size); -void DebugArena_GetSizes(u32* outMaxFree, u32* outFree, u32* outAlloc); -void DebugArena_Check(void); -void DebugArena_Init(void* start, u32 size); -void DebugArena_Cleanup(void); -s32 DebugArena_IsInitialized(void); -#if DEBUG_FEATURES -void DebugArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action); -void* DebugArena_MallocDebug(u32 size, const char* file, int line); -void* DebugArena_MallocRDebug(u32 size, const char* file, int line); -void* DebugArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line); -void DebugArena_FreeDebug(void* ptr, const char* file, int line); -void DebugArena_Display(void); -#endif - -void RcpUtils_PrintRegisterStatus(void); -void RcpUtils_Reset(void); -void* Overlay_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd); -void MtxConv_F2L(Mtx* m1, MtxF* m2); -void MtxConv_L2F(MtxF* m1, Mtx* m2); -void Overlay_Relocate(void* allocatedRamAddr, OverlayRelocationSection* ovlRelocs, void* vramStart); -size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd, void* allocatedRamAddr); -// ? func_800FC800(?); -// ? func_800FC83C(?); -// ? func_800FCAB4(?); -void SystemHeap_Init(void* start, u32 size); - -f32 absf(f32); - -void Regs_InitData(PlayState* play); - -void Setup_Init(GameState* thisx); -void Setup_Destroy(GameState* thisx); -void ConsoleLogo_Init(GameState* thisx); -void ConsoleLogo_Destroy(GameState* thisx); -void MapSelect_Init(GameState* thisx); -void MapSelect_Destroy(GameState* thisx); -void TitleSetup_Init(GameState* thisx); -void TitleSetup_Destroy(GameState* thisx); -void FileSelect_Init(GameState* thisx); -void FileSelect_Destroy(GameState* thisx); - -#endif diff --git a/include/gamealloc.h b/include/gamealloc.h new file mode 100644 index 0000000000..c69ea35749 --- /dev/null +++ b/include/gamealloc.h @@ -0,0 +1,31 @@ +#ifndef GAMEALLOC_H +#define GAMEALLOC_H + +#include "ultra64/ultratypes.h" + +typedef struct GameAllocEntry { + /* 0x00 */ struct GameAllocEntry* next; + /* 0x04 */ struct GameAllocEntry* prev; + /* 0x08 */ u32 size; + /* 0x0C */ u32 unk_0C; +} GameAllocEntry; // size = 0x10 + +typedef struct GameAlloc { + /* 0x00 */ GameAllocEntry base; + /* 0x10 */ GameAllocEntry* head; +} GameAlloc; // size = 0x14 + +#if DEBUG_FEATURES + +#define GAME_ALLOC_MALLOC(alloc, size, file, line) GameAlloc_MallocDebug(alloc, size, file, line) +void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, int line); +#else +#define GAME_ALLOC_MALLOC(alloc, size, file, line) GameAlloc_Malloc(alloc, size) +#endif + +void* GameAlloc_Malloc(GameAlloc* this, u32 size); +void GameAlloc_Free(GameAlloc* this, void* data); +void GameAlloc_Cleanup(GameAlloc* this); +void GameAlloc_Init(GameAlloc* this); + +#endif diff --git a/include/gfx.h b/include/gfx.h index 46a06649b9..e534655964 100644 --- a/include/gfx.h +++ b/include/gfx.h @@ -7,6 +7,9 @@ #include "thga.h" #include "versions.h" +#define SCREEN_WIDTH 320 +#define SCREEN_HEIGHT 240 + // Texture memory size, 4 KiB #define TMEM_SIZE 0x1000 @@ -54,6 +57,8 @@ typedef struct GraphicsContext { /* 0x02FC */ char unk_2FC[0x04]; } GraphicsContext; // size = 0x300 +extern Gfx gEmptyDL[]; + Gfx* Gfx_SetFog(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 near, s32 far); Gfx* Gfx_SetFogWithSync(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 near, s32 far); Gfx* Gfx_SetFog2(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 near, s32 far); @@ -117,4 +122,44 @@ void Graph_CloseDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, #endif +void Graph_ThreadEntry(void*); + +extern u64 gMojiFontTLUTs[4][4]; // original name: "moji_tlut" +extern u64 gMojiFontTex[]; // original name: "font_ff" + +/** + * `x` vertex x + * `y` vertex y + * `z` vertex z + * `s` texture s coordinate + * `t` texture t coordinate + * `crnx` red component of color vertex, or x component of normal vertex + * `cgny` green component of color vertex, or y component of normal vertex + * `cbnz` blue component of color vertex, or z component of normal vertex + * `a` alpha + */ +#define VTX(x,y,z,s,t,crnx,cgny,cbnz,a) { { { x, y, z }, 0, { s, t }, { crnx, cgny, cbnz, a } } } + +#define VTX_T(x,y,z,s,t,cr,cg,cb,a) { { x, y, z }, 0, { s, t }, { cr, cg, cb, a } } + +#define gDPSetTileCustom(pkt, fmt, siz, uls, ult, lrs, lrt, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ +_DW({ \ + gDPPipeSync(pkt); \ + gDPTileSync(pkt); \ + gDPSetTile(pkt, fmt, siz, \ + (((((lrs) - (uls) + 1) * siz##_TILE_BYTES) + 7) >> 3), 0, \ + G_TX_LOADTILE, 0, cmt, maskt, shiftt, cms, masks, \ + shifts); \ + gDPTileSync(pkt); \ + gDPSetTile(pkt, fmt, siz, \ + (((((lrs) - (uls) + 1) * siz##_LINE_BYTES) + 7) >> 3), 0, \ + G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPSetTileSize(pkt, G_TX_RENDERTILE, \ + (uls) << G_TEXTURE_IMAGE_FRAC, \ + (ult) << G_TEXTURE_IMAGE_FRAC, \ + (lrs) << G_TEXTURE_IMAGE_FRAC, \ + (lrt) << G_TEXTURE_IMAGE_FRAC); \ +}) + #endif diff --git a/include/global.h b/include/global.h deleted file mode 100644 index d2a081a5fb..0000000000 --- a/include/global.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef GLOBAL_H -#define GLOBAL_H - -#include "functions.h" -#include "variables.h" -#include "macros.h" -#include "versions.h" - -#endif diff --git a/include/idle.h b/include/idle.h new file mode 100644 index 0000000000..1317775d53 --- /dev/null +++ b/include/idle.h @@ -0,0 +1,12 @@ +#ifndef IDLE_H +#define IDLE_H + +#include "ultra64.h" + +void Idle_ThreadEntry(void* arg); + +extern OSMesgQueue gPiMgrCmdQueue; +extern OSViMode gViConfigMode; +extern u8 gViConfigModeType; + +#endif diff --git a/include/inflate.h b/include/inflate.h new file mode 100644 index 0000000000..f26f7e496b --- /dev/null +++ b/include/inflate.h @@ -0,0 +1,10 @@ +#ifndef INFLATE_H +#define INFLATE_H + +#include "libc/stddef.h" +#include "libc/stdint.h" +#include "ultra64.h" + +void gzip_decompress(uintptr_t romStart, u8* dst, size_t size); + +#endif diff --git a/include/irqmgr.h b/include/irqmgr.h index b931977ab0..b841fb141f 100644 --- a/include/irqmgr.h +++ b/include/irqmgr.h @@ -46,4 +46,6 @@ void IrqMgr_RemoveClient(IrqMgr* irqMgr, IrqMgrClient* client); extern vu32 gIrqMgrResetStatus; extern volatile OSTime gIrqMgrRetraceTime; +extern IrqMgr gIrqMgr; + #endif diff --git a/include/is_debug.h b/include/is_debug.h new file mode 100644 index 0000000000..e5f03bb784 --- /dev/null +++ b/include/is_debug.h @@ -0,0 +1,18 @@ +#ifndef IS_DEBUG_H +#define IS_DEBUG_H + +#include "libc/stddef.h" +#include "attributes.h" + +#if DEBUG_FEATURES +void isPrintfInit(void); +#endif + +void rmonPrintf(const char* fmt, ...); + +#if DEBUG_FEATURES +void* is_proutSyncPrintf(void* arg, const char* str, size_t count); +NORETURN void func_80002384(const char* exp, const char* file, int line); +#endif + +#endif diff --git a/include/kanread.h b/include/kanread.h new file mode 100644 index 0000000000..bea4831c81 --- /dev/null +++ b/include/kanread.h @@ -0,0 +1,8 @@ +#ifndef KANREAD_H +#define KANREAD_H + +#include "ultra64/ultratypes.h" + +s32 Kanji_OffsetFromShiftJIS(s32 sjis); + +#endif diff --git a/include/language_array.h b/include/language_array.h new file mode 100644 index 0000000000..b93dbd4e0e --- /dev/null +++ b/include/language_array.h @@ -0,0 +1,12 @@ +#ifndef LANGUAGE_ARRAY_H +#define LANGUAGE_ARRAY_H + +#include "versions.h" + +#if OOT_NTSC +#define LANGUAGE_ARRAY(jpn, eng, ger, fra) { jpn, eng } +#else +#define LANGUAGE_ARRAY(jpn, eng, ger, fra) { eng, ger, fra } +#endif + +#endif diff --git a/include/libc64/malloc.h b/include/libc64/malloc.h index 86b58d17ca..02540e3530 100644 --- a/include/libc64/malloc.h +++ b/include/libc64/malloc.h @@ -16,13 +16,22 @@ void SystemArena_Cleanup(void); s32 SystemArena_IsInitialized(void); #if DEBUG_FEATURES +#define SYSTEM_ARENA_MALLOC(size, file, line) SystemArena_MallocDebug(size, file, line) +#define SYSTEM_ARENA_MALLOC_R(size, file, line) SystemArena_MallocRDebug(size, file, line) +#define SYSTEM_ARENA_FREE(size, file, line) SystemArena_FreeDebug(size, file, line) + void* SystemArena_MallocDebug(u32 size, const char* file, int line); void* SystemArena_MallocRDebug(u32 size, const char* file, int line); void* SystemArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line); void SystemArena_FreeDebug(void* ptr, const char* file, int line); void SystemArena_Display(void); +#else +#define SYSTEM_ARENA_MALLOC(size, file, line) SystemArena_Malloc(size) +#define SYSTEM_ARENA_MALLOC_R(size, file, line) SystemArena_MallocR(size) +#define SYSTEM_ARENA_FREE(size, file, line) SystemArena_Free(size) #endif extern Arena gSystemArena; +extern s32 gSystemArenaLogSeverity; #endif diff --git a/include/libu64/debug.h b/include/libu64/debug.h index 598c901957..87015afde8 100644 --- a/include/libu64/debug.h +++ b/include/libu64/debug.h @@ -3,12 +3,33 @@ #include "ultra64.h" +#if DEBUG_FEATURES +#define LOG(exp, value, format, file, line) \ + do { \ + LogUtils_LogThreadId(file, line); \ + osSyncPrintf(exp " = " format "\n", value); \ + } while (0) +#else +#define LOG(exp, value, format, file, line) (void)(value) +#endif + +#define LOG_STRING(string, file, line) LOG(#string, string, "%s", file, line) +#define LOG_ADDRESS(exp, value, file, line) LOG(exp, value, "%08x", file, line) +#define LOG_TIME(exp, value, file, line) LOG(exp, value, "%lld", file, line) +#define LOG_NUM(exp, value, file, line) LOG(exp, value, "%d", file, line) +#define LOG_HEX(exp, value, file, line) LOG(exp, value, "%x", file, line) +#define LOG_HEX32(exp, value, file, line) LOG(exp, value, "%08x", file, line) +#define LOG_FLOAT(exp, value, file, line) LOG(exp, value, "%f", file, line) + #if PLATFORM_N64 || DEBUG_FEATURES f32 LogUtils_CheckFloatRange(const char* exp, int line, const char* valueName, f32 value, const char* minName, f32 min, const char* maxName, f32 max); #endif #if DEBUG_FEATURES +#define LOG_UTILS_CHECK_NULL_POINTER(exp, ptr, file, line) LogUtils_CheckNullPointer(exp, ptr, file, line) +#define LOG_UTILS_CHECK_VALID_POINTER(exp, ptr, file, line) LogUtils_CheckValidPointer(exp, ptr, file, line) + s32 LogUtils_CheckIntRange(const char* exp, int line, const char* valueName, s32 value, const char* minName, s32 min, const char* maxName, s32 max); void LogUtils_LogHexDump(void* ptr, s32 size0); @@ -17,6 +38,11 @@ void LogUtils_CheckBoundary(const char* name, s32 value, s32 unk, const char* fi void LogUtils_CheckNullPointer(const char* exp, void* ptr, const char* file, int line); void LogUtils_CheckValidPointer(const char* exp, void* ptr, const char* file, int line); void LogUtils_LogThreadId(const char* name, int line); +#else + +#define LOG_UTILS_CHECK_NULL_POINTER(exp, ptr, file, line) (void)0 +#define LOG_UTILS_CHECK_VALID_POINTER(exp, ptr, file, line) (void)0 + #endif void LogUtils_HungupThread(const char* name, int line); diff --git a/include/libu64/mtxuty-cvt.h b/include/libu64/mtxuty-cvt.h new file mode 100644 index 0000000000..636978bb6f --- /dev/null +++ b/include/libu64/mtxuty-cvt.h @@ -0,0 +1,9 @@ +#ifndef LIBU64_MTXUTY_CVT_H +#define LIBU64_MTXUTY_CVT_H + +#include "ultra64.h" + +void MtxConv_F2L(Mtx* m1, MtxF* m2); +void MtxConv_L2F(MtxF* m1, Mtx* m2); + +#endif diff --git a/include/libu64/overlay.h b/include/libu64/overlay.h new file mode 100644 index 0000000000..47f3276576 --- /dev/null +++ b/include/libu64/overlay.h @@ -0,0 +1,42 @@ +#ifndef LIBU64_OVERLAY_H +#define LIBU64_OVERLAY_H + +#include "ultra64.h" + +/* Relocation entry field getters */ +#define RELOC_SECTION(reloc) ((reloc) >> 30) +#define RELOC_OFFSET(reloc) ((reloc) & 0xFFFFFF) +#define RELOC_TYPE_MASK(reloc) ((reloc) & 0x3F000000) +#define RELOC_TYPE_SHIFT 24 + +/* MIPS Relocation Types, matches the MIPS ELF spec */ +#define R_MIPS_32 2 +#define R_MIPS_26 4 +#define R_MIPS_HI16 5 +#define R_MIPS_LO16 6 + +/* Reloc section id, must fit in 2 bits otherwise the relocation format must be modified */ +typedef enum RelocSectionId { + /* 0 */ RELOC_SECTION_NULL, + /* 1 */ RELOC_SECTION_TEXT, + /* 2 */ RELOC_SECTION_DATA, + /* 3 */ RELOC_SECTION_RODATA, + /* 4 */ RELOC_SECTION_MAX +} RelocSectionId; + +typedef struct OverlayRelocationSection { + /* 0x00 */ u32 textSize; + /* 0x04 */ u32 dataSize; + /* 0x08 */ u32 rodataSize; + /* 0x0C */ u32 bssSize; + /* 0x10 */ u32 nRelocations; + /* 0x14 */ u32 relocations[1]; // size is nRelocations +} OverlayRelocationSection; // size >= 0x18 + +extern s32 gOverlayLogSeverity; + +void* Overlay_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd); +void Overlay_Relocate(void* allocatedRamAddr, OverlayRelocationSection* ovlRelocs, void* vramStart); +size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd, void* allocatedRamAddr); + +#endif diff --git a/include/libu64/rcp_utils.h b/include/libu64/rcp_utils.h new file mode 100644 index 0000000000..7582305142 --- /dev/null +++ b/include/libu64/rcp_utils.h @@ -0,0 +1,6 @@ +#ifndef LIBU64_RCP_UTILS_H +#define LIBU64_RCP_UTILS_H + +void RcpUtils_Reset(void); + +#endif diff --git a/include/libu64/runtime.h b/include/libu64/runtime.h new file mode 100644 index 0000000000..7df947cef5 --- /dev/null +++ b/include/libu64/runtime.h @@ -0,0 +1,8 @@ +#ifndef LIBU64_RUNTIME_H +#define LIBU64_RUNTIME_H + +#include "ultra64.h" + +void Runtime_Init(void* start, u32 size); + +#endif diff --git a/include/line_numbers.h b/include/line_numbers.h index bc11d555db..adc2d654d5 100644 --- a/include/line_numbers.h +++ b/include/line_numbers.h @@ -1,6 +1,8 @@ #ifndef LINE_NUMBERS_H #define LINE_NUMBERS_H +#include "versions.h" + // The macros in this file serve to reduce clutter from version differences that are only due to line numbers being different. // The "LN" macros defined here are not meant to be used directly. See the wrapper macros below. diff --git a/include/listalloc.h b/include/listalloc.h new file mode 100644 index 0000000000..76321a3e87 --- /dev/null +++ b/include/listalloc.h @@ -0,0 +1,16 @@ +#ifndef LISTALLOC_H +#define LISTALLOC_H + +#include "ultra64/ultratypes.h" + +typedef struct ListAlloc { + /* 0x00 */ struct ListAlloc* prev; + /* 0x04 */ struct ListAlloc* next; +} ListAlloc; // size = 0x8 + +ListAlloc* ListAlloc_Init(ListAlloc* this); +void* ListAlloc_Alloc(ListAlloc* this, u32 size); +void ListAlloc_Free(ListAlloc* this, void* data); +void ListAlloc_FreeAll(ListAlloc* this); + +#endif diff --git a/include/macros.h b/include/macros.h deleted file mode 100644 index 343484028d..0000000000 --- a/include/macros.h +++ /dev/null @@ -1,197 +0,0 @@ -#ifndef MACROS_H -#define MACROS_H - -#include "terminal.h" -#include "versions.h" - -#ifndef AVOID_UB -#define BAD_RETURN(type) type -#else -#define BAD_RETURN(type) void -#endif - -/** - * The T macro holds translations in English for original debug strings written in Japanese. - * The translated strings match the original debug strings, they are only direct translations. - * For example, any original name is left as is rather than being replaced with the name in the codebase. - */ -#define T(jp, en) jp - -#define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0])) -#define ARRAY_COUNTU(arr) (u32)(sizeof(arr) / sizeof(arr[0])) -#define ARRAY_COUNT_2D(arr) (s32)(sizeof(arr) / sizeof(arr[0][0])) - -#define PHYSICAL_TO_VIRTUAL(addr) (void*)((uintptr_t)(addr) + 0x80000000) -#define VIRTUAL_TO_PHYSICAL(addr) (uintptr_t)((u8*)(addr) - 0x80000000) - -#define ABS(x) ((x) >= 0 ? (x) : -(x)) -#define DECR(x) ((x) == 0 ? 0 : --(x)) -#define CLAMP(x, min, max) ((x) < (min) ? (min) : (x) > (max) ? (max) : (x)) -#define CLAMP_MAX(x, max) ((x) > (max) ? (max) : (x)) -#define CLAMP_MIN(x, min) ((x) < (min) ? (min) : (x)) - -#define SWAP(type, a, b) \ - { \ - type _temp = (a); \ - (a) = (b); \ - (b) = _temp; \ - } \ - (void)0 - -#define RGBA8(r, g, b, a) ((((r) & 0xFF) << 24) | (((g) & 0xFF) << 16) | (((b) & 0xFF) << 8) | (((a) & 0xFF) << 0)) - -#define CHECK_FLAG_ALL(flags, mask) (((flags) & (mask)) == (mask)) - -// IDO doesn't support variadic macros, but it merely throws a warning for the -// number of arguments not matching the definition (warning 609) instead of -// throwing an error. We suppress this warning and rely on GCC to catch macro -// argument errors instead. -// Note some tools define __sgi but preprocess with a modern cpp implementation, -// ensure that these do not use the IDO workaround to avoid errors. -#define IDO_PRINTF_WORKAROUND (__sgi && !__GNUC__ && !M2CTX) - -#if DEBUG_FEATURES -#define PRINTF osSyncPrintf -#elif defined(EGCS) -#define PRINTF(format, args...) while (0) osSyncPrintf(format, ##args) -#elif IDO_PRINTF_WORKAROUND -#define PRINTF(args) (void)0 -#else -#define PRINTF(format, ...) (void)0 -#endif - -#if DEBUG_FEATURES -#define PRINTF_COLOR_BLACK() PRINTF(VT_FGCOL(BLACK)) -#define PRINTF_COLOR_RED() PRINTF(VT_FGCOL(RED)) -#define PRINTF_COLOR_GREEN() PRINTF(VT_FGCOL(GREEN)) -#define PRINTF_COLOR_YELLOW() PRINTF(VT_FGCOL(YELLOW)) -#define PRINTF_COLOR_BLUE() PRINTF(VT_FGCOL(BLUE)) -#define PRINTF_COLOR_MAGENTA() PRINTF(VT_FGCOL(MAGENTA)) -#define PRINTF_COLOR_CYAN() PRINTF(VT_FGCOL(CYAN)) -#define PRINTF_COLOR_WHITE() PRINTF(VT_FGCOL(WHITE)) -#define PRINTF_COLOR_WARNING() PRINTF(VT_COL(YELLOW, BLACK)) -#define PRINTF_COLOR_ERROR() PRINTF(VT_COL(RED, WHITE)) -#define PRINTF_RST() PRINTF(VT_RST) -#else -#define PRINTF_COLOR_BLACK() (void)0 -#define PRINTF_COLOR_RED() (void)0 -#define PRINTF_COLOR_GREEN() (void)0 -#define PRINTF_COLOR_YELLOW() (void)0 -#define PRINTF_COLOR_BLUE() (void)0 -#define PRINTF_COLOR_MAGENTA() (void)0 -#define PRINTF_COLOR_CYAN() (void)0 -#define PRINTF_COLOR_WHITE() (void)0 -#define PRINTF_COLOR_WARNING() (void)0 -#define PRINTF_COLOR_ERROR() (void)0 -#define PRINTF_RST() (void)0 -#endif - -#if DEBUG_FEATURES -#define LOG(exp, value, format, file, line) \ - do { \ - LogUtils_LogThreadId(file, line); \ - osSyncPrintf(exp " = " format "\n", value); \ - } while (0) -#else -#define LOG(exp, value, format, file, line) (void)(value) -#endif - -#define LOG_STRING(string, file, line) LOG(#string, string, "%s", file, line) -#define LOG_ADDRESS(exp, value, file, line) LOG(exp, value, "%08x", file, line) -#define LOG_TIME(exp, value, file, line) LOG(exp, value, "%lld", file, line) -#define LOG_NUM(exp, value, file, line) LOG(exp, value, "%d", file, line) -#define LOG_HEX(exp, value, file, line) LOG(exp, value, "%x", file, line) -#define LOG_HEX32(exp, value, file, line) LOG(exp, value, "%08x", file, line) -#define LOG_FLOAT(exp, value, file, line) LOG(exp, value, "%f", file, line) - -#define SET_NEXT_GAMESTATE(curState, newInit, newStruct) \ - if (1) { \ - GameState* state = curState; \ - \ - (state)->init = newInit; \ - (state)->size = sizeof(newStruct); \ - } (void)0 - -#if DEBUG_FEATURES - -#define DMA_REQUEST_SYNC(ram, vrom, size, file, line) DmaMgr_RequestSyncDebug(ram, vrom, size, file, line) -#define DMA_REQUEST_ASYNC(req, ram, vrom, size, unk5, queue, msg, file, line) DmaMgr_RequestAsyncDebug(req, ram, vrom, size, unk5, queue, msg, file, line) -#define GAME_STATE_ALLOC(gameState, size, file, line) GameState_Alloc(gameState, size, file, line) -#define DEBUG_ARENA_MALLOC(size, file, line) DebugArena_MallocDebug(size, file, line) -#define DEBUG_ARENA_MALLOC_R(size, file, line) DebugArena_MallocRDebug(size, file, line) -#define DEBUG_ARENA_FREE(size, file, line) DebugArena_FreeDebug(size, file, line) -#define SYSTEM_ARENA_MALLOC(size, file, line) SystemArena_MallocDebug(size, file, line) -#define SYSTEM_ARENA_MALLOC_R(size, file, line) SystemArena_MallocRDebug(size, file, line) -#define SYSTEM_ARENA_FREE(size, file, line) SystemArena_FreeDebug(size, file, line) -#define LOG_UTILS_CHECK_NULL_POINTER(exp, ptr, file, line) LogUtils_CheckNullPointer(exp, ptr, file, line) -#define LOG_UTILS_CHECK_VALID_POINTER(exp, ptr, file, line) LogUtils_CheckValidPointer(exp, ptr, file, line) -#define GAME_ALLOC_MALLOC(alloc, size, file, line) GameAlloc_MallocDebug(alloc, size, file, line) - -#else - -#define DMA_REQUEST_SYNC(ram, vrom, size, file, line) DmaMgr_RequestSync(ram, vrom, size) -#define DMA_REQUEST_ASYNC(req, ram, vrom, size, unk5, queue, msg, file, line) DmaMgr_RequestAsync(req, ram, vrom, size, unk5, queue, msg) -#define GAME_STATE_ALLOC(gameState, size, file, line) THA_AllocTailAlign16(&(gameState)->tha, size) -#define DEBUG_ARENA_MALLOC(size, file, line) DebugArena_Malloc(size) -#define DEBUG_ARENA_MALLOC_R(size, file, line) DebugArena_MallocR(size) -#define DEBUG_ARENA_FREE(size, file, line) DebugArena_Free(size) -#define SYSTEM_ARENA_MALLOC(size, file, line) SystemArena_Malloc(size) -#define SYSTEM_ARENA_MALLOC_R(size, file, line) SystemArena_MallocR(size) -#define SYSTEM_ARENA_FREE(size, file, line) SystemArena_Free(size) -#define LOG_UTILS_CHECK_NULL_POINTER(exp, ptr, file, line) (void)0 -#define LOG_UTILS_CHECK_VALID_POINTER(exp, ptr, file, line) (void)0 -#define GAME_ALLOC_MALLOC(alloc, size, file, line) GameAlloc_Malloc(alloc, size) - -#endif - -#if PLATFORM_N64 || DEBUG_FEATURES -#define HUNGUP_AND_CRASH(file, line) Fault_AddHungupAndCrash(file, line) -#else -#define HUNGUP_AND_CRASH(file, line) LogUtils_HungupThread(file, line) -#endif - -#define MATRIX_FINALIZE_AND_LOAD(pkt, gfxCtx, file, line) \ - gSPMatrix(pkt, MATRIX_FINALIZE(gfxCtx, file, line), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW) - -#if OOT_NTSC -#define LANGUAGE_ARRAY(jpn, eng, ger, fra) { jpn, eng } -#else -#define LANGUAGE_ARRAY(jpn, eng, ger, fra) { eng, ger, fra } -#endif - -/** - * `x` vertex x - * `y` vertex y - * `z` vertex z - * `s` texture s coordinate - * `t` texture t coordinate - * `crnx` red component of color vertex, or x component of normal vertex - * `cgny` green component of color vertex, or y component of normal vertex - * `cbnz` blue component of color vertex, or z component of normal vertex - * `a` alpha - */ -#define VTX(x,y,z,s,t,crnx,cgny,cbnz,a) { { { x, y, z }, 0, { s, t }, { crnx, cgny, cbnz, a } } } - -#define VTX_T(x,y,z,s,t,cr,cg,cb,a) { { x, y, z }, 0, { s, t }, { cr, cg, cb, a } } - -#define gDPSetTileCustom(pkt, fmt, siz, uls, ult, lrs, lrt, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ -_DW({ \ - gDPPipeSync(pkt); \ - gDPTileSync(pkt); \ - gDPSetTile(pkt, fmt, siz, \ - (((((lrs) - (uls) + 1) * siz##_TILE_BYTES) + 7) >> 3), 0, \ - G_TX_LOADTILE, 0, cmt, maskt, shiftt, cms, masks, \ - shifts); \ - gDPTileSync(pkt); \ - gDPSetTile(pkt, fmt, siz, \ - (((((lrs) - (uls) + 1) * siz##_LINE_BYTES) + 7) >> 3), 0, \ - G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, shifts); \ - gDPSetTileSize(pkt, G_TX_RENDERTILE, \ - (uls) << G_TEXTURE_IMAGE_FRAC, \ - (ult) << G_TEXTURE_IMAGE_FRAC, \ - (lrs) << G_TEXTURE_IMAGE_FRAC, \ - (lrt) << G_TEXTURE_IMAGE_FRAC); \ -}) - -#endif diff --git a/include/map.h b/include/map.h index 23d3eb3c88..ef82c03554 100644 --- a/include/map.h +++ b/include/map.h @@ -67,6 +67,9 @@ typedef struct MapData { #define MAP_48x85_TEX_HEIGHT 85 #define MAP_48x85_TEX_SIZE ((MAP_48x85_TEX_WIDTH * MAP_48x85_TEX_HEIGHT) / 2) // 48x85 CI4 texture +extern MapData gMapDataTable; +extern MapData* gMapData; + void Map_SavePlayerInitialInfo(struct PlayState* play); void Map_SetFloorPalettesData(struct PlayState* play, s16 floor); void Map_InitData(struct PlayState* play, s16 room); diff --git a/include/map_select_state.h b/include/map_select_state.h new file mode 100644 index 0000000000..d2a6b43d19 --- /dev/null +++ b/include/map_select_state.h @@ -0,0 +1,41 @@ +#ifndef MAP_SELECT_STATE_H +#define MAP_SELECT_STATE_H + +#include "ultra64.h" +#include "z64game.h" +#include "z64view.h" + +struct MapSelectState; + +typedef struct MapSelectEntry { + /* 0x00 */ char* name; + /* 0x04 */ void (*loadFunc)(struct MapSelectState*, s32); + /* 0x08 */ s32 entranceIndex; +} MapSelectEntry; // size = 0xC + +typedef struct MapSelectState { + /* 0x0000 */ GameState state; + /* 0x00A8 */ View view; + /* 0x01D0 */ s32 count; + /* 0x01D4 */ MapSelectEntry* entries; + /* 0x01D8 */ s32 currentEntry; + /* 0x01DC */ s32 pageDownIndex; // Index of pageDownStops + /* 0x01E0 */ s32 pageDownStops[7]; + /* 0x01FC */ char unk_1FC[0x0C]; + /* 0x0208 */ s32 opt; + /* 0x020C */ s32 topDisplayedEntry; // The entry which is currently at the top of the screen + /* 0x0210 */ char unk_210[0x0C]; + /* 0x021C */ s32 verticalInputAccumulator; + /* 0x0220 */ s32 verticalInput; + /* 0x0224 */ s32 timerUp; + /* 0x0228 */ s32 timerDown; + /* 0x022C */ s32 lockUp; + /* 0x0230 */ s32 lockDown; + /* 0x0234 */ s32 unk_234; // unused + /* 0x0238 */ u8* staticSegment; +} MapSelectState; // size = 0x240 + +void MapSelect_Init(GameState* thisx); +void MapSelect_Destroy(GameState* thisx); + +#endif diff --git a/include/memory_utils.h b/include/memory_utils.h new file mode 100644 index 0000000000..7a8d9aca91 --- /dev/null +++ b/include/memory_utils.h @@ -0,0 +1,9 @@ +#ifndef MEMORY_UTILS_H +#define MEMORY_UTILS_H + +#include "ultra64.h" + +void* MemCpy(void* dest, const void* src, s32 len); +void* MemSet(void* dest, s32 val, s32 len); + +#endif diff --git a/include/mio0.h b/include/mio0.h new file mode 100644 index 0000000000..d350b45551 --- /dev/null +++ b/include/mio0.h @@ -0,0 +1,8 @@ +#ifndef MIO0_H +#define MIO0_H + +#include "ultra64.h" + +void Mio0_Decompress(u8* src, u8* dst); + +#endif diff --git a/include/prenmi_buff.h b/include/prenmi_buff.h new file mode 100644 index 0000000000..b0a9e66f72 --- /dev/null +++ b/include/prenmi_buff.h @@ -0,0 +1,25 @@ +#ifndef PRENMI_BUFF_H +#define PRENMI_BUFF_H + +#include "ultra64.h" +#include "alignment.h" + +// This struct is used at osAppNMIBuffer which is not at an 8-byte aligned address. This causes an unaligned access +// crash if the OSTime variables use 64-bit load/store instructions, which is the case in any MIPS ABI other than O32 +// where 64-bit load/store instructions are emulated with 2x 32-bit load/store instructions. The alignment attribute +// conveys that this structure will not always be 8-bytes aligned, allowing a modern compiler to generate non-crashing +// code for accessing these. This is not an issue in the original compiler as it only output O32 ABI code. +ALIGNED(4) typedef struct PreNmiBuff { + /* 0x00 */ u32 resetting; + /* 0x04 */ u32 resetCount; + /* 0x08 */ OSTime duration; + /* 0x10 */ OSTime resetTime; +} PreNmiBuff; // size = 0x18 (actually osAppNMIBuffer is 0x40 bytes large but the rest is unused) + +extern PreNmiBuff* gAppNmiBufferPtr; + +void PreNmiBuff_Init(PreNmiBuff* this); +void PreNmiBuff_SetReset(PreNmiBuff* this); +u32 PreNmiBuff_IsResetting(PreNmiBuff* this); + +#endif diff --git a/include/prenmi_state.h b/include/prenmi_state.h new file mode 100644 index 0000000000..3710425ca9 --- /dev/null +++ b/include/prenmi_state.h @@ -0,0 +1,16 @@ +#ifndef PRENMI_STATE_H +#define PRENMI_STATE_H + +#include "ultra64.h" +#include "z64game.h" + +typedef struct PreNMIState { + /* 0x00 */ GameState state; + /* 0xA4 */ u32 timer; + /* 0xA8 */ s32 unk_A8; +} PreNMIState; // size = 0xAC + +void PreNMI_Init(GameState* thisx); +void PreNMI_Destroy(GameState* thisx); + +#endif diff --git a/include/prerender.h b/include/prerender.h index ca16826341..0674fac020 100644 --- a/include/prerender.h +++ b/include/prerender.h @@ -2,11 +2,7 @@ #define PRERENDER_H #include "ultra64/ultratypes.h" - -typedef struct ListAlloc { - /* 0x00 */ struct ListAlloc* prev; - /* 0x04 */ struct ListAlloc* next; -} ListAlloc; // size = 0x8 +#include "listalloc.h" typedef struct PreRender { /* 0x00 */ s32 width; @@ -30,4 +26,19 @@ typedef struct PreRender { /* 0x4C */ u32 unk_4C; } PreRender; // size = 0x50 +void PreRender_SetValuesSave(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf, void* cvg); +void PreRender_Init(PreRender* this); +void PreRender_SetValues(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf); +void PreRender_Destroy(PreRender* this); +void func_800C170C(PreRender* this, Gfx** gfxP, void* buf, void* bufSave, u32 r, u32 g, u32 b, u32 a); +void func_800C1AE8(PreRender* this, Gfx** gfxP, void* fbuf, void* fbufSave); +void PreRender_SaveZBuffer(PreRender* this, Gfx** gfxP); +void PreRender_SaveFramebuffer(PreRender* this, Gfx** gfxP); +void PreRender_DrawCoverage(PreRender* this, Gfx** gfxP); +void PreRender_RestoreZBuffer(PreRender* this, Gfx** gfxP); +void func_800C213C(PreRender* this, Gfx** gfxP); +void PreRender_RestoreFramebuffer(PreRender* this, Gfx** gfxP); +void PreRender_CopyImageRegion(PreRender* this, Gfx** gfxP); +void PreRender_ApplyFilters(PreRender* this); + #endif diff --git a/include/printf.h b/include/printf.h new file mode 100644 index 0000000000..a2a31a39e5 --- /dev/null +++ b/include/printf.h @@ -0,0 +1,51 @@ +#ifndef PRINTF_H +#define PRINTF_H + +#include "terminal.h" +#include "ultra64.h" + +// IDO doesn't support variadic macros, but it merely throws a warning for the +// number of arguments not matching the definition (warning 609) instead of +// throwing an error. We suppress this warning and rely on GCC to catch macro +// argument errors instead. +// Note some tools define __sgi but preprocess with a modern cpp implementation, +// ensure that these do not use the IDO workaround to avoid errors. +#define IDO_PRINTF_WORKAROUND (__sgi && !__GNUC__ && !M2CTX) + +#if DEBUG_FEATURES +#define PRINTF osSyncPrintf +#elif defined(EGCS) +#define PRINTF(format, args...) while (0) osSyncPrintf(format, ##args) +#elif IDO_PRINTF_WORKAROUND +#define PRINTF(args) (void)0 +#else +#define PRINTF(format, ...) (void)0 +#endif + +#if DEBUG_FEATURES +#define PRINTF_COLOR_BLACK() PRINTF(VT_FGCOL(BLACK)) +#define PRINTF_COLOR_RED() PRINTF(VT_FGCOL(RED)) +#define PRINTF_COLOR_GREEN() PRINTF(VT_FGCOL(GREEN)) +#define PRINTF_COLOR_YELLOW() PRINTF(VT_FGCOL(YELLOW)) +#define PRINTF_COLOR_BLUE() PRINTF(VT_FGCOL(BLUE)) +#define PRINTF_COLOR_MAGENTA() PRINTF(VT_FGCOL(MAGENTA)) +#define PRINTF_COLOR_CYAN() PRINTF(VT_FGCOL(CYAN)) +#define PRINTF_COLOR_WHITE() PRINTF(VT_FGCOL(WHITE)) +#define PRINTF_COLOR_WARNING() PRINTF(VT_COL(YELLOW, BLACK)) +#define PRINTF_COLOR_ERROR() PRINTF(VT_COL(RED, WHITE)) +#define PRINTF_RST() PRINTF(VT_RST) +#else +#define PRINTF_COLOR_BLACK() (void)0 +#define PRINTF_COLOR_RED() (void)0 +#define PRINTF_COLOR_GREEN() (void)0 +#define PRINTF_COLOR_YELLOW() (void)0 +#define PRINTF_COLOR_BLUE() (void)0 +#define PRINTF_COLOR_MAGENTA() (void)0 +#define PRINTF_COLOR_CYAN() (void)0 +#define PRINTF_COLOR_WHITE() (void)0 +#define PRINTF_COLOR_WARNING() (void)0 +#define PRINTF_COLOR_ERROR() (void)0 +#define PRINTF_RST() (void)0 +#endif + +#endif diff --git a/include/regs.h b/include/regs.h index 89cb022bc9..509f5ea583 100644 --- a/include/regs.h +++ b/include/regs.h @@ -1,8 +1,11 @@ #ifndef REGS_H #define REGS_H +#include "ultra64.h" #include "versions.h" +struct PlayState; + #define REG_GROUPS 29 // number of REG groups, i.e. REG, SREG, OREG, etc. #define REG_PAGES 6 #define REGS_PER_PAGE 16 @@ -419,6 +422,8 @@ typedef struct RegEditor { /* 0x14 */ s16 data[REG_GROUPS * REGS_PER_GROUP]; // Accessed through *REG macros, see regs.h } RegEditor; // size = 0x15D4 +void Regs_InitData(struct PlayState* play); + extern RegEditor* gRegEditor; #endif diff --git a/include/sample_state.h b/include/sample_state.h new file mode 100644 index 0000000000..b568a83f95 --- /dev/null +++ b/include/sample_state.h @@ -0,0 +1,17 @@ +#ifndef SAMPLE_STATE_H +#define SAMPLE_STATE_H + +#include "ultra64.h" +#include "z64game.h" +#include "z64view.h" + +typedef struct SampleState { + /* 0x0000 */ GameState state; + /* 0x00A4 */ u8* staticSegment; + /* 0x00A8 */ View view; +} SampleState; // size = 0x1D0 + +void Sample_Init(GameState* thisx); +void Sample_Destroy(GameState* thisx); + +#endif diff --git a/include/sched.h b/include/sched.h index 2d20e7ec09..bf204bc6d9 100644 --- a/include/sched.h +++ b/include/sched.h @@ -69,6 +69,7 @@ typedef struct Scheduler { void Sched_Notify(Scheduler* sc); void Sched_Init(Scheduler* sc, void* stack, OSPri priority, u8 viModeType, UNK_TYPE arg4, IrqMgr* irqMgr); +void Sched_FlushTaskQueue(void); extern Scheduler gScheduler; diff --git a/include/segment_symbols.h b/include/segment_symbols.h index 1aacb246d0..d036e7cec0 100644 --- a/include/segment_symbols.h +++ b/include/segment_symbols.h @@ -1,8 +1,8 @@ #ifndef SEGMENT_SYMBOLS_H #define SEGMENT_SYMBOLS_H +#include "ultra64/ultratypes.h" #include "versions.h" -#include "z64.h" #define DECLARE_SEGMENT(name) \ extern u8 _##name##SegmentStart[]; \ diff --git a/include/seqcmd.h b/include/seqcmd.h index 5acce7c493..53fce27bfb 100644 --- a/include/seqcmd.h +++ b/include/seqcmd.h @@ -56,7 +56,7 @@ typedef enum SeqCmdSetupCmdOp { // Subset of `SEQCMD_OP_GLOBAL_CMD` typedef enum SeqCmdSubCmdOp { - /* 0x0 */ SEQCMD_SUB_OP_GLOBAL_SET_SOUND_MODE, + /* 0x0 */ SEQCMD_SUB_OP_GLOBAL_SET_SOUND_OUTPUT_MODE, /* 0x1 */ SEQCMD_SUB_OP_GLOBAL_DISABLE_NEW_SEQUENCES } SeqCmdSubCmdOp; @@ -479,12 +479,12 @@ typedef enum SeqCmdSubCmdOp { */ /** - * Change the sound mode of audio + * Change the sound output mode * - * @param soundMode see the `SoundMode` enum + * @param soundOutputMode see the `SoundOutputMode` enum */ -#define SEQCMD_SET_SOUND_MODE(soundMode) \ - Audio_QueueSeqCmd((SEQCMD_OP_GLOBAL_CMD << 28) | (SEQCMD_SUB_OP_GLOBAL_SET_SOUND_MODE << 8) | (u8)(soundMode)) +#define SEQCMD_SET_SOUND_OUTPUT_MODE(soundOutputMode) \ + Audio_QueueSeqCmd((SEQCMD_OP_GLOBAL_CMD << 28) | (SEQCMD_SUB_OP_GLOBAL_SET_SOUND_OUTPUT_MODE << 8) | (u8)(soundOutputMode)) /** * Disable (or reenable) new sequences from starting diff --git a/include/setup_state.h b/include/setup_state.h new file mode 100644 index 0000000000..863b71401e --- /dev/null +++ b/include/setup_state.h @@ -0,0 +1,13 @@ +#ifndef SETUP_STATE_H +#define SETUP_STATE_H + +#include "z64game.h" + +typedef struct SetupState { + /* 0x00 */ GameState state; +} SetupState; // size = 0xA4 + +void Setup_Init(GameState* thisx); +void Setup_Destroy(GameState* thisx); + +#endif diff --git a/include/sfx.h b/include/sfx.h index 16d0b122d3..4dfb96f9b4 100644 --- a/include/sfx.h +++ b/include/sfx.h @@ -6,6 +6,8 @@ #include "z64math.h" #include "libc/assert.h" +#define MAX_CHANNELS_PER_BANK 3 + typedef enum SfxBankType { /* 0 */ BANK_PLAYER, /* 1 */ BANK_ITEM, @@ -178,4 +180,36 @@ extern Vec3f gSfxDefaultPos; extern f32 gSfxDefaultFreqAndVolScale; extern s8 gSfxDefaultReverb; +extern SfxParams* gSfxParams[7]; +extern char D_80133390[]; +extern char D_80133398[]; +extern u8 gSfxRequestWriteIndex; +extern u8 gSfxRequestReadIndex; +extern SfxBankEntry* gSfxBanks[7]; +extern u8 gSfxBankSizes[]; +extern u8 gSfxChannelLayout; +extern u16 D_801333D0; +extern Vec3f gSfxDefaultPos; +extern f32 gSfxDefaultFreqAndVolScale; +extern s8 gSfxDefaultReverb; + +#if DEBUG_FEATURES +extern u8 D_801333F0; +extern u8 gAudioSfxSwapOff; +extern u8 D_801333F8; +#endif + +extern SfxBankEntry D_8016BAD0[9]; +extern SfxBankEntry D_8016BC80[12]; +extern SfxBankEntry D_8016BEC0[22]; +extern SfxBankEntry D_8016C2E0[20]; +extern SfxBankEntry D_8016C6A0[8]; +extern SfxBankEntry D_8016C820[3]; +extern SfxBankEntry D_8016C8B0[5]; +extern ActiveSfx gActiveSfx[7][MAX_CHANNELS_PER_BANK]; // total size = 0xA8 +extern u8 gSfxBankMuted[]; +extern u16 gAudioSfxSwapSource[10]; +extern u16 gAudioSfxSwapTarget[10]; +extern u8 gAudioSfxSwapMode[10]; + #endif diff --git a/include/speed_meter.h b/include/speed_meter.h index 393c89de8d..f8779902f9 100644 --- a/include/speed_meter.h +++ b/include/speed_meter.h @@ -1,7 +1,7 @@ #ifndef SPEEDMETER_H #define SPEEDMETER_H -#include "ultra64/ultratypes.h" +#include "ultra64.h" struct GraphicsContext; struct GameState; @@ -12,6 +12,20 @@ typedef struct SpeedMeter { /* 0x1C */ s32 y; } SpeedMeter; // size = 0x20 +extern volatile OSTime gAudioThreadUpdateTimeTotalPerGfxTask; +extern volatile OSTime gGfxTaskSentToNextReadyMinusAudioThreadUpdateTime; +extern volatile OSTime gRSPAudioTimeTotal; +extern volatile OSTime gRSPGfxTimeTotal; +extern volatile OSTime gRDPTimeTotal; +extern volatile OSTime gGraphUpdatePeriod; +extern volatile OSTime gAudioThreadUpdateTimeStart; +extern volatile OSTime gAudioThreadUpdateTimeAcc; +extern volatile OSTime gRSPAudioTimeAcc; +extern volatile OSTime gRSPGfxTimeAcc; +extern volatile OSTime gRSPOtherTimeAcc; +extern volatile OSTime D_8016A578; +extern volatile OSTime gRDPTimeAcc; + void SpeedMeter_Init(SpeedMeter* this); void SpeedMeter_Destroy(SpeedMeter* this); void SpeedMeter_DrawTimeEntries(SpeedMeter* this, struct GraphicsContext* gfxCtx); diff --git a/include/sys_cfb.h b/include/sys_cfb.h new file mode 100644 index 0000000000..5b7039175d --- /dev/null +++ b/include/sys_cfb.h @@ -0,0 +1,10 @@ +#ifndef SYS_CFB_H +#define SYS_CFB_H + +#include "ultra64.h" + +void SysCfb_Init(s32 n64dd); +void* SysCfb_GetFbPtr(s32 idx); +void* SysCfb_GetFbEnd(void); + +#endif diff --git a/include/sys_debug_controller.h b/include/sys_debug_controller.h new file mode 100644 index 0000000000..0345d85aaf --- /dev/null +++ b/include/sys_debug_controller.h @@ -0,0 +1,13 @@ +#ifndef SYS_DEBUG_CONTROLLER_H +#define SYS_DEBUG_CONTROLLER_H + +#include "ultra64/ultratypes.h" + +#if DEBUG_FEATURES +extern u32 gIsCtrlr2Valid; + +void func_800D31F0(void); +void func_800D3210(void); +#endif + +#endif diff --git a/include/sys_freeze.h b/include/sys_freeze.h new file mode 100644 index 0000000000..0e033cacd9 --- /dev/null +++ b/include/sys_freeze.h @@ -0,0 +1,8 @@ +#ifndef SYS_FREEZE_H +#define SYS_FREEZE_H + +#include "attributes.h" + +NORETURN void func_800D31A0(void); + +#endif diff --git a/include/sys_matrix.h b/include/sys_matrix.h index 1d136a06ee..2708af81ee 100644 --- a/include/sys_matrix.h +++ b/include/sys_matrix.h @@ -11,8 +11,8 @@ typedef enum MatrixMode { /* 1 */ MTXMODE_APPLY // applies transformation to the current matrix } MatrixMode; -extern Mtx gMtxClear; -extern MtxF gMtxFClear; +extern Mtx gIdentityMtx; +extern MtxF gIdentityMtxF; /* Stack operations */ @@ -64,6 +64,9 @@ Mtx* Matrix_Finalize(struct GraphicsContext* gfxCtx); #endif +#define MATRIX_FINALIZE_AND_LOAD(pkt, gfxCtx, file, line) \ + gSPMatrix(pkt, MATRIX_FINALIZE(gfxCtx, file, line), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW) + /* Vector operations */ void Matrix_MultVec3f(Vec3f* src, Vec3f* dest); diff --git a/include/sys_ucode.h b/include/sys_ucode.h new file mode 100644 index 0000000000..fa690d4784 --- /dev/null +++ b/include/sys_ucode.h @@ -0,0 +1,11 @@ +#ifndef SYS_UCODE_H +#define SYS_UCODE_H + +#include "ultra64.h" + +u64* SysUcode_GetUCodeBoot(void); +size_t SysUcode_GetUCodeBootSize(void); +u64* SysUcode_GetUCode(void); +u64* SysUcode_GetUCodeData(void); + +#endif diff --git a/include/title_setup_state.h b/include/title_setup_state.h new file mode 100644 index 0000000000..30219872a8 --- /dev/null +++ b/include/title_setup_state.h @@ -0,0 +1,15 @@ +#ifndef TITLE_SETUP_STATE_H +#define TITLE_SETUP_STATE_H + +#include "z64game.h" +#include "z64view.h" + +typedef struct TitleSetupState { + /* 0x0000 */ GameState state; + /* 0x00A8 */ View view; +} TitleSetupState; // size = 0x1D0 + +void TitleSetup_Init(GameState* thisx); +void TitleSetup_Destroy(GameState* thisx); + +#endif diff --git a/include/transition_circle.h b/include/transition_circle.h new file mode 100644 index 0000000000..23dec1d9d5 --- /dev/null +++ b/include/transition_circle.h @@ -0,0 +1,55 @@ +#ifndef TRANSITION_CIRCLE_H +#define TRANSITION_CIRCLE_H + +#include "ultra64.h" +#include "color.h" + +typedef enum TransitionCircleAppearance { + /* 0 */ TCA_NORMAL, + /* 1 */ TCA_WAVE, + /* 2 */ TCA_RIPPLE, + /* 3 */ TCA_STARBURST +} TransitionCircleAppearance; + +typedef enum TransitionCircleColor { + /* 0 */ TCC_BLACK, + /* 1 */ TCC_WHITE, + /* 2 */ TCC_GRAY, + /* 3 */ TCC_SPECIAL // color varies depending on appearance. unused and appears broken +} TransitionCircleColor; + +typedef enum TransitionCircleSpeed { + /* 0 */ TCS_FAST, + /* 1 */ TCS_SLOW +} TransitionCircleSpeed; + +typedef struct TransitionCircle { + /* 0x000 */ Color_RGBA8_u32 color; + /* 0x004 */ Color_RGBA8_u32 unkColor; + /* 0x008 */ s32 texX; + /* 0x00C */ s32 texY; + /* 0x010 */ s32 speed; + /* 0x014 */ u8 direction; + /* 0x015 */ u8 colorType; + /* 0x016 */ u8 speedType; + /* 0x017 */ u8 appearanceType; + /* 0x018 */ u8 isDone; + /* 0x019 */ u8 frame; + /* 0x01A */ u16 normal; + /* 0x020 */ Mtx projection; + /* 0x060 */ Mtx lookAt; + /* 0x0A0 */ void* texture; + /* 0x0A8 */ Mtx modelView[2][3]; +} TransitionCircle; // size = 0x228 + +void TransitionCircle_Start(void* thisx); +void* TransitionCircle_Init(void* thisx); +void TransitionCircle_Destroy(void* thisx); +void TransitionCircle_Update(void* thisx, s32 updateRate); +void TransitionCircle_Draw(void* thisx, Gfx** gfxP); +s32 TransitionCircle_IsDone(void* thisx); +void TransitionCircle_SetType(void* thisx, s32 type); +void TransitionCircle_SetColor(void* thisx, u32 color); +void TransitionCircle_SetUnkColor(void* thisx, u32 color); + +#endif diff --git a/include/transition_fade.h b/include/transition_fade.h new file mode 100644 index 0000000000..be4e575e0c --- /dev/null +++ b/include/transition_fade.h @@ -0,0 +1,24 @@ +#ifndef TRANSITION_FADE_H +#define TRANSITION_FADE_H + +#include "ultra64.h" +#include "color.h" + +typedef struct TransitionFade { + /* 0x000 */ u8 type; + /* 0x001 */ u8 isDone; + /* 0x002 */ u8 direction; + /* 0x004 */ Color_RGBA8_u32 color; + /* 0x008 */ u16 timer; +} TransitionFade; // size = 0xC + +void TransitionFade_Start(void* thisx); +void* TransitionFade_Init(void* thisx); +void TransitionFade_Destroy(void* thisx); +void TransitionFade_Update(void* thisx, s32 updateRate); +void TransitionFade_Draw(void* thisx, Gfx** gfxP); +s32 TransitionFade_IsDone(void* thisx); +void TransitionFade_SetColor(void* thisx, u32 color); +void TransitionFade_SetType(void* thisx, s32 type); + +#endif diff --git a/include/transition_tile.h b/include/transition_tile.h new file mode 100644 index 0000000000..14191f3fe7 --- /dev/null +++ b/include/transition_tile.h @@ -0,0 +1,30 @@ +#ifndef TRANSITION_TILE_H +#define TRANSITION_TILE_H + +#include "ultra64.h" + +typedef struct TransitionTileVtxData { + /* 0x0 */ f32 x; + /* 0x4 */ f32 y; +} TransitionTileVtxData; // size = 0x8 + +typedef struct TransitionTile { + /* 0x00 */ s32 cols; + /* 0x04 */ s32 rows; + /* 0x08 */ s32 frame; + /* 0x0C */ TransitionTileVtxData* vtxData; + /* 0x10 */ Vtx* vtxFrame1; + /* 0x14 */ Vtx* vtxFrame2; + /* 0x18 */ Mtx projection; + /* 0x58 */ Mtx modelView; + /* 0x98 */ Mtx unk_98; + /* 0xD8 */ Gfx* gfx; // "gfxtbl" + /* 0xDC */ u16* zBuffer; +} TransitionTile; // size = 0xE0 + +TransitionTile* TransitionTile_Init(TransitionTile* this, s32 cols, s32 rows); +void TransitionTile_Destroy(TransitionTile* this); +void TransitionTile_Update(TransitionTile* this); +void TransitionTile_Draw(TransitionTile* this, Gfx** gfxP); + +#endif diff --git a/include/transition_triforce.h b/include/transition_triforce.h new file mode 100644 index 0000000000..85eb1597ea --- /dev/null +++ b/include/transition_triforce.h @@ -0,0 +1,27 @@ +#ifndef TRANSITION_TRIFORCE_H +#define TRANSITION_TRIFORCE_H + +#include "ultra64.h" +#include "color.h" + +typedef struct TransitionTriforce { + /* 0x000 */ Color_RGBA8_u32 color; + /* 0x004 */ f32 transPos; + /* 0x008 */ f32 step; + /* 0x00C */ s32 state; + /* 0x010 */ s32 type; + /* 0x018 */ Mtx projection; + /* 0x058 */ s32 frame; + /* 0x060 */ Mtx modelView[2][3]; +} TransitionTriforce; // size = 0x1E0 + +void TransitionTriforce_Start(void* thisx); +void* TransitionTriforce_Init(void* thisx); +void TransitionTriforce_Destroy(void* thisx); +void TransitionTriforce_Update(void* thisx, s32 updateRate); +void TransitionTriforce_SetColor(void* thisx, u32 color); +void TransitionTriforce_SetType(void* thisx, s32 type); +void TransitionTriforce_Draw(void* thisx, Gfx** gfxP); +s32 TransitionTriforce_IsDone(void* thisx); + +#endif diff --git a/include/transition_wipe.h b/include/transition_wipe.h new file mode 100644 index 0000000000..654e9b6230 --- /dev/null +++ b/include/transition_wipe.h @@ -0,0 +1,30 @@ +#ifndef TRANSITION_WIPE_H +#define TRANSITION_WIPE_H + +#include "ultra64.h" +#include "color.h" + +typedef struct TransitionWipe { + /* 0x000 */ Color_RGBA8_u32 color; + /* 0x004 */ Color_RGBA8_u32 unkColor; + /* 0x008 */ u8 direction; + /* 0x009 */ u8 frame; + /* 0x00A */ u8 isDone; + /* 0x00C */ u16 texX; + /* 0x00E */ u16 texY; + /* 0x010 */ u16 normal; + /* 0x018 */ Mtx projection; + /* 0x058 */ Mtx lookAt; + /* 0x098 */ Mtx modelView[2][3]; +} TransitionWipe; // size = 0x218 + +void TransitionWipe_Start(void* thisx); +void* TransitionWipe_Init(void* thisx); +void TransitionWipe_Destroy(void* thisx); +void TransitionWipe_Update(void* thisx, s32 updateRate); +void TransitionWipe_Draw(void* thisx, Gfx** gfxP); +s32 TransitionWipe_IsDone(void* thisx); +void TransitionWipe_SetType(void* thisx, s32 type); +void TransitionWipe_SetColor(void* thisx, u32 color); + +#endif diff --git a/include/translation.h b/include/translation.h new file mode 100644 index 0000000000..6583326701 --- /dev/null +++ b/include/translation.h @@ -0,0 +1,16 @@ +#ifndef TRANSLATION_H +#define TRANSLATION_H + +/** + * The "T" macro holds translations in English for original debug strings written in Japanese. + * The translated strings are only direct translations. Certain names or terms may not reflect + * their in-game localized counterparts. + * + * To use translated English strings in the build, change the definition below to "en". + * + * Note: This translation macro exists for quality of life purposes. + * The original game would not have had a macro like this. + */ +#define T(jp, en) jp + +#endif diff --git a/include/ultra64.h b/include/ultra64.h index 30e43563e9..4a8696a841 100644 --- a/include/ultra64.h +++ b/include/ultra64.h @@ -24,12 +24,19 @@ #include "ultra64/sptask.h" #include "ultra64/gu.h" #include "ultra64/vi.h" +#include "ultra64/viint.h" #include "ultra64/pi.h" #include "ultra64/controller.h" #include "ultra64/mbi.h" #include "ultra64/pfs.h" #include "ultra64/motor.h" +#include "ultra64/os_pi.h" +#include "ultra64/os_system.h" +#include "ultra64/os_vi.h" +#include "ultra64/osint.h" +#include "ultra64/piint.h" #include "ultra64/R4300.h" +#include "ultra64/siint.h" #include "ultra64/ucode.h" #include "ultra64/version.h" @@ -105,6 +112,7 @@ OSMesgQueue* osPiGetCmdQueue(void); s32 osEPiReadIo(OSPiHandle* handle, u32 devAddr, u32* data); void osViSetSpecialFeatures(u32 func); OSPiHandle* osCartRomInit(void); +OSPiHandle* osDriveRomInit(void); void __osSetFpcCsr(u32); u32 __osGetFpcCsr(void); s32 osEPiWriteIo(OSPiHandle* handle, u32 devAddr, u32 data); @@ -189,7 +197,6 @@ void osViSetEvent(OSMesgQueue* mq, OSMesg msg, u32 retraceCount); s32 osPfsIsPlug(OSMesgQueue* mq, u8* pattern); void __osPfsRequestData(u8 cmd); void __osPfsGetInitData(u8* pattern, OSContStatus* contData); -void guS2DInitBg(union uObjBg* bg); s32 __osPfsSelectBank(OSPfs* pfs, u8 bank); s32 osContSetCh(u8 ch); s32 osPfsFileState(OSPfs* pfs, s32 fileNo, OSPfsState* state); diff --git a/include/ultra64/controller.h b/include/ultra64/controller.h index 1b6d0cf323..e233f00484 100644 --- a/include/ultra64/controller.h +++ b/include/ultra64/controller.h @@ -182,4 +182,9 @@ typedef struct __OSContReadFormat { /* 0x07 */ s8 joyY; } __OSContReadFormat; // size = 0x8 +extern u8 __osContLastCmd; +extern OSPifRam __osContPifRam; +extern OSPifRam __osPfsPifRam; +extern u8 __osMaxControllers; + #endif diff --git a/include/ultra64/gbi.h b/include/ultra64/gbi.h index 55171076d6..fe248cdf69 100644 --- a/include/ultra64/gbi.h +++ b/include/ultra64/gbi.h @@ -1,8 +1,10 @@ -#include "mbi.h" #ifndef ULTRA64_GBI_H #define ULTRA64_GBI_H +#include "mbi.h" +#include "ultratypes.h" + #ifdef GBI_DOWHILE /* Private macro to wrap other macros in do {...} while (0) */ #define _DW(macro) do { macro } while (0) diff --git a/include/ultra64/gs2dex.h b/include/ultra64/gs2dex.h index 031dcb9f7d..3e15c49d14 100644 --- a/include/ultra64/gs2dex.h +++ b/include/ultra64/gs2dex.h @@ -1,6 +1,8 @@ #ifndef GS2DEX_H #define GS2DEX_H +#include "ultratypes.h" + #ifdef _LANGUAGE_C_PLUS_PLUS extern "C" { #endif diff --git a/include/ultra64/os_pi.h b/include/ultra64/os_pi.h new file mode 100644 index 0000000000..5a13f05fd9 --- /dev/null +++ b/include/ultra64/os_pi.h @@ -0,0 +1,8 @@ +#ifndef ULTRA64_OS_PI_H +#define ULTRA64_OS_PI_H + +#include "pi.h" + +extern OSPiHandle* __osPiTable; + +#endif diff --git a/include/ultra64/os_system.h b/include/ultra64/os_system.h new file mode 100644 index 0000000000..19558c3103 --- /dev/null +++ b/include/ultra64/os_system.h @@ -0,0 +1,31 @@ +#ifndef ULTRA64_OS_SYSTEM_H +#define ULTRA64_OS_SYSTEM_H + +#include "exception.h" +#include "ultratypes.h" + +extern s32 osRomType; /* Bulk or cartridge ROM. 0=cartridge 1=bulk */ +extern void* osRomBase; /* Rom base address of the game image */ +extern s32 osTvType; /* 0 = PAL, 1 = NTSC, 2 = MPAL */ +extern s32 osResetType; /* 0 = cold reset, 1 = NMI */ +extern s32 osCicId; +extern s32 osVersion; +extern u32 osMemSize; /* Memory Size */ +extern s32 osAppNMIBuffer[0x10]; + +extern OSIntMask __OSGlobalIntMask; + +#ifdef BBPLAYER +extern u32 __osBbIsBb; +extern u32 __osBbEepromSize; +extern u32 __osBbPakSize; +extern u32 __osBbFlashSize; +extern u32 __osBbEepromAddress; +extern u32 __osBbPakAddress[4]; +extern u32 __osBbFlashAddress; +extern u32 __osBbSramSize; +extern u32 __osBbSramAddress; +extern u32 __osBbHackFlags; +#endif + +#endif diff --git a/include/ultra64/os_vi.h b/include/ultra64/os_vi.h new file mode 100644 index 0000000000..3b38b60fe4 --- /dev/null +++ b/include/ultra64/os_vi.h @@ -0,0 +1,11 @@ +#ifndef ULTRA64_OS_VI_H +#define ULTRA64_OS_VI_H + +#include "vi.h" + +extern OSViMode osViModeNtscLan1; +extern OSViMode osViModePalLan1; +extern OSViMode osViModeMpalLan1; +extern OSViMode osViModeFpalLan1; + +#endif diff --git a/include/ultra64/osint.h b/include/ultra64/osint.h new file mode 100644 index 0000000000..ec254d4163 --- /dev/null +++ b/include/ultra64/osint.h @@ -0,0 +1,22 @@ +#ifndef ULTRA64_OSINT_H +#define ULTRA64_OSINT_H + +#include "time.h" +#include "thread.h" +#include "ultratypes.h" + +extern __OSThreadTail __osThreadTail; + +extern OSThread* __osRunningThread; +extern OSThread* __osActiveQueue; +extern OSThread* __osFaultedThread; +extern OSThread* __osRunQueue; + +extern OSTimer* __osTimerList; +extern u32 __osBaseCounter; +extern OSTime __osCurrentTime; +extern u32 __osViIntrCount; +extern u32 __osTimerCounter; +extern u32 __osShutdown; + +#endif diff --git a/include/ultra64/pi.h b/include/ultra64/pi.h index af18c407ea..42a90d7609 100644 --- a/include/ultra64/pi.h +++ b/include/ultra64/pi.h @@ -1,6 +1,7 @@ #ifndef ULTRA64_PI_H #define ULTRA64_PI_H +#include "stddef.h" #include "message.h" typedef struct __OSBlockInfo { diff --git a/include/ultra64/piint.h b/include/ultra64/piint.h new file mode 100644 index 0000000000..59b200a6cf --- /dev/null +++ b/include/ultra64/piint.h @@ -0,0 +1,11 @@ +#ifndef ULTRA64_PIINT_H +#define ULTRA64_PIINT_H + +#include "ultratypes.h" +#include "pi.h" + +extern OSPiHandle* __osCurrentHandle[]; +extern OSMesgQueue __osPiAccessQueue; +extern u32 __osPiAccessQueueEnabled; + +#endif diff --git a/include/ultra64/siint.h b/include/ultra64/siint.h new file mode 100644 index 0000000000..d43489b657 --- /dev/null +++ b/include/ultra64/siint.h @@ -0,0 +1,8 @@ +#ifndef ULTRA64_SIINT_H +#define ULTRA64_SIINT_H + +#include "pfs.h" + +extern u8 __osPfsInodeCacheBank; + +#endif diff --git a/include/ultra64/viint.h b/include/ultra64/viint.h index 2df9936405..25a6ceb041 100644 --- a/include/ultra64/viint.h +++ b/include/ultra64/viint.h @@ -1,6 +1,9 @@ #ifndef ULTRA64_VIINT_H #define ULTRA64_VIINT_H +#include "vi.h" +#include "ultratypes.h" + #define VI_STATE_MODE_SET (1 << 0) #define VI_STATE_XSCALE_SET (1 << 1) #define VI_STATE_YSCALE_FACTOR_SET (1 << 2) @@ -43,4 +46,8 @@ #define VI_CTRL_PIXEL_ADV_DEFAULT VI_CTRL_PIXEL_ADV(3) #endif +extern OSViContext* __osViCurr; +extern OSViContext* __osViNext; +extern u32 __additional_scanline; + #endif diff --git a/include/variables.h b/include/variables.h deleted file mode 100644 index f5f4599e7a..0000000000 --- a/include/variables.h +++ /dev/null @@ -1,228 +0,0 @@ -#ifndef VARIABLES_H -#define VARIABLES_H - -#include "z64.h" -#include "libc64/os_malloc.h" -#include "segment_symbols.h" - -extern Mtx D_01000000; - -extern void* osRomBase; -extern s32 osTvType; -extern u32 osRomType; -extern u32 osVersion; -extern s32 osResetType; -extern s32 osCicId; -extern u32 osMemSize; -extern u8 osAppNMIBuffer[0x40]; - -extern u32 __osBbIsBb; -extern u32 __osBbEepromSize; -extern u32 __osBbPakSize; -extern u32 __osBbFlashSize; -extern u32 __osBbEepromAddress; -extern u32 __osBbPakAddress[4]; -extern u32 __osBbFlashAddress; -extern u32 __osBbSramSize; -extern u32 __osBbSramAddress; -extern u32 __osBbHackFlags; - -extern s8 D_80009430; -extern vu8 gViConfigBlack; -extern u8 gViConfigAdditionalScanLines; -extern u32 gViConfigFeatures; -extern f32 gViConfigXScale; -extern f32 gViConfigYScale; -extern OSPiHandle* gCartHandle; -extern s32 gCurrentRegion; -extern u32 __osPiAccessQueueEnabled; -extern OSViMode osViModePalLan1; -extern s32 osViClock; -extern u32 __osShutdown; -extern OSHWIntr __OSGlobalIntMask; -extern __OSThreadTail __osThreadTail; -extern OSThread* __osRunQueue; -extern OSThread* __osActiveQueue; -extern OSThread* __osRunningThread; -extern OSThread* __osFaultedThread; -extern OSPiHandle* __osPiTable; -extern OSPiHandle* __osCurrentHandle[]; -extern OSTimer* __osTimerList; -extern OSViMode osViModeNtscLan1; -extern OSViMode osViModeMpalLan1; -extern OSViContext* __osViCurr; -extern OSViContext* __osViNext; -extern OSViMode osViModeFpalLan1; -extern u32 __additional_scanline; -extern const char gBuildCreator[]; -extern const char gBuildDate[]; -extern const char gBuildMakeOption[]; -extern OSMesgQueue gPiMgrCmdQueue; -extern OSViMode gViConfigMode; -extern u8 gViConfigModeType; -extern OSMesgQueue __osPiAccessQueue; -extern OSPiHandle __Dom1SpeedParam; -extern OSPiHandle __Dom2SpeedParam; -extern OSTime __osCurrentTime; -extern u32 __osBaseCounter; -extern u32 __osViIntrCount; -extern u32 __osTimerCounter; -extern EffectSsOverlay gEffectSsOverlayTable[EFFECT_SS_TYPE_MAX]; -extern Gfx D_80116280[]; -extern ActorOverlay gActorOverlayTable[ACTOR_ID_MAX]; // original name: "actor_dlftbls" 801162A0 -extern s32 gMaxActorId; // original name: "MaxProfile" -extern s32 gDebugCamEnabled; -extern GameStateOverlay gGameStateOverlayTable[GAMESTATE_ID_MAX]; -extern s32 gZeldaArenaLogSeverity; -extern MapData gMapDataTable; -extern s16 gSpoilingItems[3]; -extern s16 gSpoilingItemReverts[3]; - -extern Gfx gEmptyDL[]; - -extern u16 gSramSlotOffsets[]; -// 4 16-colors palettes -extern u64 gMojiFontTLUTs[4][4]; // original name: "moji_tlut" -extern u64 gMojiFontTex[]; // original name: "font_ff" -extern u8 gBossMarkState; - -#if DEBUG_FEATURES -extern u32 gIsCtrlr2Valid; -#endif -extern s16* gWaveSamples[9]; -extern f32 gBendPitchOneOctaveFrequencies[256]; -extern f32 gBendPitchTwoSemitonesFrequencies[256]; -extern f32 gPitchFrequencies[]; -extern u8 gDefaultShortNoteVelocityTable[16]; -extern u8 gDefaultShortNoteGateTimeTable[16]; -extern EnvelopePoint gDefaultEnvelope[4]; -extern NoteSubEu gZeroNoteSub; -extern NoteSubEu gDefaultNoteSub; -extern u16 gHaasEffectDelaySizes[64]; -extern s16 D_8012FBA8[]; -extern f32 gHeadsetPanVolume[128]; -extern f32 gStereoPanVolume[128]; -extern f32 gDefaultPanVolume[128]; -extern s16 gLowPassFilterData[16 * 8]; -extern s16 gHighPassFilterData[15 * 8]; -extern s32 gAudioContextInitialized; -extern u8 gIsLargeSfxBank[7]; -extern u8 gChannelsPerBank[4][7]; -extern u8 gUsedChannelsPerBank[4][7]; -extern u8 gMorphaTransposeTable[16]; -extern u8* gFrogsSongPtr; -extern OcarinaNote* gScarecrowLongSongPtr; -extern u8* gScarecrowSpawnSongPtr; -extern OcarinaSongButtons gOcarinaSongButtons[]; -extern SfxParams* gSfxParams[7]; -extern char D_80133390[]; -extern char D_80133398[]; -extern u8 gSfxRequestWriteIndex; -extern u8 gSfxRequestReadIndex; -extern SfxBankEntry* gSfxBanks[7]; -extern u8 gSfxBankSizes[]; -extern u8 gSfxChannelLayout; -extern u16 D_801333D0; -extern Vec3f gSfxDefaultPos; -extern f32 gSfxDefaultFreqAndVolScale; -extern s8 gSfxDefaultReverb; -#if DEBUG_FEATURES -extern u8 D_801333F0; -extern u8 gAudioSfxSwapOff; -extern u8 D_801333F8; -#endif -extern u8 gSeqCmdWritePos; -extern u8 gSeqCmdReadPos; -extern u8 gStartSeqDisabled; -#if DEBUG_FEATURES -extern u8 gAudioDebugPrintSeqCmd; -#endif -extern u8 gSoundModeList[]; -extern u8 gAudioSpecId; -extern u8 D_80133418; -extern AudioSpec gAudioSpecs[18]; -extern s32 gOverlayLogSeverity; -extern s32 gSystemArenaLogSeverity; -extern u8 __osPfsInodeCacheBank; -extern s32 __osPfsLastChannel; - -extern TempoData gTempoData; -extern AudioHeapInitSizes gAudioHeapInitSizes; -extern s16 gOcarinaSongItemMap[]; -extern AudioTable gSoundFontTable; -extern u8 gSequenceFontTable[]; -extern u8 gSequenceTable[]; -extern AudioTable gSampleBankTable; - -extern u8 gUseCutsceneCam; -extern u16 D_8015FCCC; -extern char D_8015FCD0[20]; -extern u8 D_8015FCE4; -extern u16 gCamAtSplinePointsAppliedFrame; -extern u16 gCamEyePointAppliedFrame; -extern u16 gCamAtPointAppliedFrame; - -extern LightningStrike gLightningStrike; -// TODO: These variables are here for BSS ordering but ideally they should not -// be extern. This could be fixed by putting more stuff (e.g. struct definitions) -// between gLightningStrike and gCustomLensFlareOn. -extern s16 sLightningFlashAlpha; -extern s16 sSunDepthTestX; -extern s16 sSunDepthTestY; -extern u8 gCustomLensFlareOn; -extern Vec3f gCustomLensFlarePos; -extern s16 gLensFlareScale; -extern f32 gLensFlareColorIntensity; -extern s16 gLensFlareGlareStrength; -extern MapData* gMapData; -extern f32 gBossMarkScale; -extern u32 D_8016139C; -extern PauseMapMarksData* gLoadedPauseMarkDataTable; - -extern PreNmiBuff* gAppNmiBufferPtr; -extern Scheduler gScheduler; -extern PadMgr gPadMgr; -extern IrqMgr gIrqMgr; -extern volatile OSTime gAudioThreadUpdateTimeTotalPerGfxTask; -extern volatile OSTime gGfxTaskSentToNextReadyMinusAudioThreadUpdateTime; -extern volatile OSTime gRSPAudioTimeTotal; -extern volatile OSTime gRSPGfxTimeTotal; -extern volatile OSTime gRDPTimeTotal; -extern volatile OSTime gGraphUpdatePeriod; -extern volatile OSTime gAudioThreadUpdateTimeStart; -extern volatile OSTime gAudioThreadUpdateTimeAcc; -extern volatile OSTime gRSPAudioTimeAcc; -extern volatile OSTime gRSPGfxTimeAcc; -extern volatile OSTime gRSPOtherTimeAcc; -extern volatile OSTime D_8016A578; -extern volatile OSTime gRDPTimeAcc; - -extern SfxBankEntry D_8016BAD0[9]; -extern SfxBankEntry D_8016BC80[12]; -extern SfxBankEntry D_8016BEC0[22]; -extern SfxBankEntry D_8016C2E0[20]; -extern SfxBankEntry D_8016C6A0[8]; -extern SfxBankEntry D_8016C820[3]; -extern SfxBankEntry D_8016C8B0[5]; -extern ActiveSfx gActiveSfx[7][MAX_CHANNELS_PER_BANK]; // total size = 0xA8 -extern u8 gSfxBankMuted[]; -extern u16 gAudioSfxSwapSource[10]; -extern u16 gAudioSfxSwapTarget[10]; -extern u8 gAudioSfxSwapMode[10]; -extern ActiveSequence gActiveSeqs[4]; -extern AudioContext gAudioCtx; -extern AudioCustomUpdateFunction gAudioCustomUpdateFunction; - -extern OSPifRam __osContPifRam; -extern u8 __osContLastCmd; -extern u8 __osMaxControllers; -extern __OSInode __osPfsInodeCache; -extern OSPifRam __osPfsPifRam; -extern u16 gZBuffer[SCREEN_HEIGHT][SCREEN_WIDTH]; // 0x25800 bytes -extern u64 gGfxSPTaskOutputBuffer[0x3000]; // 0x18000 bytes -extern u64 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE / sizeof(u64)]; // 0xC00 bytes -extern u64 gGfxSPTaskStack[SP_DRAM_STACK_SIZE64]; // 0x400 bytes -extern GfxPool gGfxPools[2]; // 0x24820 bytes -extern u8 gAudioHeap[0x38000]; // 0x38000 bytes - -#endif diff --git a/include/vi_mode.h b/include/vi_mode.h new file mode 100644 index 0000000000..5c2f1bace2 --- /dev/null +++ b/include/vi_mode.h @@ -0,0 +1,55 @@ +#ifndef VI_MODE_H +#define VI_MODE_H + +#include "ultra64.h" +#include "libu64/pad.h" +#include "versions.h" + +typedef enum ViModeEditState { +#if OOT_VERSION < PAL_1_0 + /* -2 */ VI_MODE_EDIT_STATE_NEGATIVE_2 = -2, + /* -1 */ VI_MODE_EDIT_STATE_NEGATIVE_1, + /* 0 */ VI_MODE_EDIT_STATE_INACTIVE, + /* 1 */ VI_MODE_EDIT_STATE_2, // active, more adjustments + /* 2 */ VI_MODE_EDIT_STATE_3 // active, more adjustments, print comparison with NTSC LAN1 mode +#else + /* 0 */ VI_MODE_EDIT_STATE_INACTIVE, + /* 1 */ VI_MODE_EDIT_STATE_ACTIVE, + /* 2 */ VI_MODE_EDIT_STATE_2, // active, more adjustments + /* 3 */ VI_MODE_EDIT_STATE_3 // active, more adjustments, print comparison with NTSC LAN1 mode +#endif +} ViModeEditState; + +typedef struct ViMode { + /* 0x00 */ OSViMode customViMode; + /* 0x50 */ s32 viHeight; + /* 0x54 */ s32 viWidth; + /* 0x58 */ s32 rightAdjust; + /* 0x5C */ s32 leftAdjust; + /* 0x60 */ s32 lowerAdjust; + /* 0x64 */ s32 upperAdjust; + /* 0x68 */ s32 editState; + /* 0x6C */ s32 tvType; + /* 0x70 */ u32 loRes; + /* 0x74 */ u32 antialiasOff; + /* 0x78 */ u32 modeN; // Controls interlacing, the meaning of this mode is different based on choice of resolution + /* 0x7C */ u32 fb16Bit; + /* 0x80 */ u32 viFeatures; + /* 0x84 */ u32 unk_84; +} ViMode; // size = 0x88 + +void ViMode_Init(ViMode* viMode); +void ViMode_Destroy(ViMode* viMode); +void ViMode_Update(ViMode* viMode, Input* input); + +void ViConfig_UpdateVi(u32 black); +void ViConfig_UpdateBlack(void); + +extern s8 D_80009430; +extern vu8 gViConfigBlack; +extern u8 gViConfigAdditionalScanLines; +extern u32 gViConfigFeatures; +extern f32 gViConfigXScale; +extern f32 gViConfigYScale; + +#endif diff --git a/include/yaz0.h b/include/yaz0.h new file mode 100644 index 0000000000..52f5ba951e --- /dev/null +++ b/include/yaz0.h @@ -0,0 +1,10 @@ +#ifndef YAZ0_H +#define YAZ0_H + +#include "libc/stddef.h" +#include "libc/stdint.h" +#include "ultra64.h" + +void Yaz0_Decompress(uintptr_t romStart, u8* dst, size_t size); + +#endif diff --git a/include/z64.h b/include/z64.h deleted file mode 100644 index f0ac7d547a..0000000000 --- a/include/z64.h +++ /dev/null @@ -1,418 +0,0 @@ -#ifndef Z64_H -#define Z64_H - -#include "ultra64.h" -#include "ultra64/gs2dex.h" -#include "attributes.h" -#include "audiomgr.h" -#include "controller.h" -#include "versions.h" -#include "z64save.h" -#include "z64light.h" -#include "z64bgcheck.h" -#include "z64actor.h" -#include "z64player.h" -#include "z64audio.h" -#include "z64object.h" -#include "z64ocarina.h" -#include "z64camera.h" -#include "z64environment.h" -#include "z64cutscene.h" -#include "z64collision_check.h" -#include "z64curve.h" -#include "z64scene.h" -#include "z64effect.h" -#include "z64game_over.h" -#include "z64inventory.h" -#include "z64item.h" -#include "z64animation.h" -#include "z64animation_legacy.h" -#include "z64dma.h" -#include "letterbox.h" -#include "z64math.h" -#include "z64map_mark.h" -#include "z64message.h" -#include "z64olib.h" -#include "one_point_cutscene.h" -#include "z64pause.h" -#include "z64play.h" -#include "z64skin.h" -#include "z64skin_matrix.h" -#include "z64game.h" -#include "z64transition.h" -#include "z64transition_instances.h" -#include "z64interface.h" -#include "z64sfx_source.h" -#include "z64skybox.h" -#include "z64sram.h" -#include "z64view.h" -#include "z64vis.h" -#include "zelda_arena.h" -#include "alignment.h" -#include "audiothread_cmd.h" -#include "seqcmd.h" -#include "sequence.h" -#include "sfx.h" -#include "color.h" -#include "libu64/gfxprint.h" -#include "z_lib.h" -#include "ichain.h" -#include "regs.h" -#include "irqmgr.h" -#include "padmgr.h" -#include "sched.h" -#include "rumble.h" -#include "map.h" -#include "mempak.h" -#include "tha.h" -#include "thga.h" -#include "speed_meter.h" -#include "gfx.h" -#include "gfx_setupdl.h" -#include "gfxalloc.h" -#include "jpeg.h" -#include "prerender.h" -#include "rand.h" -#include "libc64/qrand.h" -#include "sys_math.h" -#include "sys_math3d.h" -#include "libc64/math64.h" -#include "sys_matrix.h" -#include "main.h" -#include "segmented_address.h" -#include "stackcheck.h" -#include "kaleido_manager.h" -#include "libc64/aprintf.h" -#include "libc64/malloc.h" -#include "libc64/sleep.h" -#include "libc64/sprintf.h" -#include "libu64/debug.h" -#include "z64debug_display.h" -#include "z64draw.h" -#include "z_en_item00.h" - -#define SCREEN_WIDTH 320 -#define SCREEN_HEIGHT 240 - -#define THREAD_PRI_IDLE_INIT 10 -#define THREAD_PRI_MAIN_INIT 10 -#define THREAD_PRI_DMAMGR_LOW 10 // Used when decompressing files -#define THREAD_PRI_GRAPH 11 -#define THREAD_PRI_AUDIOMGR 12 -#define THREAD_PRI_N64DD 13 -#define THREAD_PRI_DDMSG 13 -#define THREAD_PRI_PADMGR 14 -#define THREAD_PRI_MAIN 15 -#define THREAD_PRI_SCHED 15 -#define THREAD_PRI_DMAMGR 16 -#define THREAD_PRI_IRQMGR 17 -#define THREAD_PRI_FAULT_CLIENT (OS_PRIORITY_APPMAX - 1) -#define THREAD_PRI_FAULT OS_PRIORITY_APPMAX - -#define THREAD_ID_IDLE 1 -#define THREAD_ID_FAULT 2 -#define THREAD_ID_MAIN 3 -#define THREAD_ID_GRAPH 4 -#define THREAD_ID_SCHED 5 -#define THREAD_ID_PADMGR 7 -#define THREAD_ID_N64DD 8 -#define THREAD_ID_DDMSG 9 -#define THREAD_ID_AUDIOMGR 10 -#define THREAD_ID_DMAMGR 18 -#define THREAD_ID_IRQMGR 19 - -typedef enum LensMode { - /* 0 */ LENS_MODE_SHOW_ACTORS, // lens actors are invisible by default, and shown by using lens (for example, invisible enemies) - /* 1 */ LENS_MODE_HIDE_ACTORS // lens actors are visible by default, and hidden by using lens (for example, fake walls) -} LensMode; - -typedef struct SetupState { - /* 0x00 */ GameState state; -} SetupState; // size = 0xA4 - -typedef struct ConsoleLogoState { - /* 0x0000 */ GameState state; - /* 0x00A4 */ u8* staticSegment; - /* 0x00A8 */ View view; - /* 0x01D0 */ SramContext sramCtx; - /* 0x01D4 */ s16 unk_1D4; - /* 0x01D6 */ s16 coverAlpha; - /* 0x01D8 */ s16 addAlpha; - /* 0x01DA */ s16 visibleDuration; - /* 0x01DC */ s16 ult; - /* 0x01DE */ s16 uls; - /* 0x01E0 */ u8 unk_1E0; - /* 0x01E1 */ u8 exit; - /* 0x01E2 */ char unk_1E2[0x06]; -} ConsoleLogoState; // size = 0x1E8 - -struct MapSelectState; - -typedef struct SceneSelectEntry { - /* 0x00 */ char* name; - /* 0x04 */ void (*loadFunc)(struct MapSelectState*, s32); - /* 0x08 */ s32 entranceIndex; -} SceneSelectEntry; // size = 0xC - -typedef struct MapSelectState { - /* 0x0000 */ GameState state; - /* 0x00A8 */ View view; - /* 0x01D0 */ s32 count; - /* 0x01D4 */ SceneSelectEntry* scenes; - /* 0x01D8 */ s32 currentScene; - /* 0x01DC */ s32 pageDownIndex; // Index of pageDownStops - /* 0x01E0 */ s32 pageDownStops[7]; - /* 0x01FC */ char unk_1FC[0x0C]; - /* 0x0208 */ s32 opt; - /* 0x020C */ s32 topDisplayedScene; // The scene which is currently at the top of the screen - /* 0x0210 */ char unk_210[0x0C]; - /* 0x021C */ s32 verticalInputAccumulator; - /* 0x0220 */ s32 verticalInput; - /* 0x0224 */ s32 timerUp; - /* 0x0228 */ s32 timerDown; - /* 0x022C */ s32 lockUp; - /* 0x0230 */ s32 lockDown; - /* 0x0234 */ s32 unk_234; // unused - /* 0x0238 */ u8* staticSegment; -} MapSelectState; // size = 0x240 - -typedef struct SampleState { - /* 0x0000 */ GameState state; - /* 0x00A4 */ u8* staticSegment; - /* 0x00A8 */ View view; -} SampleState; // size = 0x1D0 - -typedef struct QuestHintCmd { - /* 0x00 */ u8 byte0; - /* 0x01 */ u8 byte1; - /* 0x02 */ u8 byte2; - /* 0x03 */ u8 byte3; -} QuestHintCmd; // size = 0x4 - -typedef enum PauseBgPreRenderState { - /* 0 */ PAUSE_BG_PRERENDER_OFF, // Inactive, do nothing. - /* 1 */ PAUSE_BG_PRERENDER_SETUP, // The current frame is only drawn for the purpose of serving as the pause background. - /* 2 */ PAUSE_BG_PRERENDER_PROCESS, // The previous frame was PAUSE_BG_PRERENDER_SETUP, now apply prerender filters. - /* 3 */ PAUSE_BG_PRERENDER_READY, // The pause background is ready to be used. - /* 4 */ PAUSE_BG_PRERENDER_MAX -} PauseBgPreRenderState; - -typedef enum TransitionTileState { - /* 0 */ TRANS_TILE_OFF, // Inactive, do nothing - /* 1 */ TRANS_TILE_SETUP, // Save the necessary buffers - /* 2 */ TRANS_TILE_PROCESS, // Initialize the transition - /* 3 */ TRANS_TILE_READY // The transition is ready, so will update and draw each frame -} TransitionTileState; - -typedef struct TitleSetupState { - /* 0x0000 */ GameState state; - /* 0x00A8 */ View view; -} TitleSetupState; // size = 0x1D0 - -typedef struct FileSelectState { - /* 0x00000 */ GameState state; - /* 0x000A4 */ Vtx* windowVtx; - /* 0x000A8 */ u8* staticSegment; - /* 0x000AC */ u8* parameterSegment; -#if OOT_PAL - /* 0x000B0 */ u8* objectMagSegment; -#endif - /* 0x000B8 */ View view; - /* 0x001E0 */ SramContext sramCtx; - /* 0x001E4 */ char unk_1E4[0x4]; - /* 0x001E8 */ SkyboxContext skyboxCtx; - /* 0x00348 */ MessageContext msgCtx; - /* 0x0E760 */ Font font; - /* 0x1C8E8 */ EnvironmentContext envCtx; - /* 0x1C9E4 */ char unk_1C9E4[0x4]; - /* 0x1C9E8 */ Vtx* windowContentVtx; - /* 0x1C9EC */ Vtx* keyboardVtx; - /* 0x1C9F0 */ Vtx* nameEntryVtx; - /* 0x1C9F4 */ u8 n64ddFlag; - /* 0x1C9F6 */ u16 deaths[3]; - /* 0x1C9FC */ u8 fileNames[3][8]; - /* 0x1CA14 */ u16 healthCapacities[3]; - /* 0x1CA1C */ u32 questItems[3]; - /* 0x1CA28 */ s16 n64ddFlags[3]; - /* 0x1CA2E */ s8 defense[3]; -#if OOT_PAL - /* 0x1CA32 */ u16 health[3]; -#endif - /* 0x1CA38 */ s16 buttonIndex; - /* 0x1CA3A */ s16 confirmButtonIndex; // 0: yes, 1: quit - /* 0x1CA3C */ s16 menuMode; - /* 0x1CA3E */ s16 configMode; - /* 0x1CA40 */ s16 prevConfigMode; - /* 0x1CA42 */ s16 nextConfigMode; - /* 0x1CA44 */ s16 selectMode; - /* 0x1CA46 */ s16 selectedFileIndex; - /* 0x1CA48 */ char unk_1CA48[0x2]; - /* 0x1CA4A */ s16 fileNamesY[3]; - /* 0x1CA50 */ s16 actionTimer; - /* 0x1CA52 */ s16 buttonYOffsets[6]; - /* 0x1CA5E */ s16 copyDestFileIndex; - /* 0x1CA60 */ s16 warningLabel; - /* 0x1CA62 */ s16 warningButtonIndex; - /* 0x1CA64 */ s16 titleLabel; - /* 0x1CA66 */ s16 nextTitleLabel; - /* 0x1CA68 */ s16 windowColor[3]; - /* 0x1CA6E */ s16 titleAlpha[2]; - /* 0x1CA72 */ s16 windowAlpha; - /* 0x1CA74 */ s16 fileButtonAlpha[3]; - /* 0x1CA7A */ s16 nameBoxAlpha[3]; - /* 0x1CA80 */ s16 nameAlpha[3]; - /* 0x1CA86 */ s16 connectorAlpha[3]; - /* 0x1CA8C */ s16 fileInfoAlpha[3]; - /* 0x1CA92 */ s16 actionButtonAlpha[4]; // also contains the alphas for the confirm buttons - /* 0x1CA9A */ s16 optionButtonAlpha; - /* 0x1CA9C */ s16 nameEntryBoxAlpha; - /* 0x1CA9E */ s16 controlsAlpha; - /* 0x1CAA0 */ s16 emptyFileTextAlpha; - /* 0x1CAA2 */ s16 highlightColor[4]; - /* 0x1CAAA */ s16 highlightPulseDir; // 0 fade out, 1 fade in - /* 0x1CAAC */ s16 unk_1CAAC; // initialized but never used - /* 0x1CAAE */ s16 confirmButtonTexIndices[2]; - /* 0x1CAB2 */ s16 inputTimerX; - /* 0x1CAB4 */ s16 inputTimerY; - /* 0x1CAB6 */ s16 stickXDir; - /* 0x1CAB8 */ s16 stickYDir; - /* 0x1CABA */ s16 stickAdjX; - /* 0x1CABC */ s16 stickAdjY; - /* 0x1CABE */ s16 nameEntryBoxPosX; - /* 0x1CAC0 */ s16 windowPosX; - /* 0x1CAC4 */ f32 windowRot; - /* 0x1CAC8 */ s16 kbdButton; // only for buttons, not characters - /* 0x1CACA */ s16 charPage; // 0: hiragana, 1: katakana, 2: alphabet - /* 0x1CACC */ s16 charBgAlpha; // square shape the letter sits in - /* 0x1CACE */ s16 charIndex; // 0 - 64, top left to bottom right - /* 0x1CAD0 */ s16 kbdX; // (0, 0) is top left character - /* 0x1CAD2 */ s16 kbdY; - /* 0x1CAD4 */ s16 newFileNameCharCount; - /* 0x1CAD6 */ s16 unk_1CAD6[5]; -} FileSelectState; // size = 0x1CAE0 - -typedef struct GameStateOverlay { - /* 0x00 */ void* loadedRamAddr; - /* 0x04 */ RomFile file; // if applicable - /* 0x0C */ void* vramStart; // if applicable - /* 0x10 */ void* vramEnd; // if applicable - /* 0x14 */ void* unk_14; - /* 0x18 */ void* init; // initializes and executes the given context - /* 0x1C */ void* destroy; // deconstructs the context, and sets the next context to load - /* 0x20 */ void* unk_20; - /* 0x24 */ void* unk_24; - /* 0x28 */ UNK_TYPE4 unk_28; - /* 0x2C */ u32 instanceSize; -} GameStateOverlay; // size = 0x30 - -typedef struct PreNMIState { - /* 0x00 */ GameState state; - /* 0xA4 */ u32 timer; - /* 0xA8 */ UNK_TYPE4 unk_A8; -} PreNMIState; // size = 0xAC - -typedef struct ISVDbg { - /* 0x00 */ u32 magic; // IS64 - /* 0x04 */ u32 get; - /* 0x08 */ u8 unk_08[0x14-0x08]; - /* 0x14 */ u32 put; - /* 0x18 */ u8 unk_18[0x20-0x18]; - /* 0x20 */ u8 data[0x10000-0x20]; -} ISVDbg; - -typedef struct LocaleCartInfo { - /* 0x00 */ char name[0x18]; - /* 0x18 */ u32 mediaFormat; - /* 0x1C */ union { - struct { - u16 cartId; - u8 countryCode; - u8 version; - }; - u32 regionInfo; - }; -} LocaleCartInfo; // size = 0x20 - -typedef struct Yaz0Header { - /* 0x00 */ char magic[4]; // Yaz0 - /* 0x04 */ u32 decSize; - /* 0x08 */ u32 compInfoOffset; // only used in mio0 - /* 0x0C */ u32 uncompDataOffset; // only used in mio0 -} Yaz0Header; // size = 0x10 - -/* Relocation entry field getters */ -#define RELOC_SECTION(reloc) ((reloc) >> 30) -#define RELOC_OFFSET(reloc) ((reloc) & 0xFFFFFF) -#define RELOC_TYPE_MASK(reloc) ((reloc) & 0x3F000000) -#define RELOC_TYPE_SHIFT 24 - -/* MIPS Relocation Types, matches the MIPS ELF spec */ -#define R_MIPS_32 2 -#define R_MIPS_26 4 -#define R_MIPS_HI16 5 -#define R_MIPS_LO16 6 - -/* Reloc section id, must fit in 2 bits otherwise the relocation format must be modified */ -typedef enum RelocSectionId { - /* 0 */ RELOC_SECTION_NULL, - /* 1 */ RELOC_SECTION_TEXT, - /* 2 */ RELOC_SECTION_DATA, - /* 3 */ RELOC_SECTION_RODATA, - /* 4 */ RELOC_SECTION_MAX -} RelocSectionId; - -typedef struct OverlayRelocationSection { - /* 0x00 */ u32 textSize; - /* 0x04 */ u32 dataSize; - /* 0x08 */ u32 rodataSize; - /* 0x0C */ u32 bssSize; - /* 0x10 */ u32 nRelocations; - /* 0x14 */ u32 relocations[1]; // size is nRelocations -} OverlayRelocationSection; // size >= 0x18 - -// This struct is used at osAppNMIBuffer which is not at an 8-byte aligned address. This causes an unaligned access -// crash if the OSTime variables use 64-bit load/store instructions, which is the case in any MIPS ABI other than O32 -// where 64-bit load/store instructions are emulated with 2x 32-bit load/store instructions. The alignment attribute -// conveys that this structure will not always be 8-bytes aligned, allowing a modern compiler to generate non-crashing -// code for accessing these. This is not an issue in the original compiler as it only output O32 ABI code. -ALIGNED(4) typedef struct PreNmiBuff { - /* 0x00 */ u32 resetting; - /* 0x04 */ u32 resetCount; - /* 0x08 */ OSTime duration; - /* 0x10 */ OSTime resetTime; -} PreNmiBuff; // size = 0x18 (actually osAppNMIBuffer is 0x40 bytes large but the rest is unused) - -typedef enum ViModeEditState { -#if OOT_VERSION < PAL_1_0 - /* -2 */ VI_MODE_EDIT_STATE_NEGATIVE_2 = -2, - /* -1 */ VI_MODE_EDIT_STATE_NEGATIVE_1, - /* 0 */ VI_MODE_EDIT_STATE_INACTIVE, - /* 1 */ VI_MODE_EDIT_STATE_2, // active, more adjustments - /* 2 */ VI_MODE_EDIT_STATE_3 // active, more adjustments, print comparison with NTSC LAN1 mode -#else - /* 0 */ VI_MODE_EDIT_STATE_INACTIVE, - /* 1 */ VI_MODE_EDIT_STATE_ACTIVE, - /* 2 */ VI_MODE_EDIT_STATE_2, // active, more adjustments - /* 3 */ VI_MODE_EDIT_STATE_3 // active, more adjustments, print comparison with NTSC LAN1 mode -#endif -} ViModeEditState; - -typedef struct ViMode { - /* 0x00 */ OSViMode customViMode; - /* 0x50 */ s32 viHeight; - /* 0x54 */ s32 viWidth; - /* 0x58 */ s32 rightAdjust; - /* 0x5C */ s32 leftAdjust; - /* 0x60 */ s32 lowerAdjust; - /* 0x64 */ s32 upperAdjust; - /* 0x68 */ s32 editState; - /* 0x6C */ s32 tvType; - /* 0x70 */ u32 loRes; - /* 0x74 */ u32 antialiasOff; - /* 0x78 */ u32 modeN; // Controls interlacing, the meaning of this mode is different based on choice of resolution - /* 0x7C */ u32 fb16Bit; - /* 0x80 */ u32 viFeatures; - /* 0x84 */ u32 unk_84; -} ViMode; // size = 0x88 - -#endif diff --git a/include/z64actor.h b/include/z64actor.h index 38132540ab..1a8b503297 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -3,6 +3,7 @@ #include "color.h" #include "romfile.h" +#include "z64actor_profile.h" #include "z64animation.h" #include "z64math.h" #include "z64collision_check.h" @@ -23,88 +24,16 @@ struct Actor; struct ActorEntry; +struct ActorOverlay; struct CollisionPoly; struct Lights; struct Player; struct PlayState; -typedef void (*ActorFunc)(struct Actor*, struct PlayState*); typedef void (*ActorShadowFunc)(struct Actor*, struct Lights*, struct PlayState*); typedef u16 (*NpcGetTextIdFunc)(struct PlayState*, struct Actor*); typedef s16 (*NpcUpdateTalkStateFunc)(struct PlayState*, struct Actor*); -typedef struct ActorProfile { - /* 0x00 */ s16 id; - /* 0x02 */ u8 category; // Classifies actor and determines when it will update or draw - /* 0x04 */ u32 flags; - /* 0x08 */ s16 objectId; - /* 0x0C */ u32 instanceSize; - /* 0x10 */ ActorFunc init; // Constructor - /* 0x14 */ ActorFunc destroy; // Destructor - /* 0x18 */ ActorFunc update; // Update Function - /* 0x1C */ ActorFunc draw; // Draw function -} ActorProfile; // size = 0x20 - -/** - * @see ACTOROVL_ALLOC_ABSOLUTE - */ -#if DEBUG_FEATURES -#define ACTOROVL_ABSOLUTE_SPACE_SIZE 0x27A0 -#else -#define ACTOROVL_ABSOLUTE_SPACE_SIZE 0x24E0 -#endif - -/** - * The actor overlay should be allocated memory for when loading, - * and the memory deallocated when there is no more actor using the overlay. - * - * `ACTOROVL_ALLOC_` defines indicate how an actor overlay should be loaded. - * - * @note Bitwise or-ing `ACTOROVL_ALLOC_` types is not meaningful. - * The `ACTOROVL_ALLOC_` types are 0, 1, 2 but checked against with a bitwise and. - * - * @see ACTOROVL_ALLOC_ABSOLUTE - * @see ACTOROVL_ALLOC_PERSISTENT - * @see actor_table.h - */ -#define ACTOROVL_ALLOC_NORMAL 0 - -/** - * The actor overlay should be loaded to "absolute space". - * - * Absolute space is a fixed amount of memory allocated once. - * The overlay will still need to be loaded again if at some point there is no more actor using the overlay. - * - * @note Only one such overlay may be loaded at a time. - * This is not checked: a newly loaded overlay will overwrite the previous one in absolute space, - * even if actors are still relying on the previous one. Actors using absolute-allocated overlays should be deleted - * when another absolute-allocated overlay is about to be used. - * - * @see ACTOROVL_ABSOLUTE_SPACE_SIZE - * @see ActorContext.absoluteSpace - * @see ACTOROVL_ALLOC_NORMAL - */ -#define ACTOROVL_ALLOC_ABSOLUTE (1 << 0) - -/** - * The actor overlay should be loaded persistently. - * It will stay loaded until the current game state instance ends. - * - * @see ACTOROVL_ALLOC_NORMAL - */ -#define ACTOROVL_ALLOC_PERSISTENT (1 << 1) - -typedef struct ActorOverlay { - /* 0x00 */ RomFile file; - /* 0x08 */ void* vramStart; - /* 0x0C */ void* vramEnd; - /* 0x10 */ void* loadedRamAddr; // original name: "allocp" - /* 0x14 */ ActorProfile* profile; - /* 0x18 */ char* name; - /* 0x1C */ u16 allocType; // See `ACTOROVL_ALLOC_` defines - /* 0x1E */ s8 numLoaded; // original name: "clients" -} ActorOverlay; // size = 0x20 - typedef struct ActorShape { /* 0x00 */ Vec3s rot; // Current actor shape rotation /* 0x06 */ s16 face; // Used to index eyes and mouth textures. Only used by player @@ -231,6 +160,8 @@ typedef struct ActorShape { // Flag controlling the use of `Actor.sfx`. Do not use directly. See Actor_PlaySfx_FlaggedTimer #define ACTOR_FLAG_SFX_TIMER (1 << 28) +#define ACTOR_FLAGS_CHECK_ALL(thisx, mask) (((thisx)->flags & (mask)) == (mask)) + #define COLORFILTER_GET_COLORINTENSITY(colorFilterParams) (((colorFilterParams) & 0x1F00) >> 5) #define COLORFILTER_GET_DURATION(colorFilterParams) ((colorFilterParams) & 0xFF) @@ -309,7 +240,7 @@ typedef struct Actor { /* 0x12C */ ActorFunc destroy; // Destruction Routine. Called by `Actor_Destroy` /* 0x130 */ ActorFunc update; // Update Routine. Called by `Actor_UpdateAll` /* 0x134 */ ActorFunc draw; // Draw Routine. Called by `Actor_Draw` - /* 0x138 */ ActorOverlay* overlayEntry; // Pointer to the overlay table entry for this actor + /* 0x138 */ struct ActorOverlay* overlayEntry; // Pointer to the overlay table entry for this actor #if DEBUG_FEATURES /* 0x13C */ char dbgPad[0x10]; #endif @@ -362,69 +293,6 @@ typedef struct BodyBreak { #define BODYBREAK_STATUS_READY -1 #define BODYBREAK_STATUS_FINISHED 0 -// Only A_OBJ_SIGNPOST_OBLONG and A_OBJ_SIGNPOST_ARROW are used in room files. -typedef enum AObjType { - /* 0x00 */ A_OBJ_BLOCK_SMALL, - /* 0x01 */ A_OBJ_BLOCK_LARGE, - /* 0x02 */ A_OBJ_BLOCK_HUGE, - /* 0x03 */ A_OBJ_BLOCK_SMALL_ROT, - /* 0x04 */ A_OBJ_BLOCK_LARGE_ROT, - /* 0x05 */ A_OBJ_CUBE_SMALL, - /* 0x06 */ A_OBJ_UNKNOWN_6, - /* 0x07 */ A_OBJ_GRASS_CLUMP, - /* 0x08 */ A_OBJ_TREE_STUMP, - /* 0x09 */ A_OBJ_SIGNPOST_OBLONG, - /* 0x0A */ A_OBJ_SIGNPOST_ARROW, - /* 0x0B */ A_OBJ_BOULDER_FRAGMENT, - /* 0x0C */ A_OBJ_MAX -} AObjType; - -struct EnAObj; - -typedef void (*EnAObjActionFunc)(struct EnAObj*, struct PlayState*); - -typedef struct EnAObj { - /* 0x000 */ DynaPolyActor dyna; - /* 0x164 */ EnAObjActionFunc actionFunc; - /* 0x168 */ s32 rotateWaitTimer; - /* 0x16C */ s16 textId; - /* 0x16E */ s16 rotateState; - /* 0x170 */ s16 rotateForTimer; - /* 0x172 */ s16 rotSpeedY; - /* 0x174 */ s16 rotSpeedX; - /* 0x178 */ f32 focusYoffset; - /* 0x17C */ ColliderCylinder collider; -} EnAObj; // size = 0x1C8 - -typedef enum ActorCategory { - /* 0x00 */ ACTORCAT_SWITCH, - /* 0x01 */ ACTORCAT_BG, - /* 0x02 */ ACTORCAT_PLAYER, - /* 0x03 */ ACTORCAT_EXPLOSIVE, - /* 0x04 */ ACTORCAT_NPC, - /* 0x05 */ ACTORCAT_ENEMY, - /* 0x06 */ ACTORCAT_PROP, - /* 0x07 */ ACTORCAT_ITEMACTION, - /* 0x08 */ ACTORCAT_MISC, - /* 0x09 */ ACTORCAT_BOSS, - /* 0x0A */ ACTORCAT_DOOR, - /* 0x0B */ ACTORCAT_CHEST, - /* 0x0C */ ACTORCAT_MAX -} ActorCategory; - -#define DEFINE_ACTOR(_0, enum, _2, _3) enum, -#define DEFINE_ACTOR_INTERNAL(_0, enum, _2, _3) enum, -#define DEFINE_ACTOR_UNSET(enum) enum, - -typedef enum ActorID { - #include "tables/actor_table.h" - /* 0x0192 */ ACTOR_ID_MAX // originally "ACTOR_DLF_MAX" -} ActorID; - -#undef DEFINE_ACTOR -#undef DEFINE_ACTOR_INTERNAL -#undef DEFINE_ACTOR_UNSET - typedef enum DoorLockType { DOORLOCK_NORMAL, DOORLOCK_BOSS, @@ -732,6 +600,8 @@ typedef struct NpcInteractInfo { #define TRANSITION_ACTOR_PARAMS_INDEX_SHIFT 10 #define GET_TRANSITION_ACTOR_INDEX(actor) PARAMS_GET_NOMASK((u16)(actor)->params, 10) +extern Gfx D_80116280[]; + void ActorShape_Init(ActorShape* shape, f32 yOffset, ActorShadowFunc shadowDraw, f32 shadowScale); void ActorShadow_DrawCircle(Actor* actor, struct Lights* lights, struct PlayState* play); void ActorShadow_DrawWhiteCircle(Actor* actor, struct Lights* lights, struct PlayState* play); @@ -850,7 +720,7 @@ void Actor_DisableLens(struct PlayState* play); void Actor_InitContext(struct PlayState* play, ActorContext* actorCtx, struct ActorEntry* playerEntry); void Actor_UpdateAll(struct PlayState* play, ActorContext* actorCtx); s32 Actor_CullingVolumeTest(struct PlayState* play, Actor* actor, Vec3f* projPos, f32 projW); -void func_800315AC(struct PlayState* play, ActorContext* actorCtx); +void Actor_DrawAll(struct PlayState* play, ActorContext* actorCtx); void Actor_KillAllWithMissingObject(struct PlayState* play, ActorContext* actorCtx); void func_80031B14(struct PlayState* play, ActorContext* actorCtx); void func_80031C3C(ActorContext* actorCtx, struct PlayState* play); diff --git a/include/z64actor_profile.h b/include/z64actor_profile.h new file mode 100644 index 0000000000..82ec9f957b --- /dev/null +++ b/include/z64actor_profile.h @@ -0,0 +1,52 @@ +#ifndef Z64ACTOR_PROFILE_H +#define Z64ACTOR_PROFILE_H + +#include "ultra64.h" + +struct Actor; +struct PlayState; + +#define DEFINE_ACTOR(_0, enum, _2, _3) enum, +#define DEFINE_ACTOR_INTERNAL(_0, enum, _2, _3) enum, +#define DEFINE_ACTOR_UNSET(enum) enum, + +typedef enum ActorID { + #include "tables/actor_table.h" + /* 0x0192 */ ACTOR_ID_MAX // originally "ACTOR_DLF_MAX" +} ActorID; + +#undef DEFINE_ACTOR +#undef DEFINE_ACTOR_INTERNAL +#undef DEFINE_ACTOR_UNSET + +typedef enum ActorCategory { + /* 0x00 */ ACTORCAT_SWITCH, + /* 0x01 */ ACTORCAT_BG, + /* 0x02 */ ACTORCAT_PLAYER, + /* 0x03 */ ACTORCAT_EXPLOSIVE, + /* 0x04 */ ACTORCAT_NPC, + /* 0x05 */ ACTORCAT_ENEMY, + /* 0x06 */ ACTORCAT_PROP, + /* 0x07 */ ACTORCAT_ITEMACTION, + /* 0x08 */ ACTORCAT_MISC, + /* 0x09 */ ACTORCAT_BOSS, + /* 0x0A */ ACTORCAT_DOOR, + /* 0x0B */ ACTORCAT_CHEST, + /* 0x0C */ ACTORCAT_MAX +} ActorCategory; + +typedef void (*ActorFunc)(struct Actor*, struct PlayState*); + +typedef struct ActorProfile { + /* 0x00 */ s16 id; + /* 0x02 */ u8 category; // Classifies actor and determines when it will update or draw + /* 0x04 */ u32 flags; + /* 0x08 */ s16 objectId; + /* 0x0C */ u32 instanceSize; + /* 0x10 */ ActorFunc init; // Constructor + /* 0x14 */ ActorFunc destroy; // Destructor + /* 0x18 */ ActorFunc update; // Update Function + /* 0x1C */ ActorFunc draw; // Draw function +} ActorProfile; // size = 0x20 + +#endif diff --git a/include/z64animation.h b/include/z64animation.h index 17b42e1a0f..a085da5ddd 100644 --- a/include/z64animation.h +++ b/include/z64animation.h @@ -1,10 +1,10 @@ #ifndef Z64_ANIMATION_H #define Z64_ANIMATION_H +#include "avoid_ub.h" #include "ultra64.h" #include "z64dma.h" #include "z64math.h" -#include "macros.h" struct PlayState; struct Actor; diff --git a/include/z64audio.h b/include/z64audio.h index d60a6aaeb7..308c220d7a 100644 --- a/include/z64audio.h +++ b/include/z64audio.h @@ -31,8 +31,6 @@ typedef void (*AudioCustomUpdateFunction)(void); #define SEQ_NUM_CHANNELS 16 #define SEQ_IO_VAL_NONE -1 -#define MAX_CHANNELS_PER_BANK 3 - #define MUTE_BEHAVIOR_3 (1 << 3) // prevent further noteSubEus from playing #define MUTE_BEHAVIOR_4 (1 << 4) // stop something in seqLayer scripts #define MUTE_BEHAVIOR_SOFTEN (1 << 5) // lower volume, by default to half @@ -68,12 +66,19 @@ typedef void (*AudioCustomUpdateFunction)(void); #define AUDIO_RELOCATED_ADDRESS_START K0BASE -typedef enum SoundMode { - /* 0 */ SOUNDMODE_STEREO, - /* 1 */ SOUNDMODE_HEADSET, - /* 2 */ SOUNDMODE_SURROUND, - /* 3 */ SOUNDMODE_MONO -} SoundMode; +typedef enum SoundSetting { + /* 0 */ SOUND_SETTING_STEREO, + /* 1 */ SOUND_SETTING_MONO, + /* 2 */ SOUND_SETTING_HEADSET, + /* 3 */ SOUND_SETTING_SURROUND +} SoundSetting; + +typedef enum SoundOutputMode { + /* 0 */ SOUND_OUTPUT_STEREO, + /* 1 */ SOUND_OUTPUT_HEADSET, + /* 2 */ SOUND_OUTPUT_SURROUND, + /* 3 */ SOUND_OUTPUT_MONO +} SoundOutputMode; typedef enum AdsrStatus { /* 0 */ ADSR_STATE_DISABLED, @@ -929,7 +934,7 @@ typedef struct AudioContext { /* 0x2890 */ s32 maxAudioCmds; /* 0x2894 */ s32 numNotes; /* 0x2898 */ s16 maxTempo; // Maximum possible tempo (seqTicks per minute), using every tick as a seqTick to process a .seq file - /* 0x289A */ s8 soundMode; + /* 0x289A */ s8 soundOutputMode; /* 0x289C */ s32 totalTaskCount; // The total number of times the top-level function on the audio thread has run since audio was initialized /* 0x28A0 */ s32 curAudioFrameDmaCount; /* 0x28A4 */ s32 rspTaskIndex; @@ -1197,7 +1202,7 @@ void func_800F64E0(u8 arg0); void Audio_ToggleMalonSinging(u8 malonSingingDisabled); void Audio_SetEnvReverb(s8 reverb); void Audio_SetCodeReverb(s8 reverb); -void func_800F6700(s8 audioSetting); +void Audio_SetSoundOutputMode(s8 soundSetting); void Audio_SetBaseFilter(u8); void Audio_SetExtraFilter(u8); void Audio_SetCutsceneFlag(s8 flag); @@ -1214,4 +1219,51 @@ void Audio_InitSound(void); void func_800F7170(void); void func_800F71BC(s32 arg0); +extern s16* gWaveSamples[9]; +extern f32 gBendPitchOneOctaveFrequencies[256]; +extern f32 gBendPitchTwoSemitonesFrequencies[256]; +extern f32 gPitchFrequencies[]; +extern u8 gDefaultShortNoteVelocityTable[16]; +extern u8 gDefaultShortNoteGateTimeTable[16]; +extern EnvelopePoint gDefaultEnvelope[4]; +extern NoteSubEu gZeroNoteSub; +extern NoteSubEu gDefaultNoteSub; +extern u16 gHaasEffectDelaySizes[64]; +extern s16 D_8012FBA8[]; +extern f32 gHeadsetPanVolume[128]; +extern f32 gStereoPanVolume[128]; +extern f32 gDefaultPanVolume[128]; +extern s16 gLowPassFilterData[16 * 8]; +extern s16 gHighPassFilterData[15 * 8]; +extern s32 gAudioContextInitialized; +extern u8 gIsLargeSfxBank[7]; +extern u8 gChannelsPerBank[4][7]; +extern u8 gUsedChannelsPerBank[4][7]; +extern u8 gMorphaTransposeTable[16]; + +extern u8 gSeqCmdWritePos; +extern u8 gSeqCmdReadPos; +extern u8 gStartSeqDisabled; + +#if DEBUG_FEATURES +extern u8 gAudioDebugPrintSeqCmd; +#endif + +extern u8 gSoundOutputModes[]; +extern u8 gAudioSpecId; +extern u8 D_80133418; +extern AudioSpec gAudioSpecs[18]; + +extern TempoData gTempoData; +extern AudioHeapInitSizes gAudioHeapInitSizes; + +extern AudioTable gSequenceTable; +extern AudioTable gSoundFontTable; +extern u8 gSequenceFontTable[]; +extern AudioTable gSampleBankTable; + +extern ActiveSequence gActiveSeqs[4]; +extern AudioContext gAudioCtx; +extern AudioCustomUpdateFunction gAudioCustomUpdateFunction; + #endif diff --git a/include/z64bgcheck.h b/include/z64bgcheck.h index bb9e9cf148..eb7e9155d0 100644 --- a/include/z64bgcheck.h +++ b/include/z64bgcheck.h @@ -215,7 +215,7 @@ typedef enum ConveyorSpeed { } ConveyorSpeed; #define CONVEYOR_DIRECTION_TO_BINANG(conveyorDirection) ((conveyorDirection) * (0x10000 / 64)) -#define CONVEYOR_DIRECTION_FROM_BINANG(conveyorDirectionBinang) ((conveyorDirectionBinang) * (64 / 0x10000)) +#define CONVEYOR_DIRECTION_FROM_BINANG(conveyorDirectionBinang) ((conveyorDirectionBinang) / (0x10000 / 64)) #define SURFACETYPE0(bgCamIndex, exitIndex, floorType, unk18, wallType, floorProperty, isSoft, isHorseBlocked) \ ((((bgCamIndex) & 0xFF) << 0) | \ diff --git a/include/z64camera.h b/include/z64camera.h index 1e831a909e..2fcbffdf5a 100644 --- a/include/z64camera.h +++ b/include/z64camera.h @@ -4,7 +4,6 @@ #include "ultra64.h" #include "z64cutscene.h" #include "z64math.h" -#include "z64save.h" struct CollisionContext; struct View; @@ -1622,82 +1621,7 @@ typedef struct Camera { /* 0x16A */ s16 unk_16A; } Camera; // size = 0x16C -/** - * Debug Camera -*/ - -typedef struct DebugCamSub { - /* 0x0000 */ s16 mode; - /* 0x0002 */ s16 nFrames; - /* 0x0004 */ s16 nPoints; - /* 0x0006 */ s16 unkIdx; - /* 0x0008 */ s16 unk_08; - /* 0x000A */ s16 unk_0A; - /* 0x000C */ s32 unk_0C; // bool: indicates position vs lookAt? - /* 0x0010 */ char unk_10[0x14]; - /* 0x0024 */ CutsceneCameraPoint position[129]; - /* 0x0834 */ CutsceneCameraPoint lookAt[129]; - /* 0x1044 */ s16 demoCtrlMenu; - /* 0x1046 */ s16 demoCtrlActionIdx; // e (?), s (save), l (load), c (clear) - /* 0x1048 */ s16 demoCtrlToggleSwitch; - /* 0x104A */ Vec3s unk_104A; -} DebugCamSub; // size = 0x1050 - -typedef struct DebugCam { - /* 0x00 */ s32 unk_00; - /* 0x04 */ Vec3f at; - /* 0x10 */ Vec3f eye; - /* 0x1C */ Vec3f unk_1C; - /* 0x28 */ char unk_28[0xC]; - /* 0x34 */ s32 unk_34; - /* 0x38 */ s32 unk_38; - /* 0x3C */ s32 unk_3C; // bool - /* 0x40 */ s32 unk_40; - /* 0x44 */ s32 unk_44; - /* 0x48 */ f32 fov; - /* 0x4C */ s16 roll; - /* 0x4E */ char unk_4E[0x2]; - /* 0x50 */ f32 rollDegrees; - /* 0x54 */ Vec3f unk_54; - /* 0x60 */ Vec3f unk_60; - /* 0x6C */ Vec3f unk_6C; - /* 0x78 */ s16 unk_78; - /* 0x7A */ s16 unk_7A; - /* 0x7C */ DebugCamSub sub; -} DebugCam; // size = 0x10CC - -typedef struct DebugCamCut { - /* 0x00 */ char letter; - /* 0x01 */ u8 unk_01; - /* 0x02 */ s16 mode; - /* 0x04 */ CutsceneCameraPoint* position; - /* 0x08 */ CutsceneCameraPoint* lookAt; - /* 0x0C */ s16 nFrames; - /* 0x0E */ s16 nPoints; -} DebugCamCut; // size = 0x10 - -typedef struct DebugCamAnim { - /* 0x00 */ f32 curFrame; - /* 0x04 */ f32 unk_04; // frame count? - /* 0x08 */ s16 keyframe; - /* 0x0A */ s16 unk_0A; - /* 0x0C */ s16 unk_0C; - /* 0x10 */ Vec3f positionPos; // confusing name - /* 0x1C */ Vec3f lookAtPos; - /* 0x28 */ f32 roll; - /* 0x2C */ f32 fov; -} DebugCamAnim; // size = 0x30 - -typedef enum DebugCamTextColor { - /* 0 */ DEBUG_CAM_TEXT_YELLOW, - /* 1 */ DEBUG_CAM_TEXT_PEACH, - /* 2 */ DEBUG_CAM_TEXT_BROWN, - /* 3 */ DEBUG_CAM_TEXT_ORANGE, - /* 4 */ DEBUG_CAM_TEXT_GOLD, - /* 5 */ DEBUG_CAM_TEXT_WHITE, - /* 6 */ DEBUG_CAM_TEXT_BLUE, - /* 7 */ DEBUG_CAM_TEXT_GREEN -} DebugCamTextColor; +extern s32 gDebugCamEnabled; void Camera_Init(Camera* camera, struct View* view, struct CollisionContext* colCtx, struct PlayState* play); void Camera_InitDataUsingPlayer(Camera* camera, struct Player* player); diff --git a/include/z64curve.h b/include/z64curve.h index 2f35aec967..8fb83242ba 100644 --- a/include/z64curve.h +++ b/include/z64curve.h @@ -5,6 +5,7 @@ #include "z64math.h" struct PlayState; +struct Actor; typedef struct CurveInterpKnot { /* 0x0 */ u16 flags; // Only the bottom two bits are used, although others are set in objects @@ -56,7 +57,7 @@ void SkelCurve_Destroy(struct PlayState* play, SkelCurve* skelCurve); void SkelCurve_SetAnim(SkelCurve* skelCurve, CurveAnimationHeader* animation, f32 arg2, f32 endFrame, f32 curFrame, f32 playSpeed); s32 SkelCurve_Update(struct PlayState* play, SkelCurve* skelCurve); -void SkelCurve_Draw(Actor* actor, struct PlayState* play, SkelCurve* skelCurve, OverrideCurveLimbDraw overrideLimbDraw, +void SkelCurve_Draw(struct Actor* actor, struct PlayState* play, SkelCurve* skelCurve, OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, void* data); #endif diff --git a/include/z64cutscene.h b/include/z64cutscene.h index c9200c24f9..f8aed368d4 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -515,6 +515,14 @@ typedef struct CutsceneContext { /* 0x28 */ CsCmdActorCue* actorCues[10]; // "npcdemopnt" } CutsceneContext; // size = 0x50 +extern u8 gUseCutsceneCam; +extern u16 D_8015FCCC; +extern char D_8015FCD0[20]; +extern u8 D_8015FCE4; +extern u16 gCamAtSplinePointsAppliedFrame; +extern u16 gCamEyePointAppliedFrame; +extern u16 gCamAtPointAppliedFrame; + void Cutscene_InitContext(struct PlayState* play, CutsceneContext* csCtx); void Cutscene_StartManual(struct PlayState* play, CutsceneContext* csCtx); void Cutscene_StopManual(struct PlayState* play, CutsceneContext* csCtx); diff --git a/include/z64cutscene_flags.h b/include/z64cutscene_flags.h new file mode 100644 index 0000000000..5a3c7c2a7a --- /dev/null +++ b/include/z64cutscene_flags.h @@ -0,0 +1,13 @@ +#ifndef Z64CUTSCENE_FLAGS_H +#define Z64CUTSCENE_FLAGS_H + +#include "ultra64.h" + +struct PlayState; + +void CutsceneFlags_UnsetAll(struct PlayState* play); +void CutsceneFlags_Set(struct PlayState* play, s16 flag); +void CutsceneFlags_Unset(struct PlayState* play, s16 flag); +s32 CutsceneFlags_Get(struct PlayState* play, s16 flag); + +#endif diff --git a/include/z64cutscene_spline.h b/include/z64cutscene_spline.h new file mode 100644 index 0000000000..3a73949453 --- /dev/null +++ b/include/z64cutscene_spline.h @@ -0,0 +1,12 @@ +#ifndef Z64CUTSCENE_SPLINE_H +#define Z64CUTSCENE_SPLINE_H + +#include "ultra64.h" +#include "z64math.h" + +union CutsceneCameraPoint; + +void func_800BB0A0(f32 u, Vec3f* pos, f32* roll, f32* viewAngle, f32* point0, f32* point1, f32* point2, f32* point3); +s32 func_800BB2B4(Vec3f* pos, f32* roll, f32* fov, union CutsceneCameraPoint* point, s16* keyFrame, f32* curFrame); + +#endif diff --git a/include/z64debug.h b/include/z64debug.h new file mode 100644 index 0000000000..0e2c7334ee --- /dev/null +++ b/include/z64debug.h @@ -0,0 +1,17 @@ +#ifndef Z64DEBUG_H +#define Z64DEBUG_H + +#include "ultra64.h" + +struct GraphicsContext; +struct Input; + +void Regs_Init(void); +void DebugCamera_ScreenText(u8 x, u8 y, const char* text); +void DebugCamera_ScreenTextColored(u8 x, u8 y, u8 colorIndex, const char* text); +#if DEBUG_FEATURES +void Regs_UpdateEditor(struct Input* input); +#endif +void Debug_DrawText(struct GraphicsContext* gfxCtx); + +#endif diff --git a/include/z64dma.h b/include/z64dma.h index b9cbf6a42d..10968517bc 100755 --- a/include/z64dma.h +++ b/include/z64dma.h @@ -50,4 +50,12 @@ s32 DmaMgr_AudioDmaHandler(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction); void DmaMgr_Init(void); +#if DEBUG_FEATURES +#define DMA_REQUEST_SYNC(ram, vrom, size, file, line) DmaMgr_RequestSyncDebug(ram, vrom, size, file, line) +#define DMA_REQUEST_ASYNC(req, ram, vrom, size, unk5, queue, msg, file, line) DmaMgr_RequestAsyncDebug(req, ram, vrom, size, unk5, queue, msg, file, line) +#else +#define DMA_REQUEST_SYNC(ram, vrom, size, file, line) DmaMgr_RequestSync(ram, vrom, size) +#define DMA_REQUEST_ASYNC(req, ram, vrom, size, unk5, queue, msg, file, line) DmaMgr_RequestAsync(req, ram, vrom, size, unk5, queue, msg) +#endif + #endif diff --git a/include/z64effect.h b/include/z64effect.h index bad2b1d324..0c07cc5124 100644 --- a/include/z64effect.h +++ b/include/z64effect.h @@ -262,6 +262,8 @@ typedef enum EffectSsType { #undef DEFINE_EFFECT_SS #undef DEFINE_EFFECT_SS_UNSET +extern EffectSsOverlay gEffectSsOverlayTable[EFFECT_SS_TYPE_MAX]; + void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2); void EffectBlure_AddSpace(EffectBlure* this); void EffectBlure_Init1(void* thisx, void* initParamsx); diff --git a/include/z64environment.h b/include/z64environment.h index 598c4655a9..4c4bc770cd 100644 --- a/include/z64environment.h +++ b/include/z64environment.h @@ -242,6 +242,19 @@ extern u8 gLightConfigAfterUnderwater; extern u8 gInterruptSongOfStorms; extern u16 gTimeSpeed; +extern LightningStrike gLightningStrike; +// TODO: These variables are here for BSS ordering but ideally they should not +// be extern. This could be fixed by putting more stuff (e.g. struct definitions) +// between gLightningStrike and gCustomLensFlareOn. +extern s16 sLightningFlashAlpha; +extern s16 sSunDepthTestX; +extern s16 sSunDepthTestY; +extern u8 gCustomLensFlareOn; +extern Vec3f gCustomLensFlarePos; +extern s16 gLensFlareScale; +extern f32 gLensFlareColorIntensity; +extern s16 gLensFlareGlareStrength; + void Environment_UpdateSkybox(u8 skyboxId, EnvironmentContext* envCtx, struct SkyboxContext* skyboxCtx); void Environment_DrawSkyboxFilters(struct PlayState* play); diff --git a/include/z64face_reaction.h b/include/z64face_reaction.h new file mode 100644 index 0000000000..274340ebcb --- /dev/null +++ b/include/z64face_reaction.h @@ -0,0 +1,74 @@ +#ifndef Z64FACE_REACTION_H +#define Z64FACE_REACTION_H + +#include "ultra64.h" + +struct PlayState; + +typedef enum MaskReactionSet { + /* 0x00 */ MASK_REACTION_SET_CARPENTER_BOSS, + /* 0x01 */ MASK_REACTION_SET_CARPENTER_1, + /* 0x02 */ MASK_REACTION_SET_CARPENTER_2, + /* 0x03 */ MASK_REACTION_SET_CARPENTER_3, + /* 0x04 */ MASK_REACTION_SET_CARPENTER_4, + /* 0x05 */ MASK_REACTION_SET_HYRULIAN_GUARD, + /* 0x06 */ MASK_REACTION_SET_HEISHI4_1, + /* 0x07 */ MASK_REACTION_SET_HEISHI4_2, + /* 0x08 */ MASK_REACTION_SET_CUCCO_LADY, + /* 0x09 */ MASK_REACTION_SET_CARPENTERS_SON, + /* 0x0A */ MASK_REACTION_SET_KAKARIKO_ROOF_MAN, + /* 0x0B */ MASK_REACTION_SET_WINDMILL_MAN, + /* 0x0C */ MASK_REACTION_SET_12, // Unused + /* 0x0D */ MASK_REACTION_SET_CURSED_SKULLTULA_MAN, + /* 0x0E */ MASK_REACTION_SET_DAMPE, + /* 0x0F */ MASK_REACTION_SET_GRAVEYARD_KID, + /* 0x10 */ MASK_REACTION_SET_SARIA, + /* 0x11 */ MASK_REACTION_SET_MIDO, + /* 0x12 */ MASK_REACTION_SET_FADO, + /* 0x13 */ MASK_REACTION_SET_KOKIRI_1, + /* 0x14 */ MASK_REACTION_SET_KOKIRI_2, + /* 0x15 */ MASK_REACTION_SET_SKULL_KID, + /* 0x16 */ MASK_REACTION_SET_ZELDA, + /* 0x17 */ MASK_REACTION_SET_MALON, + /* 0x18 */ MASK_REACTION_SET_TALON, + /* 0x19 */ MASK_REACTION_SET_INGO, + /* 0x1A */ MASK_REACTION_SET_LAKESIDE_PROFESSOR, + /* 0x1B */ MASK_REACTION_SET_MAGIC_BEAN_SALESMAN, + /* 0x1C */ MASK_REACTION_SET_RUNNING_MAN, + /* 0x1D */ MASK_REACTION_SET_ZORA, + /* 0x1E */ MASK_REACTION_SET_KING_ZORA, + /* 0x1F */ MASK_REACTION_SET_RUTO, + /* 0x20 */ MASK_REACTION_SET_GORON, + /* 0x21 */ MASK_REACTION_SET_DARUNIA, + /* 0x22 */ MASK_REACTION_SET_GERUDO_WHITE, + /* 0x23 */ MASK_REACTION_SET_NABOORU, + /* 0x24 */ MASK_REACTION_SET_DANCING_COUPLE, + /* 0x25 */ MASK_REACTION_SET_DOG_LADY, + /* 0x26 */ MASK_REACTION_SET_WOMAN_3, + /* 0x27 */ MASK_REACTION_SET_MAN_1_BEARD, + /* 0x28 */ MASK_REACTION_SET_MAN_2_BALD, + /* 0x29 */ MASK_REACTION_SET_MAN_1_SHAVED_BLACK_SHIRT, + /* 0x2A */ MASK_REACTION_SET_BEGGAR, + /* 0x2B */ MASK_REACTION_SET_OLD_WOMAN, + /* 0x2C */ MASK_REACTION_SET_OLD_MAN, + /* 0x2D */ MASK_REACTION_SET_YOUNG_WOMAN_BROWN_HAIR, + /* 0x2E */ MASK_REACTION_SET_MAN_2_MUSTACHE_RED_SHIRT, + /* 0x2F */ MASK_REACTION_SET_MAN_2_MUSTACHE_BLUE_SHIRT, + /* 0x30 */ MASK_REACTION_SET_YOUNG_WOMAN_ORANGE_HAIR, + /* 0x31 */ MASK_REACTION_SET_MAN_2_ALT_MUSTACHE, + /* 0x32 */ MASK_REACTION_SET_MAN_1_BOWL_CUT_PURPLE_SHIRT, + /* 0x33 */ MASK_REACTION_SET_MAN_2_BEARD, + /* 0x34 */ MASK_REACTION_SET_OLD_MAN_BALD_BROWN_ROBE, + /* 0x35 */ MASK_REACTION_SET_MAN_2_MUSTACHE_WHITE_SHIRT, + /* 0x36 */ MASK_REACTION_SET_MAN_1_SHAVED_GREEN_SHIRT, + /* 0x37 */ MASK_REACTION_SET_WOMAN_2, + /* 0x38 */ MASK_REACTION_SET_OLD_MAN_BALD_PURPLE_ROBE, + /* 0x39 */ MASK_REACTION_SET_MAN_1_BOWL_CUT_GREEN_SHIRT, + /* 0x3A */ MASK_REACTION_SET_HAGGLING_TOWNSPEOPLE_1, + /* 0x3B */ MASK_REACTION_SET_HAGGLING_TOWNSPEOPLE_2, + /* 0x3C */ MASK_REACTION_SET_MAX +} MaskReactionSet; + +u16 MaskReaction_GetTextId(struct PlayState* play, u32 maskReactionSet); + +#endif diff --git a/include/z64font.h b/include/z64font.h new file mode 100644 index 0000000000..72f97fddd6 --- /dev/null +++ b/include/z64font.h @@ -0,0 +1,41 @@ +#ifndef Z64FONT_H +#define Z64FONT_H + +#include "ultra64.h" + +// TODO get these properties from the textures themselves +#define FONT_CHAR_TEX_WIDTH 16 +#define FONT_CHAR_TEX_HEIGHT 16 +#define FONT_CHAR_TEX_SIZE ((FONT_CHAR_TEX_WIDTH * FONT_CHAR_TEX_HEIGHT) / 2) // 16x16 I4 texture + +typedef struct Font { + /* 0x0000 */ u32 msgOffset; + /* 0x0004 */ u32 msgLength; + union { + /* 0x0008 */ u8 charTexBuf[FONT_CHAR_TEX_SIZE * 120]; + /* 0x0008 */ u64 force_structure_alignment_charTex; + }; + union { + /* 0x3C08 */ u8 iconBuf[FONT_CHAR_TEX_SIZE]; + /* 0x3C08 */ u64 force_structure_alignment_icon; + }; + union { + /* 0x3C88 */ u8 fontBuf[FONT_CHAR_TEX_SIZE * 320]; + /* 0x3C88 */ u64 force_structure_alignment_font; + }; + union { + /* 0xDC88 */ u8 msgBuf[1280]; + /* 0xDC88 */ u16 msgBufWide[640]; + /* 0xDC88 */ u64 force_structure_alignment_msg; + }; +} Font; // size = 0xE188 + +#if PLATFORM_IQUE +void Font_LoadCharCHN(Font* font, u16 character, u16 codePointIndex); +#endif +void Font_LoadCharWide(Font* font, u16 character, u16 codePointIndex); +void Font_LoadChar(Font* font, u8 character, u16 codePointIndex); +void Font_LoadMessageBoxIcon(Font* font, u16 icon); +void Font_LoadOrderedFont(Font* font); + +#endif diff --git a/include/z64game.h b/include/z64game.h index 3b50cfd362..fe683777b7 100644 --- a/include/z64game.h +++ b/include/z64game.h @@ -3,33 +3,12 @@ // This file is named "game" after game.c for now, this may change later with the system name #include "ultra64/ultratypes.h" -#include "padmgr.h" +#include "libu64/pad.h" +#include "gamealloc.h" +#include "romfile.h" #include "tha.h" struct GraphicsContext; - -typedef struct GameAllocEntry { - /* 0x00 */ struct GameAllocEntry* next; - /* 0x04 */ struct GameAllocEntry* prev; - /* 0x08 */ u32 size; - /* 0x0C */ u32 unk_0C; -} GameAllocEntry; // size = 0x10 - -typedef struct GameAlloc { - /* 0x00 */ GameAllocEntry base; - /* 0x10 */ GameAllocEntry* head; -} GameAlloc; // size = 0x14 - -// Used in Graph_GetNextGameState in graph.c -#define DEFINE_GAMESTATE_INTERNAL(typeName, enumName) enumName, -#define DEFINE_GAMESTATE(typeName, enumName, name) DEFINE_GAMESTATE_INTERNAL(typeName, enumName) -typedef enum GameStateId { -#include "tables/gamestate_table.h" - GAMESTATE_ID_MAX -} GameStateId; -#undef DEFINE_GAMESTATE -#undef DEFINE_GAMESTATE_INTERNAL - struct GameState; typedef void (*GameStateFunc)(struct GameState* gameState); @@ -48,4 +27,27 @@ typedef struct GameState { /* 0xA0 */ u32 inPreNMIState; } GameState; // size = 0xA4 +#define SET_NEXT_GAMESTATE(curState, newInit, newStruct) \ + if (1) { \ + GameState* state = curState; \ + \ + (state)->init = newInit; \ + (state)->size = sizeof(newStruct); \ + } (void)0 + +void GameState_ReqPadData(GameState* gameState); +void GameState_Update(GameState* gameState); +void GameState_InitArena(GameState* gameState, size_t size); +void GameState_Realloc(GameState* gameState, size_t size); +void GameState_Init(GameState* gameState, GameStateFunc init, struct GraphicsContext* gfxCtx); +void GameState_Destroy(GameState* gameState); +GameStateFunc GameState_GetInit(GameState* gameState); +u32 GameState_IsRunning(GameState* gameState); +#if DEBUG_FEATURES +void* GameState_Alloc(GameState* gameState, size_t size, const char* file, int line); +#define GAME_STATE_ALLOC(gameState, size, file, line) GameState_Alloc(gameState, size, file, line) +#else +#define GAME_STATE_ALLOC(gameState, size, file, line) THA_AllocTailAlign16(&(gameState)->tha, size) +#endif + #endif diff --git a/include/z64interface.h b/include/z64interface.h index 5bcad2bc11..bfa3bffeb3 100644 --- a/include/z64interface.h +++ b/include/z64interface.h @@ -279,4 +279,7 @@ void Interface_Update(struct PlayState* play); void Interface_Destroy(struct PlayState* play); void Interface_Init(struct PlayState* play); +extern s16 gSpoilingItems[3]; +extern s16 gSpoilingItemReverts[3]; + #endif diff --git a/include/z64inventory.h b/include/z64inventory.h index 9a8133b3da..8c1a5a90d8 100644 --- a/include/z64inventory.h +++ b/include/z64inventory.h @@ -3,7 +3,6 @@ #include "ultra64.h" #include "z64item.h" -#include "z64save.h" struct PlayState; diff --git a/include/z64lifemeter.h b/include/z64lifemeter.h new file mode 100644 index 0000000000..29b2656b88 --- /dev/null +++ b/include/z64lifemeter.h @@ -0,0 +1,14 @@ +#ifndef Z64LIFEMETER_H +#define Z64LIFEMETER_H + +#include "ultra64/ultratypes.h" + +struct PlayState; + +void Health_InitMeter(struct PlayState* play); +void Health_UpdateMeter(struct PlayState* play); +void Health_DrawMeter(struct PlayState* play); +void Health_UpdateBeatingHeart(struct PlayState* play); +u32 Health_IsCritical(void); + +#endif diff --git a/include/z64map_mark.h b/include/z64map_mark.h index 0c55efa3ae..b566491118 100644 --- a/include/z64map_mark.h +++ b/include/z64map_mark.h @@ -3,6 +3,8 @@ #include "ultra64.h" +struct PlayState; + #define MAP_MARK_NONE -1 #define MAP_MARK_CHEST 0 #define MAP_MARK_BOSS 1 @@ -20,6 +22,10 @@ typedef struct MapMarkIconData { typedef MapMarkIconData MapMarkData[3]; // size = 0x72 +void MapMark_Init(struct PlayState* play); +void MapMark_ClearPointers(struct PlayState* play); +void MapMark_Draw(struct PlayState* play); + extern MapMarkData* gMapMarkDataTable[]; #endif diff --git a/include/z64math.h b/include/z64math.h index 95a494a693..187d95b250 100644 --- a/include/z64math.h +++ b/include/z64math.h @@ -1,11 +1,8 @@ #ifndef Z64MATH_H #define Z64MATH_H -#include "ultra64.h" #include "math.h" - -#define SQ(x) ((x)*(x)) -#define VEC_SET(V,X,Y,Z) (V).x=(X);(V).y=(Y);(V).z=(Z) +#include "ultra64.h" typedef union FloatInt { f32 f; @@ -95,6 +92,27 @@ typedef VecSphGeo VecSph; // Pitch is 0 along the xz-plane (horizon) typedef VecSphGeo VecGeo; +/** + * Macros + */ + +// General number macros +#define SQ(x) ((x)*(x)) +#define ABS(x) ((x) >= 0 ? (x) : -(x)) +#define DECR(x) ((x) == 0 ? 0 : --(x)) +#define CLAMP(x, min, max) ((x) < (min) ? (min) : (x) > (max) ? (max) : (x)) +#define CLAMP_MAX(x, max) ((x) > (max) ? (max) : (x)) +#define CLAMP_MIN(x, min) ((x) < (min) ? (min) : (x)) + +#define SWAP(type, a, b) \ + { \ + type _temp = (a); \ + (a) = (b); \ + (b) = _temp; \ + } \ + (void)0 + +// LERP macros #define LERP(x, y, scale) (((y) - (x)) * (scale) + (x)) #define LERP32(x, y, scale) ((s32)(((y) - (x)) * (scale)) + (x)) #define LERP16(x, y, scale) ((s16)(((y) - (x)) * (scale)) + (x)) @@ -110,6 +128,7 @@ typedef VecSphGeo VecGeo; (dst)->z = (v0)->z + (((v1)->z - (v0)->z) * t); \ } +// Floating point macros #define IS_ZERO(f) (fabsf(f) < 0.008f) // Casting a float to an integer, when the float value is larger than what the integer type can hold, @@ -145,6 +164,7 @@ typedef VecSphGeo VecGeo; #define CAM_BINANG_TO_DEG(binang) ((f32)(binang) * (360.0001525f / 65535.0f)) // Vector macros +#define VEC_SET(V,X,Y,Z) (V).x=(X);(V).y=(Y);(V).z=(Z) #define SQXZ(vec) ((vec).x * (vec).x + (vec).z * (vec).z) #define DOTXZ(vec1, vec2) ((vec1).x * (vec2).x + (vec1).z * (vec2).z) #define SQXYZ(vec) ((vec).x * (vec).x + (vec).y * (vec).y + (vec).z * (vec).z) diff --git a/include/z64message.h b/include/z64message.h index 415ab80ac7..3dfa196d97 100644 --- a/include/z64message.h +++ b/include/z64message.h @@ -3,6 +3,7 @@ #include "z64view.h" #include "versions.h" +#include "z64font.h" struct OcarinaStaff; struct Actor; @@ -14,11 +15,6 @@ typedef enum TextBoxIcon { /* 2 */ TEXTBOX_ICON_ARROW } TextBoxIcon; -// TODO get these properties from the textures themselves -#define FONT_CHAR_TEX_WIDTH 16 -#define FONT_CHAR_TEX_HEIGHT 16 -#define FONT_CHAR_TEX_SIZE ((FONT_CHAR_TEX_WIDTH * FONT_CHAR_TEX_HEIGHT) / 2) // 16x16 I4 texture - // TODO get these properties from the textures themselves #define MESSAGE_STATIC_TEX_SIZE 0x1000 @@ -115,70 +111,6 @@ typedef enum MessageMode { /* 0x37 */ MSGMODE_PAUSED // Causes the message system to do nothing until external code sets a new message mode or calls a public function } MessageMode; -typedef enum MaskReactionSet { - /* 0x00 */ MASK_REACTION_SET_CARPENTER_BOSS, - /* 0x01 */ MASK_REACTION_SET_CARPENTER_1, - /* 0x02 */ MASK_REACTION_SET_CARPENTER_2, - /* 0x03 */ MASK_REACTION_SET_CARPENTER_3, - /* 0x04 */ MASK_REACTION_SET_CARPENTER_4, - /* 0x05 */ MASK_REACTION_SET_HYRULIAN_GUARD, - /* 0x06 */ MASK_REACTION_SET_HEISHI4_1, - /* 0x07 */ MASK_REACTION_SET_HEISHI4_2, - /* 0x08 */ MASK_REACTION_SET_CUCCO_LADY, - /* 0x09 */ MASK_REACTION_SET_CARPENTERS_SON, - /* 0x0A */ MASK_REACTION_SET_KAKARIKO_ROOF_MAN, - /* 0x0B */ MASK_REACTION_SET_WINDMILL_MAN, - /* 0x0C */ MASK_REACTION_SET_12, // Unused - /* 0x0D */ MASK_REACTION_SET_CURSED_SKULLTULA_MAN, - /* 0x0E */ MASK_REACTION_SET_DAMPE, - /* 0x0F */ MASK_REACTION_SET_GRAVEYARD_KID, - /* 0x10 */ MASK_REACTION_SET_SARIA, - /* 0x11 */ MASK_REACTION_SET_MIDO, - /* 0x12 */ MASK_REACTION_SET_FADO, - /* 0x13 */ MASK_REACTION_SET_KOKIRI_1, - /* 0x14 */ MASK_REACTION_SET_KOKIRI_2, - /* 0x15 */ MASK_REACTION_SET_SKULL_KID, - /* 0x16 */ MASK_REACTION_SET_ZELDA, - /* 0x17 */ MASK_REACTION_SET_MALON, - /* 0x18 */ MASK_REACTION_SET_TALON, - /* 0x19 */ MASK_REACTION_SET_INGO, - /* 0x1A */ MASK_REACTION_SET_LAKESIDE_PROFESSOR, - /* 0x1B */ MASK_REACTION_SET_MAGIC_BEAN_SALESMAN, - /* 0x1C */ MASK_REACTION_SET_RUNNING_MAN, - /* 0x1D */ MASK_REACTION_SET_ZORA, - /* 0x1E */ MASK_REACTION_SET_KING_ZORA, - /* 0x1F */ MASK_REACTION_SET_RUTO, - /* 0x20 */ MASK_REACTION_SET_GORON, - /* 0x21 */ MASK_REACTION_SET_DARUNIA, - /* 0x22 */ MASK_REACTION_SET_GERUDO_WHITE, - /* 0x23 */ MASK_REACTION_SET_NABOORU, - /* 0x24 */ MASK_REACTION_SET_DANCING_COUPLE, - /* 0x25 */ MASK_REACTION_SET_DOG_LADY, - /* 0x26 */ MASK_REACTION_SET_WOMAN_3, - /* 0x27 */ MASK_REACTION_SET_MAN_1_BEARD, - /* 0x28 */ MASK_REACTION_SET_MAN_2_BALD, - /* 0x29 */ MASK_REACTION_SET_MAN_1_SHAVED_BLACK_SHIRT, - /* 0x2A */ MASK_REACTION_SET_BEGGAR, - /* 0x2B */ MASK_REACTION_SET_OLD_WOMAN, - /* 0x2C */ MASK_REACTION_SET_OLD_MAN, - /* 0x2D */ MASK_REACTION_SET_YOUNG_WOMAN_BROWN_HAIR, - /* 0x2E */ MASK_REACTION_SET_MAN_2_MUSTACHE_RED_SHIRT, - /* 0x2F */ MASK_REACTION_SET_MAN_2_MUSTACHE_BLUE_SHIRT, - /* 0x30 */ MASK_REACTION_SET_YOUNG_WOMAN_ORANGE_HAIR, - /* 0x31 */ MASK_REACTION_SET_MAN_2_ALT_MUSTACHE, - /* 0x32 */ MASK_REACTION_SET_MAN_1_BOWL_CUT_PURPLE_SHIRT, - /* 0x33 */ MASK_REACTION_SET_MAN_2_BEARD, - /* 0x34 */ MASK_REACTION_SET_OLD_MAN_BALD_BROWN_ROBE, - /* 0x35 */ MASK_REACTION_SET_MAN_2_MUSTACHE_WHITE_SHIRT, - /* 0x36 */ MASK_REACTION_SET_MAN_1_SHAVED_GREEN_SHIRT, - /* 0x37 */ MASK_REACTION_SET_WOMAN_2, - /* 0x38 */ MASK_REACTION_SET_OLD_MAN_BALD_PURPLE_ROBE, - /* 0x39 */ MASK_REACTION_SET_MAN_1_BOWL_CUT_GREEN_SHIRT, - /* 0x3A */ MASK_REACTION_SET_HAGGLING_TOWNSPEOPLE_1, - /* 0x3B */ MASK_REACTION_SET_HAGGLING_TOWNSPEOPLE_2, - /* 0x3C */ MASK_REACTION_SET_MAX -} MaskReactionSet; - typedef enum TextState { /* 0 */ TEXT_STATE_NONE, /* 1 */ TEXT_STATE_DONE_HAS_NEXT, @@ -193,28 +125,6 @@ typedef enum TextState { /* 10 */ TEXT_STATE_AWAITING_NEXT } TextState; -typedef struct Font { - /* 0x0000 */ u32 msgOffset; - /* 0x0004 */ u32 msgLength; - union { - /* 0x0008 */ u8 charTexBuf[FONT_CHAR_TEX_SIZE * 120]; - /* 0x0008 */ u64 force_structure_alignment_charTex; - }; - union { - /* 0x3C08 */ u8 iconBuf[FONT_CHAR_TEX_SIZE]; - /* 0x3C08 */ u64 force_structure_alignment_icon; - }; - union { - /* 0x3C88 */ u8 fontBuf[FONT_CHAR_TEX_SIZE * 320]; - /* 0x3C88 */ u64 force_structure_alignment_font; - }; - union { - /* 0xDC88 */ u8 msgBuf[1280]; - /* 0xDC88 */ u16 msgBufWide[640]; - /* 0xDC88 */ u64 force_structure_alignment_msg; - }; -} Font; // size = 0xE188 - #define TEXTBOX_ENDTYPE_DEFAULT 0x00 #define TEXTBOX_ENDTYPE_2_CHOICE 0x10 #define TEXTBOX_ENDTYPE_3_CHOICE 0x20 @@ -293,4 +203,6 @@ void Message_Update(struct PlayState* play); void Message_SetTables(void); void Message_Init(struct PlayState* play); +extern s16 gOcarinaSongItemMap[]; + #endif diff --git a/include/z64ocarina.h b/include/z64ocarina.h index afad53811b..d00ef01f2b 100644 --- a/include/z64ocarina.h +++ b/include/z64ocarina.h @@ -188,4 +188,9 @@ void AudioOcarina_MemoryGameInit(u8 minigameRound); s32 AudioOcarina_MemoryGameNextNote(void); void AudioOcarina_PlayLongScarecrowSong(void); +extern u8* gFrogsSongPtr; +extern OcarinaNote* gScarecrowLongSongPtr; +extern u8* gScarecrowSpawnSongPtr; +extern OcarinaSongButtons gOcarinaSongButtons[]; + #endif diff --git a/include/z64path.h b/include/z64path.h new file mode 100644 index 0000000000..0f9243974a --- /dev/null +++ b/include/z64path.h @@ -0,0 +1,19 @@ +#ifndef Z64PATH_H +#define Z64PATH_H + +#include "ultra64.h" +#include "z64math.h" + +struct PlayState; +struct Actor; + +typedef struct Path { + /* 0x00 */ u8 count; // number of points in the path + /* 0x04 */ Vec3s* points; // Segment Address to the array of points +} Path; // size = 0x8 + +Path* Path_GetByIndex(struct PlayState* play, s16 index, s16 max); +f32 Path_OrientAndGetDistSq(struct Actor* actor, Path* path, s16 waypoint, s16* yaw); +void Path_CopyLastPoint(Path* path, Vec3f* dest); + +#endif diff --git a/include/z64pause.h b/include/z64pause.h index 97ae476d1a..da0e56038a 100644 --- a/include/z64pause.h +++ b/include/z64pause.h @@ -252,4 +252,9 @@ void KaleidoSetup_Update(struct PlayState* play); void KaleidoSetup_Init(struct PlayState* play); void KaleidoSetup_Destroy(struct PlayState* play); +extern u8 gBossMarkState; +extern f32 gBossMarkScale; +extern u32 D_8016139C; +extern PauseMapMarksData* gLoadedPauseMarkDataTable; + #endif diff --git a/include/z64play.h b/include/z64play.h index cb2e78edc4..4853ac8f47 100644 --- a/include/z64play.h +++ b/include/z64play.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "prerender.h" - +#include "transition_tile.h" #include "z64actor.h" #include "z64bgcheck.h" #include "z64camera.h" @@ -18,6 +18,7 @@ #include "z64message.h" #include "z64object.h" #include "z64pause.h" +#include "z64room.h" #include "z64scene.h" #include "z64sfx_source.h" #include "z64skybox.h" @@ -26,10 +27,26 @@ #include "z64view.h" union Color_RGBA8_u32; +struct Path; struct Player; struct QuestHintCmd; struct VisMono; +typedef enum PauseBgPreRenderState { + /* 0 */ PAUSE_BG_PRERENDER_OFF, // Inactive, do nothing. + /* 1 */ PAUSE_BG_PRERENDER_SETUP, // The current frame is only drawn for the purpose of serving as the pause background. + /* 2 */ PAUSE_BG_PRERENDER_PROCESS, // The previous frame was PAUSE_BG_PRERENDER_SETUP, now apply prerender filters. + /* 3 */ PAUSE_BG_PRERENDER_READY, // The pause background is ready to be used. + /* 4 */ PAUSE_BG_PRERENDER_MAX +} PauseBgPreRenderState; + +typedef enum TransitionTileState { + /* 0 */ TRANS_TILE_OFF, // Inactive, do nothing + /* 1 */ TRANS_TILE_SETUP, // Save the necessary buffers + /* 2 */ TRANS_TILE_PROCESS, // Initialize the transition + /* 3 */ TRANS_TILE_READY // The transition is ready, so will update and draw each frame +} TransitionTileState; + typedef struct SceneSequences { /* 0x00 */ u8 seqId; /* 0x01 */ u8 natureAmbienceId; @@ -88,7 +105,7 @@ typedef struct PlayState { /* 0x11DFC */ void* unk_11DFC; /* 0x11E00 */ Spawn* spawnList; /* 0x11E04 */ s16* exitList; - /* 0x11E08 */ Path* pathList; + /* 0x11E08 */ struct Path* pathList; /* 0x11E0C */ struct QuestHintCmd* naviQuestHints; /* 0x11E10 */ void* specialEffects; /* 0x11E14 */ u8 skyboxId; @@ -115,6 +132,8 @@ typedef struct PlayState { /* 0x12430 */ char unk_12430[0xE8]; } PlayState; // size = 0x12518 +extern Mtx D_01000000; // billboardMtx + #define GET_ACTIVE_CAM(play) ((play)->cameraPtrs[(play)->activeCamId]) #define GET_PLAYER(play) ((Player*)(play)->actorCtx.actorLists[ACTORCAT_PLAYER].head) @@ -122,8 +141,6 @@ void Play_SetViewpoint(PlayState* this, s16 viewpoint); s32 Play_CheckViewpoint(PlayState* this, s16 viewpoint); void Play_SetShopBrowsingViewpoint(PlayState* this); Gfx* Play_SetFog(PlayState* this, Gfx* gfx); -void Play_Destroy(GameState* thisx); -void Play_Init(GameState* thisx); void Play_Main(GameState* thisx); int Play_InCsMode(PlayState* this); f32 func_800BFCB8(PlayState* this, MtxF* mf, Vec3f* pos); @@ -148,6 +165,11 @@ void Play_SetupRespawnPoint(PlayState* this, s32 respawnMode, s32 playerParams); void Play_TriggerVoidOut(PlayState* this); void Play_TriggerRespawn(PlayState* this); int Play_CamIsNotFixed(PlayState* this); +s32 func_800C0D34(PlayState* this, Actor* actor, s16* yaw); +s32 func_800C0DB4(PlayState* this, Vec3f* pos); + +void Play_Init(GameState* thisx); +void Play_Destroy(GameState* thisx); #if DEBUG_FEATURES extern void* gDebugCutsceneScript; diff --git a/include/z64quest_hint.h b/include/z64quest_hint.h new file mode 100644 index 0000000000..b592a07c34 --- /dev/null +++ b/include/z64quest_hint.h @@ -0,0 +1,11 @@ +#ifndef Z64QUEST_HINT_H +#define Z64QUEST_HINT_H + +#include "ultra64.h" + +struct PlayState; + +u16 QuestHint_GetSariaTextId(struct PlayState* play); +u16 QuestHint_GetNaviTextId(struct PlayState* play); + +#endif diff --git a/include/z64quest_hint_commands.h b/include/z64quest_hint_commands.h index 62f262f39b..8b99510160 100644 --- a/include/z64quest_hint_commands.h +++ b/include/z64quest_hint_commands.h @@ -3,6 +3,13 @@ #include "ultra64.h" +typedef struct QuestHintCmd { + /* 0x00 */ u8 byte0; + /* 0x01 */ u8 byte1; + /* 0x02 */ u8 byte2; + /* 0x03 */ u8 byte3; +} QuestHintCmd; // size = 0x4 + /* * Hint Command Types */ diff --git a/include/z64room.h b/include/z64room.h new file mode 100644 index 0000000000..72c6f0982b --- /dev/null +++ b/include/z64room.h @@ -0,0 +1,174 @@ +#ifndef Z64ROOM_H +#define Z64ROOM_H + +#include "ultra64.h" +#include "z64dma.h" +#include "z64math.h" + +struct Input; +struct PlayState; + +// Room shapes + +typedef enum RoomShapeType { + /* 0 */ ROOM_SHAPE_TYPE_NORMAL, + /* 1 */ ROOM_SHAPE_TYPE_IMAGE, + /* 2 */ ROOM_SHAPE_TYPE_CULLABLE, + /* 3 */ ROOM_SHAPE_TYPE_MAX +} RoomShapeType; + +typedef struct RoomShapeBase { + /* 0x00 */ u8 type; +} RoomShapeBase; // size = 0x01 + +typedef struct RoomShapeDListsEntry { + /* 0x00 */ Gfx* opa; + /* 0x04 */ Gfx* xlu; +} RoomShapeDListsEntry; // size = 0x08 + +typedef struct RoomShapeNormal { + /* 0x00 */ RoomShapeBase base; + /* 0x01 */ u8 numEntries; + /* 0x04 */ RoomShapeDListsEntry* entries; + /* 0x08 */ RoomShapeDListsEntry* entriesEnd; +} RoomShapeNormal; // size = 0x0C + +typedef enum RoomShapeImageAmountType { + /* 1 */ ROOM_SHAPE_IMAGE_AMOUNT_SINGLE = 1, + /* 2 */ ROOM_SHAPE_IMAGE_AMOUNT_MULTI +} RoomShapeImageAmountType; + +typedef struct RoomShapeImageBase { + /* 0x00 */ RoomShapeBase base; + /* 0x01 */ u8 amountType; // RoomShapeImageAmountType + /* 0x04 */ RoomShapeDListsEntry* entry; +} RoomShapeImageBase; // size = 0x08 + +typedef struct RoomShapeImageSingle { + /* 0x00 */ RoomShapeImageBase base; + /* 0x08 */ void* source; + /* 0x0C */ u32 unk_0C; + /* 0x10 */ void* tlut; + /* 0x14 */ u16 width; + /* 0x16 */ u16 height; + /* 0x18 */ u8 fmt; + /* 0x19 */ u8 siz; + /* 0x1A */ u16 tlutMode; + /* 0x1C */ u16 tlutCount; +} RoomShapeImageSingle; // size = 0x20 + +typedef struct RoomShapeImageMultiBgEntry { + /* 0x00 */ u16 unk_00; + /* 0x02 */ u8 bgCamIndex; // for which bg cam index is this entry for + /* 0x04 */ void* source; + /* 0x08 */ u32 unk_0C; + /* 0x0C */ void* tlut; + /* 0x10 */ u16 width; + /* 0x12 */ u16 height; + /* 0x14 */ u8 fmt; + /* 0x15 */ u8 siz; + /* 0x16 */ u16 tlutMode; + /* 0x18 */ u16 tlutCount; +} RoomShapeImageMultiBgEntry; // size = 0x1C + +typedef struct RoomShapeImageMulti { + /* 0x00 */ RoomShapeImageBase base; + /* 0x08 */ u8 numBackgrounds; + /* 0x0C */ RoomShapeImageMultiBgEntry* backgrounds; +} RoomShapeImageMulti; // size = 0x10 + +typedef struct RoomShapeCullableEntry { + /* 0x00 */ Vec3s boundsSphereCenter; + /* 0x06 */ s16 boundsSphereRadius; + /* 0x08 */ Gfx* opa; + /* 0x0C */ Gfx* xlu; +} RoomShapeCullableEntry; // size = 0x10 + +#define ROOM_SHAPE_CULLABLE_MAX_ENTRIES 64 + +typedef struct RoomShapeCullable { + /* 0x00 */ RoomShapeBase base; + /* 0x01 */ u8 numEntries; + /* 0x04 */ RoomShapeCullableEntry* entries; + /* 0x08 */ RoomShapeCullableEntry* entriesEnd; +} RoomShapeCullable; // size = 0x0C + +typedef union RoomShape { + RoomShapeBase base; + RoomShapeNormal normal; + union { + RoomShapeImageBase base; + RoomShapeImageSingle single; + RoomShapeImageMulti multi; + } image; + RoomShapeCullable cullable; +} RoomShape; // "Ground Shape" + +typedef enum RoomType { + /* 0 */ ROOM_TYPE_NORMAL, + /* 1 */ ROOM_TYPE_DUNGEON, // Blocks Sun's Song's time advance effect. Not exclusively used by typical dungeon rooms. + /* 2 */ ROOM_TYPE_INDOORS, // Reduces player run speed and blocks player from attacking or jumping. + /* 3 */ ROOM_TYPE_3, // Unused. Color dithering is turned off when drawing the room and other things. + /* 4 */ ROOM_TYPE_4, // Unused. Prevents switching to CAM_SET_HORSE when mounting a horse. + /* 5 */ ROOM_TYPE_BOSS // Disables Environment_AdjustLights +} RoomType; + +typedef enum RoomEnvironmentType { + /* 0 */ ROOM_ENV_DEFAULT, + /* 1 */ ROOM_ENV_COLD, + /* 2 */ ROOM_ENV_WARM, + /* 3 */ ROOM_ENV_HOT, // Enables hot room timer for the current room + /* 4 */ ROOM_ENV_UNK_STRETCH_1, + /* 5 */ ROOM_ENV_UNK_STRETCH_2, + /* 6 */ ROOM_ENV_UNK_STRETCH_3 +} RoomEnvironmentType; + +typedef enum LensMode { + /* 0 */ LENS_MODE_SHOW_ACTORS, // lens actors are invisible by default, and shown by using lens (for example, invisible enemies) + /* 1 */ LENS_MODE_HIDE_ACTORS // lens actors are visible by default, and hidden by using lens (for example, fake walls) +} LensMode; + +typedef struct Room { + /* 0x00 */ s8 num; // -1 is invalid room + /* 0x01 */ u8 unk_01; + /* 0x02 */ u8 environmentType; + /* 0x03 */ u8 type; + /* 0x04 */ s8 echo; + /* 0x05 */ u8 lensMode; + /* 0x08 */ RoomShape* roomShape; // original name: "ground_shape" + /* 0x0C */ void* segment; + /* 0x10 */ char unk_10[0x4]; +} Room; // size = 0x14 + +typedef struct RoomContext { + /* 0x00 */ Room curRoom; + /* 0x14 */ Room prevRoom; + /* 0x28 */ void* bufPtrs[2]; // Start and end pointers for the room buffer. Can be split into two pages, where page 0 is allocated from the start pointer and page 1 is allocated from the end pointer. + /* 0x30 */ u8 activeBufPage; // 0 - First page in memory, 1 - Last page in memory + /* 0x31 */ s8 status; // 0 - Free for new room request, 1 - DmaRequest for a new room is in progress + /* 0x34 */ void* roomRequestAddr; // Pointer to where the requested room segment will be stored + /* 0x38 */ DmaRequest dmaRequest; + /* 0x58 */ OSMesgQueue loadQueue; + /* 0x70 */ OSMesg loadMsg; + /* 0x74 */ s16 drawParams[2]; // context-specific data used by the current scene draw config +} RoomContext; // size = 0x78 + +typedef struct RoomList { + /* 0x00 */ u8 count; + /* 0x04 */ RomFile* romFiles; // Array of rom addresses for each room in a scene +} RoomList; + +#define ROOM_DRAW_OPA (1 << 0) +#define ROOM_DRAW_XLU (1 << 1) + +void func_80095AA0(struct PlayState* play, Room* room, struct Input* input, s32 arg3); +void Room_DrawBackground2D(Gfx** gfxP, void* tex, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 tlutMode, + u16 tlutCount, f32 offsetX, f32 offsetY); +void Room_Init(struct PlayState* play, Room* room); +u32 Room_SetupFirstRoom(struct PlayState* play, RoomContext* roomCtx); +s32 Room_RequestNewRoom(struct PlayState* play, RoomContext* roomCtx, s32 roomNum); +s32 Room_ProcessRoomRequest(struct PlayState* play, RoomContext* roomCtx); +void Room_Draw(struct PlayState* play, Room* room, u32 flags); +void Room_FinishRoomChange(struct PlayState* play, RoomContext* roomCtx); + +#endif diff --git a/include/z64save.h b/include/z64save.h index 62107df5ed..71b1414052 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -6,6 +6,11 @@ #include "z64inventory.h" #include "z64math.h" +typedef enum ZTargetSetting { + /* 0 */ Z_TARGET_SETTING_SWITCH, + /* 1 */ Z_TARGET_SETTING_HOLD +} ZTargetSetting; + typedef enum Language { #if OOT_NTSC /* 0 */ LANGUAGE_JPN, @@ -315,10 +320,10 @@ typedef struct SaveContext { /* 0x1404 */ u16 minigameState; /* 0x1406 */ u16 minigameScore; // "yabusame_total" /* 0x1408 */ char unk_1408[0x0001]; - /* 0x1409 */ u8 language; // NTSC 0: Japanese; 1: English | PAL 0: English; 1: German; 2: French - /* 0x140A */ u8 audioSetting; + /* 0x1409 */ u8 language; // NTSC 0: Japanese; 1: English | PAL 0: English; 1: German; 2: French (see enum `Language`) + /* 0x140A */ u8 soundSetting; // 0: Stereo; 1: Mono; 2: Headset; 3: Surround (see enum `SoundSetting`) /* 0x140B */ char unk_140B[0x0001]; - /* 0x140C */ u8 zTargetSetting; // 0: Switch; 1: Hold + /* 0x140C */ u8 zTargetSetting; // 0: Switch; 1: Hold (see enum `ZTargetSetting`) /* 0x140E */ u16 forcedSeqId; // immediately start playing the sequence if set /* 0x1410 */ u8 cutsceneTransitionControl; // context dependent usage: can either trigger a delayed fade or control fill alpha /* 0x1411 */ char unk_1411[0x0001]; @@ -587,14 +592,11 @@ typedef enum LinkAge { (EVENTCHKINF_MASK(EVENTCHKINF_CARPENTER_0_RESCUED) | EVENTCHKINF_MASK(EVENTCHKINF_CARPENTER_1_RESCUED) | \ EVENTCHKINF_MASK(EVENTCHKINF_CARPENTER_2_RESCUED) | EVENTCHKINF_MASK(EVENTCHKINF_CARPENTER_3_RESCUED)) -#define GET_EVENTCHKINF_CARPENTERS_ALL_RESCUED() \ - CHECK_FLAG_ALL(gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_CARPENTERS_RESCUED], \ - EVENTCHKINF_CARPENTERS_ALL_RESCUED_MASK) +#define GET_EVENTCHKINF_CARPENTERS_ALL_RESCUED() \ + ((gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_CARPENTERS_RESCUED] & EVENTCHKINF_CARPENTERS_ALL_RESCUED_MASK) == (EVENTCHKINF_CARPENTERS_ALL_RESCUED_MASK)) -#define GET_EVENTCHKINF_CARPENTERS_ALL_RESCUED2() \ - CHECK_FLAG_ALL(gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_CARPENTERS_RESCUED] & \ - (EVENTCHKINF_CARPENTERS_ALL_RESCUED_MASK | 0xF0), \ - EVENTCHKINF_CARPENTERS_ALL_RESCUED_MASK) +#define GET_EVENTCHKINF_CARPENTERS_ALL_RESCUED2() \ + ((gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_CARPENTERS_RESCUED] & (EVENTCHKINF_CARPENTERS_ALL_RESCUED_MASK | 0xF0) & EVENTCHKINF_CARPENTERS_ALL_RESCUED_MASK) == (EVENTCHKINF_CARPENTERS_ALL_RESCUED_MASK)) #define ENDAIKU_CARPENTER_RESCUED_MASK(carpenterType) (1 << (carpenterType)) @@ -991,6 +993,7 @@ typedef enum IngoRaceState { #define EVENTINF_30 0x30 +void SaveContext_Init(void); extern SaveContext gSaveContext; diff --git a/include/z64scene.h b/include/z64scene.h index 4acf9df16a..09b342c047 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -1,18 +1,19 @@ #ifndef Z64SCENE_H #define Z64SCENE_H -#include "macros.h" +#include "avoid_ub.h" #include "ultra64.h" #include "z64bgcheck.h" -#include "z64dma.h" #include "z64environment.h" #include "z64light.h" #include "z64math.h" +#include "z64path.h" #include "command_macros_base.h" struct GameState; struct PlayState; +struct RoomShapeBase; typedef struct SceneTableEntry { /* 0x00 */ RomFile sceneFile; @@ -51,159 +52,6 @@ typedef struct Spawn { /* 0x01 */ u8 room; } Spawn; -typedef struct Path { - /* 0x00 */ u8 count; // number of points in the path - /* 0x04 */ Vec3s* points; // Segment Address to the array of points -} Path; // size = 0x8 - -// Room shapes - -typedef enum RoomShapeType { - /* 0 */ ROOM_SHAPE_TYPE_NORMAL, - /* 1 */ ROOM_SHAPE_TYPE_IMAGE, - /* 2 */ ROOM_SHAPE_TYPE_CULLABLE, - /* 3 */ ROOM_SHAPE_TYPE_MAX -} RoomShapeType; - -typedef struct RoomShapeBase { - /* 0x00 */ u8 type; -} RoomShapeBase; // size = 0x01 - -typedef struct RoomShapeDListsEntry { - /* 0x00 */ Gfx* opa; - /* 0x04 */ Gfx* xlu; -} RoomShapeDListsEntry; // size = 0x08 - -typedef struct RoomShapeNormal { - /* 0x00 */ RoomShapeBase base; - /* 0x01 */ u8 numEntries; - /* 0x04 */ RoomShapeDListsEntry* entries; - /* 0x08 */ RoomShapeDListsEntry* entriesEnd; -} RoomShapeNormal; // size = 0x0C - -typedef enum RoomShapeImageAmountType { - /* 1 */ ROOM_SHAPE_IMAGE_AMOUNT_SINGLE = 1, - /* 2 */ ROOM_SHAPE_IMAGE_AMOUNT_MULTI -} RoomShapeImageAmountType; - -typedef struct RoomShapeImageBase { - /* 0x00 */ RoomShapeBase base; - /* 0x01 */ u8 amountType; // RoomShapeImageAmountType - /* 0x04 */ RoomShapeDListsEntry* entry; -} RoomShapeImageBase; // size = 0x08 - -typedef struct RoomShapeImageSingle { - /* 0x00 */ RoomShapeImageBase base; - /* 0x08 */ void* source; - /* 0x0C */ u32 unk_0C; - /* 0x10 */ void* tlut; - /* 0x14 */ u16 width; - /* 0x16 */ u16 height; - /* 0x18 */ u8 fmt; - /* 0x19 */ u8 siz; - /* 0x1A */ u16 tlutMode; - /* 0x1C */ u16 tlutCount; -} RoomShapeImageSingle; // size = 0x20 - -typedef struct RoomShapeImageMultiBgEntry { - /* 0x00 */ u16 unk_00; - /* 0x02 */ u8 bgCamIndex; // for which bg cam index is this entry for - /* 0x04 */ void* source; - /* 0x08 */ u32 unk_0C; - /* 0x0C */ void* tlut; - /* 0x10 */ u16 width; - /* 0x12 */ u16 height; - /* 0x14 */ u8 fmt; - /* 0x15 */ u8 siz; - /* 0x16 */ u16 tlutMode; - /* 0x18 */ u16 tlutCount; -} RoomShapeImageMultiBgEntry; // size = 0x1C - -typedef struct RoomShapeImageMulti { - /* 0x00 */ RoomShapeImageBase base; - /* 0x08 */ u8 numBackgrounds; - /* 0x0C */ RoomShapeImageMultiBgEntry* backgrounds; -} RoomShapeImageMulti; // size = 0x10 - -typedef struct RoomShapeCullableEntry { - /* 0x00 */ Vec3s boundsSphereCenter; - /* 0x06 */ s16 boundsSphereRadius; - /* 0x08 */ Gfx* opa; - /* 0x0C */ Gfx* xlu; -} RoomShapeCullableEntry; // size = 0x10 - -#define ROOM_SHAPE_CULLABLE_MAX_ENTRIES 64 - -typedef struct RoomShapeCullable { - /* 0x00 */ RoomShapeBase base; - /* 0x01 */ u8 numEntries; - /* 0x04 */ RoomShapeCullableEntry* entries; - /* 0x08 */ RoomShapeCullableEntry* entriesEnd; -} RoomShapeCullable; // size = 0x0C - -typedef union RoomShape { - RoomShapeBase base; - RoomShapeNormal normal; - union { - RoomShapeImageBase base; - RoomShapeImageSingle single; - RoomShapeImageMulti multi; - } image; - RoomShapeCullable cullable; -} RoomShape; // "Ground Shape" - -typedef enum RoomType { - /* 0 */ ROOM_TYPE_NORMAL, - /* 1 */ ROOM_TYPE_DUNGEON, // Blocks Sun's Song's time advance effect. Not exclusively used by typical dungeon rooms. - /* 2 */ ROOM_TYPE_INDOORS, // Reduces player run speed and blocks player from attacking or jumping. - /* 3 */ ROOM_TYPE_3, // Unused. Color dithering is turned off when drawing the room and other things. - /* 4 */ ROOM_TYPE_4, // Unused. Prevents switching to CAM_SET_HORSE when mounting a horse. - /* 5 */ ROOM_TYPE_BOSS // Disables Environment_AdjustLights -} RoomType; - -typedef enum RoomEnvironmentType { - /* 0 */ ROOM_ENV_DEFAULT, - /* 1 */ ROOM_ENV_COLD, - /* 2 */ ROOM_ENV_WARM, - /* 3 */ ROOM_ENV_HOT, // Enables hot room timer for the current room - /* 4 */ ROOM_ENV_UNK_STRETCH_1, - /* 5 */ ROOM_ENV_UNK_STRETCH_2, - /* 6 */ ROOM_ENV_UNK_STRETCH_3 -} RoomEnvironmentType; - -typedef struct Room { - /* 0x00 */ s8 num; // -1 is invalid room - /* 0x01 */ u8 unk_01; - /* 0x02 */ u8 environmentType; - /* 0x03 */ u8 type; - /* 0x04 */ s8 echo; - /* 0x05 */ u8 lensMode; - /* 0x08 */ RoomShape* roomShape; // original name: "ground_shape" - /* 0x0C */ void* segment; - /* 0x10 */ char unk_10[0x4]; -} Room; // size = 0x14 - -typedef struct RoomContext { - /* 0x00 */ Room curRoom; - /* 0x14 */ Room prevRoom; - /* 0x28 */ void* bufPtrs[2]; // Start and end pointers for the room buffer. Can be split into two pages, where page 0 is allocated from the start pointer and page 1 is allocated from the end pointer. - /* 0x30 */ u8 activeBufPage; // 0 - First page in memory, 1 - Last page in memory - /* 0x31 */ s8 status; // 0 - Free for new room request, 1 - DmaRequest for a new room is in progress - /* 0x34 */ void* roomRequestAddr; // Pointer to where the requested room segment will be stored - /* 0x38 */ DmaRequest dmaRequest; - /* 0x58 */ OSMesgQueue loadQueue; - /* 0x70 */ OSMesg loadMsg; - /* 0x74 */ s16 drawParams[2]; // context-specific data used by the current scene draw config -} RoomContext; // size = 0x78 - -typedef struct RoomList { - /* 0x00 */ u8 count; - /* 0x04 */ RomFile* romFiles; // Array of rom addresses for each room in a scene -} RoomList; - -#define ROOM_DRAW_OPA (1 << 0) -#define ROOM_DRAW_XLU (1 << 1) - // Scene commands typedef struct SCmdBase { @@ -273,7 +121,7 @@ typedef struct SCmdRoomBehavior { typedef struct SCmdMesh { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; - /* 0x04 */ RoomShapeBase* data; + /* 0x04 */ struct RoomShapeBase* data; } SCmdMesh; typedef struct SCmdObjectList { diff --git a/include/z64skin.h b/include/z64skin.h index d29c7c7482..641a980925 100644 --- a/include/z64skin.h +++ b/include/z64skin.h @@ -3,6 +3,10 @@ #include "z64animation.h" +struct Actor; +struct GraphicsContext; +struct PlayState; + /** * Holds a compact version of a vertex used in the Skin system * It is used to initialise the Vtx used by an animated limb @@ -75,4 +79,19 @@ typedef s32 (*SkinOverrideLimbDraw)(struct Actor*, struct PlayState*, s32, Skin* #define SKIN_TRANSFORM_IS_FHG 0x23 +void Skin_UpdateVertices(MtxF* mtx, SkinVertex* skinVertices, SkinLimbModif* modifEntry, Vtx* vtxBuf, Vec3f* pos); +void Skin_DrawAnimatedLimb(struct GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, s32 arg3, s32 drawFlags); +void Skin_DrawLimb(struct GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, Gfx* dlistOverride, s32 drawFlags); +void func_800A6330(struct Actor* actor, struct PlayState* play, Skin* skin, SkinPostDraw postDraw, s32 setTranslation); +void func_800A6360(struct Actor* actor, struct PlayState* play, Skin* skin, SkinPostDraw postDraw, + SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation); +void func_800A6394(struct Actor* actor, struct PlayState* play, Skin* skin, SkinPostDraw postDraw, + SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6); +void func_800A63CC(struct Actor* actor, struct PlayState* play, Skin* skin, SkinPostDraw postDraw, + SkinOverrideLimbDraw overrideLimbDraw, s32 setTranslation, s32 arg6, s32 drawFlags); +void Skin_GetLimbPos(Skin* skin, s32 limbIndex, Vec3f* offset, Vec3f* dst); +void Skin_Init(struct PlayState* play, Skin* skin, SkeletonHeader* skeletonHeader, AnimationHeader* animationHeader); +void Skin_Free(struct PlayState* play, Skin* skin); +s32 Skin_ApplyAnimTransformations(Skin* skin, MtxF* limbMatrices, struct Actor* actor, s32 setTranslation); + #endif diff --git a/include/z64sram.h b/include/z64sram.h index 3769f4419d..f1d05b7775 100644 --- a/include/z64sram.h +++ b/include/z64sram.h @@ -3,6 +3,9 @@ #include "ultra64/ultratypes.h" +struct FileSelectState; +struct GameState; + typedef struct SramContext { /* 0x00 */ u8* readBuff; } SramContext; // size = 0x4 @@ -12,9 +15,24 @@ typedef struct SramContext { typedef enum SramHeaderField { /* 0x00 */ SRAM_HEADER_SOUND, - /* 0x01 */ SRAM_HEADER_ZTARGET, + /* 0x01 */ SRAM_HEADER_Z_TARGET, /* 0x02 */ SRAM_HEADER_LANGUAGE, /* 0x03 */ SRAM_HEADER_MAGIC // must be the value in `sSramDefaultHeader` for save to be considered valid } SramHeaderField; +extern u16 gSramSlotOffsets[]; + +void Sram_InitNewSave(void); +void Sram_InitDebugSave(void); +void Sram_OpenSave(SramContext* sramCtx); +void Sram_WriteSave(SramContext* sramCtx); +void Sram_VerifyAndLoadAllSaves(struct FileSelectState* fileSelect, SramContext* sramCtx); +void Sram_InitSave(struct FileSelectState* fileSelect, SramContext* sramCtx); +void Sram_EraseSave(struct FileSelectState* fileSelect, SramContext* sramCtx); +void Sram_CopySave(struct FileSelectState* fileSelect, SramContext* sramCtx); +void Sram_WriteSramHeader(SramContext* sramCtx); +void Sram_InitSram(struct GameState* gameState, SramContext* sramCtx); +void Sram_Alloc(struct GameState* gameState, SramContext* sramCtx); +void Sram_Init(struct GameState* gameState, SramContext* sramCtx); + #endif diff --git a/include/z64ss_sram.h b/include/z64ss_sram.h new file mode 100644 index 0000000000..ffd628239d --- /dev/null +++ b/include/z64ss_sram.h @@ -0,0 +1,12 @@ +#ifndef Z64SS_SRAM_H +#define Z64SS_SRAM_H + +#include "libc/stddef.h" +#include "ultra64/ultratypes.h" + +void SsSram_Init(s32 addr, u8 handleType, u8 handleDomain, u8 handleLatency, u8 handlePageSize, u8 handleRelDuration, + u8 handlePulse, u32 handleSpeed); +void SsSram_Dma(void* dramAddr, size_t size, s32 direction); +void SsSram_ReadWrite(s32 addr, void* dramAddr, size_t size, s32 direction); + +#endif diff --git a/include/z64thread.h b/include/z64thread.h new file mode 100644 index 0000000000..c4ab827b42 --- /dev/null +++ b/include/z64thread.h @@ -0,0 +1,33 @@ +#ifndef Z64THREAD_H +#define Z64THREAD_H + +#include "ultra64.h" + +#define THREAD_ID_IDLE 1 +#define THREAD_ID_FAULT 2 +#define THREAD_ID_MAIN 3 +#define THREAD_ID_GRAPH 4 +#define THREAD_ID_SCHED 5 +#define THREAD_ID_PADMGR 7 +#define THREAD_ID_N64DD 8 +#define THREAD_ID_DDMSG 9 +#define THREAD_ID_AUDIOMGR 10 +#define THREAD_ID_DMAMGR 18 +#define THREAD_ID_IRQMGR 19 + +#define THREAD_PRI_IDLE_INIT 10 +#define THREAD_PRI_MAIN_INIT 10 +#define THREAD_PRI_DMAMGR_LOW 10 // Used when decompressing files +#define THREAD_PRI_GRAPH 11 +#define THREAD_PRI_AUDIOMGR 12 +#define THREAD_PRI_N64DD 13 +#define THREAD_PRI_DDMSG 13 +#define THREAD_PRI_PADMGR 14 +#define THREAD_PRI_MAIN 15 +#define THREAD_PRI_SCHED 15 +#define THREAD_PRI_DMAMGR 16 +#define THREAD_PRI_IRQMGR 17 +#define THREAD_PRI_FAULT_CLIENT (OS_PRIORITY_APPMAX - 1) +#define THREAD_PRI_FAULT OS_PRIORITY_APPMAX + +#endif diff --git a/include/z64transition.h b/include/z64transition.h index 569b8fb328..d46683d2b3 100644 --- a/include/z64transition.h +++ b/include/z64transition.h @@ -3,6 +3,10 @@ #include "ultra64/ultratypes.h" #include "ultra64/gbi.h" // for Gfx +#include "transition_circle.h" +#include "transition_fade.h" +#include "transition_triforce.h" +#include "transition_wipe.h" #include "z64transition_instances.h" #define TRANS_TRIGGER_OFF 0 // transition is not active diff --git a/include/z64transition_instances.h b/include/z64transition_instances.h index 154b98d008..cc35add03c 100644 --- a/include/z64transition_instances.h +++ b/include/z64transition_instances.h @@ -1,104 +1,10 @@ #ifndef Z64TRANSITION_INSTANCES_H #define Z64TRANSITION_INSTANCES_H -#include "ultra64.h" -#include "color.h" - -typedef struct TransitionTileVtxData { - /* 0x0 */ f32 x; - /* 0x4 */ f32 y; -} TransitionTileVtxData; // size = 0x8 - -typedef struct TransitionTile { - /* 0x00 */ s32 cols; - /* 0x04 */ s32 rows; - /* 0x08 */ s32 frame; - /* 0x0C */ TransitionTileVtxData* vtxData; - /* 0x10 */ Vtx* vtxFrame1; - /* 0x14 */ Vtx* vtxFrame2; - /* 0x18 */ Mtx projection; - /* 0x58 */ Mtx modelView; - /* 0x98 */ Mtx unk_98; - /* 0xD8 */ Gfx* gfx; // "gfxtbl" - /* 0xDC */ u16* zBuffer; -} TransitionTile; // size = 0xE0 - typedef enum TransitionInstanceType { /* 1 */ TRANS_INSTANCE_TYPE_FILL_OUT = 1, - /* 2 */ TRANS_INSTANCE_TYPE_FILL_IN + /* 2 */ TRANS_INSTANCE_TYPE_FILL_IN, + /* 3 */ TRANS_INSTANCE_TYPE_FADE_FLASH } TransitionInstanceType; -typedef struct TransitionWipe { - /* 0x000 */ Color_RGBA8_u32 color; - /* 0x004 */ Color_RGBA8_u32 unkColor; - /* 0x008 */ u8 direction; - /* 0x009 */ u8 frame; - /* 0x00A */ u8 isDone; - /* 0x00C */ u16 texX; - /* 0x00E */ u16 texY; - /* 0x010 */ u16 normal; - /* 0x018 */ Mtx projection; - /* 0x058 */ Mtx lookAt; - /* 0x098 */ Mtx modelView[2][3]; -} TransitionWipe; // size = 0x218 - -#define TRANS_INSTANCE_TYPE_FADE_FLASH 3 - -typedef struct TransitionFade { - /* 0x000 */ u8 type; - /* 0x001 */ u8 isDone; - /* 0x002 */ u8 direction; - /* 0x004 */ Color_RGBA8_u32 color; - /* 0x008 */ u16 timer; -} TransitionFade; // size = 0xC - -typedef enum TransitionCircleAppearance { - /* 0 */ TCA_NORMAL, - /* 1 */ TCA_WAVE, - /* 2 */ TCA_RIPPLE, - /* 3 */ TCA_STARBURST -} TransitionCircleAppearance; - -typedef enum TransitionCircleColor { - /* 0 */ TCC_BLACK, - /* 1 */ TCC_WHITE, - /* 2 */ TCC_GRAY, - /* 3 */ TCC_SPECIAL // color varies depending on appearance. unused and appears broken -} TransitionCircleColor; - -typedef enum TransitionCircleSpeed { - /* 0 */ TCS_FAST, - /* 1 */ TCS_SLOW -} TransitionCircleSpeed; - -typedef struct TransitionCircle { - /* 0x000 */ Color_RGBA8_u32 color; - /* 0x004 */ Color_RGBA8_u32 unkColor; - /* 0x008 */ s32 texX; - /* 0x00C */ s32 texY; - /* 0x010 */ s32 speed; - /* 0x014 */ u8 direction; - /* 0x015 */ u8 colorType; - /* 0x016 */ u8 speedType; - /* 0x017 */ u8 appearanceType; - /* 0x018 */ u8 isDone; - /* 0x019 */ u8 frame; - /* 0x01A */ u16 normal; - /* 0x020 */ Mtx projection; - /* 0x060 */ Mtx lookAt; - /* 0x0A0 */ void* texture; - /* 0x0A8 */ Mtx modelView[2][3]; -} TransitionCircle; // size = 0x228 - -typedef struct TransitionTriforce { - /* 0x000 */ Color_RGBA8_u32 color; - /* 0x004 */ f32 transPos; - /* 0x008 */ f32 step; - /* 0x00C */ s32 state; - /* 0x010 */ s32 type; - /* 0x018 */ Mtx projection; - /* 0x058 */ s32 frame; - /* 0x060 */ Mtx modelView[2][3]; -} TransitionTriforce; // size = 0x1E0 - #endif diff --git a/include/z64view.h b/include/z64view.h index 82f4ee48ff..83bdf0fe84 100644 --- a/include/z64view.h +++ b/include/z64view.h @@ -1,6 +1,7 @@ #ifndef Z64VIEW_H #define Z64VIEW_H +#include "avoid_ub.h" #include "ultra64.h" #include "z64math.h" diff --git a/include/z64vis.h b/include/z64vis.h index fcd24d1b76..86e286c325 100644 --- a/include/z64vis.h +++ b/include/z64vis.h @@ -28,7 +28,6 @@ typedef struct Vis { } Vis; // size = 0x10 - /* Cvg: Coverage */ #define FB_FILTER_TO_CVG_TYPE(filter) (filter) @@ -50,7 +49,6 @@ void VisCvg_Destroy(VisCvg* this); void VisCvg_Draw(VisCvg* this, Gfx** gfxP); - /* Mono: Desaturation */ // Only one type @@ -66,7 +64,6 @@ void VisMono_Destroy(VisMono* this); void VisMono_Draw(VisMono* this, Gfx** gfxP); - /* ZBuf: Z-Buffer */ #define FB_FILTER_TO_ZBUF_TYPE(filter) ((filter) - FB_FILTER_ZBUF_IA) diff --git a/include/z_actor_dlftbls.h b/include/z_actor_dlftbls.h new file mode 100644 index 0000000000..e9e2dc7d93 --- /dev/null +++ b/include/z_actor_dlftbls.h @@ -0,0 +1,74 @@ +#ifndef Z_ACTOR_DLFTBLS_H +#define Z_ACTOR_DLFTBLS_H + +#include "romfile.h" +#include "z64actor_profile.h" + +/** + * @see ACTOROVL_ALLOC_ABSOLUTE + */ +#if DEBUG_FEATURES +#define ACTOROVL_ABSOLUTE_SPACE_SIZE 0x27A0 +#else +#define ACTOROVL_ABSOLUTE_SPACE_SIZE 0x24E0 +#endif + +/** + * The actor overlay should be allocated memory for when loading, + * and the memory deallocated when there is no more actor using the overlay. + * + * `ACTOROVL_ALLOC_` defines indicate how an actor overlay should be loaded. + * + * @note Bitwise or-ing `ACTOROVL_ALLOC_` types is not meaningful. + * The `ACTOROVL_ALLOC_` types are 0, 1, 2 but checked against with a bitwise and. + * + * @see ACTOROVL_ALLOC_ABSOLUTE + * @see ACTOROVL_ALLOC_PERSISTENT + * @see actor_table.h + */ +#define ACTOROVL_ALLOC_NORMAL 0 + +/** + * The actor overlay should be loaded to "absolute space". + * + * Absolute space is a fixed amount of memory allocated once. + * The overlay will still need to be loaded again if at some point there is no more actor using the overlay. + * + * @note Only one such overlay may be loaded at a time. + * This is not checked: a newly loaded overlay will overwrite the previous one in absolute space, + * even if actors are still relying on the previous one. Actors using absolute-allocated overlays should be deleted + * when another absolute-allocated overlay is about to be used. + * + * @see ACTOROVL_ABSOLUTE_SPACE_SIZE + * @see ActorContext.absoluteSpace + * @see ACTOROVL_ALLOC_NORMAL + */ +#define ACTOROVL_ALLOC_ABSOLUTE (1 << 0) + +/** + * The actor overlay should be loaded persistently. + * It will stay loaded until the current game state instance ends. + * + * @see ACTOROVL_ALLOC_NORMAL + */ +#define ACTOROVL_ALLOC_PERSISTENT (1 << 1) + +typedef struct ActorOverlay { + /* 0x00 */ RomFile file; + /* 0x08 */ void* vramStart; + /* 0x0C */ void* vramEnd; + /* 0x10 */ void* loadedRamAddr; // original name: "allocp" + /* 0x14 */ ActorProfile* profile; + /* 0x18 */ char* name; + /* 0x1C */ u16 allocType; // See `ACTOROVL_ALLOC_` defines + /* 0x1E */ s8 numLoaded; // original name: "clients" +} ActorOverlay; // size = 0x20 + +extern ActorOverlay gActorOverlayTable[ACTOR_ID_MAX]; // original name: "actor_dlftbls" 801162A0 +extern s32 gMaxActorId; // original name: "MaxProfile" + +void ActorOverlayTable_LogPrint(void); +void ActorOverlayTable_Init(void); +void ActorOverlayTable_Cleanup(void); + +#endif diff --git a/include/z_en_a_obj.h b/include/z_en_a_obj.h new file mode 100644 index 0000000000..bd65f88f13 --- /dev/null +++ b/include/z_en_a_obj.h @@ -0,0 +1,41 @@ +#ifndef Z_EN_A_OBJ_H +#define Z_EN_A_OBJ_H + +#include "ultra64.h" +#include "z64actor.h" + +// Only A_OBJ_SIGNPOST_OBLONG and A_OBJ_SIGNPOST_ARROW are used in room files. +typedef enum AObjType { + /* 0x00 */ A_OBJ_BLOCK_SMALL, + /* 0x01 */ A_OBJ_BLOCK_LARGE, + /* 0x02 */ A_OBJ_BLOCK_HUGE, + /* 0x03 */ A_OBJ_BLOCK_SMALL_ROT, + /* 0x04 */ A_OBJ_BLOCK_LARGE_ROT, + /* 0x05 */ A_OBJ_CUBE_SMALL, + /* 0x06 */ A_OBJ_UNKNOWN_6, + /* 0x07 */ A_OBJ_GRASS_CLUMP, + /* 0x08 */ A_OBJ_TREE_STUMP, + /* 0x09 */ A_OBJ_SIGNPOST_OBLONG, + /* 0x0A */ A_OBJ_SIGNPOST_ARROW, + /* 0x0B */ A_OBJ_BOULDER_FRAGMENT, + /* 0x0C */ A_OBJ_MAX +} AObjType; + +struct EnAObj; + +typedef void (*EnAObjActionFunc)(struct EnAObj*, struct PlayState*); + +typedef struct EnAObj { + /* 0x000 */ DynaPolyActor dyna; + /* 0x164 */ EnAObjActionFunc actionFunc; + /* 0x168 */ s32 rotateWaitTimer; + /* 0x16C */ s16 textId; + /* 0x16E */ s16 rotateState; + /* 0x170 */ s16 rotateForTimer; + /* 0x172 */ s16 rotSpeedY; + /* 0x174 */ s16 rotSpeedX; + /* 0x178 */ f32 focusYoffset; + /* 0x17C */ ColliderCylinder collider; +} EnAObj; // size = 0x1C8 + +#endif diff --git a/include/z_game_dlftbls.h b/include/z_game_dlftbls.h new file mode 100644 index 0000000000..b5b8c62c87 --- /dev/null +++ b/include/z_game_dlftbls.h @@ -0,0 +1,36 @@ +#ifndef Z_GAME_DLFTBLS_H +#define Z_GAME_DLFTBLS_H + +#include "ultra64.h" +#include "romfile.h" + +typedef struct GameStateOverlay { + /* 0x00 */ void* loadedRamAddr; + /* 0x04 */ RomFile file; // if applicable + /* 0x0C */ void* vramStart; // if applicable + /* 0x10 */ void* vramEnd; // if applicable + /* 0x14 */ void* unk_14; + /* 0x18 */ void* init; // initializes and executes the given context + /* 0x1C */ void* destroy; // deconstructs the context, and sets the next context to load + /* 0x20 */ void* unk_20; + /* 0x24 */ void* unk_24; + /* 0x28 */ s32 unk_28; + /* 0x2C */ u32 instanceSize; +} GameStateOverlay; // size = 0x30 + +// Used in Graph_GetNextGameState in graph.c +#define DEFINE_GAMESTATE_INTERNAL(typeName, enumName) enumName, +#define DEFINE_GAMESTATE(typeName, enumName, name) DEFINE_GAMESTATE_INTERNAL(typeName, enumName) +typedef enum GameStateId { +#include "tables/gamestate_table.h" + GAMESTATE_ID_MAX +} GameStateId; +#undef DEFINE_GAMESTATE +#undef DEFINE_GAMESTATE_INTERNAL + +extern GameStateOverlay gGameStateOverlayTable[GAMESTATE_ID_MAX]; + +void Overlay_LoadGameState(GameStateOverlay* overlayEntry); +void Overlay_FreeGameState(GameStateOverlay* overlayEntry); + +#endif diff --git a/include/z_lib.h b/include/z_lib.h index 34581da982..1e9052f93b 100644 --- a/include/z_lib.h +++ b/include/z_lib.h @@ -2,7 +2,7 @@ #define Z_LIB_H #include "libc/stddef.h" -#include "padmgr.h" +#include "libu64/pad.h" #include "z64math.h" #include "color.h" diff --git a/include/z_locale.h b/include/z_locale.h new file mode 100644 index 0000000000..7afcb33db4 --- /dev/null +++ b/include/z_locale.h @@ -0,0 +1,12 @@ +#ifndef Z_LOCALE_H +#define Z_LOCALE_H + +#include "ultra64/ultratypes.h" +#include "region.h" + +extern s32 gCurrentRegion; + +void Locale_Init(void); +void Locale_ResetRegion(void); + +#endif diff --git a/include/zelda_arena.h b/include/zelda_arena.h index 1d035a0bbe..cf67406577 100644 --- a/include/zelda_arena.h +++ b/include/zelda_arena.h @@ -3,6 +3,8 @@ #include "ultra64.h" +extern s32 gZeldaArenaLogSeverity; + void* ZeldaArena_Malloc(u32 size); void* ZeldaArena_MallocR(u32 size); void* ZeldaArena_Realloc(void* ptr, u32 newSize); diff --git a/requirements.txt b/requirements.txt index c9c4afed64..bea2fe176c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,6 +2,7 @@ crunch64>=0.5.1,<1.0.0 ipl3checksum>=1.2.0,<2.0.0 pyyaml>=6.0.1,<7.0.0 +pygfxd>=1.0.3,<2.0.0 # asm-differ argcomplete diff --git a/spec/code_libultra_ique.inc b/spec/code_libultra_ique.inc index 4e53234778..e99152cf98 100644 --- a/spec/code_libultra_ique.inc +++ b/spec/code_libultra_ique.inc @@ -101,7 +101,9 @@ include "$(BUILD_DIR)/src/libultra/gu/rotate.o" include "$(BUILD_DIR)/src/libultra/os/getcurrfaultedthread.o" include "$(BUILD_DIR)/src/libultra/bb/sk/skapi.o" +#ifndef COMPILER_GCC include "$(BUILD_DIR)/src/libultra/bb/sa/common.o" +#endif include "$(BUILD_DIR)/src/libultra/io/motor.o" include "$(BUILD_DIR)/src/libultra/os/afterprenmi.o" include "$(BUILD_DIR)/src/libultra/audio/drvrnew.o" diff --git a/spec/spec b/spec/spec index 345f46f27d..60437c4bf9 100644 --- a/spec/spec +++ b/spec/spec @@ -676,31 +676,30 @@ beginseg #if OOT_VERSION < NTSC_1_1 || !PLATFORM_N64 pad_text #endif - include "$(BUILD_DIR)/src/audio/lib/data.o" - include "$(BUILD_DIR)/src/audio/lib/synthesis.o" - include "$(BUILD_DIR)/src/audio/lib/heap.o" - include "$(BUILD_DIR)/src/audio/lib/load.o" - include "$(BUILD_DIR)/src/audio/lib/thread.o" - include "$(BUILD_DIR)/src/audio/lib/dcache.o" - include "$(BUILD_DIR)/src/audio/lib/aisetnextbuf.o" + include "$(BUILD_DIR)/src/audio/internal/data.o" + include "$(BUILD_DIR)/src/audio/internal/synthesis.o" + include "$(BUILD_DIR)/src/audio/internal/heap.o" + include "$(BUILD_DIR)/src/audio/internal/load.o" + include "$(BUILD_DIR)/src/audio/internal/thread.o" + include "$(BUILD_DIR)/src/audio/internal/os.o" #if OOT_PAL_N64 pad_text pad_text pad_text #endif - include "$(BUILD_DIR)/src/audio/lib/playback.o" - include "$(BUILD_DIR)/src/audio/lib/effects.o" - include "$(BUILD_DIR)/src/audio/lib/seqplayer.o" - include "$(BUILD_DIR)/src/audio/general.o" + include "$(BUILD_DIR)/src/audio/internal/playback.o" + include "$(BUILD_DIR)/src/audio/internal/effects.o" + include "$(BUILD_DIR)/src/audio/internal/seqplayer.o" + include "$(BUILD_DIR)/src/audio/game/general.o" #if !PLATFORM_N64 && !DEBUG_FEATURES pad_text #endif - include "$(BUILD_DIR)/src/audio/sfx_params.o" - include "$(BUILD_DIR)/src/audio/sfx.o" - include "$(BUILD_DIR)/src/audio/sequence.o" - include "$(BUILD_DIR)/src/audio/data.o" - include "$(BUILD_DIR)/src/audio/session_config.o" - include "$(BUILD_DIR)/src/audio/session_init.o" + include "$(BUILD_DIR)/src/audio/game/sfx_params.o" + include "$(BUILD_DIR)/src/audio/game/sfx.o" + include "$(BUILD_DIR)/src/audio/game/sequence.o" + include "$(BUILD_DIR)/src/audio/game/data.o" + include "$(BUILD_DIR)/src/audio/game/session_config.o" + include "$(BUILD_DIR)/src/audio/game/session_init.o" // libu64 #if PLATFORM_N64 @@ -708,7 +707,7 @@ beginseg include "$(BUILD_DIR)/src/libu64/rcp_utils.o" include "$(BUILD_DIR)/src/libu64/loadfragment2_n64.o" include "$(BUILD_DIR)/src/libu64/pad.o" - include "$(BUILD_DIR)/src/libu64/system_heap.o" + include "$(BUILD_DIR)/src/libu64/runtime.o" include "$(BUILD_DIR)/src/libu64/padsetup.o" #elif PLATFORM_GC include "$(BUILD_DIR)/src/libu64/logseverity_gc.o" @@ -720,11 +719,11 @@ beginseg #endif include "$(BUILD_DIR)/src/libu64/relocation_gc.o" include "$(BUILD_DIR)/src/libu64/load_gc.o" - include "$(BUILD_DIR)/src/libu64/system_heap.o" + include "$(BUILD_DIR)/src/libu64/runtime.o" include "$(BUILD_DIR)/src/libu64/pad.o" include "$(BUILD_DIR)/src/libu64/padsetup.o" #elif PLATFORM_IQUE - include "$(BUILD_DIR)/src/libu64/system_heap.o" + include "$(BUILD_DIR)/src/libu64/runtime.o" include "$(BUILD_DIR)/src/libu64/debug.o" include "$(BUILD_DIR)/src/libu64/gfxprint.o" include "$(BUILD_DIR)/src/libu64/logseverity_gc.o" @@ -786,14 +785,14 @@ beginseg include "$(BUILD_DIR)/src/libc/memmove.o" #elif PLATFORM_GC include "$(BUILD_DIR)/src/libc/sqrt.o" - include "$(BUILD_DIR)/src/libc/absf.o" + include "$(BUILD_DIR)/src/libc/fabsf.o" include "$(BUILD_DIR)/src/libc/fmodf.o" include "$(BUILD_DIR)/src/libc/memset.o" include "$(BUILD_DIR)/src/libc/memmove.o" #elif PLATFORM_IQUE include "$(BUILD_DIR)/src/libc/fmodf.o" include "$(BUILD_DIR)/src/libc/memmove.o" - include "$(BUILD_DIR)/src/libc/absf.o" + include "$(BUILD_DIR)/src/libc/fabsf.o" include "$(BUILD_DIR)/src/libc/sqrt.o" #endif diff --git a/src/audio/data.c b/src/audio/game/data.c similarity index 89% rename from src/audio/data.c rename to src/audio/game/data.c index 5f8bfa71f3..6c5528f347 100644 --- a/src/audio/data.c +++ b/src/audio/game/data.c @@ -1,5 +1,7 @@ +#include "array_count.h" +#include "sfx.h" #include "ultra64.h" -#include "global.h" +#include "z64audio.h" // sSfxRequests ring buffer endpoints. read index <= write index, wrapping around mod 256. u8 gSfxRequestWriteIndex = 0; @@ -59,11 +61,11 @@ u8 gStartSeqDisabled = false; u8 gAudioDebugPrintSeqCmd = true; #endif -u8 gSoundModeList[] = { - SOUNDMODE_STEREO, - SOUNDMODE_HEADSET, - SOUNDMODE_SURROUND, - SOUNDMODE_MONO, +u8 gSoundOutputModes[] = { + SOUND_OUTPUT_STEREO, + SOUND_OUTPUT_HEADSET, + SOUND_OUTPUT_SURROUND, + SOUND_OUTPUT_MONO, }; u8 gAudioSpecId = 0; diff --git a/src/audio/debug.inc.c b/src/audio/game/debug.inc.c similarity index 99% rename from src/audio/debug.inc.c rename to src/audio/game/debug.inc.c index 29fbd50a3c..e6d2dd89ca 100644 --- a/src/audio/debug.inc.c +++ b/src/audio/game/debug.inc.c @@ -847,7 +847,7 @@ void AudioDebug_ProcessInput_SndCont(void) { &gSfxDefaultReverb); break; case 4: - func_800F6700(sAudioSndContWork[sAudioSndContSel]); + Audio_SetSoundOutputMode(sAudioSndContWork[sAudioSndContSel]); break; case 5: SEQCMD_DISABLE_PLAY_SEQUENCES(sAudioSndContWork[sAudioSndContSel]); diff --git a/src/audio/general.c b/src/audio/game/general.c similarity index 98% rename from src/audio/general.c rename to src/audio/game/general.c index 2a639275bb..f04f203a1f 100644 --- a/src/audio/general.c +++ b/src/audio/game/general.c @@ -1,6 +1,17 @@ +#include "libu64/gfxprint.h" +#include "array_count.h" +#include "attributes.h" +#include "audiothread_cmd.h" +#include "controller.h" +#include "padmgr.h" +#include "printf.h" +#include "seqcmd.h" +#include "sequence.h" +#include "sfx.h" #include "ultra64.h" -#include "global.h" #include "versions.h" +#include "z64audio.h" +#include "z64ocarina.h" #define ABS_ALT(x) ((x) < 0 ? -(x) : (x)) @@ -134,9 +145,9 @@ f32 D_801305F4 = 1.0f; u8 sGanonsTowerLevelsVol[8] = { 127, 80, 75, 73, 70, 68, 65, 60 }; u8 sEnterGanonsTowerTimer = 0; #if DEBUG_FEATURES -s8 sSoundMode = SOUNDMODE_SURROUND; +s8 sSoundOutputMode = SOUND_OUTPUT_SURROUND; #else -s8 sSoundMode = SOUNDMODE_STEREO; +s8 sSoundOutputMode = SOUND_OUTPUT_STEREO; #endif s8 D_80130608 = 0; s8 sAudioCutsceneFlag = 0; @@ -2624,7 +2635,7 @@ void Audio_SetSfxProperties(u8 bankId, u8 entryIdx, u8 channelIndex) { case BANK_ENV: case BANK_ENEMY: case BANK_VOICE: - if (sSoundMode == SOUNDMODE_SURROUND) { + if (sSoundOutputMode == SOUND_OUTPUT_SURROUND) { combFilterGain = func_800F3990(*entry->posY, entry->sfxParams); } FALLTHROUGH; @@ -2636,7 +2647,7 @@ void Audio_SetSfxProperties(u8 bankId, u8 entryIdx, u8 channelIndex) { pan = Audio_ComputeSfxPanSigned(*entry->posX, *entry->posZ, entry->token); freqScale = Audio_ComputeSfxFreqScale(bankId, entryIdx) * *entry->freqScale; - if (sSoundMode == SOUNDMODE_SURROUND) { + if (sSoundOutputMode == SOUND_OUTPUT_SURROUND) { behindScreenZ = sBehindScreenZ[(entry->sfxParams & SFX_FLAG_10) >> SFX_FLAG_10_SHIFT]; if (!(entry->sfxParams & SFX_FLAG_11)) { if (*entry->posZ < behindScreenZ) { @@ -2668,7 +2679,7 @@ void Audio_SetSfxProperties(u8 bankId, u8 entryIdx, u8 channelIndex) { if ((baseFilter | sAudioExtraFilter) != 0) { filter = (baseFilter | sAudioExtraFilter); - } else if ((sSoundMode == SOUNDMODE_SURROUND) && !(entry->sfxParams & SFX_FLAG_13)) { + } else if ((sSoundOutputMode == SOUND_OUTPUT_SURROUND) && !(entry->sfxParams & SFX_FLAG_13)) { filter = func_800F37B8(behindScreenZ, entry, pan); } break; @@ -2875,7 +2886,7 @@ void func_800F4578(Vec3f* pos, u16 sfxId, f32 arg2) { void func_800F45D0(f32 arg0) { func_800F4414(&gSfxDefaultPos, NA_SE_IT_FISHING_REEL_SLOW - SFX_FLAG, arg0); - func_800F436C(&gSfxDefaultPos, 0, (0.15f * arg0) + 1.4f); + func_800F436C(&gSfxDefaultPos, NA_SE_NONE, (0.15f * arg0) + 1.4f); } void Audio_PlaySfxRiver(Vec3f* pos, f32 freqScale) { @@ -3766,32 +3777,40 @@ void Audio_SetCodeReverb(s8 reverb) { } } -void func_800F6700(s8 audioSetting) { - s8 soundModeIndex; +/** + * Sets the Sound Output Mode. + * + * This function translates the game-side `SoundSetting` to an internal `SoundOutputMode` value. + * The order of each value between the two enums is slightly different. + * + * Original name: Na_SetSoundOutputMode + */ +void Audio_SetSoundOutputMode(s8 soundSetting) { + s8 soundOutputMode; - switch (audioSetting) { - case 0: - soundModeIndex = SOUNDMODE_STEREO; - sSoundMode = SOUNDMODE_STEREO; + switch (soundSetting) { + case SOUND_SETTING_STEREO: + soundOutputMode = SOUND_OUTPUT_STEREO; + sSoundOutputMode = SOUND_OUTPUT_STEREO; break; - case 1: - soundModeIndex = SOUNDMODE_MONO; - sSoundMode = SOUNDMODE_MONO; + case SOUND_SETTING_MONO: + soundOutputMode = SOUND_OUTPUT_MONO; + sSoundOutputMode = SOUND_OUTPUT_MONO; break; - case 2: - soundModeIndex = SOUNDMODE_HEADSET; - sSoundMode = SOUNDMODE_HEADSET; + case SOUND_SETTING_HEADSET: + soundOutputMode = SOUND_OUTPUT_HEADSET; + sSoundOutputMode = SOUND_OUTPUT_HEADSET; break; - case 3: - soundModeIndex = SOUNDMODE_STEREO; - sSoundMode = SOUNDMODE_SURROUND; + case SOUND_SETTING_SURROUND: + soundOutputMode = SOUND_OUTPUT_STEREO; + sSoundOutputMode = SOUND_OUTPUT_SURROUND; break; } - SEQCMD_SET_SOUND_MODE(soundModeIndex); + SEQCMD_SET_SOUND_OUTPUT_MODE(soundOutputMode); } void Audio_SetBaseFilter(u8 filter) { @@ -4039,7 +4058,7 @@ void Audio_PlayNatureAmbienceSequence(u8 natureAmbienceId) { SEQCMD_SET_CHANNEL_IO(SEQ_PLAYER_BGM_MAIN, channelIdx, ioPort, ioData); } - SEQCMD_SET_CHANNEL_IO(SEQ_PLAYER_BGM_MAIN, NATURE_CHANNEL_UNK, CHANNEL_IO_PORT_7, sSoundMode); + SEQCMD_SET_CHANNEL_IO(SEQ_PLAYER_BGM_MAIN, NATURE_CHANNEL_UNK, CHANNEL_IO_PORT_7, sSoundOutputMode); } } diff --git a/src/audio/sequence.c b/src/audio/game/sequence.c similarity index 99% rename from src/audio/sequence.c rename to src/audio/game/sequence.c index c1530377a2..a311e4e73d 100644 --- a/src/audio/sequence.c +++ b/src/audio/game/sequence.c @@ -17,9 +17,13 @@ * Nor are these commands to be confused with the internal audio commands used to transfer requests from * the graph thread to the audio thread. */ +#include "array_count.h" +#include "audiothread_cmd.h" +#include "seqcmd.h" +#include "sfx.h" #include "ultra64.h" -#include "global.h" #include "ultra64/abi.h" +#include "z64audio.h" // Direct audio command (skips the queueing system) #define SEQCMD_SET_SEQPLAYER_VOLUME_NOW(seqPlayerIndex, duration, volume) \ @@ -369,9 +373,9 @@ void Audio_ProcessSeqCmd(u32 cmd) { subOp = (cmd & 0xF00) >> 8; val = cmd & 0xFF; switch (subOp) { - case SEQCMD_SUB_OP_GLOBAL_SET_SOUND_MODE: - // Set sound mode - AUDIOCMD_GLOBAL_SET_SOUND_MODE(gSoundModeList[val]); + case SEQCMD_SUB_OP_GLOBAL_SET_SOUND_OUTPUT_MODE: + // Set sound output mode + AUDIOCMD_GLOBAL_SET_SOUND_OUTPUT_MODE(gSoundOutputModes[val]); break; case SEQCMD_SUB_OP_GLOBAL_DISABLE_NEW_SEQUENCES: diff --git a/src/audio/session_config.c b/src/audio/game/session_config.c similarity index 99% rename from src/audio/session_config.c rename to src/audio/game/session_config.c index a531d6c27b..c21a79c725 100644 --- a/src/audio/session_config.c +++ b/src/audio/game/session_config.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "z64audio.h" AudioContext gAudioCtx; AudioCustomUpdateFunction gAudioCustomUpdateFunction; diff --git a/src/audio/session_init.c b/src/audio/game/session_init.c similarity index 93% rename from src/audio/session_init.c rename to src/audio/game/session_init.c index a6e67f40d4..3c3d9c4aeb 100644 --- a/src/audio/session_init.c +++ b/src/audio/game/session_init.c @@ -1,4 +1,7 @@ -#include "global.h" +#include "array_count.h" +#include "buffers.h" +#include "z64audio.h" + #include "assets/audio/sequence_sizes.h" #include "assets/audio/soundfont_sizes.h" diff --git a/src/audio/sfx.c b/src/audio/game/sfx.c similarity index 99% rename from src/audio/sfx.c rename to src/audio/game/sfx.c index 1c743e95ba..65309942a6 100644 --- a/src/audio/sfx.c +++ b/src/audio/game/sfx.c @@ -1,6 +1,10 @@ -#include "ultra64.h" -#include "global.h" +#include "array_count.h" +#include "audiothread_cmd.h" +#include "printf.h" +#include "sfx.h" #include "terminal.h" +#include "ultra64.h" +#include "z64audio.h" typedef struct SfxRequest { /* 0x00 */ u16 sfxId; diff --git a/src/audio/sfx_params.c b/src/audio/game/sfx_params.c similarity index 98% rename from src/audio/sfx_params.c rename to src/audio/game/sfx_params.c index 7dc1bbd2c7..37b9971caa 100644 --- a/src/audio/sfx_params.c +++ b/src/audio/game/sfx_params.c @@ -1,5 +1,5 @@ #include "ultra64.h" -#include "global.h" +#include "sfx.h" #include "versions.h" #define DEFINE_SFX(_0, _1, importance, distParam, randParam, flags) \ diff --git a/src/audio/lib/data.c b/src/audio/internal/data.c similarity index 99% rename from src/audio/lib/data.c rename to src/audio/internal/data.c index 8dc4729ff9..f2f1b2c94e 100644 --- a/src/audio/lib/data.c +++ b/src/audio/internal/data.c @@ -1,4 +1,6 @@ -#include "global.h" +#include "alignment.h" +#include "ultra64.h" +#include "z64audio.h" // clang-format off ALIGNED(16) s16 gSawtoothWaveSample[] = { diff --git a/src/audio/lib/effects.c b/src/audio/internal/effects.c similarity index 99% rename from src/audio/lib/effects.c rename to src/audio/internal/effects.c index bbfcaf61ad..7e3d01d3a7 100644 --- a/src/audio/lib/effects.c +++ b/src/audio/internal/effects.c @@ -1,5 +1,6 @@ #include "ultra64.h" -#include "global.h" +#include "attributes.h" +#include "z64audio.h" void Audio_SequenceChannelProcessSound(SequenceChannel* channel, s32 recalculateVolume, s32 applyBend) { f32 channelVolume; diff --git a/src/audio/lib/heap.c b/src/audio/internal/heap.c similarity index 99% rename from src/audio/lib/heap.c rename to src/audio/internal/heap.c index d996b553ab..e78787027b 100644 --- a/src/audio/lib/heap.c +++ b/src/audio/internal/heap.c @@ -1,6 +1,7 @@ +#include "alignment.h" #include "ultra64.h" -#include "global.h" #include "versions.h" +#include "z64audio.h" void AudioHeap_InitSampleCaches(u32 persistentSampleCacheSize, u32 temporarySampleCacheSize); SampleCacheEntry* AudioHeap_AllocTemporarySampleCacheEntry(u32 size); diff --git a/src/audio/lib/load.c b/src/audio/internal/load.c similarity index 95% rename from src/audio/lib/load.c rename to src/audio/internal/load.c index 0aa3324d73..f723e5b836 100644 --- a/src/audio/lib/load.c +++ b/src/audio/internal/load.c @@ -1,6 +1,14 @@ +/** + * Original Filename: system.c + */ + +#include "array_count.h" +#include "attributes.h" +#include "buffers.h" +#include "segment_symbols.h" #include "ultra64.h" -#include "global.h" #include "versions.h" +#include "z64audio.h" #define MK_ASYNC_MSG(retData, tableType, id, loadStatus) \ (((retData) << 24) | ((tableType) << 16) | ((id) << 8) | (loadStatus)) @@ -73,6 +81,9 @@ void* sUnusedHandler = NULL; s32 gAudioContextInitialized = false; +/** + * original name: Nas_WaveDmaFrameWork + */ void AudioLoad_DecreaseSampleDmaTtls(void) { u32 i; @@ -105,6 +116,9 @@ void AudioLoad_DecreaseSampleDmaTtls(void) { gAudioCtx.unused2628 = 0; } +/** + * original name:Nas_WaveDmaCallBack + */ void* AudioLoad_DmaSampleData(u32 devAddr, u32 size, s32 arg2, u8* dmaIndexRef, s32 medium) { s32 pad1; SampleDma* dma; @@ -199,6 +213,9 @@ void* AudioLoad_DmaSampleData(u32 devAddr, u32 size, s32 arg2, u8* dmaIndexRef, return (devAddr - dmaDevAddr) + dma->ramAddr; } +/** + * original name: Nas_WaveDmaNew + */ void AudioLoad_InitSampleDmaBuffers(s32 numNotes) { SampleDma* dma; s32 i; @@ -268,6 +285,9 @@ void AudioLoad_InitSampleDmaBuffers(s32 numNotes) { gAudioCtx.sampleDmaReuseQueue2WrPos = gAudioCtx.sampleDmaCount - gAudioCtx.sampleDmaListSize1; } +/** + * original name: Nas_CheckIDbank + */ s32 AudioLoad_IsFontLoadComplete(s32 fontId) { if (fontId == 0xFF) { return true; @@ -280,6 +300,9 @@ s32 AudioLoad_IsFontLoadComplete(s32 fontId) { } } +/** + * original name: Nas_CheckIDseq + */ s32 AudioLoad_IsSeqLoadComplete(s32 seqId) { if (seqId == 0xFF) { return true; @@ -292,6 +315,9 @@ s32 AudioLoad_IsSeqLoadComplete(s32 seqId) { } } +/** + * original name: Nas_CheckIDwave + */ s32 AudioLoad_IsSampleLoadComplete(s32 sampleBankId) { if (sampleBankId == 0xFF) { return true; @@ -305,18 +331,27 @@ s32 AudioLoad_IsSampleLoadComplete(s32 sampleBankId) { } } +/** + * original name: Nas_WriteIDbank + */ void AudioLoad_SetFontLoadStatus(s32 fontId, s32 loadStatus) { if ((fontId != 0xFF) && (gAudioCtx.fontLoadStatus[fontId] != LOAD_STATUS_PERMANENTLY_LOADED)) { gAudioCtx.fontLoadStatus[fontId] = loadStatus; } } +/** + * original name: Nas_WriteIDseq + */ void AudioLoad_SetSeqLoadStatus(s32 seqId, s32 loadStatus) { if ((seqId != 0xFF) && (gAudioCtx.seqLoadStatus[seqId] != LOAD_STATUS_PERMANENTLY_LOADED)) { gAudioCtx.seqLoadStatus[seqId] = loadStatus; } } +/** + * original name: Nas_WriteIDwave + */ void AudioLoad_SetSampleFontLoadStatusAndApplyCaches(s32 sampleBankId, s32 loadStatus) { if (sampleBankId != 0xFF) { if (gAudioCtx.sampleFontLoadStatus[sampleBankId] != LOAD_STATUS_PERMANENTLY_LOADED) { @@ -330,12 +365,18 @@ void AudioLoad_SetSampleFontLoadStatusAndApplyCaches(s32 sampleBankId, s32 loadS } } +/** + * original name: Nas_WriteIDwaveOnly + */ void AudioLoad_SetSampleFontLoadStatus(s32 sampleBankId, s32 loadStatus) { if ((sampleBankId != 0xFF) && (gAudioCtx.sampleFontLoadStatus[sampleBankId] != LOAD_STATUS_PERMANENTLY_LOADED)) { gAudioCtx.sampleFontLoadStatus[sampleBankId] = loadStatus; } } +/** + * original name: Nas_BankHeaderInit + */ void AudioLoad_InitTable(AudioTable* table, u32 romAddr, u16 unkMediumParam) { s32 i; @@ -349,6 +390,9 @@ void AudioLoad_InitTable(AudioTable* table, u32 romAddr, u16 unkMediumParam) { } } +/** + * original name: Nas_PreLoadBank + */ SoundFontData* AudioLoad_SyncLoadSeqFonts(s32 seqId, u32* outDefaultFontId) { s32 pad[2]; s32 index; @@ -375,6 +419,9 @@ SoundFontData* AudioLoad_SyncLoadSeqFonts(s32 seqId, u32* outDefaultFontId) { return fontData; } +/** + * original name: Nas_PreLoadSeq + */ void AudioLoad_SyncLoadSeqParts(s32 seqId, s32 arg1) { s32 pad; u32 defaultFontId; @@ -389,6 +436,9 @@ void AudioLoad_SyncLoadSeqParts(s32 seqId, s32 arg1) { } } +/** + * original name: __Nas_LoadVoice_Inner + */ s32 AudioLoad_SyncLoadSample(Sample* sample, s32 fontId) { void* sampleAddr; @@ -413,6 +463,9 @@ s32 AudioLoad_SyncLoadSample(Sample* sample, s32 fontId) { //! @bug Missing return, but the return value is never used so it's fine. } +/** + * original name: Nas_LoadVoice + */ s32 AudioLoad_SyncLoadInstrument(s32 fontId, s32 instId, s32 drumId) { if (instId < 0x7F) { Instrument* instrument = Audio_GetInstrumentInner(fontId, instId); @@ -439,24 +492,39 @@ s32 AudioLoad_SyncLoadInstrument(s32 fontId, s32 instId, s32 drumId) { } } +/** + * original name: Nas_PreLoad_BG + */ void AudioLoad_AsyncLoad(s32 tableType, s32 id, s32 nChunks, s32 retData, OSMesgQueue* retQueue) { if (AudioLoad_AsyncLoadInner(tableType, id, nChunks, retData, retQueue) == NULL) { osSendMesg(retQueue, (OSMesg)0xFFFFFFFF, OS_MESG_NOBLOCK); } } +/** + * original name: Nas_PreLoadSeq_BG + */ void AudioLoad_AsyncLoadSeq(s32 seqId, s32 arg1, s32 retData, OSMesgQueue* retQueue) { AudioLoad_AsyncLoad(SEQUENCE_TABLE, seqId, 0, retData, retQueue); } +/** + * original name: Nas_PreLoadWave_BG + */ void AudioLoad_AsyncLoadSampleBank(s32 sampleBankId, s32 arg1, s32 retData, OSMesgQueue* retQueue) { AudioLoad_AsyncLoad(SAMPLE_TABLE, sampleBankId, 0, retData, retQueue); } +/** + * original name: Nas_PreLoadBank_BG + */ void AudioLoad_AsyncLoadFont(s32 fontId, s32 arg1, s32 retData, OSMesgQueue* retQueue) { AudioLoad_AsyncLoad(FONT_TABLE, fontId, 0, retData, retQueue); } +/** + * original name: Nas_SeqToBank + */ u8* AudioLoad_GetFontsForSequence(s32 seqId, u32* outNumFonts) { s32 index = ((u16*)gAudioCtx.sequenceFontTable)[seqId]; @@ -467,6 +535,9 @@ u8* AudioLoad_GetFontsForSequence(s32 seqId, u32* outNumFonts) { return &gAudioCtx.sequenceFontTable[index]; } +/** + * original name: Nas_FlushBank + */ void AudioLoad_DiscardSeqFonts(s32 seqId) { s32 fontId; s32 index = ((u16*)gAudioCtx.sequenceFontTable)[seqId]; @@ -482,6 +553,9 @@ void AudioLoad_DiscardSeqFonts(s32 seqId) { } } +/** + * original name: __Kill_Bank + */ void AudioLoad_DiscardFont(s32 fontId) { u32 i; AudioCache* pool = &gAudioCtx.fontCache; @@ -503,6 +577,9 @@ void AudioLoad_DiscardFont(s32 fontId) { AudioHeap_DiscardFont(fontId); } +/** + * original name: Nas_StartMySeq + */ s32 AudioLoad_SyncInitSeqPlayer(s32 playerIdx, s32 seqId, s32 arg2) { if (gAudioCtx.resetTimer != 0) { return 0; @@ -516,6 +593,9 @@ s32 AudioLoad_SyncInitSeqPlayer(s32 playerIdx, s32 seqId, s32 arg2) { //! The callers of this function do not use the return value, so it's fine. } +/** + * original name: Nas_StartSeq_Skip + */ s32 AudioLoad_SyncInitSeqPlayerSkipTicks(s32 playerIdx, s32 seqId, s32 skipTicks) { if (gAudioCtx.resetTimer != 0) { return 0; @@ -526,6 +606,9 @@ s32 AudioLoad_SyncInitSeqPlayerSkipTicks(s32 playerIdx, s32 seqId, s32 skipTicks //! @bug Missing return, see comment in AudioLoad_SyncInitSeqPlayer above. } +/** + * original name: __Nas_StartSeq + */ s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2) { SequencePlayer* seqPlayer = &gAudioCtx.seqPlayers[playerIdx]; u8* seqData; @@ -568,6 +651,9 @@ s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2) { //! @bug missing return (but the return value is not used so it's not UB) } +/** + * original name: __Load_Seq + */ u8* AudioLoad_SyncLoadSeq(s32 seqId) { s32 pad; s32 didAllocate; @@ -579,10 +665,16 @@ u8* AudioLoad_SyncLoadSeq(s32 seqId) { return AudioLoad_SyncLoad(SEQUENCE_TABLE, seqId, &didAllocate); } +/** + * original name: __Load_Wave_Check + */ u32 AudioLoad_GetSampleBank(u32 sampleBankId, u32* outMedium) { return AudioLoad_TrySyncLoadSampleBank(sampleBankId, outMedium, true); } +/** + * original name: __Load_Wave + */ u32 AudioLoad_TrySyncLoadSampleBank(u32 sampleBankId, u32* outMedium, s32 noLoad) { void* ramAddr; AudioTable* sampleBankTable; @@ -615,6 +707,9 @@ u32 AudioLoad_TrySyncLoadSampleBank(u32 sampleBankId, u32* outMedium, s32 noLoad return sampleBankTable->entries[realTableId].romAddr; } +/** + * original name: __Load_Ctrl + */ SoundFontData* AudioLoad_SyncLoadFont(u32 fontId) { SoundFontData* fontData; s32 sampleBankId1; @@ -654,6 +749,9 @@ SoundFontData* AudioLoad_SyncLoadFont(u32 fontId) { return fontData; } +/** + * original name: __Load_Bank + */ void* AudioLoad_SyncLoad(u32 tableType, u32 id, s32* didAllocate) { u32 size; AudioTable* table; @@ -738,6 +836,9 @@ void* AudioLoad_SyncLoad(u32 tableType, u32 id, s32* didAllocate) { return ramAddr; } +/** + * original name: __Link_BankNum + */ u32 AudioLoad_GetRealTableIndex(s32 tableType, u32 id) { AudioTable* table = AudioLoad_GetLoadTable(tableType); @@ -748,6 +849,9 @@ u32 AudioLoad_GetRealTableIndex(s32 tableType, u32 id) { return id; } +/** + * original name: __Check_Cache + */ void* AudioLoad_SearchCaches(s32 tableType, s32 id) { void* ramAddr; @@ -764,6 +868,10 @@ void* AudioLoad_SearchCaches(s32 tableType, s32 id) { return NULL; } +/** + * Animal Crossing's equivalent to this function is __Get_ArcHeader. + * This name must be new, because ARC files are GameCube speicifc. + */ AudioTable* AudioLoad_GetLoadTable(s32 tableType) { AudioTable* table; @@ -789,7 +897,9 @@ AudioTable* AudioLoad_GetLoadTable(s32 tableType) { /** * Read and extract information from soundFont binary loaded into ram. - * Also relocate offsets into pointers within this loaded soundFont + * Also relocate offsets into pointers within this loaded soundFont. + * + * original name: Nas_BankOfsToAddr_Inner * * @param fontId index of font being processed * @param fontDataStartAddr ram address of raw soundfont binary loaded into cache @@ -919,6 +1029,9 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, Sample gAudioCtx.soundFontList[fontId].instruments = (Instrument**)(fontData + 2); } +/** + * original name: Nas_FastCopy + */ void AudioLoad_SyncDma(u32 devAddr, u8* ramAddr, u32 size, s32 medium) { OSMesgQueue* msgQueue = &gAudioCtx.syncDmaQueue; OSIoMesg* ioMesg = &gAudioCtx.syncDmaIoMesg; @@ -943,9 +1056,15 @@ void AudioLoad_SyncDma(u32 devAddr, u8* ramAddr, u32 size, s32 medium) { } } +/** + * original name: Nas_FastDiskCopy + */ void AudioLoad_SyncDmaUnkMedium(u32 devAddr, u8* addr, u32 size, s32 unkMediumParam) { } +/** + * original name: Nas_StartDma + */ s32 AudioLoad_Dma(OSIoMesg* mesg, u32 priority, s32 direction, u32 devAddr, void* ramAddr, u32 size, OSMesgQueue* reqQueue, s32 medium, const char* dmaFuncType) { OSPiHandle* handle; @@ -983,15 +1102,24 @@ s32 AudioLoad_Dma(OSIoMesg* mesg, u32 priority, s32 direction, u32 devAddr, void return 0; } +/** + * original name: __OfsToLbaOfs + */ void AudioLoad_Unused1(void) { } +/** + * original name: EmemLoad + */ void AudioLoad_SyncLoadSimple(u32 tableType, u32 fontId) { s32 didAllocate; AudioLoad_SyncLoad(tableType, fontId, &didAllocate); } +/** + * original name: __Load_Bank_BG + */ void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData, OSMesgQueue* retQueue) { u32 size; AudioTable* table; @@ -1098,20 +1226,32 @@ void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData, return ramAddr; } +/** + * original name: Nas_BgDmaFrameWork + */ void AudioLoad_ProcessLoads(s32 resetStatus) { AudioLoad_ProcessSlowLoads(resetStatus); AudioLoad_ProcessSamplePreloads(resetStatus); AudioLoad_ProcessAsyncLoads(resetStatus); } +/** + * original name: Nas_SetRomHandler + */ void AudioLoad_SetDmaHandler(DmaHandler callback) { sDmaHandler = callback; } +/** + * original name: Nas_SetRomHandler + */ void AudioLoad_SetUnusedHandler(void* callback) { sUnusedHandler = callback; } +/** + * original name: __SetVlute + */ void AudioLoad_InitSoundFont(s32 fontId) { SoundFont* font = &gAudioCtx.soundFontList[fontId]; AudioTableEntry* entry = &gAudioCtx.soundFontTable->entries[fontId]; @@ -1123,6 +1263,9 @@ void AudioLoad_InitSoundFont(s32 fontId) { font->numSfx = entry->shortData3; } +/** + * original name: Nas_InitAudio + */ void AudioLoad_Init(void* heap, u32 heapSize) { s32 pad[18]; s32 numFonts; @@ -1189,7 +1332,7 @@ void AudioLoad_Init(void* heap, u32 heapSize) { gAudioCtx.totalTaskCount = 0; gAudioCtx.rspTaskIndex = 0; gAudioCtx.curAiBufIndex = 0; - gAudioCtx.soundMode = SOUNDMODE_STEREO; + gAudioCtx.soundOutputMode = SOUND_OUTPUT_STEREO; gAudioCtx.curTask = NULL; gAudioCtx.rspTask[0].task.t.data_size = 0; gAudioCtx.rspTask[1].task.t.data_size = 0; @@ -1225,7 +1368,7 @@ void AudioLoad_Init(void* heap, u32 heapSize) { } // Set audio tables pointers - gAudioCtx.sequenceTable = (AudioTable*)gSequenceTable; + gAudioCtx.sequenceTable = &gSequenceTable; gAudioCtx.soundFontTable = &gSoundFontTable; gAudioCtx.sampleBankTable = &gSampleBankTable; gAudioCtx.sequenceFontTable = gSequenceFontTable; @@ -1258,11 +1401,17 @@ void AudioLoad_Init(void* heap, u32 heapSize) { osSendMesg(gAudioCtx.taskStartQueueP, (OSMesg)gAudioCtx.totalTaskCount, OS_MESG_NOBLOCK); } +/** + * original name: LpsInit + */ void AudioLoad_InitSlowLoads(void) { gAudioCtx.slowLoads[0].state = SLOW_LOAD_STATE_WAITING; gAudioCtx.slowLoads[1].state = SLOW_LOAD_STATE_WAITING; } +/** + * original name: VoiceLoad + */ s32 AudioLoad_SlowLoadSample(s32 fontId, s32 instId, s8* status) { Sample* sample; AudioSlowLoad* slowLoad; @@ -1313,6 +1462,9 @@ s32 AudioLoad_SlowLoadSample(s32 fontId, s32 instId, s8* status) { return 0; } +/** + * original name: __GetWaveTable + */ Sample* AudioLoad_GetFontSample(s32 fontId, s32 instId) { Sample* sample; @@ -1344,6 +1496,9 @@ Sample* AudioLoad_GetFontSample(s32 fontId, s32 instId) { void AudioLoad_Unused2(void) { } +/** + * original name: __SwapLoadLps + */ void AudioLoad_FinishSlowLoad(AudioSlowLoad* slowLoad) { Sample* sample; @@ -1361,6 +1516,9 @@ void AudioLoad_FinishSlowLoad(AudioSlowLoad* slowLoad) { sample->medium = MEDIUM_RAM; } +/** + * original name: LpsDma + */ void AudioLoad_ProcessSlowLoads(s32 resetStatus) { AudioSlowLoad* slowLoad; s32 i; @@ -1410,6 +1568,9 @@ void AudioLoad_ProcessSlowLoads(s32 resetStatus) { } } +/** + * original name: __Nas_SlowCopy + */ void AudioLoad_DmaSlowCopy(AudioSlowLoad* slowLoad, s32 size) { Audio_InvalDCache(slowLoad->curRamAddr, size); osCreateMesgQueue(&slowLoad->msgQueue, &slowLoad->msg, 1); @@ -1417,9 +1578,15 @@ void AudioLoad_DmaSlowCopy(AudioSlowLoad* slowLoad, s32 size) { &slowLoad->msgQueue, slowLoad->medium, "SLOWCOPY"); } +/** + * original name: __Nas_SlowDiskCopy + */ void AudioLoad_DmaSlowCopyUnkMedium(s32 devAddr, u8* ramAddr, s32 size, s32 arg3) { } +/** + * original name: SeqLoad + */ s32 AudioLoad_SlowLoadSeq(s32 seqId, u8* ramAddr, s8* status) { AudioSlowLoad* slowLoad; AudioTable* seqTable; @@ -1457,6 +1624,9 @@ s32 AudioLoad_SlowLoadSeq(s32 seqId, u8* ramAddr, s8* status) { return 0; } +/** + * original name: Nas_BgCopyInit + */ void AudioLoad_InitAsyncLoads(void) { s32 i; @@ -1465,6 +1635,9 @@ void AudioLoad_InitAsyncLoads(void) { } } +/** + * original name: Nas_BgCopyDisk + */ AudioAsyncLoad* AudioLoad_StartAsyncLoadUnkMedium(s32 unkMediumParam, u32 devAddr, void* ramAddr, s32 size, s32 medium, s32 nChunks, OSMesgQueue* retQueue, s32 retMsg) { AudioAsyncLoad* asyncLoad; @@ -1480,6 +1653,9 @@ AudioAsyncLoad* AudioLoad_StartAsyncLoadUnkMedium(s32 unkMediumParam, u32 devAdd return asyncLoad; } +/** + * original name: Nas_BgCopyReq + */ AudioAsyncLoad* AudioLoad_StartAsyncLoad(u32 devAddr, void* ramAddr, u32 size, s32 medium, s32 nChunks, OSMesgQueue* retQueue, s32 retMsg) { AudioAsyncLoad* asyncLoad; @@ -1522,6 +1698,9 @@ AudioAsyncLoad* AudioLoad_StartAsyncLoad(u32 devAddr, void* ramAddr, u32 size, s return asyncLoad; } +/** + * original name: Nas_BgCopyMain + */ void AudioLoad_ProcessAsyncLoads(s32 resetStatus) { AudioAsyncLoad* asyncLoad; s32 i; @@ -1556,9 +1735,15 @@ void AudioLoad_ProcessAsyncLoads(s32 resetStatus) { } } +/** + * original name: __BgCopyDisk + */ void AudioLoad_ProcessAsyncLoadUnkMedium(AudioAsyncLoad* asyncLoad, s32 resetStatus) { } +/** + * original name: __BgCopyFinishProcess + */ void AudioLoad_FinishAsyncLoad(AudioAsyncLoad* asyncLoad) { u32 retMsg = asyncLoad->retMsg; u32 fontId; @@ -1599,6 +1784,9 @@ void AudioLoad_FinishAsyncLoad(AudioAsyncLoad* asyncLoad) { osSendMesg(asyncLoad->retQueue, doneMsg, OS_MESG_NOBLOCK); } +/** + * original name: __BgCopySub + */ void AudioLoad_ProcessAsyncLoad(AudioAsyncLoad* asyncLoad, s32 resetStatus) { AudioTable* sampleBankTable = gAudioCtx.sampleBankTable; @@ -1647,6 +1835,9 @@ void AudioLoad_ProcessAsyncLoad(AudioAsyncLoad* asyncLoad, s32 resetStatus) { asyncLoad->curRamAddr += asyncLoad->chunkSize; } +/** + * original name: __Nas_BgCopy + */ void AudioLoad_AsyncDma(AudioAsyncLoad* asyncLoad, u32 size) { size = ALIGN16(size); Audio_InvalDCache(asyncLoad->curRamAddr, size); @@ -1655,6 +1846,9 @@ void AudioLoad_AsyncDma(AudioAsyncLoad* asyncLoad, u32 size) { &asyncLoad->msgQueue, asyncLoad->medium, "BGCOPY"); } +/** + * original name: __Nas_BgDiskCopy + */ void AudioLoad_AsyncDmaUnkMedium(u32 devAddr, void* ramAddr, u32 size, s16 arg3) { } @@ -1664,6 +1858,8 @@ void AudioLoad_AsyncDmaUnkMedium(u32 devAddr, void* ramAddr, u32 size, s16 arg3) * TunedSample contains metadata on a sample used by a particular instrument/drum/sfx * Also relocate offsets into pointers within this loaded TunedSample * + * original name: __WaveTouch + * * @param fontId index of font being processed * @param fontData ram address of raw soundfont binary loaded into cache * @param sampleBankReloc information on the sampleBank containing raw audio samples @@ -1720,6 +1916,8 @@ void AudioLoad_RelocateSample(TunedSample* tunedSample, SoundFontData* fontData, } /** + * original name: Nas_BankOfsToAddr + * * @param fontId index of font being processed * @param fontData ram address of raw soundfont binary loaded into cache * @param sampleBankReloc information on the sampleBank containing raw audio samples @@ -1827,6 +2025,9 @@ void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* fontData } } +/** + * original name: Nas_CheckBgWave + */ s32 AudioLoad_ProcessSamplePreloads(s32 resetStatus) { Sample* sample; AudioPreloadReq* preload; @@ -1889,6 +2090,9 @@ s32 AudioLoad_ProcessSamplePreloads(s32 resetStatus) { return true; } +/** + * original name: __AddList + */ s32 AudioLoad_AddToSampleSet(Sample* sample, s32 numSamples, Sample** sampleSet) { s32 i; @@ -1906,6 +2110,9 @@ s32 AudioLoad_AddToSampleSet(Sample* sample, s32 numSamples, Sample** sampleSet) return numSamples; } +/** + * original name: MakeWaveList + */ s32 AudioLoad_GetSamplesForFont(s32 fontId, Sample** sampleSet) { s32 i; s32 numSamples = 0; @@ -1939,6 +2146,9 @@ s32 AudioLoad_GetSamplesForFont(s32 fontId, Sample** sampleSet) { return numSamples; } +/** + * original name: __Reload + */ void AudioLoad_AddUsedSample(TunedSample* tunedSample) { Sample* sample = tunedSample->sample; @@ -1947,6 +2157,9 @@ void AudioLoad_AddUsedSample(TunedSample* tunedSample) { } } +/** + * original name: WaveReload + */ void AudioLoad_PreloadSamplesForFont(s32 fontId, s32 async, SampleBankRelocInfo* sampleBankReloc) { s32 numDrums; s32 numInstruments; @@ -2082,6 +2295,9 @@ void AudioLoad_PreloadSamplesForFont(s32 fontId, s32 async, SampleBankRelocInfo* } } +/** + * original name: EmemReload + */ void AudioLoad_LoadPermanentSamples(void) { s32 pad; u32 fontId; @@ -2114,15 +2330,27 @@ void AudioLoad_LoadPermanentSamples(void) { } } +/** + * original name: __ExtDiskFinishCheck + */ void AudioLoad_Unused3(void) { } +/** + * original name: __ExtDiskInit + */ void AudioLoad_Unused4(void) { } +/** + * original name: __ExtDiskLoad + */ void AudioLoad_Unused5(void) { } +/** + * original name: MK_load + */ void AudioLoad_ScriptLoad(s32 tableType, s32 id, s8* status) { static u32 sLoadIndex = 0; @@ -2134,6 +2362,9 @@ void AudioLoad_ScriptLoad(s32 tableType, s32 id, s8* status) { } } +/** + * original name: MK_FrameWork + */ void AudioLoad_ProcessScriptLoads(void) { u32 temp; u32 sp20; @@ -2148,6 +2379,9 @@ void AudioLoad_ProcessScriptLoads(void) { } } +/** + * original name: MK_Init + */ void AudioLoad_InitScriptLoads(void) { osCreateMesgQueue(&sScriptLoadQueue, sScriptLoadMsgBuf, ARRAY_COUNT(sScriptLoadMsgBuf)); } diff --git a/src/audio/lib/aisetnextbuf.c b/src/audio/internal/os.c similarity index 83% rename from src/audio/lib/aisetnextbuf.c rename to src/audio/internal/os.c index 4cf5d1f7d9..4bbb0d2fdb 100644 --- a/src/audio/lib/aisetnextbuf.c +++ b/src/audio/internal/os.c @@ -1,4 +1,23 @@ -#include "global.h" +/** + * Original Filename: os.c + */ + +#include "ultra64.h" +#include "z64audio.h" + +void Audio_InvalDCache(void* buf, s32 size) { + OSIntMask prevMask = osSetIntMask(OS_IM_NONE); + + osInvalDCache(buf, size); + osSetIntMask(prevMask); +} + +void Audio_WritebackDCache(void* buf, s32 size) { + OSIntMask prevMask = osSetIntMask(OS_IM_NONE); + + osWritebackDCache(buf, size); + osSetIntMask(prevMask); +} /** * Submits an audio buffer to be consumed by the Audio DAC. The audio interface can queue a second DMA while another diff --git a/src/audio/lib/playback.c b/src/audio/internal/playback.c similarity index 99% rename from src/audio/lib/playback.c rename to src/audio/internal/playback.c index 9c1b8126e4..327e271d06 100644 --- a/src/audio/lib/playback.c +++ b/src/audio/internal/playback.c @@ -1,4 +1,5 @@ -#include "global.h" +#include "ultra64.h" +#include "z64audio.h" void Audio_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) { f32 volLeft; @@ -31,7 +32,7 @@ void Audio_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) { sub->bitField0.stereoStrongLeft = false; sub->bitField0.stereoHeadsetEffects = stereoData.stereoHeadsetEffects; sub->bitField0.usesHeadsetPanEffects = stereoData.usesHeadsetPanEffects; - if (stereoHeadsetEffects && (gAudioCtx.soundMode == SOUNDMODE_HEADSET)) { + if (stereoHeadsetEffects && (gAudioCtx.soundOutputMode == SOUND_OUTPUT_HEADSET)) { halfPanIndex = pan >> 1; if (halfPanIndex > 0x3F) { halfPanIndex = 0x3F; @@ -43,7 +44,7 @@ void Audio_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) { volLeft = gHeadsetPanVolume[pan]; volRight = gHeadsetPanVolume[0x7F - pan]; - } else if (stereoHeadsetEffects && (gAudioCtx.soundMode == SOUNDMODE_STEREO)) { + } else if (stereoHeadsetEffects && (gAudioCtx.soundOutputMode == SOUND_OUTPUT_STEREO)) { strongLeft = strongRight = 0; sub->haasEffectLeftDelaySize = 0; sub->haasEffectRightDelaySize = 0; @@ -80,7 +81,7 @@ void Audio_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) { break; } - } else if (gAudioCtx.soundMode == SOUNDMODE_MONO) { + } else if (gAudioCtx.soundOutputMode == SOUND_OUTPUT_MONO) { sub->bitField0.stereoHeadsetEffects = false; sub->bitField0.usesHeadsetPanEffects = false; volLeft = 0.707f; // approx 1/sqrt(2) diff --git a/src/audio/lib/seqplayer.c b/src/audio/internal/seqplayer.c similarity index 83% rename from src/audio/lib/seqplayer.c rename to src/audio/internal/seqplayer.c index a7091b24b3..1d6fb7c0a6 100644 --- a/src/audio/lib/seqplayer.c +++ b/src/audio/internal/seqplayer.c @@ -1,5 +1,6 @@ /** * @file audio_seqplayer.c + * original name: track.c * * Manages audio sequence players, interprets and executes sequence instructions used to write .seq files * @@ -13,8 +14,14 @@ * - All three sets share a common pool of control flow instructions (>= 0xF2). * Otherwise, each set of instructions has its own command interpreter */ +#include "audio/aseq.h" +#include "array_count.h" +#include "assert.h" +#include "attributes.h" #include "ultra64.h" -#include "global.h" +#include "z64audio.h" + +static_assert(MML_VERSION == MML_VERSION_OOT, "This file implements the OoT version of the MML"); #define PORTAMENTO_IS_SPECIAL(x) ((x).mode & 0x80) #define PORTAMENTO_MODE(x) ((x).mode & ~0x80) @@ -70,93 +77,95 @@ u8 AudioSeq_GetInstrument(SequenceChannel* channel, u8 instId, Instrument** inst (((sizeof(arg0Type) - 1) << 7) | ((sizeof(arg1Type) - 1) << 6) | ((sizeof(arg2Type) - 1) << 5) | 3) u8 sSeqInstructionArgsTable[] = { - CMD_ARGS_1(s16), // 0xB0 - CMD_ARGS_0(), // 0xB1 - CMD_ARGS_1(s16), // 0xB2 - CMD_ARGS_1(u8), // 0xB3 - CMD_ARGS_0(), // 0xB4 - CMD_ARGS_0(), // 0xB5 - CMD_ARGS_0(), // 0xB6 - CMD_ARGS_1(s16), // 0xB7 - CMD_ARGS_1(u8), // 0xB8 - CMD_ARGS_1(u8), // 0xB9 - CMD_ARGS_1(u8), // 0xBA - CMD_ARGS_2(u8, s16), // 0xBB - CMD_ARGS_1(s16), // 0xBC - CMD_ARGS_2(s16, s16), // 0xBD + CMD_ARGS_1(s16), // ASEQ_OP_CHAN_LDFILTER + CMD_ARGS_0(), // ASEQ_OP_CHAN_FREEFILTER + CMD_ARGS_1(s16), // ASEQ_OP_CHAN_LDSEQTOPTR + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_FILTER + CMD_ARGS_0(), // ASEQ_OP_CHAN_PTRTODYNTBL + CMD_ARGS_0(), // ASEQ_OP_CHAN_DYNTBLTOPTR + CMD_ARGS_0(), // ASEQ_OP_CHAN_DYNTBLV + CMD_ARGS_1(s16), // ASEQ_OP_CHAN_RANDTOPTR + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_RAND + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_RANDVEL + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_RANDGATE + CMD_ARGS_2(u8, s16), // ASEQ_OP_CHAN_COMBFILTER + CMD_ARGS_1(s16), // ASEQ_OP_CHAN_PTRADD + CMD_ARGS_2(s16, s16), // ASEQ_OP_CHAN_RANDPTR CMD_ARGS_0(), // 0xBE CMD_ARGS_0(), // 0xBF CMD_ARGS_0(), // 0xC0 - CMD_ARGS_1(u8), // 0xC1 - CMD_ARGS_1(s16), // 0xC2 - CMD_ARGS_0(), // 0xC3 - CMD_ARGS_0(), // 0xC4 - CMD_ARGS_0(), // 0xC5 - CMD_ARGS_1(u8), // 0xC6 - CMD_ARGS_2(u8, s16), // 0xC7 - CMD_ARGS_1(u8), // 0xC8 - CMD_ARGS_1(u8), // 0xC9 - CMD_ARGS_1(u8), // 0xCA - CMD_ARGS_1(s16), // 0xCB - CMD_ARGS_1(u8), // 0xCC - CMD_ARGS_1(u8), // 0xCD - CMD_ARGS_1(s16), // 0xCE - CMD_ARGS_1(s16), // 0xCF - CMD_ARGS_1(u8), // 0xD0 - CMD_ARGS_1(u8), // 0xD1 - CMD_ARGS_1(u8), // 0xD2 - CMD_ARGS_1(u8), // 0xD3 - CMD_ARGS_1(u8), // 0xD4 + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_INSTR + CMD_ARGS_1(s16), // ASEQ_OP_CHAN_DYNTBL + CMD_ARGS_0(), // ASEQ_OP_CHAN_SHORT + CMD_ARGS_0(), // ASEQ_OP_CHAN_NOSHORT + CMD_ARGS_0(), // ASEQ_OP_CHAN_DYNTBLLOOKUP + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_FONT + CMD_ARGS_2(u8, s16), // ASEQ_OP_CHAN_STSEQ + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_SUB + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_AND + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_MUTEBHV + CMD_ARGS_1(s16), // ASEQ_OP_CHAN_LDSEQ + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_LDI + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_STOPCHAN + CMD_ARGS_1(s16), // ASEQ_OP_CHAN_LDPTR + CMD_ARGS_1(s16), // ASEQ_OP_CHAN_STPTRTOSEQ + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_EFFECTS + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_NOTEALLOC + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_SUSTAIN + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_BEND + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_REVERB CMD_ARGS_1(u8), // 0xD5 CMD_ARGS_1(u8), // 0xD6 - CMD_ARGS_1(u8), // 0xD7 - CMD_ARGS_1(u8), // 0xD8 - CMD_ARGS_1(u8), // 0xD9 - CMD_ARGS_1(s16), // 0xDA - CMD_ARGS_1(u8), // 0xDB - CMD_ARGS_1(u8), // 0xDC - CMD_ARGS_1(u8), // 0xDD - CMD_ARGS_1(s16), // 0xDE - CMD_ARGS_1(u8), // 0xDF - CMD_ARGS_1(u8), // 0xE0 - CMD_ARGS_3(u8, u8, u8), // 0xE1 - CMD_ARGS_3(u8, u8, u8), // 0xE2 - CMD_ARGS_1(u8), // 0xE3 - CMD_ARGS_0(), // 0xE4 - CMD_ARGS_1(u8), // 0xE5 - CMD_ARGS_1(u8), // 0xE6 - CMD_ARGS_1(s16), // 0xE7 - CMD_ARGS_3(u8, u8, u8), // 0xE8 - CMD_ARGS_1(u8), // 0xE9 - CMD_ARGS_0(), // 0xEA - CMD_ARGS_2(u8, u8), // 0xEB - CMD_ARGS_0(), // 0xEC - CMD_ARGS_1(u8), // 0xED - CMD_ARGS_1(u8), // 0xEE + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_VIBFREQ + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_VIBDEPTH + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_RELEASERATE + CMD_ARGS_1(s16), // ASEQ_OP_CHAN_ENV + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_TRANSPOSE + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_PANWEIGHT + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_PAN + CMD_ARGS_1(s16), // ASEQ_OP_CHAN_FREQSCALE + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_VOL + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_VOLEXP + CMD_ARGS_3(u8, u8, u8), // ASEQ_OP_CHAN_VIBFREQGRAD + CMD_ARGS_3(u8, u8, u8), // ASEQ_OP_CHAN_VIBDEPTHGRAD + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_VIBDELAY + CMD_ARGS_0(), // ASEQ_OP_CHAN_DYNCALL + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_REVERBIDX + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_SAMPLEBOOK + CMD_ARGS_1(s16), // ASEQ_OP_CHAN_LDPARAMS + CMD_ARGS_3(u8, u8, u8), // ASEQ_OP_CHAN_PARAMS + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_NOTEPRI + CMD_ARGS_0(), // ASEQ_OP_CHAN_STOP + CMD_ARGS_2(u8, u8), // ASEQ_OP_CHAN_FONTINSTR + CMD_ARGS_0(), // ASEQ_OP_CHAN_VIBRESET + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_GAIN + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_BENDFINE CMD_ARGS_2(s16, u8), // 0xEF - CMD_ARGS_0(), // 0xF0 - CMD_ARGS_1(u8), // 0xF1 - // Control flow instructions (>= 0xF2) can only have 0 or 1 args - CMD_ARGS_1(u8), // 0xF2 - CMD_ARGS_1(u8), // 0xF3 - CMD_ARGS_1(u8), // 0xF4 - CMD_ARGS_1(s16), // 0xF5 - CMD_ARGS_0(), // 0xF6 - CMD_ARGS_0(), // 0xF7 - CMD_ARGS_1(u8), // 0xF8 - CMD_ARGS_1(s16), // 0xF9 - CMD_ARGS_1(s16), // 0xFA - CMD_ARGS_1(s16), // 0xFB - CMD_ARGS_1(s16), // 0xFC - CMD_ARGS_0(), // 0xFD - CMD_ARGS_0(), // 0xFE - CMD_ARGS_0(), // 0xFF + CMD_ARGS_0(), // ASEQ_OP_CHAN_FREENOTELIST + CMD_ARGS_1(u8), // ASEQ_OP_CHAN_ALLOCNOTELIST + // Control flow instructions (>= ASEQ_OP_CONTROL_FLOW_FIRST) can only have 0 or 1 args + CMD_ARGS_1(u8), // ASEQ_OP_RBLTZ + CMD_ARGS_1(u8), // ASEQ_OP_RBEQZ + CMD_ARGS_1(u8), // ASEQ_OP_RJUMP + CMD_ARGS_1(s16), // ASEQ_OP_BGEZ + CMD_ARGS_0(), // ASEQ_OP_BREAK + CMD_ARGS_0(), // ASEQ_OP_LOOPEND + CMD_ARGS_1(u8), // ASEQ_OP_LOOP + CMD_ARGS_1(s16), // ASEQ_OP_BLTZ + CMD_ARGS_1(s16), // ASEQ_OP_BEQZ + CMD_ARGS_1(s16), // ASEQ_OP_JUMP + CMD_ARGS_1(s16), // ASEQ_OP_CALL + CMD_ARGS_0(), // ASEQ_OP_DELAY + CMD_ARGS_0(), // ASEQ_OP_DELAY1 + CMD_ARGS_0(), // ASEQ_OP_END }; /** * Read and return the argument from the sequence script for a control flow instruction. - * Control flow instructions (>= 0xF2) can only have 0 or 1 args. + * Control flow instructions (>= ASEQ_OP_CONTROL_FLOW_FIRST) can only have 0 or 1 args. * @return the argument value for a control flow instruction, or 0 if there is no argument + * + * original name: Convert_Com */ u16 AudioSeq_GetScriptControlFlowArgument(SeqScriptState* state, u8 cmd) { u8 highBits = sSeqInstructionArgsTable[cmd - 0xB0]; @@ -178,33 +187,35 @@ u16 AudioSeq_GetScriptControlFlowArgument(SeqScriptState* state, u8 cmd) { /** * Read and execute the control flow sequence instructions * @return number of frames until next instruction. -1 signals termination + * + * original name: Common_Com */ s32 AudioSeq_HandleScriptFlowControl(SequencePlayer* seqPlayer, SeqScriptState* state, s32 cmd, s32 cmdArg) { switch (cmd) { - case 0xFF: + case ASEQ_OP_END: if (state->depth == 0) { return PROCESS_SCRIPT_END; } state->pc = state->stack[--state->depth]; break; - case 0xFD: + case ASEQ_OP_DELAY: return AudioSeq_ScriptReadCompressedU16(state); - case 0xFE: + case ASEQ_OP_DELAY1: return 1; - case 0xFC: + case ASEQ_OP_CALL: state->stack[state->depth++] = state->pc; state->pc = seqPlayer->seqData + (u16)cmdArg; break; - case 0xF8: + case ASEQ_OP_LOOP: state->remLoopIters[state->depth] = cmdArg; state->stack[state->depth++] = state->pc; break; - case 0xF7: + case ASEQ_OP_LOOPEND: state->remLoopIters[state->depth - 1]--; if (state->remLoopIters[state->depth - 1] != 0) { state->pc = state->stack[state->depth - 1]; @@ -213,33 +224,33 @@ s32 AudioSeq_HandleScriptFlowControl(SequencePlayer* seqPlayer, SeqScriptState* } break; - case 0xF6: + case ASEQ_OP_BREAK: state->depth--; break; - case 0xF5: - case 0xF9: - case 0xFA: - case 0xFB: - if (cmd == 0xFA && state->value != 0) { + case ASEQ_OP_BGEZ: + case ASEQ_OP_BLTZ: + case ASEQ_OP_BEQZ: + case ASEQ_OP_JUMP: + if (cmd == ASEQ_OP_BEQZ && state->value != 0) { break; } - if (cmd == 0xF9 && state->value >= 0) { + if (cmd == ASEQ_OP_BLTZ && state->value >= 0) { break; } - if (cmd == 0xF5 && state->value < 0) { + if (cmd == ASEQ_OP_BGEZ && state->value < 0) { break; } state->pc = seqPlayer->seqData + (u16)cmdArg; break; - case 0xF2: - case 0xF3: - case 0xF4: - if (cmd == 0xF3 && state->value != 0) { + case ASEQ_OP_RBLTZ: + case ASEQ_OP_RBEQZ: + case ASEQ_OP_RJUMP: + if (cmd == ASEQ_OP_RBEQZ && state->value != 0) { break; } - if (cmd == 0xF2 && state->value >= 0) { + if (cmd == ASEQ_OP_RBLTZ && state->value >= 0) { break; } state->pc += (s8)(cmdArg & 0xFF); @@ -249,6 +260,9 @@ s32 AudioSeq_HandleScriptFlowControl(SequencePlayer* seqPlayer, SeqScriptState* return 0; } +/** + * original name: Nas_InitSubTrack + */ void AudioSeq_InitSequenceChannel(SequenceChannel* channel) { s32 i; @@ -304,6 +318,9 @@ void AudioSeq_InitSequenceChannel(SequenceChannel* channel) { Audio_InitNoteLists(&channel->notePool); } +/** + * original name: Nas_EntryNoteTrack + */ s32 AudioSeq_SeqChannelSetLayer(SequenceChannel* channel, s32 layerIndex) { SequenceLayer* layer; s32 pad; @@ -351,6 +368,9 @@ s32 AudioSeq_SeqChannelSetLayer(SequenceChannel* channel, s32 layerIndex) { return 0; } +/** + * original name: Nas_ReleaseNoteTrack + */ void AudioSeq_SeqLayerDisable(SequenceLayer* layer) { if (layer != NULL) { if (layer->channel != &gAudioCtx.sequenceChannelNone && layer->channel->seqPlayer->finished == 1) { @@ -363,6 +383,9 @@ void AudioSeq_SeqLayerDisable(SequenceLayer* layer) { } } +/** + * original name: Nas_CloseNoteTrack + */ void AudioSeq_SeqLayerFree(SequenceChannel* channel, s32 layerIndex) { SequenceLayer* layer = channel->layers[layerIndex]; @@ -373,6 +396,9 @@ void AudioSeq_SeqLayerFree(SequenceChannel* channel, s32 layerIndex) { } } +/** + * original name: Nas_ReleaseSubTrack + */ void AudioSeq_SequenceChannelDisable(SequenceChannel* channel) { s32 i; @@ -385,6 +411,9 @@ void AudioSeq_SequenceChannelDisable(SequenceChannel* channel) { channel->finished = true; } +/** + * original name: Nas_AllocSub + */ void AudioSeq_SequencePlayerSetupChannels(SequencePlayer* seqPlayer, u16 channelBits) { SequenceChannel* channel; s32 i; @@ -400,6 +429,9 @@ void AudioSeq_SequencePlayerSetupChannels(SequencePlayer* seqPlayer, u16 channel } } +/** + * original name: Nas_DeAllocSub + */ void AudioSeq_SequencePlayerDisableChannels(SequencePlayer* seqPlayer, u16 channelBitsUnused) { SequenceChannel* channel; s32 i; @@ -412,6 +444,9 @@ void AudioSeq_SequencePlayerDisableChannels(SequencePlayer* seqPlayer, u16 chann } } +/** + * original name: Nas_OpenSub + */ void AudioSeq_SequenceChannelEnable(SequencePlayer* seqPlayer, u8 channelIndex, void* script) { SequenceChannel* channel = seqPlayer->channels[channelIndex]; s32 i; @@ -429,11 +464,17 @@ void AudioSeq_SequenceChannelEnable(SequencePlayer* seqPlayer, u8 channelIndex, } } +/** + * original name: Nas_ReleaseGroup_Force + */ void AudioSeq_SequencePlayerDisableAsFinished(SequencePlayer* seqPlayer) { seqPlayer->finished = true; AudioSeq_SequencePlayerDisable(seqPlayer); } +/** + * original name: Nas_ReleaseGroup + */ void AudioSeq_SequencePlayerDisable(SequencePlayer* seqPlayer) { s32 finished = 0; @@ -472,6 +513,9 @@ void AudioSeq_SequencePlayerDisable(SequencePlayer* seqPlayer) { } } +/** + * original name: Nas_AddList + */ void AudioSeq_AudioListPushBack(AudioListItem* list, AudioListItem* item) { if (item->prev == NULL) { list->prev->next = item; @@ -483,6 +527,9 @@ void AudioSeq_AudioListPushBack(AudioListItem* list, AudioListItem* item) { } } +/** + * original name: Nas_GetList + */ void* AudioSeq_AudioListPopBack(AudioListItem* list) { AudioListItem* item = list->prev; @@ -498,6 +545,9 @@ void* AudioSeq_AudioListPopBack(AudioListItem* list) { return item->u.value; } +/** + * original name: Nas_InitNoteList + */ void AudioSeq_InitLayerFreelist(void) { s32 i; @@ -513,10 +563,16 @@ void AudioSeq_InitLayerFreelist(void) { } } +/** + * original name: Nas_ReadByteData + */ u8 AudioSeq_ScriptReadU8(SeqScriptState* state) { return *(state->pc++); } +/** + * original name: Nas_ReadWordData + */ s16 AudioSeq_ScriptReadS16(SeqScriptState* state) { s16 ret = *(state->pc++) << 8; @@ -524,6 +580,9 @@ s16 AudioSeq_ScriptReadS16(SeqScriptState* state) { return ret; } +/** + * original name: Nas_ReadLengthData + */ u16 AudioSeq_ScriptReadCompressedU16(SeqScriptState* state) { u16 ret = *(state->pc++); @@ -534,6 +593,9 @@ u16 AudioSeq_ScriptReadCompressedU16(SeqScriptState* state) { return ret; } +/** + * original name: Nas_NoteSeq + */ void AudioSeq_SeqLayerProcessScript(SequenceLayer* layer) { s32 cmd; @@ -575,6 +637,9 @@ void AudioSeq_SeqLayerProcessScript(SequenceLayer* layer) { } } +/** + * original name: __Stop_Note + */ void AudioSeq_SeqLayerProcessScriptStep1(SequenceLayer* layer) { if (!layer->continuousNotes) { Audio_SeqLayerNoteDecay(layer); @@ -589,6 +654,9 @@ void AudioSeq_SeqLayerProcessScriptStep1(SequenceLayer* layer) { layer->notePropertiesNeedInit = true; } +/** + * original name: __SetChannel + */ s32 AudioSeq_SeqLayerProcessScriptStep5(SequenceLayer* layer, s32 sameTunedSample) { Note* note; @@ -627,6 +695,9 @@ s32 AudioSeq_SeqLayerProcessScriptStep5(SequenceLayer* layer, s32 sameTunedSampl return 0; } +/** + * original name: __Command_Seq + */ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) { SequenceChannel* channel = layer->channel; SeqScriptState* state = &layer->scriptState; @@ -645,7 +716,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) { } // Control Flow Commands - if (cmd >= 0xF2) { + if (cmd >= ASEQ_OP_CONTROL_FLOW_FIRST) { cmdArg16 = AudioSeq_GetScriptControlFlowArgument(state, cmd); if (AudioSeq_HandleScriptFlowControl(seqPlayer, state, cmd, cmdArg16) == 0) { @@ -656,29 +727,29 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) { } switch (cmd) { - case 0xC1: // layer_setshortnotevelocity - case 0xCA: // layer_setpan + case ASEQ_OP_LAYER_SHORTVEL: // layer_setshortnotevelocity + case ASEQ_OP_LAYER_NOTEPAN: // layer_setpan cmdArg8 = *(state->pc++); - if (cmd == 0xC1) { + if (cmd == ASEQ_OP_LAYER_SHORTVEL) { layer->velocitySquare = SQ(cmdArg8) / SQ(127.0f); } else { layer->pan = cmdArg8; } break; - case 0xC9: // layer_setshortnotegatetime - case 0xC2: // layer_transpose; set transposition in semitones + case ASEQ_OP_LAYER_SHORTGATE: // layer_setshortnotegatetime + case ASEQ_OP_LAYER_TRANSPOSE: // layer_transpose; set transposition in semitones cmdArg8 = *(state->pc++); - if (cmd == 0xC9) { + if (cmd == ASEQ_OP_LAYER_SHORTGATE) { layer->gateTime = cmdArg8; } else { layer->transposition = cmdArg8; } break; - case 0xC4: // layer_continuousnoteson - case 0xC5: // layer_continuousnotesoff - if (cmd == 0xC4) { + case ASEQ_OP_LAYER_LEGATO: // layer_continuousnoteson + case ASEQ_OP_LAYER_NOLEGATO: // layer_continuousnotesoff + if (cmd == ASEQ_OP_LAYER_LEGATO) { layer->continuousNotes = true; } else { layer->continuousNotes = false; @@ -687,12 +758,12 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) { Audio_SeqLayerNoteDecay(layer); break; - case 0xC3: // layer_setshortnotedefaultdelay + case ASEQ_OP_LAYER_SHORTDELAY: // layer_setshortnotedefaultdelay cmdArg16 = AudioSeq_ScriptReadCompressedU16(state); layer->shortNoteDefaultDelay = cmdArg16; break; - case 0xC6: // layer_setinstr + case ASEQ_OP_LAYER_INSTR: // layer_setinstr cmd = AudioSeq_ScriptReadU8(state); if (cmd >= 0x7E) { if (cmd == 0x7E) { @@ -719,7 +790,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) { } break; - case 0xC7: // layer_portamento + case ASEQ_OP_LAYER_PORTAMENTO: // layer_portamento layer->portamento.mode = AudioSeq_ScriptReadU8(state); cmd = AudioSeq_ScriptReadU8(state); @@ -743,39 +814,39 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) { layer->portamentoTime = cmdArg16; break; - case 0xC8: // layer_disableportamento + case ASEQ_OP_LAYER_NOPORTAMENTO: // layer_disableportamento layer->portamento.mode = PORTAMENTO_MODE_OFF; break; - case 0xCB: + case ASEQ_OP_LAYER_ENV: cmdArg16 = AudioSeq_ScriptReadS16(state); layer->adsr.envelope = (EnvelopePoint*)(seqPlayer->seqData + cmdArg16); FALLTHROUGH; - case 0xCF: + case ASEQ_OP_LAYER_RELEASERATE: layer->adsr.decayIndex = AudioSeq_ScriptReadU8(state); break; - case 0xCC: + case ASEQ_OP_LAYER_NODRUMPAN: layer->ignoreDrumPan = true; break; - case 0xCD: + case ASEQ_OP_LAYER_STEREO: layer->stereo.asByte = AudioSeq_ScriptReadU8(state); break; - case 0xCE: + case ASEQ_OP_LAYER_BENDFINE: cmdArg8 = AudioSeq_ScriptReadU8(state); layer->bend = gBendPitchTwoSemitonesFrequencies[(u8)(cmdArg8 + 0x80)]; break; default: switch (cmd & 0xF0) { - case 0xD0: // layer_setshortnotevelocityfromtable + case ASEQ_OP_LAYER_LDSHORTVEL: // layer_setshortnotevelocityfromtable velocity = seqPlayer->shortNoteVelocityTable[cmd & 0xF]; layer->velocitySquare = SQ(velocity) / SQ(127.0f); break; - case 0xE0: // layer_setshortnotegatetimefromtable + case ASEQ_OP_LAYER_LDSHORTGATE: // layer_setshortnotegatetimefromtable layer->gateTime = seqPlayer->shortNoteGateTimeTable[cmd & 0xF]; break; } @@ -783,6 +854,9 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) { } } +/** + * original name: __SetVoice + */ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) { s32 sameTunedSample = true; s32 instOrWave; @@ -991,6 +1065,9 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) { return sameTunedSample; } +/** + * original name: __SetNote + */ s32 AudioSeq_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd) { SeqScriptState* state = &layer->scriptState; u16 delay; @@ -1000,7 +1077,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd) { s32 intDelta; f32 floatDelta; - if (cmd == 0xC0) { + if (cmd == ASEQ_OP_LAYER_LDELAY) { layer->delay = AudioSeq_ScriptReadCompressedU16(state); layer->muted = true; layer->bit1 = false; @@ -1011,21 +1088,21 @@ s32 AudioSeq_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd) { if (channel->largeNotes == true) { switch (cmd & 0xC0) { - case 0x00: + case ASEQ_OP_LAYER_NOTEDVG: delay = AudioSeq_ScriptReadCompressedU16(state); velocity = *(state->pc++); layer->gateTime = *(state->pc++); layer->lastDelay = delay; break; - case 0x40: + case ASEQ_OP_LAYER_NOTEDV: delay = AudioSeq_ScriptReadCompressedU16(state); velocity = *(state->pc++); layer->gateTime = 0; layer->lastDelay = delay; break; - case 0x80: + case ASEQ_OP_LAYER_NOTEVG: delay = layer->lastDelay; velocity = *(state->pc++); layer->gateTime = *(state->pc++); @@ -1039,16 +1116,16 @@ s32 AudioSeq_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd) { cmd -= (cmd & 0xC0); } else { switch (cmd & 0xC0) { - case 0x00: + case ASEQ_OP_LAYER_NOTEDVG: delay = AudioSeq_ScriptReadCompressedU16(state); layer->lastDelay = delay; break; - case 0x40: + case ASEQ_OP_LAYER_NOTEDV: delay = layer->shortNoteDefaultDelay; break; - case 0x80: + case ASEQ_OP_LAYER_NOTEVG: delay = layer->lastDelay; break; } @@ -1104,6 +1181,9 @@ s32 AudioSeq_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd) { return cmd; } +/** + * original name: Nas_PriorityChanger + */ void AudioSeq_SetChannelPriorities(SequenceChannel* channel, u8 priority) { if ((priority & 0xF) != 0) { channel->notePriority = priority & 0xF; @@ -1115,6 +1195,9 @@ void AudioSeq_SetChannelPriorities(SequenceChannel* channel, u8 priority) { } } +/** + * original name: Nas_ProgramChanger + */ u8 AudioSeq_GetInstrument(SequenceChannel* channel, u8 instId, Instrument** instOut, AdsrSettings* adsr) { Instrument* inst = Audio_GetInstrumentInner(channel->fontId, instId); @@ -1134,6 +1217,9 @@ u8 AudioSeq_GetInstrument(SequenceChannel* channel, u8 instId, Instrument** inst return instId; } +/** + * original name: Nas_SubVoiceSet + */ void AudioSeq_SetInstrument(SequenceChannel* channel, u8 instId) { if (instId >= 0x80) { // Synthetic Waves @@ -1159,10 +1245,16 @@ void AudioSeq_SetInstrument(SequenceChannel* channel, u8 instId) { channel->hasInstrument = true; } +/** + * original name: Nas_SubVolumeSet + */ void AudioSeq_SequenceChannelSetVolume(SequenceChannel* channel, u8 volume) { channel->volume = (s32)volume / 127.0f; } +/** + * original name: Nas_SubSeq + */ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { s32 i; u8* data; @@ -1210,7 +1302,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { } // Control Flow Commands - if (cmd >= 0xF2) { + if (cmd >= ASEQ_OP_CONTROL_FLOW_FIRST) { delay = AudioSeq_HandleScriptFlowControl(seqPlayer, scriptState, cmd, cmdArgs[0]); if (delay != 0) { @@ -1225,26 +1317,26 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { } switch (cmd) { - case 0xEA: + case ASEQ_OP_CHAN_STOP: channel->stopScript = true; goto exit_loop; - case 0xF1: + case ASEQ_OP_CHAN_ALLOCNOTELIST: Audio_NotePoolClear(&channel->notePool); cmd = (u8)cmdArgs[0]; Audio_NotePoolFill(&channel->notePool, cmd); break; - case 0xF0: + case ASEQ_OP_CHAN_FREENOTELIST: Audio_NotePoolClear(&channel->notePool); break; - case 0xC2: + case ASEQ_OP_CHAN_DYNTBL: cmdArgU16 = (u16)cmdArgs[0]; channel->dynTable = (void*)&seqPlayer->seqData[cmdArgU16]; break; - case 0xC5: + case ASEQ_OP_CHAN_DYNTBLLOOKUP: if (scriptState->value != -1) { data = (*channel->dynTable)[scriptState->value]; cmdArgU16 = (u16)((data[0] << 8) + data[1]); @@ -1253,7 +1345,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { } break; - case 0xEB: + case ASEQ_OP_CHAN_FONTINSTR: cmd = (u8)cmdArgs[0]; if (seqPlayer->defaultFont != 0xFF) { @@ -1268,93 +1360,93 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { cmdArgs[0] = cmdArgs[1]; FALLTHROUGH; - case 0xC1: + case ASEQ_OP_CHAN_INSTR: cmd = (u8)cmdArgs[0]; AudioSeq_SetInstrument(channel, cmd); break; - case 0xC3: + case ASEQ_OP_CHAN_SHORT: channel->largeNotes = false; break; - case 0xC4: + case ASEQ_OP_CHAN_NOSHORT: channel->largeNotes = true; break; - case 0xDF: + case ASEQ_OP_CHAN_VOL: cmd = (u8)cmdArgs[0]; AudioSeq_SequenceChannelSetVolume(channel, cmd); channel->changes.s.volume = true; break; - case 0xE0: + case ASEQ_OP_CHAN_VOLEXP: cmd = (u8)cmdArgs[0]; channel->volumeScale = (s32)cmd / 128.0f; channel->changes.s.volume = true; break; - case 0xDE: + case ASEQ_OP_CHAN_FREQSCALE: cmdArgU16 = (u16)cmdArgs[0]; channel->freqScale = (s32)cmdArgU16 / 32768.0f; channel->changes.s.freqScale = true; break; - case 0xD3: + case ASEQ_OP_CHAN_BEND: cmd = (u8)cmdArgs[0]; cmd += 0x80; channel->freqScale = gBendPitchOneOctaveFrequencies[cmd]; channel->changes.s.freqScale = true; break; - case 0xEE: + case ASEQ_OP_CHAN_BENDFINE: cmd = (u8)cmdArgs[0]; cmd += 0x80; channel->freqScale = gBendPitchTwoSemitonesFrequencies[cmd]; channel->changes.s.freqScale = true; break; - case 0xDD: + case ASEQ_OP_CHAN_PAN: cmd = (u8)cmdArgs[0]; channel->newPan = cmd; channel->changes.s.pan = true; break; - case 0xDC: + case ASEQ_OP_CHAN_PANWEIGHT: cmd = (u8)cmdArgs[0]; channel->panChannelWeight = cmd; channel->changes.s.pan = true; break; - case 0xDB: + case ASEQ_OP_CHAN_TRANSPOSE: cmdArgS8 = (s8)cmdArgs[0]; channel->transposition = cmdArgS8; break; - case 0xDA: + case ASEQ_OP_CHAN_ENV: cmdArgU16 = (u16)cmdArgs[0]; channel->adsr.envelope = (EnvelopePoint*)&seqPlayer->seqData[cmdArgU16]; break; - case 0xD9: + case ASEQ_OP_CHAN_RELEASERATE: cmd = (u8)cmdArgs[0]; channel->adsr.decayIndex = cmd; break; - case 0xD8: + case ASEQ_OP_CHAN_VIBDEPTH: cmd = (u8)cmdArgs[0]; channel->vibratoDepthTarget = cmd * 8; channel->vibratoDepthStart = 0; channel->vibratoDepthChangeDelay = 0; break; - case 0xD7: + case ASEQ_OP_CHAN_VIBFREQ: cmd = (u8)cmdArgs[0]; channel->vibratoRateChangeDelay = 0; channel->vibratoRateTarget = cmd * 32; channel->vibratoRateStart = cmd * 32; break; - case 0xE2: + case ASEQ_OP_CHAN_VIBDEPTHGRAD: cmd = (u8)cmdArgs[0]; channel->vibratoDepthStart = cmd * 8; cmd = (u8)cmdArgs[1]; @@ -1363,7 +1455,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { channel->vibratoDepthChangeDelay = cmd * 16; break; - case 0xE1: + case ASEQ_OP_CHAN_VIBFREQGRAD: cmd = (u8)cmdArgs[0]; channel->vibratoRateStart = cmd * 32; cmd = (u8)cmdArgs[1]; @@ -1372,17 +1464,17 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { channel->vibratoRateChangeDelay = cmd * 16; break; - case 0xE3: + case ASEQ_OP_CHAN_VIBDELAY: cmd = (u8)cmdArgs[0]; channel->vibratoDelay = cmd * 16; break; - case 0xD4: + case ASEQ_OP_CHAN_REVERB: cmd = (u8)cmdArgs[0]; channel->targetReverbVol = cmd; break; - case 0xC6: + case ASEQ_OP_CHAN_FONT: cmd = (u8)cmdArgs[0]; if (seqPlayer->defaultFont != 0xFF) { @@ -1396,56 +1488,56 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { } break; - case 0xC7: + case ASEQ_OP_CHAN_STSEQ: cmd = (u8)cmdArgs[0]; cmdArgU16 = (u16)cmdArgs[1]; seqData = &seqPlayer->seqData[cmdArgU16]; seqData[0] = (u8)scriptState->value + cmd; break; - case 0xC8: - case 0xCC: - case 0xC9: + case ASEQ_OP_CHAN_SUB: + case ASEQ_OP_CHAN_LDI: + case ASEQ_OP_CHAN_AND: cmdArgS8 = (s8)cmdArgs[0]; - if (cmd == 0xC8) { + if (cmd == ASEQ_OP_CHAN_SUB) { scriptState->value -= cmdArgS8; - } else if (cmd == 0xCC) { + } else if (cmd == ASEQ_OP_CHAN_LDI) { scriptState->value = cmdArgS8; } else { scriptState->value &= cmdArgS8; } break; - case 0xCD: + case ASEQ_OP_CHAN_STOPCHAN: cmd = (u8)cmdArgs[0]; AudioSeq_SequenceChannelDisable(seqPlayer->channels[cmd]); break; - case 0xCA: + case ASEQ_OP_CHAN_MUTEBHV: cmd = (u8)cmdArgs[0]; channel->muteBehavior = cmd; channel->changes.s.volume = true; break; - case 0xCB: + case ASEQ_OP_CHAN_LDSEQ: cmdArgU16 = (u16)cmdArgs[0]; scriptState->value = *(seqPlayer->seqData + (u32)(cmdArgU16 + scriptState->value)); break; - case 0xCE: + case ASEQ_OP_CHAN_LDPTR: cmdArgU16 = (u16)cmdArgs[0]; channel->unk_22 = cmdArgU16; break; - case 0xCF: + case ASEQ_OP_CHAN_STPTRTOSEQ: cmdArgU16 = (u16)cmdArgs[0]; seqData = &seqPlayer->seqData[cmdArgU16]; seqData[0] = (channel->unk_22 >> 8) & 0xFF; seqData[1] = channel->unk_22 & 0xFF; break; - case 0xD0: + case ASEQ_OP_CHAN_EFFECTS: cmd = (u8)cmdArgs[0]; if (cmd & 0x80) { channel->stereoHeadsetEffects = true; @@ -1455,22 +1547,22 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { channel->stereo.asByte = cmd & 0x7F; break; - case 0xD1: + case ASEQ_OP_CHAN_NOTEALLOC: cmd = (u8)cmdArgs[0]; channel->noteAllocPolicy = cmd; break; - case 0xD2: + case ASEQ_OP_CHAN_SUSTAIN: cmd = (u8)cmdArgs[0]; channel->adsr.sustain = cmd; break; - case 0xE5: + case ASEQ_OP_CHAN_REVERBIDX: cmd = (u8)cmdArgs[0]; channel->reverbIndex = cmd; break; - case 0xE4: + case ASEQ_OP_CHAN_DYNCALL: if (scriptState->value != -1) { data = (*channel->dynTable)[scriptState->value]; //! @bug: Missing a stack depth check here @@ -1480,12 +1572,12 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { } break; - case 0xE6: + case ASEQ_OP_CHAN_SAMPLEBOOK: cmd = (u8)cmdArgs[0]; channel->bookOffset = cmd; break; - case 0xE7: + case ASEQ_OP_CHAN_LDPARAMS: cmdArgU16 = (u16)cmdArgs[0]; data = &seqPlayer->seqData[cmdArgU16]; channel->muteBehavior = *data++; @@ -1500,7 +1592,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { channel->changes.s.pan = true; break; - case 0xE8: + case ASEQ_OP_CHAN_PARAMS: channel->muteBehavior = cmdArgs[0]; channel->noteAllocPolicy = cmdArgs[1]; cmd = (u8)cmdArgs[2]; @@ -1514,7 +1606,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { channel->changes.s.pan = true; break; - case 0xEC: + case ASEQ_OP_CHAN_VIBRESET: channel->vibratoDepthTarget = 0; channel->vibratoDepthStart = 0; channel->vibratoDepthChangeDelay = 0; @@ -1532,26 +1624,26 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { channel->freqScale = 1.0f; break; - case 0xE9: + case ASEQ_OP_CHAN_NOTEPRI: AudioSeq_SetChannelPriorities(channel, (u8)cmdArgs[0]); break; - case 0xED: + case ASEQ_OP_CHAN_GAIN: cmd = (u8)cmdArgs[0]; channel->gain = cmd; break; - case 0xB0: + case ASEQ_OP_CHAN_LDFILTER: cmdArgU16 = (u16)cmdArgs[0]; data = seqPlayer->seqData + cmdArgU16; channel->filter = (s16*)data; break; - case 0xB1: + case ASEQ_OP_CHAN_FREEFILTER: channel->filter = NULL; break; - case 0xB3: + case ASEQ_OP_CHAN_FILTER: cmd = cmdArgs[0]; if (channel->filter != NULL) { @@ -1561,34 +1653,34 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { } break; - case 0xB2: + case ASEQ_OP_CHAN_LDSEQTOPTR: cmdArgU16 = (u16)cmdArgs[0]; channel->unk_22 = *(u16*)(seqPlayer->seqData + (u32)(cmdArgU16 + scriptState->value * 2)); break; - case 0xB4: + case ASEQ_OP_CHAN_PTRTODYNTBL: channel->dynTable = (void*)&seqPlayer->seqData[channel->unk_22]; break; - case 0xB5: + case ASEQ_OP_CHAN_DYNTBLTOPTR: channel->unk_22 = ((u16*)(channel->dynTable))[scriptState->value]; break; - case 0xB6: + case ASEQ_OP_CHAN_DYNTBLV: scriptState->value = (*channel->dynTable)[0][scriptState->value]; break; - case 0xB7: + case ASEQ_OP_CHAN_RANDTOPTR: channel->unk_22 = (cmdArgs[0] == 0) ? gAudioCtx.audioRandom & 0xFFFF : gAudioCtx.audioRandom % cmdArgs[0]; break; - case 0xB8: + case ASEQ_OP_CHAN_RAND: scriptState->value = (cmdArgs[0] == 0) ? gAudioCtx.audioRandom & 0xFFFF : gAudioCtx.audioRandom % cmdArgs[0]; break; - case 0xBD: + case ASEQ_OP_CHAN_RANDPTR: temp2 = AudioThread_NextRandom(); channel->unk_22 = (cmdArgs[0] == 0) ? (temp2 & 0xFFFF) : (temp2 % cmdArgs[0]); channel->unk_22 += cmdArgs[1]; @@ -1597,20 +1689,20 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { channel->unk_22 = (temp2 << 8) | param; break; - case 0xB9: + case ASEQ_OP_CHAN_RANDVEL: channel->velocityRandomVariance = cmdArgs[0]; break; - case 0xBA: + case ASEQ_OP_CHAN_RANDGATE: channel->gateTimeRandomVariance = cmdArgs[0]; break; - case 0xBB: + case ASEQ_OP_CHAN_COMBFILTER: channel->combFilterSize = cmdArgs[0]; channel->combFilterGain = cmdArgs[1]; break; - case 0xBC: + case ASEQ_OP_CHAN_PTRADD: channel->unk_22 += cmdArgs[0]; break; } @@ -1620,12 +1712,12 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { if (cmd >= 0x70) { lowBits = cmd & 0x7; - if ((cmd & 0xF8) != 0x70 && lowBits >= 4) { + if ((cmd & 0xF8) != ASEQ_OP_CHAN_STIO && lowBits >= 4) { lowBits = 0; } switch (cmd & 0xF8) { - case 0x80: + case ASEQ_OP_CHAN_TESTLAYER: if (channel->layers[lowBits] != NULL) { scriptState->value = channel->layers[lowBits]->finished; } else { @@ -1633,18 +1725,18 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { } break; - case 0x88: + case ASEQ_OP_CHAN_LDLAYER: cmdArgU16 = AudioSeq_ScriptReadS16(scriptState); if (!AudioSeq_SeqChannelSetLayer(channel, lowBits)) { channel->layers[lowBits]->scriptState.pc = &seqPlayer->seqData[cmdArgU16]; } break; - case 0x90: + case ASEQ_OP_CHAN_DELLAYER: AudioSeq_SeqLayerFree(channel, lowBits); break; - case 0x98: + case ASEQ_OP_CHAN_DYNLDLAYER: if (scriptState->value != -1 && AudioSeq_SeqChannelSetLayer(channel, lowBits) != -1) { data = (*channel->dynTable)[scriptState->value]; cmdArgU16 = (data[0] << 8) + data[1]; @@ -1652,11 +1744,11 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { } break; - case 0x70: + case ASEQ_OP_CHAN_STIO: channel->seqScriptIO[lowBits] = scriptState->value; break; - case 0x78: + case ASEQ_OP_CHAN_RLDLAYER: temp1 = AudioSeq_ScriptReadS16(scriptState); if (!AudioSeq_SeqChannelSetLayer(channel, lowBits)) { channel->layers[lowBits]->scriptState.pc = &scriptState->pc[temp1]; @@ -1669,11 +1761,11 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { lowBits = cmd & 0xF; switch (cmd & 0xF0) { - case 0x00: + case ASEQ_OP_CHAN_CDELAY: channel->delay = lowBits; goto exit_loop; - case 0x10: + case ASEQ_OP_CHAN_LDSAMPLE: if (lowBits < 8) { channel->seqScriptIO[lowBits] = SEQ_IO_VAL_NONE; if (AudioLoad_SlowLoadSample(channel->fontId, scriptState->value, &channel->seqScriptIO[lowBits]) == @@ -1686,28 +1778,28 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { } break; - case 0x60: + case ASEQ_OP_CHAN_LDIO: scriptState->value = channel->seqScriptIO[lowBits]; if (lowBits < 2) { channel->seqScriptIO[lowBits] = SEQ_IO_VAL_NONE; } break; - case 0x50: + case ASEQ_OP_CHAN_SUBIO: scriptState->value -= channel->seqScriptIO[lowBits]; break; - case 0x20: + case ASEQ_OP_CHAN_LDCHAN: cmdArgU16 = AudioSeq_ScriptReadS16(scriptState); AudioSeq_SequenceChannelEnable(seqPlayer, lowBits, &seqPlayer->seqData[cmdArgU16]); break; - case 0x30: + case ASEQ_OP_CHAN_STCIO: cmd = AudioSeq_ScriptReadU8(scriptState); seqPlayer->channels[lowBits]->seqScriptIO[cmd] = scriptState->value; break; - case 0x40: + case ASEQ_OP_CHAN_LDCIO: cmd = AudioSeq_ScriptReadU8(scriptState); scriptState->value = seqPlayer->channels[lowBits]->seqScriptIO[cmd]; break; @@ -1722,6 +1814,9 @@ exit_loop: } } +/** + * original name: Nas_GroupSeq + */ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { u8 cmd; u8 cmdLowBits; @@ -1780,7 +1875,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { cmd = AudioSeq_ScriptReadU8(seqScript); // 0xF2 and above are "flow control" commands, including termination. - if (cmd >= 0xF2) { + if (cmd >= ASEQ_OP_CONTROL_FLOW_FIRST) { delay = AudioSeq_HandleScriptFlowControl( seqPlayer, seqScript, cmd, AudioSeq_GetScriptControlFlowArgument(&seqPlayer->scriptState, cmd)); @@ -1797,7 +1892,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { if (cmd >= 0xC0) { switch (cmd) { - case 0xF1: + case ASEQ_OP_SEQ_ALLOCNOTELIST: Audio_NotePoolClear(&seqPlayer->notePool); cmd = AudioSeq_ScriptReadU8(seqScript); Audio_NotePoolFill(&seqPlayer->notePool, cmd); @@ -1813,18 +1908,18 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { if (dummy) {} break; - case 0xF0: + case ASEQ_OP_SEQ_FREENOTELIST: Audio_NotePoolClear(&seqPlayer->notePool); break; - case 0xDF: + case ASEQ_OP_SEQ_TRANSPOSE: seqPlayer->transposition = 0; FALLTHROUGH; - case 0xDE: + case ASEQ_OP_SEQ_RTRANSPOSE: seqPlayer->transposition += (s8)AudioSeq_ScriptReadU8(seqScript); break; - case 0xDD: + case ASEQ_OP_SEQ_TEMPO: seqPlayer->tempo = AudioSeq_ScriptReadU8(seqScript) * SEQTICKS_PER_BEAT; if (seqPlayer->tempo > gAudioCtx.maxTempo) { seqPlayer->tempo = (u16)gAudioCtx.maxTempo; @@ -1835,11 +1930,11 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { } break; - case 0xDC: + case ASEQ_OP_SEQ_TEMPOCHG: seqPlayer->tempoChange = (s8)AudioSeq_ScriptReadU8(seqScript) * SEQTICKS_PER_BEAT; break; - case 0xDA: + case ASEQ_OP_SEQ_VOLMODE: cmd = AudioSeq_ScriptReadU8(seqScript); temp = AudioSeq_ScriptReadS16(seqScript); switch (cmd) { @@ -1859,7 +1954,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { } break; - case 0xDB: + case ASEQ_OP_SEQ_VOL: value = AudioSeq_ScriptReadU8(seqScript); switch (seqPlayer->state) { case 1: @@ -1881,47 +1976,47 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { } break; - case 0xD9: + case ASEQ_OP_SEQ_VOLSCALE: seqPlayer->fadeVolumeScale = (s8)AudioSeq_ScriptReadU8(seqScript) / 127.0f; break; - case 0xD7: + case ASEQ_OP_SEQ_INITCHAN: temp = AudioSeq_ScriptReadS16(seqScript); AudioSeq_SequencePlayerSetupChannels(seqPlayer, temp); break; - case 0xD6: + case ASEQ_OP_SEQ_FREECHAN: AudioSeq_ScriptReadS16(seqScript); break; - case 0xD5: + case ASEQ_OP_SEQ_MUTESCALE: seqPlayer->muteVolumeScale = (s8)AudioSeq_ScriptReadU8(seqScript) / 127.0f; break; - case 0xD4: + case ASEQ_OP_SEQ_MUTE: seqPlayer->muted = true; break; - case 0xD3: + case ASEQ_OP_SEQ_MUTEBHV: seqPlayer->muteBehavior = AudioSeq_ScriptReadU8(seqScript); break; - case 0xD1: - case 0xD2: + case ASEQ_OP_SEQ_LDSHORTGATEARR: + case ASEQ_OP_SEQ_LDSHORTVELARR: temp = AudioSeq_ScriptReadS16(seqScript); data3 = &seqPlayer->seqData[temp]; - if (cmd == 0xD2) { + if (cmd == ASEQ_OP_SEQ_LDSHORTVELARR) { seqPlayer->shortNoteVelocityTable = data3; } else { seqPlayer->shortNoteGateTimeTable = data3; } break; - case 0xD0: + case ASEQ_OP_SEQ_NOTEALLOC: seqPlayer->noteAllocPolicy = AudioSeq_ScriptReadU8(seqScript); break; - case 0xCE: + case ASEQ_OP_SEQ_RAND: cmd = AudioSeq_ScriptReadU8(seqScript); if (cmd == 0) { seqScript->value = (gAudioCtx.audioRandom >> 2) & 0xFF; @@ -1930,7 +2025,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { } break; - case 0xCD: + case ASEQ_OP_SEQ_DYNCALL: temp = AudioSeq_ScriptReadS16(seqScript); if ((seqScript->value != -1) && (seqScript->depth != 3)) { data = seqPlayer->seqData + (u32)(temp + (seqScript->value << 1)); @@ -1942,39 +2037,39 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { } break; - case 0xCC: + case ASEQ_OP_SEQ_LDI: seqScript->value = AudioSeq_ScriptReadU8(seqScript); break; - case 0xC9: + case ASEQ_OP_SEQ_AND: seqScript->value &= AudioSeq_ScriptReadU8(seqScript); break; - case 0xC8: + case ASEQ_OP_SEQ_SUB: seqScript->value -= AudioSeq_ScriptReadU8(seqScript); break; - case 0xC7: + case ASEQ_OP_SEQ_STSEQ: cmd = AudioSeq_ScriptReadU8(seqScript); temp = AudioSeq_ScriptReadS16(seqScript); data2 = &seqPlayer->seqData[temp]; *data2 = (u8)seqScript->value + cmd; break; - case 0xC6: + case ASEQ_OP_SEQ_STOP: seqPlayer->stopScript = true; return; - case 0xC5: + case ASEQ_OP_SEQ_SCRIPTCTR: seqPlayer->scriptCounter = (u16)AudioSeq_ScriptReadS16(seqScript); break; - case 0xEF: + case ASEQ_OP_SEQ_EF: AudioSeq_ScriptReadS16(seqScript); AudioSeq_ScriptReadU8(seqScript); break; - case 0xC4: + case ASEQ_OP_SEQ_RUNSEQ: cmd = AudioSeq_ScriptReadU8(seqScript); if (cmd == 0xFF) { cmd = seqPlayer->playerIdx; @@ -1992,47 +2087,47 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { cmdLowBits = cmd & 0x0F; switch (cmd & 0xF0) { - case 0x00: + case ASEQ_OP_SEQ_TESTCHAN: seqScript->value = seqPlayer->channels[cmdLowBits]->enabled ^ 1; break; - case 0x50: + case ASEQ_OP_SEQ_SUBIO: seqScript->value -= seqPlayer->seqScriptIO[cmdLowBits]; break; - case 0x70: + case ASEQ_OP_SEQ_STIO: seqPlayer->seqScriptIO[cmdLowBits] = seqScript->value; break; - case 0x80: + case ASEQ_OP_SEQ_LDIO: seqScript->value = seqPlayer->seqScriptIO[cmdLowBits]; if (cmdLowBits < 2) { seqPlayer->seqScriptIO[cmdLowBits] = SEQ_IO_VAL_NONE; } break; - case 0x40: + case ASEQ_OP_SEQ_STOPCHAN: AudioSeq_SequenceChannelDisable(seqPlayer->channels[cmdLowBits]); break; - case 0x90: + case ASEQ_OP_SEQ_LDCHAN: temp = AudioSeq_ScriptReadS16(seqScript); AudioSeq_SequenceChannelEnable(seqPlayer, cmdLowBits, (void*)&seqPlayer->seqData[temp]); break; - case 0xA0: + case ASEQ_OP_SEQ_RLDCHAN: tempS = AudioSeq_ScriptReadS16(seqScript); AudioSeq_SequenceChannelEnable(seqPlayer, cmdLowBits, (void*)&seqScript->pc[tempS]); break; - case 0xB0: + case ASEQ_OP_SEQ_LDSEQ: cmd = AudioSeq_ScriptReadU8(seqScript); temp = AudioSeq_ScriptReadS16(seqScript); data2 = &seqPlayer->seqData[temp]; AudioLoad_SlowLoadSeq(cmd, data2, &seqPlayer->seqScriptIO[cmdLowBits]); break; - case 0x60: + case ASEQ_OP_SEQ_LDRES: cmd = AudioSeq_ScriptReadU8(seqScript); value = cmd; temp = AudioSeq_ScriptReadU8(seqScript); @@ -2049,6 +2144,9 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { } } +/** + * original name: Nas_MySeqMain + */ void AudioSeq_ProcessSequences(s32 arg0) { SequencePlayer* seqPlayer; u32 i; @@ -2066,6 +2164,9 @@ void AudioSeq_ProcessSequences(s32 arg0) { Audio_ProcessNotes(); } +/** + * original name: Nas_SeqSkip + */ void AudioSeq_SkipForwardSequence(SequencePlayer* seqPlayer) { while (seqPlayer->skipTicks > 0) { AudioSeq_SequencePlayerProcessSequence(seqPlayer); @@ -2074,6 +2175,9 @@ void AudioSeq_SkipForwardSequence(SequencePlayer* seqPlayer) { } } +/** + * original name: Nas_InitMySeq + */ void AudioSeq_ResetSequencePlayer(SequencePlayer* seqPlayer) { s32 i; @@ -2101,6 +2205,9 @@ void AudioSeq_ResetSequencePlayer(SequencePlayer* seqPlayer) { } } +/** + * original name: Nas_AssignSubTrack + */ void AudioSeq_InitSequencePlayerChannels(s32 playerIdx) { SequenceChannel* channel; SequencePlayer* seqPlayer = &gAudioCtx.seqPlayers[playerIdx]; @@ -2123,6 +2230,9 @@ void AudioSeq_InitSequencePlayerChannels(s32 playerIdx) { } } +/** + * original name: __InitGroup + */ void AudioSeq_InitSequencePlayer(SequencePlayer* seqPlayer) { s32 i; s32 j; @@ -2148,6 +2258,9 @@ void AudioSeq_InitSequencePlayer(SequencePlayer* seqPlayer) { AudioSeq_ResetSequencePlayer(seqPlayer); } +/** + * original name: Nas_InitPlayer + */ void AudioSeq_InitSequencePlayers(void) { s32 i; diff --git a/src/audio/lib/synthesis.c b/src/audio/internal/synthesis.c similarity index 99% rename from src/audio/lib/synthesis.c rename to src/audio/internal/synthesis.c index 85fb8d2610..c7c3eefb04 100644 --- a/src/audio/lib/synthesis.c +++ b/src/audio/internal/synthesis.c @@ -1,5 +1,6 @@ +#include "alignment.h" #include "ultra64.h" -#include "global.h" +#include "z64audio.h" // DMEM Addresses for the RSP #define DMEM_TEMP 0x3C0 @@ -647,7 +648,7 @@ Acmd* AudioSynth_DoOneAudioUpdate(s16* aiBuf, s32 aiBufLen, Acmd* cmd, s32 updat #if OOT_VERSION < NTSC_1_1 || !PLATFORM_N64 if ((reverb->leakRtl != 0) || (reverb->leakLtr != 0)) #else - if (((reverb->leakRtl != 0) || (reverb->leakLtr != 0)) && (gAudioCtx.soundMode != SOUNDMODE_MONO)) + if (((reverb->leakRtl != 0) || (reverb->leakLtr != 0)) && (gAudioCtx.soundOutputMode != SOUND_OUTPUT_MONO)) #endif { cmd = AudioSynth_LeakReverb(cmd, reverb); diff --git a/src/audio/lib/thread.c b/src/audio/internal/thread.c similarity index 95% rename from src/audio/lib/thread.c rename to src/audio/internal/thread.c index f47dbade7e..2e2d0630e1 100644 --- a/src/audio/lib/thread.c +++ b/src/audio/internal/thread.c @@ -1,5 +1,12 @@ -#include "global.h" +/** + * Original Filename: sub_sys.c + */ + +#include "array_count.h" +#include "audiothread_cmd.h" +#include "ultra64.h" #include "versions.h" +#include "z64audio.h" #define SAMPLES_TO_OVERPRODUCE 0x10 #define EXTRA_BUFFERED_AI_SAMPLES_TARGET 0x80 @@ -24,6 +31,8 @@ static AudioTask* sWaitingAudioTask = NULL; /** * This is Audio_Update for the audio thread + * + * original name: CreateAudioTask (note: function is heavily modified in Animal Crossing) */ AudioTask* AudioThread_UpdateImpl(void) { #if OOT_VERSION < PAL_1_0 || !PLATFORM_N64 @@ -197,6 +206,9 @@ AudioTask* AudioThread_UpdateImpl(void) { } } +/** + * original name: Nap_AudioSysProcess + */ void AudioThread_ProcessGlobalCmd(AudioCmd* cmd) { s32 i; s32 pad[3]; @@ -226,8 +238,8 @@ void AudioThread_ProcessGlobalCmd(AudioCmd* cmd) { } break; - case AUDIOCMD_OP_GLOBAL_SET_SOUND_MODE: - gAudioCtx.soundMode = cmd->asUInt; + case AUDIOCMD_OP_GLOBAL_SET_SOUND_OUTPUT_MODE: + gAudioCtx.soundOutputMode = cmd->asUInt; break; case AUDIOCMD_OP_GLOBAL_MUTE: @@ -322,6 +334,9 @@ void AudioThread_ProcessGlobalCmd(AudioCmd* cmd) { } } +/** + * original name: __Nas_GroupFadeOut + */ void AudioThread_SetFadeOutTimer(s32 seqPlayerIndex, s32 fadeTimer) { SequencePlayer* seqPlayer = &gAudioCtx.seqPlayers[seqPlayerIndex]; @@ -334,6 +349,9 @@ void AudioThread_SetFadeOutTimer(s32 seqPlayerIndex, s32 fadeTimer) { seqPlayer->fadeTimer = fadeTimer; } +/** + * original name: __Nas_GroupFadeIn + */ void AudioThread_SetFadeInTimer(s32 seqPlayerIndex, s32 fadeTimer) { SequencePlayer* seqPlayer; @@ -347,6 +365,9 @@ void AudioThread_SetFadeInTimer(s32 seqPlayerIndex, s32 fadeTimer) { } } +/** + * original name: Nap_AudioPortInit + */ void AudioThread_InitMesgQueuesImpl(void) { gAudioCtx.threadCmdWritePos = 0; gAudioCtx.threadCmdReadPos = 0; @@ -362,6 +383,9 @@ void AudioThread_InitMesgQueuesImpl(void) { osCreateMesgQueue(gAudioCtx.audioResetQueueP, gAudioCtx.audioResetMsgBuf, ARRAY_COUNT(gAudioCtx.audioResetMsgBuf)); } +/** + * original name: Nap_PortSet + */ void AudioThread_QueueCmd(u32 opArgs, void** data) { AudioCmd* cmd = &gAudioCtx.threadCmdBuf[gAudioCtx.threadCmdWritePos & 0xFF]; @@ -375,26 +399,41 @@ void AudioThread_QueueCmd(u32 opArgs, void** data) { } } +/** + * original name: Nap_SetF32 + */ void AudioThread_QueueCmdF32(u32 opArgs, f32 data) { AudioThread_QueueCmd(opArgs, (void**)&data); } +/** + * original name: Nap_SetS32 + */ void AudioThread_QueueCmdS32(u32 opArgs, s32 data) { AudioThread_QueueCmd(opArgs, (void**)&data); } +/** + * original name: Nap_SetS8 + */ void AudioThread_QueueCmdS8(u32 opArgs, s8 data) { u32 uData = data << 0x18; AudioThread_QueueCmd(opArgs, (void**)&uData); } +/** + * original name: Nap_SetU16 + */ void AudioThread_QueueCmdU16(u32 opArgs, u16 data) { u32 uData = data << 0x10; AudioThread_QueueCmd(opArgs, (void**)&uData); } +/** + * original name: Nap_SendStart + */ s32 AudioThread_ScheduleProcessCmds(void) { static s32 D_801304E8 = 0; s32 ret; @@ -416,11 +455,17 @@ s32 AudioThread_ScheduleProcessCmds(void) { return ret; } +/** + * original name: Nap_FlushPort + */ void AudioThread_ResetCmdQueue(void) { gAudioCtx.threadCmdQueueFinished = false; gAudioCtx.threadCmdReadPos = gAudioCtx.threadCmdWritePos; } +/** + * original name: Nap_Process1Command + */ void AudioThread_ProcessCmd(AudioCmd* cmd) { SequencePlayer* seqPlayer; u16 threadCmdChannelMask; @@ -458,6 +503,9 @@ void AudioThread_ProcessCmd(AudioCmd* cmd) { } } +/** + * original name: Nap_AudioPortProcess + */ void AudioThread_ProcessCmds(u32 msg) { static u8 sCurCmdRdPos = 0; AudioCmd* cmd; @@ -505,6 +553,9 @@ void Audio_GetSampleBankIdsOfFont(s32 fontId, u32* sampleBankId1, u32* sampleBan *sampleBankId2 = gAudioCtx.soundFontList[fontId].sampleBankId2; } +/** + * original name: Nap_CheckSpecChange + */ s32 func_800E5EDC(void) { s32 pad; s32 specId; @@ -518,6 +569,9 @@ s32 func_800E5EDC(void) { } } +/** + * original name: __ClearSpecChangeQ + */ void func_800E5F34(void) { // macro? // clang-format off @@ -525,6 +579,9 @@ void func_800E5F34(void) { // clang-format on } +/** + * original name: Nap_StartSpecChange + */ s32 AudioThread_ResetAudioHeap(s32 specId) { s32 resetStatus; OSMesg msg; @@ -550,6 +607,9 @@ s32 AudioThread_ResetAudioHeap(s32 specId) { return AudioThread_ScheduleProcessCmds(); } +/** + * original name: Nap_StartReset + */ void AudioThread_PreNMIInternal(void) { gAudioCtx.resetTimer = 1; if (gAudioContextInitialized) { @@ -558,6 +618,9 @@ void AudioThread_PreNMIInternal(void) { } } +/** + * original name: Nap_ReadSubPort + */ s8 AudioThread_GetChannelIO(s32 seqPlayerIndex, s32 channelIndex, s32 ioPort) { SequencePlayer* seqPlayer = &gAudioCtx.seqPlayers[seqPlayerIndex]; SequenceChannel* channel; @@ -570,6 +633,9 @@ s8 AudioThread_GetChannelIO(s32 seqPlayerIndex, s32 channelIndex, s32 ioPort) { } } +/** + * original name: Nap_ReadGrpPort + */ s8 AudioThread_GetSeqPlayerIO(s32 seqPlayerIndex, s32 ioPort) { return gAudioCtx.seqPlayers[seqPlayerIndex].seqScriptIO[ioPort]; } @@ -582,6 +648,9 @@ void AudioThread_ResetExternalPool(void) { gAudioCtx.externalPool.startRamAddr = NULL; } +/** + * original name: __SetGrpParam + */ void AudioThread_ProcessSeqPlayerCmd(SequencePlayer* seqPlayer, AudioCmd* cmd) { f32 fadeVolume; @@ -662,6 +731,9 @@ void AudioThread_ProcessSeqPlayerCmd(SequencePlayer* seqPlayer, AudioCmd* cmd) { } } +/** + * original name: __SetSubParam + */ void AudioThread_ProcessChannelCmd(SequenceChannel* channel, AudioCmd* cmd) { switch (cmd->op) { case AUDIOCMD_OP_CHANNEL_SET_VOL_SCALE: @@ -768,6 +840,9 @@ void AudioThread_Noop2Cmd(u32 arg0, s32 arg1) { AUDIOCMD_GLOBAL_NOOP_2(0, 0, arg1, arg0); } +/** + * original name: Nap_WaitVsync + */ void AudioThread_WaitForAudioTask(void) { osRecvMesg(gAudioCtx.taskStartQueueP, NULL, OS_MESG_NOBLOCK); osRecvMesg(gAudioCtx.taskStartQueueP, NULL, OS_MESG_BLOCK); @@ -821,6 +896,9 @@ void func_800E66A0(void) { func_800E66C0(2); } +/** + * original name: Nap_SilenceCheck_Inner + */ s32 func_800E66C0(s32 flags) { s32 phi_v1; NotePlaybackState* playbackState; @@ -857,6 +935,9 @@ s32 func_800E66C0(s32 flags) { return phi_v1; } +/** + * original name: Nap_GetRandom + */ u32 AudioThread_NextRandom(void) { static u32 sAudioRandom = 0x12345678; @@ -866,6 +947,9 @@ u32 AudioThread_NextRandom(void) { return sAudioRandom; } +/** + * original name: Nas_InitGAudio + */ void AudioThread_InitMesgQueues(void) { AudioThread_InitMesgQueuesImpl(); } diff --git a/src/audio/lib/dcache.c b/src/audio/lib/dcache.c deleted file mode 100644 index caaaea3323..0000000000 --- a/src/audio/lib/dcache.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "global.h" - -void Audio_InvalDCache(void* buf, s32 size) { - OSIntMask prevMask = osSetIntMask(OS_IM_NONE); - - osInvalDCache(buf, size); - osSetIntMask(prevMask); -} - -void Audio_WritebackDCache(void* buf, s32 size) { - OSIntMask prevMask = osSetIntMask(OS_IM_NONE); - - osWritebackDCache(buf, size); - osSetIntMask(prevMask); -} diff --git a/src/audio/tables/samplebank_table.c b/src/audio/tables/samplebank_table.c index 58ebf06f22..d26d9d5bcb 100644 --- a/src/audio/tables/samplebank_table.c +++ b/src/audio/tables/samplebank_table.c @@ -3,7 +3,6 @@ // Symbol definition -extern AudioTable gSampleBankTable; #pragma weak gSampleBankTable = sSampleBankTableHeader // Externs for table diff --git a/src/audio/tables/sequence_table.c b/src/audio/tables/sequence_table.c index dc3321d2b4..8235cd674b 100644 --- a/src/audio/tables/sequence_table.c +++ b/src/audio/tables/sequence_table.c @@ -4,7 +4,6 @@ // Symbol definition -extern AudioTable gSequenceTable; #pragma weak gSequenceTable = sSequenceTableHeader // Externs for table diff --git a/src/audio/tables/soundfont_table.c b/src/audio/tables/soundfont_table.c index 65d1fc9a52..779be397ba 100644 --- a/src/audio/tables/soundfont_table.c +++ b/src/audio/tables/soundfont_table.c @@ -3,7 +3,6 @@ // Symbol definition -extern AudioTable gSoundFontTable; #pragma weak gSoundFontTable = sSoundFontTableHeader // Externs for table diff --git a/src/boot/assert.c b/src/boot/assert.c index e58f2cc1e7..661f7db873 100644 --- a/src/boot/assert.c +++ b/src/boot/assert.c @@ -1,4 +1,5 @@ -#include "global.h" +#include "libc64/sprintf.h" +#include "assert.h" #include "fault.h" NORETURN void __assert(const char* assertion, const char* file, int line) { diff --git a/src/boot/boot_main.c b/src/boot/boot_main.c index 0c1eeea49e..2f948b9d6a 100644 --- a/src/boot/boot_main.c +++ b/src/boot/boot_main.c @@ -1,12 +1,18 @@ -#include "global.h" #include "boot.h" + +#include "carthandle.h" +#include "idle.h" +#include "is_debug.h" +#include "segment_symbols.h" #include "stack.h" +#include "stackcheck.h" #if PLATFORM_N64 #include "cic6105.h" #endif +#include "z_locale.h" +#include "z64thread.h" -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:128" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:128" StackEntry sBootThreadInfo; OSThread sIdleThread; diff --git a/src/boot/build.c b/src/boot/build.c index 31e48096b2..035e685db9 100644 --- a/src/boot/build.c +++ b/src/boot/build.c @@ -1,3 +1,5 @@ +#include "build.h" + #include "versions.h" const char gBuildCreator[] = BUILD_CREATOR; diff --git a/src/boot/carthandle.c b/src/boot/carthandle.c index 16d3160b55..9a4cf542d8 100644 --- a/src/boot/carthandle.c +++ b/src/boot/carthandle.c @@ -1,3 +1,3 @@ -#include "ultra64.h" +#include "carthandle.h" OSPiHandle* gCartHandle = NULL; diff --git a/src/boot/cic6105.c b/src/boot/cic6105.c index 5ef47053fc..fadae3a181 100644 --- a/src/boot/cic6105.c +++ b/src/boot/cic6105.c @@ -1,8 +1,11 @@ -#pragma increment_block_number "ntsc-1.2:128" +#pragma increment_block_number "ntsc-1.0:132 ntsc-1.1:132 ntsc-1.2:132 pal-1.0:132 pal-1.1:132" -#include "global.h" +#include "audiomgr.h" +#include "build.h" #include "cic6105.h" #include "fault.h" +#include "regs.h" +#include "sched.h" s32 func_80001714(void); diff --git a/src/boot/driverominit.c b/src/boot/driverominit.c index 5ed69abe07..72ab069d34 100644 --- a/src/boot/driverominit.c +++ b/src/boot/driverominit.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" OSPiHandle __DriveRomHandle; diff --git a/src/boot/idle.c b/src/boot/idle.c index 508fd16c4e..743219d94c 100644 --- a/src/boot/idle.c +++ b/src/boot/idle.c @@ -1,9 +1,21 @@ -#include "global.h" +#include "array_count.h" +#include "buffers.h" +#include "build.h" +#include "idle.h" +#include "main.h" +#include "printf.h" +#include "segment_symbols.h" #include "stack.h" +#include "stackcheck.h" #include "terminal.h" +#include "translation.h" #include "versions.h" +#include "vi_mode.h" +#include "z64thread.h" +#include "z64dma.h" -#pragma increment_block_number "gc-eu:64 gc-eu-mq:64 gc-jp:64 gc-jp-ce:64 gc-jp-mq:64 gc-us:64 gc-us-mq:64 ntsc-1.2:64" +#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ + "ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" OSThread sMainThread; #if OOT_VERSION < PAL_1_0 diff --git a/src/boot/inflate.c b/src/boot/inflate.c index c0467dd38c..391ce0368f 100644 --- a/src/boot/inflate.c +++ b/src/boot/inflate.c @@ -95,6 +95,8 @@ the two sets of lengths. */ +#include "inflate.h" + #include "ultra64/ultratypes.h" #include "libc/stddef.h" #include "libc/stdint.h" diff --git a/src/boot/is_debug.c b/src/boot/is_debug.c index 5415b8a7b3..6d63118853 100644 --- a/src/boot/is_debug.c +++ b/src/boot/is_debug.c @@ -1,4 +1,15 @@ -#include "global.h" +#include "is_debug.h" + +#include "ultra64.h" + +typedef struct ISVDbg { + /* 0x00 */ u32 magic; // "IS64" + /* 0x04 */ u32 get; + /* 0x08 */ u8 unk_08[0xC]; + /* 0x14 */ u32 put; + /* 0x18 */ u8 unk_18[0x8]; + /* 0x20 */ u8 data[0xFFE0]; +} ISVDbg; // size = 0x10000 #define gISVDbgPrnAdrs ((ISVDbg*)0xB3FF0000) #define ASCII_TO_U32(a, b, c, d) ((u32)((a << 24) | (b << 16) | (c << 8) | (d << 0))) diff --git a/src/boot/viconfig.c b/src/boot/viconfig.c index ae50922e63..0381f57f30 100644 --- a/src/boot/viconfig.c +++ b/src/boot/viconfig.c @@ -1,5 +1,6 @@ -#include "global.h" +#include "printf.h" #include "terminal.h" +#include "idle.h" s8 D_80009430 = 1; vu8 gViConfigBlack = true; diff --git a/src/boot/yaz0.c b/src/boot/yaz0.c index 5e5ed26eb1..eb3ce23317 100644 --- a/src/boot/yaz0.c +++ b/src/boot/yaz0.c @@ -1,7 +1,11 @@ -#include "global.h" +#include "yaz0.h" -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:128 pal-1.1:128" +#include "alignment.h" +#include "ultra64.h" +#include "z64dma.h" + +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:128" \ + "pal-1.1:128" ALIGNED(16) u8 sYaz0DataBuffer[0x400]; u8* sYaz0DataBufferEnd; @@ -51,6 +55,13 @@ void* Yaz0_NextDMA(u8* curSrcPos) { return dst; } +typedef struct Yaz0Header { + /* 0x00 */ char magic[4]; // Yaz0 + /* 0x04 */ u32 decSize; + /* 0x08 */ u32 compInfoOffset; // only used in mio0 + /* 0x0C */ u32 uncompDataOffset; // only used in mio0 +} Yaz0Header; // size = 0x10 + void Yaz0_DecompressImpl(u8* src, u8* dst) { Yaz0Header* header = (Yaz0Header*)src; u32 bitIdx = 0; diff --git a/src/boot/z_locale.c b/src/boot/z_locale.c index f320f1e0f4..a517f561ce 100644 --- a/src/boot/z_locale.c +++ b/src/boot/z_locale.c @@ -1,11 +1,31 @@ -#include "global.h" +#include "libu64/debug.h" +#include "alignment.h" +#include "carthandle.h" +#include "line_numbers.h" +#include "padmgr.h" +#include "printf.h" #include "region.h" #include "terminal.h" +#include "translation.h" #include "versions.h" -#include "line_numbers.h" +#include "vi_mode.h" +#include "z_locale.h" s32 gCurrentRegion = 0; +typedef struct LocaleCartInfo { + /* 0x00 */ char name[0x18]; + /* 0x18 */ u32 mediaFormat; + /* 0x1C */ union { + struct { + u16 cartId; + u8 countryCode; + u8 version; + }; + u32 regionInfo; + }; +} LocaleCartInfo; // size = 0x20 + void Locale_Init(void) { #if !PLATFORM_GC ALIGNED(4) u8 regionInfo[4]; diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index 38da143aed..de2a19e57c 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -18,17 +18,35 @@ * There are some additional provisions to ensure that audio DMA is particularly high-speed, the audio data is assumed * to be uncompressed and the request queue and address translation is skipped. */ -#include "global.h" +#include "libc64/sleep.h" +#include "libc64/sprintf.h" +#include "libu64/debug.h" +#include "array_count.h" +#include "attributes.h" +#include "carthandle.h" #include "fault.h" -#include "stack.h" -#include "terminal.h" +#include "idle.h" +#if PLATFORM_IQUE +#include "inflate.h" +#endif #include "line_numbers.h" #if PLATFORM_N64 #include "n64dd.h" #endif +#include "printf.h" +#include "segment_symbols.h" +#include "stack.h" +#include "stackcheck.h" +#include "terminal.h" +#include "translation.h" +#if !PLATFORM_IQUE +#include "yaz0.h" +#endif +#include "z64dma.h" +#include "z64thread.h" -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:62 pal-1.0:60 pal-1.1:60" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:66" \ + "pal-1.0:64 pal-1.1:64" StackEntry sDmaMgrStackInfo; OSMesgQueue sDmaMgrMsgQueue; diff --git a/src/buffers/audio_heap.c b/src/buffers/audio_heap.c index b6474ccc6a..b8e0e336e7 100644 --- a/src/buffers/audio_heap.c +++ b/src/buffers/audio_heap.c @@ -1,3 +1,5 @@ -#include "z64.h" +#include "ultra64/ultratypes.h" +#include "alignment.h" +#include "buffers.h" ALIGNED(16) u8 gAudioHeap[0x38000]; diff --git a/src/buffers/gfxbuffers.c b/src/buffers/gfxbuffers.c index fa466bc829..1806570ae4 100644 --- a/src/buffers/gfxbuffers.c +++ b/src/buffers/gfxbuffers.c @@ -1,4 +1,7 @@ -#include "z64.h" +#include "alignment.h" +#include "buffers.h" +#include "gfx.h" +#include "ultra64.h" ALIGNED(16) u64 gGfxSPTaskOutputBuffer[0x3000]; diff --git a/src/buffers/zbuffer.c b/src/buffers/zbuffer.c index d9e5d2784a..69c445b633 100644 --- a/src/buffers/zbuffer.c +++ b/src/buffers/zbuffer.c @@ -1,3 +1,5 @@ -#include "z64.h" +#include "alignment.h" +#include "buffers.h" +#include "ultra64/ultratypes.h" ALIGNED(64) u16 gZBuffer[SCREEN_HEIGHT][SCREEN_WIDTH]; diff --git a/src/code/PreRender.c b/src/code/PreRender.c index 8e002a5a18..ddf6b473ea 100644 --- a/src/code/PreRender.c +++ b/src/code/PreRender.c @@ -5,8 +5,13 @@ * buffer copies and coverage drawing. Also contains software implementations of the Video Interface anti-aliasing and * divot filters. */ -#include "global.h" +#include "libu64/debug.h" #include "alloca.h" +#include "color.h" +#include "gfx.h" +#include "prerender.h" +#include "printf.h" +#include "regs.h" void PreRender_SetValuesSave(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf, void* cvg) { this->widthSave = width; diff --git a/src/code/TwoHeadArena.c b/src/code/TwoHeadArena.c index 271c2ae7ff..490304a472 100644 --- a/src/code/TwoHeadArena.c +++ b/src/code/TwoHeadArena.c @@ -9,7 +9,7 @@ * is to reset the entire arena, deallocating everything. This scheme is most applicable to allocating similar data * with identical lifetime. */ -#include "global.h" +#include "tha.h" void* THA_GetHead(TwoHeadArena* tha) { return tha->head; diff --git a/src/code/TwoHeadGfxArena.c b/src/code/TwoHeadGfxArena.c index ce7b8a45fb..c3f2216fad 100644 --- a/src/code/TwoHeadGfxArena.c +++ b/src/code/TwoHeadGfxArena.c @@ -8,7 +8,7 @@ * * @see TwoHeadArena.c */ -#include "global.h" +#include "thga.h" void THGA_Init(TwoHeadGfxArena* thga, void* start, size_t size) { THA_Init(&thga->tha, start, size); diff --git a/src/code/audio_stop_all_sfx.c b/src/code/audio_stop_all_sfx.c index ef84cd6fff..b1b526e8ec 100644 --- a/src/code/audio_stop_all_sfx.c +++ b/src/code/audio_stop_all_sfx.c @@ -1,4 +1,6 @@ -#include "global.h" +#include "array_count.h" +#include "sfx.h" +#include "ultra64.h" u8 sSfxBankIds[] = { BANK_PLAYER, BANK_ITEM, BANK_ENV, BANK_ENEMY, BANK_SYSTEM, BANK_OCARINA, BANK_VOICE, diff --git a/src/code/audio_thread_manager.c b/src/code/audio_thread_manager.c index 1dc72642f3..57f530a4b8 100644 --- a/src/code/audio_thread_manager.c +++ b/src/code/audio_thread_manager.c @@ -5,7 +5,13 @@ * and sending the audio rsp tasks generated by the driver to the task scheduler. */ -#include "global.h" +#include "array_count.h" +#include "audiomgr.h" +#include "printf.h" +#include "regs.h" +#include "speed_meter.h" +#include "translation.h" +#include "z64dma.h" void AudioMgr_NotifyTaskDone(AudioMgr* audioMgr) { AudioTask* task = audioMgr->rspTask; diff --git a/src/code/code_n64dd_800AD4C0.c b/src/code/code_n64dd_800AD4C0.c index 3f1488c66e..4c4e0db0e3 100644 --- a/src/code/code_n64dd_800AD4C0.c +++ b/src/code/code_n64dd_800AD4C0.c @@ -1,6 +1,10 @@ -#include "global.h" #include "fault.h" #include "n64dd.h" +#include "regs.h" +#include "segmented_address.h" +#include "z64actor.h" +#include "z64cutscene.h" +#include "z64save.h" n64ddStruct_800FEE70_pointers D_800FEE70 = { func_801C7C1C, diff --git a/src/code/db_camera.c b/src/code/db_camera.c index 242609295d..a275cae523 100644 --- a/src/code/db_camera.c +++ b/src/code/db_camera.c @@ -1,4 +1,23 @@ -#include "global.h" +#include "libu64/gfxprint.h" +#include "array_count.h" +#include "attributes.h" +#include "controller.h" +#include "db_camera.h" +#include "debug_arena.h" +#include "letterbox.h" +#include "mempak.h" +#include "printf.h" +#include "regs.h" +#include "sfx.h" +#include "z_lib.h" +#include "z64camera.h" +#include "z64cutscene.h" +#include "z64cutscene_spline.h" +#include "z64debug.h" +#include "z64debug_display.h" +#include "z64olib.h" +#include "z64play.h" +#include "z64save.h" #define DEBUG_CAM_CONTROLLER_PORT 2 diff --git a/src/code/debug_malloc.c b/src/code/debug_malloc.c index b6aa81b329..ad7c786f34 100644 --- a/src/code/debug_malloc.c +++ b/src/code/debug_malloc.c @@ -1,5 +1,7 @@ -#include "global.h" #include "libc64/os_malloc.h" +#include "debug_arena.h" +#include "printf.h" +#include "translation.h" #define LOG_SEVERITY_NOLOG 0 #define LOG_SEVERITY_ERROR 2 diff --git a/src/code/fault_gc.c b/src/code/fault_gc.c index 5a85d03ebb..b2bb9d13d4 100644 --- a/src/code/fault_gc.c +++ b/src/code/fault_gc.c @@ -40,14 +40,23 @@ * DPad-Up may be pressed to enable sending fault pages over osSyncPrintf as well as displaying them on-screen. * DPad-Down disables sending fault pages over osSyncPrintf. */ -#pragma increment_block_number "gc-eu:160 gc-eu-mq:160 gc-eu-mq-dbg:144 gc-jp:160 gc-jp-ce:160 gc-jp-mq:160 gc-us:160" \ + +#pragma increment_block_number "gc-eu:160 gc-eu-mq:160 gc-eu-mq-dbg:160 gc-jp:160 gc-jp-ce:160 gc-jp-mq:160 gc-us:160" \ "gc-us-mq:160 ique-cn:160" -#include "global.h" +#include "libc64/sleep.h" +#include "libc64/sprintf.h" #include "alloca.h" +#include "array_count.h" +#include "controller.h" +#include "gfx.h" +#include "padmgr.h" #include "fault.h" #include "stack.h" +#include "stackcheck.h" #include "terminal.h" +#include "translation.h" +#include "z64thread.h" void Fault_Init(void); void Fault_SetOsSyncPrintfEnabled(u32 enabled); diff --git a/src/code/fault_gc_drawer.c b/src/code/fault_gc_drawer.c index 9d3478a48f..9c2470b9b8 100644 --- a/src/code/fault_gc_drawer.c +++ b/src/code/fault_gc_drawer.c @@ -4,10 +4,13 @@ * Implements routines for drawing text with a fixed font directly to a framebuffer, used in displaying * the crash screen implemented by fault.c */ -#include "global.h" + +#include "array_count.h" #include "fault.h" +#include "gfx.h" #include "terminal.h" -#pragma increment_block_number "gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" + +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" typedef struct FaultDrawer { /* 0x00 */ u16* fb; @@ -101,7 +104,7 @@ FaultDrawer sFaultDrawerDefault = { NULL, }; -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0" FaultDrawer sFaultDrawer; char D_8016B6C0[0x20]; diff --git a/src/code/fault_n64.c b/src/code/fault_n64.c index 720307c0a1..75fc704b91 100644 --- a/src/code/fault_n64.c +++ b/src/code/fault_n64.c @@ -1,12 +1,19 @@ -#pragma increment_block_number "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" - -#include "global.h" -#include "fault.h" #include "libc64/os_malloc.h" +#include "libc64/sleep.h" +#include "libc64/sprintf.h" +#include "array_count.h" +#include "controller.h" +#include "fault.h" +#include "gfx.h" +#include "padmgr.h" +#include "segmented_address.h" #include "stack.h" +#include "stackcheck.h" #include "terminal.h" +#include "z64thread.h" +#include "translation.h" -#pragma increment_block_number "ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" +#pragma increment_block_number "ntsc-1.0:144 ntsc-1.1:144 ntsc-1.2:144 pal-1.0:144 pal-1.1:144" typedef struct FaultMgr { OSThread thread; diff --git a/src/code/flg_set.c b/src/code/flg_set.c index de5b2a3d3f..88f32a3e4e 100644 --- a/src/code/flg_set.c +++ b/src/code/flg_set.c @@ -1,4 +1,12 @@ -#include "global.h" +#include "flag_set.h" + +#include "libu64/gfxprint.h" +#include "libu64/pad.h" +#include "gfx.h" +#include "gfxalloc.h" +#include "controller.h" +#include "z64play.h" +#include "z64save.h" typedef struct FlagSetEntry { /* 0x00 */ u16* value; diff --git a/src/code/game.c b/src/code/game.c index 4367839528..5b80355cbb 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -1,12 +1,36 @@ -#include "global.h" -#include "fault.h" +#include "libc64/malloc.h" #include "libc64/os_malloc.h" -#include "terminal.h" -#include "versions.h" +#include "libu64/debug.h" +#include "libu64/gfxprint.h" +#include "array_count.h" +#include "audiomgr.h" +#include "buffers.h" +#include "controller.h" +#include "debug_arena.h" +#include "gfx.h" +#include "gfxalloc.h" +#include "fault.h" +#include "idle.h" #include "line_numbers.h" #if PLATFORM_N64 #include "n64dd.h" #endif +#include "padmgr.h" +#include "printf.h" +#include "regs.h" +#include "rumble.h" +#include "speed_meter.h" +#include "sys_debug_controller.h" +#include "terminal.h" +#include "translation.h" +#include "versions.h" +#include "vi_mode.h" +#include "zelda_arena.h" +#include "z64debug.h" +#include "z64dma.h" +#include "z64game.h" +#include "z64play.h" +#include "z64vis.h" #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" @@ -448,7 +472,7 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g gameState->running = 1; startTime = osGetTime(); - // Thse assignments must be written this way for matching and to avoid a warning due to casting a pointer to an + // These assignments must be written this way for matching and to avoid a warning due to casting a pointer to an // integer without a cast. This assigns init = NULL and size = 0. gameState->size = (u32)(gameState->init = NULL); diff --git a/src/code/gamealloc.c b/src/code/gamealloc.c index d625bc65f7..506ef7721e 100644 --- a/src/code/gamealloc.c +++ b/src/code/gamealloc.c @@ -1,4 +1,7 @@ -#include "global.h" +#include "libc64/malloc.h" +#include "libu64/debug.h" +#include "gamealloc.h" +#include "printf.h" void GameAlloc_Log(GameAlloc* this) { GameAllocEntry* iter; diff --git a/src/code/gfxalloc.c b/src/code/gfxalloc.c index 79d8bb04e5..9e2fe9bb99 100644 --- a/src/code/gfxalloc.c +++ b/src/code/gfxalloc.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "gfx.h" Gfx* Gfx_Open(Gfx* gfx) { return gfx + 1; diff --git a/src/code/graph.c b/src/code/graph.c index 046e04d374..86543cc50d 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -1,15 +1,40 @@ -#include "global.h" +#include "libc64/malloc.h" +#include "libc64/sprintf.h" +#include "libu64/debug.h" +#include "array_count.h" +#include "buffers.h" +#include "console_logo_state.h" +#include "controller.h" +#include "gfx.h" #include "fault.h" +#include "file_select_state.h" +#include "line_numbers.h" +#include "map_select_state.h" +#include "prenmi_buff.h" +#include "prenmi_state.h" +#include "printf.h" +#include "regs.h" +#include "setup_state.h" +#include "speed_meter.h" +#include "sys_cfb.h" +#include "sys_debug_controller.h" +#include "sys_ucode.h" #include "terminal.h" +#include "title_setup_state.h" +#include "translation.h" #include "ucode_disas.h" #include "versions.h" -#include "line_numbers.h" +#include "vi_mode.h" +#include "z_game_dlftbls.h" +#include "z64audio.h" +#include "z64save.h" +#include "z64play.h" #define GFXPOOL_HEAD_MAGIC 0x1234 #define GFXPOOL_TAIL_MAGIC 0x5678 -#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.0:160" \ - "ntsc-1.1:160 ntsc-1.2:160 pal-1.0:160 pal-1.1:160" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:128" \ + "ntsc-1.0:224 ntsc-1.1:224 ntsc-1.2:224 pal-1.0:224 pal-1.1:224" /** * The time at which the previous `Graph_Update` ended. diff --git a/src/code/irqmgr.c b/src/code/irqmgr.c index 59d7a41cfa..ced883f7a0 100644 --- a/src/code/irqmgr.c +++ b/src/code/irqmgr.c @@ -32,9 +32,15 @@ * * @see sched.c */ -#include "global.h" +#include "libu64/debug.h" +#include "array_count.h" +#include "irqmgr.h" +#include "printf.h" +#include "stackcheck.h" #include "terminal.h" +#include "translation.h" #include "versions.h" +#include "z64thread.h" vu32 gIrqMgrResetStatus = IRQ_RESET_STATUS_IDLE; volatile OSTime sIrqMgrResetTime = 0; diff --git a/src/code/jpegdecoder.c b/src/code/jpegdecoder.c index a29752511c..338c6b15d9 100644 --- a/src/code/jpegdecoder.c +++ b/src/code/jpegdecoder.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "jpeg.h" s32 JpegDecoder_ProcessMcu(JpegHuffmanTable* hTable0, JpegHuffmanTable* hTable1, u16* mcu, s16* unk); s32 JpegDecoder_ParseNextSymbol(JpegHuffmanTable* hTable, s16* outCoeff, s8* outZeroCount); diff --git a/src/code/jpegutils.c b/src/code/jpegutils.c index 00c0406096..7f5442fd9b 100644 --- a/src/code/jpegutils.c +++ b/src/code/jpegutils.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "jpeg.h" void JpegUtils_ProcessQuantizationTable(u8* dqt, JpegQuantizationTable* qt, u8 count) { u8 i; diff --git a/src/code/listalloc.c b/src/code/listalloc.c index 7560c20c64..9ccaa443d1 100644 --- a/src/code/listalloc.c +++ b/src/code/listalloc.c @@ -1,4 +1,5 @@ -#include "global.h" +#include "libc64/malloc.h" +#include "listalloc.h" ListAlloc* ListAlloc_Init(ListAlloc* this) { this->prev = NULL; diff --git a/src/code/main.c b/src/code/main.c index d31f7cd211..cb936b2176 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -1,6 +1,10 @@ +#include "sys_cfb.h" #include "ultra64.h" #include "versions.h" +#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ + "ique-cn:0 ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" + // Declared before including other headers for BSS ordering extern uintptr_t gSegments[NUM_SEGMENTS]; @@ -12,19 +16,35 @@ extern struct Scheduler gScheduler; extern struct PadMgr gPadMgr; extern struct IrqMgr gIrqMgr; -#include "global.h" +#include "libc64/malloc.h" +#include "libu64/rcp_utils.h" +#include "libu64/runtime.h" +#include "array_count.h" +#include "audiomgr.h" +#include "debug_arena.h" #include "fault.h" +#include "gfx.h" +#include "idle.h" +#include "padmgr.h" +#include "prenmi_buff.h" +#include "printf.h" +#include "regs.h" +#include "segment_symbols.h" #include "segmented_address.h" #include "stack.h" +#include "stackcheck.h" #include "terminal.h" +#include "translation.h" #include "versions.h" #if PLATFORM_N64 #include "cic6105.h" #include "n64dd.h" #endif +#include "z64debug.h" +#include "z64thread.h" -#pragma increment_block_number "gc-eu:144 gc-eu-mq:144 gc-jp:144 gc-jp-ce:144 gc-jp-mq:144 gc-us:144 gc-us-mq:144" \ - "ique-cn:128 ntsc-1.0:122 ntsc-1.1:122 ntsc-1.2:122 pal-1.0:120 pal-1.1:120" +#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ + "ique-cn:0 ntsc-1.0:34 ntsc-1.1:34 ntsc-1.2:34 pal-1.0:32 pal-1.1:32" extern u8 _buffersSegmentEnd[]; @@ -98,7 +118,7 @@ void Main(void* arg) { gSystemHeapSize = fb - systemHeapStart; PRINTF(T("システムヒープ初期化 %08x-%08x %08x\n", "System heap initialization %08x-%08x %08x\n"), systemHeapStart, fb, gSystemHeapSize); - SystemHeap_Init((void*)systemHeapStart, gSystemHeapSize); // initializes the system heap + Runtime_Init((void*)systemHeapStart, gSystemHeapSize); #if DEBUG_FEATURES { diff --git a/src/code/mempak.c b/src/code/mempak.c index 8d68be5ca3..850c478b93 100644 --- a/src/code/mempak.c +++ b/src/code/mempak.c @@ -7,7 +7,9 @@ * Each file is assigned an uppercase ASCII letter as an identifier, the game name for each is marked as * 'ZELDA DEMO TOOL', encoded according to the N64 Font Code described in section 26.3 of the N64 Programming Manual. */ -#include "global.h" +#include "mempak.h" +#include "padmgr.h" +#include "printf.h" #define MEMPAK_MAX_FILES 11 diff --git a/src/code/object_table.c b/src/code/object_table.c index d0f9e936dc..9ed6a1f44d 100644 --- a/src/code/object_table.c +++ b/src/code/object_table.c @@ -1,4 +1,8 @@ -#include "global.h" +#include "array_count.h" +#include "segment_symbols.h" +#include "romfile.h" +#include "ultra64.h" +#include "z64object.h" s16 gLinkObjectIds[] = { OBJECT_LINK_BOY, OBJECT_LINK_CHILD }; diff --git a/src/code/padmgr.c b/src/code/padmgr.c index 740f15b29a..01a952c876 100644 --- a/src/code/padmgr.c +++ b/src/code/padmgr.c @@ -30,9 +30,12 @@ */ #include "libu64/debug.h" #include "libu64/padsetup.h" -#include "macros.h" +#include "array_count.h" +#include "padmgr.h" +#include "printf.h" #include "fault.h" #include "terminal.h" +#include "translation.h" #include "line_numbers.h" #define PADMGR_LOG(controllerNum, msg) \ diff --git a/src/code/sched.c b/src/code/sched.c index b22f38b402..c573bf97f6 100644 --- a/src/code/sched.c +++ b/src/code/sched.c @@ -39,9 +39,20 @@ * * @see irqmgr.c */ -#include "global.h" +#include "libu64/debug.h" +#include "libu64/rcp_utils.h" +#include "array_count.h" #include "fault.h" +#include "irqmgr.h" +#include "main.h" +#include "printf.h" +#include "regs.h" +#include "sched.h" +#include "speed_meter.h" +#include "translation.h" #include "versions.h" +#include "vi_mode.h" +#include "z64thread.h" #define RSP_DONE_MSG 667 #define RDP_DONE_MSG 668 diff --git a/src/code/shrink_window.c b/src/code/shrink_window.c index ad8da58d35..3c92ede0e1 100644 --- a/src/code/shrink_window.c +++ b/src/code/shrink_window.c @@ -1,4 +1,6 @@ -#include "global.h" +#include "letterbox.h" +#include "printf.h" +#include "regs.h" typedef enum LetterboxState { /* 0 */ LETTERBOX_STATE_IDLE, diff --git a/src/code/speed_meter.c b/src/code/speed_meter.c index d282e34953..bb3624fa86 100644 --- a/src/code/speed_meter.c +++ b/src/code/speed_meter.c @@ -1,8 +1,16 @@ -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:128 pal-1.0:128 pal-1.1:128" - -#include "global.h" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:0" \ + "pal-1.0:0 pal-1.1:0" +#include "libc64/malloc.h" +#include "libu64/debug.h" +#include "array_count.h" +#include "gfx.h" +#include "printf.h" +#include "regs.h" +#include "speed_meter.h" #include "terminal.h" +#include "zelda_arena.h" +#include "z64game.h" +#include "z64view.h" /** * How much time the audio update on the audio thread (`AudioThread_Update`) took in total, between scheduling the last diff --git a/src/code/sys_cfb.c b/src/code/sys_cfb.c index 4e4bc06f25..38fc9c65d8 100644 --- a/src/code/sys_cfb.c +++ b/src/code/sys_cfb.c @@ -1,8 +1,11 @@ -#include "ultra64.h" +#include "sys_cfb.h" + #include "libu64/debug.h" #include "attributes.h" +#include "gfx.h" #include "line_numbers.h" -#include "global.h" +#include "printf.h" +#include "translation.h" #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ "pal-1.1:128" diff --git a/src/code/sys_debug_controller.c b/src/code/sys_debug_controller.c index eb1398ff24..06ce8bf6cd 100644 --- a/src/code/sys_debug_controller.c +++ b/src/code/sys_debug_controller.c @@ -1,4 +1,7 @@ -#include "global.h" +#include "sys_debug_controller.h" +#include "stdbool.h" +#include "ultra64/ultratypes.h" +#include "padmgr.h" u32 gIsCtrlr2Valid = false; diff --git a/src/code/sys_freeze.c b/src/code/sys_freeze.c index f7cb515cfe..2957155559 100644 --- a/src/code/sys_freeze.c +++ b/src/code/sys_freeze.c @@ -1,4 +1,7 @@ -#include "global.h" +#include "libc64/sleep.h" +#include "attributes.h" +#include "printf.h" +#include "sys_freeze.h" #include "terminal.h" NORETURN void func_800D31A0(void) { diff --git a/src/code/sys_math3d.c b/src/code/sys_math3d.c index 54ae8741e4..1ce651e9c9 100644 --- a/src/code/sys_math3d.c +++ b/src/code/sys_math3d.c @@ -1,12 +1,14 @@ +#include "sys_math3d.h" + +#include "printf.h" +#include "terminal.h" +#include "translation.h" #include "ultra64.h" #include "z_lib.h" #include "z64math.h" -#include "terminal.h" -#include "macros.h" -#include "sys_math3d.h" -#pragma increment_block_number "gc-eu:97 gc-eu-mq:97 gc-jp:97 gc-jp-ce:97 gc-jp-mq:97 gc-us:97 gc-us-mq:97 ique-cn:97" \ - "ntsc-1.0:80 ntsc-1.1:80 ntsc-1.2:79 pal-1.0:80 pal-1.1:80" +#pragma increment_block_number "gc-eu:77 gc-eu-mq:77 gc-jp:77 gc-jp-ce:77 gc-jp-mq:77 gc-us:77 gc-us-mq:77 ique-cn:67" \ + "ntsc-1.0:64 ntsc-1.1:64 ntsc-1.2:64 pal-1.0:64 pal-1.1:64" s32 Math3D_LineVsLineClosestTwoPoints(Vec3f* lineAPointA, Vec3f* lineAPointB, Vec3f* lineBPointA, Vec3f* lineBPointB, Vec3f* lineAClosestToB, Vec3f* lineBClosestToA); diff --git a/src/code/sys_math3d_draw.c b/src/code/sys_math3d_draw.c index 76651c825e..7781a79e2e 100644 --- a/src/code/sys_math3d_draw.c +++ b/src/code/sys_math3d_draw.c @@ -1,4 +1,5 @@ -#include "z64.h" +#include "sys_math3d.h" +#include "z64play.h" void Math3D_DrawSphere(PlayState* play, Sphere16* sph) { } diff --git a/src/code/sys_math_atan.c b/src/code/sys_math_atan.c index 0647745b06..0c99eaced4 100644 --- a/src/code/sys_math_atan.c +++ b/src/code/sys_math_atan.c @@ -1,5 +1,6 @@ +#include "array_count.h" +#include "sys_math.h" #include "z64math.h" -#include "macros.h" static u16 sAtan2Tbl[] = { 0x0000, 0x000A, 0x0014, 0x001F, 0x0029, 0x0033, 0x003D, 0x0047, 0x0051, 0x005C, 0x0066, 0x0070, 0x007A, 0x0084, diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c index 19db7799e6..2ca4882601 100644 --- a/src/code/sys_matrix.c +++ b/src/code/sys_matrix.c @@ -1,17 +1,24 @@ -#include "global.h" +#include "libc64/math64.h" +#include "gfx.h" #if DEBUG_FEATURES #include "fault.h" #endif +#include "printf.h" +#include "sys_matrix.h" +#include "ultra64.h" +#include "z_lib.h" +#include "z64game.h" +#include "z64skin_matrix.h" // clang-format off -Mtx gMtxClear = gdSPDefMtx( +Mtx gIdentityMtx = gdSPDefMtx( 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f ); -MtxF gMtxFClear = { +MtxF gIdentityMtxF = { 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, @@ -19,9 +26,6 @@ MtxF gMtxFClear = { }; // clang-format on -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "pal-1.1:128" - MtxF* sMatrixStack; // "Matrix_stack" MtxF* sCurrentMatrix; // "Matrix_now" diff --git a/src/code/sys_rumble.c b/src/code/sys_rumble.c index 10844f3674..57f61c9214 100644 --- a/src/code/sys_rumble.c +++ b/src/code/sys_rumble.c @@ -12,7 +12,8 @@ * * @note Original filename is likely sys_vibrate.c or similar as it is ordered after sys_ucode.c */ -#include "global.h" +#include "rumble.h" +#include "padmgr.h" /** * Rumble manager update, runs on Vertical Retrace on the padmgr thread. diff --git a/src/code/sys_ucode.c b/src/code/sys_ucode.c index 2be2566e84..71ae003909 100644 --- a/src/code/sys_ucode.c +++ b/src/code/sys_ucode.c @@ -1,4 +1,5 @@ -#include "global.h" +#include "ultra64.h" +#include "sys_ucode.h" u64* sDefaultGSPUCodeText = gspF3DZEX2_NoN_PosLight_fifoTextStart; u64* sDefaultGSPUCodeData = gspF3DZEX2_NoN_PosLight_fifoDataStart; diff --git a/src/code/title_setup.c b/src/code/title_setup.c index fcc6eaa239..0272022474 100644 --- a/src/code/title_setup.c +++ b/src/code/title_setup.c @@ -1,4 +1,8 @@ -#include "global.h" +#include "console_logo_state.h" +#include "setup_state.h" +#include "printf.h" +#include "translation.h" +#include "z64save.h" void Setup_InitImpl(SetupState* this) { PRINTF(T("ゼルダ共通データ初期化\n", "Zelda common data initialization\n")); diff --git a/src/code/ucode_disas.c b/src/code/ucode_disas.c index ecfc7d7ac4..8d1ff6cd77 100644 --- a/src/code/ucode_disas.c +++ b/src/code/ucode_disas.c @@ -1,5 +1,11 @@ -#include "global.h" +#include "libu64/mtxuty-cvt.h" +#include "ultra64/gs2dex.h" +#include "array_count.h" +#include "printf.h" +#include "segmented_address.h" +#include "translation.h" #include "ucode_disas.h" +#include "ultra64.h" #if DEBUG_FEATURES @@ -54,7 +60,7 @@ typedef void (*UcodeDisasCallback)(UCodeDisas*, u32); void* UCodeDisas_TranslateAddr(UCodeDisas* this, uintptr_t addr) { uintptr_t physical = this->segments[SEGMENT_NUMBER(addr)] + SEGMENT_OFFSET(addr); - return PHYSICAL_TO_VIRTUAL(physical); + return OS_PHYSICAL_TO_K0(physical); } F3dzexConst sUCodeDisasGeometryModes[] = { diff --git a/src/code/z_DLF.c b/src/code/z_DLF.c index f56fcc742b..ad2cdff118 100644 --- a/src/code/z_DLF.c +++ b/src/code/z_DLF.c @@ -1,5 +1,10 @@ -#include "global.h" +#include "libc64/malloc.h" +#include "libu64/overlay.h" +#include "printf.h" #include "terminal.h" +#include "translation.h" +#include "ultra64.h" +#include "z_game_dlftbls.h" void Overlay_LoadGameState(GameStateOverlay* overlayEntry) { if (overlayEntry->loadedRamAddr != NULL) { diff --git a/src/code/z_actor.c b/src/code/z_actor.c index f59a996e6a..83105d23ec 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -1,19 +1,42 @@ -#include "global.h" +#include "libc64/math64.h" +#include "libu64/overlay.h" +#include "array_count.h" #include "fault.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" #include "quake.h" #include "rand.h" +#include "regs.h" +#include "rumble.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_math.h" +#include "sys_matrix.h" #include "terminal.h" +#include "translation.h" #include "versions.h" +#include "z_actor_dlftbls.h" +#include "z_lib.h" +#include "zelda_arena.h" +#include "z64actor.h" +#include "z64audio.h" +#include "z64effect.h" +#include "z64light.h" #include "z64horse.h" +#include "z64play.h" +#include "z64save.h" +#include "z64skin_matrix.h" #include "overlays/actors/ovl_Arms_Hook/z_arms_hook.h" #include "overlays/actors/ovl_En_Part/z_en_part.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" #include "assets/objects/object_bdoor/object_bdoor.h" -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" +#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.0:0" \ + "ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" CollisionPoly* sCurCeilingPoly; s32 sCurCeilingBgId; @@ -571,7 +594,7 @@ void Attention_Update(Attention* attention, Player* player, Actor* playerFocusAc attention->reticleFadeAlphaControl = 0; } - lockOnSfxId = CHECK_FLAG_ALL(playerFocusActor->flags, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE) + lockOnSfxId = ACTOR_FLAGS_CHECK_ALL(playerFocusActor, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE) ? NA_SE_SY_LOCK_ON : NA_SE_SY_LOCK_ON_HUMAN; Sfx_PlaySfxCentered(lockOnSfxId); @@ -907,7 +930,7 @@ void Actor_SetScale(Actor* actor, f32 scale) { } void Actor_SetObjectDependency(PlayState* play, Actor* actor) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[actor->objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[actor->objectSlot].segment); } void Actor_Init(Actor* actor, PlayState* play) { @@ -2314,8 +2337,8 @@ void Actor_InitContext(PlayState* play, ActorContext* actorCtx, ActorEntry* play bzero(actorCtx, sizeof(ActorContext)); ActorOverlayTable_Init(); - Matrix_MtxFCopy(&play->billboardMtxF, &gMtxFClear); - Matrix_MtxFCopy(&play->viewProjectionMtxF, &gMtxFClear); + Matrix_MtxFCopy(&play->billboardMtxF, &gIdentityMtxF); + Matrix_MtxFCopy(&play->viewProjectionMtxF, &gIdentityMtxF); overlayEntry = &gActorOverlayTable[0]; for (i = 0; i < ARRAY_COUNT(gActorOverlayTable); i++) { @@ -2835,7 +2858,20 @@ s32 Actor_CullingVolumeTest(PlayState* play, Actor* actor, Vec3f* projPos, f32 p return false; } -void func_800315AC(PlayState* play, ActorContext* actorCtx) { +/** + * Iterates through all category lists to draw every actor. + * + * In addition to actors, this function also draws: + * - Effects + * - EffectSs + * - Title Cards + * - Farores Wind Pointer + * - Light glow + * - Actor Collision (debug only) + * + * Note: If an actor is made visible by Lens of Truth, it will be drawn by `Actor_DrawLensActors` instead. + */ +void Actor_DrawAll(PlayState* play, ActorContext* actorCtx) { s32 invisibleActorCounter; Actor* invisibleActors[INVISIBLE_ACTOR_MAX]; ActorListEntry* actorListEntry; @@ -3430,9 +3466,9 @@ void Attention_FindActorInCategory(PlayState* play, ActorContext* actorCtx, Play while (actor != NULL) { if ((actor->update != NULL) && ((Player*)actor != player) && - CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_ATTENTION_ENABLED)) { + ACTOR_FLAGS_CHECK_ALL(actor, ACTOR_FLAG_ATTENTION_ENABLED)) { if ((actorCategory == ACTORCAT_ENEMY) && - CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE) && + ACTOR_FLAGS_CHECK_ALL(actor, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE) && (actor->xyzDistToPlayerSq < SQ(500.0f)) && (actor->xyzDistToPlayerSq < sBgmEnemyDistSq)) { actorCtx->attention.bgmEnemy = actor; sBgmEnemyDistSq = actor->xyzDistToPlayerSq; diff --git a/src/code/z_actor_dlftbls.c b/src/code/z_actor_dlftbls.c index 52d8ad8556..1e3c6c96ba 100644 --- a/src/code/z_actor_dlftbls.c +++ b/src/code/z_actor_dlftbls.c @@ -1,5 +1,7 @@ -#include "global.h" #include "fault.h" +#include "printf.h" +#include "segment_symbols.h" +#include "z_actor_dlftbls.h" // Linker symbol declarations (used in the table below) #define DEFINE_ACTOR(name, _1, _2, _3) DECLARE_OVERLAY_SEGMENT(name) diff --git a/src/code/z_bg_collect.c b/src/code/z_bg_collect.c index bd349765de..68966b74fc 100644 --- a/src/code/z_bg_collect.c +++ b/src/code/z_bg_collect.c @@ -1,5 +1,11 @@ -#include "global.h" +#include "printf.h" #include "terminal.h" +#include "translation.h" +#include "ultra64.h" +#include "z64actor.h" +#include "z64bgcheck.h" +#include "z64player.h" +#include "z64skin_matrix.h" /** * Update the `carriedActor`'s position based on the dynapoly actor identified by `bgId`. @@ -76,7 +82,7 @@ void func_80043334(CollisionContext* colCtx, Actor* actor, s32 bgId) { if (dynaActor != NULL) { DynaPolyActor_SetActorOnTop(dynaActor); - if (CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_CAN_PRESS_SWITCHES)) { + if (ACTOR_FLAGS_CHECK_ALL(actor, ACTOR_FLAG_CAN_PRESS_SWITCHES)) { DynaPolyActor_SetSwitchPressed(dynaActor); } } diff --git a/src/code/z_bg_item.c b/src/code/z_bg_item.c index 1a4d9f58d5..43c32eb558 100644 --- a/src/code/z_bg_item.c +++ b/src/code/z_bg_item.c @@ -1,4 +1,7 @@ -#include "global.h" +#include "z_lib.h" +#include "z64actor.h" +#include "z64bgcheck.h" +#include "z64play.h" /** * @param transformFlags How other actors standing on the dynapoly actor's collision move when the dynapoly actor moves. diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index a134591925..945051552a 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -1,8 +1,20 @@ -#include "global.h" -#include "terminal.h" +#include "libu64/debug.h" +#include "array_count.h" +#include "attributes.h" #include "line_numbers.h" +#include "printf.h" +#include "regs.h" +#include "segmented_address.h" +#include "sys_math3d.h" +#include "terminal.h" +#include "translation.h" +#include "z_lib.h" +#include "z64bgcheck.h" +#include "z64play.h" +#include "z64player.h" +#include "z64skin_matrix.h" -#pragma increment_block_number "ntsc-1.0:108 ntsc-1.1:104 ntsc-1.2:104" +#pragma increment_block_number "ntsc-1.0:152 ntsc-1.1:152 ntsc-1.2:152" u16 DynaSSNodeList_GetNextNodeIdx(DynaSSNodeList* nodeList); void BgCheck_GetStaticLookupIndicesFromPos(CollisionContext* colCtx, Vec3f* pos, Vec3i* sector); diff --git a/src/code/z_camera.c b/src/code/z_camera.c index dda1f5ea30..cf18c3634a 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -1,7 +1,29 @@ -#include "ultra64.h" -#include "global.h" +#include "libc64/math64.h" +#include "libc64/qrand.h" +#include "array_count.h" +#include "attributes.h" +#include "controller.h" +#include "db_camera.h" +#include "gfx.h" +#include "letterbox.h" +#include "one_point_cutscene.h" #include "quake.h" +#include "printf.h" +#include "regs.h" +#include "sfx.h" +#include "sys_math3d.h" #include "terminal.h" +#include "translation.h" +#include "ultra64.h" +#include "z_lib.h" +#include "zelda_arena.h" +#include "z64audio.h" +#include "z64cutscene_spline.h" +#include "z64debug.h" +#include "z64olib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" #include "overlays/actors/ovl_En_Horse/z_en_horse.h" #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ @@ -3639,7 +3661,7 @@ s32 Camera_KeepOn3(Camera* camera) { } #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ique-cn:128 ntsc-1.0:124 ntsc-1.1:124 ntsc-1.2:124 pal-1.0:122 pal-1.1:122" + "ique-cn:128 ntsc-1.0:86 ntsc-1.1:86 ntsc-1.2:86 pal-1.0:86 pal-1.1:86" s32 Camera_KeepOn4(Camera* camera) { static Vec3f D_8015BD50; @@ -7532,7 +7554,7 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, PlayState #if DEBUG_FEATURES sDbgModeIdx = -1; #endif - D_8011D3F0 = 3; + sSceneInitLetterboxTimer = 3; // show letterbox for 3 frames at the start of a new scene PRINTF(VT_FGCOL(BLUE) "camera: initialize --- " VT_RST " UID %d\n", camera->uid); } @@ -8141,8 +8163,8 @@ Vec3s Camera_Update(Camera* camera) { if ((gSaveContext.gameMode != GAMEMODE_NORMAL) && (gSaveContext.gameMode != GAMEMODE_END_CREDITS)) { sCameraInterfaceField = CAM_INTERFACE_FIELD(CAM_LETTERBOX_NONE, CAM_HUD_VISIBILITY_ALL, 0); Camera_UpdateInterface(sCameraInterfaceField); - } else if ((D_8011D3F0 != 0) && (camera->camId == CAM_ID_MAIN)) { - D_8011D3F0--; + } else if ((sSceneInitLetterboxTimer != 0) && (camera->camId == CAM_ID_MAIN)) { + sSceneInitLetterboxTimer--; sCameraInterfaceField = CAM_INTERFACE_FIELD(CAM_LETTERBOX_LARGE, CAM_HUD_VISIBILITY_NOTHING_ALT, 0); Camera_UpdateInterface(sCameraInterfaceField); } else if (camera->play->transitionMode != TRANS_MODE_OFF) { diff --git a/src/code/z_camera_data.inc.c b/src/code/z_camera_data.inc.c index fece55ea3d..9a9795f453 100644 --- a/src/code/z_camera_data.inc.c +++ b/src/code/z_camera_data.inc.c @@ -1,5 +1,5 @@ +#include "array_count.h" #include "ultra64.h" -#include "global.h" typedef struct CameraModeValue { s16 val; @@ -2584,7 +2584,7 @@ s16 D_8011D3CC[] = { s32 sUpdateCameraDirection = 0; s32 D_8011D3EC = 0; -s32 D_8011D3F0 = 0; +s32 sSceneInitLetterboxTimer = 0; s32 sDemo5PrevAction12Frame = -16; diff --git a/src/code/z_cheap_proc.inc.c b/src/code/z_cheap_proc.inc.c index 059f67c02b..e922c0832c 100644 --- a/src/code/z_cheap_proc.inc.c +++ b/src/code/z_cheap_proc.inc.c @@ -1,4 +1,7 @@ -#include "global.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sys_matrix.h" +#include "z64play.h" void Gfx_DrawDListOpa(PlayState* play, Gfx* dlist) { OPEN_DISPS(play->state.gfxCtx, "../z_cheap_proc.c", 214); diff --git a/src/code/z_collision_btltbls.c b/src/code/z_collision_btltbls.c index 1039371f7a..5c2a210bcc 100644 --- a/src/code/z_collision_btltbls.c +++ b/src/code/z_collision_btltbls.c @@ -1,4 +1,7 @@ -#include "global.h" +#include "array_count.h" +#include "printf.h" +#include "translation.h" +#include "z64collision_check.h" static DamageTable sDamageTablePresets[] = { { { diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 8af30ac7ff..dcf07766e6 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -1,10 +1,11 @@ #include "gfx.h" -#include "macros.h" +#include "printf.h" #include "regs.h" #include "sfx.h" #include "sys_math3d.h" #include "sys_matrix.h" #include "terminal.h" +#include "translation.h" #include "versions.h" #include "z64collision_check.h" #include "z64effect.h" @@ -15,8 +16,8 @@ #include "overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.h" #include "z_lib.h" -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ique-cn:128 ntsc-1.0:96 ntsc-1.1:96 ntsc-1.2:96 pal-1.0:96 pal-1.1:96" +#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ + "ique-cn:192 ntsc-1.0:168 ntsc-1.1:168 ntsc-1.2:168 pal-1.0:168 pal-1.1:168" typedef s32 (*ColChkResetFunc)(PlayState*, Collider*); typedef void (*ColChkApplyFunc)(PlayState*, CollisionCheckContext*, Collider*); @@ -46,7 +47,7 @@ void Collider_DrawPoly(GraphicsContext* gfxCtx, Vec3f* vA, Vec3f* vB, Vec3f* vC, OPEN_DISPS(gfxCtx, "../z_collision_check.c", 713); - gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_OPA_DISP++, 0x00, 0xFF, r, g, b, 50); gDPPipeSync(POLY_OPA_DISP++); gDPSetRenderMode(POLY_OPA_DISP++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2); diff --git a/src/code/z_common_data.c b/src/code/z_common_data.c index d5322bbd4f..97cb44a4f0 100644 --- a/src/code/z_common_data.c +++ b/src/code/z_common_data.c @@ -1,9 +1,14 @@ -#include "global.h" +#include "alignment.h" #include "region.h" +#include "sequence.h" #include "versions.h" +#include "z_locale.h" +#include "z64environment.h" +#include "z64save.h" +#include "z64transition.h" -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.0:176 ntsc-1.1:176 ntsc-1.2:176 pal-1.0:160 pal-1.1:160" +#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ + "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" ALIGNED(16) SaveContext gSaveContext; #if PLATFORM_IQUE diff --git a/src/code/z_construct.c b/src/code/z_construct.c index b170884579..7561953684 100644 --- a/src/code/z_construct.c +++ b/src/code/z_construct.c @@ -1,5 +1,14 @@ -#include "global.h" +#include "map.h" +#include "printf.h" +#include "regs.h" +#include "segment_symbols.h" +#include "translation.h" #include "versions.h" +#include "z64lifemeter.h" +#include "z64interface.h" +#include "z64ocarina.h" +#include "z64play.h" +#include "z64save.h" void Interface_Destroy(PlayState* play) { Map_Destroy(play); diff --git a/src/code/z_cutscene_spline.c b/src/code/z_cutscene_spline.c index 421f9a2809..137f9f544c 100644 --- a/src/code/z_cutscene_spline.c +++ b/src/code/z_cutscene_spline.c @@ -1,4 +1,7 @@ -#include "global.h" +#include "ultra64.h" +#include "z64math.h" +#include "z64camera.h" +#include "z64cutscene_spline.h" // The code in this file is very similar to a spline system used in Super Mario 64 for cutscene camera movement diff --git a/src/code/z_debug.c b/src/code/z_debug.c index 957b0364c3..af3c945b76 100644 --- a/src/code/z_debug.c +++ b/src/code/z_debug.c @@ -1,4 +1,15 @@ -#include "global.h" +#include "libc64/malloc.h" +#include "libu64/gfxprint.h" +#include "libu64/pad.h" +#include "array_count.h" +#include "color.h" +#include "controller.h" +#include "gfx.h" +#include "gfxalloc.h" +#include "regs.h" +#include "rumble.h" +#include "ultra64.h" +#include "z64debug.h" #pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0" @@ -14,8 +25,8 @@ typedef struct InputCombo { /* 0x2 */ u16 press; } InputCombo; // size = 0x4 -#pragma increment_block_number "gc-eu:160 gc-eu-mq:160 gc-jp:160 gc-jp-ce:160 gc-jp-mq:160 gc-us:160 gc-us-mq:160" \ - "ique-cn:128 ntsc-1.0:160 ntsc-1.1:160 ntsc-1.2:160 pal-1.0:160 pal-1.1:160" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:0" \ + "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" RegEditor* gRegEditor; diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 6e35b82554..d5135b99d1 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -1,11 +1,34 @@ #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" -#include "global.h" -#include "quake.h" -#include "z64camera.h" + "ique-cn:128 ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" + +#include "libu64/gfxprint.h" +#include "array_count.h" +#include "controller.h" +#include "gfx.h" +#include "gfxalloc.h" +#include "letterbox.h" +#include "memory_utils.h" #if PLATFORM_N64 #include "n64dd.h" #endif +#include "printf.h" +#include "regs.h" +#include "rumble.h" +#include "quake.h" +#include "segmented_address.h" +#include "seqcmd.h" +#include "sequence.h" +#include "sfx.h" +#include "translation.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64camera.h" +#include "z64cutscene.h" +#include "z64cutscene_flags.h" +#include "z64ocarina.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" #include "assets/scenes/indoors/tokinoma/tokinoma_scene.h" @@ -126,8 +149,8 @@ u16 gCamAtSplinePointsAppliedFrame; u16 gCamEyePointAppliedFrame; u16 gCamAtPointAppliedFrame; -#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:188 gc-jp-ce:188 gc-jp-mq:0 gc-us:188 gc-us-mq:0" \ - "ntsc-1.0:128 ntsc-1.1:80 ntsc-1.2:80 pal-1.0:80 pal-1.1:80" +#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ + "ique-cn:128 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" // Cam ID to return to when a scripted cutscene is finished s16 sReturnToCamId; diff --git a/src/code/z_eff_blure.c b/src/code/z_eff_blure.c index 212f5ee7df..6e2023b67d 100644 --- a/src/code/z_eff_blure.c +++ b/src/code/z_eff_blure.c @@ -1,4 +1,14 @@ -#include "global.h" +#include "libc64/math64.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "sys_math3d.h" +#include "sys_matrix.h" +#include "translation.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64skin_matrix.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2) { @@ -805,7 +815,7 @@ void EffectBlure_DrawSimpleVertices(GraphicsContext* gfxCtx, EffectBlure* this, gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPVertex(POLY_XLU_DISP++, &vtx[4 * i], 4, 0); gSP2Triangles(POLY_XLU_DISP++, 0, 1, 3, 0, 0, 3, 2, 0); - gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); } } } @@ -932,7 +942,7 @@ void EffectBlure_Draw(void* thisx, GraphicsContext* gfxCtx) { OPEN_DISPS(gfxCtx, "../z_eff_blure.c", 1596); - gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->numElements != 0) { if (this->flags == 0) { diff --git a/src/code/z_eff_shield_particle.c b/src/code/z_eff_shield_particle.c index 74cd6a435a..865bd8ec93 100644 --- a/src/code/z_eff_shield_particle.c +++ b/src/code/z_eff_shield_particle.c @@ -1,5 +1,15 @@ -#include "global.h" +#include "libc64/qrand.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" #include "terminal.h" +#include "translation.h" +#include "z64effect.h" +#include "z64light.h" +#include "z64play.h" +#include "z64skin_matrix.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" static Vtx sVertices[5] = { diff --git a/src/code/z_eff_spark.c b/src/code/z_eff_spark.c index a997caa129..57ce3d9ba1 100644 --- a/src/code/z_eff_spark.c +++ b/src/code/z_eff_spark.c @@ -1,4 +1,14 @@ -#include "global.h" +#include "libc64/qrand.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "sys_matrix.h" +#include "translation.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64skin_matrix.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" // original name: "spark" @@ -154,7 +164,7 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) { OPEN_DISPS(gfxCtx, "../z_eff_spark.c", 293); if (this != NULL) { - gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_38); gDPSetCycleType(POLY_XLU_DISP++, G_CYC_2CYCLE); diff --git a/src/code/z_eff_ss_dead.c b/src/code/z_eff_ss_dead.c index 2a64a23f4a..c752738725 100644 --- a/src/code/z_eff_ss_dead.c +++ b/src/code/z_eff_ss_dead.c @@ -1,4 +1,6 @@ -#include "global.h" +#include "gfx.h" +#include "z_lib.h" +#include "z64play.h" void func_80026230(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3) { f32 cos; diff --git a/src/code/z_effect.c b/src/code/z_effect.c index ac2141db0b..c0a39cc4bd 100644 --- a/src/code/z_effect.c +++ b/src/code/z_effect.c @@ -1,6 +1,9 @@ -#include "global.h" - +#include "gfx.h" +#include "printf.h" +#include "translation.h" +#include "z64effect.h" #include "z64frame_advance.h" +#include "z64play.h" EffectContext sEffectContext; diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c index 9a3df7eef3..061b6d70da 100644 --- a/src/code/z_effect_soft_sprite.c +++ b/src/code/z_effect_soft_sprite.c @@ -1,7 +1,13 @@ -#include "global.h" +#include "libu64/overlay.h" +#include "array_count.h" +#include "printf.h" +#include "sfx.h" #include "terminal.h" - +#include "translation.h" +#include "zelda_arena.h" #include "z64frame_advance.h" +#include "z64effect.h" +#include "z64play.h" EffectSsInfo sEffectSsInfo = { 0 }; // "EffectSS2Info" diff --git a/src/code/z_effect_soft_sprite_dlftbls.c b/src/code/z_effect_soft_sprite_dlftbls.c index cb24257c87..7c9e228f63 100644 --- a/src/code/z_effect_soft_sprite_dlftbls.c +++ b/src/code/z_effect_soft_sprite_dlftbls.c @@ -1,4 +1,5 @@ -#include "global.h" +#include "segment_symbols.h" +#include "z64effect.h" // Linker symbol declarations (used in the table below) #define DEFINE_EFFECT_SS(name, _1) DECLARE_OVERLAY_SEGMENT(name) diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c index 253996b625..1654ab3d0d 100644 --- a/src/code/z_effect_soft_sprite_old_init.c +++ b/src/code/z_effect_soft_sprite_old_init.c @@ -1,4 +1,17 @@ -#include "global.h" +#include "libc64/qrand.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "rand.h" +#include "regs.h" +#include "segmented_address.h" +#include "sfx.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64skin_matrix.h" + #include "overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.h" #include "overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.h" #include "overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.h" @@ -58,7 +71,7 @@ void EffectSs_DrawGEffect(PlayState* play, EffectSs* this, void* texture) { SkinMatrix_SetScale(&mfScale, scale, scale, scale); SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard); SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfScale, &mfResult); - gSegments[6] = VIRTUAL_TO_PHYSICAL(objectPtr); + gSegments[6] = OS_K0_TO_PHYSICAL(objectPtr); gSPSegment(POLY_XLU_DISP++, 0x06, objectPtr); mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult); diff --git a/src/code/z_elf_message.c b/src/code/z_elf_message.c index c90b4ee6f4..bb93099363 100644 --- a/src/code/z_elf_message.c +++ b/src/code/z_elf_message.c @@ -1,5 +1,10 @@ -#include "global.h" +#include "libu64/debug.h" +#include "rand.h" +#include "z64play.h" +#include "z64player.h" +#include "z64quest_hint.h" #include "z64quest_hint_commands.h" +#include "z64save.h" QuestHintCmd sChildSariaQuestHints[] = { QUEST_HINT_STRENGTH_UPG(SKIP, 0, false, 3), diff --git a/src/code/z_en_a_keep.c b/src/code/z_en_a_keep.c index 23d77075dd..9b2bf7c0b7 100644 --- a/src/code/z_en_a_keep.c +++ b/src/code/z_en_a_keep.c @@ -1,4 +1,11 @@ -#include "global.h" +#include "z_en_a_obj.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_d_hsblock/object_d_hsblock.h" diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index e91f09ac0e..f0c627b250 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -17,11 +17,12 @@ #include "z64item.h" #include "z64play.h" #include "z64player.h" +#include "z64save.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-eu-mq-dbg:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128" \ - "gc-us-mq:128 ntsc-1.2:128" + "gc-us-mq:128 ique-cn:128 ntsc-1.0:128 ntsc-1.2:128" #define FLAGS 0 diff --git a/src/code/z_env_flags.c b/src/code/z_env_flags.c index d277a5f752..164ff1dde4 100644 --- a/src/code/z_env_flags.c +++ b/src/code/z_env_flags.c @@ -1,4 +1,6 @@ +#include "array_count.h" #include "ultra64.h" +#include "z64cutscene_flags.h" #include "z64play.h" void CutsceneFlags_UnsetAll(PlayState* play) { diff --git a/src/code/z_face_reaction.c b/src/code/z_face_reaction.c index 9864944b1c..ea6313a762 100644 --- a/src/code/z_face_reaction.c +++ b/src/code/z_face_reaction.c @@ -1,4 +1,6 @@ -#include "global.h" +#include "ultra64.h" +#include "z64face_reaction.h" +#include "z64player.h" u16 sMaskReactionSetTextIds[MASK_REACTION_SET_MAX][PLAYER_MASK_MAX] = { // MASK_REACTION_SET_CARPENTER_BOSS @@ -182,7 +184,7 @@ u16 sMaskReactionSetTextIds[MASK_REACTION_SET_MAX][PLAYER_MASK_MAX] = { { 0x0000, 0x7104, 0x7105, 0x7107, 0x7105, 0x710C, 0x7105, 0x7107, 0x7107 }, }; -u16 MaskReaction_GetTextId(PlayState* play, u32 maskReactionSet) { +u16 MaskReaction_GetTextId(struct PlayState* play, u32 maskReactionSet) { u8 currentMask = Player_GetMask(play); return sMaskReactionSetTextIds[maskReactionSet][currentMask]; diff --git a/src/code/z_fbdemo.c b/src/code/z_fbdemo.c index a2b0fb8bf1..2621f1c129 100644 --- a/src/code/z_fbdemo.c +++ b/src/code/z_fbdemo.c @@ -9,7 +9,15 @@ * @note The only coded effect has a visual effect to blend the tiles to a single point, which looks like the screen * gets sucked into. */ -#include "global.h" +#include "transition_tile.h" + +#include "libc64/malloc.h" +#include "libc64/sleep.h" +#include "libu64/debug.h" +#include "gfx.h" +#include "printf.h" +#include "z64math.h" +#include "z64transition_instances.h" // color framebuffer extern u16 D_0F000000[]; diff --git a/src/code/z_fbdemo_circle.c b/src/code/z_fbdemo_circle.c index 59f019e952..d8aa81df06 100644 --- a/src/code/z_fbdemo_circle.c +++ b/src/code/z_fbdemo_circle.c @@ -1,4 +1,9 @@ -#include "global.h" +#include "transition_circle.h" + +#include "color.h" +#include "gfx.h" +#include "sfx.h" +#include "z64transition.h" typedef enum TransitionCircleDirection { /* 0 */ TRANS_CIRCLE_DIR_IN, @@ -10,34 +15,7 @@ Gfx sTransCircleEmptyDL[] = { gsSPEndDisplayList(), }; -#include "assets/code/fbdemo_circle/z_fbdemo_circle.c" - -Gfx sTransCircleDL[] = { - gsDPPipeSync(), - gsSPClearGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | - G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH), - gsSPSetGeometryMode(G_SHADE | G_SHADING_SMOOTH), - gsDPSetOtherMode(G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | - G_TD_CLAMP | G_TP_PERSP | G_CYC_1CYCLE | G_PM_NPRIMITIVE, - G_AC_NONE | G_ZS_PIXEL | G_RM_XLU_SURF | G_RM_XLU_SURF2), - gsDPSetCombineMode(G_CC_BLENDPEDECALA, G_CC_BLENDPEDECALA), - gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON), - gsDPLoadTextureBlock(0x08000000, G_IM_FMT_I, G_IM_SIZ_8b, 16, 64, 0, G_TX_NOMIRROR | G_TX_WRAP, - G_TX_NOMIRROR | G_TX_CLAMP, 4, 6, G_TX_NOLOD, G_TX_NOLOD), - gsSPDisplayList(0x09000000), - gsSPVertex(sTransCircleVtx, 32, 0), - gsSP2Triangles(0, 1, 2, 0, 1, 3, 4, 0), - gsSP2Triangles(3, 5, 6, 0, 5, 7, 8, 0), - gsSP2Triangles(7, 9, 10, 0, 9, 11, 12, 0), - gsSP2Triangles(11, 13, 14, 0, 13, 15, 16, 0), - gsSP2Triangles(15, 17, 18, 0, 17, 19, 20, 0), - gsSP2Triangles(19, 21, 22, 0, 21, 23, 24, 0), - gsSP2Triangles(23, 25, 26, 0, 25, 27, 28, 0), - gsSP1Triangle(27, 29, 30, 0), - gsSPVertex(&sTransCircleVtx[31], 3, 0), - gsSP1Triangle(0, 1, 2, 0), - gsSPEndDisplayList(), -}; +#include "assets/code/fbdemo_circle/code.c" void TransitionCircle_Start(void* thisx) { TransitionCircle* this = (TransitionCircle*)thisx; diff --git a/src/code/z_fbdemo_fade.c b/src/code/z_fbdemo_fade.c index d2cb382f05..1be97d5f51 100644 --- a/src/code/z_fbdemo_fade.c +++ b/src/code/z_fbdemo_fade.c @@ -1,5 +1,13 @@ -#include "global.h" +#include "transition_fade.h" + +#include "main.h" +#include "printf.h" +#include "regs.h" #include "terminal.h" +#include "translation.h" +#include "z_lib.h" +#include "z64save.h" +#include "z64transition_instances.h" typedef enum TransitionFadeDirection { /* 0 */ TRANS_FADE_DIR_IN, diff --git a/src/code/z_fbdemo_triforce.c b/src/code/z_fbdemo_triforce.c index 7bb8862b2d..6624a4373c 100644 --- a/src/code/z_fbdemo_triforce.c +++ b/src/code/z_fbdemo_triforce.c @@ -1,6 +1,10 @@ -#include "global.h" +#include "transition_triforce.h" -#include "assets/code/fbdemo_triforce/z_fbdemo_triforce.c" +#include "printf.h" +#include "z64math.h" +#include "z64transition_instances.h" + +#include "assets/code/fbdemo_triforce/code.c" void TransitionTriforce_Start(void* thisx) { TransitionTriforce* this = (TransitionTriforce*)thisx; diff --git a/src/code/z_fbdemo_wipe1.c b/src/code/z_fbdemo_wipe1.c index e008f68613..25b45e7e2c 100644 --- a/src/code/z_fbdemo_wipe1.c +++ b/src/code/z_fbdemo_wipe1.c @@ -1,39 +1,15 @@ -#include "global.h" +#include "transition_wipe.h" + +#include "gfx.h" +#include "z64save.h" +#include "z64transition_instances.h" typedef enum TransitionWipeDirection { /* 0 */ TRANS_WIPE_DIR_IN, /* 1 */ TRANS_WIPE_DIR_OUT } TransitionWipeDirection; -#include "assets/code/fbdemo_wipe1/z_fbdemo_wipe1.c" - -Gfx sTransWipeDL[] = { - gsDPPipeSync(), - gsSPClearGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | - G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH), - gsSPSetGeometryMode(G_ZBUFFER | G_SHADE | G_SHADING_SMOOTH), - gsDPSetOtherMode(G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | - G_TD_CLAMP | G_TP_PERSP | G_CYC_2CYCLE | G_PM_1PRIMITIVE, - G_AC_NONE | G_ZS_PRIM | G_RM_PASS | G_RM_AA_ZB_TEX_EDGE2), - gsDPSetCombineLERP(TEXEL1, TEXEL0, PRIM_LOD_FRAC, TEXEL0, TEXEL1, TEXEL0, PRIM_LOD_FRAC, TEXEL0, COMBINED, 0, - PRIMITIVE, 0, COMBINED, 0, PRIMITIVE, 0), - gsDPSetPrimDepth(0, 0), - gsDPLoadTextureBlock_4b(sTransWipeTex, G_IM_FMT_I, 64, 64, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_MIRROR | G_TX_WRAP, 6, - 6, 11, G_TX_NOLOD), - gsDPLoadMultiBlock_4b(sTransWipeTex, 0x0100, 1, G_IM_FMT_I, 64, 64, 0, G_TX_NOMIRROR | G_TX_WRAP, - G_TX_MIRROR | G_TX_WRAP, 6, 6, 11, 1), - gsDPSetTextureLUT(G_TT_NONE), - gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON), - gsSPDisplayList(0x08000000), - gsSPVertex(sTransWipeVtx, 25, 0), - gsSP2Triangles(0, 1, 2, 0, 1, 3, 4, 0), - gsSP2Triangles(5, 6, 7, 0, 6, 8, 9, 0), - gsSP2Triangles(8, 10, 11, 0, 10, 12, 13, 0), - gsSP2Triangles(12, 14, 15, 0, 14, 16, 17, 0), - gsSP2Triangles(16, 18, 19, 0, 18, 20, 21, 0), - gsSP2Triangles(20, 22, 23, 0, 22, 0, 24, 0), - gsSPEndDisplayList(), -}; +#include "assets/code/fbdemo_wipe1/code.c" // unused. Gfx sTransWipeSyncDL[] = { diff --git a/src/code/z_fcurve_data.c b/src/code/z_fcurve_data.c index a1c03a9278..a1950a568b 100644 --- a/src/code/z_fcurve_data.c +++ b/src/code/z_fcurve_data.c @@ -2,7 +2,6 @@ * File: z_fcurve_data.c * Description: Interpolation functions for use with Curve SkelAnime */ -#include "global.h" #include "z64curve.h" #define FCURVE_INTERP_CUBIC 0 // Interpolate using a Hermite cubic spline diff --git a/src/code/z_fcurve_data_skelanime.c b/src/code/z_fcurve_data_skelanime.c index 1086adb2ec..e5d1f1fbb3 100644 --- a/src/code/z_fcurve_data_skelanime.c +++ b/src/code/z_fcurve_data_skelanime.c @@ -25,8 +25,16 @@ * - higher detail draws both. */ -#include "global.h" +#include "gfx.h" +#include "printf.h" +#include "regs.h" +#include "segmented_address.h" +#include "sys_matrix.h" +#include "translation.h" +#include "zelda_arena.h" +#include "z64actor.h" #include "z64curve.h" +#include "z64play.h" void SkelCurve_Clear(SkelCurve* skelCurve) { skelCurve->limbCount = 0; diff --git a/src/code/z_frame_advance.c b/src/code/z_frame_advance.c index 486717a50f..6ca410a759 100644 --- a/src/code/z_frame_advance.c +++ b/src/code/z_frame_advance.c @@ -3,8 +3,7 @@ #include "stdbool.h" #include "controller.h" -#include "padmgr.h" -#include "macros.h" +#include "libu64/pad.h" void FrameAdvance_Init(FrameAdvanceContext* frameAdvCtx) { frameAdvCtx->timer = 0; diff --git a/src/code/z_game_dlftbls.c b/src/code/z_game_dlftbls.c index 2cad84089d..57efe90dfc 100644 --- a/src/code/z_game_dlftbls.c +++ b/src/code/z_game_dlftbls.c @@ -1,4 +1,11 @@ -#include "global.h" +#include "segment_symbols.h" +#include "console_logo_state.h" +#include "file_select_state.h" +#include "map_select_state.h" +#include "setup_state.h" +#include "title_setup_state.h" +#include "z_game_dlftbls.h" +#include "z64play.h" // Linker symbol declarations (used in the table below) #define DEFINE_GAMESTATE(typeName, enumName, name) DECLARE_OVERLAY_SEGMENT(name) diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index f0390a9611..f73616116d 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -1,7 +1,12 @@ -#include "z64game_over.h" - -#include "global.h" +#include "array_count.h" +#include "letterbox.h" +#include "regs.h" +#include "rumble.h" +#include "sequence.h" #include "versions.h" +#include "z64game_over.h" +#include "z64play.h" +#include "z64save.h" void GameOver_Init(PlayState* play) { play->gameOverCtx.state = GAMEOVER_INACTIVE; diff --git a/src/code/z_horse.c b/src/code/z_horse.c index f6f55c9d06..d61af32e7e 100644 --- a/src/code/z_horse.c +++ b/src/code/z_horse.c @@ -1,10 +1,14 @@ +#include "array_count.h" #include "terminal.h" #include "z_lib.h" +#include "printf.h" #include "regs.h" +#include "translation.h" #include "z64horse.h" #include "z64play.h" #include "z64player.h" -#include "src/overlays/actors/ovl_En_Horse/z_en_horse.h" +#include "z64save.h" +#include "overlays/actors/ovl_En_Horse/z_en_horse.h" /** * Tests if the player horse can be spawned diff --git a/src/code/z_inventory.c b/src/code/z_inventory.c index 2f89c0565b..c31d4d926f 100644 --- a/src/code/z_inventory.c +++ b/src/code/z_inventory.c @@ -1,4 +1,10 @@ -#include "global.h" +#include "ultra64.h" +#include "printf.h" +#include "translation.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/textures/icon_item_static/icon_item_static.h" #include "assets/textures/icon_item_24_static/icon_item_24_static.h" #include "assets/textures/parameter_static/parameter_static.h" diff --git a/src/code/z_jpeg.c b/src/code/z_jpeg.c index 86a97183aa..4413e8ae69 100644 --- a/src/code/z_jpeg.c +++ b/src/code/z_jpeg.c @@ -1,5 +1,13 @@ -#include "global.h" +#include "jpeg.h" + +#include "array_count.h" +#include "attributes.h" +#include "gfx.h" +#include "printf.h" +#include "sys_ucode.h" #include "terminal.h" +#include "translation.h" +#include "ultra64.h" #define MARKER_ESCAPE 0x00 #define MARKER_SOI 0xD8 @@ -40,12 +48,12 @@ void Jpeg_ScheduleDecoderTask(JpegContext* ctx) { JpegWork* workBuf = ctx->workBuf; s32 pad[2]; - workBuf->taskData.address = VIRTUAL_TO_PHYSICAL(&workBuf->data); + workBuf->taskData.address = OS_K0_TO_PHYSICAL(&workBuf->data); workBuf->taskData.mode = ctx->mode; workBuf->taskData.mbCount = 4; - workBuf->taskData.qTableYPtr = VIRTUAL_TO_PHYSICAL(&workBuf->qTableY); - workBuf->taskData.qTableUPtr = VIRTUAL_TO_PHYSICAL(&workBuf->qTableU); - workBuf->taskData.qTableVPtr = VIRTUAL_TO_PHYSICAL(&workBuf->qTableV); + workBuf->taskData.qTableYPtr = OS_K0_TO_PHYSICAL(&workBuf->qTableY); + workBuf->taskData.qTableUPtr = OS_K0_TO_PHYSICAL(&workBuf->qTableU); + workBuf->taskData.qTableVPtr = OS_K0_TO_PHYSICAL(&workBuf->qTableV); sJpegTask.t.flags = 0; sJpegTask.t.ucode_boot = SysUcode_GetUCodeBoot(); diff --git a/src/code/z_kaleido_manager.c b/src/code/z_kaleido_manager.c index 42ec59fd0a..d9bca732e5 100644 --- a/src/code/z_kaleido_manager.c +++ b/src/code/z_kaleido_manager.c @@ -1,5 +1,12 @@ -#include "global.h" +#include "libu64/debug.h" +#include "libu64/overlay.h" +#include "array_count.h" +#include "kaleido_manager.h" +#include "printf.h" +#include "segment_symbols.h" #include "terminal.h" +#include "translation.h" +#include "z64play.h" #define KALEIDO_OVERLAY(name, nameString) \ { NULL, ROM_FILE(ovl_##name), _ovl_##name##SegmentStart, _ovl_##name##SegmentEnd, 0, nameString, } diff --git a/src/code/z_kaleido_scope_call.c b/src/code/z_kaleido_scope_call.c index 994c5ac205..2707db8265 100644 --- a/src/code/z_kaleido_scope_call.c +++ b/src/code/z_kaleido_scope_call.c @@ -1,8 +1,14 @@ -#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ - "ique-cn:192 ntsc-1.0:224 ntsc-1.1:224 ntsc-1.2:224 pal-1.0:192 pal-1.1:192" +#pragma increment_block_number "gc-eu:80 gc-eu-mq:80 gc-jp:80 gc-jp-ce:80 gc-jp-mq:80 gc-us:80 gc-us-mq:80 ique-cn:80" \ + "ntsc-1.0:96 ntsc-1.1:96 ntsc-1.2:96 pal-1.0:96 pal-1.1:96" -#include "global.h" +#include "libu64/debug.h" +#include "kaleido_manager.h" +#include "letterbox.h" +#include "printf.h" +#include "regs.h" #include "terminal.h" +#include "translation.h" +#include "z64play.h" void (*sKaleidoScopeUpdateFunc)(PlayState* play); void (*sKaleidoScopeDrawFunc)(PlayState* play); diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 59e1c6d7b7..11109c65bd 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -1,7 +1,13 @@ -#include "global.h" +#include "controller.h" +#include "letterbox.h" #if PLATFORM_N64 #include "n64dd.h" #endif +#include "printf.h" +#include "regs.h" +#include "z64audio.h" +#include "z64play.h" +#include "z64save.h" /* * The following three arrays are effectively unused. diff --git a/src/code/z_kanfont.c b/src/code/z_kanfont.c index fa038276fe..89f5bbd3b7 100644 --- a/src/code/z_kanfont.c +++ b/src/code/z_kanfont.c @@ -1,6 +1,12 @@ -#include "global.h" +#include "kanread.h" #include "message_data_static.h" +#include "printf.h" +#include "segment_symbols.h" +#include "translation.h" #include "versions.h" +#include "z64dma.h" +#include "z64font.h" +#include "z64message.h" /** * Loads a texture from kanji for the requested `character` into the character texture buffer diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 85e1e1ab61..c78fc5de87 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -1,12 +1,36 @@ -#pragma increment_block_number "gc-eu:208 gc-eu-mq:208 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ - "ique-cn:192 ntsc-1.0:208 ntsc-1.1:208 ntsc-1.2:208 pal-1.0:220 pal-1.1:220" +#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ + "ique-cn:128 ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" -#include "global.h" +#include "libc64/qrand.h" +#include "libu64/gfxprint.h" +#include "array_count.h" +#include "buffers.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "gfxalloc.h" #include "ultra64.h" +#include "printf.h" +#include "regs.h" +#include "rumble.h" +#include "segment_symbols.h" +#include "segmented_address.h" +#include "seqcmd.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_math.h" +#include "sys_math3d.h" +#include "sys_matrix.h" #include "terminal.h" +#include "translation.h" #include "versions.h" - +#include "z_lib.h" +#include "z64audio.h" +#include "z64cutscene.h" #include "z64frame_advance.h" +#include "z64environment.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/gameplay_field_keep/gameplay_field_keep.h" @@ -214,8 +238,8 @@ s16 sLightningFlashAlpha; s16 sSunDepthTestX; s16 sSunDepthTestY; -#pragma increment_block_number "gc-eu:240 gc-eu-mq:240 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224" \ - "ique-cn:224 ntsc-1.0:224 ntsc-1.1:224 ntsc-1.2:224 pal-1.0:240 pal-1.1:240" +#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ + "ique-cn:128 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:192 pal-1.1:192" LightNode* sNGameOverLightNode; LightInfo sNGameOverLightInfo; @@ -882,9 +906,9 @@ void Environment_PrintDebugInfo(PlayState* play, Gfx** gfx) { GfxPrint_SetPos(&printer, 22, 6); if (!IS_DAY) { - GfxPrint_Printf(&printer, "%s", "YORU"); // "night" + GfxPrint_Printf(&printer, "%s", T("YORU", "NIGHT")); } else { - GfxPrint_Printf(&printer, "%s", "HIRU"); // "day" + GfxPrint_Printf(&printer, "%s", T("HIRU", "DAY")); } *gfx = GfxPrint_Close(&printer); diff --git a/src/code/z_lib.c b/src/code/z_lib.c index d5f59a2a86..e4d56b8dad 100644 --- a/src/code/z_lib.c +++ b/src/code/z_lib.c @@ -1,8 +1,8 @@ #include "ultra64.h" #include "z_lib.h" #include "ichain.h" +#include "printf.h" #include "regs.h" -#include "macros.h" #include "sys_math.h" #include "rand.h" #include "sfx.h" diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c index efe7b92b83..cab9737ff7 100644 --- a/src/code/z_lifemeter.c +++ b/src/code/z_lifemeter.c @@ -1,4 +1,13 @@ -#include "global.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64lifemeter.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/textures/parameter_static/parameter_static.h" static s16 sHeartsPrimColors[3][3] = { diff --git a/src/code/z_lights.c b/src/code/z_lights.c index 5ee208f705..d0b003f77c 100644 --- a/src/code/z_lights.c +++ b/src/code/z_lights.c @@ -1,4 +1,11 @@ -#include "global.h" +#include "avoid_ub.h" +#include "buffers.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sys_matrix.h" +#include "z64light.h" +#include "z64play.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define LIGHTS_BUFFER_SIZE 32 diff --git a/src/code/z_malloc.c b/src/code/z_malloc.c index eaa1408bf4..513a61b31e 100644 --- a/src/code/z_malloc.c +++ b/src/code/z_malloc.c @@ -1,5 +1,6 @@ -#include "global.h" #include "libc64/os_malloc.h" +#include "printf.h" +#include "translation.h" #define LOG_SEVERITY_NOLOG 0 #define LOG_SEVERITY_ERROR 2 diff --git a/src/code/z_map_data.c b/src/code/z_map_data.c index 24721c6234..502eb43c3c 100644 --- a/src/code/z_map_data.c +++ b/src/code/z_map_data.c @@ -1,4 +1,5 @@ -#include "global.h" +#include "map.h" +#include "z64save.h" static s16 sFloorTexIndexOffset[10][8] = { { 0, 0, 0, 0, 2, 4, 6, 8 }, { 0, 0, 0, 0, 0, 0, 0, 2 }, diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c index c658775da3..e46c70bd10 100644 --- a/src/code/z_map_exp.c +++ b/src/code/z_map_exp.c @@ -1,10 +1,24 @@ -#include "global.h" -#include "terminal.h" -#include "assets/objects/gameplay_keep/gameplay_keep.h" -#include "assets/textures/parameter_static/parameter_static.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "controller.h" +#include "map.h" #if PLATFORM_N64 #include "n64dd.h" #endif +#include "printf.h" +#include "regs.h" +#include "segment_symbols.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "terminal.h" +#include "translation.h" +#include "z64map_mark.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/gameplay_keep/gameplay_keep.h" +#include "assets/textures/parameter_static/parameter_static.h" MapData* gMapData; @@ -356,7 +370,7 @@ void Minimap_DrawCompassIcons(PlayState* play) { if (play->interfaceCtx.minimapAlpha >= 0xAA) { Gfx_SetupDL_42Overlay(play->state.gfxCtx); - gSPMatrix(OVERLAY_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(OVERLAY_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 255); diff --git a/src/code/z_map_mark.c b/src/code/z_map_mark.c index 4d0ab0411b..402d942d66 100644 --- a/src/code/z_map_mark.c +++ b/src/code/z_map_mark.c @@ -1,9 +1,20 @@ -#include "global.h" -#include "terminal.h" -#include "assets/textures/parameter_static/parameter_static.h" +#include "libu64/debug.h" +#include "libu64/overlay.h" +#include "map.h" +#include "printf.h" #if PLATFORM_N64 #include "n64dd.h" #endif +#include "regs.h" +#include "romfile.h" +#include "segment_symbols.h" +#include "terminal.h" +#include "translation.h" +#include "z64map_mark.h" +#include "z64play.h" +#include "z64save.h" + +#include "assets/textures/parameter_static/parameter_static.h" typedef struct MapMarkInfo { /* 0x00 */ void* texture; diff --git a/src/code/z_message.c b/src/code/z_message.c index a2c275b8ea..1d6fee156b 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -1,14 +1,33 @@ -#include "global.h" +#include "libu64/gfxprint.h" +#include "array_count.h" +#include "attributes.h" +#include "controller.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "gfxalloc.h" +#include "language_array.h" +#include "memory_utils.h" #include "message_data_static.h" -#include "terminal.h" -#include "versions.h" -#include "assets/textures/parameter_static/parameter_static.h" #if PLATFORM_N64 #include "n64dd.h" #endif +#include "printf.h" +#include "segment_symbols.h" +#include "sequence.h" +#include "regs.h" +#include "terminal.h" +#include "translation.h" +#include "versions.h" +#include "z64audio.h" +#include "z64ocarina.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" -#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.0:80 ntsc-1.1:80 ntsc-1.2:80 pal-1.0:128 pal-1.1:128" +#include "assets/textures/parameter_static/parameter_static.h" + +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.0:32" \ + "ntsc-1.1:32 ntsc-1.2:32 pal-1.0:0 pal-1.1:0" #if !PLATFORM_IQUE #define MSG_BUF_DECODED (msgCtx->msgBufDecoded) diff --git a/src/code/z_moji.c b/src/code/z_moji.c index c9cbbdda88..e26ce68e7f 100644 --- a/src/code/z_moji.c +++ b/src/code/z_moji.c @@ -2,7 +2,8 @@ * Unused. A very simple utility for drawing text on screen. */ -#include "global.h" +#include "gfx.h" +#include "printf.h" // how big to draw the characters on screen #define DISP_CHAR_WIDTH 8 diff --git a/src/code/z_nulltask.c b/src/code/z_nulltask.c index 1f7dae689e..42ba3d86f9 100644 --- a/src/code/z_nulltask.c +++ b/src/code/z_nulltask.c @@ -1,4 +1,5 @@ -#include "global.h" +#include "ultra64.h" +#include "sched.h" /** * Blocks the current thread until all queued scheduler tasks have completed. diff --git a/src/code/z_olib.c b/src/code/z_olib.c index 298f151e2c..66c767f68b 100644 --- a/src/code/z_olib.c +++ b/src/code/z_olib.c @@ -1,5 +1,6 @@ #include "z64math.h" #include "libc64/math64.h" +#include "z64olib.h" #include "z_lib.h" /** diff --git a/src/code/z_onepointdemo.c b/src/code/z_onepointdemo.c index 04ffc2f463..94c3bc9e11 100644 --- a/src/code/z_onepointdemo.c +++ b/src/code/z_onepointdemo.c @@ -1,7 +1,18 @@ -#include "global.h" +#include "one_point_cutscene.h" + +#include "libc64/math64.h" +#include "libc64/qrand.h" +#include "array_count.h" +#include "printf.h" #include "quake.h" +#include "sfx.h" #include "terminal.h" #include "versions.h" +#include "z_lib.h" +#include "z64olib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" #include "overlays/actors/ovl_En_Sw/z_en_sw.h" static s16 sDisableAttention = false; diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 5b0629047c..1498db0fba 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -1,7 +1,30 @@ -#include "global.h" +#include "array_count.h" +#include "attributes.h" +#include "controller.h" +#include "flag_set.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "language_array.h" +#include "main.h" +#include "map.h" +#include "printf.h" +#include "regs.h" +#include "segment_symbols.h" +#include "segmented_address.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" #include "terminal.h" +#include "translation.h" #include "versions.h" +#include "z64audio.h" +#include "z64lifemeter.h" #include "z64horse.h" +#include "z64ocarina.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/textures/parameter_static/parameter_static.h" #include "assets/textures/do_action_static/do_action_static.h" #include "assets/textures/icon_item_static/icon_item_static.h" @@ -2140,7 +2163,7 @@ void Interface_LoadActionLabel(InterfaceContext* interfaceCtx, u16 action, s16 l DO_ACTION_TEX_SIZE, 0, &interfaceCtx->loadQueue, NULL, "../z_parameter.c", 2145); osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK); } else { - gSegments[7] = VIRTUAL_TO_PHYSICAL(interfaceCtx->doActionSegment); + gSegments[7] = OS_K0_TO_PHYSICAL(interfaceCtx->doActionSegment); func_80086D5C(SEGMENTED_TO_VIRTUAL(sDoActionTextures[loadOffset]), DO_ACTION_TEX_SIZE / 4); } } @@ -3429,7 +3452,7 @@ void Interface_Draw(PlayState* play) { gSPSegment(OVERLAY_DISP++, 0x08, pauseCtx->iconItemSegment); Gfx_SetupDL_42Overlay(play->state.gfxCtx); gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATERGBA_PRIM, G_CC_MODULATERGBA_PRIM); - gSPMatrix(OVERLAY_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(OVERLAY_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); // PAUSE_CURSOR_QUAD_4 pauseCtx->cursorVtx[16].v.ob[0] = pauseCtx->cursorVtx[18].v.ob[0] = pauseCtx->equipAnimX / 10; diff --git a/src/code/z_path.c b/src/code/z_path.c index d27530eb3a..29b51a8f17 100644 --- a/src/code/z_path.c +++ b/src/code/z_path.c @@ -1,4 +1,9 @@ -#include "global.h" +#include "ultra64.h" +#include "libc64/math64.h" +#include "segmented_address.h" +#include "z64actor.h" +#include "z64path.h" +#include "z64play.h" Path* Path_GetByIndex(PlayState* play, s16 index, s16 max) { Path* path; diff --git a/src/code/z_play.c b/src/code/z_play.c index d531a79110..d4d28422c3 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -1,18 +1,54 @@ - -#include "global.h" +#include "libc64/malloc.h" +#include "libc64/qrand.h" +#include "libu64/debug.h" +#include "array_count.h" +#include "buffers.h" +#include "color.h" +#include "controller.h" #include "fault.h" -#include "quake.h" -#include "terminal.h" -#include "versions.h" +#include "file_select_state.h" +#include "gfx.h" +#include "gfxalloc.h" +#include "kaleido_manager.h" +#include "letterbox.h" #include "line_numbers.h" #if PLATFORM_N64 #include "n64dd.h" #endif - +#include "one_point_cutscene.h" +#include "printf.h" +#include "quake.h" +#include "regs.h" +#include "rumble.h" +#include "segmented_address.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_math3d.h" +#include "sys_matrix.h" +#include "terminal.h" +#include "title_setup_state.h" +#include "transition_circle.h" +#include "transition_fade.h" +#include "transition_tile.h" +#include "transition_triforce.h" +#include "transition_wipe.h" +#include "translation.h" +#include "versions.h" +#include "z_actor_dlftbls.h" +#include "zelda_arena.h" +#include "z64audio.h" +#include "z64cutscene_flags.h" #include "z64debug_display.h" +#include "z64effect.h" #include "z64frame_advance.h" +#include "z64light.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" +#include "z64vis.h" -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:224" \ + "ntsc-1.0:240 ntsc-1.1:240 ntsc-1.2:240 pal-1.0:240 pal-1.1:240" TransitionTile gTransitionTile; s32 gTransitionTileState; @@ -301,7 +337,7 @@ void Play_Init(GameState* thisx) { Camera_OverwriteStateFlags(&this->mainCamera, CAM_STATE_CHECK_BG_ALT | CAM_STATE_CHECK_WATER | CAM_STATE_CHECK_BG | CAM_STATE_EXTERNAL_FINISHED | CAM_STATE_CAM_FUNC_FINISH | CAM_STATE_LOCK_MODE | CAM_STATE_DISTORTION | CAM_STATE_PLAY_INIT); - Sram_Init(this, &this->sramCtx); + Sram_Init(&this->state, &this->sramCtx); Regs_InitData(this); Message_Init(this); GameOver_Init(this); @@ -548,9 +584,9 @@ void Play_Update(PlayState* this) { } #endif - gSegments[4] = VIRTUAL_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment); - gSegments[5] = VIRTUAL_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.subKeepSlot].segment); - gSegments[2] = VIRTUAL_TO_PHYSICAL(this->sceneSegment); + gSegments[4] = OS_K0_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment); + gSegments[5] = OS_K0_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.subKeepSlot].segment); + gSegments[2] = OS_K0_TO_PHYSICAL(this->sceneSegment); if (FrameAdvance_Update(&this->frameAdvCtx, &input[1])) { if ((this->transitionMode == TRANS_MODE_OFF) && (this->transitionTrigger != TRANS_TRIGGER_OFF)) { @@ -1109,9 +1145,9 @@ void Play_Draw(PlayState* this) { OPEN_DISPS(gfxCtx, "../z_play.c", 3907); - gSegments[4] = VIRTUAL_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment); - gSegments[5] = VIRTUAL_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.subKeepSlot].segment); - gSegments[2] = VIRTUAL_TO_PHYSICAL(this->sceneSegment); + gSegments[4] = OS_K0_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment); + gSegments[5] = OS_K0_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.subKeepSlot].segment); + gSegments[2] = OS_K0_TO_PHYSICAL(this->sceneSegment); gSPSegment(POLY_OPA_DISP++, 0x00, NULL); gSPSegment(POLY_XLU_DISP++, 0x00, NULL); @@ -1294,7 +1330,7 @@ void Play_Draw(PlayState* this) { } if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_ACTORS) { - func_800315AC(this, &this->actorCtx); + Actor_DrawAll(this, &this->actorCtx); } if (!DEBUG_FEATURES || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_LENS_FLARES) { @@ -1570,7 +1606,7 @@ void Play_SpawnScene(PlayState* this, s32 sceneId, s32 spawn) { ASSERT(this->sceneSegment != NULL, "this->sceneSegment != NULL", "../z_play.c", 4960); - gSegments[2] = VIRTUAL_TO_PHYSICAL(this->sceneSegment); + gSegments[2] = OS_K0_TO_PHYSICAL(this->sceneSegment); Play_InitScene(this, spawn); diff --git a/src/code/z_player_call.c b/src/code/z_player_call.c index b922f56638..eb52aff798 100644 --- a/src/code/z_player_call.c +++ b/src/code/z_player_call.c @@ -1,10 +1,14 @@ -#include "global.h" +#include "kaleido_manager.h" +#include "z64actor.h" +#include "z64actor_profile.h" +#include "z64play.h" +#include "z64player.h" #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ ACTOR_FLAG_DRAW_CULLING_DISABLED | ACTOR_FLAG_UPDATE_DURING_OCARINA | ACTOR_FLAG_CAN_PRESS_SWITCHES) -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ "ntsc-1.2:128 pal-1.1:128" void (*sPlayerCallInitFunc)(Actor* thisx, PlayState* play); diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 0e34ff571a..1ac27fdb6c 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -1,12 +1,24 @@ -#include "global.h" +#include "libc64/math64.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "regs.h" +#include "segmented_address.h" +#include "sys_matrix.h" #include "versions.h" +#include "z_lib.h" #include "z64draw.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" +#include "z64skin_matrix.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_link_boy/object_link_boy.h" #include "assets/objects/object_link_child/object_link_child.h" -#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ + "pal-1.0:0 pal-1.1:0" typedef struct BowSlingshotStringData { /* 0x00 */ Gfx* dList; @@ -1513,7 +1525,7 @@ void Player_DrawGetItemImpl(PlayState* play, Player* this, Vec3f* refPos, s32 dr OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2401); - gSegments[6] = VIRTUAL_TO_PHYSICAL(this->giObjectSegment); + gSegments[6] = OS_K0_TO_PHYSICAL(this->giObjectSegment); gSPSegment(POLY_OPA_DISP++, 0x06, this->giObjectSegment); gSPSegment(POLY_XLU_DISP++, 0x06, this->giObjectSegment); @@ -1867,9 +1879,9 @@ u32 Player_InitPauseDrawData(PlayState* play, u8* segment, SkelAnime* skelAnime) ptr = (void*)ALIGN16((uintptr_t)ptr + size); - gSegments[4] = VIRTUAL_TO_PHYSICAL(segment + PAUSE_EQUIP_BUFFER_SIZE); + gSegments[4] = OS_K0_TO_PHYSICAL(segment + PAUSE_EQUIP_BUFFER_SIZE); gSegments[6] = - VIRTUAL_TO_PHYSICAL(segment + PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE); + OS_K0_TO_PHYSICAL(segment + PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE); SkelAnime_InitLink(play, skelAnime, gPlayerSkelHeaders[(void)0, gSaveContext.save.linkAge], &gPlayerAnim_link_normal_wait, 9, ptr, ptr, PLAYER_LIMB_MAX); @@ -2045,9 +2057,9 @@ void Player_DrawPause(PlayState* play, u8* segment, SkelAnime* skelAnime, Vec3f* Vec3s* srcTable; s32 i; - gSegments[4] = VIRTUAL_TO_PHYSICAL(segment + PAUSE_EQUIP_BUFFER_SIZE); + gSegments[4] = OS_K0_TO_PHYSICAL(segment + PAUSE_EQUIP_BUFFER_SIZE); gSegments[6] = - VIRTUAL_TO_PHYSICAL(segment + PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE); + OS_K0_TO_PHYSICAL(segment + PAUSE_EQUIP_BUFFER_SIZE + PAUSE_PLAYER_SEGMENT_GAMEPLAY_KEEP_BUFFER_SIZE); if (!LINK_IS_ADULT) { if (shield == PLAYER_SHIELD_DEKU) { diff --git a/src/code/z_prenmi.c b/src/code/z_prenmi.c index e1bb151453..6bf73b0577 100644 --- a/src/code/z_prenmi.c +++ b/src/code/z_prenmi.c @@ -1,6 +1,11 @@ -#include "global.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "prenmi_state.h" +#include "printf.h" +#include "regs.h" #include "terminal.h" #include "versions.h" +#include "vi_mode.h" void func_80092320(PreNMIState* this) { this->state.running = false; diff --git a/src/code/z_prenmi_buff.c b/src/code/z_prenmi_buff.c index c00d0513c0..3c45d7e540 100644 --- a/src/code/z_prenmi_buff.c +++ b/src/code/z_prenmi_buff.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "prenmi_buff.h" #define COLD_RESET 0 #define NMI 1 diff --git a/src/code/z_quake.c b/src/code/z_quake.c index 4c318b9386..d3ba17810d 100644 --- a/src/code/z_quake.c +++ b/src/code/z_quake.c @@ -1,6 +1,11 @@ -#include "global.h" +#include "libc64/qrand.h" +#include "array_count.h" +#include "printf.h" #include "quake.h" #include "terminal.h" +#include "z_lib.h" +#include "z64olib.h" +#include "z64play.h" typedef struct QuakeRequest { /* 0x00 */ s16 index; diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c index 8f0f61ed34..6228b51cf1 100644 --- a/src/code/z_rcp.c +++ b/src/code/z_rcp.c @@ -1,4 +1,11 @@ -#include "global.h" +#include "buffers.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "gfxalloc.h" +#include "letterbox.h" +#include "main.h" +#include "regs.h" +#include "z64play.h" Gfx sSetupDL[SETUPDL_MAX][6] = { { diff --git a/src/code/z_room.c b/src/code/z_room.c index 0c5d37f551..7bc9e4801d 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -1,11 +1,30 @@ -#include "global.h" +#include "libu64/debug.h" +#include "ultra64/gs2dex.h" +#include "array_count.h" +#include "buffers.h" #include "fault.h" -#include "terminal.h" -#include "versions.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "jpeg.h" #include "line_numbers.h" +#include "map.h" #if PLATFORM_N64 #include "n64dd.h" #endif +#include "printf.h" +#include "regs.h" +#include "segmented_address.h" +#include "sys_matrix.h" +#include "sys_ucode.h" +#include "terminal.h" +#include "translation.h" +#include "versions.h" +#include "z64audio.h" +#include "z64play.h" +#include "z64player.h" +#include "z64room.h" +#include "z64save.h" +#include "z64skin_matrix.h" Vec3f D_801270A0 = { 0.0f, 0.0f, 0.0f }; @@ -48,14 +67,14 @@ void Room_DrawNormal(PlayState* play, Room* room, u32 flags) { func_800342EC(&D_801270A0, play); gSPSegment(POLY_OPA_DISP++, 0x03, room->segment); func_80093C80(play); - gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); } if (flags & ROOM_DRAW_XLU) { func_8003435C(&D_801270A0, play); gSPSegment(POLY_XLU_DISP++, 0x03, room->segment); Gfx_SetupDL_25Xlu(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); } roomShape = &room->roomShape->normal; @@ -122,7 +141,7 @@ void Room_DrawCullable(PlayState* play, Room* room, u32 flags) { func_800342EC(&D_801270A0, play); gSPSegment(POLY_OPA_DISP++, 0x03, room->segment); func_80093C80(play); - gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); } if (1) {} @@ -131,7 +150,7 @@ void Room_DrawCullable(PlayState* play, Room* room, u32 flags) { func_8003435C(&D_801270A0, play); gSPSegment(POLY_XLU_DISP++, 0x03, room->segment); Gfx_SetupDL_25Xlu(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); } roomShape = &room->roomShape->cullable; @@ -390,7 +409,7 @@ void Room_DrawImageSingle(PlayState* play, Room* room, u32 flags) { if (drawOpa) { Gfx_SetupDL_25Opa(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, entry->opa); } @@ -421,7 +440,7 @@ void Room_DrawImageSingle(PlayState* play, Room* room, u32 flags) { if (drawXlu) { gSPSegment(POLY_XLU_DISP++, 0x03, room->segment); Gfx_SetupDL_25Xlu(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, entry->xlu); } @@ -499,7 +518,7 @@ void Room_DrawImageMulti(PlayState* play, Room* room, u32 flags) { if (drawOpa) { Gfx_SetupDL_25Opa(play->state.gfxCtx); - gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, dListsEntry->opa); } @@ -530,7 +549,7 @@ void Room_DrawImageMulti(PlayState* play, Room* room, u32 flags) { if (drawXlu) { gSPSegment(POLY_XLU_DISP++, 0x03, room->segment); Gfx_SetupDL_25Xlu(play->state.gfxCtx); - gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, dListsEntry->xlu); } @@ -697,7 +716,7 @@ s32 Room_ProcessRoomRequest(PlayState* play, RoomContext* roomCtx) { if (osRecvMesg(&roomCtx->loadQueue, NULL, OS_MESG_NOBLOCK) == 0) { roomCtx->status = 0; roomCtx->curRoom.segment = roomCtx->roomRequestAddr; - gSegments[3] = VIRTUAL_TO_PHYSICAL(roomCtx->curRoom.segment); + gSegments[3] = OS_K0_TO_PHYSICAL(roomCtx->curRoom.segment); Scene_ExecuteCommands(play, roomCtx->curRoom.segment); Player_SetBootData(play, GET_PLAYER(play)); @@ -712,7 +731,7 @@ s32 Room_ProcessRoomRequest(PlayState* play, RoomContext* roomCtx) { void Room_Draw(PlayState* play, Room* room, u32 flags) { if (room->segment != NULL) { - gSegments[3] = VIRTUAL_TO_PHYSICAL(room->segment); + gSegments[3] = OS_K0_TO_PHYSICAL(room->segment); ASSERT(room->roomShape->base.type < ARRAY_COUNTU(sRoomDrawHandlers), "this->ground_shape->polygon.type < number(Room_Draw_Proc)", "../z_room.c", 1125); sRoomDrawHandlers[room->roomShape->base.type](play, room, flags); diff --git a/src/code/z_rumble.c b/src/code/z_rumble.c index 49a54e7aab..fc811cfccb 100644 --- a/src/code/z_rumble.c +++ b/src/code/z_rumble.c @@ -11,8 +11,11 @@ * * @note Original filename is likely z_vibrate.c or similar as it is ordered after z_ss_sram.c and before z_view.c */ -#include "global.h" +#include "rumble.h" +#include "padmgr.h" +#include "z64math.h" +static s32 sUnused[4]; RumbleMgr sRumbleMgr; /** diff --git a/src/code/z_sample.c b/src/code/z_sample.c index 541771432b..63e0836bbc 100644 --- a/src/code/z_sample.c +++ b/src/code/z_sample.c @@ -1,4 +1,11 @@ -#include "global.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "controller.h" +#include "regs.h" +#include "sample_state.h" +#include "segment_symbols.h" +#include "z64dma.h" +#include "z64play.h" void Sample_HandleStateChange(SampleState* this) { if (CHECK_BTN_ALL(this->state.input[0].press.button, BTN_START)) { diff --git a/src/code/z_scene.c b/src/code/z_scene.c index e285587d90..feef5ffc62 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -1,6 +1,20 @@ -#include "global.h" +#include "array_count.h" +#include "avoid_ub.h" +#include "printf.h" +#include "regs.h" +#include "romfile.h" +#include "seqcmd.h" +#include "segment_symbols.h" +#include "segmented_address.h" #include "terminal.h" +#include "translation.h" #include "versions.h" +#include "z_actor_dlftbls.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" +#include "z64scene.h" SceneCmdHandlerFunc sSceneCmdHandlers[SCENE_CMD_ID_MAX]; RomFile sNaviQuestHintFiles[]; @@ -96,7 +110,7 @@ void Object_InitContext(PlayState* play, ObjectContext* objectCtx) { objectCtx->spaceEnd = (void*)((uintptr_t)objectCtx->spaceStart + spaceSize); objectCtx->mainKeepSlot = Object_SpawnPersistent(objectCtx, OBJECT_GAMEPLAY_KEEP); - gSegments[4] = VIRTUAL_TO_PHYSICAL(objectCtx->slots[objectCtx->mainKeepSlot].segment); + gSegments[4] = OS_K0_TO_PHYSICAL(objectCtx->slots[objectCtx->mainKeepSlot].segment); } void Object_UpdateEntries(ObjectContext* objectCtx) { @@ -252,7 +266,7 @@ BAD_RETURN(s32) Scene_CommandSpawnList(PlayState* play, SceneCmd* cmd) { BAD_RETURN(s32) Scene_CommandSpecialFiles(PlayState* play, SceneCmd* cmd) { if (cmd->specialFiles.keepObjectId != OBJECT_INVALID) { play->objectCtx.subKeepSlot = Object_SpawnPersistent(&play->objectCtx, cmd->specialFiles.keepObjectId); - gSegments[5] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[play->objectCtx.subKeepSlot].segment); + gSegments[5] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[play->objectCtx.subKeepSlot].segment); } if (cmd->specialFiles.naviQuestHintFileId != NAVI_QUEST_HINTS_NONE) { diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c index a6a08ccd16..5e096a262e 100644 --- a/src/code/z_scene_table.c +++ b/src/code/z_scene_table.c @@ -1,10 +1,20 @@ -#include "global.h" -#include "quake.h" -#include "versions.h" -#include "z64frame_advance.h" +#include "libc64/qrand.h" +#include "gfx.h" #if PLATFORM_N64 #include "n64dd.h" #endif +#include "quake.h" +#include "regs.h" +#include "segment_symbols.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "versions.h" +#include "z_lib.h" +#include "z64frame_advance.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" #include "assets/scenes/indoors/miharigoya/miharigoya_scene.h" #include "assets/scenes/indoors/souko/souko_scene.h" diff --git a/src/code/z_sfx_source.c b/src/code/z_sfx_source.c index 1dad386594..785afcde35 100644 --- a/src/code/z_sfx_source.c +++ b/src/code/z_sfx_source.c @@ -1,6 +1,9 @@ #include "z64sfx_source.h" -#include "global.h" +#include "array_count.h" +#include "sfx.h" +#include "z64play.h" +#include "z64skin_matrix.h" void SfxSource_InitAll(PlayState* play) { SfxSource* sources = &play->sfxSources[0]; diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index 49502f4ec9..4e4fd97e9a 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -1,5 +1,18 @@ -#include "global.h" +#include "libu64/debug.h" +#include "avoid_ub.h" +#include "gfx.h" +#include "printf.h" +#include "regs.h" +#include "segmented_address.h" +#include "segment_symbols.h" +#include "sys_matrix.h" #include "terminal.h" +#include "translation.h" +#include "z_lib.h" +#include "zelda_arena.h" +#include "z64animation.h" +#include "z64animation_legacy.h" +#include "z64play.h" #define ANIM_INTERP 1 diff --git a/src/code/z_skin.c b/src/code/z_skin.c index 55af9b1e2d..7861acb897 100644 --- a/src/code/z_skin.c +++ b/src/code/z_skin.c @@ -1,12 +1,13 @@ -#include "global.h" - -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "pal-1.1:128" +#include "gfx.h" +#include "segmented_address.h" +#include "sys_matrix.h" +#include "z64math.h" +#include "z64play.h" +#include "z64skin.h" +#include "z64skin_matrix.h" MtxF gSkinLimbMatrices[60]; // holds matrices for each limb of the skeleton currently being drawn -static s32 sUnused; - void Skin_UpdateVertices(MtxF* mtx, SkinVertex* skinVertices, SkinLimbModif* modifEntry, Vtx* vtxBuf, Vec3f* pos) { Vtx* vtx; SkinVertex* vertexEntry; @@ -207,7 +208,7 @@ void Skin_DrawImpl(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postD skeleton = SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment); if (!(drawFlags & SKIN_DRAW_FLAG_CUSTOM_MATRIX)) { - gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &skin->mtx); if (mtx == NULL) { diff --git a/src/code/z_skin_awb.c b/src/code/z_skin_awb.c index 55633bc872..196ce9aae4 100644 --- a/src/code/z_skin_awb.c +++ b/src/code/z_skin_awb.c @@ -1,4 +1,11 @@ -#include "global.h" +#include "array_count.h" +#include "segmented_address.h" +#include "zelda_arena.h" +#include "z64actor.h" +#include "z64play.h" +#include "z64skin.h" +#include "z64skin_matrix.h" + #include "overlays/actors/ovl_En_fHG/z_en_fhg.h" /** diff --git a/src/code/z_skin_matrix.c b/src/code/z_skin_matrix.c index 689fe67107..36d7a02791 100644 --- a/src/code/z_skin_matrix.c +++ b/src/code/z_skin_matrix.c @@ -1,5 +1,10 @@ -#include "global.h" +#include "z64skin_matrix.h" + +#include "gfx.h" +#include "printf.h" #include "terminal.h" +#include "translation.h" +#include "z_lib.h" // clang-format off MtxF sMtxFClear = { diff --git a/src/code/z_sram.c b/src/code/z_sram.c index 0531e29952..2eef6db036 100644 --- a/src/code/z_sram.c +++ b/src/code/z_sram.c @@ -1,6 +1,21 @@ -#include "global.h" +#include "z64sram.h" + +#include "array_count.h" +#include "file_select_state.h" +#include "controller.h" +#include "memory_utils.h" +#include "printf.h" #include "terminal.h" +#include "translation.h" #include "versions.h" +#include "z64audio.h" +#include "z64game.h" +#include "z64interface.h" +#include "z64message.h" +#include "z64ocarina.h" +#include "z64save.h" +#include "z64scene.h" +#include "z64ss_sram.h" #define SLOT_SIZE (sizeof(SaveContext) + 0x28) #define CHECKSUM_SIZE (sizeof(Save) / 2) @@ -52,10 +67,13 @@ u16 gSramSlotOffsets[] = { }; static u8 sSramDefaultHeader[] = { - // TODO: use enums for these - 0, // SRAM_HEADER_SOUND - 0, // SRAM_HEADER_ZTARGET - 0, // SRAM_HEADER_LANGUAGE + SOUND_SETTING_STEREO, // SRAM_HEADER_SOUND + Z_TARGET_SETTING_SWITCH, // SRAM_HEADER_Z_TARGET +#if OOT_NTSC + LANGUAGE_JPN, // SRAM_HEADER_LANGUAGE +#else + LANGUAGE_ENG, // SRAM_HEADER_LANGUAGE +#endif // SRAM_HEADER_MAGIC 0x98, @@ -1016,8 +1034,8 @@ void Sram_InitSram(GameState* gameState, SramContext* sramCtx) { } } - gSaveContext.audioSetting = sramCtx->readBuff[SRAM_HEADER_SOUND] & 3; - gSaveContext.zTargetSetting = sramCtx->readBuff[SRAM_HEADER_ZTARGET] & 1; + gSaveContext.soundSetting = sramCtx->readBuff[SRAM_HEADER_SOUND] & 3; + gSaveContext.zTargetSetting = sramCtx->readBuff[SRAM_HEADER_Z_TARGET] & 1; #if OOT_PAL gSaveContext.language = sramCtx->readBuff[SRAM_HEADER_LANGUAGE]; @@ -1042,11 +1060,11 @@ void Sram_InitSram(GameState* gameState, SramContext* sramCtx) { PRINTF(T("GOOD!GOOD! サイズ=%d + %d = %d\n", "GOOD! GOOD! Size = %d + %d = %d\n"), sizeof(SaveInfo), 4, sizeof(SaveInfo) + 4); PRINTF_COLOR_BLUE(); - PRINTF("Na_SetSoundOutputMode = %d\n", gSaveContext.audioSetting); - PRINTF("Na_SetSoundOutputMode = %d\n", gSaveContext.audioSetting); - PRINTF("Na_SetSoundOutputMode = %d\n", gSaveContext.audioSetting); + PRINTF("Na_SetSoundOutputMode = %d\n", gSaveContext.soundSetting); + PRINTF("Na_SetSoundOutputMode = %d\n", gSaveContext.soundSetting); + PRINTF("Na_SetSoundOutputMode = %d\n", gSaveContext.soundSetting); PRINTF_RST(); - func_800F6700(gSaveContext.audioSetting); + Audio_SetSoundOutputMode(gSaveContext.soundSetting); } void Sram_Alloc(GameState* gameState, SramContext* sramCtx) { @@ -1054,5 +1072,5 @@ void Sram_Alloc(GameState* gameState, SramContext* sramCtx) { ASSERT(sramCtx->readBuff != NULL, "sram->read_buff != NULL", "../z_sram.c", 1295); } -void Sram_Init(PlayState* play, SramContext* sramCtx) { +void Sram_Init(GameState* gameState, SramContext* sramCtx) { } diff --git a/src/code/z_ss_sram.c b/src/code/z_ss_sram.c index dd26d695cb..94e97639aa 100644 --- a/src/code/z_ss_sram.c +++ b/src/code/z_ss_sram.c @@ -1,5 +1,6 @@ #include "ultra64.h" -#include "global.h" +#include "printf.h" +#include "z64ss_sram.h" typedef struct SsSramContext { /* 0x00 */ OSPiHandle piHandle; diff --git a/src/code/z_view.c b/src/code/z_view.c index 5b68f00bf4..6fe82aaeb3 100644 --- a/src/code/z_view.c +++ b/src/code/z_view.c @@ -1,5 +1,16 @@ -#include "global.h" +#include "z64view.h" + +#include "libc64/malloc.h" +#include "libu64/debug.h" +#include "avoid_ub.h" +#include "gfx.h" +#include "letterbox.h" +#include "main.h" +#include "printf.h" +#include "regs.h" +#include "sys_matrix.h" #include "terminal.h" +#include "translation.h" vu32 sLogOnNextViewInit = true; diff --git a/src/code/z_vimode.c b/src/code/z_vimode.c index 0d2f5716fa..6eceeaa7e7 100644 --- a/src/code/z_vimode.c +++ b/src/code/z_vimode.c @@ -1,5 +1,12 @@ -#include "global.h" +#include "vi_mode.h" + +#include "libu64/debug.h" #include "ultra64/viint.h" +#include "controller.h" +#include "gfx.h" +#include "main.h" +#include "printf.h" +#include "regs.h" #include "versions.h" void ViMode_LogPrint(OSViMode* osViMode) { diff --git a/src/code/z_viscvg.c b/src/code/z_viscvg.c index 9caf39a3f8..51fc6f8e5d 100644 --- a/src/code/z_viscvg.c +++ b/src/code/z_viscvg.c @@ -20,7 +20,8 @@ * before the filter is applied. */ -#include "global.h" +#include "gfx.h" +#include "z64vis.h" /** * Draws only coverage: does not retain any of the original pixel RGB, primColor is used as background color. diff --git a/src/code/z_vismono.c b/src/code/z_vismono.c index aac4fa84f9..517f2ada60 100644 --- a/src/code/z_vismono.c +++ b/src/code/z_vismono.c @@ -8,7 +8,12 @@ * comments. */ -#include "global.h" +#include "libc64/malloc.h" +#include "libu64/debug.h" +#include "attributes.h" +#include "gfx.h" +#include "gfxalloc.h" +#include "z64vis.h" // Height of the fragments the color frame buffer (CFB) is split into. // It is the maximum amount of lines such that all rgba16 SCREEN_WIDTH-long lines fit into diff --git a/src/code/z_viszbuf.c b/src/code/z_viszbuf.c index 5a542bc124..431d7f6d9a 100644 --- a/src/code/z_viszbuf.c +++ b/src/code/z_viszbuf.c @@ -32,7 +32,8 @@ * again ignored by the RenderMode. */ -#include "global.h" +#include "gfx.h" +#include "z64vis.h" // Height of the fragments the z-buffer is split into. // It is the maximum amount of lines such that all rgba16 SCREEN_WIDTH-long lines fit into TMEM. diff --git a/src/code/z_vr_box.c b/src/code/z_vr_box.c index 2e7953362b..2fa2122acf 100644 --- a/src/code/z_vr_box.c +++ b/src/code/z_vr_box.c @@ -1,6 +1,14 @@ -#include "global.h" +#include "z64skybox.h" + +#include "array_count.h" +#include "printf.h" +#include "segment_symbols.h" #include "terminal.h" +#include "ultra64.h" #include "z64environment.h" +#include "z64game.h" +#include "z64play.h" +#include "z64save.h" typedef struct SkyboxFaceParams { /* 0x000 */ s32 xStart; diff --git a/src/code/z_vr_box_draw.c b/src/code/z_vr_box_draw.c index 45e3237deb..aa7fa1dae0 100644 --- a/src/code/z_vr_box_draw.c +++ b/src/code/z_vr_box_draw.c @@ -1,4 +1,7 @@ -#include "global.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sys_matrix.h" +#include "z64skybox.h" Mtx* sSkyboxDrawMatrix; diff --git a/src/elf_message/elf_message_field.c b/src/elf_message/elf_message_field.c index 505649afda..8c672ad50b 100644 --- a/src/elf_message/elf_message_field.c +++ b/src/elf_message/elf_message_field.c @@ -1,5 +1,5 @@ -#include "global.h" #include "z64quest_hint_commands.h" +#include "z64save.h" QuestHintCmd gOverworldNaviQuestHints[] = { QUEST_HINT_FLAG(CHECK, EVENTCHKINF_05, false, 0x40), diff --git a/src/elf_message/elf_message_ydan.c b/src/elf_message/elf_message_ydan.c index 21b5fe89fa..cde6410b22 100644 --- a/src/elf_message/elf_message_ydan.c +++ b/src/elf_message/elf_message_ydan.c @@ -1,4 +1,3 @@ -#include "global.h" #include "z64quest_hint_commands.h" QuestHintCmd gDungeonNaviQuestHints[] = { diff --git a/src/gcc_fix/missing_gcc_functions.c b/src/gcc_fix/missing_gcc_functions.c index 76bf8e9db6..615dd23549 100644 --- a/src/gcc_fix/missing_gcc_functions.c +++ b/src/gcc_fix/missing_gcc_functions.c @@ -5,7 +5,7 @@ /* This file is NOT a part of the original game and only exists to help gcc work. */ /* --------------------------------------------------------------------------------*/ -#include "global.h" +#include "ultra64.h" // Self-hosted libc memory functions, gcc assumes these exist even in a freestanding // environment and there is no way to tell it otherwise. diff --git a/src/libc/absf.s b/src/libc/fabsf.s similarity index 82% rename from src/libc/absf.s rename to src/libc/fabsf.s index 58450e7791..6f27b4ca1b 100644 --- a/src/libc/absf.s +++ b/src/libc/fabsf.s @@ -3,7 +3,7 @@ .text -LEAF(absf) +LEAF(fabsf) abs.s fv0, fa0 jr ra -END(absf) +END(fabsf) diff --git a/src/libc64/__osMalloc_gc.c b/src/libc64/__osMalloc_gc.c index 025c21bff9..d6e4e17d13 100644 --- a/src/libc64/__osMalloc_gc.c +++ b/src/libc64/__osMalloc_gc.c @@ -1,7 +1,10 @@ -#include "global.h" -#include "fault.h" #include "libc64/os_malloc.h" + +#include "alignment.h" +#include "fault.h" +#include "printf.h" #include "terminal.h" +#include "translation.h" #define FILL_ALLOC_BLOCK_FLAG (1 << 0) #define FILL_FREE_BLOCK_FLAG (1 << 1) diff --git a/src/libc64/__osMalloc_n64.c b/src/libc64/__osMalloc_n64.c index 56996feac9..6b81212963 100644 --- a/src/libc64/__osMalloc_n64.c +++ b/src/libc64/__osMalloc_n64.c @@ -1,7 +1,9 @@ -#include "global.h" -#include "fault.h" #include "libc64/os_malloc.h" +#include "alignment.h" +#include "fault.h" +#include "translation.h" + #define NODE_MAGIC 0x7373 #define NODE_IS_VALID(node) ((node)->magic == NODE_MAGIC) diff --git a/src/libc64/malloc.c b/src/libc64/malloc.c index f7a642ce9d..8b9c9b6705 100644 --- a/src/libc64/malloc.c +++ b/src/libc64/malloc.c @@ -1,7 +1,9 @@ #include "libc64/malloc.h" -#include "ultra64.h" -#include "macros.h" + #include "libc64/os_malloc.h" +#include "printf.h" +#include "translation.h" +#include "ultra64.h" #define LOG_SEVERITY_NOLOG 0 #define LOG_SEVERITY_ERROR 2 diff --git a/src/libc64/math64.c b/src/libc64/math64.c index 85fb4cedf3..b51eb333ed 100644 --- a/src/libc64/math64.c +++ b/src/libc64/math64.c @@ -1,5 +1,5 @@ +#include "libc64/math64.h" #include "z64math.h" -#include "macros.h" #if !PLATFORM_N64 s32 gUseAtanContFrac; diff --git a/src/libc64/sleep.c b/src/libc64/sleep.c index 2b67088a1b..17fd3b1e24 100644 --- a/src/libc64/sleep.c +++ b/src/libc64/sleep.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void Sleep_Cycles(OSTime cycles) { OSMesgQueue mq; diff --git a/src/libleo/api/bytetolba.c b/src/libleo/api/bytetolba.c index 9b28baf2f1..9b25ac840f 100644 --- a/src/libleo/api/bytetolba.c +++ b/src/libleo/api/bytetolba.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" diff --git a/src/libleo/api/cacreateleomanager.c b/src/libleo/api/cacreateleomanager.c index fc3235c08c..d4f6f5100b 100644 --- a/src/libleo/api/cacreateleomanager.c +++ b/src/libleo/api/cacreateleomanager.c @@ -1,9 +1,11 @@ -#include "global.h" #include "ultra64/asm.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" #include "libc/stdint.h" +#include "attributes.h" + +#include "ultra64.h" s32 LeoCACreateLeoManager(s32 comPri, s32 intPri, OSMesg* cmdBuf, s32 cmdMsgCnt) { OSPiHandle* driveRomHandle; diff --git a/src/libleo/api/cjcreateleomanager.c b/src/libleo/api/cjcreateleomanager.c index 26ced4f7db..23f9da8226 100644 --- a/src/libleo/api/cjcreateleomanager.c +++ b/src/libleo/api/cjcreateleomanager.c @@ -1,9 +1,11 @@ -#include "global.h" #include "ultra64/asm.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" #include "libc/stdint.h" +#include "attributes.h" + +#include "ultra64.h" s32 LeoCJCreateLeoManager(s32 comPri, s32 intPri, OSMesg* cmdBuf, s32 cmdMsgCnt) { OSPiHandle* driveRomHandle; diff --git a/src/libleo/api/clearqueue.c b/src/libleo/api/clearqueue.c index ed5b623280..1972b6080f 100644 --- a/src/libleo/api/clearqueue.c +++ b/src/libleo/api/clearqueue.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" diff --git a/src/libleo/api/driveexist.c b/src/libleo/api/driveexist.c index 314a67064e..f658817a3d 100644 --- a/src/libleo/api/driveexist.c +++ b/src/libleo/api/driveexist.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" diff --git a/src/libleo/api/lbatobyte.c b/src/libleo/api/lbatobyte.c index dc5b1f5dbe..e260fced18 100644 --- a/src/libleo/api/lbatobyte.c +++ b/src/libleo/api/lbatobyte.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" diff --git a/src/libleo/api/readwrite.c b/src/libleo/api/readwrite.c index a4c27d26f9..570b94b203 100644 --- a/src/libleo/api/readwrite.c +++ b/src/libleo/api/readwrite.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" diff --git a/src/libleo/api/seek.c b/src/libleo/api/seek.c index dbbc4651ac..8abbb0f0a5 100644 --- a/src/libleo/api/seek.c +++ b/src/libleo/api/seek.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" diff --git a/src/libleo/api/spdlmotor.c b/src/libleo/api/spdlmotor.c index 8c0ffa9ffa..21ef2b0223 100644 --- a/src/libleo/api/spdlmotor.c +++ b/src/libleo/api/spdlmotor.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" diff --git a/src/libleo/api/testunitready.c b/src/libleo/api/testunitready.c index f5770f86b7..2116bc9e2a 100644 --- a/src/libleo/api/testunitready.c +++ b/src/libleo/api/testunitready.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" diff --git a/src/libleo/leo/leo_tbl.c b/src/libleo/leo/leo_tbl.c index f4093fbd53..083fabb728 100644 --- a/src/libleo/leo/leo_tbl.c +++ b/src/libleo/leo/leo_tbl.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" diff --git a/src/libleo/leo/leoc2ecc.c b/src/libleo/leo/leoc2ecc.c index 4d268df51b..5b770b138d 100644 --- a/src/libleo/leo/leoc2ecc.c +++ b/src/libleo/leo/leoc2ecc.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" diff --git a/src/libleo/leo/leocmdex.c b/src/libleo/leo/leocmdex.c index ca3101fb0a..d7887d4944 100644 --- a/src/libleo/leo/leocmdex.c +++ b/src/libleo/leo/leocmdex.c @@ -1,7 +1,9 @@ -#include "global.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" +#include "attributes.h" + +#include "ultra64.h" extern vu16 LEOrw_flags; diff --git a/src/libleo/leo/leodiskinit.c b/src/libleo/leo/leodiskinit.c index 6c11f728e2..92020029ea 100644 --- a/src/libleo/leo/leodiskinit.c +++ b/src/libleo/leo/leodiskinit.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" diff --git a/src/libleo/leo/leofunc.c b/src/libleo/leo/leofunc.c index 20809e55f6..35ba14005f 100644 --- a/src/libleo/leo/leofunc.c +++ b/src/libleo/leo/leofunc.c @@ -1,7 +1,8 @@ -#include "global.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" +#include "array_count.h" +#include "ultra64.h" static s32 __leoResetCalled = false; static s32 __leoQueuesCreated = false; diff --git a/src/libleo/leo/leoglobals.c b/src/libleo/leo/leoglobals.c index ca11ec6c4e..28a99f626d 100644 --- a/src/libleo/leo/leoglobals.c +++ b/src/libleo/leo/leoglobals.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" diff --git a/src/libleo/leo/leoinquiry.c b/src/libleo/leo/leoinquiry.c index cfa4f1c27f..b23a9ab454 100644 --- a/src/libleo/leo/leoinquiry.c +++ b/src/libleo/leo/leoinquiry.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" diff --git a/src/libleo/leo/leoint.c b/src/libleo/leo/leoint.c index f337b15080..33ac3d2010 100644 --- a/src/libleo/leo/leoint.c +++ b/src/libleo/leo/leoint.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" diff --git a/src/libleo/leo/leointerrupt.c b/src/libleo/leo/leointerrupt.c index d9e2175ad3..fc547cfd5c 100644 --- a/src/libleo/leo/leointerrupt.c +++ b/src/libleo/leo/leointerrupt.c @@ -1,11 +1,11 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" #include "ultra64/internal.h" extern OSThread* __osRunQueue; -extern OSHWIntr __OSGlobalIntMask; +extern OSIntMask __OSGlobalIntMask; void __osLeoAbnormalResume(void); void __osLeoResume(void); diff --git a/src/libleo/leo/leomecha.c b/src/libleo/leo/leomecha.c index da141616c8..d0804f033c 100644 --- a/src/libleo/leo/leomecha.c +++ b/src/libleo/leo/leomecha.c @@ -1,7 +1,9 @@ -#include "global.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" +#include "attributes.h" + +#include "ultra64.h" extern s32 currentCommand; diff --git a/src/libleo/leo/leomode_sel.c b/src/libleo/leo/leomode_sel.c index cd45fd8350..fe36bc16af 100644 --- a/src/libleo/leo/leomode_sel.c +++ b/src/libleo/leo/leomode_sel.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" diff --git a/src/libleo/leo/leomotor.c b/src/libleo/leo/leomotor.c index 251ac2a95b..652b626ee0 100644 --- a/src/libleo/leo/leomotor.c +++ b/src/libleo/leo/leomotor.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" diff --git a/src/libleo/leo/leomseq_tbl.c b/src/libleo/leo/leomseq_tbl.c index 4944e63336..f94979f623 100644 --- a/src/libleo/leo/leomseq_tbl.c +++ b/src/libleo/leo/leomseq_tbl.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" diff --git a/src/libleo/leo/leoram.c b/src/libleo/leo/leoram.c index 7600632482..159aaaae27 100644 --- a/src/libleo/leo/leoram.c +++ b/src/libleo/leo/leoram.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" diff --git a/src/libleo/leo/leord_capa.c b/src/libleo/leo/leord_capa.c index d060a64936..86b71ac903 100644 --- a/src/libleo/leo/leord_capa.c +++ b/src/libleo/leo/leord_capa.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" diff --git a/src/libleo/leo/leord_diskid.c b/src/libleo/leo/leord_diskid.c index fde59bcc9c..df4d6bf24b 100644 --- a/src/libleo/leo/leord_diskid.c +++ b/src/libleo/leo/leord_diskid.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" diff --git a/src/libleo/leo/leoread.c b/src/libleo/leo/leoread.c index 62017cd159..11dc28c41c 100644 --- a/src/libleo/leo/leoread.c +++ b/src/libleo/leo/leoread.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" diff --git a/src/libleo/leo/leoreset.c b/src/libleo/leo/leoreset.c index ff6e0f9439..40eb56482c 100644 --- a/src/libleo/leo/leoreset.c +++ b/src/libleo/leo/leoreset.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" diff --git a/src/libleo/leo/leorezero.c b/src/libleo/leo/leorezero.c index 73b58df765..9e28bf13a3 100644 --- a/src/libleo/leo/leorezero.c +++ b/src/libleo/leo/leorezero.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" diff --git a/src/libleo/leo/leoseek.c b/src/libleo/leo/leoseek.c index 566866255e..2f530ac726 100644 --- a/src/libleo/leo/leoseek.c +++ b/src/libleo/leo/leoseek.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" diff --git a/src/libleo/leo/leotestunit.c b/src/libleo/leo/leotestunit.c index a6a6dbdb62..4c81d7970a 100644 --- a/src/libleo/leo/leotestunit.c +++ b/src/libleo/leo/leotestunit.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" diff --git a/src/libleo/leo/leotimer.c b/src/libleo/leo/leotimer.c index aadfc3b828..f6c7fdfc05 100644 --- a/src/libleo/leo/leotimer.c +++ b/src/libleo/leo/leotimer.c @@ -1,7 +1,9 @@ -#include "global.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" +#include "attributes.h" + +#include "ultra64.h" typedef struct { /* 0x0 */ u8 year; diff --git a/src/libleo/leo/leotranslat.c b/src/libleo/leo/leotranslat.c index 1f297a792b..6eb2011367 100644 --- a/src/libleo/leo/leotranslat.c +++ b/src/libleo/leo/leotranslat.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" diff --git a/src/libleo/leo/leoutil.c b/src/libleo/leo/leoutil.c index 08f88938cf..e90ea1f678 100644 --- a/src/libleo/leo/leoutil.c +++ b/src/libleo/leo/leoutil.c @@ -1,7 +1,8 @@ -#include "global.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" +#include "array_count.h" +#include "ultra64.h" u16 leoLba_to_phys(u32 lba) { u16 vzone_num; diff --git a/src/libleo/leo/leowrite.c b/src/libleo/leo/leowrite.c index deeafc9ad8..91b2163f0b 100644 --- a/src/libleo/leo/leowrite.c +++ b/src/libleo/leo/leowrite.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/leo.h" #include "ultra64/leoappli.h" #include "ultra64/leodrive.h" diff --git a/src/libu64/debug.c b/src/libu64/debug.c index 80be25f9d0..e1ed15fe45 100644 --- a/src/libu64/debug.c +++ b/src/libu64/debug.c @@ -1,6 +1,7 @@ -#include "global.h" #include "fault.h" +#include "printf.h" #include "terminal.h" +#include "translation.h" #if PLATFORM_N64 || DEBUG_FEATURES f32 LogUtils_CheckFloatRange(const char* exp, int line, const char* valueName, f32 value, const char* minName, f32 min, diff --git a/src/libu64/gfxprint.c b/src/libu64/gfxprint.c index b3ebfcd0ef..c47d52a3a5 100644 --- a/src/libu64/gfxprint.c +++ b/src/libu64/gfxprint.c @@ -1,4 +1,7 @@ -#include "global.h" +#include "libc64/aprintf.h" +#include "libu64/gfxprint.h" +#include "attributes.h" +#include "translation.h" u16 sGfxPrintFontTLUT[64] = { 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, diff --git a/src/libu64/load_gc.c b/src/libu64/load_gc.c index 39662cbcef..340780a130 100644 --- a/src/libu64/load_gc.c +++ b/src/libu64/load_gc.c @@ -1,4 +1,8 @@ -#include "global.h" +#include "libu64/overlay.h" +#include "ultra64.h" +#include "printf.h" +#include "translation.h" +#include "z64dma.h" size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd, void* allocatedRamAddr) { s32 pad[3]; diff --git a/src/libu64/loadfragment2_gc.c b/src/libu64/loadfragment2_gc.c index 6befb8c9b9..5ad556e506 100644 --- a/src/libu64/loadfragment2_gc.c +++ b/src/libu64/loadfragment2_gc.c @@ -1,4 +1,6 @@ -#include "global.h" +#include "libc64/malloc.h" +#include "libu64/overlay.h" +#include "printf.h" void* Overlay_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd) { void* allocatedRamAddr = SYSTEM_ARENA_MALLOC_R((intptr_t)vramEnd - (intptr_t)vramStart, "../loadfragment2.c", 31); diff --git a/src/libu64/loadfragment2_n64.c b/src/libu64/loadfragment2_n64.c index 6a06b1ba09..be0e5295d9 100644 --- a/src/libu64/loadfragment2_n64.c +++ b/src/libu64/loadfragment2_n64.c @@ -6,7 +6,10 @@ * * @see Overlay_Relocate */ -#include "global.h" +#include "libc64/malloc.h" +#include "libu64/overlay.h" +#include "translation.h" +#include "z64dma.h" s32 gOverlayLogSeverity = 2; diff --git a/src/libu64/logseverity_gc.c b/src/libu64/logseverity_gc.c index 940aa87cc8..50c2eb4ab8 100644 --- a/src/libu64/logseverity_gc.c +++ b/src/libu64/logseverity_gc.c @@ -1,3 +1,3 @@ -#include "global.h" +#include "libu64/overlay.h" s32 gOverlayLogSeverity = 2; diff --git a/src/libu64/mtxuty-cvt.c b/src/libu64/mtxuty-cvt.c index 10f88f7827..759c686d95 100644 --- a/src/libu64/mtxuty-cvt.c +++ b/src/libu64/mtxuty-cvt.c @@ -1,4 +1,6 @@ -#include "global.h" +#include "ultra64.h" +#include "libu64/debug.h" +#include "libu64/mtxuty-cvt.h" void MtxConv_F2L(Mtx* m1, MtxF* m2) { s32 i; diff --git a/src/libu64/padsetup.c b/src/libu64/padsetup.c index 86f38c0adf..fde25418f6 100644 --- a/src/libu64/padsetup.c +++ b/src/libu64/padsetup.c @@ -1,4 +1,5 @@ #include "ultra64.h" +#include "libu64/padsetup.h" s32 PadSetup_Init(OSMesgQueue* mq, u8* outMask, OSContStatus* status) { s32 ret; diff --git a/src/libu64/rcp_utils.c b/src/libu64/rcp_utils.c index 420ac51f98..27e929f7d1 100644 --- a/src/libu64/rcp_utils.c +++ b/src/libu64/rcp_utils.c @@ -1,4 +1,6 @@ -#include "global.h" +#include "libu64/rcp_utils.h" +#include "ultra64.h" +#include "printf.h" #if PLATFORM_N64 || DEBUG_FEATURES #define RCP_UTILS_PRINTF osSyncPrintf @@ -55,9 +57,12 @@ void RcpUtils_PrintRegisterStatus(void) { void RcpUtils_Reset(void) { RcpUtils_PrintRegisterStatus(); + // Flush the RDP pipeline and freeze clock counter osDpSetStatus(DPC_SET_FREEZE | DPC_SET_FLUSH); + // Halt the RSP, disable interrupt on break and set "task done" signal __osSpSetStatus(SP_SET_HALT | SP_SET_TASKDONE | SP_CLR_INTR_BREAK); + RcpUtils_PrintRegisterStatus(); } diff --git a/src/libu64/relocation_gc.c b/src/libu64/relocation_gc.c index 1d2f3193da..91d7eaf790 100644 --- a/src/libu64/relocation_gc.c +++ b/src/libu64/relocation_gc.c @@ -6,7 +6,10 @@ * * @see Overlay_Relocate */ -#include "global.h" +#include "libu64/overlay.h" +#include "attributes.h" +#include "printf.h" +#include "ultra64.h" // Extract MIPS register rs from an instruction word #define MIPS_REG_RS(insn) (((insn) >> 0x15) & 0x1F) diff --git a/src/libu64/system_heap.c b/src/libu64/runtime.c similarity index 75% rename from src/libu64/system_heap.c rename to src/libu64/runtime.c index 1ae93e868c..aa0c507b7d 100644 --- a/src/libu64/system_heap.c +++ b/src/libu64/runtime.c @@ -1,4 +1,6 @@ -#include "global.h" +#include "libu64/runtime.h" + +#include "libc64/malloc.h" #include "libc64/os_malloc.h" typedef void (*arg3_800FC868)(void*); @@ -6,13 +8,12 @@ typedef void (*arg3_800FC8D8)(void*, u32); typedef void (*arg3_800FC948)(void*, u32, u32, u32, u32, u32, u32, u32, u32); typedef void (*arg3_800FCA18)(void*, u32); -typedef struct InitFunc { +typedef struct CtorEntry { s32 nextOffset; void (*func)(void); -} InitFunc; +} CtorEntry; -// .data -void* sInitFuncs = NULL; +void* sGlobalCtorEntries = NULL; #if DEBUG_FEATURES char sNew[] = "new"; @@ -20,8 +21,7 @@ char sNew[] = "new"; char sNew[] = ""; #endif -// possibly some kind of new() function -void* func_800FC800(u32 size) { +void* Runtime_New(u32 size) { DECLARE_INTERRUPT_MASK void* ptr; @@ -41,8 +41,7 @@ void* func_800FC800(u32 size) { return ptr; } -// possibly some kind of delete() function -void func_800FC83C(void* ptr) { +void Runtime_Delete(void* ptr) { DECLARE_INTERRUPT_MASK DISABLE_INTERRUPTS(); @@ -81,7 +80,7 @@ void* func_800FC948(void* blk, u32 nBlk, u32 blkSize, arg3_800FC948 arg3) { DISABLE_INTERRUPTS(); if (blk == NULL) { - blk = func_800FC800(nBlk * blkSize); + blk = Runtime_New(nBlk * blkSize); } if (blk != NULL && arg3 != NULL) { @@ -115,39 +114,39 @@ void func_800FCA18(void* blk, u32 nBlk, u32 blkSize, arg3_800FCA18 arg3, s32 arg } if (arg4 != 0) { - func_800FC83C(blk); + Runtime_Delete(blk); } } RESTORE_INTERRUPTS(); } -void func_800FCB34(void) { - InitFunc* initFunc = (InitFunc*)&sInitFuncs; - u32 nextOffset = initFunc->nextOffset; - InitFunc* prev = NULL; +void Runtime_ExecuteGlobalCtors(void) { + CtorEntry* ctorEntry = (CtorEntry*)&sGlobalCtorEntries; + u32 nextOffset = ctorEntry->nextOffset; + CtorEntry* prevEntry = NULL; while (nextOffset != 0) { - initFunc = (InitFunc*)((s32)initFunc + nextOffset); + ctorEntry = (CtorEntry*)((s32)ctorEntry + nextOffset); - if (initFunc->func != NULL) { - initFunc->func(); + if (ctorEntry->func != NULL) { + ctorEntry->func(); } - nextOffset = initFunc->nextOffset; - initFunc->nextOffset = (s32)prev; - prev = initFunc; + nextOffset = ctorEntry->nextOffset; + ctorEntry->nextOffset = (s32)prevEntry; + prevEntry = ctorEntry; } - sInitFuncs = prev; + sGlobalCtorEntries = prevEntry; } -void SystemHeap_Init(void* start, u32 size) { +void Runtime_Init(void* start, u32 size) { #if PLATFORM_N64 __osMallocInit(&gSystemArena, start, size); #else SystemArena_Init(start, size); #endif - func_800FCB34(); + Runtime_ExecuteGlobalCtors(); } diff --git a/src/libu64/stackcheck.c b/src/libu64/stackcheck.c index 787eb1c3e5..69fe224ee8 100644 --- a/src/libu64/stackcheck.c +++ b/src/libu64/stackcheck.c @@ -1,5 +1,9 @@ -#include "global.h" +#include "libu64/debug.h" +#include "attributes.h" +#include "printf.h" +#include "stackcheck.h" #include "terminal.h" +#include "translation.h" StackEntry* sStackInfoListStart = NULL; StackEntry* sStackInfoListEnd = NULL; diff --git a/src/libultra/gu/cosf.c b/src/libultra/gu/cosf.c index 639084093f..f217eec13a 100644 --- a/src/libultra/gu/cosf.c +++ b/src/libultra/gu/cosf.c @@ -1,5 +1,5 @@ #include "ultra64.h" -#include "global.h" +#include "z64math.h" // TODO: libultra should not have access to game-side headers static const du P[] = { { 0x3FF00000, 0x00000000 }, { 0xBFC55554, 0xBC83656D }, { 0x3F8110ED, 0x3804C2A0 }, diff --git a/src/libultra/gu/lookat.c b/src/libultra/gu/lookat.c index e1c7500cf1..8d1df6bbe1 100644 --- a/src/libultra/gu/lookat.c +++ b/src/libultra/gu/lookat.c @@ -1,4 +1,5 @@ -#include "global.h" +#include "ultra64.h" +#include "z64math.h" // TODO: libultra should not have access to game-side headers void guLookAtF(f32 mf[4][4], f32 xEye, f32 yEye, f32 zEye, f32 xAt, f32 yAt, f32 zAt, f32 xUp, f32 yUp, f32 zUp) { f32 length; diff --git a/src/libultra/gu/lookathil.c b/src/libultra/gu/lookathil.c index e9cf650a6e..5d14e59aba 100644 --- a/src/libultra/gu/lookathil.c +++ b/src/libultra/gu/lookathil.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #define FTOFRAC8(x) ((s32)MIN(((x) * (128.0f)), 127.0f) & 0xFF) diff --git a/src/libultra/gu/mtxutil.c b/src/libultra/gu/mtxutil.c index e9e327f740..a6a3defa00 100644 --- a/src/libultra/gu/mtxutil.c +++ b/src/libultra/gu/mtxutil.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void guMtxF2L(f32 mf[4][4], Mtx* m) { s32 i, j; diff --git a/src/libultra/gu/normalize.c b/src/libultra/gu/normalize.c index 6a0cac0200..8b20110c8c 100644 --- a/src/libultra/gu/normalize.c +++ b/src/libultra/gu/normalize.c @@ -1,4 +1,5 @@ -#include "global.h" +#include "ultra64.h" +#include "z64math.h" // TODO: libultra should not have access to game-side headers void guNormalize(f32* x, f32* y, f32* z) { f32 m = 1 / sqrtf(SQ(*x) + SQ(*y) + SQ(*z)); diff --git a/src/libultra/gu/ortho.c b/src/libultra/gu/ortho.c index 62b6d79503..4ed717acfd 100644 --- a/src/libultra/gu/ortho.c +++ b/src/libultra/gu/ortho.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void guOrthoF(f32 mf[4][4], f32 left, f32 right, f32 bottom, f32 top, f32 near, f32 far, f32 scale) { s32 i, j; diff --git a/src/libultra/gu/perspective.c b/src/libultra/gu/perspective.c index 3f700a814a..e7a6bad2f5 100644 --- a/src/libultra/gu/perspective.c +++ b/src/libultra/gu/perspective.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void guPerspectiveF(f32 mf[4][4], u16* perspNorm, f32 fovy, f32 aspect, f32 near, f32 far, f32 scale) { f32 yscale; diff --git a/src/libultra/gu/position.c b/src/libultra/gu/position.c index 1b9a3525b2..b016c29a7c 100644 --- a/src/libultra/gu/position.c +++ b/src/libultra/gu/position.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" /** * guPositionF diff --git a/src/libultra/gu/rotate.c b/src/libultra/gu/rotate.c index dc50aba3c5..3f068f9417 100644 --- a/src/libultra/gu/rotate.c +++ b/src/libultra/gu/rotate.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void guRotateF(f32 m[4][4], f32 a, f32 x, f32 y, f32 z) { static f32 dtor = M_PI / 180.0f; diff --git a/src/libultra/gu/scale.c b/src/libultra/gu/scale.c index 525f2fb4c5..6bfcd98c30 100644 --- a/src/libultra/gu/scale.c +++ b/src/libultra/gu/scale.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void guScaleF(f32 m[4][4], f32 x, f32 y, f32 z) { guMtxIdentF(m); diff --git a/src/libultra/gu/sinf.c b/src/libultra/gu/sinf.c index 49929e8436..23013731c4 100644 --- a/src/libultra/gu/sinf.c +++ b/src/libultra/gu/sinf.c @@ -1,5 +1,5 @@ -#include "global.h" #include "ultra64.h" +#include "z64math.h" // TODO: libultra should not have access to game-side headers static const du P[] = { { 0x3FF00000, 0x00000000 }, { 0xBFC55554, 0xBC83656D }, { 0x3F8110ED, 0x3804C2A0 }, diff --git a/src/libultra/gu/translate.c b/src/libultra/gu/translate.c index 2753063d5d..9843890628 100644 --- a/src/libultra/gu/translate.c +++ b/src/libultra/gu/translate.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void guTranslateF(f32 m[4][4], f32 x, f32 y, f32 z) { guMtxIdentF(m); diff --git a/src/libultra/gu/us2dex.c b/src/libultra/gu/us2dex.c index b8708c086c..bb2f50ae82 100644 --- a/src/libultra/gu/us2dex.c +++ b/src/libultra/gu/us2dex.c @@ -1,4 +1,6 @@ -#include "global.h" +#include "ultra64/ultratypes.h" +#include "ultra64/gbi.h" +#include "ultra64/gs2dex.h" void guS2DInitBg(uObjBg* bg) { u16 tmem = (bg->b.imageFmt == G_IM_FMT_CI) ? 0x100 : 0x200; diff --git a/src/libultra/io/aigetlen.c b/src/libultra/io/aigetlen.c index 45be442516..5787f10e33 100644 --- a/src/libultra/io/aigetlen.c +++ b/src/libultra/io/aigetlen.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" /** * Returns the number of bytes remaining in a currently ongoing audio DMA. diff --git a/src/libultra/io/aisetfreq.c b/src/libultra/io/aisetfreq.c index 9e1b8c44e2..ce79191e11 100644 --- a/src/libultra/io/aisetfreq.c +++ b/src/libultra/io/aisetfreq.c @@ -1,4 +1,6 @@ -#include "global.h" +#include "ultra64.h" + +extern s32 osViClock; /** * Programs the operating frequency of the Audio DAC. diff --git a/src/libultra/io/cartrominit.c b/src/libultra/io/cartrominit.c index b2cf1d1e17..22dd36e631 100644 --- a/src/libultra/io/cartrominit.c +++ b/src/libultra/io/cartrominit.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" OSPiHandle __CartRomHandle; diff --git a/src/libultra/io/contpfs.c b/src/libultra/io/contpfs.c index 20b2ea63ff..0506ca5d5a 100644 --- a/src/libultra/io/contpfs.c +++ b/src/libultra/io/contpfs.c @@ -1,5 +1,5 @@ +#include "array_count.h" #include "ultra64.h" -#include "global.h" s32 __osPfsInodeCacheChannel = -1; u8 __osPfsInodeCacheBank = 250; diff --git a/src/libultra/io/contquery.c b/src/libultra/io/contquery.c index 9a8370af31..b90ea2ff68 100644 --- a/src/libultra/io/contquery.c +++ b/src/libultra/io/contquery.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" /** * osContStartQuery: diff --git a/src/libultra/io/contramread.c b/src/libultra/io/contramread.c index 01e0703da6..d631d2fb6a 100644 --- a/src/libultra/io/contramread.c +++ b/src/libultra/io/contramread.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #define BLOCKSIZE 32 diff --git a/src/libultra/io/contramwrite.c b/src/libultra/io/contramwrite.c index 4bd8ffaa30..b71a3d48b1 100644 --- a/src/libultra/io/contramwrite.c +++ b/src/libultra/io/contramwrite.c @@ -1,5 +1,6 @@ #include "ultra64.h" -#include "global.h" + +extern s32 __osPfsLastChannel; s32 __osContRamWrite(OSMesgQueue* mq, s32 channel, u16 address, u8* buffer, s32 force) { #ifndef BBPLAYER diff --git a/src/libultra/io/contreaddata.c b/src/libultra/io/contreaddata.c index f1f250e965..bafb2ad40a 100644 --- a/src/libultra/io/contreaddata.c +++ b/src/libultra/io/contreaddata.c @@ -1,4 +1,5 @@ -#include "global.h" +#include "array_count.h" +#include "ultra64.h" s32 osContStartReadData(OSMesgQueue* mq) { s32 ret; diff --git a/src/libultra/io/controller.c b/src/libultra/io/controller.c index 3a2dc9a172..588e2ae9ac 100644 --- a/src/libultra/io/controller.c +++ b/src/libultra/io/controller.c @@ -1,4 +1,5 @@ -#include "global.h" +#include "array_count.h" +#include "ultra64.h" OSPifRam __osContPifRam; u8 __osContLastCmd; diff --git a/src/libultra/io/contsetch.c b/src/libultra/io/contsetch.c index 5ced5b6de4..c5002ce6ac 100644 --- a/src/libultra/io/contsetch.c +++ b/src/libultra/io/contsetch.c @@ -1,5 +1,4 @@ #include "ultra64.h" -#include "global.h" /* * s32 osContSetCh(u8 ch) diff --git a/src/libultra/io/crc.c b/src/libultra/io/crc.c index c1af0b12c5..485b6c0f54 100644 --- a/src/libultra/io/crc.c +++ b/src/libultra/io/crc.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" // Valid addr up to 0x7FF // It's the address of a block of 0x20 bytes in the mempak diff --git a/src/libultra/io/devmgr.c b/src/libultra/io/devmgr.c index 05dcb99519..7eb3197f81 100644 --- a/src/libultra/io/devmgr.c +++ b/src/libultra/io/devmgr.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/internal.h" #include "ultra64/leodrive.h" diff --git a/src/libultra/io/dpgetstat.c b/src/libultra/io/dpgetstat.c index 1a944b2c7a..1dbf5e09b8 100644 --- a/src/libultra/io/dpgetstat.c +++ b/src/libultra/io/dpgetstat.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" u32 osDpGetStatus(void) { return IO_READ(DPC_STATUS_REG); diff --git a/src/libultra/io/dpsetstat.c b/src/libultra/io/dpsetstat.c index 4275e1fde6..cfaa644b8d 100644 --- a/src/libultra/io/dpsetstat.c +++ b/src/libultra/io/dpsetstat.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void osDpSetStatus(u32 status) { IO_WRITE(DPC_STATUS_REG, status); diff --git a/src/libultra/io/epidma.c b/src/libultra/io/epidma.c index ca57a9d170..f2a073cb48 100644 --- a/src/libultra/io/epidma.c +++ b/src/libultra/io/epidma.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/internal.h" s32 osEPiStartDma(OSPiHandle* handle, OSIoMesg* mb, s32 direction) { diff --git a/src/libultra/io/epirawdma.c b/src/libultra/io/epirawdma.c index dbc072fbb2..3f238dd3fc 100644 --- a/src/libultra/io/epirawdma.c +++ b/src/libultra/io/epirawdma.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/bcp.h" s32 __osEPiRawStartDma(OSPiHandle* handle, s32 direction, u32 cartAddr, void* dramAddr, size_t size) { diff --git a/src/libultra/io/epirawread.c b/src/libultra/io/epirawread.c index 41997df66d..77d558958c 100644 --- a/src/libultra/io/epirawread.c +++ b/src/libultra/io/epirawread.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" s32 __osEPiRawReadIo(OSPiHandle* handle, u32 devAddr, u32* data) { s32 status; diff --git a/src/libultra/io/epirawwrite.c b/src/libultra/io/epirawwrite.c index 4d704a1923..d9b1377656 100644 --- a/src/libultra/io/epirawwrite.c +++ b/src/libultra/io/epirawwrite.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" s32 __osEPiRawWriteIo(OSPiHandle* handle, u32 devAddr, u32 data) { s32 status; diff --git a/src/libultra/io/epiread.c b/src/libultra/io/epiread.c index d05604a589..a102bbc7e0 100644 --- a/src/libultra/io/epiread.c +++ b/src/libultra/io/epiread.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" s32 osEPiReadIo(OSPiHandle* handle, u32 devAddr, u32* data) { register s32 ret; diff --git a/src/libultra/io/epiwrite.c b/src/libultra/io/epiwrite.c index 0547e69991..c06e71f7a8 100644 --- a/src/libultra/io/epiwrite.c +++ b/src/libultra/io/epiwrite.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" s32 osEPiWriteIo(OSPiHandle* handle, u32 devAddr, u32 data) { register s32 ret; diff --git a/src/libultra/io/motor.c b/src/libultra/io/motor.c index 7350ef9210..78ce191b7b 100644 --- a/src/libultra/io/motor.c +++ b/src/libultra/io/motor.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #define MOTOR_ID 0x80 diff --git a/src/libultra/io/pfsallocatefile.c b/src/libultra/io/pfsallocatefile.c index c20531224e..10684cc736 100644 --- a/src/libultra/io/pfsallocatefile.c +++ b/src/libultra/io/pfsallocatefile.c @@ -1,5 +1,4 @@ #include "ultra64.h" -#include "global.h" #include "ultra64/pfs.h" s32 osPfsAllocateFile(OSPfs* pfs, u16 companyCode, u32 gameCode, u8* gameName, u8* extName, s32 fileSize, s32* fileNo) { diff --git a/src/libultra/io/pfschecker.c b/src/libultra/io/pfschecker.c index b0a94f1ad4..fddb150d53 100644 --- a/src/libultra/io/pfschecker.c +++ b/src/libultra/io/pfschecker.c @@ -1,5 +1,4 @@ #include "ultra64.h" -#include "global.h" #include "ultra64/pfs.h" #define CHECK_IPAGE(p) \ diff --git a/src/libultra/io/pfsdeletefile.c b/src/libultra/io/pfsdeletefile.c index 573af6a724..864dbd6b81 100644 --- a/src/libultra/io/pfsdeletefile.c +++ b/src/libultra/io/pfsdeletefile.c @@ -1,5 +1,5 @@ #include "ultra64/pfs.h" -#include "global.h" +#include "ultra64.h" s32 osPfsDeleteFile(OSPfs* pfs, u16 companyCode, u32 gameCode, u8* gameName, u8* extName) { s32 file_no; diff --git a/src/libultra/io/pfsfilestate.c b/src/libultra/io/pfsfilestate.c index 367a7f27d6..489e4b300e 100644 --- a/src/libultra/io/pfsfilestate.c +++ b/src/libultra/io/pfsfilestate.c @@ -1,5 +1,4 @@ #include "ultra64.h" -#include "global.h" s32 osPfsFileState(OSPfs* pfs, s32 fileNo, OSPfsState* state) { s32 ret; diff --git a/src/libultra/io/pfsfindfile.c b/src/libultra/io/pfsfindfile.c index ad0bde885a..06e6d57f3f 100644 --- a/src/libultra/io/pfsfindfile.c +++ b/src/libultra/io/pfsfindfile.c @@ -1,5 +1,4 @@ #include "ultra64.h" -#include "global.h" s32 osPfsFindFile(OSPfs* pfs, u16 companyCode, u32 gameCode, u8* gameName, u8* extName, s32* fileNo) { s32 j; diff --git a/src/libultra/io/pfsfreeblocks.c b/src/libultra/io/pfsfreeblocks.c index 7210c65815..6bf8678bc1 100644 --- a/src/libultra/io/pfsfreeblocks.c +++ b/src/libultra/io/pfsfreeblocks.c @@ -1,5 +1,4 @@ #include "ultra64.h" -#include "global.h" #include "ultra64/pfs.h" s32 osPfsFreeBlocks(OSPfs* pfs, s32* leftoverBytes) { diff --git a/src/libultra/io/pfsgetstatus.c b/src/libultra/io/pfsgetstatus.c index aa9851e6e7..a6f09fa63b 100644 --- a/src/libultra/io/pfsgetstatus.c +++ b/src/libultra/io/pfsgetstatus.c @@ -1,5 +1,4 @@ #include "ultra64.h" -#include "global.h" s32 __osPfsGetStatus(OSMesgQueue* queue, s32 channel) { #ifndef BBPLAYER diff --git a/src/libultra/io/pfsinitpak.c b/src/libultra/io/pfsinitpak.c index 59fb8eda9b..9e03188dca 100644 --- a/src/libultra/io/pfsinitpak.c +++ b/src/libultra/io/pfsinitpak.c @@ -1,5 +1,4 @@ #include "ultra64.h" -#include "global.h" s32 osPfsInitPak(OSMesgQueue* queue, OSPfs* pfs, s32 channel) { s32 ret; diff --git a/src/libultra/io/pfsisplug.c b/src/libultra/io/pfsisplug.c index 9a144d0cb5..faa0752172 100644 --- a/src/libultra/io/pfsisplug.c +++ b/src/libultra/io/pfsisplug.c @@ -1,5 +1,4 @@ #include "ultra64.h" -#include "global.h" OSPifRam __osPfsPifRam; diff --git a/src/libultra/io/pfsreadwritefile.c b/src/libultra/io/pfsreadwritefile.c index b2c78a7464..b2579839ff 100644 --- a/src/libultra/io/pfsreadwritefile.c +++ b/src/libultra/io/pfsreadwritefile.c @@ -1,5 +1,4 @@ #include "ultra64.h" -#include "global.h" #define CHECK_IPAGE(p, pfs) \ (((p).ipage >= (pfs).inodeStartPage) && ((p).inode_t.bank < (pfs).banks) && ((p).inode_t.page >= 0x01) && \ diff --git a/src/libultra/io/pfsselectbank.c b/src/libultra/io/pfsselectbank.c index d257e04911..1c89138546 100644 --- a/src/libultra/io/pfsselectbank.c +++ b/src/libultra/io/pfsselectbank.c @@ -1,5 +1,5 @@ #include "ultra64/pfs.h" -#include "global.h" +#include "ultra64.h" s32 __osPfsSelectBank(OSPfs* pfs, u8 bank) { u8 temp[BLOCKSIZE]; diff --git a/src/libultra/io/piacs.c b/src/libultra/io/piacs.c index cff131f690..84cc4246be 100644 --- a/src/libultra/io/piacs.c +++ b/src/libultra/io/piacs.c @@ -1,4 +1,5 @@ -#include "global.h" +#include "array_count.h" +#include "ultra64.h" u32 __osPiAccessQueueEnabled = false; static OSMesg piAccessBuf[1]; diff --git a/src/libultra/io/pigetcmdq.c b/src/libultra/io/pigetcmdq.c index 3f6f173580..c0de3d088b 100644 --- a/src/libultra/io/pigetcmdq.c +++ b/src/libultra/io/pigetcmdq.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/internal.h" OSMesgQueue* osPiGetCmdQueue(void) { diff --git a/src/libultra/io/pimgr.c b/src/libultra/io/pimgr.c index 6b006d7aa8..58f5def6e9 100644 --- a/src/libultra/io/pimgr.c +++ b/src/libultra/io/pimgr.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "stack.h" #include "ultra64/internal.h" diff --git a/src/libultra/io/pirawdma.c b/src/libultra/io/pirawdma.c index 84f809c9c9..20a0e18a9b 100644 --- a/src/libultra/io/pirawdma.c +++ b/src/libultra/io/pirawdma.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" s32 __osPiRawStartDma(s32 dir, u32 cartAddr, void* dramAddr, size_t size) { s32 status; diff --git a/src/libultra/io/si.c b/src/libultra/io/si.c index 4afee03405..65cab5e898 100644 --- a/src/libultra/io/si.c +++ b/src/libultra/io/si.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" s32 __osSiDeviceBusy(void) { register u32 status = IO_READ(SI_STATUS_REG); diff --git a/src/libultra/io/siacs.c b/src/libultra/io/siacs.c index 9f528feeff..8359c1bdda 100644 --- a/src/libultra/io/siacs.c +++ b/src/libultra/io/siacs.c @@ -1,4 +1,5 @@ -#include "global.h" +#include "array_count.h" +#include "ultra64.h" static OSMesg siAccessBuf[1]; OSMesgQueue __osSiAccessQueue; diff --git a/src/libultra/io/sirawdma.c b/src/libultra/io/sirawdma.c index 0aa2f86942..4e7d082fd7 100644 --- a/src/libultra/io/sirawdma.c +++ b/src/libultra/io/sirawdma.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/bbskapi.h" #define PIF_RAM_SIZE (PIF_RAM_END + 1 - PIF_RAM_START) diff --git a/src/libultra/io/sirawread.c b/src/libultra/io/sirawread.c index 8efa071efb..71646f0324 100644 --- a/src/libultra/io/sirawread.c +++ b/src/libultra/io/sirawread.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" s32 __osSiRawReadIo(void* devAddr, u32* dst) { if (__osSiDeviceBusy()) { diff --git a/src/libultra/io/sirawwrite.c b/src/libultra/io/sirawwrite.c index f0e4514d77..c4b688813d 100644 --- a/src/libultra/io/sirawwrite.c +++ b/src/libultra/io/sirawwrite.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" s32 __osSiRawWriteIo(void* devAddr, u32 val) { if (__osSiDeviceBusy()) { diff --git a/src/libultra/io/sp.c b/src/libultra/io/sp.c index 1796dc8f6e..3f4bbca704 100644 --- a/src/libultra/io/sp.c +++ b/src/libultra/io/sp.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" u32 __osSpDeviceBusy(void) { register u32 status = IO_READ(SP_STATUS_REG); diff --git a/src/libultra/io/spgetstat.c b/src/libultra/io/spgetstat.c index e1545bdb7c..5b749e03f6 100644 --- a/src/libultra/io/spgetstat.c +++ b/src/libultra/io/spgetstat.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" u32 __osSpGetStatus(void) { return IO_READ(SP_STATUS_REG); diff --git a/src/libultra/io/sprawdma.c b/src/libultra/io/sprawdma.c index 795282c4a0..2faee64ca0 100644 --- a/src/libultra/io/sprawdma.c +++ b/src/libultra/io/sprawdma.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" s32 __osSpRawStartDma(s32 direction, void* devAddr, void* dramAddr, u32 size) { if (__osSpDeviceBusy()) { diff --git a/src/libultra/io/spsetpc.c b/src/libultra/io/spsetpc.c index 944fc98631..5ffae42652 100644 --- a/src/libultra/io/spsetpc.c +++ b/src/libultra/io/spsetpc.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" s32 __osSpSetPc(void* pc) { register u32 spStatus = IO_READ(SP_STATUS_REG); diff --git a/src/libultra/io/spsetstat.c b/src/libultra/io/spsetstat.c index 3fa7a49188..9becdb0ebe 100644 --- a/src/libultra/io/spsetstat.c +++ b/src/libultra/io/spsetstat.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void __osSpSetStatus(u32 status) { IO_WRITE(SP_STATUS_REG, status); diff --git a/src/libultra/io/sptask.c b/src/libultra/io/sptask.c index be805ab5ce..b728146bda 100644 --- a/src/libultra/io/sptask.c +++ b/src/libultra/io/sptask.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #define _osVirtualToPhysical(ptr) \ if (ptr != NULL) { \ diff --git a/src/libultra/io/sptaskyield.c b/src/libultra/io/sptaskyield.c index ec7a248bbb..1aaf3773b5 100644 --- a/src/libultra/io/sptaskyield.c +++ b/src/libultra/io/sptaskyield.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void osSpTaskYield(void) { __osSpSetStatus(SP_SET_SIG0); diff --git a/src/libultra/io/sptaskyielded.c b/src/libultra/io/sptaskyielded.c index 8be0556c33..13acd4a5ff 100644 --- a/src/libultra/io/sptaskyielded.c +++ b/src/libultra/io/sptaskyielded.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" u32 osSpTaskYielded(OSTask* task) { u32 status = __osSpGetStatus(); diff --git a/src/libultra/io/vi.c b/src/libultra/io/vi.c index dac56ed812..c2c91ba276 100644 --- a/src/libultra/io/vi.c +++ b/src/libultra/io/vi.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/viint.h" OSViContext vi[2] = { 0 }; diff --git a/src/libultra/io/viblack.c b/src/libultra/io/viblack.c index 491522fb1f..7866f3fc9d 100644 --- a/src/libultra/io/viblack.c +++ b/src/libultra/io/viblack.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/viint.h" void osViBlack(u8 active) { diff --git a/src/libultra/io/viextendvstart.c b/src/libultra/io/viextendvstart.c index 9efb9dbc3a..a28a8386d5 100644 --- a/src/libultra/io/viextendvstart.c +++ b/src/libultra/io/viextendvstart.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void osViExtendVStart(u32 value) { __additional_scanline = value; diff --git a/src/libultra/io/vigetcurrcontext.c b/src/libultra/io/vigetcurrcontext.c index 1e3c6ffa3c..24ebcc5745 100644 --- a/src/libultra/io/vigetcurrcontext.c +++ b/src/libultra/io/vigetcurrcontext.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" OSViContext* __osViGetCurrentContext(void) { return __osViCurr; diff --git a/src/libultra/io/vigetcurrframebuf.c b/src/libultra/io/vigetcurrframebuf.c index 442a1afa9d..3c7ec71183 100644 --- a/src/libultra/io/vigetcurrframebuf.c +++ b/src/libultra/io/vigetcurrframebuf.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void* osViGetCurrentFramebuffer(void) { register u32 prevInt = __osDisableInt(); diff --git a/src/libultra/io/vigetnextframebuf.c b/src/libultra/io/vigetnextframebuf.c index 5e6bd2ac74..8c782ca54f 100644 --- a/src/libultra/io/vigetnextframebuf.c +++ b/src/libultra/io/vigetnextframebuf.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void* osViGetNextFramebuffer(void) { register u32 prevInt = __osDisableInt(); diff --git a/src/libultra/io/vimgr.c b/src/libultra/io/vimgr.c index a075ebf4f7..b4857c334a 100644 --- a/src/libultra/io/vimgr.c +++ b/src/libultra/io/vimgr.c @@ -1,6 +1,7 @@ -#include "global.h" -#include "stack.h" #include "ultra64/internal.h" +#include "array_count.h" +#include "stack.h" +#include "ultra64.h" static OSThread viThread; static STACK(viThreadStack, 0x1000); diff --git a/src/libultra/io/visetevent.c b/src/libultra/io/visetevent.c index 89e482cf84..789e044a60 100644 --- a/src/libultra/io/visetevent.c +++ b/src/libultra/io/visetevent.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void osViSetEvent(OSMesgQueue* mq, OSMesg msg, u32 retraceCount) { register u32 prevInt = __osDisableInt(); diff --git a/src/libultra/io/visetmode.c b/src/libultra/io/visetmode.c index 8c34a4ee31..38eae7522b 100644 --- a/src/libultra/io/visetmode.c +++ b/src/libultra/io/visetmode.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/viint.h" void osViSetMode(OSViMode* mode) { diff --git a/src/libultra/io/visetspecial.c b/src/libultra/io/visetspecial.c index d51e3479d3..ef053fee1f 100644 --- a/src/libultra/io/visetspecial.c +++ b/src/libultra/io/visetspecial.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/viint.h" /** diff --git a/src/libultra/io/visetxscale.c b/src/libultra/io/visetxscale.c index 5e5e04ee47..765ac43844 100644 --- a/src/libultra/io/visetxscale.c +++ b/src/libultra/io/visetxscale.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/viint.h" void osViSetXScale(f32 value) { diff --git a/src/libultra/io/visetyscale.c b/src/libultra/io/visetyscale.c index adea96fd23..95c3273580 100644 --- a/src/libultra/io/visetyscale.c +++ b/src/libultra/io/visetyscale.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/viint.h" void osViSetYScale(f32 scale) { diff --git a/src/libultra/io/viswapbuf.c b/src/libultra/io/viswapbuf.c index 99259c03c3..e1e42922d2 100644 --- a/src/libultra/io/viswapbuf.c +++ b/src/libultra/io/viswapbuf.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/viint.h" void osViSwapBuffer(void* frameBufPtr) { diff --git a/src/libultra/io/viswapcontext.c b/src/libultra/io/viswapcontext.c index d1a7d0c0e6..19892ece36 100644 --- a/src/libultra/io/viswapcontext.c +++ b/src/libultra/io/viswapcontext.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/viint.h" void __osViSwapContext(void) { diff --git a/src/libultra/mgu/normalize.s b/src/libultra/mgu/normalize.s index 8174527f2c..d94748bced 100644 --- a/src/libultra/mgu/normalize.s +++ b/src/libultra/mgu/normalize.s @@ -8,20 +8,24 @@ LEAF(guNormalize) lwc1 ft0, (a0) lwc1 ft1, (a1) lwc1 ft2, (a2) +.set noreorder mul.s ft3, ft0, ft0 li.s t0, 1.0 mul.s ft4, ft1, ft1 add.s ft5, ft3, ft4 mul.s ft4, ft2, ft2 +.set reorder add.s ft3, ft4, ft5 mtc1 t0, ft5 sqrt.s ft4, ft3 div.s ft3, ft5, ft4 +.set noreorder mul.s ft4, ft0, ft3 nop mul.s ft5, ft1, ft3 nop mul.s ft0, ft2, ft3 +.set reorder swc1 ft4, (a0) swc1 ft5, (a1) swc1 ft0, (a2) diff --git a/src/libultra/os/afterprenmi.c b/src/libultra/os/afterprenmi.c index b59814763f..6a9a83de33 100644 --- a/src/libultra/os/afterprenmi.c +++ b/src/libultra/os/afterprenmi.c @@ -1,5 +1,4 @@ #include "ultra64.h" -#include "global.h" s32 osAfterPreNMI(void) { return __osSpSetPc(0); diff --git a/src/libultra/os/createmesgqueue.c b/src/libultra/os/createmesgqueue.c index a85eadb0d7..4598de6aaa 100644 --- a/src/libultra/os/createmesgqueue.c +++ b/src/libultra/os/createmesgqueue.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void osCreateMesgQueue(OSMesgQueue* mq, OSMesg* msg, s32 count) { mq->mtqueue = (OSThread*)&__osThreadTail; diff --git a/src/libultra/os/createthread.c b/src/libultra/os/createthread.c index 8d54fb9871..9332207971 100644 --- a/src/libultra/os/createthread.c +++ b/src/libultra/os/createthread.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/asm.h" void osCreateThread(OSThread* thread, OSId id, void (*entry)(void*), void* arg, void* sp, OSPri pri) { diff --git a/src/libultra/os/destroythread.c b/src/libultra/os/destroythread.c index a3273cadee..0b74a4fcbc 100644 --- a/src/libultra/os/destroythread.c +++ b/src/libultra/os/destroythread.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void osDestroyThread(OSThread* thread) { register u32 prevInt = __osDisableInt(); diff --git a/src/libultra/os/getactivequeue.c b/src/libultra/os/getactivequeue.c index de55d7f041..633e01814a 100644 --- a/src/libultra/os/getactivequeue.c +++ b/src/libultra/os/getactivequeue.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" OSThread* __osGetActiveQueue(void) { return __osActiveQueue; diff --git a/src/libultra/os/getcurrfaultedthread.c b/src/libultra/os/getcurrfaultedthread.c index f36799b26f..bf2edb92d3 100644 --- a/src/libultra/os/getcurrfaultedthread.c +++ b/src/libultra/os/getcurrfaultedthread.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" OSThread* __osGetCurrFaultedThread(void) { return __osFaultedThread; diff --git a/src/libultra/os/gethwintrroutine.c b/src/libultra/os/gethwintrroutine.c index d7d8897803..64044e66d3 100644 --- a/src/libultra/os/gethwintrroutine.c +++ b/src/libultra/os/gethwintrroutine.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/internal.h" void __osGetHWIntrRoutine(OSHWIntr intr, s32 (**callbackOut)(void), void** spOut) { diff --git a/src/libultra/os/getmemsize.c b/src/libultra/os/getmemsize.c index 1adbd66ff4..9489b0f057 100644 --- a/src/libultra/os/getmemsize.c +++ b/src/libultra/os/getmemsize.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #define STEP 0x100000 diff --git a/src/libultra/os/getthreadid.c b/src/libultra/os/getthreadid.c index 792229c9bf..8cee7a2aa3 100644 --- a/src/libultra/os/getthreadid.c +++ b/src/libultra/os/getthreadid.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" OSId osGetThreadId(OSThread* thread) { if (thread == NULL) { diff --git a/src/libultra/os/getthreadpri.c b/src/libultra/os/getthreadpri.c index 6c36a7c3b1..8eed2024f9 100644 --- a/src/libultra/os/getthreadpri.c +++ b/src/libultra/os/getthreadpri.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" OSPri osGetThreadPri(OSThread* thread) { if (thread == NULL) { diff --git a/src/libultra/os/gettime.c b/src/libultra/os/gettime.c index e8943cd9e0..e0adcc9f80 100644 --- a/src/libultra/os/gettime.c +++ b/src/libultra/os/gettime.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" OSTime osGetTime(void) { u32 count; diff --git a/src/libultra/os/initialize.c b/src/libultra/os/initialize.c index 300f2743dc..1241a0ac8f 100644 --- a/src/libultra/os/initialize.c +++ b/src/libultra/os/initialize.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/bcp.h" typedef struct __osExceptionVector { @@ -10,10 +10,13 @@ typedef struct __osExceptionVector { extern __osExceptionVector __osExceptionPreamble; +extern OSPiHandle __Dom1SpeedParam; +extern OSPiHandle __Dom2SpeedParam; + u64 osClockRate = OS_CLOCK_RATE; s32 osViClock = VI_NTSC_CLOCK; u32 __osShutdown = false; -OSHWIntr __OSGlobalIntMask = OS_IM_ALL; +OSIntMask __OSGlobalIntMask = OS_IM_ALL; u32 __osFinalrom; @@ -55,7 +58,7 @@ void OSINITIALIZE_FUNC(void) { __osFinalrom = true; __osSetSR(__osGetSR() | SR_CU1); - __osSetFpcCsr(FPCSR_FS | FPCSR_EV); + __osSetFpcCsr(FPCSR_FS | FPCSR_EV | FPCSR_RM_RN); #if LIBULTRA_VERSION >= LIBULTRA_VERSION_K __osSetWatchLo(0x04900000); #endif diff --git a/src/libultra/os/jammesg.c b/src/libultra/os/jammesg.c index e0ca40fc68..b5d42895c2 100644 --- a/src/libultra/os/jammesg.c +++ b/src/libultra/os/jammesg.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" s32 osJamMesg(OSMesgQueue* mq, OSMesg msg, s32 flag) { register u32 prevInt = __osDisableInt(); diff --git a/src/libultra/os/recvmesg.c b/src/libultra/os/recvmesg.c index 3254867cce..0e60519d18 100644 --- a/src/libultra/os/recvmesg.c +++ b/src/libultra/os/recvmesg.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" s32 osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flag) { register u32 prevInt = __osDisableInt(); diff --git a/src/libultra/os/resetglobalintmask.c b/src/libultra/os/resetglobalintmask.c index c418731838..1dde3754ca 100644 --- a/src/libultra/os/resetglobalintmask.c +++ b/src/libultra/os/resetglobalintmask.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void __osResetGlobalIntMask(OSHWIntr mask) { register u32 prevInt = __osDisableInt(); diff --git a/src/libultra/os/sendmesg.c b/src/libultra/os/sendmesg.c index df0bc2bee4..cba5dcee81 100644 --- a/src/libultra/os/sendmesg.c +++ b/src/libultra/os/sendmesg.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" s32 osSendMesg(OSMesgQueue* mq, OSMesg msg, s32 flag) { register u32 prevInt = __osDisableInt(); diff --git a/src/libultra/os/seteventmesg.c b/src/libultra/os/seteventmesg.c index d105850ee1..d77dea8999 100644 --- a/src/libultra/os/seteventmesg.c +++ b/src/libultra/os/seteventmesg.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/internal.h" __OSEventState __osEventStateTab[OS_NUM_EVENTS]; diff --git a/src/libultra/os/setglobalintmask.c b/src/libultra/os/setglobalintmask.c index 8c4aebb926..c75f846f1e 100644 --- a/src/libultra/os/setglobalintmask.c +++ b/src/libultra/os/setglobalintmask.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void __osSetGlobalIntMask(OSHWIntr mask) { register u32 prevInt = __osDisableInt(); diff --git a/src/libultra/os/sethwintrroutine.c b/src/libultra/os/sethwintrroutine.c index e6bb74f0f3..5ceae62bb1 100644 --- a/src/libultra/os/sethwintrroutine.c +++ b/src/libultra/os/sethwintrroutine.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" #include "ultra64/internal.h" void __osSetHWIntrRoutine(OSHWIntr intr, s32 (*callback)(void), void* sp) { diff --git a/src/libultra/os/setthreadpri.c b/src/libultra/os/setthreadpri.c index a9a1b0eb6e..93ece6f5c8 100644 --- a/src/libultra/os/setthreadpri.c +++ b/src/libultra/os/setthreadpri.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void osSetThreadPri(OSThread* thread, OSPri pri) { register u32 prevInt = __osDisableInt(); diff --git a/src/libultra/os/settime.c b/src/libultra/os/settime.c index 2be47ed9ed..310809e2c4 100644 --- a/src/libultra/os/settime.c +++ b/src/libultra/os/settime.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void osSetTime(OSTime time) { __osCurrentTime = time; diff --git a/src/libultra/os/settimer.c b/src/libultra/os/settimer.c index c5632e82c2..4ad8ccc820 100644 --- a/src/libultra/os/settimer.c +++ b/src/libultra/os/settimer.c @@ -1,4 +1,7 @@ -#include "global.h" +#include "ultra64.h" +#include "attributes.h" + +#include "ultra64.h" s32 osSetTimer(OSTimer* timer, OSTime countdown, OSTime interval, OSMesgQueue* mq, OSMesg msg) { UNUSED OSTime time; diff --git a/src/libultra/os/startthread.c b/src/libultra/os/startthread.c index 6594fd5ae5..eb84bd9461 100644 --- a/src/libultra/os/startthread.c +++ b/src/libultra/os/startthread.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void osStartThread(OSThread* thread) { register u32 prevInt = __osDisableInt(); diff --git a/src/libultra/os/stopthread.c b/src/libultra/os/stopthread.c index 53aecd940a..6e24b5d83f 100644 --- a/src/libultra/os/stopthread.c +++ b/src/libultra/os/stopthread.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void osStopThread(OSThread* thread) { register u32 prevInt = __osDisableInt(); diff --git a/src/libultra/os/stoptimer.c b/src/libultra/os/stoptimer.c index d6d20536a1..e8dbdbd2cf 100644 --- a/src/libultra/os/stoptimer.c +++ b/src/libultra/os/stoptimer.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" s32 osStopTimer(OSTimer* timer) { register u32 prevInt; diff --git a/src/libultra/os/thread.c b/src/libultra/os/thread.c index 0263acb454..a9429b6b9b 100644 --- a/src/libultra/os/thread.c +++ b/src/libultra/os/thread.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" __OSThreadTail __osThreadTail = { NULL, OS_PRIORITY_THREADTAIL }; OSThread* __osRunQueue = (OSThread*)&__osThreadTail; diff --git a/src/libultra/os/timerintr.c b/src/libultra/os/timerintr.c index 3f94368b20..2e6d6ba71b 100644 --- a/src/libultra/os/timerintr.c +++ b/src/libultra/os/timerintr.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" OSTimer __osBaseTimer; OSTime __osCurrentTime; diff --git a/src/libultra/os/virtualtophysical.c b/src/libultra/os/virtualtophysical.c index 0037572232..0906dc51af 100644 --- a/src/libultra/os/virtualtophysical.c +++ b/src/libultra/os/virtualtophysical.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" u32 osVirtualToPhysical(void* vaddr) { if (IS_KSEG0(vaddr)) { diff --git a/src/libultra/os/yieldthread.c b/src/libultra/os/yieldthread.c index af9e15a2c1..a0604f7183 100644 --- a/src/libultra/os/yieldthread.c +++ b/src/libultra/os/yieldthread.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "ultra64.h" void osYieldThread(void) { register u32 prevInt = __osDisableInt(); diff --git a/src/n64dd/n64dd_801C8000.c b/src/n64dd/n64dd_801C8000.c index 9b0a4b3adc..2212fe43fb 100644 --- a/src/n64dd/n64dd_801C8000.c +++ b/src/n64dd/n64dd_801C8000.c @@ -1,7 +1,10 @@ // Does some command processing -#include "global.h" + #include "n64dd.h" + +#include "array_count.h" #include "versions.h" +#include "z_locale.h" void func_801C8554(void); void func_801C8578(void* arg0, void* arg1, OSId id, void* sp, OSPri pri); diff --git a/src/n64dd/n64dd_801C8940.c b/src/n64dd/n64dd_801C8940.c index 437a23dcf2..132222b689 100644 --- a/src/n64dd/n64dd_801C8940.c +++ b/src/n64dd/n64dd_801C8940.c @@ -1,7 +1,9 @@ // Lower-level command processing in a background thread -#include "global.h" #include "n64dd.h" +#include "libc64/sleep.h" +#include "attributes.h" + s32 D_801D2EA0 = 0; u8* D_801D2EA4 = NULL; s32 D_801D2EA8 = 0; diff --git a/src/n64dd/n64dd_801C9440.c b/src/n64dd/n64dd_801C9440.c index 2d0b1b5c01..ecab855d4a 100644 --- a/src/n64dd/n64dd_801C9440.c +++ b/src/n64dd/n64dd_801C9440.c @@ -1,5 +1,4 @@ // Some text-handling functions -#include "global.h" #include "n64dd.h" #include "versions.h" diff --git a/src/n64dd/n64dd_801C9B70.c b/src/n64dd/n64dd_801C9B70.c index d7d2f63849..2437904c37 100644 --- a/src/n64dd/n64dd_801C9B70.c +++ b/src/n64dd/n64dd_801C9B70.c @@ -1,6 +1,6 @@ // User-facing error handling -#include "global.h" #include "n64dd.h" +#include "z_locale.h" u8 B_801E0F80[0x600]; u8 B_801E1580[0x2800]; diff --git a/src/n64dd/n64dd_801CA0B0.c b/src/n64dd/n64dd_801CA0B0.c index 8758e0fd62..e3ba1be18d 100644 --- a/src/n64dd/n64dd_801CA0B0.c +++ b/src/n64dd/n64dd_801CA0B0.c @@ -1,6 +1,9 @@ -#include "global.h" #include "n64dd.h" +#include "libc64/aprintf.h" +#include "attributes.h" +#include "array_count.h" + // Draws text to framebuffer typedef struct struct_801CA704 { /* 0x00 */ PrintCallback callback; diff --git a/src/n64dd/n64dd_data_buffer.c b/src/n64dd/n64dd_data_buffer.c index 6aacae2d57..d4dfeb3363 100644 --- a/src/n64dd/n64dd_data_buffer.c +++ b/src/n64dd/n64dd_data_buffer.c @@ -1,4 +1,3 @@ -#include "global.h" #include "n64dd.h" // Buffer used for reading from the disk? diff --git a/src/n64dd/n64dd_error_bodies.c b/src/n64dd/n64dd_error_bodies.c index 757e1afb6b..9c990d76bf 100644 --- a/src/n64dd/n64dd_error_bodies.c +++ b/src/n64dd/n64dd_error_bodies.c @@ -1,4 +1,3 @@ -#include "global.h" #include "n64dd.h" const char* D_801D2EE0[2][8][4] = { diff --git a/src/n64dd/n64dd_error_headers.c b/src/n64dd/n64dd_error_headers.c index b14d80fba5..ee7d611c21 100644 --- a/src/n64dd/n64dd_error_headers.c +++ b/src/n64dd/n64dd_error_headers.c @@ -1,4 +1,3 @@ -#include "global.h" #include "n64dd.h" // Padding in .rodata suggests that these are in a separate file diff --git a/src/n64dd/n64dd_error_textures.c b/src/n64dd/n64dd_error_textures.c index d115fdd6ef..38b42de363 100644 --- a/src/n64dd/n64dd_error_textures.c +++ b/src/n64dd/n64dd_error_textures.c @@ -2,18 +2,18 @@ u64 gN64DDError41Texs[2][0x600 / sizeof(u64)] = { { -#include "assets/n64dd/error_textures/n64dd_error_41_jpn.i4.inc.c" +#include "assets/n64dd/error_textures/gN64DDError41JPNTex.i4.inc.c" }, { -#include "assets/n64dd/error_textures/n64dd_error_41_eng.i4.inc.c" +#include "assets/n64dd/error_textures/gN64DDError41ENGTex.i4.inc.c" }, }; u64 gN64DDPleaseReadManualTexs[2][0x2800 / sizeof(u64)] = { { -#include "assets/n64dd/error_textures/n64dd_please_read_manual_jpn.i4.inc.c" +#include "assets/n64dd/error_textures/gN64DDPleaseReadManualJPNTex.i4.inc.c" }, { -#include "assets/n64dd/error_textures/n64dd_please_read_manual_eng.i4.inc.c" +#include "assets/n64dd/error_textures/gN64DDPleaseReadManualENGTex.i4.inc.c" }, }; diff --git a/src/n64dd/z_n64dd.c b/src/n64dd/z_n64dd.c index 3524cd348e..a8ce0674c7 100644 --- a/src/n64dd/z_n64dd.c +++ b/src/n64dd/z_n64dd.c @@ -1,13 +1,22 @@ // Main interface for the 64DD from the rest of the game. Starts background // threads and provides functions to submit commands to them. -#include "global.h" -#include "fault.h" -#include "n64dd.h" -#include "stack.h" -#include "versions.h" -#include "line_numbers.h" -#pragma increment_block_number "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" +#include "n64dd.h" + +#include "libc64/sleep.h" +#include "array_count.h" +#include "fault.h" +#include "gfx.h" +#include "irqmgr.h" +#include "line_numbers.h" +#include "stack.h" +#include "stackcheck.h" +#include "sys_freeze.h" +#include "versions.h" +#include "z64audio.h" +#include "z64thread.h" + +#pragma increment_block_number "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" typedef struct struct_801D9C30 { /* 0x000 */ s32 unk_000; // disk start diff --git a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c index f9c6f71d25..9ca642d4e9 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c @@ -176,7 +176,7 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { if (this->collider.elem.atHitElem->acElemFlags & ACELEM_HOOKABLE) { ArmsHook_AttachToActor(this, touchedActor); - if (CHECK_FLAG_ALL(touchedActor->flags, ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER)) { + if (ACTOR_FLAGS_CHECK_ALL(touchedActor, ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER)) { ArmsHook_PullPlayer(this); } } @@ -202,7 +202,7 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { if (attachedActor != NULL) { if ((attachedActor->update == NULL) || - !CHECK_FLAG_ALL(attachedActor->flags, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { + !ACTOR_FLAGS_CHECK_ALL(attachedActor, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { attachedActor = NULL; this->attachedActor = NULL; } else if (this->actor.child != NULL) { diff --git a/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c b/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c index 67268e9e8a..a92c226117 100644 --- a/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c +++ b/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c @@ -16,8 +16,6 @@ #include "z_lib.h" #include "z64play.h" -#include "z64.h" - #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_UPDATE_DURING_OCARINA) void ArrowFire_Init(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c b/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c index e84af1d7b7..953e0a333c 100644 --- a/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c +++ b/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c @@ -16,8 +16,6 @@ #include "z_lib.h" #include "z64play.h" -#include "z64.h" - #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_UPDATE_DURING_OCARINA) void ArrowIce_Init(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c b/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c index 4f3f5572e1..100b8c20c1 100644 --- a/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c +++ b/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c @@ -16,8 +16,6 @@ #include "z_lib.h" #include "z64play.h" -#include "z64.h" - #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_UPDATE_DURING_OCARINA) void ArrowLight_Init(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c index 2548f33e10..f8529bb775 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c +++ b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c @@ -8,14 +8,17 @@ #include "ichain.h" #include "one_point_cutscene.h" +#include "printf.h" #include "quake.h" #include "rumble.h" #include "sfx.h" #include "sys_matrix.h" +#include "translation.h" #include "z_lib.h" #include "z64audio.h" #include "z64play.h" #include "z64player.h" +#include "z64save.h" #include "assets/objects/object_bdan_objects/object_bdan_objects.h" @@ -106,7 +109,9 @@ s32 BgBdanObjects_GetProperty(BgBdanObjects* this, s32 arg1) { case JABU_OBJECTS_GET_PROP_CAM_SETTING_DUNGEON1: return this->cameraSetting == CAM_SET_DUNGEON1; default: - PRINTF("Bg_Bdan_Objects_Get_Contact_Ru1\nそんな受信モードは無い%d!!!!!!!!\n", arg1); + PRINTF(T("Bg_Bdan_Objects_Get_Contact_Ru1\nそんな受信モードは無い%d!!!!!!!!\n", + "Bg_Bdan_Objects_Get_Contact_Ru1\nThere is no such receiving mode %d!!!!!!!!\n"), + arg1); return -1; } } @@ -123,7 +128,9 @@ void BgBdanObjects_SetProperty(BgBdanObjects* this, s32 arg1) { SET_INFTABLE(INFTABLE_146); break; default: - PRINTF("Bg_Bdan_Objects_Set_Contact_Ru1\nそんな送信モードは無い%d!!!!!!!!\n", arg1); + PRINTF(T("Bg_Bdan_Objects_Set_Contact_Ru1\nそんな送信モードは無い%d!!!!!!!!\n", + "Bg_Bdan_Objects_Set_Contact_Ru1\nThere is no such transmission mode %d!!!!!!!!\n"), + arg1); } } diff --git a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c index a28786d50f..0dcb302eaa 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c +++ b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c @@ -7,10 +7,12 @@ #include "z_bg_bdan_switch.h" #include "ichain.h" -#include "rumble.h" #include "one_point_cutscene.h" +#include "printf.h" +#include "rumble.h" #include "sfx.h" #include "sys_matrix.h" +#include "translation.h" #include "z_lib.h" #include "z64play.h" #include "z64player.h" @@ -111,8 +113,9 @@ void BgBdanSwitch_InitDynaPoly(BgBdanSwitch* this, PlayState* play, CollisionHea if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; - PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_bdan_switch.c", 325, - this->dyna.actor.id, this->dyna.actor.params); + PRINTF(T("Warning : move BG 登録失敗", + "Warning : move BG registration failed") "(%s %d)(name %d)(arg_data 0x%04x)\n", + "../z_bg_bdan_switch.c", 325, this->dyna.actor.id, this->dyna.actor.params); } #endif } @@ -120,7 +123,7 @@ void BgBdanSwitch_InitDynaPoly(BgBdanSwitch* this, PlayState* play, CollisionHea void BgBdanSwitch_InitCollision(BgBdanSwitch* this, PlayState* play) { Actor* actor = &this->dyna.actor; Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, actor, &sJntSphInit, this->colliderItems); + Collider_SetJntSph(play, &this->collider, actor, &sJntSphInit, this->colliderElements); } void func_8086D0EC(BgBdanSwitch* this) { @@ -206,11 +209,13 @@ void BgBdanSwitch_Init(Actor* thisx, PlayState* play) { } break; default: - PRINTF("不正な ARG_DATA(arg_data 0x%04x)(%s %d)\n", this->dyna.actor.params, "../z_bg_bdan_switch.c", 454); + PRINTF(T("不正な", "Invalid") " ARG_DATA(arg_data 0x%04x)(%s %d)\n", this->dyna.actor.params, + "../z_bg_bdan_switch.c", 454); Actor_Kill(&this->dyna.actor); return; } - PRINTF("(巨大魚ダンジョン 専用スイッチ)(arg_data 0x%04x)\n", this->dyna.actor.params); + PRINTF(T("(巨大魚ダンジョン 専用スイッチ)", "(Giant Fish Dungeon Special Switch)") "(arg_data 0x%04x)\n", + this->dyna.actor.params); } void BgBdanSwitch_Destroy(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h index e47a98e6c8..f86ef79e3e 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h +++ b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.h @@ -20,7 +20,7 @@ typedef struct BgBdanSwitch { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ BgBdanSwitchActionFunc actionFunc; /* 0x0168 */ ColliderJntSph collider; - /* 0x0188 */ ColliderJntSphElement colliderItems[1]; + /* 0x0188 */ ColliderJntSphElement colliderElements[1]; /* 0x01C8 */ f32 unk_1C8; /* 0x01CC */ s16 unk_1CC; /* 0x01CE */ char unk_1CE[0x2]; diff --git a/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c b/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c index ae816120b4..bee0e2484c 100644 --- a/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c +++ b/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c @@ -7,8 +7,10 @@ #include "z_bg_bom_guard.h" #include "overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h" +#include "printf.h" #include "regs.h" #include "terminal.h" +#include "translation.h" #include "z64play.h" #include "assets/objects/object_bowl/object_bowl.h" @@ -47,7 +49,7 @@ void BgBomGuard_Init(Actor* thisx, PlayState* play) { this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); PRINTF("\n\n"); - PRINTF(VT_FGCOL(GREEN) " ☆☆☆☆☆ 透明ガード出現 ☆☆☆☆☆ \n" VT_RST); + PRINTF(VT_FGCOL(GREEN) " ☆☆☆☆☆ " T("透明ガード出現", "Transparent guard appears") " ☆☆☆☆☆ \n" VT_RST); thisx->scale.x = 1.0f; thisx->scale.y = 1.0f; diff --git a/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c b/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c index 0e5db9b283..6db143bdf8 100644 --- a/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c @@ -7,7 +7,9 @@ #include "z_bg_bombwall.h" #include "libc64/qrand.h" #include "ichain.h" +#include "printf.h" #include "sfx.h" +#include "translation.h" #include "z_lib.h" #include "z64play.h" @@ -97,9 +99,8 @@ void BgBombwall_InitDynapoly(BgBombwall* this, PlayState* play) { this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { - // "Warning : move BG login failed" - PRINTF("Warning : move BG 登録失敗(%s %d)(arg_data 0x%04x)\n", "../z_bg_bombwall.c", 243, - this->dyna.actor.params); + PRINTF(T("Warning : move BG 登録失敗", "Warning : move BG registration failed") "(%s %d)(arg_data 0x%04x)\n", + "../z_bg_bombwall.c", 243, this->dyna.actor.params); } } @@ -134,7 +135,7 @@ void BgBombwall_Init(Actor* thisx, PlayState* play) { BgBombwall_InitDynapoly(this, play); this->unk_2A2 |= 2; Collider_InitTris(play, &this->collider); - Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInit, this->colliderItems); + Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInit, this->colliderElements); for (i = 0; i <= 2; i++) { for (j = 0; j <= 2; j++) { @@ -155,8 +156,8 @@ void BgBombwall_Init(Actor* thisx, PlayState* play) { func_8086ED50(this, play); } - PRINTF("(field keep 汎用爆弾壁)(arg_data 0x%04x)(angY %d)\n", this->dyna.actor.params, - this->dyna.actor.shape.rot.y); + PRINTF("(field keep " T("汎用爆弾壁", "general purpose bomb wall") ")(arg_data 0x%04x)(angY %d)\n", + this->dyna.actor.params, this->dyna.actor.shape.rot.y); } void BgBombwall_DestroyCollision(BgBombwall* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.h b/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.h index 4c58b38788..8cd1bb879f 100644 --- a/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.h +++ b/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.h @@ -11,7 +11,7 @@ typedef void (*BgBombwallActionFunc)(struct BgBombwall*, struct PlayState*); typedef struct BgBombwall { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ ColliderTris collider; - /* 0x0184 */ ColliderTrisElement colliderItems[3]; + /* 0x0184 */ ColliderTrisElement colliderElements[3]; /* 0x0298 */ BgBombwallActionFunc actionFunc; /* 0x029C */ Gfx* dList; /* 0x02A0 */ s16 unk_2A0; diff --git a/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c b/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c index 377efc13e8..e0c0e1c4fd 100644 --- a/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c +++ b/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c @@ -10,11 +10,13 @@ #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" +#include "quake.h" #include "rand.h" #include "sfx.h" -#include "quake.h" #include "sys_matrix.h" #include "terminal.h" +#include "translation.h" #include "z_lib.h" #include "z64effect.h" #include "z64play.h" @@ -72,7 +74,9 @@ void BgBowlWall_Init(Actor* thisx, PlayState* play) { this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->initPos = this->dyna.actor.world.pos; PRINTF("\n\n"); - PRINTF(VT_FGCOL(GREEN) " ☆☆☆☆☆ ボーリングおじゃま壁発生 ☆☆☆☆☆ %d\n" VT_RST, this->dyna.actor.params); + PRINTF( + VT_FGCOL(GREEN) " ☆☆☆☆☆ " T("ボーリングおじゃま壁発生", "Bowling obstacle wall appears") " ☆☆☆☆☆ %d\n" VT_RST, + this->dyna.actor.params); this->actionFunc = BgBowlWall_SpawnBullseyes; this->dyna.actor.scale.x = this->dyna.actor.scale.y = this->dyna.actor.scale.z = 1.0f; } diff --git a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c index e03e1f6299..f36d251f45 100644 --- a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c +++ b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c @@ -17,6 +17,7 @@ #include "z_lib.h" #include "z64play.h" #include "z64player.h" +#include "z64save.h" #include "assets/scenes/dungeons/ddan/ddan_scene.h" #include "assets/objects/object_bwall/object_bwall.h" diff --git a/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c b/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c index 74e9b63fec..9a8669e535 100644 --- a/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c +++ b/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c @@ -9,6 +9,7 @@ #include "libc64/qrand.h" #include "ichain.h" #include "one_point_cutscene.h" +#include "printf.h" #include "rand.h" #include "rumble.h" #include "sfx.h" diff --git a/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c b/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c index 46f40d3ec0..3764381c19 100644 --- a/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c +++ b/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c @@ -7,21 +7,25 @@ #include "z_bg_dodoago.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" -#include "macros.h" #include "one_point_cutscene.h" #include "rand.h" #include "rumble.h" #include "sfx.h" #include "sys_matrix.h" +#include "z_en_item00.h" #include "z_lib.h" #include "z64effect.h" #include "z64play.h" +#include "z64save.h" #include "assets/objects/object_ddan_objects/object_ddan_objects.h" +#pragma increment_block_number "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" + #define FLAGS 0 void BgDodoago_Init(Actor* thisx, PlayState* play); @@ -139,12 +143,12 @@ void BgDodoago_Init(Actor* thisx, PlayState* play) { return; } - Collider_InitCylinder(play, &this->colliderMain); - Collider_InitCylinder(play, &this->colliderLeft); - Collider_InitCylinder(play, &this->colliderRight); - Collider_SetCylinder(play, &this->colliderMain, &this->dyna.actor, &sColCylinderInitMain); - Collider_SetCylinder(play, &this->colliderLeft, &this->dyna.actor, &sColCylinderInitLeftRight); - Collider_SetCylinder(play, &this->colliderRight, &this->dyna.actor, &sColCylinderInitLeftRight); + Collider_InitCylinder(play, &this->mainCollider); + Collider_InitCylinder(play, &this->leftCollider); + Collider_InitCylinder(play, &this->rightCollider); + Collider_SetCylinder(play, &this->mainCollider, &this->dyna.actor, &sColCylinderInitMain); + Collider_SetCylinder(play, &this->leftCollider, &this->dyna.actor, &sColCylinderInitLeftRight); + Collider_SetCylinder(play, &this->rightCollider, &this->dyna.actor, &sColCylinderInitLeftRight); BgDodoago_SetupAction(this, BgDodoago_WaitExplosives); sDisableBombCatcher = false; @@ -154,13 +158,13 @@ void BgDodoago_Destroy(Actor* thisx, PlayState* play) { BgDodoago* this = (BgDodoago*)thisx; DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); - Collider_DestroyCylinder(play, &this->colliderMain); - Collider_DestroyCylinder(play, &this->colliderLeft); - Collider_DestroyCylinder(play, &this->colliderRight); + Collider_DestroyCylinder(play, &this->mainCollider); + Collider_DestroyCylinder(play, &this->leftCollider); + Collider_DestroyCylinder(play, &this->rightCollider); } void BgDodoago_WaitExplosives(BgDodoago* this, PlayState* play) { - Actor* explosive = Actor_GetCollidedExplosive(play, &this->colliderMain.base); + Actor* explosive = Actor_GetCollidedExplosive(play, &this->mainCollider.base); if (explosive != NULL) { this->state = @@ -197,21 +201,21 @@ void BgDodoago_WaitExplosives(BgDodoago* this, PlayState* play) { sTimer = 50; } } else if (Flags_GetEventChkInf(EVENTCHKINF_B0)) { - Collider_UpdateCylinder(&this->dyna.actor, &this->colliderMain); - Collider_UpdateCylinder(&this->dyna.actor, &this->colliderLeft); - Collider_UpdateCylinder(&this->dyna.actor, &this->colliderRight); + Collider_UpdateCylinder(&this->dyna.actor, &this->mainCollider); + Collider_UpdateCylinder(&this->dyna.actor, &this->leftCollider); + Collider_UpdateCylinder(&this->dyna.actor, &this->rightCollider); - this->colliderMain.dim.pos.z += 200; + this->mainCollider.dim.pos.z += 200; - this->colliderLeft.dim.pos.z += 215; - this->colliderLeft.dim.pos.x += 90; + this->leftCollider.dim.pos.z += 215; + this->leftCollider.dim.pos.x += 90; - this->colliderRight.dim.pos.z += 215; - this->colliderRight.dim.pos.x -= 90; + this->rightCollider.dim.pos.z += 215; + this->rightCollider.dim.pos.x -= 90; - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderMain.base); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderLeft.base); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderRight.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->mainCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->leftCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->rightCollider.base); } } @@ -289,15 +293,15 @@ void BgDodoago_Update(Actor* thisx, PlayState* play) { if (this->dyna.actor.parent == NULL) { // this is a "bomb catcher", it kills the XZ speed and sets the timer for bombs that are dropped through the // holes in the bridge above the skull - if ((this->colliderLeft.base.ocFlags1 & OC1_HIT) || (this->colliderRight.base.ocFlags1 & OC1_HIT)) { + if ((this->leftCollider.base.ocFlags1 & OC1_HIT) || (this->rightCollider.base.ocFlags1 & OC1_HIT)) { - if (this->colliderLeft.base.ocFlags1 & OC1_HIT) { - actor = this->colliderLeft.base.oc; + if (this->leftCollider.base.ocFlags1 & OC1_HIT) { + actor = this->leftCollider.base.oc; } else { - actor = this->colliderRight.base.oc; + actor = this->rightCollider.base.oc; } - this->colliderLeft.base.ocFlags1 &= ~OC1_HIT; - this->colliderRight.base.ocFlags1 &= ~OC1_HIT; + this->leftCollider.base.ocFlags1 &= ~OC1_HIT; + this->rightCollider.base.ocFlags1 &= ~OC1_HIT; if (actor->category == ACTORCAT_EXPLOSIVE && actor->id == ACTOR_EN_BOM && actor->params == 0) { bomb = (EnBom*)actor; diff --git a/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.h b/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.h index c767ed5003..9f361a3ccb 100644 --- a/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.h +++ b/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.h @@ -16,9 +16,9 @@ typedef void (*BgDodoagoActionFunc)(struct BgDodoago*, struct PlayState*); typedef struct BgDodoago { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ s16 state; // BgDodoagoEye or a timer-like value - /* 0x0168 */ ColliderCylinder colliderMain; // Used to detect explosions for lighting the eyes - /* 0x01B4 */ ColliderCylinder colliderLeft; // OC-colliding bombs have their xz speed cleared and timer set - /* 0x0200 */ ColliderCylinder colliderRight; // same as colliderLeft + /* 0x0168 */ ColliderCylinder mainCollider; // Used to detect explosions for lighting the eyes + /* 0x01B4 */ ColliderCylinder leftCollider; // OC-colliding bombs have their xz speed cleared and timer set + /* 0x0200 */ ColliderCylinder rightCollider; // same as colliderLeft /* 0x024C */ BgDodoagoActionFunc actionFunc; } BgDodoago; // size = 0x0250 diff --git a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c index b20e6fc16e..006deb893e 100644 --- a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c +++ b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c @@ -11,17 +11,20 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "one_point_cutscene.h" +#include "printf.h" #include "rand.h" #include "regs.h" #include "segmented_address.h" #include "sfx.h" #include "sys_matrix.h" #include "terminal.h" +#include "translation.h" #include "versions.h" #include "z_lib.h" #include "z64ocarina.h" #include "z64play.h" #include "z64player.h" +#include "z64save.h" #include "assets/objects/object_dy_obj/object_dy_obj.h" #include "assets/scenes/indoors/yousei_izumi_yoko/yousei_izumi_yoko_scene.h" @@ -101,8 +104,7 @@ void BgDyYoseizo_Init(Actor* thisx, PlayState* play2) { this->actor.focus.pos = this->actor.world.pos; if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - // "Great Fairy Fountain" - PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 大妖精の泉 ☆☆☆☆☆ %d\n" VT_RST, play->spawn); + PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ " T("大妖精の泉", "Great Fairy Fountain") " ☆☆☆☆☆ %d\n" VT_RST, play->spawn); SkelAnime_InitFlex(play, &this->skelAnime, &gGreatFairySkel, &gGreatFairySittingTransitionAnim, this->jointTable, this->morphTable, 28); #if OOT_VERSION < NTSC_1_1 @@ -112,8 +114,7 @@ void BgDyYoseizo_Init(Actor* thisx, PlayState* play2) { } #endif } else { - // "Stone/Jewel Fairy Fountain" - PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 石妖精の泉 ☆☆☆☆☆ %d\n" VT_RST, play->spawn); + PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ " T("石妖精の泉", "Stone Fairy Fountain") " ☆☆☆☆☆ %d\n" VT_RST, play->spawn); SkelAnime_InitFlex(play, &this->skelAnime, &gGreatFairySkel, &gGreatFairyLayingDownTransitionAnim, this->jointTable, this->morphTable, 28); #if OOT_VERSION < NTSC_1_1 @@ -250,8 +251,7 @@ void BgDyYoseizo_ChooseType(BgDyYoseizo* this, PlayState* play) { #endif Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1); - // "Mode" - PRINTF(VT_FGCOL(YELLOW) "☆☆☆☆☆ もうど ☆☆☆☆☆ %d\n" VT_RST, play->msgCtx.ocarinaMode); + PRINTF(VT_FGCOL(YELLOW) "☆☆☆☆☆ " T("もうど", "Mode") " ☆☆☆☆☆ %d\n" VT_RST, play->msgCtx.ocarinaMode); givingReward = false; if (play->sceneId != SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { @@ -276,24 +276,22 @@ void BgDyYoseizo_ChooseType(BgDyYoseizo* this, PlayState* play) { switch (this->fountainType) { case FAIRY_UPGRADE_MAGIC: if (!gSaveContext.save.info.playerData.isMagicAcquired || BREG(2)) { - // "Spin Attack speed UP" - PRINTF(VT_FGCOL(GREEN) " ☆☆☆☆☆ 回転切り速度UP ☆☆☆☆☆ \n" VT_RST); + PRINTF(VT_FGCOL(GREEN) " ☆☆☆☆☆ " T("回転切り速度UP", "Turning speed UP") " ☆☆☆☆☆ \n" VT_RST); this->givingSpell = true; givingReward = true; } break; case FAIRY_UPGRADE_DOUBLE_MAGIC: if (!gSaveContext.save.info.playerData.isDoubleMagicAcquired) { - // "Magic Meter doubled" - PRINTF(VT_FGCOL(YELLOW) " ☆☆☆☆☆ 魔法ゲージメーター倍増 ☆☆☆☆☆ \n" VT_RST); + PRINTF(VT_FGCOL(YELLOW) " ☆☆☆☆☆ " T("魔法ゲージメーター倍増", + "Magic Gauge Meter Doubled") " ☆☆☆☆☆ \n" VT_RST); this->givingSpell = true; givingReward = true; } break; case FAIRY_UPGRADE_DOUBLE_DEFENSE: if (!gSaveContext.save.info.playerData.isDoubleDefenseAcquired) { - // "Damage halved" - PRINTF(VT_FGCOL(MAGENTA) " ☆☆☆☆☆ ダメージ半減 ☆☆☆☆☆ \n" VT_RST); + PRINTF(VT_FGCOL(MAGENTA) " ☆☆☆☆☆ " T("ダメージ半減", "Damage halved") " ☆☆☆☆☆ \n" VT_RST); this->givingSpell = true; givingReward = true; } diff --git a/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c b/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c index 7a84de3cb4..1df0e5b730 100644 --- a/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c +++ b/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c @@ -7,9 +7,11 @@ #include "z_bg_ganon_otyuka.h" #include "overlays/actors/ovl_Boss_Ganon/z_boss_ganon.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" +#include "printf.h" #include "rand.h" #include "sfx.h" #include "sys_matrix.h" diff --git a/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c b/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c index c4811a1d5a..c263ed5e3a 100644 --- a/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c +++ b/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c @@ -8,11 +8,14 @@ #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "sfx.h" #include "sys_matrix.h" #include "terminal.h" +#include "translation.h" #include "z_lib.h" #include "z64play.h" +#include "z64save.h" #include "assets/objects/object_spot01_matoyab/object_spot01_matoyab.h" @@ -59,7 +62,7 @@ void BgGateShutter_Init(Actor* thisx, PlayState* play) { thisx->scale.y = 1.0f; thisx->scale.z = 1.0f; PRINTF("\n\n"); - PRINTF(VT_FGCOL(GREEN) " ☆☆☆☆☆ 柵でたなぁ ☆☆☆☆☆ \n" VT_RST); + PRINTF(VT_FGCOL(GREEN) " ☆☆☆☆☆ " T("柵でたなぁ", "There's a fence") " ☆☆☆☆☆ \n" VT_RST); this->actionFunc = func_8087828C; } diff --git a/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c b/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c index a4a64c2014..6c0f01b322 100644 --- a/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c +++ b/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c @@ -13,6 +13,7 @@ #include "sys_matrix.h" #include "z64play.h" #include "z64player.h" +#include "z64save.h" #include "assets/objects/object_gjyo_objects/object_gjyo_objects.h" #include "assets/scenes/overworld/ganon_tou/ganon_tou_scene.h" diff --git a/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c b/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c index ab2b0ce919..98824a94e0 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c +++ b/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c @@ -58,7 +58,7 @@ void BgGndNisekabe_Draw(Actor* thisx, PlayState* play) { BgGndNisekabe* this = (BgGndNisekabe*)thisx; u32 index = PARAMS_GET_U(this->actor.params, 0, 8); - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { + if (ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_REACT_TO_LENS)) { Gfx_DrawDListXlu(play, dLists[index]); } else { Gfx_DrawDListOpa(play, dLists[index]); diff --git a/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c b/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c index 6e0b045a8b..f20af0b9f8 100644 --- a/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c +++ b/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c @@ -14,6 +14,7 @@ #include "z_lib.h" #include "z64play.h" #include "z64player.h" +#include "z64save.h" #include "assets/objects/object_haka/object_haka.h" diff --git a/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c b/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c index 9ef689694f..a209637949 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c +++ b/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c @@ -355,7 +355,7 @@ void BgHakaGate_Draw(Actor* thisx, PlayState* play) { BgHakaGate* this = (BgHakaGate*)thisx; MtxF currentMtxF; - if (CHECK_FLAG_ALL(thisx->flags, ACTOR_FLAG_REACT_TO_LENS)) { + if (ACTOR_FLAGS_CHECK_ALL(thisx, ACTOR_FLAG_REACT_TO_LENS)) { Gfx_DrawDListXlu(play, object_haka_objects_DL_00F1B0); } else { Gfx_SetupDL_25Opa(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c index c83de30010..a09195d6fe 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c +++ b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c @@ -9,8 +9,6 @@ #include "ichain.h" #include "z64play.h" -#include "z64.h" - #include "assets/objects/object_hakach_objects/object_hakach_objects.h" #include "assets/objects/object_haka_objects/object_haka_objects.h" @@ -135,7 +133,7 @@ void BgHakaMegane_Update(Actor* thisx, PlayState* play) { void BgHakaMegane_Draw(Actor* thisx, PlayState* play) { BgHakaMegane* this = (BgHakaMegane*)thisx; - if (CHECK_FLAG_ALL(thisx->flags, ACTOR_FLAG_REACT_TO_LENS)) { + if (ACTOR_FLAGS_CHECK_ALL(thisx, ACTOR_FLAG_REACT_TO_LENS)) { Gfx_DrawDListXlu(play, sDLists[thisx->params]); } else { Gfx_DrawDListOpa(play, sDLists[thisx->params]); diff --git a/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c b/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c index ce4da2a2ea..f11973a86f 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c +++ b/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c @@ -155,12 +155,12 @@ void BgHakaSgami_Init(Actor* thisx, PlayState* play) { Collider_InitTris(play, colliderScythe); Collider_SetTris(play, colliderScythe, thisx, &sTrisInit, this->colliderScytheItems); - Collider_InitCylinder(play, &this->colliderScytheCenter); - Collider_SetCylinder(play, &this->colliderScytheCenter, thisx, &sCylinderInit); + Collider_InitCylinder(play, &this->scytheCenterCollider); + Collider_SetCylinder(play, &this->scytheCenterCollider, thisx, &sCylinderInit); - this->colliderScytheCenter.dim.pos.x = thisx->world.pos.x; - this->colliderScytheCenter.dim.pos.y = thisx->world.pos.y; - this->colliderScytheCenter.dim.pos.z = thisx->world.pos.z; + this->scytheCenterCollider.dim.pos.x = thisx->world.pos.x; + this->scytheCenterCollider.dim.pos.y = thisx->world.pos.y; + this->scytheCenterCollider.dim.pos.z = thisx->world.pos.z; CollisionCheck_SetInfo(&thisx->colChkInfo, NULL, &sColChkInfoInit); @@ -181,8 +181,8 @@ void BgHakaSgami_Init(Actor* thisx, PlayState* play) { thisx->flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; } else { this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_ICE_OBJECTS); - this->colliderScytheCenter.dim.radius = 30; - this->colliderScytheCenter.dim.height = 70; + this->scytheCenterCollider.dim.radius = 30; + this->scytheCenterCollider.dim.height = 70; Actor_SetFocus(thisx, 40.0f); } @@ -200,7 +200,7 @@ void BgHakaSgami_Destroy(Actor* thisx, PlayState* play) { Effect_Delete(play, this->blureEffectIndex[0]); Effect_Delete(play, this->blureEffectIndex[1]); Collider_DestroyTris(play, &this->colliderScythe); - Collider_DestroyCylinder(play, &this->colliderScytheCenter); + Collider_DestroyCylinder(play, &this->scytheCenterCollider); } void BgHakaSgami_SetupSpin(BgHakaSgami* this, PlayState* play) { @@ -289,7 +289,7 @@ void BgHakaSgami_Spin(BgHakaSgami* this, PlayState* play) { } CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderScythe.base); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderScytheCenter.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->scytheCenterCollider.base); Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ROLLCUTTER_MOTOR - SFX_FLAG); } diff --git a/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.h b/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.h index 2bbcd2dc0d..53c0b63400 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.h +++ b/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.h @@ -15,7 +15,7 @@ typedef struct BgHakaSgami { /* 0x0151 */ s8 unk_151; /* 0x0152 */ s16 timer; /* 0x0154 */ s32 blureEffectIndex[2]; - /* 0x015C */ ColliderCylinder colliderScytheCenter; + /* 0x015C */ ColliderCylinder scytheCenterCollider; /* 0x01A8 */ ColliderTris colliderScythe; /* 0x01C8 */ ColliderTrisElement colliderScytheItems[4]; } BgHakaSgami; // size = 0x0338 diff --git a/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c b/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c index b28c155edd..126dcc7ee1 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c +++ b/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c @@ -10,8 +10,10 @@ #include "gfx_setupdl.h" #include "ichain.h" #include "one_point_cutscene.h" +#include "printf.h" #include "sfx.h" #include "sys_matrix.h" +#include "translation.h" #include "z_lib.h" #include "z64play.h" #include "z64skin_matrix.h" @@ -104,7 +106,7 @@ void BgHakaShip_WaitForSong(BgHakaShip* this, PlayState* play) { if (this->counter == 0) { this->counter = 130; this->actionFunc = BgHakaShip_CutsceneStationary; - PRINTF("シーン 外輪船 ... アァクション!!\n"); + PRINTF(T("シーン 外輪船 ... アァクション!!\n", "Scene paddle steamer... action!!\n")); OnePointCutscene_Init(play, 3390, 999, &this->dyna.actor, CAM_ID_MAIN); } } diff --git a/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c b/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c index 8237009d97..df7c95b0e9 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c +++ b/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c @@ -12,12 +12,11 @@ #include "ichain.h" #include "sfx.h" #include "sys_matrix.h" +#include "z_en_item00.h" #include "z_lib.h" #include "z64effect.h" #include "z64play.h" -#include "global.h" - #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_haka_objects/object_haka_objects.h" diff --git a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c index ba6d3f526a..90aeee4b87 100644 --- a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c +++ b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c @@ -7,10 +7,12 @@ #include "z_bg_heavy_block.h" #include "libu64/debug.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" #include "one_point_cutscene.h" +#include "printf.h" #include "quake.h" #include "rand.h" #include "rumble.h" @@ -18,6 +20,7 @@ #include "sys_math.h" #include "sys_matrix.h" #include "terminal.h" +#include "translation.h" #include "z_lib.h" #include "z64effect.h" #include "z64play.h" @@ -162,8 +165,7 @@ void BgHeavyBlock_Init(Actor* thisx, PlayState* play) { this->actionFunc = BgHeavyBlock_Wait; break; } - // "Largest Block Save Bit %x" - PRINTF(VT_FGCOL(CYAN) " 最大 ブロック セーブビット %x\n" VT_RST, thisx->params); + PRINTF(VT_FGCOL(CYAN) T(" 最大 ブロック セーブビット %x\n", " Largest Block Save Bit %x\n") VT_RST, thisx->params); } void BgHeavyBlock_Destroy(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c b/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c index dfaca6232e..0f0f99da70 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c @@ -10,10 +10,13 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "one_point_cutscene.h" +#include "printf.h" #include "sfx.h" #include "sys_matrix.h" +#include "translation.h" #include "z_lib.h" #include "z64play.h" +#include "z64save.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" @@ -84,9 +87,9 @@ void BgHidanCurtain_Init(Actor* thisx, PlayState* play) { Actor_SetFocus(&this->actor, 20.0f); this->type = PARAMS_GET_U(thisx->params, 12, 4); if (this->type > 6) { - // "Type is not set" - PRINTF("Error : object のタイプが設定されていない(%s %d)(arg_data 0x%04x)\n", "../z_bg_hidan_curtain.c", 352, - this->actor.params); + PRINTF(T("Error : object のタイプが設定されていない", + "Error : object type is not set") "(%s %d)(arg_data 0x%04x)\n", + "../z_bg_hidan_curtain.c", 352, this->actor.params); Actor_Kill(&this->actor); return; } @@ -97,9 +100,9 @@ void BgHidanCurtain_Init(Actor* thisx, PlayState* play) { thisx->params &= 0x3F; if (DEBUG_FEATURES && ((this->actor.params < 0) || (this->actor.params > 0x3F))) { - // "Save bit is not set" - PRINTF("Warning : object のセーブビットが設定されていない(%s %d)(arg_data 0x%04x)\n", "../z_bg_hidan_curtain.c", - 373, this->actor.params); + PRINTF(T("Warning : object のセーブビットが設定されていない", + "Warning : object save bit is not set") "(%s %d)(arg_data 0x%04x)\n", + "../z_bg_hidan_curtain.c", 373, this->actor.params); } Actor_SetScale(&this->actor, hcParams->scale); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c b/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c index b64979766c..885967c2bb 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c @@ -114,7 +114,7 @@ void BgHidanDalm_Init(Actor* thisx, PlayState* play) { CollisionHeader_GetVirtual(&gFireTempleHammerableTotemCol, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); Collider_InitTris(play, &this->collider); - Collider_SetTris(play, &this->collider, thisx, &sTrisInit, this->colliderItems); + Collider_SetTris(play, &this->collider, thisx, &sTrisInit, this->colliderElements); this->switchFlag = PARAMS_GET_U(thisx->params, 8, 8); thisx->params &= 0xFF; diff --git a/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.h b/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.h index 39a5d64c99..83cabfaab4 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.h +++ b/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.h @@ -13,7 +13,7 @@ typedef struct BgHidanDalm { /* 0x0164 */ BgHidanDalmActionFunc actionFunc; /* 0x0168 */ u8 switchFlag; /* 0x016C */ ColliderTris collider; - /* 0x018C */ ColliderTrisElement colliderItems[4]; + /* 0x018C */ ColliderTrisElement colliderElements[4]; } BgHidanDalm; // size = 0x02FC #endif diff --git a/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c b/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c index 26201b24c2..47849aa850 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c @@ -17,6 +17,7 @@ #include "z_lib.h" #include "z64play.h" #include "z64player.h" +#include "z64save.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_hidan_objects/object_hidan_objects.h" diff --git a/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c b/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c index f882203bd5..d20bccdb71 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c @@ -6,15 +6,18 @@ #include "z_bg_hidan_hamstep.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" #include "one_point_cutscene.h" +#include "printf.h" #include "quake.h" #include "regs.h" #include "rumble.h" #include "sfx.h" #include "sys_matrix.h" +#include "translation.h" #include "versions.h" #include "z_lib.h" #include "z64play.h" @@ -153,7 +156,7 @@ void BgHidanHamstep_Init(Actor* thisx, PlayState* play) { if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) == 0) { Collider_InitTris(play, &this->collider); - Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInit, this->colliderItems); + Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInit, this->colliderElements); for (i = 0; i < 2; i++) { for (i2 = 0; i2 < 3; i2++) { @@ -192,13 +195,11 @@ void BgHidanHamstep_Init(Actor* thisx, PlayState* play) { this->dyna.actor.minVelocityY = -12.0f; if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) == 0) { - // "Fire Temple Object [Hammer Step] appears" - PRINTF("◯◯◯炎の神殿オブジェクト【ハンマーステップ】出現\n"); + PRINTF(T("◯◯◯炎の神殿オブジェクト【ハンマーステップ】出現\n", "◯◯◯Fire Temple object [Hammer Step] appears\n")); if (BgHidanHamstep_SpawnChildren(this, play) == 0) { step = this; - // "[Hammer Step] I can't create a step!" - PRINTF("【ハンマーステップ】 足場産れない!!\n"); + PRINTF(T("【ハンマーステップ】 足場産れない!!\n", "[Hammer Step] I can't create a step!!\n")); PRINTF("%s %d\n", "../z_bg_hidan_hamstep.c", 425); while (step != NULL) { @@ -362,8 +363,9 @@ void func_80888A58(BgHidanHamstep* this, PlayState* play) { #if DEBUG_FEATURES if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) <= 0 || PARAMS_GET_U(this->dyna.actor.params, 0, 8) >= 6) { - // "[Hammer Step] arg_data strange (arg_data = %d)" - PRINTF("【ハンマーステップ】 arg_data おかしい (arg_data = %d)", this->dyna.actor.params); + PRINTF(T("【ハンマーステップ】 arg_data おかしい (arg_data = %d)", + "[Hammer Step] arg_data strange (arg_data = %d)"), + this->dyna.actor.params); PRINTF("%s %d\n", "../z_bg_hidan_hamstep.c", 696); } #endif diff --git a/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.h b/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.h index 34c2537203..faf1db7577 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.h +++ b/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.h @@ -11,7 +11,7 @@ typedef void (*BgHidanHamstepActionFunc)(struct BgHidanHamstep*, struct PlayStat typedef struct BgHidanHamstep { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ ColliderTris collider; - /* 0x0184 */ ColliderTrisElement colliderItems[2]; + /* 0x0184 */ ColliderTrisElement colliderElements[2]; /* 0x023C */ BgHidanHamstepActionFunc actionFunc; /* 0x0240 */ s32 action; /* 0x0244 */ s32 unk_244; diff --git a/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c b/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c index 2fae07b984..a4fd5fab33 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c @@ -95,7 +95,7 @@ void BgHidanHrock_Init(Actor* thisx, PlayState* play) { this->unk_16A = PARAMS_GET_U(thisx->params, 0, 6); thisx->params = PARAMS_GET_U(thisx->params, 8, 8); Collider_InitTris(play, &this->collider); - Collider_SetTris(play, &this->collider, thisx, &sTrisInit, this->colliderItems); + Collider_SetTris(play, &this->collider, thisx, &sTrisInit, this->colliderElements); DynaPolyActor_Init(&this->dyna, 0); sinRotY = Math_SinS(thisx->shape.rot.y); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.h b/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.h index 892e44865b..955ddd5dfc 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.h +++ b/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.h @@ -14,7 +14,7 @@ typedef struct BgHidanHrock { /* 0x0168 */ s16 unk_168; /* 0x016A */ u8 unk_16A; /* 0x016C */ ColliderTris collider; - /* 0x018C */ ColliderTrisElement colliderItems[2]; + /* 0x018C */ ColliderTrisElement colliderElements[2]; } BgHidanHrock; // size = 0x0244 #endif diff --git a/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c b/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c index bce57124eb..8148f8ca0d 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c @@ -10,8 +10,10 @@ #include "gfx_setupdl.h" #include "ichain.h" #include "one_point_cutscene.h" +#include "printf.h" #include "sfx.h" #include "sys_matrix.h" +#include "translation.h" #include "z_lib.h" #include "z64play.h" @@ -79,14 +81,15 @@ void BgHidanKousi_Init(Actor* thisx, PlayState* play) { DynaPolyActor_Init(&this->dyna, 0); Actor_SetFocus(thisx, 50.0f); - PRINTF("◯◯◯炎の神殿オブジェクト【格子(arg_data : %0x)】出現 (%d %d)\n", thisx->params, - PARAMS_GET_U(thisx->params, 0, 8), PARAMS_GET_U((s32)thisx->params, 8, 8)); + PRINTF(T("◯◯◯炎の神殿オブジェクト【格子(arg_data : %0x)】出現 (%d %d)\n", + "◯◯◯ Fire Temple object [lattice (arg_data : %0x)] appeared (%d %d)\n"), + thisx->params, PARAMS_GET_U(thisx->params, 0, 8), PARAMS_GET_U((s32)thisx->params, 8, 8)); Actor_ProcessInitChain(thisx, sInitChain); #if DEBUG_FEATURES if (PARAMS_GET_U(thisx->params, 0, 8) < 0 || PARAMS_GET_U(thisx->params, 0, 8) >= 3) { - PRINTF("arg_data おかしい 【格子】\n"); + PRINTF(T("arg_data おかしい 【格子】\n", "arg_data is strange [lattice]\n")); } #endif diff --git a/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c b/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c index 25263fd571..7663c13aa0 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c @@ -11,8 +11,10 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" +#include "printf.h" #include "sfx.h" #include "sys_matrix.h" +#include "translation.h" #include "z_lib.h" #include "z64effect.h" #include "z64play.h" @@ -103,7 +105,7 @@ void BgHidanKowarerukabe_InitColliderSphere(BgHidanKowarerukabe* this, PlayState s32 pad; Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderItems); + Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderElements); this->collider.elements[0].dim.modelSphere.radius = sphereRadii[PARAMS_GET_U(this->dyna.actor.params, 0, 8)]; this->collider.elements[0].dim.modelSphere.center.y = sphereYPositions[PARAMS_GET_U(this->dyna.actor.params, 0, 8)]; @@ -129,9 +131,10 @@ void BgHidanKowarerukabe_Init(Actor* thisx, PlayState* play) { if (PARAMS_GET_U(this->dyna.actor.params, 0, 8) < CRACKED_STONE_FLOOR || PARAMS_GET_U(this->dyna.actor.params, 0, 8) > LARGE_BOMBABLE_WALL) { - // "Error: Fire Temple Breakable Walls. arg_data I can't determine the (%s %d)(arg_data 0x%04x)" - PRINTF("Error : 炎の神殿 壊れる壁 の arg_data が判別出来ない(%s %d)(arg_data 0x%04x)\n", - "../z_bg_hidan_kowarerukabe.c", 254, this->dyna.actor.params); + PRINTF( + T("Error : 炎の神殿 壊れる壁 の arg_data が判別出来ない", + "Error : arg_data for the Fire Temple breakable wall cannot be determined") "(%s %d)(arg_data 0x%04x)\n", + "../z_bg_hidan_kowarerukabe.c", 254, this->dyna.actor.params); Actor_Kill(&this->dyna.actor); return; } @@ -145,8 +148,8 @@ void BgHidanKowarerukabe_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->dyna.actor, 0.1f); BgHidanKowarerukabe_InitColliderSphere(this, play); BgHidanKowarerukabe_OffsetActorYPos(this); - // "(fire walls, floors, destroyed by bombs)(arg_data 0x%04x)" - PRINTF("(hidan 爆弾で壊れる 壁 床)(arg_data 0x%04x)\n", this->dyna.actor.params); + PRINTF(T("(hidan 爆弾で壊れる 壁 床)", "(hidan bomb destroys walls and floors)") "(arg_data 0x%04x)\n", + this->dyna.actor.params); } void BgHidanKowarerukabe_Destroy(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.h b/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.h index 4fc6befab2..7257a210f1 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.h +++ b/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.h @@ -9,7 +9,7 @@ struct BgHidanKowarerukabe; typedef struct BgHidanKowarerukabe { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ ColliderJntSph collider; - /* 0x0184 */ ColliderJntSphElement colliderItems[1]; + /* 0x0184 */ ColliderJntSphElement colliderElements[1]; } BgHidanKowarerukabe; // size = 0x01C4 #endif diff --git a/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c index b162af3792..0b64a4ff6b 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c @@ -6,6 +6,7 @@ #include "z_bg_hidan_rsekizou.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" @@ -141,8 +142,8 @@ void BgHidanRsekizou_Init(Actor* thisx, PlayState* play) { CollisionHeader_GetVirtual(&gFireTempleSpinningFlamethrowerCol, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderItems); - for (i = 0; i < ARRAY_COUNT(this->colliderItems); i++) { + Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderElements); + for (i = 0; i < ARRAY_COUNT(this->colliderElements); i++) { this->collider.elements[i].dim.worldSphere.radius = this->collider.elements[i].dim.modelSphere.radius; } this->burnFrame = 0; @@ -178,7 +179,7 @@ void BgHidanRsekizou_Update(Actor* thisx, PlayState* play) { yawSine = Math_SinS(this->dyna.actor.shape.rot.y); yawCosine = Math_CosS(this->dyna.actor.shape.rot.y); - for (i = 0; i < ARRAY_COUNT(this->colliderItems); i++) { + for (i = 0; i < ARRAY_COUNT(this->colliderElements); i++) { sphere = &this->collider.elements[i]; sphere->dim.worldSphere.center.x = this->dyna.actor.home.pos.x + yawCosine * sphere->dim.modelSphere.center.x + yawSine * sphere->dim.modelSphere.center.z; @@ -244,7 +245,7 @@ void BgHidanRsekizou_Draw(Actor* thisx, PlayState* play) { MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_bg_hidan_rsekizou.c", 568); gSPDisplayList(POLY_OPA_DISP++, gFireTempleSpinningFlamethrowerDL); - Matrix_MtxFCopy(&mf, &gMtxFClear); + Matrix_MtxFCopy(&mf, &gIdentityMtxF); POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_20); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.h b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.h index 13ce01a7f5..82725e4fc1 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.h +++ b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.h @@ -11,7 +11,7 @@ typedef struct BgHidanRsekizou { /* 0x0164 */ s16 bendFrame; /* 0x0166 */ s16 burnFrame; /* 0x0168 */ ColliderJntSph collider; - /* 0x0188 */ ColliderJntSphElement colliderItems[6]; + /* 0x0188 */ ColliderJntSphElement colliderElements[6]; } BgHidanRsekizou; // size = 0x0308 #endif diff --git a/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c b/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c index 117064ffb4..452c88f5f4 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c @@ -6,6 +6,7 @@ #include "z_bg_hidan_sekizou.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" @@ -165,8 +166,8 @@ void BgHidanSekizou_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 0); Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->elements); - for (i = 0; i < ARRAY_COUNT(this->elements); i++) { + Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderElements); + for (i = 0; i < ARRAY_COUNT(this->colliderElements); i++) { this->collider.elements[i].dim.worldSphere.radius = this->collider.elements[i].dim.modelSphere.radius; } if (this->dyna.actor.params == 0) { @@ -221,7 +222,7 @@ void func_8088D434(BgHidanSekizou* this, PlayState* play) { } } } - for (i = 3 * phi_s4; i < ARRAY_COUNT(this->elements); i++) { + for (i = 3 * phi_s4; i < ARRAY_COUNT(this->colliderElements); i++) { this->collider.elements[i].base.atElemFlags &= ~ATELEM_ON; this->collider.elements[i].base.ocElemFlags &= ~OCELEM_ON; } @@ -360,7 +361,7 @@ Gfx* func_8088DC50(PlayState* play, BgHidanSekizou* this, s16 arg2, s16 arg3, Gf } temp_f20 = Math_SinS(arg2); temp_f22 = Math_CosS(arg2); - Matrix_MtxFCopy(&sp68, &gMtxFClear); + Matrix_MtxFCopy(&sp68, &gIdentityMtxF); temp_v1 = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - arg2; if (ABS(temp_v1) < 0x4000) { diff --git a/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.h b/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.h index 45aef4e922..c898f9d934 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.h +++ b/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.h @@ -14,7 +14,7 @@ typedef struct BgHidanSekizou { /* 0x0168 */ s16 unk_168[4]; /* 0x0170 */ s16 unk_170; /* 0x0174 */ ColliderJntSph collider; - /* 0x0194 */ ColliderJntSphElement elements[6]; + /* 0x0194 */ ColliderJntSphElement colliderElements[6]; } BgHidanSekizou; // size = 0x0314 #endif diff --git a/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c b/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c index 06f5b2a308..f166f9f4d8 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c @@ -5,6 +5,19 @@ */ #include "z_bg_hidan_sima.h" + +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "rumble.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_hidan_objects/object_hidan_objects.h" #define FLAGS 0 @@ -95,7 +108,7 @@ void BgHidanSima_Init(Actor* thisx, PlayState* play) { } this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->elements); + Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderElements); for (i = 0; i < ARRAY_COUNT(sJntSphElementsInit); i++) { this->collider.elements[i].dim.worldSphere.radius = this->collider.elements[i].dim.modelSphere.radius; } @@ -233,7 +246,7 @@ Gfx* func_8088EB54(PlayState* play, BgHidanSima* this, Gfx* gfx) { f32 sin; s32 pad[2]; - Matrix_MtxFCopy(&mtxF, &gMtxFClear); + Matrix_MtxFCopy(&mtxF, &gIdentityMtxF); cos = Math_CosS(this->dyna.actor.world.rot.y + 0x8000); sin = Math_SinS(this->dyna.actor.world.rot.y + 0x8000); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.h b/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.h index 927391110b..dd64b556b0 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.h +++ b/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.h @@ -2,18 +2,18 @@ #define Z_BG_HIDAN_SIMA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgHidanSima; -typedef void (*BgHidanSimaActionFunc)(struct BgHidanSima*, PlayState*); +typedef void (*BgHidanSimaActionFunc)(struct BgHidanSima*, struct PlayState*); typedef struct BgHidanSima { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ BgHidanSimaActionFunc actionFunc; /* 0x0168 */ s16 timer; /* 0x016C */ ColliderJntSph collider; - /* 0x018C */ ColliderJntSphElement elements[2]; + /* 0x018C */ ColliderJntSphElement colliderElements[2]; } BgHidanSima; // size = 0x020C #endif diff --git a/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c b/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c index e1a7007068..d21b1e8212 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c @@ -5,6 +5,11 @@ */ #include "z_bg_hidan_syoku.h" + +#include "ichain.h" +#include "sfx.h" +#include "z64play.h" + #include "assets/objects/object_hidan_objects/object_hidan_objects.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.h b/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.h index 61e3520b76..2ce3fbfd4e 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.h +++ b/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.h @@ -2,11 +2,11 @@ #define Z_BG_HIDAN_SYOKU_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgHidanSyoku; -typedef void (*BgHidanSyokuActionFunc)(struct BgHidanSyoku*, PlayState*); +typedef void (*BgHidanSyokuActionFunc)(struct BgHidanSyoku*, struct PlayState*); typedef struct BgHidanSyoku { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c b/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c index 15163c9842..6bfd39e4e5 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c +++ b/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c @@ -5,6 +5,16 @@ */ #include "z_bg_ice_objects.h" + +#include "libc64/qrand.h" +#include "ichain.h" +#include "rand.h" +#include "sfx.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_ice_objects/object_ice_objects.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.h b/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.h index 13a2334c39..364b087852 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.h +++ b/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.h @@ -2,11 +2,11 @@ #define Z_BG_ICE_OBJECTS_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgIceObjects; -typedef void (*BgIceObjectsActionFunc) (struct BgIceObjects*, PlayState*); +typedef void (*BgIceObjectsActionFunc) (struct BgIceObjects*, struct PlayState*); typedef struct BgIceObjects { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c b/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c index 39c891ab4f..102e2e3ba5 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c +++ b/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c @@ -5,6 +5,19 @@ */ #include "z_bg_ice_shelter.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "translation.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/object_ice_objects/object_ice_objects.h" #define FLAGS 0 @@ -124,9 +137,9 @@ void BgIceShelter_InitDynaPoly(BgIceShelter* this, PlayState* play, CollisionHea if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; - // "Warning : move BG registration failed" - PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_ice_shelter.c", 362, - this->dyna.actor.id, this->dyna.actor.params); + PRINTF(T("Warning : move BG 登録失敗", + "Warning : move BG registration failed") "(%s %d)(name %d)(arg_data 0x%04x)\n", + "../z_bg_ice_shelter.c", 362, this->dyna.actor.id, this->dyna.actor.params); } #endif } diff --git a/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.h b/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.h index 765b017b32..30286a64d1 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.h +++ b/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.h @@ -2,11 +2,11 @@ #define Z_BG_ICE_SHELTER_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgIceShelter; -typedef void (*BgIceShelterActionFunc)(struct BgIceShelter*, PlayState*); +typedef void (*BgIceShelterActionFunc)(struct BgIceShelter*, struct PlayState*); typedef enum RedIceType { /* 0 */ RED_ICE_LARGE, // Large red ice block diff --git a/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c b/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c index d00358e230..20176f2758 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c +++ b/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c @@ -5,6 +5,13 @@ */ #include "z_bg_ice_shutter.h" + +#include "ichain.h" +#include "one_point_cutscene.h" +#include "sfx.h" +#include "z_lib.h" +#include "z64play.h" + #include "assets/objects/object_ice_objects/object_ice_objects.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.h b/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.h index db8a7ff61c..aad63d435b 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.h +++ b/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.h @@ -2,11 +2,11 @@ #define Z_BG_ICE_SHUTTER_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgIceShutter; -typedef void (*BgIceShutterActionFunc)(struct BgIceShutter*, PlayState*); +typedef void (*BgIceShutterActionFunc)(struct BgIceShutter*, struct PlayState*); typedef struct BgIceShutter { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c b/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c index 094f585645..8fb200aca5 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c +++ b/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c @@ -5,6 +5,15 @@ */ #include "z_bg_ice_turara.h" + +#include "libc64/qrand.h" +#include "ichain.h" +#include "rand.h" +#include "sfx.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/object_ice_objects/object_ice_objects.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.h b/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.h index eaa6cc843f..46a78eb738 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.h +++ b/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.h @@ -2,11 +2,11 @@ #define Z_BG_ICE_TURARA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgIceTurara; -typedef void (*BgIceTuraraActionFunc)(struct BgIceTurara*, PlayState*); +typedef void (*BgIceTuraraActionFunc)(struct BgIceTurara*, struct PlayState*); typedef enum BgIceTuraraType { /* 0 */ TURARA_STALAGMITE, diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c index dc5b9323e3..e46139117c 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c @@ -5,6 +5,14 @@ */ #include "z_bg_ingate.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_ingate/object_ingate.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.h b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.h index 2137cc6464..c9f46446ab 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.h +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.h @@ -2,11 +2,11 @@ #define Z_BG_INGATE_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgInGate; -typedef void (*BgInGateActionFunc)(struct BgInGate*, PlayState*); +typedef void (*BgInGateActionFunc)(struct BgInGate*, struct PlayState*); typedef struct BgInGate { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c b/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c index 7963199d74..58cd7278ad 100644 --- a/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c +++ b/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c @@ -5,6 +5,15 @@ */ #include "z_bg_jya_1flift.h" + +#include "ichain.h" +#include "printf.h" +#include "sfx.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_jya_obj/object_jya_obj.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -78,9 +87,9 @@ void BgJya1flift_InitDynapoly(BgJya1flift* this, PlayState* play, CollisionHeade if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; - // "Warning : move BG login failed" - PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_1flift.c", 179, - this->dyna.actor.id, this->dyna.actor.params); + PRINTF(T("Warning : move BG 登録失敗", + "Warning : move BG registration failed") "(%s %d)(name %d)(arg_data 0x%04x)\n", + "../z_bg_jya_1flift.c", 179, this->dyna.actor.id, this->dyna.actor.params); } #endif } @@ -95,8 +104,7 @@ void BgJya1flift_InitCollision(Actor* thisx, PlayState* play) { void BgJya1flift_Init(Actor* thisx, PlayState* play) { BgJya1flift* this = (BgJya1flift*)thisx; - // "1 F lift" - PRINTF("(1Fリフト)(flag %d)(room %d)\n", sIsSpawned, play->roomCtx.curRoom.num); + PRINTF(T("(1Fリフト)", "1F lift") "(flag %d)(room %d)\n", sIsSpawned, play->roomCtx.curRoom.num); this->hasInitialized = false; if (sIsSpawned) { Actor_Kill(thisx); diff --git a/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.h b/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.h index 31ce5a7f4d..8d772757bf 100644 --- a/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.h +++ b/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.h @@ -2,11 +2,11 @@ #define Z_BG_JYA_1FLIFT_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgJya1flift; -typedef void (*BgJya1fliftActionFunc)(struct BgJya1flift*, PlayState*); +typedef void (*BgJya1fliftActionFunc)(struct BgJya1flift*, struct PlayState*); typedef struct BgJya1flift { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c b/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c index 23f5658ce8..ee9487d2ef 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c +++ b/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c @@ -5,6 +5,14 @@ */ #include "z_bg_jya_amishutter.h" + +#include "ichain.h" +#include "printf.h" +#include "sfx.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" + #include "assets/objects/object_jya_obj/object_jya_obj.h" #define FLAGS 0 @@ -54,8 +62,9 @@ void BgJyaAmishutter_InitDynaPoly(BgJyaAmishutter* this, PlayState* play, Collis if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; - PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_amishutter.c", 129, - this->dyna.actor.id, this->dyna.actor.params); + PRINTF(T("Warning : move BG 登録失敗", + "Warning : move BG registration failed") "(%s %d)(name %d)(arg_data 0x%04x)\n", + "../z_bg_jya_amishutter.c", 129, this->dyna.actor.id, this->dyna.actor.params); } #endif } diff --git a/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.h b/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.h index e15a42fe88..1dad4c1543 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.h +++ b/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.h @@ -2,7 +2,7 @@ #define Z_BG_JYA_AMISHUTTER_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgJyaAmishutter; diff --git a/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c b/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c index ecdf4aa4de..f2955f3050 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c +++ b/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c @@ -5,6 +5,15 @@ */ #include "z_bg_jya_bigmirror.h" +#include "overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "sys_matrix.h" +#include "translation.h" +#include "z64play.h" + #include "assets/objects/object_jya_obj/object_jya_obj.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) @@ -76,8 +85,8 @@ void BgJyaBigmirror_HandleCobra(Actor* thisx, PlayState* play) { #if DEBUG_FEATURES if (curCobraInfo->cobra->dyna.actor.update == NULL) { - // "Cobra deleted" - PRINTF("Error : コブラ削除された (%s %d)\n", "../z_bg_jya_bigmirror.c", 203); + PRINTF("Error : " T("コブラ削除された", "Cobra deleted") " (%s %d)\n", "../z_bg_jya_bigmirror.c", + 203); } #endif } else { @@ -87,8 +96,8 @@ void BgJyaBigmirror_HandleCobra(Actor* thisx, PlayState* play) { this->actor.child = NULL; if (curCobraInfo->cobra == NULL) { - // "Cobra generation failed" - PRINTF("Error : コブラ発生失敗 (%s %d)\n", "../z_bg_jya_bigmirror.c", 221); + PRINTF("Error : " T("コブラ発生失敗", "Cobra generation failed") " (%s %d)\n", + "../z_bg_jya_bigmirror.c", 221); } } } @@ -155,8 +164,8 @@ void BgJyaBigmirror_HandleMirRay(Actor* thisx, PlayState* play) { #if DEBUG_FEATURES if (this->lightBeams[i] == NULL) { - // "Mir Ray generation failed" - PRINTF("Error : Mir Ray 発生失敗 (%s %d)\n", "../z_bg_jya_bigmirror.c", 310); + PRINTF("Error : " T("Mir Ray 発生失敗", "Mir Ray generation failed") " (%s %d)\n", + "../z_bg_jya_bigmirror.c", 310); } #endif } @@ -187,8 +196,7 @@ void BgJyaBigmirror_Init(Actor* thisx, PlayState* play) { this->spawned = true; this->mirRayObjectSlot = -1; - // "jya Bigmirror" - PRINTF("(jya 大鏡)(arg_data 0x%04x)\n", this->actor.params); + PRINTF("(jya " T("大鏡", "Big mirror") ")(arg_data 0x%04x)\n", this->actor.params); } void BgJyaBigmirror_Destroy(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.h b/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.h index 52f2b95930..56b6d8db07 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.h +++ b/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.h @@ -2,8 +2,7 @@ #define Z_BG_JYA_BIGMIRROR_H #include "ultra64.h" -#include "global.h" -#include "overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.h" +#include "z64actor.h" #define BIGMIR_PUZZLE_COBRA1_SOLVED (1 << 0) #define BIGMIR_PUZZLE_COBRA2_SOLVED (1 << 1) @@ -15,7 +14,7 @@ struct BgJyaBigmirror; typedef struct BigmirrorCobra { - /* 0x00 */ BgJyaCobra* cobra; + /* 0x00 */ struct BgJyaCobra* cobra; /* 0x04 */ s16 rotY; } BigmirrorCobra; // size = 0x08 diff --git a/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c b/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c index eea63927ed..946db1b05c 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c +++ b/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c @@ -5,6 +5,16 @@ */ #include "z_bg_jya_block.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "segmented_address.h" +#include "sys_matrix.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.h b/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.h index 2d58de5c12..641141945a 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.h +++ b/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.h @@ -2,7 +2,7 @@ #define Z_BG_JYA_BLOCK_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgJyaBlock; diff --git a/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c b/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c index cd177d8044..73108e43d0 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c +++ b/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c @@ -1,5 +1,19 @@ #include "z_bg_jya_bombchuiwa.h" #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "translation.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/object_jya_obj/object_jya_obj.h" #define FLAGS ACTOR_FLAG_ATTENTION_ENABLED @@ -65,7 +79,7 @@ void BgJyaBombchuiwa_SetupCollider(BgJyaBombchuiwa* this, PlayState* play) { s32 pad; Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, &this->colliderItems); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); } void BgJyaBombchuiwa_SetDrawFlags(BgJyaBombchuiwa* this, u8 drawFlags) { @@ -181,9 +195,8 @@ void BgJyaBombchuiwa_SpawnLightRay(BgJyaBombchuiwa* this, PlayState* play) { BgJyaBombchuiwa_SetDrawFlags(this, 4); if (Actor_Spawn(&play->actorCtx, play, ACTOR_MIR_RAY, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0) == NULL) { - // "Occurrence failure" - PRINTF("Error : Mir_Ray 発生失敗(%s %d)(arg_data 0x%04x)\n", "../z_bg_jya_bombchuiwa.c", 410, - this->actor.params); + PRINTF(T("Error : Mir_Ray 発生失敗", "Error : Mir_Ray failed to occur") "(%s %d)(arg_data 0x%04x)\n", + "../z_bg_jya_bombchuiwa.c", 410, this->actor.params); } } diff --git a/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.h b/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.h index e936167100..ad9b9c33db 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.h +++ b/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.h @@ -2,17 +2,17 @@ #define Z_BG_JYA_BOMBCHUIWA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgJyaBombchuiwa; -typedef void (*BgJyaBombchuiwaActionFunc)(struct BgJyaBombchuiwa*, PlayState*); +typedef void (*BgJyaBombchuiwaActionFunc)(struct BgJyaBombchuiwa*, struct PlayState*); typedef struct BgJyaBombchuiwa { /* 0x0000 */ Actor actor; /* 0x014C */ BgJyaBombchuiwaActionFunc actionFunc; /* 0x0150 */ ColliderJntSph collider; - /* 0x0170 */ ColliderJntSphElement colliderItems; + /* 0x0170 */ ColliderJntSphElement colliderElements[1]; /* 0x01B0 */ f32 lightRayIntensity; /* 0x01B4 */ s16 timer; /* 0x01B6 */ u8 drawFlags; // Used to determine how the actor is drawn. diff --git a/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c b/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c index c94ee924b1..5a01066a3c 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c +++ b/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c @@ -6,8 +6,17 @@ #include "z_bg_jya_bombiwa.h" #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" -#include "assets/objects/object_jya_obj/object_jya_obj.h" + +#include "libc64/qrand.h" +#include "ichain.h" +#include "printf.h" +#include "sfx.h" #include "terminal.h" +#include "translation.h" +#include "z64effect.h" +#include "z64play.h" + +#include "assets/objects/object_jya_obj/object_jya_obj.h" #define FLAGS 0 @@ -74,9 +83,9 @@ void BgJyaBombiwa_SetupDynaPoly(BgJyaBombiwa* this, PlayState* play, CollisionHe if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; - // "Warning: move BG registration failed" - PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_bombiwa.c", 174, - this->dyna.actor.id, this->dyna.actor.params); + PRINTF(T("Warning : move BG 登録失敗", + "Warning : move BG registration failed") "(%s %d)(name %d)(arg_data 0x%04x)\n", + "../z_bg_jya_bombiwa.c", 174, this->dyna.actor.id, this->dyna.actor.params); } #endif } @@ -85,7 +94,7 @@ void BgJyaBombiwa_InitCollider(BgJyaBombiwa* this, PlayState* play) { s32 pad; Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderItems); + Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderElements); } void BgJyaBombiwa_Init(Actor* thisx, PlayState* play) { @@ -93,10 +102,9 @@ void BgJyaBombiwa_Init(Actor* thisx, PlayState* play) { if (PARAMS_GET_U(this->dyna.actor.params, 0, 6) != 0x29) { PRINTF_COLOR_WARNING(); - - // "Warning: Switch Number changed (%s %d)(SW %d)" - PRINTF("Warning : Switch Number が変更された(%s %d)(SW %d)\n", "../z_bg_jya_bombiwa.c", 218, - PARAMS_GET_U(this->dyna.actor.params, 0, 6)); + PRINTF(T("Warning : Switch Number が変更された", + "Warning : Switch Number has been changed") "(%s %d)(SW %d)\n", + "../z_bg_jya_bombiwa.c", 218, PARAMS_GET_U(this->dyna.actor.params, 0, 6)); PRINTF_RST(); } BgJyaBombiwa_SetupDynaPoly(this, play, &gBombiwaCol, 0); @@ -106,8 +114,7 @@ void BgJyaBombiwa_Init(Actor* thisx, PlayState* play) { } else { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - // "Rock destroyed by jya bomb" - PRINTF("(jya 爆弾で破壊岩)(arg_data 0x%04x)\n", this->dyna.actor.params); + PRINTF(T("(jya 爆弾で破壊岩)", "(jya bomb destroys rocks)") "(arg_data 0x%04x)\n", this->dyna.actor.params); } } diff --git a/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.h b/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.h index 879291f87c..9f06d9a1d6 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.h +++ b/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.h @@ -2,8 +2,7 @@ #define Z_BG_JYA_BOMBIWA_H #include "ultra64.h" -#include "global.h" - +#include "z64actor.h" struct BgJyaBombiwa; @@ -11,7 +10,7 @@ typedef struct BgJyaBombiwa { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ s32 unk_164; /* 0x0168 */ ColliderJntSph collider; - /* 0x0188 */ ColliderJntSphElement colliderItems[1]; + /* 0x0188 */ ColliderJntSphElement colliderElements[1]; } BgJyaBombiwa; // size = 0x01C8 #endif diff --git a/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c b/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c index c32bd92896..0a087d91d9 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c +++ b/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c @@ -1,8 +1,20 @@ #include "z_bg_jya_cobra.h" #include "overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.h" #include "overlays/actors/ovl_Mir_Ray/z_mir_ray.h" -#include "assets/objects/object_jya_obj/object_jya_obj.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "sfx.h" +#include "sys_matrix.h" #include "terminal.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" + +#include "assets/objects/object_jya_obj/object_jya_obj.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -127,9 +139,9 @@ void BgJyaCobra_InitDynapoly(BgJyaCobra* this, PlayState* play, CollisionHeader* if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; - // "Warning : move BG Registration Failure" - PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_cobra.c", 247, - this->dyna.actor.id, this->dyna.actor.params); + PRINTF(T("Warning : move BG 登録失敗", + "Warning : move BG registration failed") "(%s %d)(name %d)(arg_data 0x%04x)\n", + "../z_bg_jya_cobra.c", 247, this->dyna.actor.id, this->dyna.actor.params); } #endif } @@ -141,8 +153,8 @@ void BgJyaCobra_SpawnRay(BgJyaCobra* this, PlayState* play) { #if DEBUG_FEATURES if (this->dyna.actor.child == NULL) { PRINTF_COLOR_RED(); - // "Error : Mir Ray occurrence failure" - PRINTF("Error : Mir Ray 発生失敗 (%s %d)\n", "../z_bg_jya_cobra.c", 270); + PRINTF(T("Error : Mir Ray 発生失敗", "Error : Mir Ray failed to occur") " (%s %d)\n", + "../z_bg_jya_cobra.c", 270); PRINTF_RST(); } #endif @@ -427,8 +439,7 @@ void BgJyaCobra_Init(Actor* thisx, PlayState* play) { BgJyaCobra_UpdateShadowFromTop(this); } - // "(jya cobra)" - PRINTF("(jya コブラ)(arg_data 0x%04x)(act %x)(txt %x)(txt16 %x)\n", this->dyna.actor.params, this, + PRINTF("(jya " T("コブラ", "cobra") ")(arg_data 0x%04x)(act %x)(txt %x)(txt16 %x)\n", this->dyna.actor.params, this, &this->shadowTextureBuffer, COBRA_SHADOW_TEX_PTR(this)); } diff --git a/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.h b/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.h index 8722bcc2ce..32266e2ac4 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.h +++ b/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.h @@ -2,11 +2,11 @@ #define Z_BG_JYA_COBRA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgJyaCobra; -typedef void (*BgJyaCobraActionFunc)(struct BgJyaCobra*, PlayState*); +typedef void (*BgJyaCobraActionFunc)(struct BgJyaCobra*, struct PlayState*); #define COBRA_SHADOW_TEX_WIDTH 64 #define COBRA_SHADOW_TEX_HEIGHT 64 diff --git a/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c b/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c index 9122ebfcf9..6d6b13efb8 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c +++ b/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c @@ -6,6 +6,13 @@ */ #include "z_bg_jya_goroiwa.h" + +#include "ichain.h" +#include "sfx.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_goroiwa/object_goroiwa.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -83,7 +90,7 @@ void BgJyaGoroiwa_InitCollider(BgJyaGoroiwa* this, PlayState* play) { s32 pad; Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, &this->colliderItem); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); BgJyaGoroiwa_UpdateCollider(this); this->collider.elements[0].dim.worldSphere.radius = 58; } diff --git a/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.h b/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.h index 2722475480..35f4c971c9 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.h +++ b/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.h @@ -2,17 +2,17 @@ #define Z_BG_JYA_GOROIWA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgJyaGoroiwa; -typedef void (*BgJyaGoroiwaFunc)(struct BgJyaGoroiwa*, PlayState*); +typedef void (*BgJyaGoroiwaFunc)(struct BgJyaGoroiwa*, struct PlayState*); typedef struct BgJyaGoroiwa { /* 0x0000 */ Actor actor; /* 0x014C */ BgJyaGoroiwaFunc actionFunc; /* 0x0150 */ ColliderJntSph collider; - /* 0x0170 */ ColliderJntSphElement colliderItem; + /* 0x0170 */ ColliderJntSphElement colliderElements[1]; /* 0x01B0 */ f32 speedFactor; /* 0x01B4 */ s16 hasHit; /* 0x01B6 */ s16 waitTimer; diff --git a/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c b/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c index f327e15f8c..b9350da300 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c +++ b/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c @@ -6,6 +6,15 @@ #include "z_bg_jya_haheniron.h" #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" + +#include "libc64/qrand.h" +#include "array_count.h" +#include "ichain.h" +#include "sfx.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/object_jya_iron/object_jya_iron.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -79,7 +88,7 @@ void BgJyaHaheniron_ColliderInit(BgJyaHaheniron* this, PlayState* play) { s32 pad; Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); } void BgJyaHaheniron_SpawnFragments(PlayState* play, Vec3f* vec1, Vec3f* vec2) { diff --git a/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.h b/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.h index 60f9c6ef9e..2da7d3673f 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.h +++ b/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.h @@ -2,17 +2,17 @@ #define Z_BG_JYA_HAHENIRON_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgJyaHaheniron; -typedef void (*BgJyaHahenironActionFunc)(struct BgJyaHaheniron*, PlayState*); +typedef void (*BgJyaHahenironActionFunc)(struct BgJyaHaheniron*, struct PlayState*); typedef struct BgJyaHaheniron { /* 0x0000 */ Actor actor; /* 0x014C */ BgJyaHahenironActionFunc actionFunc; /* 0x0150 */ ColliderJntSph collider; - /* 0x0170 */ ColliderJntSphElement colliderItems[1]; + /* 0x0170 */ ColliderJntSphElement colliderElements[1]; /* 0x01B0 */ s16 timer; } BgJyaHaheniron; // size = 0x01B4 diff --git a/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c b/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c index e5a8e139ba..cb326593a7 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c +++ b/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c @@ -5,9 +5,20 @@ */ #include "z_bg_jya_ironobj.h" -#include "assets/objects/object_jya_iron/object_jya_iron.h" #include "overlays/actors/ovl_En_Ik/z_en_ik.h" +#include "libc64/qrand.h" +#include "ichain.h" +#include "printf.h" +#include "sfx.h" +#include "translation.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + +#include "assets/objects/object_jya_iron/object_jya_iron.h" + #define FLAGS 0 typedef void (*BgJyaIronobjIkFunc)(BgJyaIronobj*, PlayState*, EnIk*); @@ -80,13 +91,13 @@ static InitChainEntry sInitChain[] = { static CollisionHeader* sCollisionHeaders[] = { &gPillarCol, &gThroneCol }; void BgJyaIronobj_InitCylinder(BgJyaIronobj* this, PlayState* play) { - ColliderCylinder* colCylinder = &this->colCylinder; + ColliderCylinder* colCylinder = &this->colliderCylinder; Collider_InitCylinder(play, colCylinder); Collider_SetCylinder(play, colCylinder, &this->dyna.actor, &sCylinderInit); if (PARAMS_GET_U(this->dyna.actor.params, 0, 1) == 1) { - this->colCylinder.dim.radius = 40; - this->colCylinder.dim.height = 100; + this->colliderCylinder.dim.radius = 40; + this->colliderCylinder.dim.height = 100; } Collider_UpdateCylinder(&this->dyna.actor, colCylinder); } @@ -108,7 +119,8 @@ void BgJyaIronobj_SpawnPillarParticles(BgJyaIronobj* this, PlayState* play, EnIk #if DEBUG_FEATURES if (enIk->unk_2FF <= 0 || enIk->unk_2FF >= 4) { - PRINTF("Error 攻撃方法が分からない(%s %d)\n", "../z_bg_jya_ironobj.c", 233); + PRINTF(T("Error 攻撃方法が分からない(%s %d)\n", "Error I don't know how to attack(%s %d)\n"), + "../z_bg_jya_ironobj.c", 233); return; } #endif @@ -174,7 +186,8 @@ void BgJyaIronobj_SpawnThroneParticles(BgJyaIronobj* this, PlayState* play, EnIk #if DEBUG_FEATURES if (enIk->unk_2FF <= 0 || enIk->unk_2FF >= 4) { - PRINTF("Error 攻撃方法が分からない(%s %d)\n", "../z_bg_jya_ironobj.c", 362); + PRINTF(T("Error 攻撃方法が分からない(%s %d)\n", "Error I don't know how to attack(%s %d)\n"), + "../z_bg_jya_ironobj.c", 362); return; } #endif @@ -235,7 +248,7 @@ void BgJyaIronobj_Init(Actor* thisx, PlayState* play) { void BgJyaIronobj_Destroy(Actor* thisx, PlayState* play) { BgJyaIronobj* this = (BgJyaIronobj*)thisx; - Collider_DestroyCylinder(play, &this->colCylinder); + Collider_DestroyCylinder(play, &this->colliderCylinder); DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } @@ -249,9 +262,9 @@ void func_808992E8(BgJyaIronobj* this, PlayState* play) { Vec3f dropPos; s32 i; - if (this->colCylinder.base.acFlags & AC_HIT) { - actor = this->colCylinder.base.ac; - this->colCylinder.base.acFlags &= ~AC_HIT; + if (this->colliderCylinder.base.acFlags & AC_HIT) { + actor = this->colliderCylinder.base.ac; + this->colliderCylinder.base.acFlags &= ~AC_HIT; if (actor != NULL && actor->id == ACTOR_EN_IK) { particleFunc[PARAMS_GET_U(this->dyna.actor.params, 0, 1)](this, play, (EnIk*)actor); SfxSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 80, NA_SE_EN_IRONNACK_BREAK_PILLAR); @@ -266,7 +279,7 @@ void func_808992E8(BgJyaIronobj* this, PlayState* play) { return; } } else { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCylinder.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder.base); } } diff --git a/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.h b/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.h index a8189049af..9768aec2a5 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.h +++ b/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.h @@ -2,16 +2,16 @@ #define Z_BG_JYA_IRONOBJ_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgJyaIronobj; -typedef void (*BgJyaIronobjActionFunc)(struct BgJyaIronobj*, PlayState*); +typedef void (*BgJyaIronobjActionFunc)(struct BgJyaIronobj*, struct PlayState*); typedef struct BgJyaIronobj { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ BgJyaIronobjActionFunc actionFunc; - /* 0x0168 */ ColliderCylinder colCylinder; + /* 0x0168 */ ColliderCylinder colliderCylinder; } BgJyaIronobj; // size = 0x01B4 #endif diff --git a/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c b/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c index 459e3f11af..354c17b94b 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c +++ b/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c @@ -5,8 +5,17 @@ */ #include "z_bg_jya_kanaami.h" -#include "assets/objects/object_jya_obj/object_jya_obj.h" + +#include "ichain.h" +#include "one_point_cutscene.h" +#include "printf.h" #include "quake.h" +#include "sfx.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" + +#include "assets/objects/object_jya_obj/object_jya_obj.h" #define FLAGS 0 @@ -52,8 +61,9 @@ void BgJyaKanaami_InitDynaPoly(BgJyaKanaami* this, PlayState* play, CollisionHea if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; - PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_kanaami.c", 145, - this->dyna.actor.id, this->dyna.actor.params); + PRINTF(T("Warning : move BG 登録失敗", + "Warning : move BG registration failed") "(%s %d)(name %d)(arg_data 0x%04x)\n", + "../z_bg_jya_kanaami.c", 145, this->dyna.actor.id, this->dyna.actor.params); } #endif } @@ -68,7 +78,7 @@ void BgJyaKanaami_Init(Actor* thisx, PlayState* play) { } else { func_80899880(this); } - PRINTF("(jya 金網)(arg_data 0x%04x)\n", this->dyna.actor.params); + PRINTF("(jya " T("金網", "wire mesh") ")(arg_data 0x%04x)\n", this->dyna.actor.params); } void BgJyaKanaami_Destroy(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.h b/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.h index 6e5d670fde..a125e8ef53 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.h +++ b/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.h @@ -2,11 +2,11 @@ #define Z_BG_JYA_KANAAMI_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgJyaKanaami; -typedef void (*BgJyaKanaamiActionFunc)(struct BgJyaKanaami*, PlayState*); +typedef void (*BgJyaKanaamiActionFunc)(struct BgJyaKanaami*, struct PlayState*); typedef struct BgJyaKanaami { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c b/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c index 2d1092c8e5..dd8b162bd7 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c +++ b/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c @@ -5,6 +5,15 @@ */ #include "z_bg_jya_lift.h" + +#include "ichain.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "sfx.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" + #include "assets/objects/object_jya_obj/object_jya_obj.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -59,8 +68,7 @@ void BgJyaLift_Init(Actor* thisx, PlayState* play) { return; } - // "Goddess lift CT" - PRINTF("女神リフト CT\n"); + PRINTF(T("女神リフト CT\n", "Goddess lift CT\n")); BgJyaLift_InitDynapoly(this, play, &gLiftCol, 0); Actor_ProcessInitChain(thisx, sInitChain); if (Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 0, 6))) { @@ -78,8 +86,7 @@ void BgJyaLift_Destroy(Actor* thisx, PlayState* play) { if (this->isSpawned) { - // "Goddess Lift DT" - PRINTF("女神リフト DT\n"); + PRINTF(T("女神リフト DT\n", "Goddess lift DT\n")); sIsSpawned = false; DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } diff --git a/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.h b/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.h index b6c951dc18..ea9abac2bf 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.h +++ b/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.h @@ -2,10 +2,10 @@ #define Z_BG_JYA_LIFT_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgJyaLift; -typedef void (*BgJyaLiftActionFunc)(struct BgJyaLift*, PlayState*); +typedef void (*BgJyaLiftActionFunc)(struct BgJyaLift*, struct PlayState*); typedef struct BgJyaLift { /* 0x000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c b/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c index 546f8c8d64..a72f245e22 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c +++ b/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c @@ -6,6 +6,20 @@ #include "z_bg_jya_megami.h" #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" + +#include "libc64/qrand.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/object_jya_obj/object_jya_obj.h" #define FLAGS 0 @@ -123,7 +137,7 @@ void BgJyaMegami_InitCollider(BgJyaMegami* this, PlayState* play) { s32 pad; Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, &this->colliderItem); + Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderElements); } void BgJyaMegami_SpawnEffect(PlayState* play, Vec3f* pos, Vec3f* velocity, s32 num, s32 arg4) { diff --git a/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.h b/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.h index b24f236013..e297ebb63a 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.h +++ b/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.h @@ -2,11 +2,11 @@ #define Z_BG_JYA_MEGAMI_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgJyaMegami; -typedef void (*BgJyaMegamiActionFunc)(struct BgJyaMegami*, PlayState*); +typedef void (*BgJyaMegamiActionFunc)(struct BgJyaMegami*, struct PlayState*); typedef struct BgJyaMegamiPiece { /* 0x00 */ Vec3f pos; @@ -19,7 +19,7 @@ typedef struct BgJyaMegami { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ BgJyaMegamiActionFunc actionFunc; /* 0x0168 */ ColliderJntSph collider; - /* 0x0188 */ ColliderJntSphElement colliderItem; + /* 0x0188 */ ColliderJntSphElement colliderElements[1]; /* 0x01C8 */ s16 lightTimer; /* 0x01CA */ s16 explosionTimer; /* 0x01CC */ s16 crumbleIndex; diff --git a/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c b/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c index bbdc93c2f8..e9cfd701a2 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c +++ b/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c @@ -5,8 +5,18 @@ */ #include "z_bg_jya_zurerukabe.h" -#include "assets/objects/object_jya_obj/object_jya_obj.h" + +#include "array_count.h" +#include "ichain.h" +#include "printf.h" +#include "sfx.h" #include "terminal.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" + +#include "assets/objects/object_jya_obj/object_jya_obj.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -71,8 +81,9 @@ void BgJyaZurerukabe_InitDynaPoly(BgJyaZurerukabe* this, PlayState* play, Collis if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; - PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_zurerukabe.c", 194, - this->dyna.actor.id, this->dyna.actor.params); + PRINTF(T("Warning : move BG 登録失敗", + "Warning : move BG registration failed") "(%s %d)(name %d)(arg_data 0x%04x)\n", + "../z_bg_jya_zurerukabe.c", 194, this->dyna.actor.id, this->dyna.actor.params); } #endif } @@ -126,14 +137,14 @@ void BgJyaZurerukabe_Init(Actor* thisx, PlayState* play) { if (i == ARRAY_COUNT(D_8089B9F0)) { PRINTF_COLOR_ERROR(); - PRINTF("home pos が変更されたみたい(%s %d)(arg_data 0x%04x)\n", "../z_bg_jya_zurerukabe.c", 299, - this->dyna.actor.params); + PRINTF(T("home pos が変更されたみたい", "It seems that the home pos has changed") "(%s %d)(arg_data 0x%04x)\n", + "../z_bg_jya_zurerukabe.c", 299, this->dyna.actor.params); PRINTF_RST(); } this->unk_16E = D_8089B9F8[this->unk_168]; func_8089B7B4(this); - PRINTF("(jya ずれる壁)(arg_data 0x%04x)\n", this->dyna.actor.params); + PRINTF("(jya " T("ずれる壁", "sliding wall") ")(arg_data 0x%04x)\n", this->dyna.actor.params); } void BgJyaZurerukabe_Destroy(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.h b/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.h index 683f681999..d9d920f57b 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.h +++ b/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.h @@ -2,11 +2,11 @@ #define Z_BG_JYA_ZURERUKABE_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgJyaZurerukabe; -typedef void (*BgJyaZurerukabeActionFunc)(struct BgJyaZurerukabe*, PlayState*); +typedef void (*BgJyaZurerukabeActionFunc)(struct BgJyaZurerukabe*, struct PlayState*); typedef struct BgJyaZurerukabe { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c b/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c index e44f561d83..79102a7c12 100644 --- a/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c +++ b/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c @@ -5,6 +5,15 @@ */ #include "z_bg_menkuri_eye.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" + #include "assets/objects/object_menkuri_objects/object_menkuri_objects.h" #define FLAGS ACTOR_FLAG_DRAW_CULLING_DISABLED @@ -65,7 +74,7 @@ void BgMenkuriEye_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); this->collider.elements[0].dim.worldSphere.center.x = this->actor.world.pos.x; this->collider.elements[0].dim.worldSphere.center.y = this->actor.world.pos.y; this->collider.elements[0].dim.worldSphere.center.z = this->actor.world.pos.z; diff --git a/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.h b/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.h index cf27ca1827..69f1e32eab 100644 --- a/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.h +++ b/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.h @@ -2,7 +2,7 @@ #define Z_BG_MENKURI_EYE_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgMenkuriEye; @@ -10,7 +10,7 @@ typedef struct BgMenkuriEye { /* 0x0000 */ Actor actor; /* 0x014C */ s16 framesUntilDisable; /* 0x0150 */ ColliderJntSph collider; - /* 0x0170 */ ColliderJntSphElement colliderItems[1]; + /* 0x0170 */ ColliderJntSphElement colliderElements[1]; } BgMenkuriEye; // size = 0x01B0 #endif diff --git a/src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.c b/src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.c index cb3c724cf5..ee3f35a1db 100644 --- a/src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.c +++ b/src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.c @@ -5,6 +5,11 @@ */ #include "z_bg_menkuri_kaiten.h" + +#include "ichain.h" +#include "sfx.h" +#include "z64play.h" + #include "assets/objects/object_menkuri_objects/object_menkuri_objects.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.h b/src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.h index c65b08d6e9..5bcdbf8ec4 100644 --- a/src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.h +++ b/src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.h @@ -2,7 +2,7 @@ #define Z_BG_MENKURI_KAITEN_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgMenkuriKaiten; diff --git a/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c b/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c index 589ecd6d7a..ff13454557 100644 --- a/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c +++ b/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c @@ -5,6 +5,9 @@ */ #include "z_bg_menkuri_nisekabe.h" + +#include "z64play.h" + #include "assets/objects/object_menkuri_objects/object_menkuri_objects.h" #define FLAGS 0 @@ -51,7 +54,7 @@ void BgMenkuriNisekabe_Draw(Actor* thisx, PlayState* play) { BgMenkuriNisekabe* this = (BgMenkuriNisekabe*)thisx; u32 index = PARAMS_GET_U(this->actor.params, 0, 8); - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { + if (ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_REACT_TO_LENS)) { Gfx_DrawDListXlu(play, sDLists[index]); } else { Gfx_DrawDListOpa(play, sDLists[index]); diff --git a/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.h b/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.h index f7cb56a5bf..54cce56eff 100644 --- a/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.h +++ b/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.h @@ -2,7 +2,7 @@ #define Z_BG_MENKURI_NISEKABE_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgMenkuriNisekabe; diff --git a/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c b/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c index 2bcc1974b2..7dc55fbe02 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c @@ -6,6 +6,19 @@ #include "z_bg_mizu_bwall.h" #include "overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.h" + +#include "libc64/qrand.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" + #include "assets/objects/object_mizu_objects/object_mizu_objects.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -196,9 +209,11 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { this->actionFunc = BgMizuBwall_DoNothing; } else { Collider_InitTris(play, &this->collider); - if (!Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInitFloor, this->elements)) { - PRINTF("Error : コリジョンデータセット失敗(%s %d)(arg_data 0x%04x)\n", "../z_bg_mizu_bwall.c", 484, - this->dyna.actor.params); + if (!Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInitFloor, + this->colliderElements)) { + PRINTF(T("Error : コリジョンデータセット失敗", + "Error : Collision data set failure") "(%s %d)(arg_data 0x%04x)\n", + "../z_bg_mizu_bwall.c", 484, this->dyna.actor.params); Actor_Kill(&this->dyna.actor); } else { sin = Math_SinS(this->dyna.actor.shape.rot.y); @@ -235,9 +250,11 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { this->actionFunc = BgMizuBwall_DoNothing; } else { Collider_InitTris(play, &this->collider); - if (!Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInitRutoWall, this->elements)) { - PRINTF("Error : コリジョンデータセット失敗(%s %d)(arg_data 0x%04x)\n", "../z_bg_mizu_bwall.c", 558, - this->dyna.actor.params); + if (!Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInitRutoWall, + this->colliderElements)) { + PRINTF(T("Error : コリジョンデータセット失敗", + "Error : Collision data set failure") "(%s %d)(arg_data 0x%04x)\n", + "../z_bg_mizu_bwall.c", 558, this->dyna.actor.params); Actor_Kill(&this->dyna.actor); } else { sin = Math_SinS(this->dyna.actor.shape.rot.y); @@ -274,9 +291,11 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { this->actionFunc = BgMizuBwall_DoNothing; } else { Collider_InitTris(play, &this->collider); - if (!Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInitUnusedWall, this->elements)) { - PRINTF("Error : コリジョンデータセット失敗(%s %d)(arg_data 0x%04x)\n", "../z_bg_mizu_bwall.c", 638, - this->dyna.actor.params); + if (!Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInitUnusedWall, + this->colliderElements)) { + PRINTF(T("Error : コリジョンデータセット失敗", + "Error : Collision data set failure") "(%s %d)(arg_data 0x%04x)\n", + "../z_bg_mizu_bwall.c", 638, this->dyna.actor.params); Actor_Kill(&this->dyna.actor); } else { sin = Math_SinS(this->dyna.actor.shape.rot.y); @@ -316,9 +335,10 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { } else { Collider_InitTris(play, &this->collider); if (!Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInitStingerWall, - this->elements)) { - PRINTF("Error : コリジョンデータセット失敗(%s %d)(arg_data 0x%04x)\n", "../z_bg_mizu_bwall.c", 724, - this->dyna.actor.params); + this->colliderElements)) { + PRINTF(T("Error : コリジョンデータセット失敗", + "Error : Collision data set failure") "(%s %d)(arg_data 0x%04x)\n", + "../z_bg_mizu_bwall.c", 724, this->dyna.actor.params); Actor_Kill(&this->dyna.actor); } else { sin = Math_SinS(this->dyna.actor.shape.rot.y); @@ -358,9 +378,10 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { } else { Collider_InitTris(play, &this->collider); if (!Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInitStingerWall, - this->elements)) { - PRINTF("Error : コリジョンデータセット失敗(%s %d)(arg_data 0x%04x)\n", "../z_bg_mizu_bwall.c", 798, - this->dyna.actor.params); + this->colliderElements)) { + PRINTF(T("Error : コリジョンデータセット失敗", + "Error : Collision data set failure") "(%s %d)(arg_data 0x%04x)\n", + "../z_bg_mizu_bwall.c", 798, this->dyna.actor.params); Actor_Kill(&this->dyna.actor); } else { sin = Math_SinS(this->dyna.actor.shape.rot.y); diff --git a/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.h b/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.h index d5eeaad344..aacbf321a5 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.h +++ b/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.h @@ -2,16 +2,16 @@ #define Z_BG_MIZU_BWALL_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgMizuBwall; -typedef void (*BgMizuBwallActionFunc)(struct BgMizuBwall*, PlayState*); +typedef void (*BgMizuBwallActionFunc)(struct BgMizuBwall*, struct PlayState*); typedef struct BgMizuBwall { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ ColliderTris collider; - /* 0x0184 */ ColliderTrisElement elements[3]; // only ever uses 2 + /* 0x0184 */ ColliderTrisElement colliderElements[3]; // only ever uses 2 /* 0x0298 */ BgMizuBwallActionFunc actionFunc; /* 0x029C */ f32 yRot; /* 0x02A0 */ s32 scrollAlpha1; diff --git a/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c b/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c index 095ab67e43..ae1dd32bc6 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c @@ -6,6 +6,16 @@ #include "z_bg_mizu_movebg.h" #include "overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" + #include "assets/objects/object_mizu_objects/object_mizu_objects.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.h b/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.h index 1a378f13a5..75a50e864e 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.h +++ b/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.h @@ -2,7 +2,7 @@ #define Z_BG_MIZU_MOVEBG_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" typedef enum BgMizuMovebgType { /* 0 */ MIZUMOVEBG_TYPE_FLOATING_PLATFORM_OUTSIDE_CENTER_PILLAR, @@ -18,7 +18,7 @@ typedef enum BgMizuMovebgType { struct BgMizuMovebg; -typedef void (*BgMizuMovebgActionFunc)(struct BgMizuMovebg*, PlayState*); +typedef void (*BgMizuMovebgActionFunc)(struct BgMizuMovebg*, struct PlayState*); typedef struct BgMizuMovebg { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c b/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c index 585f85f6f5..ed8fae2784 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c @@ -1,4 +1,15 @@ #include "z_bg_mizu_shutter.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "rumble.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" + #include "assets/objects/object_mizu_objects/object_mizu_objects.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.h b/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.h index cc42e4ddf3..bcba73f531 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.h +++ b/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.h @@ -2,7 +2,7 @@ #define Z_BG_MIZU_SHUTTER_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" #define BGMIZUSHUTTER_GET_SIZE(thisx) PARAMS_GET_U((u16)(thisx)->params, 12, 4) #define BGMIZUSHUTTER_GET_TIMER(thisx) PARAMS_GET_U((u16)(thisx)->params, 6, 6) @@ -12,7 +12,7 @@ struct BgMizuShutter; -typedef void (*BgMizuShutterActionFunc)(struct BgMizuShutter*, PlayState*); +typedef void (*BgMizuShutterActionFunc)(struct BgMizuShutter*, struct PlayState*); typedef struct BgMizuShutter { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c b/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c index 9f1884ea49..3072207ece 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c @@ -5,6 +5,12 @@ */ #include "z_bg_mizu_uzu.h" + +#include "ichain.h" +#include "sfx.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_mizu_objects/object_mizu_objects.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.h b/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.h index 94e6b3c9d1..f8fe16ccd7 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.h +++ b/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.h @@ -2,11 +2,11 @@ #define Z_BG_MIZU_UZU_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgMizuUzu; -typedef void (*BgMizuUzuActionFunc)(struct BgMizuUzu*, PlayState*); +typedef void (*BgMizuUzuActionFunc)(struct BgMizuUzu*, struct PlayState*); typedef struct BgMizuUzu { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c b/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c index 68f551be8b..2b5be14285 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c @@ -5,6 +5,20 @@ */ #include "z_bg_mizu_water.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "regs.h" +#include "rumble.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" + #include "assets/objects/object_mizu_objects/object_mizu_objects.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) @@ -108,7 +122,8 @@ void BgMizuWater_Init(Actor* thisx, PlayState* play) { switch (this->type) { case 0: if (bREG(15) == 0) { - PRINTF("<コンストラクト>%x %x %x\n", Flags_GetSwitch(play, WATER_TEMPLE_WATER_F1_FLAG), + PRINTF(T("<コンストラクト>", "") "%x %x %x\n", + Flags_GetSwitch(play, WATER_TEMPLE_WATER_F1_FLAG), Flags_GetSwitch(play, WATER_TEMPLE_WATER_F2_FLAG), Flags_GetSwitch(play, WATER_TEMPLE_WATER_F3_FLAG)); } diff --git a/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.h b/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.h index 21196022f8..26eb33d0d8 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.h +++ b/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.h @@ -2,11 +2,11 @@ #define Z_BG_MIZU_WATER_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgMizuWater; -typedef void (*BgMizuWaterActionFunc)(struct BgMizuWater*, PlayState*); +typedef void (*BgMizuWaterActionFunc)(struct BgMizuWater*, struct PlayState*); typedef struct BgMizuWater { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c b/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c index 69bbc3506c..bf00812fc6 100644 --- a/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c +++ b/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c @@ -5,6 +5,14 @@ */ #include "z_bg_mjin.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "segmented_address.h" +#include "sys_matrix.h" +#include "z64play.h" + #include "assets/objects/object_mjin/object_mjin.h" #include "assets/objects/object_mjin_wind/object_mjin_wind.h" #include "assets/objects/object_mjin_soul/object_mjin_soul.h" @@ -109,7 +117,7 @@ void BgMjin_Draw(Actor* thisx, PlayState* play) { s32 objectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[thisx->params - 1]); if (objectSlot >= 0) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); } gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(&D_06000000)); diff --git a/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.h b/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.h index 03e18fbb76..1ed19aa2a4 100644 --- a/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.h +++ b/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.h @@ -2,11 +2,11 @@ #define Z_BG_MJIN_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgMjin; -typedef void (*BgMjinActionFunc)(struct BgMjin*, PlayState*); +typedef void (*BgMjinActionFunc)(struct BgMjin*, struct PlayState*); typedef struct BgMjin { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c index 7b02395228..c0b7314bcb 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c +++ b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c @@ -5,8 +5,20 @@ */ #include "z_bg_mori_bigst.h" -#include "assets/objects/object_mori_objects/object_mori_objects.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "printf.h" #include "quake.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "translation.h" +#include "z64play.h" +#include "z64player.h" + +#include "assets/objects/object_mori_objects/object_mori_objects.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -62,9 +74,9 @@ void BgMoriBigst_InitDynapoly(BgMoriBigst* this, PlayState* play, CollisionHeade if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; - // "Warning : move BG login failed" - PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_mori_bigst.c", 190, - this->dyna.actor.id, this->dyna.actor.params); + PRINTF(T("Warning : move BG 登録失敗", + "Warning : move BG registration failed") "(%s %d)(name %d)(arg_data 0x%04x)\n", + "../z_bg_mori_bigst.c", 190, this->dyna.actor.id, this->dyna.actor.params); } #endif } @@ -73,17 +85,16 @@ void BgMoriBigst_Init(Actor* thisx, PlayState* play) { s32 pad; BgMoriBigst* this = (BgMoriBigst*)thisx; - // "mori (bigST.keyceiling)" - PRINTF("mori (bigST.鍵型天井)(arg : %04x)(sw %d)(noE %d)(roomC %d)(playerPosY %f)\n", this->dyna.actor.params, - Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6)), + PRINTF(T("mori (bigST.鍵型天井)", + "mori (bigST. key-shaped ceiling)") "(arg : %04x)(sw %d)(noE %d)(roomC %d)(playerPosY %f)\n", + this->dyna.actor.params, Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6)), Flags_GetTempClear(play, this->dyna.actor.room), Flags_GetClear(play, this->dyna.actor.room), GET_PLAYER(play)->actor.world.pos.y); BgMoriBigst_InitDynapoly(this, play, &gMoriBigstCol, 0); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX); if (this->moriTexObjectSlot < 0) { - // "【Big Stalfos key ceiling】 bank danger!" - PRINTF("【ビッグスタルフォス鍵型天井】 バンク危険!\n"); + PRINTF(T("【ビッグスタルフォス鍵型天井】 バンク危険!\n", "[Big Stalfos Key-shaped Ceiling] Bank danger!\n")); PRINTF("%s %d\n", "../z_bg_mori_bigst.c", 234); Actor_Kill(&this->dyna.actor); return; @@ -140,8 +151,7 @@ void BgMoriBigst_SetupStalfosFight(BgMoriBigst* this, PlayState* play) { this->dyna.actor.child = NULL; this->dyna.actor.home.rot.z++; } else { - // "Second Stalfos failure" - PRINTF("Warning : 第2スタルフォス発生失敗\n"); + PRINTF(T("Warning : 第2スタルフォス発生失敗\n", "Warning : Second Stalfos failed to generate\n")); } Flags_SetClear(play, this->dyna.actor.room); } @@ -202,8 +212,7 @@ void BgMoriBigst_SetupStalfosPairFight(BgMoriBigst* this, PlayState* play) { this->dyna.actor.child = NULL; this->dyna.actor.home.rot.z++; } else { - // "Warning: 3-1 Stalfos failure" - PRINTF("Warning : 第3-1スタルフォス発生失敗\n"); + PRINTF(T("Warning : 第3-1スタルフォス発生失敗\n", "Warning : 3-1 Stalfos generation failure\n")); } stalfos2 = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_TEST, 170.0f, 827.0f, -3260.0f, 0, 0, 0, 5); @@ -211,8 +220,7 @@ void BgMoriBigst_SetupStalfosPairFight(BgMoriBigst* this, PlayState* play) { this->dyna.actor.child = NULL; this->dyna.actor.home.rot.z++; } else { - // "Warning: 3-2 Stalfos failure" - PRINTF("Warning : 第3-2スタルフォス発生失敗\n"); + PRINTF(T("Warning : 第3-2スタルフォス発生失敗\n", "Warning : 3-2 Stalfos generation failure\n")); } Flags_SetClear(play, this->dyna.actor.room); } diff --git a/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.h b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.h index c71eac7ab1..f37499b2f7 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.h +++ b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.h @@ -2,11 +2,11 @@ #define Z_BG_MORI_BIGST_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgMoriBigst; -typedef void (*BgMoriBigstActionFunc)(struct BgMoriBigst*, PlayState*); +typedef void (*BgMoriBigstActionFunc)(struct BgMoriBigst*, struct PlayState*); typedef struct BgMoriBigst { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c index b441ed008c..028606443f 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c +++ b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c @@ -1,4 +1,17 @@ #include "z_bg_mori_elevator.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "translation.h" +#include "z64audio.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_mori_objects/object_mori_objects.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -92,16 +105,16 @@ void BgMoriElevator_Init(Actor* thisx, PlayState* play) { #if DEBUG_FEATURES if (this->moriTexObjectSlot < 0) { Actor_Kill(thisx); - // "Forest Temple obj elevator Bank Danger!" - PRINTF("Error : 森の神殿 obj elevator バンク危険!(%s %d)\n", "../z_bg_mori_elevator.c", 277); + PRINTF(T("Error : 森の神殿 obj elevator バンク危険!(%s %d)\n", + "Error : Forest Temple obj elevator bank danger! (%s %d)\n"), + "../z_bg_mori_elevator.c", 277); return; } #endif switch (sIsSpawned) { case false: - // "Forest Temple elevator CT" - PRINTF("森の神殿 elevator CT\n"); + PRINTF(T("森の神殿 elevator CT\n", "Forest Temple elevator CT\n")); sIsSpawned = true; this->dyna.actor.room = -1; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); @@ -120,8 +133,7 @@ void BgMoriElevator_Destroy(Actor* thisx, PlayState* play) { BgMoriElevator* this = (BgMoriElevator*)thisx; if (this->unk_172 == 0) { - // "Forest Temple elevator DT" - PRINTF("森の神殿 elevator DT\n"); + PRINTF(T("森の神殿 elevator DT\n", "Forest Temple elevator DT\n")); DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); sIsSpawned = false; } @@ -144,8 +156,9 @@ void BgMoriElevator_WaitAfterInit(BgMoriElevator* this, PlayState* play) { this->dyna.actor.world.pos.y = 73.0f; BgMoriElevator_SetupSetPosition(this); } else { - // "Error: Forest Temple obj elevator Room setting is dangerous" - PRINTF("Error : 森の神殿 obj elevator 部屋設定が危険(%s %d)\n", "../z_bg_mori_elevator.c", 371); + PRINTF(T("Error : 森の神殿 obj elevator 部屋設定が危険(%s %d)\n", + "Error : Forest Temple obj elevator room setting is dangerous(%s %d)\n"), + "../z_bg_mori_elevator.c", 371); } } else { BgMoriElevator_SetupSetPosition(this); @@ -205,8 +218,9 @@ void BgMoriElevator_SetPosition(BgMoriElevator* this, PlayState* play) { this->targetY = 233.0f; BgMoriElevator_StopMovement(this); } else { - // "Error:Forest Temple obj elevator Room setting is dangerous(%s %d)" - PRINTF("Error : 森の神殿 obj elevator 部屋設定が危険(%s %d)\n", "../z_bg_mori_elevator.c", 479); + PRINTF(T("Error : 森の神殿 obj elevator 部屋設定が危険(%s %d)\n", + "Error : Forest Temple obj elevator room setting is dangerous(%s %d)\n"), + "../z_bg_mori_elevator.c", 479); } } else if ((play->roomCtx.curRoom.num == 2) && (this->dyna.actor.world.pos.y < -275.0f)) { this->targetY = 233.0f; diff --git a/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.h b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.h index e7bcc5018e..42e45d56fc 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.h +++ b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.h @@ -2,11 +2,11 @@ #define Z_BG_MORI_ELEVATOR_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgMoriElevator; -typedef void (*BgMoriElevatorActionFunc)(struct BgMoriElevator*, PlayState*); +typedef void (*BgMoriElevatorActionFunc)(struct BgMoriElevator*, struct PlayState*); typedef struct BgMoriElevator { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c index 53bc3b6b47..6bd947c3a0 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c @@ -5,6 +5,17 @@ */ #include "z_bg_mori_hashigo.h" + +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "sys_matrix.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" + #include "assets/objects/object_mori_objects/object_mori_objects.h" #define FLAGS 0 @@ -91,9 +102,9 @@ void BgMoriHashigo_InitDynapoly(BgMoriHashigo* this, PlayState* play, CollisionH if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; - // "Warning : move BG login failed" - PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_mori_hashigo.c", 164, - this->dyna.actor.id, this->dyna.actor.params); + PRINTF(T("Warning : move BG 登録失敗", + "Warning : move BG registration failed") "(%s %d)(name %d)(arg_data 0x%04x)\n", + "../z_bg_mori_hashigo.c", 164, this->dyna.actor.id, this->dyna.actor.params); } #endif } @@ -102,7 +113,7 @@ void BgMoriHashigo_InitCollider(BgMoriHashigo* this, PlayState* play) { s32 pad; Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderItems); + Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderElements); this->collider.elements[0].dim.worldSphere.center.x = (s16)this->dyna.actor.world.pos.x; this->collider.elements[0].dim.worldSphere.center.y = (s16)this->dyna.actor.world.pos.y + 21; @@ -129,9 +140,8 @@ s32 BgMoriHashigo_SpawnLadder(BgMoriHashigo* this, PlayState* play) { if (ladder != NULL) { return true; } else { - // "Ladder failure" - PRINTF("Error : 梯子の発生失敗(%s %d)(arg_data 0x%04x)\n", "../z_bg_mori_hashigo.c", 220, - this->dyna.actor.params); + PRINTF("Error : " T("梯子の発生失敗", "Ladder spawn failure") "(%s %d)(arg_data 0x%04x)\n", + "../z_bg_mori_hashigo.c", 220, this->dyna.actor.params); return false; } } @@ -171,14 +181,13 @@ void BgMoriHashigo_Init(Actor* thisx, PlayState* play) { } this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX); if (this->moriTexObjectSlot < 0) { - // "Bank danger!" - PRINTF("Error : バンク危険!(arg_data 0x%04x)(%s %d)\n", this->dyna.actor.params, "../z_bg_mori_hashigo.c", - 312); + PRINTF("Error : " T("バンク危険!", "Bank danger!") "(arg_data 0x%04x)(%s %d)\n", this->dyna.actor.params, + "../z_bg_mori_hashigo.c", 312); Actor_Kill(&this->dyna.actor); } else { BgMoriHashigo_SetupWaitForMoriTex(this); - // "(Forest Temple Ladder and its clasp)" - PRINTF("(森の神殿 梯子とその留め金)(arg_data 0x%04x)\n", this->dyna.actor.params); + PRINTF(T("(森の神殿 梯子とその留め金)", "(Forest Temple Ladder and its clasp)") "(arg_data 0x%04x)\n", + this->dyna.actor.params); } } diff --git a/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.h b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.h index 4e6e93a5de..e14aec45e1 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.h +++ b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.h @@ -2,16 +2,16 @@ #define Z_BG_MORI_HASHIGO_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgMoriHashigo; -typedef void (*BgMoriHashigoActionFunc)(struct BgMoriHashigo*, PlayState*); +typedef void (*BgMoriHashigoActionFunc)(struct BgMoriHashigo*, struct PlayState*); typedef struct BgMoriHashigo { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ ColliderJntSph collider; - /* 0x0184 */ ColliderJntSphElement colliderItems[1]; + /* 0x0184 */ ColliderJntSphElement colliderElements[1]; /* 0x01C4 */ BgMoriHashigoActionFunc actionFunc; /* 0x01C8 */ s16 hitTimer; /* 0x01CA */ s16 bounceCounter; diff --git a/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c b/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c index c5f634640e..21b561a770 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c @@ -5,6 +5,18 @@ */ #include "z_bg_mori_hashira4.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" + #include "assets/objects/object_mori_objects/object_mori_objects.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -60,9 +72,9 @@ void BgMoriHashira4_InitDynaPoly(BgMoriHashira4* this, PlayState* play, Collisio if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; - // "Warning : move BG login failed" - PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_mori_hashira4.c", 155, - this->dyna.actor.id, this->dyna.actor.params); + PRINTF(T("Warning : move BG 登録失敗", + "Warning : move BG registration failed") "(%s %d)(name %d)(arg_data 0x%04x)\n", + "../z_bg_mori_hashira4.c", 155, this->dyna.actor.id, this->dyna.actor.params); } #endif } @@ -83,9 +95,8 @@ void BgMoriHashira4_Init(Actor* thisx, PlayState* play) { this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX); if (this->moriTexObjectSlot < 0) { Actor_Kill(&this->dyna.actor); - // "Bank danger!" - PRINTF("Error : バンク危険!(arg_data 0x%04x)(%s %d)\n", this->dyna.actor.params, "../z_bg_mori_hashira4.c", - 196); + PRINTF("Error : " T("バンク危険!", "Bank danger!") "(arg_data 0x%04x)(%s %d)\n", this->dyna.actor.params, + "../z_bg_mori_hashira4.c", 196); return; } if ((this->dyna.actor.params != 0) && Flags_GetSwitch(play, this->switchFlag)) { @@ -94,8 +105,7 @@ void BgMoriHashira4_Init(Actor* thisx, PlayState* play) { } Actor_SetFocus(&this->dyna.actor, 50.0f); BgMoriHashira4_SetupWaitForMoriTex(this); - // "(4 pillars of the Forest Temple) Bank danger" - PRINTF("(森の神殿 4本柱)(arg_data 0x%04x)\n", this->dyna.actor.params); + PRINTF(T("(森の神殿 4本柱)", "Forest Temple 4 Pillars") "(arg_data 0x%04x)\n", this->dyna.actor.params); sUnkTimer = 0; } diff --git a/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.h b/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.h index a36a6ef36b..e4ab5a2d85 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.h +++ b/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.h @@ -2,11 +2,11 @@ #define Z_BG_MORI_HASHIRA4_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgMoriHashira4; -typedef void (*BgMoriHashira4ActionFunc)(struct BgMoriHashira4*, PlayState*); +typedef void (*BgMoriHashira4ActionFunc)(struct BgMoriHashira4*, struct PlayState*); typedef struct BgMoriHashira4 { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c index 70e60eacf4..92fc3c57a8 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c @@ -5,7 +5,19 @@ */ #include "z_bg_mori_hineri.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "sfx.h" +#include "sys_matrix.h" #include "versions.h" +#include "z_lib.h" +#include "z64curve.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_box/object_box.h" #include "assets/objects/object_mori_hineri1/object_mori_hineri1.h" diff --git a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.h b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.h index 468bb29656..b9a29df504 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.h +++ b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.h @@ -2,14 +2,14 @@ #define Z_BG_MORI_HINERI_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgMoriHineri; // Due to a unique access pattern, this param cannot use the generic "PARAMS_GET_U" macros #define TWISTED_HALLWAY_GET_PARAM_15(thisx) (((thisx)->params & (NBITS_TO_MASK(1) << (15))) >> ((15) - (1))) -typedef void (*BgMoriHineriActionFunc)(struct BgMoriHineri*, PlayState*); +typedef void (*BgMoriHineriActionFunc)(struct BgMoriHineri*, struct PlayState*); typedef struct BgMoriHineri { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c b/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c index 9af9f14f2f..eaeb6afc3e 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c +++ b/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c @@ -5,6 +5,17 @@ */ #include "z_bg_mori_idomizu.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" + #include "assets/objects/object_mori_objects/object_mori_objects.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) @@ -69,16 +80,15 @@ void BgMoriIdomizu_Init(Actor* thisx, PlayState* play) { this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX); if (this->moriTexObjectSlot < 0) { Actor_Kill(&this->actor); - // "Bank danger!" - PRINTF("Error : バンク危険!(arg_data 0x%04x)(%s %d)\n", this->actor.params, "../z_bg_mori_idomizu.c", 202); + PRINTF("Error : " T("バンク危険!", "Bank danger!") "(arg_data 0x%04x)(%s %d)\n", this->actor.params, + "../z_bg_mori_idomizu.c", 202); return; } BgMoriIdomizu_SetupWaitForMoriTex(this); sIsSpawned = true; this->isLoaded = true; this->actor.room = -1; - // "Forest Temple well water" - PRINTF("(森の神殿 井戸水)(arg_data 0x%04x)\n", this->actor.params); + PRINTF(T("(森の神殿 井戸水)", "(Forest Temple well water)") "(arg_data 0x%04x)\n", this->actor.params); } void BgMoriIdomizu_Destroy(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.h b/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.h index 3e7036ec4b..4348622425 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.h +++ b/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.h @@ -2,11 +2,11 @@ #define Z_BG_MORI_IDOMIZU_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgMoriIdomizu; -typedef void (*BgMoriIdomizuActionFunc)(struct BgMoriIdomizu*, PlayState*); +typedef void (*BgMoriIdomizuActionFunc)(struct BgMoriIdomizu*, struct PlayState*); typedef struct BgMoriIdomizu { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c b/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c index 910a2bd285..c47a01879f 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c +++ b/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c @@ -5,6 +5,18 @@ */ #include "z_bg_mori_kaitenkabe.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_mori_objects/object_mori_objects.h" #define FLAGS 0 @@ -50,8 +62,9 @@ void BgMoriKaitenkabe_Init(Actor* thisx, PlayState* play) { BgMoriKaitenkabe* this = (BgMoriKaitenkabe*)thisx; CollisionHeader* colHeader = NULL; - // "Forest Temple object 【Rotating Wall (arg_data: 0x% 04x)】 appears" - PRINTF("◯◯◯森の神殿オブジェクト【回転壁(arg_data : 0x%04x)】出現 \n", this->dyna.actor.params); + PRINTF(T("◯◯◯森の神殿オブジェクト【回転壁(arg_data : 0x%04x)】出現 \n", + "◯◯◯Forest Temple object [Rotating wall(arg_data : 0x%04x)] appears \n"), + this->dyna.actor.params); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&gMoriKaitenkabeCol, &colHeader); @@ -59,8 +72,8 @@ void BgMoriKaitenkabe_Init(Actor* thisx, PlayState* play) { this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX); if (this->moriTexObjectSlot < 0) { Actor_Kill(&this->dyna.actor); - // "【Rotating wall】 Bank danger!" - PRINTF("【回転壁】 バンク危険!(%s %d)\n", "../z_bg_mori_kaitenkabe.c", 176); + PRINTF(T("【回転壁】 バンク危険!(%s %d)\n", "[Rotating wall] Bank danger! (%s %d)\n"), + "../z_bg_mori_kaitenkabe.c", 176); } else { this->actionFunc = BgMoriKaitenkabe_WaitForMoriTex; } diff --git a/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.h b/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.h index 7bd6939d3f..91c0d65a80 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.h +++ b/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.h @@ -2,11 +2,11 @@ #define Z_BG_MORI_KAITENKABE_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgMoriKaitenkabe; -typedef void (*BgMoriKaitenkabeActionFunc)(struct BgMoriKaitenkabe*, PlayState*); +typedef void (*BgMoriKaitenkabeActionFunc)(struct BgMoriKaitenkabe*, struct PlayState*); typedef struct BgMoriKaitenkabe { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c index 61bbf6b9ef..dccddcf49a 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c +++ b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c @@ -5,8 +5,22 @@ */ #include "z_bg_mori_rakkatenjo.h" -#include "assets/objects/object_mori_objects/object_mori_objects.h" + +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" #include "quake.h" +#include "rumble.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" + +#include "assets/objects/object_mori_objects/object_mori_objects.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) @@ -54,24 +68,25 @@ void BgMoriRakkatenjo_Init(Actor* thisx, PlayState* play) { DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); #if DEBUG_FEATURES - // "Forest Temple obj. Falling Ceiling" - PRINTF("森の神殿 obj. 落下天井 (home posY %f)\n", this->dyna.actor.home.pos.y); + PRINTF(T("森の神殿 obj. 落下天井", "Forest Temple obj. Falling Ceiling") " (home posY %f)\n", + this->dyna.actor.home.pos.y); if ((fabsf(1991.0f - this->dyna.actor.home.pos.x) > 0.001f) || (fabsf(683.0f - this->dyna.actor.home.pos.y) > 0.001f) || (fabsf(-2520.0f - this->dyna.actor.home.pos.z) > 0.001f)) { - // "The set position has been changed. Let's fix the program." - PRINTF("Warning : セット位置が変更されています。プログラムを修正しましょう。\n"); + PRINTF(T("Warning : セット位置が変更されています。プログラムを修正しましょう。\n", + "Warning : The set position has been changed. Let's fix the program.\n")); } if (this->dyna.actor.home.rot.y != 0x8000) { - // "The set Angle has changed. Let's fix the program." - PRINTF("Warning : セット Angle が変更されています。プログラムを修正しましょう。\n"); + PRINTF(T("Warning : セット Angle が変更されています。プログラムを修正しましょう。\n", + "Warning : The set Angle has changed. Let's fix the program.\n")); } #endif this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX); if (this->moriTexObjectSlot < 0) { - // "Forest Temple obj Falling Ceiling Bank Danger!" - PRINTF("Error : 森の神殿 obj 落下天井 バンク危険!(%s %d)\n", "../z_bg_mori_rakkatenjo.c", 205); + PRINTF(T("Error : 森の神殿 obj 落下天井 バンク危険!(%s %d)\n", + "Error : Forest Temple obj Falling Ceiling Bank danger! (%s %d)\n"), + "../z_bg_mori_rakkatenjo.c", 205); Actor_Kill(&this->dyna.actor); return; } diff --git a/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.h b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.h index 97bdbc0bfd..657baefc53 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.h +++ b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.h @@ -2,11 +2,11 @@ #define Z_BG_MORI_RAKKATENJO_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgMoriRakkatenjo; -typedef void (*BgMoriRakkatenjoActionFunction)(struct BgMoriRakkatenjo*, PlayState*); +typedef void (*BgMoriRakkatenjoActionFunction)(struct BgMoriRakkatenjo*, struct PlayState*); typedef struct BgMoriRakkatenjo { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c b/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c index 7199ec25b5..eda5a530eb 100644 --- a/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c +++ b/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c @@ -5,6 +5,21 @@ */ #include "z_bg_po_event.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "rand.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_po_sisters/object_po_sisters.h" #define FLAGS 0 @@ -202,7 +217,7 @@ void BgPoEvent_Init(Actor* thisx, PlayState* play) { if (this->type >= 2) { Collider_InitTris(play, &this->collider); - Collider_SetTris(play, &this->collider, thisx, &sTrisInit, this->colliderItems); + Collider_SetTris(play, &this->collider, thisx, &sTrisInit, this->colliderElements); if (Flags_GetSwitch(play, thisx->params)) { Actor_Kill(thisx); } else { diff --git a/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.h b/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.h index 412c187227..78fe7fc966 100644 --- a/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.h +++ b/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.h @@ -2,11 +2,11 @@ #define Z_BG_PO_EVENT_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgPoEvent; -typedef void (*BgPoEventActionFunc)(struct BgPoEvent*, PlayState*); +typedef void (*BgPoEventActionFunc)(struct BgPoEvent*, struct PlayState*); typedef struct BgPoEvent { /* 0x0000 */ DynaPolyActor dyna; @@ -16,7 +16,7 @@ typedef struct BgPoEvent { /* 0x016A */ s8 direction; /* 0x016C */ s16 timer; /* 0x0170 */ ColliderTris collider; - /* 0x0190 */ ColliderTrisElement colliderItems[2]; + /* 0x0190 */ ColliderTrisElement colliderElements[2]; } BgPoEvent; // size = 0x0248 #endif diff --git a/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c b/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c index 9dae9b2a5d..e5b8edea9d 100644 --- a/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c +++ b/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c @@ -5,6 +5,16 @@ */ #include "z_bg_po_syokudai.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z64light.h" +#include "z64play.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_syokudai/object_syokudai.h" diff --git a/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.h b/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.h index 8bb84f0fe5..a6186dcbe7 100644 --- a/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.h +++ b/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.h @@ -2,7 +2,8 @@ #define Z_BG_PO_SYOKUDAI_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" +#include "z64light.h" struct BgPoSyokudai; diff --git a/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.c b/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.c index 7d9ef63e60..3392a15f60 100644 --- a/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.c +++ b/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.c @@ -5,6 +5,14 @@ */ #include "z_bg_pushbox.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" + #include "assets/objects/object_pu_box/object_pu_box.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.h b/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.h index 577ebaabb6..38cd6857d9 100644 --- a/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.h +++ b/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.h @@ -2,11 +2,11 @@ #define Z_BG_PUSHBOX_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgPushbox; -typedef void (*BgPushboxActionFunc)(struct BgPushbox*, PlayState*); +typedef void (*BgPushboxActionFunc)(struct BgPushbox*, struct PlayState*); typedef struct BgPushbox { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c b/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c index f6dfcc3d37..37591ae020 100644 --- a/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c +++ b/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c @@ -5,6 +5,17 @@ */ #include "z_bg_relay_objects.h" + +#include "ichain.h" +#include "rumble.h" +#include "sfx.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64cutscene_flags.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_relay_objects/object_relay_objects.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.h b/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.h index 802d840649..25db5cc5f6 100644 --- a/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.h +++ b/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.h @@ -2,11 +2,11 @@ #define Z_BG_RELAY_OBJECTS_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgRelayObjects; -typedef void (*BgRelayObjectsActionFunc)(struct BgRelayObjects*, PlayState*); +typedef void (*BgRelayObjectsActionFunc)(struct BgRelayObjects*, struct PlayState*); typedef struct BgRelayObjects { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.c b/src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.c index 3eb461a52f..4a3a760d92 100644 --- a/src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.c +++ b/src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.c @@ -5,6 +5,11 @@ */ #include "z_bg_spot00_break.h" + +#include "ichain.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_spot00_break/object_spot00_break.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.h b/src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.h index de282476d9..17e45aa918 100644 --- a/src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.h +++ b/src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.h @@ -2,7 +2,7 @@ #define Z_BG_SPOT00_BREAK_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgSpot00Break; diff --git a/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c b/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c index c60865af16..c305635b83 100644 --- a/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c +++ b/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c @@ -5,8 +5,22 @@ */ #include "z_bg_spot00_hanebasi.h" -#include "assets/objects/object_spot00_objects/object_spot00_objects.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64cutscene_flags.h" +#include "z64light.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" +#include "assets/objects/object_spot00_objects/object_spot00_objects.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.h b/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.h index fc6427ae82..7780bea692 100644 --- a/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.h +++ b/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.h @@ -2,11 +2,12 @@ #define Z_BG_SPOT00_HANEBASI_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" +#include "z64light.h" struct BgSpot00Hanebasi; -typedef void (*BgSpot00HanebasiActionFunc)(struct BgSpot00Hanebasi*, PlayState*); +typedef void (*BgSpot00HanebasiActionFunc)(struct BgSpot00Hanebasi*, struct PlayState*); typedef struct BgSpot00Hanebasi { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c b/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c index d8b3cfaba7..413e0a49e0 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c +++ b/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c @@ -5,6 +5,17 @@ */ #include "z_bg_spot01_fusya.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_spot01_objects/object_spot01_objects.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -64,7 +75,7 @@ void func_808AAA50(BgSpot01Fusya* this, PlayState* play) { } thisx->shape.rot.z += this->unk_154; temp = ((this->unk_154 - 100.0f) / 1700.0f) + 1.0f; - func_800F436C(&thisx->projectedPos, 0x2085, temp); + func_800F436C(&thisx->projectedPos, NA_SE_EV_WINDMILL_LEVEL - SFX_FLAG, temp); Math_ApproachF(&this->unk_154, this->unk_158, this->unk_15C, 100.0f); } diff --git a/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.h b/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.h index 1e7a831316..e232c6a907 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.h +++ b/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.h @@ -2,11 +2,11 @@ #define Z_BG_SPOT01_FUSYA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgSpot01Fusya; -typedef void (*BgSpot01FusyaActionFunc)(struct BgSpot01Fusya*, PlayState*); +typedef void (*BgSpot01FusyaActionFunc)(struct BgSpot01Fusya*, struct PlayState*); typedef struct BgSpot01Fusya { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c b/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c index ba1ff57d87..e43acd7a1d 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c +++ b/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c @@ -5,8 +5,22 @@ */ #include "z_bg_spot01_idohashira.h" -#include "assets/objects/object_spot01_objects/object_spot01_objects.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "regs.h" +#include "sfx.h" +#include "sys_matrix.h" #include "terminal.h" +#include "translation.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64save.h" + +#include "assets/objects/object_spot01_objects/object_spot01_objects.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -179,7 +193,8 @@ f32 func_808AB1DC(f32 arg0, f32 arg1, u16 arg2, u16 arg3, u16 arg4) { temp_f12 = regFloat * diff43; return (((((arg1 - arg0) - temp_f12) / SQ(diff23)) * diff43) * diff43) + temp_f12; } - PRINTF(VT_FGCOL(RED) "Bg_Spot01_Idohashira_Get_FreeFallで割り算出来ない!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("Bg_Spot01_Idohashira_Get_FreeFallで割り算出来ない!!!!!!!!!!!!!!\n", + "Bg_Spot01_Idohashira_Get_FreeFall Cannot divide by!!!!!!!!!!!!!!\n") VT_RST); return 0.0f; } @@ -254,7 +269,8 @@ void func_808AB444(BgSpot01Idohashira* this, PlayState* play) { Actor_Kill(&this->dyna.actor); break; default: - PRINTF("Bg_Spot01_Idohashira_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); + PRINTF(T("Bg_Spot01_Idohashira_Check_DemoMode:そんな動作は無い!!!!!!!!\n", + "Bg_Spot01_Idohashira_Check_DemoMode: There is no such action!!!!!!!!\n")); } this->cueId = nextCueId; @@ -284,7 +300,8 @@ void BgSpot01Idohashira_Update(Actor* thisx, PlayState* play) { BgSpot01Idohashira* this = (BgSpot01Idohashira*)thisx; if (this->action < 0 || this->action >= 4 || sActionFuncs[this->action] == NULL) { - PRINTF(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The main mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } sActionFuncs[this->action](this, play); @@ -335,7 +352,8 @@ void BgSpot01Idohashira_Draw(Actor* thisx, PlayState* play) { BgSpot01Idohashira* this = (BgSpot01Idohashira*)thisx; if (this->drawConfig < 0 || this->drawConfig > 0 || sDrawFuncs[this->drawConfig] == NULL) { - PRINTF(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The drawing mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } sDrawFuncs[this->drawConfig](this, play); diff --git a/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.h b/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.h index ae456de8fb..8d177d3317 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.h +++ b/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.h @@ -2,12 +2,12 @@ #define Z_BG_SPOT01_IDOHASHIRA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgSpot01Idohashira; -typedef void (*BgSpot01IdohashiraActionFunc)(struct BgSpot01Idohashira*, PlayState*); -typedef void (*BgSpot01IdohashiraDrawFunc)(struct BgSpot01Idohashira*, PlayState*); +typedef void (*BgSpot01IdohashiraActionFunc)(struct BgSpot01Idohashira*, struct PlayState*); +typedef void (*BgSpot01IdohashiraDrawFunc)(struct BgSpot01Idohashira*, struct PlayState*); typedef struct BgSpot01Idohashira { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c b/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c index f2c89a41de..5329d2e0f6 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c +++ b/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c @@ -5,6 +5,16 @@ */ #include "z_bg_spot01_idomizu.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_spot01_objects/object_spot01_objects.h" #define FLAGS ACTOR_FLAG_DRAW_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.h b/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.h index 3c5929714a..3d4ff68a6f 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.h +++ b/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.h @@ -2,11 +2,11 @@ #define Z_BG_SPOT01_IDOMIZU_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgSpot01Idomizu; -typedef void (*BgSpot01IdomizuActionFunc)(struct BgSpot01Idomizu*, PlayState*); +typedef void (*BgSpot01IdomizuActionFunc)(struct BgSpot01Idomizu*, struct PlayState*); typedef struct BgSpot01Idomizu { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.c b/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.c index 1bad86dd46..6dbdd910d5 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.c +++ b/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.c @@ -5,6 +5,14 @@ */ #include "z_bg_spot01_idosoko.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sys_matrix.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_spot01_matoya/object_spot01_matoya.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.h b/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.h index c17b0a43ed..44981abc07 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.h +++ b/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.h @@ -2,11 +2,11 @@ #define Z_BG_SPOT01_IDOSOKO_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgSpot01Idosoko; -typedef void (*BgSpot01IdosokoActionFunc)(struct BgSpot01Idosoko*, PlayState*); +typedef void (*BgSpot01IdosokoActionFunc)(struct BgSpot01Idosoko*, struct PlayState*); typedef struct BgSpot01Idosoko { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c b/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c index 2ee4c58283..af7dec9c5d 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c +++ b/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c @@ -5,6 +5,14 @@ */ #include "z_bg_spot01_objects2.h" + +#include "ichain.h" +#include "printf.h" +#include "segmented_address.h" +#include "translation.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_spot01_matoya/object_spot01_matoya.h" #include "assets/objects/object_spot01_matoyab/object_spot01_matoyab.h" @@ -61,8 +69,8 @@ void BgSpot01Objects2_Init(Actor* thisx, PlayState* play) { if (this->objectId >= 0) { this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, this->objectId); if (this->requiredObjectSlot < 0) { - // "There was no bank setting." - PRINTF("-----------------------------バンク設定ありませんでした."); + PRINTF(T("-----------------------------バンク設定ありませんでした.", + "----------------------------- There was no bank setting.")); Actor_Kill(&this->dyna.actor); return; } @@ -92,9 +100,8 @@ void func_808AC2BC(BgSpot01Objects2* this, PlayState* play) { Vec3f position; if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { - // "---- Successful bank switching!!" - PRINTF("-----バンク切り換え成功!!\n"); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); + PRINTF(T("-----バンク切り換え成功!!\n", "----- Successful bank switching!!\n")); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); this->dyna.actor.objectSlot = this->requiredObjectSlot; DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); diff --git a/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.h b/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.h index d1d96d045b..7ffc3094fe 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.h +++ b/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.h @@ -2,11 +2,11 @@ #define Z_BG_SPOT01_OBJECTS2_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgSpot01Objects2; -typedef void (*BgSpot01Objects2ActionFunc)(struct BgSpot01Objects2*, PlayState*); +typedef void (*BgSpot01Objects2ActionFunc)(struct BgSpot01Objects2*, struct PlayState*); typedef struct BgSpot01Objects2 { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c b/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c index a0d74b4eda..795df90151 100644 --- a/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c +++ b/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c @@ -5,6 +5,20 @@ */ #include "z_bg_spot02_objects.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_spot02_objects/object_spot02_objects.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.h b/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.h index 873fe15a52..42d4e45b08 100644 --- a/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.h +++ b/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.h @@ -2,11 +2,11 @@ #define Z_BG_SPOT02_OBJECTS_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgSpot02Objects; -typedef void (*BgSpot02ObjectsActionFunc)(struct BgSpot02Objects*, PlayState*); +typedef void (*BgSpot02ObjectsActionFunc)(struct BgSpot02Objects*, struct PlayState*); typedef struct BgSpot02Objects { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c b/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c index fccae09ba4..501a677359 100644 --- a/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c +++ b/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c @@ -5,6 +5,16 @@ */ #include "z_bg_spot03_taki.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "segmented_address.h" +#include "sys_matrix.h" +#include "z64audio.h" +#include "z64play.h" + #include "assets/objects/object_spot03_object/object_spot03_object.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.h b/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.h index f6e3daab16..45ad4de4f2 100644 --- a/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.h +++ b/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.h @@ -2,7 +2,7 @@ #define Z_BG_SPOT03_TAKI_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" typedef enum BgSpot03TakiState { WATERFALL_CLOSED, @@ -14,7 +14,7 @@ typedef enum BgSpot03TakiState { struct BgSpot03Taki; -typedef void (*BgSpot03TakiActionFunc)(struct BgSpot03Taki*, PlayState*); +typedef void (*BgSpot03TakiActionFunc)(struct BgSpot03Taki*, struct PlayState*); typedef struct BgSpot03Taki { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.c b/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.c index 93c30e65af..edb253568d 100644 --- a/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.c +++ b/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.c @@ -5,6 +5,14 @@ */ #include "z_bg_spot05_soko.h" + +#include "ichain.h" +#include "one_point_cutscene.h" +#include "sfx.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_spot05_objects/object_spot05_objects.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.h b/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.h index 849e5b2263..1aae818797 100644 --- a/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.h +++ b/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.h @@ -2,11 +2,11 @@ #define Z_BG_SPOT05_SOKO_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgSpot05Soko; -typedef void (*BgSpot05SokoActionFunc)(struct BgSpot05Soko*, PlayState*); +typedef void (*BgSpot05SokoActionFunc)(struct BgSpot05Soko*, struct PlayState*); typedef struct BgSpot05Soko { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c index d06e292e12..7c6c943aa7 100644 --- a/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c +++ b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c @@ -5,6 +5,20 @@ */ #include "z_bg_spot06_objects.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "rand.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_spot06_objects/object_spot06_objects.h" #define FLAGS ACTOR_FLAG_HOOKSHOT_PULLS_ACTOR @@ -56,7 +70,7 @@ ActorProfile Bg_Spot06_Objects_Profile = { /**/ BgSpot06Objects_Draw, }; -static ColliderJntSphElementInit sJntSphItemsInit[1] = { +static ColliderJntSphElementInit sJntSphElementsInit[1] = { { { ELEM_MATERIAL_UNK0, @@ -80,7 +94,7 @@ static ColliderJntSphInit sJntSphInit = { COLSHAPE_JNTSPH, }, 1, - sJntSphItemsInit, + sJntSphElementsInit, }; static InitChainEntry sInitChain[] = { @@ -121,7 +135,7 @@ void BgSpot06Objects_Init(Actor* thisx, PlayState* play) { case LHO_WATER_TEMPLE_ENTRANCE_LOCK: Actor_ProcessInitChain(thisx, sInitChain); Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, thisx, &sJntSphInit, this->colliderItem); + Collider_SetJntSph(play, &this->collider, thisx, &sJntSphInit, this->colliderElements); if (LINK_IS_ADULT && Flags_GetSwitch(play, this->switchFlag)) { if (!GET_EVENTCHKINF(EVENTCHKINF_RESTORED_LAKE_HYLIA)) { diff --git a/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.h b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.h index 08fdf1e9af..cbdc1054f8 100644 --- a/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.h +++ b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.h @@ -2,11 +2,11 @@ #define Z_BG_SPOT06_OBJECTS_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgSpot06Objects; -typedef void (*BgSpot06ObjectsActionFunc)(struct BgSpot06Objects*, PlayState*); +typedef void (*BgSpot06ObjectsActionFunc)(struct BgSpot06Objects*, struct PlayState*); typedef struct BgSpot06Objects { /* 0x0000 */ DynaPolyActor dyna; @@ -15,7 +15,7 @@ typedef struct BgSpot06Objects { /* 0x016A */ s16 timer; /* 0x016C */ f32 lakeHyliaWaterLevel; /* 0x0170 */ ColliderJntSph collider; - /* 0x0190 */ ColliderJntSphElement colliderItem[1]; + /* 0x0190 */ ColliderJntSphElement colliderElements[1]; } BgSpot06Objects; // size = 0x01D0 #endif diff --git a/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.c b/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.c index 04d06a57a5..afb9d02972 100644 --- a/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.c +++ b/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.c @@ -5,7 +5,15 @@ */ #include "z_bg_spot07_taki.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sys_matrix.h" #include "versions.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_spot07_object/object_spot07_object.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.h b/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.h index dcf6ef8edc..30872233ad 100644 --- a/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.h +++ b/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.h @@ -2,11 +2,11 @@ #define Z_BG_SPOT07_TAKI_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgSpot07Taki; -typedef void (*BgSpot07TakiActionFunc)(struct BgSpot07Taki*, PlayState*); +typedef void (*BgSpot07TakiActionFunc)(struct BgSpot07Taki*, struct PlayState*); typedef struct BgSpot07Taki { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c b/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c index 7d44d616d2..aa8d28b960 100644 --- a/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c +++ b/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c @@ -5,9 +5,18 @@ */ #include "z_bg_spot08_bakudankabe.h" -#include "assets/objects/object_spot08_obj/object_spot08_obj.h" #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" + +#include "libc64/qrand.h" +#include "array_count.h" +#include "ichain.h" +#include "sfx.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/gameplay_field_keep/gameplay_field_keep.h" +#include "assets/objects/object_spot08_obj/object_spot08_obj.h" #define FLAGS ACTOR_FLAG_IGNORE_POINT_LIGHTS @@ -97,7 +106,7 @@ void func_808B02D0(BgSpot08Bakudankabe* this, PlayState* play) { s32 pad; Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderItems); + Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderElements); } void func_808B0324(BgSpot08Bakudankabe* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.h b/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.h index 3be139505d..a0436ea9ea 100644 --- a/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.h +++ b/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.h @@ -2,14 +2,14 @@ #define Z_BG_SPOT08_BAKUDANKABE_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgSpot08Bakudankabe; typedef struct BgSpot08Bakudankabe { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ ColliderJntSph collider; - /* 0x0184 */ ColliderJntSphElement colliderItems[3]; + /* 0x0184 */ ColliderJntSphElement colliderElements[3]; } BgSpot08Bakudankabe; // size = 0x0244 #endif diff --git a/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c b/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c index 6ac2bd0fd7..17d9385b00 100644 --- a/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c +++ b/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c @@ -9,11 +9,14 @@ #include "libc64/math64.h" #include "libc64/qrand.h" #include "ichain.h" +#include "printf.h" #include "sys_math3d.h" #include "sys_matrix.h" +#include "translation.h" #include "z_lib.h" #include "z64play.h" #include "z64player.h" +#include "z64save.h" #include "assets/objects/object_spot08_obj/object_spot08_obj.h" @@ -60,9 +63,9 @@ void BgSpot08Iceblock_InitDynaPoly(BgSpot08Iceblock* this, PlayState* play, Coll if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; - // "Warning: move BG registration failed" - PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot08_iceblock.c", 0xD9, - this->dyna.actor.id, this->dyna.actor.params); + PRINTF(T("Warning : move BG 登録失敗", + "Warning : move BG registration failed") "(%s %d)(name %d)(arg_data 0x%04x)\n", + "../z_bg_spot08_iceblock.c", 0xD9, this->dyna.actor.id, this->dyna.actor.params); } #endif } @@ -74,9 +77,9 @@ void BgSpot08Iceblock_CheckParams(BgSpot08Iceblock* this) { this->dyna.actor.params = 0x10; break; default: - // "Error: arg_data setting error" - PRINTF("Error : arg_data 設定ミスです。(%s %d)(arg_data 0x%04x)\n", "../z_bg_spot08_iceblock.c", 0xF6, - this->dyna.actor.params); + PRINTF( + T("Error : arg_data 設定ミスです。", "Error : arg_data setting error. ") "(%s %d)(arg_data 0x%04x)\n", + "../z_bg_spot08_iceblock.c", 0xF6, this->dyna.actor.params); this->dyna.actor.params = 0x10; break; case 1: @@ -297,8 +300,7 @@ void BgSpot08Iceblock_Init(Actor* thisx, PlayState* play) { BgSpot08Iceblock* this = (BgSpot08Iceblock*)thisx; CollisionHeader* colHeader; - // "spot08 ice floe" - PRINTF("(spot08 流氷)(arg_data 0x%04x)\n", this->dyna.actor.params); + PRINTF("(spot08 " T("流氷", "ice floe") ")(arg_data 0x%04x)\n", this->dyna.actor.params); BgSpot08Iceblock_CheckParams(this); switch (PARAMS_GET_NOSHIFT(this->dyna.actor.params, 9, 1)) { diff --git a/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c b/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c index 00ca47644f..57b76c4147 100644 --- a/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c +++ b/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c @@ -5,6 +5,17 @@ */ #include "z_bg_spot09_obj.h" + +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "sys_matrix.h" +#include "translation.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_spot09_obj/object_spot09_obj.h" #define FLAGS 0 @@ -137,12 +148,13 @@ s32 func_808B1D44(BgSpot09Obj* this, PlayState* play) { void BgSpot09Obj_Init(Actor* thisx, PlayState* play) { BgSpot09Obj* this = (BgSpot09Obj*)thisx; - PRINTF("Spot09 Object [arg_data : 0x%04x](大工救出フラグ 0x%x)\n", this->dyna.actor.params, - GET_EVENTCHKINF_CARPENTERS_RESCUED_FLAGS()); + PRINTF("Spot09 Object [arg_data : 0x%04x](" T("大工救出フラグ", "Carpenter Rescue Flag") " 0x%x)\n", + this->dyna.actor.params, GET_EVENTCHKINF_CARPENTERS_RESCUED_FLAGS()); this->dyna.actor.params &= 0xFF; if ((this->dyna.actor.params < 0) || (this->dyna.actor.params >= 5)) { - PRINTF("Error : Spot 09 object の arg_data が判別出来ない(%s %d)(arg_data 0x%04x)\n", "../z_bg_spot09_obj.c", - 322, this->dyna.actor.params); + PRINTF(T("Error : Spot 09 object の arg_data が判別出来ない", + "Error : Spot 09 object arg_data cannot be determined") "(%s %d)(arg_data 0x%04x)\n", + "../z_bg_spot09_obj.c", 322, this->dyna.actor.params); } if (!func_808B1C70(this, play)) { diff --git a/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.h b/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.h index a09ce32eda..491d7380c2 100644 --- a/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.h +++ b/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.h @@ -2,7 +2,7 @@ #define Z_BG_SPOT09_OBJ_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgSpot09Obj; diff --git a/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c b/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c index d0568c23c8..f86d76a2fc 100644 --- a/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c +++ b/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c @@ -6,6 +6,15 @@ #include "z_bg_spot11_bakudankabe.h" #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" + +#include "libc64/qrand.h" +#include "printf.h" +#include "sfx.h" +#include "translation.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/object_spot11_obj/object_spot11_obj.h" #include "assets/objects/gameplay_field_keep/gameplay_field_keep.h" @@ -121,7 +130,7 @@ void BgSpot11Bakudankabe_Init(Actor* thisx, PlayState* play) { CollisionHeader_GetVirtual(&gDesertColossusBombableWallCol, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); Actor_SetScale(&this->dyna.actor, 1.0f); - PRINTF("(spot11 爆弾壁)(arg_data 0x%04x)\n", this->dyna.actor.params); + PRINTF("(spot11 " T("爆弾壁", "Bomb Wall") ")(arg_data 0x%04x)\n", this->dyna.actor.params); } void BgSpot11Bakudankabe_Destroy(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.h b/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.h index b18f5c084b..5dedab77d5 100644 --- a/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.h +++ b/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.h @@ -2,7 +2,7 @@ #define Z_BG_SPOT11_BAKUDANKABE_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgSpot11Bakudankabe; diff --git a/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c b/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c index 05987f0921..574c2533d0 100644 --- a/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c +++ b/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c @@ -6,6 +6,22 @@ #include "z_bg_spot11_oasis.h" #include "overlays/actors/ovl_En_Elf/z_en_elf.h" + +#include "libc64/qrand.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "sfx.h" +#include "sys_math3d.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64cutscene_flags.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_spot11_obj/object_spot11_obj.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.h b/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.h index cae716a00a..0f0ed97e6e 100644 --- a/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.h +++ b/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.h @@ -2,11 +2,11 @@ #define Z_BG_SPOT11_OASIS_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgSpot11Oasis; -typedef void (*BgSpot11OasisActionFunc)(struct BgSpot11Oasis*, PlayState*); +typedef void (*BgSpot11OasisActionFunc)(struct BgSpot11Oasis*, struct PlayState*); typedef struct BgSpot11Oasis { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c index b01eb98174..c4fc3fcdc4 100644 --- a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c +++ b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c @@ -5,8 +5,17 @@ */ #include "z_bg_spot12_gate.h" -#include "assets/objects/object_spot12_obj/object_spot12_obj.h" + +#include "ichain.h" +#include "one_point_cutscene.h" +#include "printf.h" #include "quake.h" +#include "sfx.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" + +#include "assets/objects/object_spot12_obj/object_spot12_obj.h" #define FLAGS 0 @@ -55,8 +64,9 @@ void BgSpot12Gate_InitDynaPoly(BgSpot12Gate* this, PlayState* play, CollisionHea if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; - PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot12_gate.c", 145, - this->dyna.actor.id, this->dyna.actor.params); + PRINTF(T("Warning : move BG 登録失敗", + "Warning : move BG registration failed") "(%s %d)(name %d)(arg_data 0x%04x)\n", + "../z_bg_spot12_gate.c", 145, this->dyna.actor.id, this->dyna.actor.params); } #endif } diff --git a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.h b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.h index 2e9989fc21..bb9ef25cf5 100644 --- a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.h +++ b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.h @@ -2,11 +2,11 @@ #define Z_BG_SPOT12_GATE_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgSpot12Gate; -typedef void (*BgSpot12GateActionFunc)(struct BgSpot12Gate*, PlayState*); +typedef void (*BgSpot12GateActionFunc)(struct BgSpot12Gate*, struct PlayState*); typedef struct BgSpot12Gate { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c b/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c index 7fc67b38df..f9a5253cea 100644 --- a/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c +++ b/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c @@ -5,6 +5,15 @@ */ #include "z_bg_spot12_saku.h" + +#include "ichain.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "sfx.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" + #include "assets/objects/object_spot12_obj/object_spot12_obj.h" #define FLAGS 0 @@ -52,8 +61,9 @@ void func_808B3420(BgSpot12Saku* this, PlayState* play, CollisionHeader* collisi if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; - PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot12_saku.c", 140, - this->dyna.actor.id, this->dyna.actor.params); + PRINTF(T("Warning : move BG 登録失敗", + "Warning : move BG registration failed") "(%s %d)(name %d)(arg_data 0x%04x)\n", + "../z_bg_spot12_saku.c", 140, this->dyna.actor.id, this->dyna.actor.params); } #endif } diff --git a/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.h b/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.h index d96967300c..7ed7751ede 100644 --- a/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.h +++ b/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.h @@ -2,11 +2,11 @@ #define Z_BG_SPOT12_SAKU_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgSpot12Saku; -typedef void (*BgSpot12SakuActionFunc)(struct BgSpot12Saku*, PlayState*); +typedef void (*BgSpot12SakuActionFunc)(struct BgSpot12Saku*, struct PlayState*); typedef struct BgSpot12Saku { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c b/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c index b2c8f61b80..eb89d5f06a 100644 --- a/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c +++ b/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c @@ -5,6 +5,18 @@ */ #include "z_bg_spot15_rrbox.h" + +#include "array_count.h" +#include "ichain.h" +#include "printf.h" +#include "sfx.h" +#include "sys_math3d.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_spot15_obj/object_spot15_obj.h" #define FLAGS 0 @@ -67,8 +79,9 @@ void func_808B3960(BgSpot15Rrbox* this, PlayState* play, CollisionHeader* collis if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; - PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot15_rrbox.c", 171, - this->dyna.actor.id, this->dyna.actor.params); + PRINTF(T("Warning : move BG 登録失敗", + "Warning : move BG registration failed") "(%s %d)(name %d)(arg_data 0x%04x)\n", + "../z_bg_spot15_rrbox.c", 171, this->dyna.actor.id, this->dyna.actor.params); } #endif } @@ -133,7 +146,7 @@ void BgSpot15Rrbox_Init(Actor* thisx, PlayState* play) { } else { func_808B4084(this, play); } - PRINTF("(spot15 ロンロン木箱)(arg_data 0x%04x)\n", this->dyna.actor.params); + PRINTF("(spot15 " T("ロンロン木箱", "Lon Lon Wooden Box") ")(arg_data 0x%04x)\n", this->dyna.actor.params); } void BgSpot15Rrbox_Destroy(Actor* thisx, PlayState* play) { @@ -320,9 +333,8 @@ void func_808B43D0(BgSpot15Rrbox* this, PlayState* play) { Actor_MoveXZGravity(actor); if (actor->world.pos.y <= BGCHECK_Y_MIN + 10.0f) { - // "Lon Lon wooden crate fell too much" - PRINTF("Warning : ロンロン木箱落ちすぎた(%s %d)(arg_data 0x%04x)\n", "../z_bg_spot15_rrbox.c", 599, - actor->params); + PRINTF("Warning : " T("ロンロン木箱落ちすぎた", "Lon Lon Wooden Box fell too far") "(%s %d)(arg_data 0x%04x)\n", + "../z_bg_spot15_rrbox.c", 599, actor->params); Actor_Kill(actor); diff --git a/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.h b/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.h index 745c65629f..d0534e1e73 100644 --- a/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.h +++ b/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.h @@ -2,11 +2,11 @@ #define Z_BG_SPOT15_RRBOX_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgSpot15Rrbox; -typedef void (*BgSpot15RrboxActionFunc)(struct BgSpot15Rrbox*, PlayState*); +typedef void (*BgSpot15RrboxActionFunc)(struct BgSpot15Rrbox*, struct PlayState*); typedef struct BgSpot15Rrbox { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c b/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c index ca52b057bb..c053a6c2d1 100644 --- a/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c +++ b/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c @@ -5,6 +5,14 @@ */ #include "z_bg_spot15_saku.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_spot15_obj/object_spot15_obj.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.h b/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.h index f7ac8d09ca..35fcbee90e 100644 --- a/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.h +++ b/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.h @@ -2,11 +2,11 @@ #define Z_BG_SPOT15_SAKU_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgSpot15Saku; -typedef void (*BgSpot15SakuActionFunc)(struct BgSpot15Saku*, PlayState*); +typedef void (*BgSpot15SakuActionFunc)(struct BgSpot15Saku*, struct PlayState*); typedef struct BgSpot15Saku { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c index f7ba17ed02..759d2184e3 100644 --- a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c +++ b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c @@ -1,9 +1,28 @@ #include "z_bg_spot16_bombstone.h" -#include "assets/objects/object_spot16_obj/object_spot16_obj.h" -#include "assets/objects/object_bombiwa/object_bombiwa.h" #include "overlays/actors/ovl_En_Bombf/z_en_bombf.h" #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" +#include "libc64/qrand.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "regs.h" +#include "sfx.h" +#include "sys_math3d.h" +#include "sys_matrix.h" +#include "translation.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/object_spot16_obj/object_spot16_obj.h" +#include "assets/objects/object_bombiwa/object_bombiwa.h" + #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED void BgSpot16Bombstone_Init(Actor* thisx, PlayState* play); @@ -152,7 +171,7 @@ void func_808B4C4C(BgSpot16Bombstone* this, PlayState* play) { s32 pad; Collider_InitJntSph(play, &this->colliderJntSph); - Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderElements); + Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElements); this->colliderJntSph.elements[0].dim.worldSphere.center.x = this->actor.world.pos.x; this->colliderJntSph.elements[0].dim.worldSphere.center.y = this->actor.world.pos.y + 50.0f; this->colliderJntSph.elements[0].dim.worldSphere.center.z = this->actor.world.pos.z; @@ -171,7 +190,7 @@ void func_808B4D04(BgSpot16Bombstone* this, PlayState* play) { s32 func_808B4D9C(BgSpot16Bombstone* this, PlayState* play) { if (Flags_GetSwitch(play, this->switchFlag)) { - PRINTF("Spot16 obj 爆弾石 破壊済み\n"); + PRINTF(T("Spot16 obj 爆弾石 破壊済み\n", "Spot16 obj Bomb Stone destroyed\n")); return false; } Actor_ProcessInitChain(&this->actor, sInitChainBoulder); @@ -221,7 +240,8 @@ s32 func_808B4E58(BgSpot16Bombstone* this, PlayState* play) { this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_BOMBIWA); if (this->requiredObjectSlot < 0) { - PRINTF("Error : バンク危険!(arg_data 0x%04x)(%s %d)\n", actor->params, "../z_bg_spot16_bombstone.c", 589); + PRINTF("Error : " T("バンク危険!", "Bank danger! ") "(arg_data 0x%04x)(%s %d)\n", actor->params, + "../z_bg_spot16_bombstone.c", 589); return false; } @@ -253,8 +273,8 @@ void BgSpot16Bombstone_Init(Actor* thisx, PlayState* play) { #if DEBUG_FEATURES default: - PRINTF("Error : arg_data おかしいな(%s %d)(arg_data 0x%04x)\n", "../z_bg_spot16_bombstone.c", 668, - this->actor.params); + PRINTF(T("Error : arg_data おかしいな", "Error : arg_data is strange") "(%s %d)(arg_data 0x%04x)\n", + "../z_bg_spot16_bombstone.c", 668, this->actor.params); shouldLive = false; break; #endif @@ -264,7 +284,8 @@ void BgSpot16Bombstone_Init(Actor* thisx, PlayState* play) { Actor_Kill(&this->actor); return; } - PRINTF("Spot16 obj 爆弾石 (scaleX %f)(arg_data 0x%04x)\n", this->actor.scale.x, this->actor.params); + PRINTF("Spot16 obj " T("爆弾石", "Bomb Stone") " (scaleX %f)(arg_data 0x%04x)\n", this->actor.scale.x, + this->actor.params); } void BgSpot16Bombstone_Destroy(Actor* thisx, PlayState* play) { @@ -387,8 +408,8 @@ void func_808B56BC(BgSpot16Bombstone* this, PlayState* play) { player->actor.world.pos.x += sinValue * this->sinRotation; player->actor.world.pos.z += sinValue * this->cosRotation; } else { - PRINTF("Error 補正出来ない(%s %d)(arg_data 0x%04x)(hosei_angY %x)\n", "../z_bg_spot16_bombstone.c", 935, - this->actor.params, adjustedYawDiff); + PRINTF(T("Error 補正出来ない", "Error Can't correct") "(%s %d)(arg_data 0x%04x)(hosei_angY %x)\n", + "../z_bg_spot16_bombstone.c", 935, this->actor.params, adjustedYawDiff); } } } diff --git a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.h b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.h index 01fb4cc3e0..577bd3863b 100644 --- a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.h +++ b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.h @@ -2,11 +2,11 @@ #define Z_BG_SPOT16_BOMBSTONE_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgSpot16Bombstone; -typedef void (*BgSpot16BombstoneActionFunc)(struct BgSpot16Bombstone*, PlayState*); +typedef void (*BgSpot16BombstoneActionFunc)(struct BgSpot16Bombstone*, struct PlayState*); typedef struct BgSpot16Bombstone { /* 0x0000 */ Actor actor; @@ -18,7 +18,7 @@ typedef struct BgSpot16Bombstone { /* 0x015C */ f32 sinRotation; /* 0x0160 */ f32 cosRotation; /* 0x0164 */ ColliderJntSph colliderJntSph; - /* 0x0184 */ ColliderJntSphElement colliderElements[1]; + /* 0x0184 */ ColliderJntSphElement colliderJntSphElements[1]; /* 0x01C4 */ ColliderCylinder colliderCylinder; /* 0x0210 */ s16 unk_210; /* 0x0212 */ s16 unk_212; diff --git a/src/overlays/actors/ovl_Bg_Spot16_Doughnut/z_bg_spot16_doughnut.c b/src/overlays/actors/ovl_Bg_Spot16_Doughnut/z_bg_spot16_doughnut.c index b71c0fd137..3ea3dd67ad 100644 --- a/src/overlays/actors/ovl_Bg_Spot16_Doughnut/z_bg_spot16_doughnut.c +++ b/src/overlays/actors/ovl_Bg_Spot16_Doughnut/z_bg_spot16_doughnut.c @@ -5,8 +5,18 @@ */ #include "z_bg_spot16_doughnut.h" -#include "assets/objects/object_efc_doughnut/object_efc_doughnut.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "sys_matrix.h" #include "terminal.h" +#include "translation.h" +#include "z64play.h" +#include "z64save.h" + +#include "assets/objects/object_efc_doughnut/object_efc_doughnut.h" #define FLAGS 0 @@ -75,7 +85,7 @@ void BgSpot16Doughnut_Init(Actor* thisx, PlayState* play) { } else { this->fireFlag |= 1; } - PRINTF("(spot16 ドーナツ雲)(arg_data 0x%04x)\n", this->actor.params); + PRINTF(T("(spot16 ドーナツ雲)", "(spot16 Donut Cloud)") "(arg_data 0x%04x)\n", this->actor.params); } } diff --git a/src/overlays/actors/ovl_Bg_Spot16_Doughnut/z_bg_spot16_doughnut.h b/src/overlays/actors/ovl_Bg_Spot16_Doughnut/z_bg_spot16_doughnut.h index 051e45cf58..3b7008ef2d 100644 --- a/src/overlays/actors/ovl_Bg_Spot16_Doughnut/z_bg_spot16_doughnut.h +++ b/src/overlays/actors/ovl_Bg_Spot16_Doughnut/z_bg_spot16_doughnut.h @@ -2,7 +2,7 @@ #define Z_BG_SPOT16_DOUGHNUT_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgSpot16Doughnut; diff --git a/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c b/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c index c6eafbdd47..03f7b4514b 100644 --- a/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c +++ b/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c @@ -6,6 +6,17 @@ #include "z_bg_spot17_bakudankabe.h" #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/object_spot17_obj/object_spot17_obj.h" #include "assets/objects/gameplay_field_keep/gameplay_field_keep.h" diff --git a/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.h b/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.h index 8928435408..fd88416ddf 100644 --- a/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.h +++ b/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.h @@ -2,7 +2,7 @@ #define Z_BG_SPOT17_BAKUDANKABE_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgSpot17Bakudankabe; diff --git a/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c b/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c index 8ee2e9dadf..b03edd8aae 100644 --- a/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c +++ b/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c @@ -5,6 +5,15 @@ */ #include "z_bg_spot17_funen.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "sys_matrix.h" +#include "translation.h" +#include "z64play.h" + #include "assets/objects/object_spot17_obj/object_spot17_obj.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) @@ -35,7 +44,7 @@ void BgSpot17Funen_Init(Actor* thisx, PlayState* play) { BgSpot17Funen* this = (BgSpot17Funen*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - PRINTF("spot17 obj. 噴煙 (arg_data 0x%04x)\n", this->actor.params); + PRINTF("spot17 obj. " T("噴煙", "volcanic smoke") " (arg_data 0x%04x)\n", this->actor.params); } void BgSpot17Funen_Destroy(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.h b/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.h index 6a44fa14cf..737719ea28 100644 --- a/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.h +++ b/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.h @@ -2,7 +2,7 @@ #define Z_BG_SPOT17_FUNEN_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgSpot17Funen; diff --git a/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c b/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c index 566d4342b5..66d8e2d509 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c +++ b/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c @@ -1,6 +1,21 @@ #include "z_bg_spot18_basket.h" -#include "assets/objects/object_spot18_obj/object_spot18_obj.h" + +#include "libc64/qrand.h" +#include "array_count.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "sfx.h" +#include "sys_math3d.h" #include "terminal.h" +#include "translation.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64effect.h" +#include "z64play.h" + +#include "assets/objects/object_spot18_obj/object_spot18_obj.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -78,7 +93,7 @@ void func_808B7710(Actor* thisx, PlayState* play) { BgSpot18Basket* this = (BgSpot18Basket*)thisx; Collider_InitJntSph(play, &this->colliderJntSph); - Collider_SetJntSph(play, &this->colliderJntSph, &this->dyna.actor, &sJntSphInit, this->ColliderJntSphElements); + Collider_SetJntSph(play, &this->colliderJntSph, &this->dyna.actor, &sJntSphInit, this->colliderJntSphElements); this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; } @@ -156,7 +171,8 @@ void BgSpot18Basket_Init(Actor* thisx, PlayState* play) { if (this->dyna.actor.child == NULL) { PRINTF_COLOR_RED(); - PRINTF("Error : 変化壷蓋発生失敗(%s %d)\n", "../z_bg_spot18_basket.c", 351); + PRINTF(T("Error : 変化壷蓋発生失敗", "Error : Failed to generate the change pot cover") "(%s %d)\n", + "../z_bg_spot18_basket.c", 351); PRINTF_RST(); Actor_Kill(&this->dyna.actor); } diff --git a/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.h b/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.h index 21f4bc4f23..460a56fb12 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.h +++ b/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.h @@ -2,16 +2,16 @@ #define Z_BG_SPOT18_BASKET_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgSpot18Basket; -typedef void (*BgSpot18BasketActionFunc)(struct BgSpot18Basket*, PlayState*); +typedef void (*BgSpot18BasketActionFunc)(struct BgSpot18Basket*, struct PlayState*); typedef struct BgSpot18Basket { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ ColliderJntSph colliderJntSph; - /* 0x0184 */ ColliderJntSphElement ColliderJntSphElements[2]; + /* 0x0184 */ ColliderJntSphElement colliderJntSphElements[2]; /* 0x0204 */ BgSpot18BasketActionFunc actionFunc; /* 0x0208 */ f32 unk_208; /* 0x020C */ s16 unk_20C; diff --git a/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.c b/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.c index cec6266a2e..21bc50671c 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.c +++ b/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.c @@ -5,6 +5,11 @@ */ #include "z_bg_spot18_futa.h" + +#include "ichain.h" +#include "z_lib.h" +#include "z64play.h" + #include "assets/objects/object_spot18_obj/object_spot18_obj.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.h b/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.h index 1150611cd2..ff0c2cf8ac 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.h +++ b/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.h @@ -2,7 +2,7 @@ #define Z_BG_SPOT18_FUTA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgSpot18Futa; diff --git a/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c b/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c index 505797f7e9..d44a14de50 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c +++ b/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c @@ -6,6 +6,18 @@ */ #include "z_bg_spot18_obj.h" + +#include "array_count.h" +#include "ichain.h" +#include "printf.h" +#include "sfx.h" +#include "sys_math3d.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_spot18_obj/object_spot18_obj.h" #define FLAGS 0 @@ -96,8 +108,8 @@ s32 func_808B8910(BgSpot18Obj* this, PlayState* play) { } else if (LINK_AGE_IN_YEARS == YEARS_CHILD) { age = 0; } else { - PRINTF("Error : リンク年齢不詳 (%s %d)(arg_data 0x%04x)\n", "../z_bg_spot18_obj.c", 182, - this->dyna.actor.params); + PRINTF(T("Error : リンク年齢不詳", "Error : Link age unknown") " (%s %d)(arg_data 0x%04x)\n", + "../z_bg_spot18_obj.c", 182, this->dyna.actor.params); return 0; } @@ -105,16 +117,17 @@ s32 func_808B8910(BgSpot18Obj* this, PlayState* play) { case 0: case 1: if (D_808B90F0[PARAMS_GET_U(this->dyna.actor.params, 0, 4)][age] == 0) { - PRINTF("出現しない Object (0x%04x)\n", this->dyna.actor.params); + PRINTF(T("出現しない Object (0x%04x)\n", "Non-appearing Object (0x%04x)\n"), this->dyna.actor.params); } return D_808B90F0[PARAMS_GET_U(this->dyna.actor.params, 0, 4)][age]; case 2: - PRINTF("Error : Obj出現判定が設定されていない(%s %d)(arg_data 0x%04x)\n", "../z_bg_spot18_obj.c", 202, - this->dyna.actor.params); + PRINTF(T("Error : Obj出現判定が設定されていない", + "Error : Obj appearance detection is not set") "(%s %d)(arg_data 0x%04x)\n", + "../z_bg_spot18_obj.c", 202, this->dyna.actor.params); return 0; default: - PRINTF("Error : Obj出現判定失敗(%s %d)(arg_data 0x%04x)\n", "../z_bg_spot18_obj.c", 210, - this->dyna.actor.params); + PRINTF(T("Error : Obj出現判定失敗", "Error : Obj appearance check failed") "(%s %d)(arg_data 0x%04x)\n", + "../z_bg_spot18_obj.c", 210, this->dyna.actor.params); } return 0; } diff --git a/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.h b/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.h index 5e000f646d..bfa758afd7 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.h +++ b/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.h @@ -2,12 +2,12 @@ #define Z_BG_SPOT18_OBJ_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgSpot18Obj; -typedef void (*BgSpot18ObjActionFunc)(struct BgSpot18Obj*, PlayState*); -typedef s32 (*BgSpot18ObjInitFunc)(struct BgSpot18Obj*, PlayState*); +typedef void (*BgSpot18ObjActionFunc)(struct BgSpot18Obj*, struct PlayState*); +typedef s32 (*BgSpot18ObjInitFunc)(struct BgSpot18Obj*, struct PlayState*); typedef struct BgSpot18Obj { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c b/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c index a078991b46..a92e53a4f2 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c +++ b/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c @@ -5,6 +5,14 @@ */ #include "z_bg_spot18_shutter.h" + +#include "ichain.h" +#include "one_point_cutscene.h" +#include "sfx.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_spot18_obj/object_spot18_obj.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.h b/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.h index 161fa9bc97..737d30bdbb 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.h +++ b/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.h @@ -2,11 +2,11 @@ #define Z_BG_SPOT18_SHUTTER_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgSpot18Shutter; -typedef void (*BgSpot18ShutterActionFunc)(struct BgSpot18Shutter*, PlayState*); +typedef void (*BgSpot18ShutterActionFunc)(struct BgSpot18Shutter*, struct PlayState*); typedef struct BgSpot18Shutter { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c b/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c index 5d96a0d750..1ddffb6c98 100644 --- a/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c +++ b/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c @@ -5,6 +5,17 @@ */ #include "z_bg_sst_floor.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_sst/object_sst.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.h b/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.h index 9149f9214b..eb4abfa662 100644 --- a/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.h +++ b/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.h @@ -2,7 +2,7 @@ #define Z_BG_SST_FLOOR_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgSstFloor; diff --git a/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c b/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c index 4ed9f8854c..47550f22bd 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c +++ b/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c @@ -5,6 +5,14 @@ */ #include "z_bg_toki_hikari.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sys_matrix.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_toki_objects/object_toki_objects.h" #define FLAGS ACTOR_FLAG_DRAW_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.h b/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.h index b4c62dba99..3c49b61cca 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.h +++ b/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.h @@ -2,11 +2,11 @@ #define Z_BG_TOKI_HIKARI_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgTokiHikari; -typedef void (*BgTokiHikariActionFunc)(struct BgTokiHikari*, PlayState*); +typedef void (*BgTokiHikariActionFunc)(struct BgTokiHikari*, struct PlayState*); typedef struct BgTokiHikari { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c index 8dcc00db30..a3a3856969 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c +++ b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c @@ -5,6 +5,19 @@ */ #include "z_bg_toki_swd.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "seqcmd.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z64cutscene_flags.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_toki_objects/object_toki_objects.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.h b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.h index 0a16201e60..5fdb9e0692 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.h +++ b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.h @@ -2,11 +2,11 @@ #define Z_BG_TOKI_SWD_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgTokiSwd; -typedef void (*BgTokiSwdActionFunc)(struct BgTokiSwd*, PlayState*); +typedef void (*BgTokiSwdActionFunc)(struct BgTokiSwd*, struct PlayState*); typedef struct BgTokiSwd { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_1.c b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_1.c index f11a8a551a..123a797a73 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_1.c +++ b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_1.c @@ -1,5 +1,5 @@ -#include "z_bg_toki_swd.h" #include "z64cutscene_commands.h" +#include "z64player.h" // clang-format off CutsceneData gPullMasterSwordCs[] = { diff --git a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_2.c b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_2.c index de138790da..3e27901701 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_2.c +++ b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_2.c @@ -1,5 +1,5 @@ -#include "z_bg_toki_swd.h" #include "z64cutscene_commands.h" +#include "z64player.h" // clang-format off CutsceneData gPlaceMasterSwordCs[] = { diff --git a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_3.c b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_3.c index c6c5e4eb60..3e5ccb4ea6 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_3.c +++ b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_3.c @@ -1,5 +1,5 @@ -#include "z_bg_toki_swd.h" #include "z64cutscene_commands.h" +#include "z64player.h" // clang-format off CutsceneData gRevealMasterSwordCs[] = { diff --git a/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c b/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c index d245fce7cd..5a544c3015 100644 --- a/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c +++ b/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c @@ -5,10 +5,22 @@ */ #include "z_bg_treemouth.h" -#include "versions.h" -#include "assets/objects/object_spot04_objects/object_spot04_objects.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "versions.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/object_spot04_objects/object_spot04_objects.h" + #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) void BgTreemouth_Init(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.h b/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.h index dc5a5f545f..7fea6f8e77 100644 --- a/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.h +++ b/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.h @@ -2,11 +2,11 @@ #define Z_BG_TREEMOUTH_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgTreemouth; -typedef void (*BgTreemouthActionFunc)(struct BgTreemouth*, PlayState*); +typedef void (*BgTreemouthActionFunc)(struct BgTreemouth*, struct PlayState*); typedef struct BgTreemouth { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth_cutscene_data.c b/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth_cutscene_data.c index 020b2972b1..c254318d42 100644 --- a/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth_cutscene_data.c +++ b/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth_cutscene_data.c @@ -1,5 +1,6 @@ -#include "z_bg_treemouth.h" +#include "sequence.h" #include "z64cutscene_commands.h" +#include "z64player.h" // clang-format off CutsceneData gDekuTreeMeetingCs[] = { diff --git a/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c b/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c index dbd5148b74..63a73aaf4e 100644 --- a/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c +++ b/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c @@ -5,6 +5,12 @@ */ #include "z_bg_umajump.h" + +#include "ichain.h" +#include "regs.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_umajump/object_umajump.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.h b/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.h index 19142ec4c8..067b5195c8 100644 --- a/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.h +++ b/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.h @@ -2,7 +2,7 @@ #define Z_BG_UMAJUMP_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgUmaJump; diff --git a/src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.c b/src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.c index 87e6c54ed4..679519f1be 100644 --- a/src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.c +++ b/src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.c @@ -5,9 +5,21 @@ */ #include "z_bg_vb_sima.h" -#include "assets/objects/object_fd/object_fd.h" #include "overlays/actors/ovl_Boss_Fd/z_boss_fd.h" +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "rand.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + +#include "assets/objects/object_fd/object_fd.h" + #define FLAGS 0 void BgVbSima_Init(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.h b/src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.h index c279ae393c..1dcee1b596 100644 --- a/src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.h +++ b/src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.h @@ -2,7 +2,7 @@ #define Z_BG_VB_SIMA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgVbSima; diff --git a/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c b/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c index df6e12f851..f759a98148 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c +++ b/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c @@ -5,6 +5,16 @@ */ #include "z_bg_ydan_hasi.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" + #include "assets/objects/object_ydan_objects/object_ydan_objects.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.h b/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.h index 616cd4250a..a308c6ebc0 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.h +++ b/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.h @@ -2,11 +2,11 @@ #define Z_BG_YDAN_HASI_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgYdanHasi; -typedef void (*BgYdanHasiActionFunc)(struct BgYdanHasi*, PlayState*); +typedef void (*BgYdanHasiActionFunc)(struct BgYdanHasi*, struct PlayState*); typedef struct BgYdanHasi { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c b/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c index 2b799465ce..becd2a11cc 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c +++ b/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c @@ -5,6 +5,13 @@ */ #include "z_bg_ydan_maruta.h" + +#include "ichain.h" +#include "one_point_cutscene.h" +#include "sfx.h" +#include "z_lib.h" +#include "z64play.h" + #include "assets/objects/object_ydan_objects/object_ydan_objects.h" #define FLAGS 0 @@ -86,7 +93,7 @@ void BgYdanMaruta_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Collider_InitTris(play, &this->collider); - Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInit, this->elements); + Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInit, this->colliderElements); this->switchFlag = PARAMS_GET_U(this->dyna.actor.params, 0, 16); thisx->params = PARAMS_GET_U(thisx->params, 8, 8); // thisx is required to match here diff --git a/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.h b/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.h index 72b753b83e..450c550b3a 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.h +++ b/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.h @@ -2,11 +2,11 @@ #define Z_BG_YDAN_MARUTA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgYdanMaruta; -typedef void (*BgYdanMarutaActionFunc)(struct BgYdanMaruta*, PlayState*); +typedef void (*BgYdanMarutaActionFunc)(struct BgYdanMaruta*, struct PlayState*); typedef struct BgYdanMaruta { /* 0x0000 */ DynaPolyActor dyna; @@ -14,7 +14,7 @@ typedef struct BgYdanMaruta { /* 0x0168 */ u8 switchFlag; /* 0x016A */ s16 unk_16A; /* 0x016C */ ColliderTris collider; - /* 0x018C */ ColliderTrisElement elements[2]; + /* 0x018C */ ColliderTrisElement colliderElements[2]; } BgYdanMaruta; // size = 0x0244 #endif diff --git a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c index 2d9b6f9296..0034cfb4ca 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c +++ b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c @@ -5,6 +5,21 @@ */ #include "z_bg_ydan_sp.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "rand.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_ydan_objects/object_ydan_objects.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.h b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.h index e134ac6f2c..b2138e23a5 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.h +++ b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.h @@ -2,11 +2,11 @@ #define Z_BG_YDAN_SP_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgYdanSp; -typedef void (*BgYdanSpActionFunc)(struct BgYdanSp*, PlayState*); +typedef void (*BgYdanSpActionFunc)(struct BgYdanSp*, struct PlayState*); typedef struct BgYdanSp { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c b/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c index 958e3c3f4f..7a12637b9d 100644 --- a/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c +++ b/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c @@ -5,8 +5,19 @@ */ #include "z_bg_zg.h" -#include "assets/objects/object_zg/object_zg.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "regs.h" +#include "sfx.h" +#include "sys_matrix.h" #include "terminal.h" +#include "translation.h" +#include "z64play.h" + +#include "assets/objects/object_zg/object_zg.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -99,8 +110,8 @@ void BgZg_Update(Actor* thisx, PlayState* play) { s32 action = this->action; if (((action < 0) || (1 < action)) || (sActionFuncs[action] == NULL)) { - // "Main Mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!" - PRINTF(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The main mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); } else { sActionFuncs[action](this, play); } @@ -146,8 +157,8 @@ void BgZg_Draw(Actor* thisx, PlayState* play) { s32 drawConfig = this->drawConfig; if (((drawConfig < 0) || (drawConfig > 0)) || sDrawFuncs[drawConfig] == NULL) { - // "Drawing mode is wrong !!!!!!!!!!!!!!!!!!!!!!!!!" - PRINTF(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The drawing mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); } else { sDrawFuncs[drawConfig](this, play); } diff --git a/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.h b/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.h index a5355defd5..c7f1add3a5 100644 --- a/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.h +++ b/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.h @@ -2,12 +2,12 @@ #define Z_BG_ZG_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BgZg; -typedef void (*BgZgActionFunc)(struct BgZg*, PlayState*); -typedef void (*BgZgDrawFunc)(struct BgZg*, PlayState*); +typedef void (*BgZgActionFunc)(struct BgZg*, struct PlayState*); +typedef void (*BgZgDrawFunc)(struct BgZg*, struct PlayState*); typedef struct BgZg { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c index ee1142b45a..bfc700c6dc 100644 --- a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c +++ b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c @@ -1,6 +1,27 @@ #include "z_boss_dodongo.h" -#include "assets/objects/object_kingdodongo/object_kingdodongo.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" + +#include "libc64/math64.h" +#include "libc64/qrand.h" +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "rand.h" +#include "regs.h" +#include "rumble.h" +#include "segmented_address.h" +#include "seqcmd.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/object_kingdodongo/object_kingdodongo.h" #include "assets/scenes/dungeons/ddan_boss/ddan_boss_room_1.h" #define FLAGS \ @@ -48,6 +69,7 @@ ActorProfile Boss_Dodongo_Profile = { }; #include "z_boss_dodongo_data.inc.c" +#include "assets/overlays/ovl_Boss_Dodongo/ovl_Boss_Dodongo.c" static InitChainEntry sInitChain[] = { ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_5, ICHAIN_CONTINUE), @@ -200,7 +222,7 @@ void BossDodongo_Init(Actor* thisx, PlayState* play) { this->unk_224 = 2.0f; this->unk_228 = 9200.0f; Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->items); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { // KD is dead u16* temp_s1_3 = SEGMENTED_TO_VIRTUAL(gDodongosCavernBossLavaFloorTex); diff --git a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h index dc5398598d..191487f13f 100644 --- a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h +++ b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h @@ -2,11 +2,11 @@ #define Z_BOSS_DODONGO_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BossDodongo; -typedef void (*BossDodongoActionFunc)(struct BossDodongo*, PlayState*); +typedef void (*BossDodongoActionFunc)(struct BossDodongo*, struct PlayState*); #define BOSS_DODONGO_EFFECT_COUNT 80 @@ -96,7 +96,7 @@ typedef struct BossDodongo { /* 0x0428 */ Vec3f subCamEye; /* 0x0434 */ Vec3f subCamAt; /* 0x0440 */ ColliderJntSph collider; - /* 0x0460 */ ColliderJntSphElement items[19]; + /* 0x0460 */ ColliderJntSphElement colliderElements[19]; /* 0x0920 */ BossDodongoEffect effects[BOSS_DODONGO_EFFECT_COUNT]; } BossDodongo; // size = 0x1820 diff --git a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo_data.inc.c b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo_data.inc.c index d4ac8f7f03..3d0061bb35 100644 --- a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo_data.inc.c +++ b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo_data.inc.c @@ -1,4 +1,4 @@ -#include "z_boss_dodongo.h" +#include "z64collision_check.h" static u8 D_808C7000[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, @@ -236,5 +236,3 @@ static ColliderJntSphInit sJntSphInit = { }; static Vec3f sUnkZeroVec = { 0.0f, 0.0f, 0.0f }; - -#include "assets/overlays/ovl_Boss_Dodongo/ovl_Boss_Dodongo.c" diff --git a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c index 1dfc472a45..c66883ddd8 100644 --- a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c +++ b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c @@ -5,12 +5,33 @@ */ #include "z_boss_fd.h" -#include "assets/objects/object_fd/object_fd.h" #include "overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.h" #include "overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.h" #include "overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" + +#include "libc64/math64.h" +#include "libc64/qrand.h" +#include "array_count.h" +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "rand.h" +#include "segmented_address.h" +#include "seqcmd.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" +#include "assets/objects/object_fd/object_fd.h" #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ @@ -193,7 +214,7 @@ void BossFd_Init(Actor* thisx, PlayState* play) { this->actor.world.pos.x = this->actor.world.pos.z = 0.0f; this->actor.world.pos.y = -200.0f; Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->elements); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); for (i = 0; i < 100; i++) { this->bodySegsPos[i].x = this->actor.world.pos.x; diff --git a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.h b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.h index dd1cbc8f0a..1ec72040c9 100644 --- a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.h +++ b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.h @@ -2,11 +2,11 @@ #define Z_BOSS_FD_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BossFd; -typedef void (*BossFdActionFunc)(struct BossFd*, PlayState*); +typedef void (*BossFdActionFunc)(struct BossFd*, struct PlayState*); typedef enum BossFdActionState { /* -1 */ BOSSFD_WAIT_INTRO = -1, @@ -175,7 +175,7 @@ typedef struct BossFd { /* 0x1488 */ f32 subCamAtYOffset; /* 0x148C */ f32 subCamShake; /* 0x1490 */ ColliderJntSph collider; - /* 0x14B0 */ ColliderJntSphElement elements[19]; + /* 0x14B0 */ ColliderJntSphElement colliderElements[19]; /* 0x1970 */ BossFdEffect effects[BOSSFD_EFFECT_COUNT]; } BossFd; // size = 0x43A0 diff --git a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd_colchk.inc.c b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd_colchk.inc.c index 83aa550fde..1012117e52 100644 --- a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd_colchk.inc.c +++ b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd_colchk.inc.c @@ -1,6 +1,6 @@ -#include "global.h" +#include "z64collision_check.h" -static ColliderJntSphElementInit sJntSphItemsInit[19] = { +static ColliderJntSphElementInit sJntSphElementsInit[19] = { { { ELEM_MATERIAL_UNK3, @@ -222,5 +222,5 @@ static ColliderJntSphInit sJntSphInit = { COLSHAPE_JNTSPH, }, 19, - sJntSphItemsInit, + sJntSphElementsInit, }; diff --git a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c index bf270508c4..856f9e34ea 100644 --- a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c +++ b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c @@ -5,10 +5,28 @@ */ #include "z_boss_fd2.h" -#include "assets/objects/object_fd2/object_fd2.h" #include "overlays/actors/ovl_Boss_Fd/z_boss_fd.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" + +#include "array_count.h" +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "rand.h" +#include "segmented_address.h" +#include "seqcmd.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_math.h" +#include "sys_matrix.h" #include "terminal.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" + +#include "assets/objects/object_fd2/object_fd2.h" #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ @@ -185,7 +203,7 @@ void BossFd2_Init(Actor* thisx, PlayState* play) { this->actionFunc = BossFd2_Wait; } Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->elements); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); } void BossFd2_Destroy(Actor* thisx, PlayState* play) { @@ -816,7 +834,7 @@ void BossFd2_CollisionCheck(BossFd2* this, PlayState* play) { if (this->actionFunc == BossFd2_ClawSwipe) { Player* player = GET_PLAYER(play); - for (i = 0; i < ARRAY_COUNT(this->elements); i++) { + for (i = 0; i < ARRAY_COUNT(this->colliderElements); i++) { if (this->collider.elements[i].base.atElemFlags & ATELEM_HIT) { this->collider.elements[i].base.atElemFlags &= ~ATELEM_HIT; Actor_PlaySfx(&player->actor, NA_SE_PL_BODY_HIT); diff --git a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h index f2d3ff45ad..d9fbde0ada 100644 --- a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h +++ b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h @@ -2,11 +2,11 @@ #define Z_BOSS_FD2_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BossFd2; -typedef void (*BossFd2ActionFunc)(struct BossFd2*, PlayState*); +typedef void (*BossFd2ActionFunc)(struct BossFd2*, struct PlayState*); typedef enum BossFd2Signal { /* 0 */ FD2_SIGNAL_NONE, @@ -83,7 +83,7 @@ typedef struct BossFd2 { /* 0x1414 */ f32 subCamAtYOffset; /* 0x1418 */ f32 subCamShake; /* 0x141C */ ColliderJntSph collider; - /* 0x143C */ ColliderJntSphElement elements[9]; + /* 0x143C */ ColliderJntSphElement colliderElements[9]; } BossFd2; // size = 0x167C #endif diff --git a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2_colchk.inc.c b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2_colchk.inc.c index 1098d44c3f..3a432692fe 100644 --- a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2_colchk.inc.c +++ b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2_colchk.inc.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "z64collision_check.h" static ColliderJntSphElementInit sJntSphElementsInit[9] = { { diff --git a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index 782d291b74..139d684deb 100644 --- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -6,6 +6,7 @@ #include "libc64/math64.h" #include "libc64/qrand.h" +#include "array_count.h" #include "attributes.h" #include "gfx.h" #include "gfx_setupdl.h" @@ -23,8 +24,7 @@ #include "z64effect.h" #include "z64play.h" #include "z64player.h" - -#include "global.h" +#include "z64save.h" #include "assets/overlays/ovl_Boss_Ganon/ovl_Boss_Ganon.h" #include "assets/objects/object_ganon/object_ganon.h" @@ -125,14 +125,14 @@ static ColliderCylinderInit sLightBallCylinderInit = { static u8 D_808E4C58[] = { 0, 12, 10, 12, 14, 16, 12, 14, 16, 12, 14, 16, 12, 14, 16, 10, 16, 14 }; static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; -#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:0" \ - "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" +#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ + "ique-cn:128 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" static EnGanonMant* sCape; // TODO: There's probably a way to match BSS ordering with less padding by spreading the variables out and moving // data around. It would be easier if we had more options for controlling BSS ordering in debug. -#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ +#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ "ique-cn:128 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" static s32 sSeed1; @@ -360,7 +360,7 @@ void BossGanon_SetColliderPos(Vec3f* pos, ColliderCylinder* collider) { void BossGanon_SetAnimationObject(BossGanon* this, PlayState* play, s32 objectId) { this->animObjectSlot = Object_GetSlot(&play->objectCtx, objectId); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); } static InitChainEntry sInitChain[] = { @@ -523,7 +523,7 @@ void BossGanon_SetupIntroCutscene(BossGanon* this, PlayState* play) { this->actionFunc = BossGanon_IntroCutscene; this->unk_198 = 1; this->animObjectSlot = animObjectSlot; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[animObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[animObjectSlot].segment); Animation_MorphToLoop(&this->skelAnime, &gGanondorfPlayOrganAnim, 0.0f); } else { this->actionFunc = BossGanon_SetupIntroCutscene; @@ -571,7 +571,7 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) { f32 cos; Camera* mainCam; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); sCape->backPush = -2.0f; sCape->backSwayMagnitude = 0.25f; @@ -1118,7 +1118,7 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) { if (this->csTimer == 50) { gSegments[6] = - VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[Object_GetSlot(&play->objectCtx, OBJECT_GANON)].segment); + OS_K0_TO_PHYSICAL(play->objectCtx.slots[Object_GetSlot(&play->objectCtx, OBJECT_GANON)].segment); if (!GET_EVENTCHKINF(EVENTCHKINF_BEGAN_GANONDORF_BATTLE)) { TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gGanondorfTitleCardTex), @@ -1208,7 +1208,7 @@ void BossGanon_SetupDeathCutscene(BossGanon* this, PlayState* play) { this->csTimer = this->csState = 0; this->unk_198 = 1; this->animObjectSlot = animObjectSlot; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[animObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[animObjectSlot].segment); Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfDefeatedStartAnim, 0.0f); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfDefeatedStartAnim); this->unk_508 = 0.0f; @@ -1221,7 +1221,7 @@ void BossGanon_SetupTowerCutscene(BossGanon* this, PlayState* play) { if (Object_IsLoaded(&play->objectCtx, animObjectSlot)) { this->animObjectSlot = animObjectSlot; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[animObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[animObjectSlot].segment); Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfDefeatedStartAnim, 0.0f); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfDefeatedStartAnim); this->actionFunc = BossGanon_DeathAndTowerCutscene; @@ -1256,7 +1256,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) { Player* player = GET_PLAYER(play); s16 pad; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); this->csTimer++; SkelAnime_Update(&this->skelAnime); @@ -2835,7 +2835,7 @@ void BossGanon_Update(Actor* thisx, PlayState* play2) { if ((this->actionFunc != BossGanon_IntroCutscene) && (this->actionFunc != BossGanon_DeathAndTowerCutscene)) { BossGanon_SetAnimationObject(this, play, OBJECT_GANON_ANIME1); } else { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); } if (this->windowShatterState != GDF_WINDOW_SHATTER_OFF) { diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c index 8d73bf78c3..e2742e3bef 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -4,9 +4,11 @@ #include "overlays/actors/ovl_En_Zl3/z_en_zl3.h" #include "libc64/qrand.h" +#include "array_count.h" #include "attributes.h" #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "rand.h" #include "rumble.h" #include "segmented_address.h" @@ -20,6 +22,7 @@ #include "z64effect.h" #include "z64play.h" #include "z64player.h" +#include "z64save.h" #include "assets/objects/object_ganon/object_ganon.h" #include "assets/objects/object_ganon2/object_ganon2.h" @@ -27,6 +30,9 @@ #include "assets/objects/object_geff/object_geff.h" #include "assets/overlays/ovl_Boss_Ganon2/ovl_Boss_Ganon2.h" +#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ + "ique-cn:128 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" + #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ ACTOR_FLAG_DRAW_CULLING_DISABLED) @@ -87,7 +93,7 @@ static Vec3f D_80906D6C = { 0.0f, 0.0f, 500.0f }; static u8 D_80906D78 = 0; -static ColliderJntSphElementInit sJntSphItemsInit1[] = { +static ColliderJntSphElementInit sJntSphElementsInit1[] = { { { ELEM_MATERIAL_UNK0, @@ -275,11 +281,11 @@ static ColliderJntSphInit sJntSphInit1 = { OC2_FIRST_ONLY | OC2_TYPE_1, COLSHAPE_JNTSPH, }, - ARRAY_COUNT(sJntSphItemsInit1), - sJntSphItemsInit1, + ARRAY_COUNT(sJntSphElementsInit1), + sJntSphElementsInit1, }; -static ColliderJntSphElementInit sJntSphItemsInit2[] = { +static ColliderJntSphElementInit sJntSphElementsInit2[] = { { { ELEM_MATERIAL_UNK2, @@ -313,8 +319,8 @@ static ColliderJntSphInit sJntSphInit2 = { OC2_TYPE_1, COLSHAPE_JNTSPH, }, - ARRAY_COUNT(sJntSphItemsInit2), - sJntSphItemsInit2, + ARRAY_COUNT(sJntSphElementsInit2), + sJntSphElementsInit2, }; static Vec3f D_8090EB20; @@ -375,7 +381,7 @@ void BossGanon2_SetObjectSegment(BossGanon2* this, PlayState* play, s32 objectId s32 pad; s32 objectSlot = Object_GetSlot(&play->objectCtx, objectId); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); if (setRSPSegment) { OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 790); @@ -1338,7 +1344,7 @@ void func_808FFDB0(BossGanon2* this, PlayState* play) { s32 objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GANON2); if (Object_IsLoaded(&play->objectCtx, objectSlot)) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); Animation_MorphToLoop(&this->skelAnime, &gGanonGuardIdleAnim, -10.0f); this->actionFunc = func_808FFEBC; diff --git a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c index 7473f8d2d8..848707f002 100644 --- a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c +++ b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c @@ -5,13 +5,34 @@ */ #include "z_boss_ganondrof.h" -#include "assets/objects/object_gnd/object_gnd.h" #include "overlays/actors/ovl_En_fHG/z_en_fhg.h" #include "overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.h" #include "overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" +#include "libc64/math64.h" +#include "libc64/qrand.h" +#include "array_count.h" +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "rand.h" +#include "segmented_address.h" +#include "seqcmd.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64light.h" +#include "z64play.h" +#include "z64player.h" + +#include "assets/objects/object_gnd/object_gnd.h" + #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ ACTOR_FLAG_DRAW_CULLING_DISABLED) @@ -294,10 +315,10 @@ void BossGanondrof_Init(Actor* thisx, PlayState* play) { BossGanondrof_SetupPaintings(this); } - Collider_InitCylinder(play, &this->colliderBody); - Collider_InitCylinder(play, &this->colliderSpear); - Collider_SetCylinder(play, &this->colliderBody, &this->actor, &sCylinderInitBody); - Collider_SetCylinder(play, &this->colliderSpear, &this->actor, &sCylinderInitSpear); + Collider_InitCylinder(play, &this->bodyCollider); + Collider_InitCylinder(play, &this->spearCollider); + Collider_SetCylinder(play, &this->bodyCollider, &this->actor, &sCylinderInitBody); + Collider_SetCylinder(play, &this->spearCollider, &this->actor, &sCylinderInitSpear); this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { Actor_Kill(&this->actor); @@ -317,8 +338,8 @@ void BossGanondrof_Destroy(Actor* thisx, PlayState* play) { PRINTF("DT1\n"); SkelAnime_Free(&this->skelAnime, play); - Collider_DestroyCylinder(play, &this->colliderBody); - Collider_DestroyCylinder(play, &this->colliderSpear); + Collider_DestroyCylinder(play, &this->bodyCollider); + Collider_DestroyCylinder(play, &this->spearCollider); if (this->actor.params == GND_REAL_BOSS) { LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } @@ -461,9 +482,9 @@ void BossGanondrof_Paintings(BossGanondrof* this, PlayState* play) { if (this->flyMode != GND_FLY_PAINTING) { BossGanondrof_SetupNeutral(this, -20.0f); this->timers[0] = 100; - this->colliderBody.dim.radius = 20; - this->colliderBody.dim.height = 60; - this->colliderBody.dim.yShift = -33; + this->bodyCollider.dim.radius = 20; + this->bodyCollider.dim.height = 60; + this->bodyCollider.dim.yShift = -33; Actor_PlaySfx(&this->actor, NA_SE_EN_FANTOM_LAUGH); this->actor.naviEnemyId = NAVI_ENEMY_PHANTOM_GANON_PHASE_2; } else { @@ -775,7 +796,7 @@ void BossGanondrof_SetupBlock(BossGanondrof* this, PlayState* play) { } void BossGanondrof_Block(BossGanondrof* this, PlayState* play) { - this->colliderBody.base.colMaterial = COL_MATERIAL_METAL; + this->bodyCollider.base.colMaterial = COL_MATERIAL_METAL; SkelAnime_Update(&this->skelAnime); this->actor.world.pos.x += this->actor.velocity.x; this->actor.world.pos.z += this->actor.velocity.z; @@ -804,7 +825,7 @@ void BossGanondrof_Charge(BossGanondrof* this, PlayState* play) { f32 dxCenter = thisx->world.pos.x - GND_BOSSROOM_CENTER_X; f32 dzCenter = thisx->world.pos.z - GND_BOSSROOM_CENTER_Z; - this->colliderBody.base.colMaterial = COL_MATERIAL_METAL; + this->bodyCollider.base.colMaterial = COL_MATERIAL_METAL; SkelAnime_Update(&this->skelAnime); switch (this->work[GND_ACTION_STATE]) { case CHARGE_WINDUP: @@ -1231,13 +1252,13 @@ void BossGanondrof_CollisionCheck(BossGanondrof* this, PlayState* play) { if (this->work[GND_INVINC_TIMER] != 0) { this->work[GND_INVINC_TIMER]--; this->returnCount = 0; - this->colliderBody.base.acFlags &= ~AC_HIT; + this->bodyCollider.base.acFlags &= ~AC_HIT; } else { - acHit = this->colliderBody.base.acFlags & AC_HIT; + acHit = this->bodyCollider.base.acFlags & AC_HIT; if ((acHit && ((s8)this->actor.colChkInfo.health > 0)) || (this->returnCount != 0)) { if (acHit) { - this->colliderBody.base.acFlags &= ~AC_HIT; - acHitElem = this->colliderBody.elem.acHitElem; + this->bodyCollider.base.acFlags &= ~AC_HIT; + acHitElem = this->bodyCollider.elem.acHitElem; } if (this->flyMode != GND_FLY_PAINTING) { if (acHit && (this->actionFunc != BossGanondrof_Stunned) && @@ -1300,7 +1321,7 @@ void BossGanondrof_Update(Actor* thisx, PlayState* play) { PRINTF("MOVE START %d\n", this->actor.params); this->actor.flags &= ~ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER; - this->colliderBody.base.colMaterial = COL_MATERIAL_HIT3; + this->bodyCollider.base.colMaterial = COL_MATERIAL_HIT3; if (this->killActor) { Actor_Kill(&this->actor); return; @@ -1328,20 +1349,20 @@ void BossGanondrof_Update(Actor* thisx, PlayState* play) { } PRINTF("MOVE END\n"); - BossGanondrof_SetColliderPos(&this->targetPos, &this->colliderBody); - BossGanondrof_SetColliderPos(&this->spearTip, &this->colliderSpear); + BossGanondrof_SetColliderPos(&this->targetPos, &this->bodyCollider); + BossGanondrof_SetColliderPos(&this->spearTip, &this->spearCollider); if ((this->flyMode == GND_FLY_PAINTING) && !horse->bossGndInPainting) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); } if ((this->actionFunc == BossGanondrof_Stunned) && (this->timers[0] > 1)) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderBody.base); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); } else if (this->actionFunc == BossGanondrof_Block) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); } else if (this->actionFunc == BossGanondrof_Charge) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderBody.base); - CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderBody.base); - CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderSpear.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->spearCollider.base); } this->actor.focus.pos = this->targetPos; diff --git a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.h b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.h index 142aea02b6..1fed43e428 100644 --- a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.h +++ b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.h @@ -2,11 +2,12 @@ #define Z_BOSS_GANONDROF_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" +#include "z64light.h" struct BossGanondrof; -typedef void (*BossGanondrofActionFunc)(struct BossGanondrof*, PlayState*); +typedef void (*BossGanondrofActionFunc)(struct BossGanondrof*, struct PlayState*); #define GND_REAL_BOSS 1 #define GND_FAKE_BOSS 10 @@ -97,8 +98,8 @@ typedef struct BossGanondrof { /* 0x0454 */ f32 rideRotY[30]; // possibly only 25 used /* 0x04CC */ LightNode* lightNode; /* 0x04D0 */ LightInfo lightInfo; - /* 0x04E0 */ ColliderCylinder colliderBody; - /* 0x052C */ ColliderCylinder colliderSpear; + /* 0x04E0 */ ColliderCylinder bodyCollider; + /* 0x052C */ ColliderCylinder spearCollider; } BossGanondrof; // size = 0x0578 #endif diff --git a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c index 082b91a56f..bfd115b535 100644 --- a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c +++ b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c @@ -5,11 +5,34 @@ */ #include "z_boss_goma.h" -#include "assets/objects/object_goma/object_goma.h" #include "overlays/actors/ovl_En_Goma/z_en_goma.h" #include "overlays/actors/ovl_Door_Shutter/z_door_shutter.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" +#include "libc64/math64.h" +#include "libc64/qrand.h" +#include "array_count.h" +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "rand.h" +#include "rumble.h" +#include "segmented_address.h" +#include "seqcmd.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64environment.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/object_goma/object_goma.h" + #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ ACTOR_FLAG_DRAW_CULLING_DISABLED) @@ -69,7 +92,7 @@ ActorProfile Boss_Goma_Profile = { /**/ BossGoma_Draw, }; -static ColliderJntSphElementInit sColliderJntSphElementInit[13] = { +static ColliderJntSphElementInit sColliderJntSphElementsInit[13] = { { { ELEM_MATERIAL_UNK3, @@ -225,7 +248,7 @@ static ColliderJntSphInit sColliderJntSphInit = { COLSHAPE_JNTSPH, }, 13, - sColliderJntSphElementInit, + sColliderJntSphElementsInit, }; static u8 sClearPixelTableFirstPass[16 * 16] = { @@ -365,7 +388,7 @@ void BossGoma_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.health = 10; this->actor.colChkInfo.mass = MASS_IMMOVABLE; Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sColliderJntSphInit, this->colliderItems); + Collider_SetJntSph(play, &this->collider, &this->actor, &sColliderJntSphInit, this->colliderElements); if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { Actor_Kill(&this->actor); diff --git a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.h b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.h index 5931f9ca3d..4e4c8ea955 100644 --- a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.h +++ b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.h @@ -2,11 +2,11 @@ #define Z_BOSS_GOMA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BossGoma; -typedef void (*BossGomaActionFunc)(struct BossGoma*, PlayState*); +typedef void (*BossGomaActionFunc)(struct BossGoma*, struct PlayState*); typedef enum BossGomaLimb { /* 0 */ BOSSGOMA_LIMB_NONE, @@ -150,7 +150,7 @@ typedef struct BossGoma { /* 0x02A8 */ Vec3f defeatedLimbPositions[100]; // only 85/86 first indices actually used /* 0x0758 */ u8 deadLimbsState[100]; // only 85/90 first indices actually used /* 0x07BC */ ColliderJntSph collider; - /* 0x07DC */ ColliderJntSphElement colliderItems[13]; + /* 0x07DC */ ColliderJntSphElement colliderElements[13]; } BossGoma; // size = 0x0B1C #endif diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c index fc82d8000e..c12ca1e950 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -5,10 +5,38 @@ */ #include "z_boss_mo.h" -#include "assets/objects/object_mo/object_mo.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" -#include "assets/objects/gameplay_keep/gameplay_keep.h" + +#include "libc64/math64.h" +#include "libc64/qrand.h" +#include "array_count.h" +#include "attributes.h" +#include "controller.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "letterbox.h" +#include "printf.h" +#include "rand.h" +#include "regs.h" +#include "rumble.h" +#include "segmented_address.h" +#include "seqcmd.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" #include "terminal.h" +#include "translation.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" +#include "z64skin_matrix.h" + +#include "assets/objects/gameplay_keep/gameplay_keep.h" +#include "assets/objects/object_mo/object_mo.h" #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ "pal-1.0:128 pal-1.1:128" @@ -389,7 +417,7 @@ void BossMo_Init(Actor* thisx, PlayState* play2) { this->actor.world.pos.y = MO_WATER_LEVEL(play); this->actor.prevPos = this->targetPos = this->actor.world.pos; Collider_InitJntSph(play, &this->tentCollider); - Collider_SetJntSph(play, &this->tentCollider, &this->actor, &sJntSphInit, this->tentElements); + Collider_SetJntSph(play, &this->tentCollider, &this->actor, &sJntSphInit, this->tentColliderElements); this->tentMaxAngle = 1.0f; } } @@ -1151,7 +1179,7 @@ void BossMo_TentCollisionCheck(BossMo* this, PlayState* play) { s16 i2; ColliderElement* acHitElem; - for (i1 = 0; i1 < ARRAY_COUNT(this->tentElements); i1++) { + for (i1 = 0; i1 < ARRAY_COUNT(this->tentColliderElements); i1++) { if (this->tentCollider.elements[i1].base.acElemFlags & ACELEM_HIT) { for (i2 = 0; i2 < 19; i2++) { @@ -1758,20 +1786,17 @@ void BossMo_CoreCollisionCheck(BossMo* this, PlayState* play) { } if (this->coreCollider.base.acFlags & AC_HIT) { ColliderElement* acHitElem = this->coreCollider.elem.acHitElem; - // "hit!!" - PRINTF("Core_Damage_check 当り!!\n"); + PRINTF(T("Core_Damage_check 当り!!\n", "Core_Damage_check hit!!\n")); this->coreCollider.base.acFlags &= ~AC_HIT; if ((acHitElem->atDmgInfo.dmgFlags & DMG_MAGIC_FIRE) && (this->work[MO_TENT_ACTION_STATE] == MO_CORE_ATTACK)) { this->work[MO_TENT_ACTION_STATE] = MO_CORE_RETREAT; } - // "hit 2 !!" - PRINTF("Core_Damage_check 当り 2 !!\n"); + PRINTF(T("Core_Damage_check 当り 2 !!\n", "Core_Damage_check hit 2 !!\n")); if ((this->work[MO_TENT_ACTION_STATE] != MO_CORE_UNDERWATER) && (this->work[MO_TENT_INVINC_TIMER] == 0)) { u8 damage = CollisionCheck_GetSwordDamage(acHitElem->atDmgInfo.dmgFlags); if ((damage != 0) && (this->work[MO_TENT_ACTION_STATE] < MO_CORE_ATTACK)) { - // "sword hit !!" - PRINTF("Core_Damage_check 剣 当り!!\n"); + PRINTF(T("Core_Damage_check 剣 当り!!\n", "Core_Damage_check sword hit!!\n")); this->work[MO_TENT_ACTION_STATE] = MO_CORE_STUNNED; this->timers[0] = 25; @@ -1841,8 +1866,7 @@ void BossMo_CoreCollisionCheck(BossMo* this, PlayState* play) { } } } - // "end !!" - PRINTF("Core_Damage_check 終わり !!\n"); + PRINTF(T("Core_Damage_check 終わり !!\n", "Core_Damage_check end !!\n")); PRINTF_RST(); } diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h index 1b7641817e..88867ceeda 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h @@ -2,11 +2,11 @@ #define Z_BOSS_MO_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BossMo; -typedef void (*BossMoActionFunc)(struct BossMo*, PlayState*); +typedef void (*BossMoActionFunc)(struct BossMo*, struct PlayState*); typedef enum BossMoTentS16Var { /* 0 */ MO_TENT_ACTION_STATE, @@ -124,7 +124,7 @@ typedef struct BossMo { /* 0x100C */ f32 subCamYawShake; /* 0x1010 */ Vec3f tentTipPos; /* 0x101C */ ColliderJntSph tentCollider; - /* 0x103C */ ColliderJntSphElement tentElements[19]; + /* 0x103C */ ColliderJntSphElement tentColliderElements[19]; /* 0x14FC */ ColliderCylinder coreCollider; /* 0x1548 */ char unk_1548[0x44]; } BossMo; // size = 0x158C diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo_colchk.inc.c b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo_colchk.inc.c index 58d807607c..1148cf1a99 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo_colchk.inc.c +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo_colchk.inc.c @@ -1,5 +1,4 @@ -#include "global.h" -#include "z_boss_mo.h" +#include "z64collision_check.h" static ColliderJntSphElementInit sJntSphElementsInit[19] = { { diff --git a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index ea77056756..89ba5fab34 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -5,14 +5,35 @@ */ #include "z_boss_sst.h" -#include "versions.h" -#include "assets/objects/object_sst/object_sst.h" -#include "assets/objects/gameplay_keep/gameplay_keep.h" #include "overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "pal-1.0:128 pal-1.1:128" +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "rand.h" +#include "rumble.h" +#include "segmented_address.h" +#include "seqcmd.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_math3d.h" +#include "sys_matrix.h" +#include "versions.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" +#include "z64skin_matrix.h" + +#include "assets/objects/object_sst/object_sst.h" +#include "assets/objects/gameplay_keep/gameplay_keep.h" + +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ + "ique-cn:128 pal-1.0:128 pal-1.1:128" #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ @@ -274,7 +295,7 @@ void BossSst_Init(Actor* thisx, PlayState* play2) { BossSst* this = (BossSst*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - Collider_InitCylinder(play, &this->colliderCyl); + Collider_InitCylinder(play, &this->colliderCylinder); Collider_InitJntSph(play, &this->colliderJntSph); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); Flags_SetSwitch(play, 0x14); @@ -284,8 +305,8 @@ void BossSst_Init(Actor* thisx, PlayState* play2) { SkelAnime_InitFlex(play, &this->skelAnime, &gBongoHeadSkel, &gBongoHeadEyeOpenIdleAnim, this->jointTable, this->morphTable, 45); ActorShape_Init(&this->actor.shape, 70000.0f, ActorShadow_DrawCircle, 95.0f); - Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInitHead, this->colliderItems); - Collider_SetCylinder(play, &this->colliderCyl, &this->actor, &sCylinderInitHead); + Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInitHead, this->colliderJntSphElements); + Collider_SetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInitHead); sHead = this; this->actor.world.pos.x = ROOM_CENTER_X + 50.0f; this->actor.world.pos.y = ROOM_CENTER_Y + 0.0f; @@ -317,8 +338,8 @@ void BossSst_Init(Actor* thisx, PlayState* play2) { Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_BOSS); } } else { - Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInitHand, this->colliderItems); - Collider_SetCylinder(play, &this->colliderCyl, &this->actor, &sCylinderInitHand); + Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInitHand, this->colliderJntSphElements); + Collider_SetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInitHand); if (this->actor.params == BONGO_LEFT_HAND) { SkelAnime_InitFlex(play, &this->skelAnime, &gBongoLeftHandSkel, &gBongoLeftHandIdleAnim, this->jointTable, this->morphTable, 27); @@ -343,7 +364,7 @@ void BossSst_Destroy(Actor* thisx, PlayState* play) { BossSst* this = (BossSst*)thisx; Collider_DestroyJntSph(play, &this->colliderJntSph); - Collider_DestroyCylinder(play, &this->colliderCyl); + Collider_DestroyCylinder(play, &this->colliderCylinder); Audio_StopSfxByPos(&this->center); } @@ -705,7 +726,7 @@ void BossSst_HeadDamagedHand(BossSst* this, PlayState* play) { void BossSst_HeadSetupReadyCharge(BossSst* this) { Animation_MorphToLoop(&this->skelAnime, &gBongoHeadEyeOpenIdleAnim, -5.0f); this->actor.speed = 0.0f; - this->colliderCyl.base.acFlags |= AC_ON; + this->colliderCylinder.base.acFlags |= AC_ON; this->actionFunc = BossSst_HeadReadyCharge; } @@ -781,7 +802,7 @@ void BossSst_HeadSetupEndCharge(BossSst* this) { Animation_MorphToLoop(&this->skelAnime, &gBongoHeadEyeCloseIdleAnim, -20.0f); this->targetYaw = Actor_WorldYawTowardPoint(&this->actor, &sRoomCenter); this->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); - this->colliderCyl.base.acFlags &= ~AC_ON; + this->colliderCylinder.base.acFlags &= ~AC_ON; this->radius *= -1.0f; this->actionFunc = BossSst_HeadEndCharge; } @@ -798,7 +819,7 @@ void BossSst_HeadEndCharge(BossSst* this, PlayState* play) { void BossSst_HeadSetupFrozenHand(BossSst* this) { Animation_MorphToLoop(&this->skelAnime, &gBongoHeadEyeOpenIdleAnim, -5.0f); this->ready = false; - this->colliderCyl.base.acFlags |= AC_ON; + this->colliderCylinder.base.acFlags |= AC_ON; this->actionFunc = BossSst_HeadFrozenHand; } @@ -811,7 +832,7 @@ void BossSst_HeadFrozenHand(BossSst* this, PlayState* play) { void BossSst_HeadSetupUnfreezeHand(BossSst* this) { Animation_MorphToPlayOnce(&this->skelAnime, &gBongoHeadEyeCloseAnim, -5.0f); - this->colliderCyl.base.acFlags &= ~AC_ON; + this->colliderCylinder.base.acFlags &= ~AC_ON; this->actionFunc = BossSst_HeadUnfreezeHand; } @@ -826,7 +847,7 @@ void BossSst_HeadSetupStunned(BossSst* this) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, Animation_GetLastFrame(&gBongoHeadKnockoutAnim)); this->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); - this->colliderCyl.base.acFlags &= ~AC_ON; + this->colliderCylinder.base.acFlags &= ~AC_ON; this->vVanish = false; this->actor.flags &= ~ACTOR_FLAG_REACT_TO_LENS; BossSst_HeadSfx(this, NA_SE_EN_SHADEST_FREEZE); @@ -878,8 +899,8 @@ void BossSst_HeadStunned(BossSst* this, PlayState* play) { void BossSst_HeadSetupVulnerable(BossSst* this) { Animation_MorphToLoop(&this->skelAnime, &gBongoHeadStunnedAnim, -5.0f); - this->colliderCyl.base.acFlags |= AC_ON; - this->colliderCyl.elem.acDmgInfo.dmgFlags = DMG_SWORD | DMG_DEKU_STICK; + this->colliderCylinder.base.acFlags |= AC_ON; + this->colliderCylinder.elem.acDmgInfo.dmgFlags = DMG_SWORD | DMG_DEKU_STICK; this->actor.speed = 0.0f; this->colliderJntSph.elements[10].base.acElemFlags |= (ACELEM_ON | ACELEM_HOOKABLE); this->colliderJntSph.elements[0].base.acElemFlags &= ~ACELEM_ON; @@ -896,7 +917,7 @@ void BossSst_HeadVulnerable(BossSst* this, PlayState* play) { Math_StepToF(&sHandOffsets[RIGHT].z, 600.0f, 20.0f); Math_StepToF(&sHandOffsets[LEFT].x, 200.0f, 20.0f); Math_StepToF(&sHandOffsets[RIGHT].x, -200.0f, 20.0f); - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { + if (ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { this->timer += 2; this->timer = CLAMP_MAX(this->timer, 50); } else { @@ -920,7 +941,7 @@ void BossSst_HeadSetupDamage(BossSst* this) { Animation_GetLastFrame(&gBongoHeadDamageAnim)); Actor_SetColorFilter(&sHands[RIGHT]->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, Animation_GetLastFrame(&gBongoHeadDamageAnim)); - this->colliderCyl.base.acFlags &= ~AC_ON; + this->colliderCylinder.base.acFlags &= ~AC_ON; BossSst_HeadSfx(this, NA_SE_EN_SHADEST_DAMAGE); this->actionFunc = BossSst_HeadDamage; } @@ -937,8 +958,8 @@ void BossSst_HeadDamage(BossSst* this, PlayState* play) { void BossSst_HeadSetupRecover(BossSst* this) { Animation_MorphToPlayOnce(&this->skelAnime, &gBongoHeadRecoverAnim, -5.0f); - this->colliderCyl.base.acFlags &= ~AC_ON; - this->colliderCyl.elem.acDmgInfo.dmgFlags = DMG_DEFAULT; + this->colliderCylinder.base.acFlags &= ~AC_ON; + this->colliderCylinder.elem.acDmgInfo.dmgFlags = DMG_DEFAULT; this->colliderJntSph.elements[10].base.acElemFlags &= ~(ACELEM_ON | ACELEM_HOOKABLE); this->colliderJntSph.elements[0].base.acElemFlags |= ACELEM_ON; this->vVanish = true; @@ -1024,7 +1045,7 @@ void BossSst_HeadSetupDeath(BossSst* this, PlayState* play) { Actor_SetColorFilter(&sHands[LEFT]->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 60); Actor_SetColorFilter(&sHands[RIGHT]->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 60); this->timer = 60; - this->colliderCyl.base.acFlags &= ~AC_ON; + this->colliderCylinder.base.acFlags &= ~AC_ON; this->colliderJntSph.base.ocFlags1 &= ~OC1_ON; sHands[LEFT]->colliderJntSph.base.ocFlags1 &= ~OC1_ON; sHands[RIGHT]->colliderJntSph.base.ocFlags1 &= ~OC1_ON; @@ -1514,9 +1535,9 @@ void BossSst_HandSlam(BossSst* this, PlayState* play) { this->ready = true; Actor_PlaySfx(&this->actor, NA_SE_EN_SHADEST_TAIKO_LOW); BossSst_SpawnShockwave(this); - this->colliderCyl.base.atFlags |= AT_ON; - Collider_UpdateCylinder(&this->actor, &this->colliderCyl); - this->colliderCyl.dim.radius = sCylinderInitHand.dim.radius; + this->colliderCylinder.base.atFlags |= AT_ON; + Collider_UpdateCylinder(&this->actor, &this->colliderCylinder); + this->colliderCylinder.dim.radius = sCylinderInitHand.dim.radius; } } @@ -2560,8 +2581,8 @@ void BossSst_HandCollisionCheck(BossSst* this, PlayState* play) { } void BossSst_HeadCollisionCheck(BossSst* this, PlayState* play) { - if (this->colliderCyl.base.acFlags & AC_HIT) { - this->colliderCyl.base.acFlags &= ~AC_HIT; + if (this->colliderCylinder.base.acFlags & AC_HIT) { + this->colliderCylinder.base.acFlags &= ~AC_HIT; if ((this->actor.colChkInfo.damageEffect != 0) || (this->actor.colChkInfo.damage != 0)) { if (this->actionFunc == BossSst_HeadVulnerable) { if (Actor_ApplyDamage(&this->actor) == 0) { @@ -2593,13 +2614,13 @@ void BossSst_UpdateHand(Actor* thisx, PlayState* play) { BossSst* this = (BossSst*)thisx; BossSstHandTrail* trail; - if (this->colliderCyl.base.atFlags & AT_ON) { + if (this->colliderCylinder.base.atFlags & AT_ON) { if ((this->effects[0].move < 5) || (this->actor.xzDistToPlayer < ((this->effects[2].scale * 0.01f) * sCylinderInitHand.dim.radius)) || - (this->colliderCyl.base.atFlags & AT_HIT)) { - this->colliderCyl.base.atFlags &= ~(AT_ON | AT_HIT); + (this->colliderCylinder.base.atFlags & AT_HIT)) { + this->colliderCylinder.base.atFlags &= ~(AT_ON | AT_HIT); } else { - this->colliderCyl.dim.radius = (this->effects[0].scale * 0.01f) * sCylinderInitHand.dim.radius; + this->colliderCylinder.dim.radius = (this->effects[0].scale * 0.01f) * sCylinderInitHand.dim.radius; } } @@ -2626,8 +2647,8 @@ void BossSst_UpdateHand(Actor* thisx, PlayState* play) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderJntSph.base); } - if (this->colliderCyl.base.atFlags & AT_ON) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderCyl.base); + if (this->colliderCylinder.base.atFlags & AT_ON) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderCylinder.base); } if ((HAND_STATE(this) != HAND_DEATH) && (HAND_STATE(this) != HAND_WAIT) && (HAND_STATE(this) != HAND_BEAT) && @@ -2674,14 +2695,14 @@ void BossSst_UpdateHead(Actor* thisx, PlayState* play2) { } #if OOT_VERSION < NTSC_1_2 - if (this->colliderCyl.base.acFlags & AC_ON) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCyl.base); + if (this->colliderCylinder.base.acFlags & AC_ON) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder.base); } CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); #else if ((this->actionFunc != BossSst_HeadLurk) && (this->actionFunc != BossSst_HeadIntro)) { - if (this->colliderCyl.base.acFlags & AC_ON) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCyl.base); + if (this->colliderCylinder.base.acFlags & AC_ON) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder.base); } CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); } @@ -2692,7 +2713,7 @@ void BossSst_UpdateHead(Actor* thisx, PlayState* play2) { } BossSst_MoveAround(this); - if ((!this->vVanish || CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) && + if ((!this->vVanish || ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_REACT_TO_LENS)) && ((this->actionFunc == BossSst_HeadReadyCharge) || (this->actionFunc == BossSst_HeadCharge) || (this->actionFunc == BossSst_HeadFrozenHand) || (this->actionFunc == BossSst_HeadStunned) || (this->actionFunc == BossSst_HeadVulnerable) || (this->actionFunc == BossSst_HeadDamage))) { @@ -2797,7 +2818,7 @@ s32 BossSst_OverrideHeadDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* Gfx** gfx) { BossSst* this = (BossSst*)thisx; - if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS) && this->vVanish) { + if (!ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_REACT_TO_LENS) && this->vVanish) { *dList = NULL; } else if (this->actionFunc == BossSst_HeadThrash) { // Animation modifications for death cutscene s32 shakeAmp = (this->timer / 10) + 1; @@ -2862,9 +2883,9 @@ void BossSst_PostHeadDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* ro if (limbIndex == 8) { Matrix_MultVec3f(&zeroVec, &this->actor.focus.pos); Matrix_MultVec3f(&headVec, &headPos); - this->colliderCyl.dim.pos.x = headPos.x; - this->colliderCyl.dim.pos.y = headPos.y; - this->colliderCyl.dim.pos.z = headPos.z; + this->colliderCylinder.dim.pos.x = headPos.x; + this->colliderCylinder.dim.pos.y = headPos.y; + this->colliderCylinder.dim.pos.z = headPos.z; } Collider_UpdateSpheres(limbIndex, &this->colliderJntSph); @@ -2876,7 +2897,7 @@ void BossSst_DrawHead(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_boss_sst.c", 6810); - if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { + if (!ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_REACT_TO_LENS)) { Gfx_SetupDL_25Opa(play->state.gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0x00, 0x80, sBodyColor.r, sBodyColor.g, sBodyColor.b, 255); if (!sBodyStatic) { @@ -2903,7 +2924,7 @@ void BossSst_DrawHead(Actor* thisx, PlayState* play) { Matrix_RotateY(-randYaw, MTXMODE_APPLY); } - if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { + if (!ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_REACT_TO_LENS)) { POLY_OPA_DISP = SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, BossSst_OverrideHeadDraw, BossSst_PostHeadDraw, this, POLY_OPA_DISP); diff --git a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h index f064f2b842..caf4891ccb 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h @@ -2,11 +2,11 @@ #define Z_BOSS_SST_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BossSst; -typedef void (*BossSstActionFunc)(struct BossSst*, PlayState*); +typedef void (*BossSstActionFunc)(struct BossSst*, struct PlayState*); #define BOSS_SST_EFFECT_COUNT 18 @@ -46,8 +46,8 @@ typedef struct BossSst { /* 0x03C4 */ f32 radius; /* 0x03C8 */ Vec3f center; /* 0x03D4 */ ColliderJntSph colliderJntSph; - /* 0x03F4 */ ColliderJntSphElement colliderItems[11]; - /* 0x06B4 */ ColliderCylinder colliderCyl; + /* 0x03F4 */ ColliderJntSphElement colliderJntSphElements[11]; + /* 0x06B4 */ ColliderCylinder colliderCylinder; /* 0x0700 */ BossSstEffect effects[BOSS_SST_EFFECT_COUNT]; /* 0x09D0 */ s16 trailIndex; /* 0x09D2 */ s16 trailCount; diff --git a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst_colchk.inc.c b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst_colchk.inc.c index cc06356aa8..0016ff93d5 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst_colchk.inc.c +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst_colchk.inc.c @@ -1,6 +1,6 @@ -#include "z_boss_sst.h" +#include "z64collision_check.h" -static ColliderJntSphElementInit sJntSphItemsInitHand[11] = { +static ColliderJntSphElementInit sJntSphElementsInitHand[11] = { { { ELEM_MATERIAL_UNK1, @@ -134,10 +134,10 @@ static ColliderJntSphInit sJntSphInitHand = { COLSHAPE_JNTSPH, }, 11, - sJntSphItemsInitHand, + sJntSphElementsInitHand, }; -static ColliderJntSphElementInit sJntSphItemsInitHead[11] = { +static ColliderJntSphElementInit sJntSphElementsInitHead[11] = { { { ELEM_MATERIAL_UNK1, @@ -271,7 +271,7 @@ static ColliderJntSphInit sJntSphInitHead = { COLSHAPE_JNTSPH, }, 11, - sJntSphItemsInitHead, + sJntSphElementsInitHead, }; static ColliderCylinderInit sCylinderInitHead = { diff --git a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c index 110c3325e9..7000900b49 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -1,7 +1,33 @@ #include "z_boss_tw.h" +#include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" + +#include "libc64/math64.h" +#include "libc64/qrand.h" +#include "array_count.h" +#include "attributes.h" +#include "controller.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "rand.h" +#include "rumble.h" +#include "segmented_address.h" +#include "seqcmd.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" +#include "z64skin_matrix.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_tw/object_tw.h" -#include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" + +#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ + "ique-cn:128 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128" #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ diff --git a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h index eb2a4ef74c..df62aeff37 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h @@ -2,11 +2,11 @@ #define Z_BOSS_TW_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BossTw; -typedef void (*BossTwActionFunc)(struct BossTw* this, PlayState* play); +typedef void (*BossTwActionFunc)(struct BossTw* this, struct PlayState* play); typedef enum TwWork { /* 0 */ CS_TIMER_1, diff --git a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c index e6ac36d486..aec25c7cf2 100644 --- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -5,12 +5,32 @@ */ #include "z_boss_va.h" -#include "assets/objects/object_bv/object_bv.h" #include "overlays/actors/ovl_En_Boom/z_en_boom.h" -#include "assets/objects/gameplay_keep/gameplay_keep.h" -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:128 pal-1.0:128 pal-1.1:128" +#include "libc64/qrand.h" +#include "array_count.h" +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "rand.h" +#include "regs.h" +#include "segmented_address.h" +#include "seqcmd.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_math.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64save.h" + +#include "assets/objects/gameplay_keep/gameplay_keep.h" +#include "assets/objects/object_bv/object_bv.h" + +#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.0:0" \ + "ntsc-1.1:0 ntsc-1.2:0 pal-1.0:128 pal-1.1:128" #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ @@ -612,7 +632,9 @@ void BossVa_Init(Actor* thisx, PlayState* play2) { break; default: this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; - SkelAnime_Init(play, &this->skelAnime, &gBarinadeBariSkel, &gBarinadeBariAnim, NULL, NULL, 0); + //! @bug Flex skeleton is used as normal skeleton + SkelAnime_Init(play, &this->skelAnime, (SkeletonHeader*)&gBarinadeBariSkel, &gBarinadeBariAnim, NULL, NULL, + 0); this->actor.shape.yOffset = 400.0f; break; case BOSSVA_DOOR: @@ -680,8 +702,8 @@ void BossVa_Init(Actor* thisx, PlayState* play2) { } this->zapHeadPos.x = 1.0f; - Collider_InitCylinder(play, &this->colliderBody); - Collider_SetCylinder(play, &this->colliderBody, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->bodyCollider); + Collider_SetCylinder(play, &this->bodyCollider, &this->actor, &sCylinderInit); for (i = BOSSVA_ZAPPER_3; i >= BOSSVA_SUPPORT_1; i--) { Actor_SpawnAsChild( @@ -702,8 +724,9 @@ void BossVa_Init(Actor* thisx, PlayState* play2) { case BOSSVA_SUPPORT_1: case BOSSVA_SUPPORT_2: case BOSSVA_SUPPORT_3: - Collider_InitJntSph(play, &this->colliderSph); - Collider_SetJntSph(play, &this->colliderSph, &this->actor, &sJntSphInitSupport, this->elements); + Collider_InitJntSph(play, &this->colliderJntSph); + Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInitSupport, + this->colliderJntSphElements); if (sCsState < BOSSVA_BATTLE) { BossVa_SetupSupportIntro(this, play); } else { @@ -731,8 +754,9 @@ void BossVa_Init(Actor* thisx, PlayState* play2) { BossVa_SetupDoor(this, play); break; default: - Collider_InitJntSph(play, &this->colliderSph); - Collider_SetJntSph(play, &this->colliderSph, &this->actor, &sJntSphInitBari, this->elements); + Collider_InitJntSph(play, &this->colliderJntSph); + Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInitBari, + this->colliderJntSphElements); Collider_InitQuad(play, &this->colliderLightning); Collider_SetQuad(play, &this->colliderLightning, &this->actor, &sQuadInit); this->unk_1D8.x = 1.0f; @@ -752,8 +776,8 @@ void BossVa_Destroy(Actor* thisx, PlayState* play) { BossVa* this = (BossVa*)thisx; SkelAnime_Free(&this->skelAnime, play); - Collider_DestroyJntSph(play, &this->colliderSph); - Collider_DestroyCylinder(play, &this->colliderBody); + Collider_DestroyJntSph(play, &this->colliderJntSph); + Collider_DestroyCylinder(play, &this->bodyCollider); } void BossVa_SetupIntro(BossVa* this) { @@ -1071,9 +1095,9 @@ void BossVa_BodyPhase1(BossVa* this, PlayState* play) { } } - if (this->colliderBody.base.atFlags & AT_HIT) { - this->colliderBody.base.atFlags &= ~AT_HIT; - if (this->colliderBody.base.at == &player->actor) { + if (this->bodyCollider.base.atFlags & AT_HIT) { + this->bodyCollider.base.atFlags &= ~AT_HIT; + if (this->bodyCollider.base.at == &player->actor) { Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); } } @@ -1101,9 +1125,9 @@ void BossVa_BodyPhase1(BossVa* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_BALINADE_BL_SPARK - SFX_FLAG); } - Collider_UpdateCylinder(&this->actor, &this->colliderBody); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderBody.base); - CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderBody.base); + Collider_UpdateCylinder(&this->actor, &this->bodyCollider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->bodyCollider.base); func_800F436C(&this->actor.projectedPos, NA_SE_EN_BALINADE_LEVEL - SFX_FLAG, 1.0f); } @@ -1133,17 +1157,17 @@ void BossVa_BodyPhase2(BossVa* this, PlayState* play) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 160); this->actor.colorFilterTimer = this->invincibilityTimer; } else { - this->colliderBody.elem.acDmgInfo.dmgFlags = DMG_BOOMERANG; + this->bodyCollider.elem.acDmgInfo.dmgFlags = DMG_BOOMERANG; } } - if (this->colliderBody.base.acFlags & AC_HIT) { - this->colliderBody.base.acFlags &= ~AC_HIT; + if (this->bodyCollider.base.acFlags & AC_HIT) { + this->bodyCollider.base.acFlags &= ~AC_HIT; - if (this->colliderBody.base.ac->id == ACTOR_EN_BOOM) { + if (this->bodyCollider.base.ac->id == ACTOR_EN_BOOM) { sPhase2Timer &= 0xFE00; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 160); - this->colliderBody.elem.acDmgInfo.dmgFlags = DMG_SWORD | DMG_BOOMERANG | DMG_DEKU_STICK; + this->bodyCollider.elem.acDmgInfo.dmgFlags = DMG_SWORD | DMG_BOOMERANG | DMG_DEKU_STICK; } else { sKillBari++; if ((this->actor.colorFilterTimer != 0) && !(this->actor.colorFilterParams & 0x4000)) { @@ -1161,11 +1185,11 @@ void BossVa_BodyPhase2(BossVa* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_BALINADE_FAINT); } - if (this->colliderBody.base.atFlags & AT_HIT) { - this->colliderBody.base.atFlags &= ~AT_HIT; + if (this->bodyCollider.base.atFlags & AT_HIT) { + this->bodyCollider.base.atFlags &= ~AT_HIT; sPhase2Timer = (sPhase2Timer + 0x18) & 0xFFF0; - if (this->colliderBody.base.at == &player->actor) { + if (this->bodyCollider.base.at == &player->actor) { Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); Actor_PlaySfx(&player->actor, NA_SE_PL_BODY_HIT); } @@ -1209,14 +1233,14 @@ void BossVa_BodyPhase2(BossVa* this, PlayState* play) { this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 45.0f; - Collider_UpdateCylinder(&this->actor, &this->colliderBody); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderBody.base); + Collider_UpdateCylinder(&this->actor, &this->bodyCollider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); if (this->actor.colorFilterTimer == 0) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->bodyCollider.base); } if ((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000)) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); } func_800F436C(&this->actor.projectedPos, NA_SE_EN_BALINADE_LEVEL - SFX_FLAG, @@ -1224,7 +1248,7 @@ void BossVa_BodyPhase2(BossVa* this, PlayState* play) { } void BossVa_SetupBodyPhase3(BossVa* this) { - this->colliderBody.elem.acDmgInfo.dmgFlags = DMG_BOOMERANG; + this->bodyCollider.elem.acDmgInfo.dmgFlags = DMG_BOOMERANG; this->actor.speed = 0.0f; sPhase3StopMoving = false; BossVa_SetupAction(this, BossVa_BodyPhase3); @@ -1239,16 +1263,16 @@ void BossVa_BodyPhase3(BossVa* this, PlayState* play) { sp62 = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos); this->unk_1B0 += 0xCE4; this->bodyGlow = (s16)(Math_SinS(this->unk_1B0) * 50.0f) + 150; - if (this->colliderBody.base.atFlags & AT_HIT) { - this->colliderBody.base.atFlags &= ~AT_HIT; - if (this->colliderBody.base.at == &player->actor) { + if (this->bodyCollider.base.atFlags & AT_HIT) { + this->bodyCollider.base.atFlags &= ~AT_HIT; + if (this->bodyCollider.base.at == &player->actor) { Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); this->actor.world.rot.y += (s16)Rand_CenteredFloat(0x2EE0) + 0x8000; Actor_PlaySfx(&player->actor, NA_SE_PL_BODY_HIT); } } - if (this->colliderBody.base.acFlags & AC_HIT) { + if (this->bodyCollider.base.acFlags & AC_HIT) { this->skelAnime.curFrame = 0.0f; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 12); Actor_PlaySfx(&this->actor, NA_SE_EN_BALINADE_FAINT); @@ -1326,11 +1350,11 @@ void BossVa_BodyPhase3(BossVa* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_BALINADE_BL_SPARK - SFX_FLAG); } - Collider_UpdateCylinder(&this->actor, &this->colliderBody); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderBody.base); - CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderBody.base); + Collider_UpdateCylinder(&this->actor, &this->bodyCollider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->bodyCollider.base); if (this->timer == 0) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); } func_800F436C(&this->actor.projectedPos, NA_SE_EN_BALINADE_LEVEL - SFX_FLAG, @@ -1349,7 +1373,7 @@ void BossVa_SetupBodyPhase4(BossVa* this, PlayState* play) { this->timer = -30; } - this->colliderBody.dim.radius = 55; + this->bodyCollider.dim.radius = 55; BossVa_SetupAction(this, BossVa_BodyPhase4); } @@ -1360,9 +1384,9 @@ void BossVa_BodyPhase4(BossVa* this, PlayState* play) { this->unk_1B0 = (this->unk_1B0 + (s16)((sFightPhase - PHASE_4 + 1) * 1000.0f)) + 0xCE4; this->bodyGlow = (s16)(Math_SinS(this->unk_1B0) * 50.0f) + 150; - if (this->colliderBody.base.atFlags & AT_HIT) { - this->colliderBody.base.atFlags &= ~AT_HIT; - if (this->colliderBody.base.at == &player->actor) { + if (this->bodyCollider.base.atFlags & AT_HIT) { + this->bodyCollider.base.atFlags &= ~AT_HIT; + if (this->bodyCollider.base.at == &player->actor) { Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); this->actor.world.rot.y += (s16)Rand_CenteredFloat(0x2EE0) + 0x8000; Actor_PlaySfx(&player->actor, NA_SE_PL_BODY_HIT); @@ -1372,8 +1396,8 @@ void BossVa_BodyPhase4(BossVa* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_BALINADE_BL_SPARK - SFX_FLAG); } - if (this->colliderBody.base.acFlags & AC_HIT) { - this->colliderBody.base.acFlags &= ~AC_HIT; + if (this->bodyCollider.base.acFlags & AC_HIT) { + this->bodyCollider.base.acFlags &= ~AC_HIT; this->skelAnime.curFrame = 0.0f; if (this->timer >= 0) { if (this->invincibilityTimer == 0) { @@ -1403,8 +1427,8 @@ void BossVa_BodyPhase4(BossVa* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_BALINADE_FAINT); } } - } else if (this->colliderBody.base.ac->id == ACTOR_EN_BOOM) { - boomerang = (EnBoom*)this->colliderBody.base.ac; + } else if (this->bodyCollider.base.ac->id == ACTOR_EN_BOOM) { + boomerang = (EnBoom*)this->bodyCollider.base.ac; boomerang->returnTimer = 0; boomerang->moveTo = &player->actor; boomerang->actor.world.rot.y = boomerang->actor.yawTowardsPlayer; @@ -1428,7 +1452,7 @@ void BossVa_BodyPhase4(BossVa* this, PlayState* play) { } Math_SmoothStepToF(&this->actor.speed, ((sFightPhase - PHASE_4 + 1) * 1.5f) + 4.0f, 1.0f, 0.25f, 0.0f); } - this->colliderBody.elem.acDmgInfo.dmgFlags = DMG_BOOMERANG; + this->bodyCollider.elem.acDmgInfo.dmgFlags = DMG_BOOMERANG; } else { Math_SmoothStepToS(&this->vaBodySpinRate, 0, 1, 0x96, 0); if (this->timer > 0) { @@ -1436,7 +1460,7 @@ void BossVa_BodyPhase4(BossVa* this, PlayState* play) { this->timer = 35; } Math_SmoothStepToF(&this->actor.shape.yOffset, -480.0f, 1.0f, 30.0f, 0.0f); - this->colliderBody.elem.acDmgInfo.dmgFlags = DMG_SWORD | DMG_BOOMERANG | DMG_DEKU_STICK; + this->bodyCollider.elem.acDmgInfo.dmgFlags = DMG_SWORD | DMG_BOOMERANG | DMG_DEKU_STICK; this->timer--; } else { if ((player->stateFlags1 & PLAYER_STATE1_26) && (this->timer < -60)) { @@ -1498,13 +1522,13 @@ void BossVa_BodyPhase4(BossVa* this, PlayState* play) { } Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 70.0f, 0.0f, UPDBGCHECKINFO_FLAG_0); - Collider_UpdateCylinder(&this->actor, &this->colliderBody); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderBody.base); + Collider_UpdateCylinder(&this->actor, &this->bodyCollider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); if (this->invincibilityTimer == 0) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); } if ((this->vaBodySpinRate > 0x3E8) || (this->actor.shape.yOffset < -1200.0f)) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->bodyCollider.base); } func_800F436C(&this->actor.projectedPos, NA_SE_EN_BALINADE_LEVEL - SFX_FLAG, (this->vaBodySpinRate * 0.00025f) + 1.0f); @@ -1745,11 +1769,11 @@ void BossVa_SupportAttached(BossVa* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_BALINADE_BL_SPARK - SFX_FLAG); } - if (this->colliderSph.base.acFlags & AC_HIT) { + if (this->colliderJntSph.base.acFlags & AC_HIT) { BossVa_SetupSupportCut(this, play); } else { if (this->actor.colorFilterTimer == 0) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSph.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); } if ((this->timer % 2) == 0) { @@ -2548,23 +2572,23 @@ void BossVa_BariPhase3Attack(BossVa* this, PlayState* play) { Math_SmoothStepToS(&this->vaBariUnused.z, this->vaBariUnused.x, 1, 0x1E, 0); this->vaBariUnused.y += this->vaBariUnused.z; - if ((this->colliderLightning.base.atFlags & AT_HIT) || (this->colliderSph.base.atFlags & AT_HIT)) { - if ((this->colliderLightning.base.at == &player->actor) || (this->colliderSph.base.at == &player->actor)) { + if ((this->colliderLightning.base.atFlags & AT_HIT) || (this->colliderJntSph.base.atFlags & AT_HIT)) { + if ((this->colliderLightning.base.at == &player->actor) || (this->colliderJntSph.base.at == &player->actor)) { Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 8.0f, GET_BODY(this)->actor.yawTowardsPlayer, 8.0f); Actor_PlaySfx(&player->actor, NA_SE_PL_BODY_HIT); - this->colliderSph.base.at = NULL; + this->colliderJntSph.base.at = NULL; this->colliderLightning.base.at = NULL; } this->colliderLightning.base.atFlags &= ~AT_HIT; - this->colliderSph.base.atFlags &= ~AT_HIT; + this->colliderJntSph.base.atFlags &= ~AT_HIT; } - if (this->colliderSph.base.acFlags & AC_HIT) { - this->colliderSph.base.acFlags &= ~AC_HIT; - if ((this->colliderSph.base.ac->id == ACTOR_EN_BOOM) && (sp52 >= 128)) { - boomerang = (EnBoom*)this->colliderSph.base.ac; + if (this->colliderJntSph.base.acFlags & AC_HIT) { + this->colliderJntSph.base.acFlags &= ~AC_HIT; + if ((this->colliderJntSph.base.ac->id == ACTOR_EN_BOOM) && (sp52 >= 128)) { + boomerang = (EnBoom*)this->colliderJntSph.base.ac; boomerang->returnTimer = 0; boomerang->moveTo = &player->actor; boomerang->actor.world.rot.y = boomerang->actor.yawTowardsPlayer; @@ -2587,14 +2611,14 @@ void BossVa_BariPhase3Attack(BossVa* this, PlayState* play) { if (sp52 >= 128) { BossVa_Spark(play, this, 1, 75, 15.0f, 7.0f, SPARK_TETHER, 1.0f, true); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSph.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); sPhase3StopMoving = false; } else { sPhase3StopMoving = true; } CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderLightning.base); - CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderSph.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderJntSph.base); if ((play->gameplayFrames % 4) == 0) { Math_SmoothStepToS(&this->unk_1F0, 0x78, 1, 0xA, 0); } @@ -2644,17 +2668,17 @@ void BossVa_BariPhase2Attack(BossVa* this, PlayState* play) { return; } - if ((this->colliderLightning.base.atFlags & AT_HIT) || (this->colliderSph.base.atFlags & AT_HIT)) { - if ((this->colliderLightning.base.at == &player->actor) || (this->colliderSph.base.at == &player->actor)) { + if ((this->colliderLightning.base.atFlags & AT_HIT) || (this->colliderJntSph.base.atFlags & AT_HIT)) { + if ((this->colliderLightning.base.at == &player->actor) || (this->colliderJntSph.base.at == &player->actor)) { Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 8.0f, GET_BODY(this)->actor.yawTowardsPlayer, 8.0f); Actor_PlaySfx(&player->actor, NA_SE_PL_BODY_HIT); - this->colliderSph.base.at = NULL; + this->colliderJntSph.base.at = NULL; this->colliderLightning.base.at = NULL; } this->colliderLightning.base.atFlags &= ~AT_HIT; - this->colliderSph.base.atFlags &= ~AT_HIT; + this->colliderJntSph.base.atFlags &= ~AT_HIT; } Math_SmoothStepToF(&this->actor.world.pos.y, 4.0f, 1.0f, 2.0f, 0.0f); @@ -2675,11 +2699,11 @@ void BossVa_BariPhase2Attack(BossVa* this, PlayState* play) { Math_SmoothStepToF(&this->unk_1A0, (Math_SinS(sPhase2Timer * 0x190) * sp4C) + 320.0f, 1.0f, 10.0f, 0.0f); Math_SmoothStepToS(&this->unk_1AC, sp50 + 0x1F4, 1, 0x3C, 0); this->actor.world.pos.y += 2.0f * Math_SinF(this->unk_1A4); - if (this->colliderSph.base.acFlags & AC_HIT) { - this->colliderSph.base.acFlags &= ~AC_HIT; + if (this->colliderJntSph.base.acFlags & AC_HIT) { + this->colliderJntSph.base.acFlags &= ~AC_HIT; - if ((this->colliderSph.base.ac->id == ACTOR_EN_BOOM) && (sp52 >= 64)) { - boomerang = (EnBoom*)this->colliderSph.base.ac; + if ((this->colliderJntSph.base.ac->id == ACTOR_EN_BOOM) && (sp52 >= 64)) { + boomerang = (EnBoom*)this->colliderJntSph.base.ac; boomerang->returnTimer = 0; boomerang->moveTo = &player->actor; boomerang->actor.world.rot.y = boomerang->actor.yawTowardsPlayer; @@ -2688,7 +2712,7 @@ void BossVa_BariPhase2Attack(BossVa* this, PlayState* play) { } CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderLightning.base); - CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderSph.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderJntSph.base); } else { this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; Math_SmoothStepToS(&this->unk_1AC, sp50 + 150, 1, 0x3C, 0); @@ -2703,13 +2727,13 @@ void BossVa_BariPhase2Attack(BossVa* this, PlayState* play) { } this->actor.world.pos.y += Math_SinF(this->unk_1A4) * 4.0f; - if (this->colliderSph.base.acFlags & AC_HIT) { + if (this->colliderJntSph.base.acFlags & AC_HIT) { BossVa_KillBari(this, play); } } Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 1, 0x5DC, 0); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSph.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); if ((play->gameplayFrames % 4) == 0) { Math_SmoothStepToS(&this->unk_1F0, 0x78, 1, 0xA, 0); } @@ -2742,7 +2766,7 @@ void BossVa_BariPhase3Stunned(BossVa* this, PlayState* play) { Vec3f sp40 = GET_BODY(this)->unk_1D8; this->actor.world.rot.x = Math_Vec3f_Pitch(&GET_BODY(this)->actor.world.pos, &this->actor.world.pos); - if (this->colliderSph.base.acFlags & AC_HIT) { + if (this->colliderJntSph.base.acFlags & AC_HIT) { BossVa_KillBari(this, play); return; } @@ -2750,7 +2774,7 @@ void BossVa_BariPhase3Stunned(BossVa* this, PlayState* play) { this->unk_1A4 += Rand_ZeroOne() * 0.5f; Math_SmoothStepToF(&this->actor.world.pos.y, 4.0f, 1.0f, 2.0f, 0.0f); this->actor.world.pos.y += Math_SinF(this->unk_1A4) * 3.0f; - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSph.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); if ((play->gameplayFrames % 4) == 0) { Math_SmoothStepToS(&this->unk_1F0, 0x28, 1, 0xA, 0); BossVa_Spark(play, this, 1, this->unk_1F0, 25.0f, 20.0f, SPARK_BARI, 2.0f, true); @@ -2819,10 +2843,10 @@ void BossVa_Update(Actor* thisx, PlayState* play2) { switch (this->actor.params) { case BOSSVA_BODY: - if (this->colliderBody.base.acFlags & AC_HIT) { - this->colliderBody.base.acFlags &= ~AC_HIT; - if (this->colliderBody.base.ac->id == ACTOR_EN_BOOM) { - boomerang = (EnBoom*)this->colliderBody.base.ac; + if (this->bodyCollider.base.acFlags & AC_HIT) { + this->bodyCollider.base.acFlags &= ~AC_HIT; + if (this->bodyCollider.base.ac->id == ACTOR_EN_BOOM) { + boomerang = (EnBoom*)this->bodyCollider.base.ac; boomerang->returnTimer = 0; } } @@ -2972,7 +2996,7 @@ void BossVa_SupportPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec switch (limbIndex) { case 4: Matrix_MultVec3f(&sZeroVec, &this->actor.focus.pos); - Collider_UpdateSpheres(0, &this->colliderSph); + Collider_UpdateSpheres(0, &this->colliderJntSph); break; case 7: Matrix_MultVec3f(&sZeroVec, &this->armTip); @@ -3228,7 +3252,7 @@ void BossVa_Draw(Actor* thisx, PlayState* play) { if (!this->isDead) { SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, BossVa_BariOverrideLimbDraw, BossVa_BariPostLimbDraw, this); - Collider_UpdateSpheres(0, &this->colliderSph); + Collider_UpdateSpheres(0, &this->colliderJntSph); if (sCsState < BOSSVA_BATTLE) { spBC = GET_BODY(this)->actor.world.pos; } else { diff --git a/src/overlays/actors/ovl_Boss_Va/z_boss_va.h b/src/overlays/actors/ovl_Boss_Va/z_boss_va.h index f5e6c8a896..628831ad2f 100644 --- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.h +++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.h @@ -2,11 +2,11 @@ #define Z_BOSS_VA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct BossVa; -typedef void (*BossVaActionFunc)(struct BossVa*, PlayState*); +typedef void (*BossVaActionFunc)(struct BossVa*, struct PlayState*); typedef struct BossVa { /* 0x0000 */ Actor actor; @@ -41,9 +41,9 @@ typedef struct BossVa { /* 0x01FC */ Vec3f effectPos[10]; /* 0x0274 */ Vec3f unk_274; // Unused body position /* 0x0280 */ Vec3f unk_280; // Unused body position - /* 0x028C */ ColliderCylinder colliderBody; - /* 0x02D8 */ ColliderJntSph colliderSph; - /* 0x02F8 */ ColliderJntSphElement elements[1]; + /* 0x028C */ ColliderCylinder bodyCollider; + /* 0x02D8 */ ColliderJntSph colliderJntSph; + /* 0x02F8 */ ColliderJntSphElement colliderJntSphElements[1]; /* 0x0338 */ ColliderQuad colliderLightning; } BossVa; // size = 0x03B8 diff --git a/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c b/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c index 7657cf7432..1673a99601 100644 --- a/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c +++ b/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c @@ -5,11 +5,27 @@ */ #include "z_demo_6k.h" +#include "overlays/actors/ovl_Eff_Dust/z_eff_dust.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "rand.h" +#include "segmented_address.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" #include "terminal.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64effect.h" +#include "z64light.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_demo_6k/object_demo_6k.h" #include "assets/objects/object_gnd_magic/object_gnd_magic.h" -#include "overlays/actors/ovl_Eff_Dust/z_eff_dust.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_Demo_6K/z_demo_6k.h b/src/overlays/actors/ovl_Demo_6K/z_demo_6k.h index 09d9c175fb..5849ccc236 100644 --- a/src/overlays/actors/ovl_Demo_6K/z_demo_6k.h +++ b/src/overlays/actors/ovl_Demo_6K/z_demo_6k.h @@ -2,11 +2,12 @@ #define Z_DEMO_6K_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" +#include "z64light.h" struct Demo6K; -typedef void (*Demo6KActionFunc)(struct Demo6K*, PlayState*); +typedef void (*Demo6KActionFunc)(struct Demo6K*, struct PlayState*); typedef struct Demo6K { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Demo_Du/z_demo_du.c b/src/overlays/actors/ovl_Demo_Du/z_demo_du.c index a5e7139f07..d3d275de9e 100644 --- a/src/overlays/actors/ovl_Demo_Du/z_demo_du.c +++ b/src/overlays/actors/ovl_Demo_Du/z_demo_du.c @@ -1,8 +1,23 @@ #include "z_demo_du.h" -#include "assets/objects/object_du/object_du.h" #include "overlays/actors/ovl_Demo_Effect/z_demo_effect.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "regs.h" +#include "segmented_address.h" +#include "sfx.h" #include "terminal.h" +#include "translation.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/object_du/object_du.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -907,8 +922,8 @@ void DemoDu_CsCredits_HandleCues(DemoDu* this, PlayState* play) { DemoDu_CsCredits_AdvanceTo04(this); break; default: - // "Demo_Du_inEnding_Check_DemoMode:There is no such operation!!!!!!!!" - PRINTF("Demo_Du_inEnding_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); + PRINTF(T("Demo_Du_inEnding_Check_DemoMode:そんな動作は無い!!!!!!!!\n", + "Demo_Du_inEnding_Check_DemoMode: There is no such action!!!!!!!!\n")); break; } this->cueId = nextCueId; @@ -964,8 +979,8 @@ void DemoDu_Update(Actor* thisx, PlayState* play) { DemoDu* this = (DemoDu*)thisx; if (this->updateIndex < 0 || this->updateIndex >= 29 || sUpdateFuncs[this->updateIndex] == NULL) { - // "The main mode is abnormal!!!!!!!!!!!!!!!!!!!!!!!!!" - PRINTF(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The main mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } sUpdateFuncs[this->updateIndex](this, play); @@ -1035,8 +1050,8 @@ void DemoDu_Draw(Actor* thisx, PlayState* play) { DemoDu* this = (DemoDu*)thisx; if (this->drawIndex < 0 || this->drawIndex >= 3 || sDrawFuncs[this->drawIndex] == NULL) { - // "The drawing mode is abnormal!!!!!!!!!!!!!!!!!!!!!!!!!" - PRINTF(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The drawing mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } sDrawFuncs[this->drawIndex](thisx, play); diff --git a/src/overlays/actors/ovl_Demo_Du/z_demo_du.h b/src/overlays/actors/ovl_Demo_Du/z_demo_du.h index d46f03145e..ede2756e05 100644 --- a/src/overlays/actors/ovl_Demo_Du/z_demo_du.h +++ b/src/overlays/actors/ovl_Demo_Du/z_demo_du.h @@ -2,7 +2,7 @@ #define Z_DEMO_DU_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct DemoDu; diff --git a/src/overlays/actors/ovl_Demo_Du/z_demo_du_cutscene_data.inc.c b/src/overlays/actors/ovl_Demo_Du/z_demo_du_cutscene_data.inc.c index 06dbb35c11..ad83a24185 100644 --- a/src/overlays/actors/ovl_Demo_Du/z_demo_du_cutscene_data.inc.c +++ b/src/overlays/actors/ovl_Demo_Du/z_demo_du_cutscene_data.inc.c @@ -1,5 +1,6 @@ -#include "z_demo_du.h" +#include "sequence.h" #include "z64cutscene_commands.h" +#include "z64player.h" // clang-format off static CutsceneData gFireMedallionCs[] = { diff --git a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c index 3f19529df0..c2c86d8a04 100644 --- a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c +++ b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c @@ -5,7 +5,18 @@ */ #include "z_demo_ec.h" + +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "segmented_address.h" #include "terminal.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_zo/object_zo.h" #include "assets/objects/object_ec/object_ec.h" #include "assets/objects/object_ma2/object_ma2.h" @@ -158,7 +169,8 @@ void DemoEc_Init(Actor* thisx, PlayState* play) { DemoEc* this = (DemoEc*)thisx; if ((this->actor.params < 0) || (this->actor.params > 34)) { - PRINTF(VT_FGCOL(RED) "Demo_Ec_Actor_ct:arg_dataがおかしい!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("Demo_Ec_Actor_ct:arg_dataがおかしい!!!!!!!!!!!!\n", + "Demo_Ec_Actor_ct:arg_data is strange!!!!!!!!!!!!\n") VT_RST); Actor_Kill(&this->actor); } else { this->updateMode = EC_UPDATE_COMMON; @@ -320,7 +332,7 @@ void DemoEc_UseDrawObject(DemoEc* this, PlayState* play) { OPEN_DISPS(gfxCtx, "../z_demo_ec.c", 662); gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[drawObjectSlot].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[drawObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[drawObjectSlot].segment); if (!play) {} CLOSE_DISPS(gfxCtx, "../z_demo_ec.c", 670); @@ -329,7 +341,7 @@ void DemoEc_UseDrawObject(DemoEc* this, PlayState* play) { void DemoEc_UseAnimationObject(DemoEc* this, PlayState* play) { s32 animObjectSlot = this->animObjectSlot; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[animObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[animObjectSlot].segment); } CsCmdActorCue* DemoEc_GetCue(PlayState* play, s32 cueChannel) { @@ -691,7 +703,7 @@ Gfx* DemoEc_GetCarpenterPostLimbDList(DemoEc* this) { case 13: return object_daiku_DL_005880; default: - PRINTF(VT_FGCOL(RED) "かつらが無い!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("かつらが無い!!!!!!!!!!!!!!!!\n", "No wig!!!!!!!!!!!!!!!!\n") VT_RST); return NULL; } } @@ -737,7 +749,7 @@ Gfx* DemoEc_GetGerudoPostLimbDList(DemoEc* this) { case 18: return gGerudoWhiteHairstyleSpikyDL; default: - PRINTF(VT_FGCOL(RED) "かつらが無い!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("かつらが無い!!!!!!!!!!!!!!!!\n", "No wig!!!!!!!!!!!!!!!!\n") VT_RST); return NULL; } } @@ -1248,8 +1260,9 @@ void DemoEc_InitNpc(DemoEc* this, PlayState* play) { s16 type = this->actor.params; if (sInitFuncs[type] == NULL) { - // "Demo_Ec_main_init: Initialization process is wrong arg_data" - PRINTF(VT_FGCOL(RED) " Demo_Ec_main_init:初期化処理がおかしいarg_data = %d!\n" VT_RST, type); + PRINTF(VT_FGCOL(RED) T(" Demo_Ec_main_init:初期化処理がおかしいarg_data = %d!\n", + " Demo_Ec_main_init: Initialization process is wrong arg_data = %d!\n") VT_RST, + type); Actor_Kill(&this->actor); return; } @@ -1273,8 +1286,9 @@ void DemoEc_InitCommon(DemoEc* this, PlayState* play) { secondaryObjectSlot = Object_GetSlot(&play->objectCtx, sp28); if ((secondaryObjectSlot < 0) || (primaryObjectSlot < 0)) { - // "Demo_Ec_main_bank: Bank unreadable arg_data = %d!" - PRINTF(VT_FGCOL(RED) "Demo_Ec_main_bank:バンクを読めない arg_data = %d!\n" VT_RST, type); + PRINTF(VT_FGCOL(RED) T("Demo_Ec_main_bank:バンクを読めない arg_data = %d!\n", + "Demo_Ec_main_bank: Bank unreadable arg_data = %d!\n") VT_RST, + type); Actor_Kill(&this->actor); return; } @@ -1326,8 +1340,8 @@ void DemoEc_Update(Actor* thisx, PlayState* play) { s32 updateMode = this->updateMode; if ((updateMode < 0) || (updateMode >= ARRAY_COUNT(sUpdateFuncs)) || sUpdateFuncs[updateMode] == NULL) { - // "The main mode is strange !!!!!!!!!!!!!!!!!!!!!!!!!" - PRINTF(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The main mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); } else { if (updateMode != EC_UPDATE_COMMON) { DemoEc_UseAnimationObject(this, play); @@ -1359,8 +1373,8 @@ void DemoEc_Draw(Actor* thisx, PlayState* play) { s32 drawConfig = this->drawConfig; if ((drawConfig < 0) || (drawConfig >= ARRAY_COUNT(sDrawFuncs)) || sDrawFuncs[drawConfig] == NULL) { - // "The main mode is strange !!!!!!!!!!!!!!!!!!!!!!!!!" - PRINTF(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The drawing mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); } else { if (drawConfig != EC_DRAW_COMMON) { DemoEc_UseDrawObject(this, play); diff --git a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.h b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.h index fe71483505..494338b27d 100644 --- a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.h +++ b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.h @@ -2,13 +2,13 @@ #define Z_DEMO_EC_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct DemoEc; -typedef void (*DemoEcInitFunc)(struct DemoEc*, PlayState*); -typedef void (*DemoEcUpdateFunc)(struct DemoEc*, PlayState*); -typedef void (*DemoEcDrawFunc)(struct DemoEc*, PlayState*); +typedef void (*DemoEcInitFunc)(struct DemoEc*, struct PlayState*); +typedef void (*DemoEcUpdateFunc)(struct DemoEc*, struct PlayState*); +typedef void (*DemoEcDrawFunc)(struct DemoEc*, struct PlayState*); typedef struct DemoEc { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c index df54812326..d422af550e 100644 --- a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c +++ b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c @@ -5,6 +5,7 @@ #include "attributes.h" #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "rand.h" #include "segmented_address.h" #include "sequence.h" @@ -16,10 +17,11 @@ #include "z_lib.h" #include "z64audio.h" #include "z64curve.h" +#include "z64draw.h" +#include "z64cutscene_flags.h" #include "z64effect.h" #include "z64play.h" - -#include "global.h" +#include "z64save.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_efc_crystal_light/object_efc_crystal_light.h" diff --git a/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c b/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c index caae4cff14..8720d49df2 100644 --- a/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c +++ b/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c @@ -5,7 +5,18 @@ */ #include "z_demo_ext.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "regs.h" +#include "sfx.h" +#include "sys_matrix.h" #include "terminal.h" +#include "translation.h" +#include "z64play.h" +#include "z64skin.h" + #include "assets/objects/object_fhg/object_fhg.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -111,8 +122,8 @@ void DemoExt_HandleCues(DemoExt* this, PlayState* play) { DemoExt_SetupDispellVortex(this); break; default: - // "Demo_Ext_Check_DemoMode: there is no such action!" - PRINTF("Demo_Ext_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); + PRINTF(T("Demo_Ext_Check_DemoMode:そんな動作は無い!!!!!!!!\n", + "Demo_Ext_Check_DemoMode: There is no such action!!!!!!!!\n")); break; } this->cueId = nextCueId; @@ -174,8 +185,8 @@ void DemoExt_Update(Actor* thisx, PlayState* play) { DemoExt* this = (DemoExt*)thisx; if ((this->action < EXT_WAIT) || (this->action > EXT_DISPELL) || sActionFuncs[this->action] == NULL) { - // "Main mode is abnormal!" - PRINTF(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The main mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); } else { sActionFuncs[this->action](this, play); } @@ -228,8 +239,8 @@ void DemoExt_Draw(Actor* thisx, PlayState* play) { if ((this->drawMode < EXT_DRAW_NOTHING) || (this->drawMode > EXT_DRAW_VORTEX) || sDrawFuncs[this->drawMode] == NULL) { - // "Draw mode is abnormal!" - PRINTF(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The drawing mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); } else { sDrawFuncs[this->drawMode](thisx, play); } diff --git a/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.h b/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.h index dbed1bf1f9..2eadc4af69 100644 --- a/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.h +++ b/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.h @@ -2,12 +2,12 @@ #define Z_DEMO_EXT_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct DemoExt; -typedef void (*DemoExtActionFunc)(struct DemoExt*, PlayState*); -typedef void (*DemoExtDrawFunc)(Actor*, PlayState*); +typedef void (*DemoExtActionFunc)(struct DemoExt*, struct PlayState*); +typedef void (*DemoExtDrawFunc)(Actor*, struct PlayState*); typedef struct DemoExt { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c index f0b240070d..5446d622fb 100644 --- a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c +++ b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c @@ -5,8 +5,19 @@ */ #include "z_demo_geff.h" -#include "assets/objects/object_geff/object_geff.h" +#include "overlays/actors/ovl_Demo_Gt/z_demo_gt.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "regs.h" +#include "segmented_address.h" +#include "sys_matrix.h" #include "terminal.h" +#include "translation.h" +#include "z64play.h" + +#include "assets/objects/object_geff/object_geff.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) @@ -61,7 +72,8 @@ void DemoGeff_Init(Actor* thisx, PlayState* play) { DemoGeff* this = (DemoGeff*)thisx; if (this->actor.params < 0 || this->actor.params >= 9) { - PRINTF(VT_FGCOL(RED) "Demo_Geff_Actor_ct:arg_dataがおかしい!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("Demo_Geff_Actor_ct:arg_dataがおかしい!!!!!!!!!!!!\n", + "Demo_Geff_Actor_ct:arg_data is strange!!!!!!!!!!!!\n") VT_RST); Actor_Kill(&this->actor); return; } @@ -92,7 +104,7 @@ void func_80977F80(DemoGeff* this, PlayState* play) { OPEN_DISPS(gfxCtx, "../z_demo_geff.c", 204); gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[objectSlot].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); // Necessary to match if (!play) {} @@ -179,7 +191,9 @@ void func_80978370(DemoGeff* this, PlayState* play) { s16 params = this->actor.params; DemoGeffInitFunc initFunc = sInitFuncs[params]; if (initFunc == NULL) { - PRINTF(VT_FGCOL(RED) " Demo_Geff_main_init:初期化処理がおかしいarg_data = %d!\n" VT_RST, params); + PRINTF(VT_FGCOL(RED) T(" Demo_Geff_main_init:初期化処理がおかしいarg_data = %d!\n", + " Demo_Geff_main_init: Initialization process is wrong arg_data = %d!\n") VT_RST, + params); Actor_Kill(&this->actor); return; } @@ -195,7 +209,9 @@ void func_809783D4(DemoGeff* this, PlayState* play) { s32 pad; if (objectSlot < 0) { - PRINTF(VT_FGCOL(RED) "Demo_Geff_main_bank:バンクを読めない arg_data = %d!\n" VT_RST, params); + PRINTF(VT_FGCOL(RED) T("Demo_Geff_main_bank:バンクを読めない arg_data = %d!\n", + "Demo_Geff_main_bank: Bank unreadable arg_data = %d!\n") VT_RST, + params); Actor_Kill(thisx); return; } @@ -209,7 +225,8 @@ void DemoGeff_Update(Actor* thisx, PlayState* play) { DemoGeff* this = (DemoGeff*)thisx; if (this->action < 0 || this->action >= 2 || sActionFuncs[this->action] == NULL) { - PRINTF(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The main mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } sActionFuncs[this->action](this, play); @@ -223,7 +240,8 @@ void DemoGeff_Draw(Actor* thisx, PlayState* play) { s32 drawConfig = this->drawConfig; if (drawConfig < 0 || drawConfig >= 2 || sDrawFuncs[drawConfig] == NULL) { - PRINTF(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The drawing mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } if (drawConfig != 0) { diff --git a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.h b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.h index ca719594ad..03c6110fae 100644 --- a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.h +++ b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.h @@ -2,22 +2,20 @@ #define Z_DEMO_GEFF_H #include "ultra64.h" -#include "global.h" - -#include "../ovl_Demo_Gt/z_demo_gt.h" +#include "z64actor.h" struct DemoGeff; -typedef void (*DemoGeffInitFunc)(struct DemoGeff*, PlayState*); -typedef void (*DemoGeffActionFunc)(struct DemoGeff*, PlayState*); -typedef void (*DemoGeffDrawFunc)(struct DemoGeff*, PlayState*); +typedef void (*DemoGeffInitFunc)(struct DemoGeff*, struct PlayState*); +typedef void (*DemoGeffActionFunc)(struct DemoGeff*, struct PlayState*); +typedef void (*DemoGeffDrawFunc)(struct DemoGeff*, struct PlayState*); typedef struct DemoGeff { /* 0x0000 */ Actor actor; /* 0x014C */ s32 action; /* 0x0150 */ s32 drawConfig; /* 0x0154 */ s32 objectSlot; - /* 0x0158 */ DemoGt* demoGt; + /* 0x0158 */ struct DemoGt* demoGt; /* 0x015C */ f32 deltaPosX; /* 0x0160 */ f32 deltaPosY; /* 0x0164 */ f32 deltaPosZ; diff --git a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c index 467f27aa3d..e7e6afe3a4 100644 --- a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c +++ b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c @@ -7,19 +7,24 @@ #include "z_demo_gj.h" #include "libc64/math64.h" +#include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" +#include "printf.h" #include "regs.h" #include "sfx.h" #include "sys_matrix.h" #include "terminal.h" +#include "translation.h" +#include "z_en_item00.h" #include "z_lib.h" +#include "z64draw.h" #include "z64effect.h" #include "z64play.h" #include "z64player.h" - -#include "global.h" +#include "z64save.h" #include "assets/objects/object_gj/object_gj.h" @@ -127,19 +132,19 @@ s32 DemoGj_HitByExplosion(DemoGj* this, PlayState* play, ColliderCylinder* cylin void DemoGj_DestroyCylinder(DemoGj* this, PlayState* play) { switch (DemoGj_GetType(this)) { case DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_1: - Collider_DestroyCylinder(play, &this->cylinders[0]); - Collider_DestroyCylinder(play, &this->cylinders[1]); - Collider_DestroyCylinder(play, &this->cylinders[2]); + Collider_DestroyCylinder(play, &this->colliderCylinders[0]); + Collider_DestroyCylinder(play, &this->colliderCylinders[1]); + Collider_DestroyCylinder(play, &this->colliderCylinders[2]); break; case DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_2: - Collider_DestroyCylinder(play, &this->cylinders[0]); - Collider_DestroyCylinder(play, &this->cylinders[1]); - Collider_DestroyCylinder(play, &this->cylinders[2]); + Collider_DestroyCylinder(play, &this->colliderCylinders[0]); + Collider_DestroyCylinder(play, &this->colliderCylinders[1]); + Collider_DestroyCylinder(play, &this->colliderCylinders[2]); break; case DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_TALL: - Collider_DestroyCylinder(play, &this->cylinders[0]); + Collider_DestroyCylinder(play, &this->colliderCylinders[0]); break; } } @@ -234,15 +239,17 @@ s32 DemoGj_FindGanon(DemoGj* this, PlayState* play) { if (actor->id == ACTOR_BOSS_GANON2) { this->ganon = (BossGanon2*)actor; - // "Demo_Gj_Search_Boss_Ganon %d: Discover Ganon !!!!" - PRINTF("Demo_Gj_Search_Boss_Ganon %d:ガノン発見!!!!\n", this->dyna.actor.params); + PRINTF(T("Demo_Gj_Search_Boss_Ganon %d:ガノン発見!!!!\n", + "Demo_Gj_Search_Boss_Ganon %d: Ganon is discovered!!!!\n"), + this->dyna.actor.params); return true; } actor = actor->next; } - // "Demo_Gj_Search_Boss_Ganon %d: I couldn't find Ganon" - PRINTF("Demo_Gj_Search_Boss_Ganon %d:ガノン発見出来ず\n", this->dyna.actor.params); + PRINTF(T("Demo_Gj_Search_Boss_Ganon %d:ガノン発見出来ず\n", + "Demo_Gj_Search_Boss_Ganon %d: Unable to find Ganon\n"), + this->dyna.actor.params); return false; } //! @bug Missing return value when `this->ganon` is already set. No caller uses the return value @@ -399,8 +406,8 @@ void DemoGj_SetupRotation(DemoGj* this, PlayState* play) { break; default: - // "Demo_Gj_common_Reflect : This arg_data is not supported = %d" - PRINTF(VT_FGCOL(RED) "Demo_Gj_common_Reflect : そんなarg_dataには対応していない = %d\n" VT_RST, + PRINTF(VT_FGCOL(RED) T("Demo_Gj_common_Reflect : そんなarg_dataには対応していない = %d\n", + "Demo_Gj_common_Reflect : This arg_data is not supported = %d\n") VT_RST, this->dyna.actor.params); return; } @@ -553,8 +560,8 @@ void DemoGj_SetupMovement(DemoGj* this, PlayState* play) { break; default: - // "Demo_Gj_Setup_Move_common : This arg_data is not supported = %d" - PRINTF(VT_FGCOL(RED) "Demo_Gj_Setup_Move_common : そんなarg_dataには対応していない = %d\n" VT_RST, + PRINTF(VT_FGCOL(RED) T("Demo_Gj_Setup_Move_common : そんなarg_dataには対応していない = %d\n", + "Demo_Gj_Setup_Move_common : This arg_data is not supported = %d\n") VT_RST, actor->params); break; } @@ -986,9 +993,9 @@ void DemoGj_DrawRubbleAroundArena(DemoGj* this, PlayState* play) { // Inits the three cylinders with `sCylinderInit1` void DemoGj_InitDestructableRubble1(DemoGj* this, PlayState* play) { DemoGj_InitSetIndices(this, play, 15, 0, NULL); - DemoGj_InitCylinder(this, play, &this->cylinders[0], &sCylinderInit1); - DemoGj_InitCylinder(this, play, &this->cylinders[1], &sCylinderInit1); - DemoGj_InitCylinder(this, play, &this->cylinders[2], &sCylinderInit1); + DemoGj_InitCylinder(this, play, &this->colliderCylinders[0], &sCylinderInit1); + DemoGj_InitCylinder(this, play, &this->colliderCylinders[1], &sCylinderInit1); + DemoGj_InitCylinder(this, play, &this->colliderCylinders[2], &sCylinderInit1); } #if DEBUG_FEATURES @@ -1001,9 +1008,9 @@ void DemoGj_DoNothing1(DemoGj* this, PlayState* play) { * Used by DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_1 */ void func_8097AEE8(DemoGj* this, PlayState* play) { - ColliderCylinder* cylinder0 = &this->cylinders[0]; - ColliderCylinder* cylinder1 = &this->cylinders[1]; - ColliderCylinder* cylinder2 = &this->cylinders[2]; + ColliderCylinder* cylinder0 = &this->colliderCylinders[0]; + ColliderCylinder* cylinder1 = &this->colliderCylinders[1]; + ColliderCylinder* cylinder2 = &this->colliderCylinders[2]; Vec3f* actorPos = &this->dyna.actor.world.pos; s32 pad; s16 theta = this->dyna.actor.world.rot.y; @@ -1025,9 +1032,9 @@ void func_8097AEE8(DemoGj* this, PlayState* play) { void DemoGj_SetCylindersAsAC(DemoGj* this, PlayState* play) { s32 pad[2]; - Collider* cylinder0 = &this->cylinders[0].base; - Collider* cylinder1 = &this->cylinders[1].base; - Collider* cylinder2 = &this->cylinders[2].base; + Collider* cylinder0 = &this->colliderCylinders[0].base; + Collider* cylinder1 = &this->colliderCylinders[1].base; + Collider* cylinder2 = &this->colliderCylinders[2].base; s32 pad2[3]; CollisionCheck_SetAC(play, &play->colChkCtx, cylinder0); @@ -1059,13 +1066,13 @@ void func_8097B128(DemoGj* this, PlayState* play) { } s32 DemoGj_HasCylinderAnyExploded(DemoGj* this, PlayState* play) { - if (DemoGj_HitByExplosion(this, play, &this->cylinders[0])) { + if (DemoGj_HitByExplosion(this, play, &this->colliderCylinders[0])) { return true; } - if (DemoGj_HitByExplosion(this, play, &this->cylinders[1])) { + if (DemoGj_HitByExplosion(this, play, &this->colliderCylinders[1])) { return true; } - if (DemoGj_HitByExplosion(this, play, &this->cylinders[2])) { + if (DemoGj_HitByExplosion(this, play, &this->colliderCylinders[2])) { return true; } return false; @@ -1123,9 +1130,9 @@ void DemoGj_DrawDestructableRubble1(DemoGj* this, PlayState* play) { // Inits the three cylinders with `sCylinderInit2` void DemoGj_InitDestructableRubble2(DemoGj* this, PlayState* play) { DemoGj_InitSetIndices(this, play, 16, 0, NULL); - DemoGj_InitCylinder(this, play, &this->cylinders[0], &sCylinderInit2); - DemoGj_InitCylinder(this, play, &this->cylinders[1], &sCylinderInit2); - DemoGj_InitCylinder(this, play, &this->cylinders[2], &sCylinderInit2); + DemoGj_InitCylinder(this, play, &this->colliderCylinders[0], &sCylinderInit2); + DemoGj_InitCylinder(this, play, &this->colliderCylinders[1], &sCylinderInit2); + DemoGj_InitCylinder(this, play, &this->colliderCylinders[2], &sCylinderInit2); } #if DEBUG_FEATURES @@ -1135,9 +1142,9 @@ void DemoGj_DoNothing2(DemoGj* this, PlayState* play) { // Moves the ColliderCylinder's relative to the actor's position. void func_8097B450(DemoGj* this, PlayState* play) { - ColliderCylinder* cylinder0 = &this->cylinders[0]; - ColliderCylinder* cylinder1 = &this->cylinders[1]; - ColliderCylinder* cylinder2 = &this->cylinders[2]; + ColliderCylinder* cylinder0 = &this->colliderCylinders[0]; + ColliderCylinder* cylinder1 = &this->colliderCylinders[1]; + ColliderCylinder* cylinder2 = &this->colliderCylinders[2]; Vec3f* actorPos = &this->dyna.actor.world.pos; s32 pad; s16 theta = this->dyna.actor.world.rot.y; @@ -1159,9 +1166,9 @@ void func_8097B450(DemoGj* this, PlayState* play) { void DemoGj_SetCylindersAsAC2(DemoGj* this, PlayState* play) { s32 pad[2]; - Collider* cylinder0 = &this->cylinders[0].base; - Collider* cylinder1 = &this->cylinders[1].base; - Collider* cylinder2 = &this->cylinders[2].base; + Collider* cylinder0 = &this->colliderCylinders[0].base; + Collider* cylinder1 = &this->colliderCylinders[1].base; + Collider* cylinder2 = &this->colliderCylinders[2].base; s32 pad2[3]; CollisionCheck_SetAC(play, &play->colChkCtx, cylinder0); @@ -1171,13 +1178,13 @@ void DemoGj_SetCylindersAsAC2(DemoGj* this, PlayState* play) { // Does the same as `DemoGj_HasCylinderAnyExploded` s32 DemoGj_HasCylinderAnyExploded2(DemoGj* this, PlayState* play) { - if (DemoGj_HitByExplosion(this, play, &this->cylinders[0])) { + if (DemoGj_HitByExplosion(this, play, &this->colliderCylinders[0])) { return true; } - if (DemoGj_HitByExplosion(this, play, &this->cylinders[1])) { + if (DemoGj_HitByExplosion(this, play, &this->colliderCylinders[1])) { return true; } - if (DemoGj_HitByExplosion(this, play, &this->cylinders[2])) { + if (DemoGj_HitByExplosion(this, play, &this->colliderCylinders[2])) { return true; } return false; @@ -1258,7 +1265,7 @@ void DemoGj_DemoGj_InitDestructableRubble2(DemoGj* this, PlayState* play) { // Inits the first cylinder (only that one) with `sCylinderInit3` void DemoGj_InitDestructableRubbleTall(DemoGj* this, PlayState* play) { DemoGj_InitSetIndices(this, play, 17, 0, NULL); - DemoGj_InitCylinder(this, play, &this->cylinders[0], &sCylinderInit3); + DemoGj_InitCylinder(this, play, &this->colliderCylinders[0], &sCylinderInit3); } #if DEBUG_FEATURES @@ -1300,7 +1307,7 @@ void func_8097B9BC(DemoGj* this, PlayState* play) { */ void func_8097BA48(DemoGj* this, PlayState* play) { Actor* thisx = &this->dyna.actor; - ColliderCylinder* cylinder = &this->cylinders[0]; + ColliderCylinder* cylinder = &this->colliderCylinders[0]; s32 pad[2]; if (func_809797E4(this, 4)) { @@ -1373,8 +1380,8 @@ void DemoGj_Update(Actor* thisx, PlayState* play) { if (this->updateMode < 0 || this->updateMode >= ARRAY_COUNT(sUpdateFuncs) || sUpdateFuncs[this->updateMode] == NULL) { - // "The main mode is abnormal!!!!!!!!!!!!!!!!!!!!!!!!!" - PRINTF(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The main mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } @@ -1430,8 +1437,8 @@ void DemoGj_Init(Actor* thisx, PlayState* play) { break; default: - // "Demo_Gj_Actor_ct There is no such argument!!!!!!!!!!!!!!!!!!!!!!" - PRINTF(VT_FGCOL(RED) "Demo_Gj_Actor_ct そんな引数は無い!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("Demo_Gj_Actor_ct そんな引数は無い!!!!!!!!!!!!!!!!!!!!!!\n", + "Demo_Gj_Actor_ct There is no such argument!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); Actor_Kill(&this->dyna.actor); } } @@ -1465,8 +1472,8 @@ void DemoGj_Draw(Actor* thisx, PlayState* play) { DemoGj* this = (DemoGj*)thisx; if (this->drawConfig < 0 || this->drawConfig >= ARRAY_COUNT(sDrawFuncs) || sDrawFuncs[this->drawConfig] == NULL) { - // "The drawing mode is abnormal!!!!!!!!!!!!!!!!!!!!!!!!!" - PRINTF(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The drawing mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } diff --git a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.h b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.h index 01a829f4fc..313788893f 100644 --- a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.h +++ b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.h @@ -17,7 +17,7 @@ typedef struct DemoGj { /* 0x0178 */ BossGanon2* ganon; /* 0x017C */ s32 isTransformedIntoGanon; // flag /* 0x0180 */ s32 isRotated; // flag - /* 0x0184 */ ColliderCylinder cylinders[3]; + /* 0x0184 */ ColliderCylinder colliderCylinders[3]; /* 0x0268 */ s32 killFlag; // This actor never sets this flag, but it reads it. If set to `true` and the actor type is DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_1, DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_2 or DEMOGJ_TYPE_DESTRUCTABLE_RUBBLE_TALL, then the actor will be killed and will drop the specified amount of collectibles. /* 0x026C */ Vec3f unk_26C; // This actor never sets this. Specifies which direction will this actor explode when killed using `killFlag`. } DemoGj; // size = 0x0278 diff --git a/src/overlays/actors/ovl_Demo_Go/z_demo_go.c b/src/overlays/actors/ovl_Demo_Go/z_demo_go.c index 01c173dcc4..4ea8f4b685 100644 --- a/src/overlays/actors/ovl_Demo_Go/z_demo_go.c +++ b/src/overlays/actors/ovl_Demo_Go/z_demo_go.c @@ -5,8 +5,20 @@ */ #include "z_demo_go.h" -#include "assets/objects/object_oF1d_map/object_oF1d_map.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "regs.h" +#include "segmented_address.h" +#include "sfx.h" #include "terminal.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64skin_matrix.h" + +#include "assets/objects/object_oF1d_map/object_oF1d_map.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -320,7 +332,8 @@ void DemoGo_Update(Actor* thisx, PlayState* play) { DemoGo* this = (DemoGo*)thisx; if (this->action < 0 || this->action >= 7 || D_8097D44C[this->action] == NULL) { - PRINTF(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The main mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } D_8097D44C[this->action](this, play); @@ -361,7 +374,8 @@ void DemoGo_Draw(Actor* thisx, PlayState* play) { DemoGo* this = (DemoGo*)thisx; if (this->drawConfig < 0 || this->drawConfig >= 2 || D_8097D468[this->drawConfig] == NULL) { - PRINTF(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The drawing mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } D_8097D468[this->drawConfig](this, play); diff --git a/src/overlays/actors/ovl_Demo_Go/z_demo_go.h b/src/overlays/actors/ovl_Demo_Go/z_demo_go.h index 969fdd8e07..9abd5ed41c 100644 --- a/src/overlays/actors/ovl_Demo_Go/z_demo_go.h +++ b/src/overlays/actors/ovl_Demo_Go/z_demo_go.h @@ -2,12 +2,12 @@ #define Z_DEMO_GO_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct DemoGo; -typedef void (*DemoGoActionFunc)(struct DemoGo*, PlayState*); -typedef void (*DemoGoDrawFunc)(struct DemoGo*, PlayState*); +typedef void (*DemoGoActionFunc)(struct DemoGo*, struct PlayState*); +typedef void (*DemoGoDrawFunc)(struct DemoGo*, struct PlayState*); typedef struct DemoGo { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c index a878a21f1f..006a9267d3 100644 --- a/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c +++ b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c @@ -1,11 +1,27 @@ #include "z_demo_gt.h" +#include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "regs.h" +#include "rumble.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "terminal.h" +#include "translation.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64effect.h" #include "z64frame_advance.h" +#include "z64play.h" +#include "z64save.h" #include "assets/objects/object_gt/object_gt.h" #include "assets/objects/object_geff/object_geff.h" -#include "terminal.h" -#include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) @@ -1721,8 +1737,8 @@ void DemoGt_Update(Actor* thisx, PlayState* play) { DemoGtUpdateFunc updateFunc; if ((this->updateMode < 0) || (this->updateMode >= 19) || (updateFunc = sUpdateFuncs[this->updateMode]) == NULL) { - // "The main mode is strange!" - PRINTF(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The main mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } @@ -1758,8 +1774,8 @@ void DemoGt_Init(Actor* thisx, PlayState* play) { func_80982054_Init24(this, play); break; default: - // "Demo_Gt_Actor_ct There is no such argument !" - PRINTF("Demo_Gt_Actor_ct そんな引数は無い!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); + PRINTF(T("Demo_Gt_Actor_ct そんな引数は無い!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "Demo_Gt_Actor_ct There is no such argument!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n")); Actor_Kill(&this->dyna.actor); } } @@ -1777,8 +1793,8 @@ void DemoGt_Draw(Actor* thisx, PlayState* play) { DemoGtDrawFunc drawFunc; if ((this->drawConfig < 0) || (this->drawConfig >= 9) || (drawFunc = sDrawFuncs[this->drawConfig]) == NULL) { - // "The drawing mode is strange !!!!!!!!!!!!!!!!!!!!!!!!!" - PRINTF(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The drawing mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } diff --git a/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.h b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.h index 18b968b15c..910c265939 100644 --- a/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.h +++ b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.h @@ -2,12 +2,12 @@ #define Z_DEMO_GT_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct DemoGt; -typedef void (*DemoGtUpdateFunc)(struct DemoGt*, PlayState*); -typedef void (*DemoGtDrawFunc)(Actor*, PlayState*); +typedef void (*DemoGtUpdateFunc)(struct DemoGt*, struct PlayState*); +typedef void (*DemoGtDrawFunc)(struct Actor*, struct PlayState*); typedef struct DemoGt { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c b/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c index 82db3d7fa6..a5dff0d4a3 100644 --- a/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c +++ b/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c @@ -1,5 +1,16 @@ #include "z_demo_ik.h" + +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "sfx.h" +#include "sys_matrix.h" #include "terminal.h" +#include "translation.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/object_ik/object_ik.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -159,7 +170,7 @@ void DemoIk_MoveToStartPos(DemoIk* this, PlayState* play, s32 cueChannel) { void DemoIk_Type1Init(DemoIk* this, PlayState* play) { s32 pad[3]; - SkeletonHeader* skeleton; + FlexSkeletonHeader* skeleton; AnimationHeader* animation; f32 phi_f0; @@ -181,7 +192,8 @@ void DemoIk_Type1Init(DemoIk* this, PlayState* play) { // No break is required for matching } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, phi_f0); - SkelAnime_Init(play, &this->skelAnime, skeleton, NULL, this->jointTable, this->morphTable, 2); + //! @bug Flex skeleton is used as normal skeleton + SkelAnime_Init(play, &this->skelAnime, (SkeletonHeader*)skeleton, NULL, this->jointTable, this->morphTable, 2); Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_ONCE, 0.0f); } @@ -232,8 +244,8 @@ void func_809839D0(DemoIk* this, PlayState* play) { case 6: break; default: - // "there is no such action" - PRINTF("Demo_Ik_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); + PRINTF(T("Demo_Ik_Check_DemoMode:そんな動作は無い!!!!!!!!\n", + "Demo_Ik_Check_DemoMode: There is no such action!!!!!!!!\n")); } this->cueId = nextCueId; } @@ -381,8 +393,8 @@ void func_80984048(DemoIk* this, PlayState* play) { Actor_Kill(&this->actor); break; default: - // "there is no such action" - PRINTF("Demo_Ik_inFace_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); + PRINTF(T("Demo_Ik_inFace_Check_DemoMode:そんな動作は無い!!!!!!!!\n", + "Demo_Ik_inFace_Check_DemoMode: There is no such action!!!!!!!!\n")); } this->cueId = nextCueId; } @@ -469,8 +481,8 @@ void DemoIk_Update(Actor* thisx, PlayState* play) { if (this->actionMode < 0 || this->actionMode >= ARRAY_COUNT(sActionFuncs) || sActionFuncs[this->actionMode] == NULL) { - // "The main mode is strange" - PRINTF(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The main mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } sActionFuncs[this->actionMode](this, play); @@ -490,8 +502,8 @@ void DemoIk_Draw(Actor* thisx, PlayState* play) { DemoIk* this = (DemoIk*)thisx; if (this->drawMode < 0 || this->drawMode >= ARRAY_COUNT(sDrawFuncs) || sDrawFuncs[this->drawMode] == NULL) { - // "The draw mode is strange" - PRINTF(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The drawing mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } sDrawFuncs[this->drawMode](this, play); diff --git a/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.h b/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.h index 3b21af5665..b4f2ca74ea 100644 --- a/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.h +++ b/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.h @@ -2,12 +2,12 @@ #define Z_DEMO_IK_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct DemoIk; -typedef void (*DemoIkActionFunc)(struct DemoIk* this, PlayState* play); -typedef void (*DemoIkDrawFunc)(struct DemoIk* this, PlayState* play); +typedef void (*DemoIkActionFunc)(struct DemoIk* this, struct PlayState* play); +typedef void (*DemoIkDrawFunc)(struct DemoIk* this, struct PlayState* play); typedef struct DemoIk { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c index 7e359f6625..508128f7be 100644 --- a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c +++ b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c @@ -7,9 +7,23 @@ #include "z_demo_im.h" #include "overlays/actors/ovl_En_Arrow/z_en_arrow.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "regs.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "terminal.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/scenes/indoors/nakaniwa/nakaniwa_scene.h" #include "assets/objects/object_im/object_im.h" -#include "terminal.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_UPDATE_CULLING_DISABLED) @@ -633,7 +647,8 @@ void func_809861C4(DemoIm* this, PlayState* play) { this->action = 12; break; default: - PRINTF("Demo_Im_Ocarina_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); + PRINTF(T("Demo_Im_Ocarina_Check_DemoMode:そんな動作は無い!!!!!!!!\n", + "Demo_Im_Ocarina_Check_DemoMode: There is no such action!!!!!!!!\n")); } this->cueId = nextCueId; } @@ -673,7 +688,8 @@ void func_809862E0(DemoIm* this, PlayState* play) { func_80986148(this); break; default: - PRINTF("Demo_Im_Ocarina_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); + PRINTF(T("Demo_Im_Ocarina_Check_DemoMode:そんな動作は無い!!!!!!!!\n", + "Demo_Im_Ocarina_Check_DemoMode: There is no such action!!!!!!!!\n")); } this->cueId = nextCueId; } @@ -801,7 +817,8 @@ void func_8098680C(DemoIm* this, PlayState* play) { Actor_Kill(&this->actor); break; default: - PRINTF("Demo_Im_Spot00_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); + PRINTF(T("Demo_Im_Spot00_Check_DemoMode:そんな動作は無い!!!!!!!!\n", + "Demo_Im_Spot00_Check_DemoMode: There is no such action!!!!!!!!\n")); } this->cueId = nextCueId; } @@ -1071,7 +1088,8 @@ void func_809871E8(DemoIm* this, PlayState* play) { func_80987174(this); break; default: - PRINTF("Demo_Im_inEnding_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); + PRINTF(T("Demo_Im_inEnding_Check_DemoMode:そんな動作は無い!!!!!!!!\n", + "Demo_Im_inEnding_Check_DemoMode: There is no such action!!!!!!!!\n")); } this->cueId = nextCueId; } @@ -1110,7 +1128,8 @@ void DemoIm_Update(Actor* thisx, PlayState* play) { DemoIm* this = (DemoIm*)thisx; if ((this->action < 0) || (this->action >= 31) || (sActionFuncs[this->action] == NULL)) { - PRINTF(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The main mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } sActionFuncs[this->action](this, play); @@ -1221,7 +1240,8 @@ void DemoIm_Draw(Actor* thisx, PlayState* play) { DemoIm* this = (DemoIm*)thisx; if ((this->drawConfig < 0) || (this->drawConfig >= 3) || (sDrawFuncs[this->drawConfig] == NULL)) { - PRINTF(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The drawing mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } sDrawFuncs[this->drawConfig](this, play); diff --git a/src/overlays/actors/ovl_Demo_Im/z_demo_im.h b/src/overlays/actors/ovl_Demo_Im/z_demo_im.h index 94744969be..9477c21d8f 100644 --- a/src/overlays/actors/ovl_Demo_Im/z_demo_im.h +++ b/src/overlays/actors/ovl_Demo_Im/z_demo_im.h @@ -2,12 +2,12 @@ #define Z_DEMO_IM_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct DemoIm; -typedef void (*DemoImActionFunc)(struct DemoIm*, PlayState*); -typedef void (*DemoImDrawFunc)(struct DemoIm*, PlayState*); +typedef void (*DemoImActionFunc)(struct DemoIm*, struct PlayState*); +typedef void (*DemoImDrawFunc)(struct DemoIm*, struct PlayState*); typedef enum ImpaLimb { /* 0x00 */ IMPA_LIMB_NONE, diff --git a/src/overlays/actors/ovl_Demo_Im/z_demo_im_cutscene_data.inc.c b/src/overlays/actors/ovl_Demo_Im/z_demo_im_cutscene_data.inc.c index f56097680c..7a9a0dde84 100644 --- a/src/overlays/actors/ovl_Demo_Im/z_demo_im_cutscene_data.inc.c +++ b/src/overlays/actors/ovl_Demo_Im/z_demo_im_cutscene_data.inc.c @@ -1,4 +1,4 @@ -#include "z_demo_im.h" +#include "sequence.h" #include "z64cutscene_commands.h" // clang-format off diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c index 50ae630b5b..e975163403 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -1,13 +1,29 @@ #include "z_demo_kankyo.h" -#include "global.h" + +#include "libc64/qrand.h" +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" #include "versions.h" +#include "z_lib.h" #include "z64cutscene_commands.h" +#include "z64cutscene_flags.h" +#include "z64cutscene_spline.h" +#include "z64olib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_efc_star_field/object_efc_star_field.h" #include "assets/objects/object_toki_objects/object_toki_objects.h" -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ique-cn:128 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" +#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:128" \ + "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:0 pal-1.1:0" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data1.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data1.c index 3a0a95a907..4e17a4a53c 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data1.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data1.c @@ -1,4 +1,3 @@ -#include "z_demo_kankyo.h" #include "z64cutscene_commands.h" // clang-format off diff --git a/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c b/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c index 8c6ded1651..2a79aef458 100644 --- a/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c +++ b/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c @@ -5,6 +5,21 @@ */ #include "z_demo_kekkai.h" + +#include "libu64/debug.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "rand.h" +#include "segmented_address.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_demo_kekkai/object_demo_kekkai.h" #include "assets/scenes/dungeons/ganontika/ganontika_scene.h" diff --git a/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.h b/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.h index 8e396c4ec6..182b1d587c 100644 --- a/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.h +++ b/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.h @@ -2,11 +2,11 @@ #define Z_DEMO_KEKKAI_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct DemoKekkai; -typedef void (*DemoKekkaiUpdateFunc)(struct DemoKekkai* this, PlayState* play); +typedef void (*DemoKekkaiUpdateFunc)(struct DemoKekkai* this, struct PlayState* play); typedef struct DemoKekkai { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c index 36e521701b..5831c44b06 100644 --- a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c +++ b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c @@ -7,9 +7,22 @@ #include "z_demo_sa.h" #include "overlays/actors/ovl_En_Elf/z_en_elf.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" -#include "assets/objects/object_sa/object_sa.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "regs.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sequence.h" #include "terminal.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/object_sa/object_sa.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -579,7 +592,8 @@ void func_8098F654(DemoSa* this, PlayState* play) { func_8098F5D0(this); break; default: - PRINTF("Demo_Sa_inEnding_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); + PRINTF(T("Demo_Sa_inEnding_Check_DemoMode:そんな動作は無い!!!!!!!!\n", + "Demo_Sa_inEnding_Check_DemoMode: There is no such action!!!!!!!!\n")); } this->cueId = nextCueId; } @@ -728,7 +742,8 @@ void func_8098FB68(DemoSa* this, PlayState* play) { func_8098FAE0(this); break; default: - PRINTF("Demo_Sa_inPresent_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); + PRINTF(T("Demo_Sa_inPresent_Check_DemoMode:そんな動作は無い!!!!!!!!\n", + "Demo_Sa_inPresent_Check_DemoMode: There is no such action!!!!!!!!\n")); } this->cueId = nextCueId; } @@ -768,7 +783,8 @@ void DemoSa_Update(Actor* thisx, PlayState* play) { DemoSa* this = (DemoSa*)thisx; if (this->action < 0 || this->action >= 21 || sActionFuncs[this->action] == NULL) { - PRINTF(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The main mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } sActionFuncs[this->action](this, play); @@ -838,7 +854,8 @@ void DemoSa_Draw(Actor* thisx, PlayState* play) { DemoSa* this = (DemoSa*)thisx; if (this->drawConfig < 0 || this->drawConfig >= 3 || sDrawFuncs[this->drawConfig] == NULL) { - PRINTF(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The drawing mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } sDrawFuncs[this->drawConfig](this, play); diff --git a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.h b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.h index 1f66c4fec3..639d50a634 100644 --- a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.h +++ b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.h @@ -2,12 +2,12 @@ #define Z_DEMO_SA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct DemoSa; -typedef void (*DemoSaActionFunc)(struct DemoSa*, PlayState*); -typedef void (*DemoSaDrawFunc)(struct DemoSa*, PlayState*); +typedef void (*DemoSaActionFunc)(struct DemoSa*, struct PlayState*); +typedef void (*DemoSaDrawFunc)(struct DemoSa*, struct PlayState*); typedef struct DemoSa { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c b/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c index d5cb025e46..549daf0db7 100644 --- a/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c +++ b/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c @@ -6,6 +6,13 @@ #include "z_demo_shd.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sequence.h" +#include "sys_matrix.h" +#include "z64audio.h" +#include "z64play.h" + #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) void DemoShd_Init(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.h b/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.h index fe9198f624..eb62a3983f 100644 --- a/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.h +++ b/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.h @@ -2,11 +2,11 @@ #define Z_DEMO_SHD_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct DemoShd; -typedef void (*DemoShdActionFunc)(struct DemoShd*, PlayState*); +typedef void (*DemoShdActionFunc)(struct DemoShd*, struct PlayState*); typedef struct DemoShd { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c b/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c index 67adb46e78..992417b888 100644 --- a/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c +++ b/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c @@ -1,5 +1,15 @@ #include "z_demo_tre_lgt.h" #include "overlays/actors/ovl_En_Box/z_en_box.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "sfx.h" +#include "translation.h" +#include "z64curve.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_box/object_box.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -49,8 +59,7 @@ void DemoTreLgt_Init(Actor* thisx, PlayState* play) { DemoTreLgt* this = (DemoTreLgt*)thisx; if (!SkelCurve_Init(play, &this->skelCurve, &gTreasureChestCurveSkel, sAnimations[0])) { - // "Demo_Tre_Lgt_Actor_ct (); Construct failed" - PRINTF("Demo_Tre_Lgt_Actor_ct();コンストラクト失敗\n"); + PRINTF(T("Demo_Tre_Lgt_Actor_ct();コンストラクト失敗\n", "Demo_Tre_Lgt_Actor_ct(); Construct failed\n")); } ASSERT(true, "1", "../z_demo_tre_lgt.c", UNK_LINE); diff --git a/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.h b/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.h index 0cad6996d9..47f6c35642 100644 --- a/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.h +++ b/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.h @@ -2,11 +2,12 @@ #define Z_DEMO_TRE_LGT_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" +#include "z64curve.h" struct DemoTreLgt; -typedef void (*DemoTreLgtActionFunc)(struct DemoTreLgt*, PlayState*); +typedef void (*DemoTreLgtActionFunc)(struct DemoTreLgt*, struct PlayState*); typedef struct DemoTreLgt { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index 40f4878831..4034dafc91 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -5,6 +5,17 @@ */ #include "z_door_ana.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64cutscene_flags.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/gameplay_field_keep/gameplay_field_keep.h" #define FLAGS ACTOR_FLAG_UPDATE_DURING_OCARINA diff --git a/src/overlays/actors/ovl_Door_Ana/z_door_ana.h b/src/overlays/actors/ovl_Door_Ana/z_door_ana.h index 51c24b84af..0092bd8f1a 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.h +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.h @@ -2,11 +2,11 @@ #define Z_DOOR_ANA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct DoorAna; -typedef void (*DoorAnaActionFunc)(struct DoorAna*, PlayState*); +typedef void (*DoorAnaActionFunc)(struct DoorAna*, struct PlayState*); typedef struct DoorAna { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c b/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c index 360f4aedec..2f9f4e1183 100644 --- a/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c +++ b/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c @@ -5,6 +5,17 @@ */ #include "z_door_gerudo.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_door_gerudo/object_door_gerudo.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.h b/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.h index c00a0fa669..efd2959767 100644 --- a/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.h +++ b/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.h @@ -2,11 +2,11 @@ #define Z_DOOR_GERUDO_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct DoorGerudo; -typedef void (*DoorGerudoActionFunc)(struct DoorGerudo*, PlayState*); +typedef void (*DoorGerudoActionFunc)(struct DoorGerudo*, struct PlayState*); typedef struct DoorGerudo { /* 0x0000 */ SLIDING_DOOR_ACTOR_BASE; diff --git a/src/overlays/actors/ovl_Door_Killer/z_door_killer.c b/src/overlays/actors/ovl_Door_Killer/z_door_killer.c index 0f2d3163ec..15d92cb18a 100644 --- a/src/overlays/actors/ovl_Door_Killer/z_door_killer.c +++ b/src/overlays/actors/ovl_Door_Killer/z_door_killer.c @@ -5,6 +5,18 @@ */ #include "z_door_killer.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "rand.h" +#include "segmented_address.h" +#include "sfx.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_hidan_objects/object_hidan_objects.h" #include "assets/objects/object_mizu_objects/object_mizu_objects.h" @@ -61,7 +73,7 @@ static ColliderCylinderInit sCylinderInit = { { 20, 100, 0, { 0, 0, 0 } }, }; -static ColliderJntSphElementInit sJntSphItemsInit[1] = { +static ColliderJntSphElementInit sJntSphElementsInit[1] = { { { ELEM_MATERIAL_UNK0, @@ -85,7 +97,7 @@ static ColliderJntSphInit sJntSphInit = { COLSHAPE_JNTSPH, }, 1, - sJntSphItemsInit, + sJntSphElementsInit, }; static DoorKillerTextureEntry sDoorTextures[4] = { @@ -137,7 +149,7 @@ void DoorKiller_Init(Actor* thisx, PlayState* play2) { Collider_InitCylinder(play, &this->colliderCylinder); Collider_SetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit); Collider_InitJntSph(play, &this->colliderJntSph); - Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphItems); + Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElements); this->colliderJntSph.elements[0].dim.worldSphere.radius = 80; this->colliderJntSph.elements[0].dim.worldSphere.center.x = (s16)this->actor.world.pos.x; this->colliderJntSph.elements[0].dim.worldSphere.center.y = (s16)this->actor.world.pos.y + 50; @@ -460,9 +472,9 @@ void DoorKiller_Wait(DoorKiller* this, PlayState* play) { void DoorKiller_UpdateTexture(Actor* thisx, PlayState* play) { DoorKiller* this = (DoorKiller*)thisx; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); this->texture = SEGMENTED_TO_VIRTUAL(this->texture); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->actor.objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->actor.objectSlot].segment); } /** diff --git a/src/overlays/actors/ovl_Door_Killer/z_door_killer.h b/src/overlays/actors/ovl_Door_Killer/z_door_killer.h index 597624df1e..32eaaeb014 100644 --- a/src/overlays/actors/ovl_Door_Killer/z_door_killer.h +++ b/src/overlays/actors/ovl_Door_Killer/z_door_killer.h @@ -2,7 +2,7 @@ #define Z_DOOR_KILLER_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" /* * Associated switch flag: (params >> 8) & 0x3F @@ -16,7 +16,7 @@ typedef struct DoorKillerTextureEntry { struct DoorKiller; -typedef void (*DoorKillerActionFunc)(struct DoorKiller*, PlayState*); +typedef void (*DoorKillerActionFunc)(struct DoorKiller*, struct PlayState*); typedef struct DoorKiller { /* 0x0000 */ DOOR_ACTOR_BASE; @@ -28,7 +28,7 @@ typedef struct DoorKiller { /* 0x021C */ u8 requiredObjectSlot; /* 0x021D */ u8 textureEntryIndex; /* 0x0220 */ ColliderJntSph colliderJntSph; - /* 0x0240 */ ColliderJntSphElement colliderJntSphItems[1]; + /* 0x0240 */ ColliderJntSphElement colliderJntSphElements[1]; /* 0x0280 */ DoorKillerActionFunc actionFunc; } DoorKiller; // size = 0x0284 diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index 0bb5e1074a..05eec20ffa 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -6,15 +6,31 @@ #include "z_door_shutter.h" #include "overlays/actors/ovl_Boss_Goma/z_boss_goma.h" + +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "rumble.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" #include "quake.h" #include "versions.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" +#include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_gnd/object_gnd.h" #include "assets/objects/object_goma/object_goma.h" #include "assets/objects/object_ydan_objects/object_ydan_objects.h" #include "assets/objects/object_ddan_objects/object_ddan_objects.h" #include "assets/objects/object_bdan_objects/object_bdan_objects.h" -#include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_bdoor/object_bdoor.h" #include "assets/objects/object_hidan_objects/object_hidan_objects.h" #include "assets/objects/object_ganon_objects/object_ganon_objects.h" diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h index 83660c5930..8ab1c8a4c7 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.h @@ -2,7 +2,7 @@ #define Z_DOOR_SHUTTER_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" /** * Actor Parameters @@ -39,7 +39,7 @@ typedef enum DoorShutterType { struct DoorShutter; -typedef void (*DoorShutterActionFunc)(struct DoorShutter*, PlayState*); +typedef void (*DoorShutterActionFunc)(struct DoorShutter*, struct PlayState*); typedef struct DoorShutter { /* 0x0000 */ SLIDING_DOOR_ACTOR_BASE; diff --git a/src/overlays/actors/ovl_Door_Toki/z_door_toki.c b/src/overlays/actors/ovl_Door_Toki/z_door_toki.c index bf423a09b5..ceef1f93f6 100644 --- a/src/overlays/actors/ovl_Door_Toki/z_door_toki.c +++ b/src/overlays/actors/ovl_Door_Toki/z_door_toki.c @@ -5,6 +5,11 @@ */ #include "z_door_toki.h" + +#include "ichain.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_toki_objects/object_toki_objects.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_Door_Toki/z_door_toki.h b/src/overlays/actors/ovl_Door_Toki/z_door_toki.h index 35d4d4f91c..8e276c56bd 100644 --- a/src/overlays/actors/ovl_Door_Toki/z_door_toki.h +++ b/src/overlays/actors/ovl_Door_Toki/z_door_toki.h @@ -2,7 +2,7 @@ #define Z_DOOR_TOKI_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct DoorToki; diff --git a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c index 6927a0f16e..dc0f0cb92e 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -4,6 +4,7 @@ #include "gfx_setupdl.h" #include "ichain.h" #include "one_point_cutscene.h" +#include "printf.h" #include "seqcmd.h" #include "sequence.h" #include "sfx.h" @@ -12,9 +13,13 @@ #include "z64light.h" #include "z64play.h" #include "z64player.h" +#include "z64save.h" #include "assets/objects/object_warp1/object_warp1.h" +#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ + "ique-cn:128 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" + #define FLAGS 0 void DoorWarp1_Init(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c b/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c index ae7c4a807a..677458f186 100644 --- a/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c +++ b/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c @@ -1,4 +1,16 @@ #include "z_efc_erupc.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "rand.h" +#include "sfx.h" +#include "sequence.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_efc_erupc/object_efc_erupc.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h b/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h index 6d14c32d76..888d9580ef 100644 --- a/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h +++ b/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h @@ -2,11 +2,11 @@ #define Z_EFC_ERUPC_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EfcErupc; -typedef void (*EfcErupcActionFunc)(struct EfcErupc*, PlayState*); +typedef void (*EfcErupcActionFunc)(struct EfcErupc*, struct PlayState*); #define EFC_ERUPC_EFFECT_COUNT 100 diff --git a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c index f23a974a32..e8f9f26841 100644 --- a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c +++ b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c @@ -5,6 +5,18 @@ */ #include "z_eff_dust.h" + +#include "libc64/malloc.h" +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "rand.h" +#include "segmented_address.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.h b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.h index e77a8e0223..153b6d4e2a 100644 --- a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.h +++ b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.h @@ -2,12 +2,12 @@ #define Z_EFF_DUST_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EffDust; -typedef void (*EffDustActionFunc)(struct EffDust*, PlayState*); -typedef void (*EffDustDrawFunc)(Actor*, PlayState*); +typedef void (*EffDustActionFunc)(struct EffDust*, struct PlayState*); +typedef void (*EffDustDrawFunc)(Actor*, struct PlayState*); typedef struct EffDust { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c b/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c index a4ebdfb131..22c96a08d4 100644 --- a/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c +++ b/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c @@ -5,8 +5,18 @@ */ #include "z_elf_msg.h" -#include "global.h" + +#include "libu64/debug.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "regs.h" +#include "sys_matrix.h" #include "terminal.h" +#include "z64play.h" +#include "z64player.h" + #include "overlays/actors/ovl_En_Elf/z_en_elf.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c b/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c index 0f0edc34e5..f6beb6cc82 100644 --- a/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c +++ b/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c @@ -5,7 +5,16 @@ */ #include "z_elf_msg2.h" + +#include "libu64/debug.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "regs.h" +#include "sys_matrix.h" #include "terminal.h" +#include "z64play.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.h b/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.h index 802769f2b7..5a0a693415 100644 --- a/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.h +++ b/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.h @@ -2,11 +2,11 @@ #define Z_ELF_MSG2_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ElfMsg2; -typedef void (*ElfMsg2ActionFunc)(struct ElfMsg2*, PlayState*); +typedef void (*ElfMsg2ActionFunc)(struct ElfMsg2*, struct PlayState*); typedef struct ElfMsg2 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Am/z_en_am.c b/src/overlays/actors/ovl_En_Am/z_en_am.c index 6f793ba1a3..3f7649ea7e 100644 --- a/src/overlays/actors/ovl_En_Am/z_en_am.c +++ b/src/overlays/actors/ovl_En_Am/z_en_am.c @@ -5,9 +5,23 @@ */ #include "z_en_am.h" -#include "assets/objects/object_am/object_am.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.h" +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "rand.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + +#include "assets/objects/object_am/object_am.h" + #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ ACTOR_FLAG_CAN_PRESS_SWITCHES) diff --git a/src/overlays/actors/ovl_En_Am/z_en_am.h b/src/overlays/actors/ovl_En_Am/z_en_am.h index 8bac3338da..2903a3b6ea 100644 --- a/src/overlays/actors/ovl_En_Am/z_en_am.h +++ b/src/overlays/actors/ovl_En_Am/z_en_am.h @@ -2,11 +2,11 @@ #define Z_EN_AM_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnAm; -typedef void (*EnAmActionFunc)(struct EnAm*, PlayState*); +typedef void (*EnAmActionFunc)(struct EnAm*, struct PlayState*); typedef struct EnAm { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.c b/src/overlays/actors/ovl_En_Ani/z_en_ani.c index 242afc095f..8bfcc38fac 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.c +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.c @@ -5,6 +5,18 @@ */ #include "z_en_ani.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64face_reaction.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_ani/object_ani.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY) diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.h b/src/overlays/actors/ovl_En_Ani/z_en_ani.h index 99bad6e1cc..454a7bd8d2 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.h +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.h @@ -2,11 +2,11 @@ #define Z_EN_ANI_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnAni; -typedef void (*EnAniActionFunc)(struct EnAni*, PlayState*); +typedef void (*EnAniActionFunc)(struct EnAni*, struct PlayState*); typedef struct EnAni { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c b/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c index 5773eb17ba..5c03ab9632 100644 --- a/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c +++ b/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c @@ -5,10 +5,25 @@ */ #include "z_en_anubice.h" -#include "assets/objects/object_anubice/object_anubice.h" #include "overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.h" #include "overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.h" + +#include "libc64/math64.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "rand.h" +#include "sfx.h" +#include "sys_matrix.h" #include "terminal.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + +#include "assets/objects/object_anubice/object_anubice.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_En_Anubice/z_en_anubice.h b/src/overlays/actors/ovl_En_Anubice/z_en_anubice.h index 5f3ec8b134..51cd02d1ef 100644 --- a/src/overlays/actors/ovl_En_Anubice/z_en_anubice.h +++ b/src/overlays/actors/ovl_En_Anubice/z_en_anubice.h @@ -2,8 +2,7 @@ #define Z_EN_ANUBICE_H #include "ultra64.h" -#include "global.h" -#include "overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.h" +#include "z64actor.h" struct EnAnubice; @@ -54,7 +53,7 @@ typedef struct EnAnubice { /* 0x028C */ Vec3f fireballRot; /* 0x0298 */ Vec3f home; /* 0x02A4 */ Vec3f knockbackRecoveryVelocity; - /* 0x02B0 */ BgHidanCurtain* flameCircles[5]; + /* 0x02B0 */ struct BgHidanCurtain* flameCircles[5]; /* 0x02C4 */ char unk_2C4[0x4]; // Possibly another element of flameCircles /* 0x02C8 */ ColliderCylinder collider; } EnAnubice; // size = 0x0314 diff --git a/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c b/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c index 9e408a3350..480940dc44 100644 --- a/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c +++ b/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c @@ -5,6 +5,19 @@ */ #include "z_en_anubice_fire.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "rand.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_anubice/object_anubice.h" @@ -55,8 +68,8 @@ void EnAnubiceFire_Init(Actor* thisx, PlayState* play) { EnAnubiceFire* this = (EnAnubiceFire*)thisx; s32 i; - Collider_InitCylinder(play, &this->cylinder); - Collider_SetCylinder(play, &this->cylinder, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->colliderCylinder); + Collider_SetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit); this->unk_15A = 30; this->unk_154 = 2.0f; @@ -73,7 +86,7 @@ void EnAnubiceFire_Init(Actor* thisx, PlayState* play) { void EnAnubiceFire_Destroy(Actor* thisx, PlayState* play) { EnAnubiceFire* this = (EnAnubiceFire*)thisx; - Collider_DestroyCylinder(play, &this->cylinder); + Collider_DestroyCylinder(play, &this->colliderCylinder); } void func_809B26EC(EnAnubiceFire* this, PlayState* play) { @@ -108,12 +121,12 @@ void func_809B27D8(EnAnubiceFire* this, PlayState* play) { Math_ApproachF(&this->scale, this->unk_154, 0.2f, 0.4f); if ((this->unk_15A == 0) && (this->scale < 0.1f)) { Actor_Kill(&this->actor); - } else if ((this->actor.params == 0) && (this->cylinder.base.atFlags & AT_BOUNCED)) { + } else if ((this->actor.params == 0) && (this->colliderCylinder.base.atFlags & AT_BOUNCED)) { if (Player_HasMirrorShieldEquipped(play)) { Actor_PlaySfx(&this->actor, NA_SE_IT_SHIELD_REFLECT_SW); - this->cylinder.base.atFlags &= ~(AT_HIT | AT_BOUNCED | AT_TYPE_ENEMY); - this->cylinder.base.atFlags |= AT_TYPE_PLAYER; - this->cylinder.elem.atDmgInfo.dmgFlags = DMG_DEKU_STICK; + this->colliderCylinder.base.atFlags &= ~(AT_HIT | AT_BOUNCED | AT_TYPE_ENEMY); + this->colliderCylinder.base.atFlags |= AT_TYPE_PLAYER; + this->colliderCylinder.elem.atDmgInfo.dmgFlags = DMG_DEKU_STICK; this->unk_15A = 30; this->actor.params = 1; this->actor.velocity.x *= -1.0f; @@ -195,14 +208,14 @@ void EnAnubiceFire_Update(Actor* thisx, PlayState* play) { UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); if (!(this->scale < 0.6f || this->actionFunc == func_809B2B48)) { - this->cylinder.dim.radius = this->scale * 15.0f + 5.0f; - this->cylinder.dim.height = this->scale * 15.0f + 5.0f; - this->cylinder.dim.yShift = this->scale * -0.75f + -15.0f; + this->colliderCylinder.dim.radius = this->scale * 15.0f + 5.0f; + this->colliderCylinder.dim.height = this->scale * 15.0f + 5.0f; + this->colliderCylinder.dim.yShift = this->scale * -0.75f + -15.0f; if (this->unk_15A != 0) { - Collider_UpdateCylinder(&this->actor, &this->cylinder); - CollisionCheck_SetAT(play, &play->colChkCtx, &this->cylinder.base); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->cylinder.base); + Collider_UpdateCylinder(&this->actor, &this->colliderCylinder); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder.base); } if (BgCheck_SphVsFirstPoly(&play->colCtx, &this->actor.world.pos, 30.0f)) { diff --git a/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.h b/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.h index 8119efa7a5..34072a43b5 100644 --- a/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.h +++ b/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.h @@ -2,11 +2,11 @@ #define Z_EN_ANUBICE_FIRE_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnAnubiceFire; -typedef void (*EnAnubiceFireActionFunc)(struct EnAnubiceFire*, PlayState*); +typedef void (*EnAnubiceFireActionFunc)(struct EnAnubiceFire*, struct PlayState*); typedef struct EnAnubiceFire { /* 0x0000 */ Actor actor; @@ -18,7 +18,7 @@ typedef struct EnAnubiceFire { /* 0x015C */ s16 unk_15C; /* 0x015E */ s16 unk_15E; /* 0x0178 */ Vec3f unk_160[6]; - /* 0x01A8 */ ColliderCylinder cylinder; + /* 0x01A8 */ ColliderCylinder colliderCylinder; } EnAnubiceFire; // size = 0x01F4 #endif diff --git a/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c b/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c index b54dc180bc..4163b5d24f 100644 --- a/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c +++ b/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c @@ -5,7 +5,14 @@ */ #include "z_en_anubice_tag.h" +#include "overlays/actors/ovl_En_Anubice/z_en_anubice.h" + +#include "printf.h" +#include "regs.h" #include "terminal.h" +#include "z_lib.h" +#include "z64debug_display.h" +#include "z64play.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.h b/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.h index 0147b30cd5..026d4d0199 100644 --- a/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.h +++ b/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.h @@ -2,17 +2,16 @@ #define Z_EN_ANUBICE_TAG_H #include "ultra64.h" -#include "global.h" -#include "overlays/actors/ovl_En_Anubice/z_en_anubice.h" +#include "z64actor.h" struct EnAnubiceTag; -typedef void (*EnAnubiceTagActionFunc)(struct EnAnubiceTag*, PlayState*); +typedef void (*EnAnubiceTagActionFunc)(struct EnAnubiceTag*, struct PlayState*); typedef struct EnAnubiceTag { /* 0x0000 */ Actor actor; /* 0x014C */ EnAnubiceTagActionFunc actionFunc; - /* 0x0150 */ EnAnubice* anubis; + /* 0x0150 */ struct EnAnubice* anubis; /* 0x0154 */ f32 extraTriggerRange; } EnAnubiceTag; // size = 0x0158 diff --git a/src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.c b/src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.c index d44d380430..d4de5191ef 100644 --- a/src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.c +++ b/src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.c @@ -6,6 +6,9 @@ #include "z_en_arow_trap.h" #include "overlays/actors/ovl_En_Arrow/z_en_arrow.h" + +#include "z64play.h" + #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED void EnArowTrap_Init(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.h b/src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.h index e29f84d2b2..ba91505088 100644 --- a/src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.h +++ b/src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.h @@ -2,8 +2,7 @@ #define Z_EN_AROW_TRAP_H #include "ultra64.h" -#include "global.h" -#include "z64.h" +#include "z64actor.h" struct EnArowTrap; diff --git a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c index 669e5ed1fb..9000417a23 100644 --- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c +++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c @@ -5,7 +5,21 @@ */ #include "z_en_arrow.h" -#include "global.h" + +#include "libc64/qrand.h" +#include "libu64/debug.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "regs.h" +#include "sfx.h" +#include "sys_math.h" +#include "sys_math3d.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c index d215d02cf3..4a3a32663a 100644 --- a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c +++ b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c @@ -5,10 +5,22 @@ */ #include "z_en_attack_niw.h" -#include "versions.h" -#include "assets/objects/object_niw/object_niw.h" #include "overlays/actors/ovl_En_Niw/z_en_niw.h" +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "rand.h" +#include "sfx.h" +#include "versions.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + +#include "assets/objects/object_niw/object_niw.h" + #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED void EnAttackNiw_Init(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.h b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.h index 381b6a2aae..a4d361542d 100644 --- a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.h +++ b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.h @@ -2,11 +2,11 @@ #define Z_EN_ATTACK_NIW_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnAttackNiw; -typedef void (*EnAttackNiwActionFunc)(struct EnAttackNiw*, PlayState*); +typedef void (*EnAttackNiwActionFunc)(struct EnAttackNiw*, struct PlayState*); typedef struct EnAttackNiw { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Ba/z_en_ba.c b/src/overlays/actors/ovl_En_Ba/z_en_ba.c index 098980836e..a149d3c63d 100644 --- a/src/overlays/actors/ovl_En_Ba/z_en_ba.c +++ b/src/overlays/actors/ovl_En_Ba/z_en_ba.c @@ -5,6 +5,20 @@ */ #include "z_en_ba.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "rand.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_math.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_bxa/object_bxa.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED) @@ -37,7 +51,7 @@ ActorProfile En_Ba_Profile = { static Vec3f D_809B8080 = { 0.0f, 0.0f, 32.0f }; -static ColliderJntSphElementInit sJntSphElementInit[2] = { +static ColliderJntSphElementInit sJntSphElementsInit[2] = { { { ELEM_MATERIAL_UNK0, @@ -72,7 +86,7 @@ static ColliderJntSphInit sJntSphInit = { COLSHAPE_JNTSPH, }, 2, - sJntSphElementInit, + sJntSphElementsInit, }; void EnBa_SetupAction(EnBa* this, EnBaActionFunc actionFunc) { @@ -118,7 +132,7 @@ void EnBa_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.health = 4; this->actor.colChkInfo.mass = MASS_HEAVY; Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); } else { Actor_SetScale(&this->actor, 0.021f); EnBa_SetupFallAsBlob(this); diff --git a/src/overlays/actors/ovl_En_Ba/z_en_ba.h b/src/overlays/actors/ovl_En_Ba/z_en_ba.h index f39fa33995..dc3b8cb3f6 100644 --- a/src/overlays/actors/ovl_En_Ba/z_en_ba.h +++ b/src/overlays/actors/ovl_En_Ba/z_en_ba.h @@ -2,11 +2,11 @@ #define Z_EN_BA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnBa; -typedef void (*EnBaActionFunc)(struct EnBa*, PlayState*); +typedef void (*EnBaActionFunc)(struct EnBa*, struct PlayState*); typedef enum EnBaType { /* 0x00 */ EN_BA_TENTACLE_RED, @@ -31,7 +31,7 @@ typedef struct EnBa { /* 0x031A */ s16 unk_31A; /* 0x031C */ s16 unk_31C; /* 0x0320 */ ColliderJntSph collider; - /* 0x0340 */ ColliderJntSphElement colliderItems[2]; + /* 0x0340 */ ColliderJntSphElement colliderElements[2]; } EnBa; // size = 0x03C0 #endif diff --git a/src/overlays/actors/ovl_En_Bb/z_en_bb.c b/src/overlays/actors/ovl_En_Bb/z_en_bb.c index 26af25354a..18dad81519 100644 --- a/src/overlays/actors/ovl_En_Bb/z_en_bb.c +++ b/src/overlays/actors/ovl_En_Bb/z_en_bb.c @@ -5,6 +5,22 @@ */ #include "z_en_bb.h" + +#include "libc64/qrand.h" +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_math.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_Bb/object_Bb.h" @@ -209,7 +225,7 @@ ActorProfile En_Bb_Profile = { /**/ EnBb_Draw, }; -static ColliderJntSphElementInit sJntSphElementInit[1] = { +static ColliderJntSphElementInit sJntSphElementsInit[1] = { { { ELEM_MATERIAL_UNK0, @@ -233,7 +249,7 @@ static ColliderJntSphInit sJntSphInit = { COLSHAPE_JNTSPH, }, 1, - sJntSphElementInit, + sJntSphElementsInit, }; static InitChainEntry sInitChain[] = { @@ -319,7 +335,7 @@ void EnBb_Init(Actor* thisx, PlayState* play) { this->unk_254 = 0; thisx->colChkInfo.health = 4; Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, thisx, &sJntSphInit, this->elements); + Collider_SetJntSph(play, &this->collider, thisx, &sJntSphInit, this->colliderElements); this->actionState = PARAMS_GET_NOMASK(thisx->params, 8); diff --git a/src/overlays/actors/ovl_En_Bb/z_en_bb.h b/src/overlays/actors/ovl_En_Bb/z_en_bb.h index 9908690e06..0b7e85c461 100644 --- a/src/overlays/actors/ovl_En_Bb/z_en_bb.h +++ b/src/overlays/actors/ovl_En_Bb/z_en_bb.h @@ -2,11 +2,11 @@ #define Z_EN_BB_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnBb; -typedef void (*EnBbActionFunc)(struct EnBb*, PlayState*); +typedef void (*EnBbActionFunc)(struct EnBb*, struct PlayState*); typedef struct EnBb { /* 0x0000 */ Actor actor; @@ -41,7 +41,7 @@ typedef struct EnBb { /* 0x02A8 */ s16 fireIceTimer; /* 0x02AA */ u8 dmgEffect; /* 0x02AC */ ColliderJntSph collider; - /* 0x02CC */ ColliderJntSphElement elements[1]; + /* 0x02CC */ ColliderJntSphElement colliderElements[1]; /* 0x030C */ BodyBreak bodyBreak; /* 0x0324 */ Actor* targetActor; } EnBb; // size = 0x0328 diff --git a/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c b/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c index 58fcf61505..9c9d7bacfa 100644 --- a/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c +++ b/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c @@ -5,6 +5,20 @@ */ #include "z_en_bdfire.h" +#include "overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64light.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_kingdodongo/object_kingdodongo.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.h b/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.h index 93b37e3b1a..876a790d71 100644 --- a/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.h +++ b/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.h @@ -2,13 +2,13 @@ #define Z_EN_BDFIRE_H #include "ultra64.h" -#include "global.h" -#include "overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h" +#include "z64actor.h" +#include "z64light.h" struct EnBdfire; -typedef void (*EnBdfireActionFunc)(struct EnBdfire*, PlayState*); -typedef void (*EnBdfireDrawFunc)(struct EnBdfire*, PlayState*); +typedef void (*EnBdfireActionFunc)(struct EnBdfire*, struct PlayState*); +typedef void (*EnBdfireDrawFunc)(struct EnBdfire*, struct PlayState*); typedef struct EnBdfire { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c index 1bb808abaf..4243bbdf79 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -1,4 +1,22 @@ #include "z_en_bigokuta.h" + +#include "array_count.h" +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "rand.h" +#include "rumble.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_bigokuta/object_bigokuta.h" #define FLAGS \ @@ -44,7 +62,7 @@ ActorProfile En_Bigokuta_Profile = { /**/ EnBigokuta_Draw, }; -static ColliderJntSphElementInit sJntSphElementInit[1] = { +static ColliderJntSphElementInit sJntSphElementsInit[1] = { { { ELEM_MATERIAL_UNK1, @@ -67,8 +85,8 @@ static ColliderJntSphInit sJntSphInit = { OC2_TYPE_1, COLSHAPE_JNTSPH, }, - ARRAY_COUNT(sJntSphElementInit), - sJntSphElementInit, + ARRAY_COUNT(sJntSphElementsInit), + sJntSphElementsInit, }; static ColliderCylinderInit sCylinderInit[] = { @@ -165,13 +183,13 @@ void EnBigokuta_Init(Actor* thisx, PlayState* play) { this->jointTable, this->morphTable, 20); Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, &this->element); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); this->collider.elements[0].dim.worldSphere.radius = this->collider.elements[0].dim.modelSphere.radius; for (i = 0; i < ARRAY_COUNT(sCylinderInit); i++) { - Collider_InitCylinder(play, &this->cylinder[i]); - Collider_SetCylinder(play, &this->cylinder[i], &this->actor, &sCylinderInit[i]); + Collider_InitCylinder(play, &this->colliderCylinders[i]); + Collider_SetCylinder(play, &this->colliderCylinders[i], &this->actor, &sCylinderInit[i]); } CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, sColChkInfoInit); @@ -194,8 +212,8 @@ void EnBigokuta_Destroy(Actor* thisx, PlayState* play) { s32 i; Collider_DestroyJntSph(play, &this->collider); - for (i = 0; i < ARRAY_COUNT(this->cylinder); i++) { - Collider_DestroyCylinder(play, &this->cylinder[i]); + for (i = 0; i < ARRAY_COUNT(this->colliderCylinders); i++) { + Collider_DestroyCylinder(play, &this->colliderCylinders[i]); } } @@ -307,7 +325,7 @@ void func_809BD3F8(EnBigokuta* this) { this->unk_198 = 80; this->unk_19A = this->unk_194 * -0x200; func_809BCE3C(this); - this->cylinder[0].base.atFlags |= AT_ON; + this->colliderCylinders[0].base.atFlags |= AT_ON; this->collider.base.acFlags |= AC_ON; this->actionFunc = func_809BDC08; } @@ -325,7 +343,7 @@ void func_809BD4A4(EnBigokuta* this) { this->actor.world.rot.x = this->actor.shape.rot.y + 0x8000; this->unk_19A = this->unk_194 * 0x200; this->collider.base.acFlags &= ~AC_ON; - this->cylinder[0].base.atFlags |= AT_ON; + this->colliderCylinders[0].base.atFlags |= AT_ON; this->actionFunc = func_809BDFC8; } @@ -333,7 +351,7 @@ void func_809BD524(EnBigokuta* this) { Animation_MorphToPlayOnce(&this->skelAnime, &object_bigokuta_Anim_000D1C, -5.0f); this->unk_196 = 80; this->unk_19A = 0; - this->cylinder[0].base.atFlags |= AT_ON; + this->colliderCylinders[0].base.atFlags |= AT_ON; Actor_PlaySfx(&this->actor, NA_SE_EN_DAIOCTA_MAHI); if (this->collider.elements[0].base.acHitElem->atDmgInfo.dmgFlags & DMG_DEKU_NUT) { this->unk_195 = true; @@ -350,7 +368,7 @@ void func_809BD5E0(EnBigokuta* this) { Animation_MorphToPlayOnce(&this->skelAnime, &object_bigokuta_Anim_000444, -5.0f); this->unk_196 = 24; this->unk_19A = 0; - this->cylinder[0].base.atFlags &= ~AT_ON; + this->colliderCylinders[0].base.atFlags &= ~AT_ON; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 24); this->actionFunc = func_809BE180; } @@ -386,7 +404,7 @@ void func_809BD768(EnBigokuta* this) { this->unk_194 = Rand_ZeroOne() < 0.5f ? -1 : 1; this->unk_19A = 0; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - this->cylinder[0].base.atFlags &= ~AT_ON; + this->colliderCylinders[0].base.atFlags &= ~AT_ON; Actor_PlaySfx(&this->actor, NA_SE_EN_DAIOCTA_SINK); this->actionFunc = func_809BE4A4; } @@ -582,12 +600,12 @@ void func_809BE058(EnBigokuta* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((this->collider.base.ocFlags1 & OC1_HIT) || (this->cylinder[0].base.ocFlags1 & OC1_HIT) || - (this->cylinder[1].base.ocFlags1 & OC1_HIT)) { + if ((this->collider.base.ocFlags1 & OC1_HIT) || (this->colliderCylinders[0].base.ocFlags1 & OC1_HIT) || + (this->colliderCylinders[1].base.ocFlags1 & OC1_HIT)) { speedXZ = CLAMP_MIN(player->actor.speed, 1.0f); if (!(this->collider.base.ocFlags1 & OC1_HIT)) { - this->cylinder[0].base.ocFlags1 &= ~OC1_HIT; - this->cylinder[1].base.ocFlags1 &= ~OC1_HIT; + this->colliderCylinders[0].base.ocFlags1 &= ~OC1_HIT; + this->colliderCylinders[1].base.ocFlags1 &= ~OC1_HIT; speedXZ *= -1.0f; } player->actor.world.pos.x -= speedXZ * Math_SinS(this->actor.shape.rot.y); @@ -705,12 +723,12 @@ void func_809BE568(EnBigokuta* this) { this->collider.elements[0].dim.worldSphere.center.y = this->actor.world.pos.y + this->collider.elements[0].dim.modelSphere.center.y; - for (i = 0; i < ARRAY_COUNT(this->cylinder); i++) { - this->cylinder[i].dim.pos.x = + for (i = 0; i < ARRAY_COUNT(this->colliderCylinders); i++) { + this->colliderCylinders[i].dim.pos.x = this->actor.world.pos.x + sCylinderInit[i].dim.pos.z * sin + sCylinderInit[i].dim.pos.x * cos; - this->cylinder[i].dim.pos.z = + this->colliderCylinders[i].dim.pos.z = this->actor.world.pos.z + sCylinderInit[i].dim.pos.z * cos - sCylinderInit[i].dim.pos.x * sin; - this->cylinder[i].dim.pos.y = this->actor.world.pos.y; + this->colliderCylinders[i].dim.pos.y = this->actor.world.pos.y; } } @@ -718,10 +736,10 @@ void func_809BE798(EnBigokuta* this, PlayState* play) { s16 effectRot; s16 yawDiff; - if ((this->cylinder[0].base.atFlags & AT_HIT) || (this->cylinder[1].base.atFlags & AT_HIT) || + if ((this->colliderCylinders[0].base.atFlags & AT_HIT) || (this->colliderCylinders[1].base.atFlags & AT_HIT) || (this->collider.base.atFlags & AT_HIT)) { - this->cylinder[0].base.atFlags &= ~AT_HIT; - this->cylinder[1].base.atFlags &= ~AT_HIT; + this->colliderCylinders[0].base.atFlags &= ~AT_HIT; + this->colliderCylinders[1].base.atFlags &= ~AT_HIT; this->collider.base.atFlags &= ~AT_HIT; yawDiff = this->actor.yawTowardsPlayer - this->actor.world.rot.y; if (yawDiff > 0x4000) { @@ -782,19 +800,19 @@ void EnBigokuta_Update(Actor* thisx, PlayState* play2) { Camera_RequestSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_BIG_OCTO); Camera_UnsetStateFlag(play->cameraPtrs[CAM_ID_MAIN], CAM_STATE_CHECK_BG); - if (this->cylinder[0].base.atFlags & AT_ON) { + if (this->colliderCylinders[0].base.atFlags & AT_ON) { if (this->actionFunc != func_809BE058) { - for (i = 0; i < ARRAY_COUNT(this->cylinder); i++) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->cylinder[i].base); + for (i = 0; i < ARRAY_COUNT(this->colliderCylinders); i++) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderCylinders[i].base); } this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; } else { - for (i = 0; i < ARRAY_COUNT(this->cylinder); i++) { - CollisionCheck_SetOC(play, &play->colChkCtx, &this->cylinder[i].base); + for (i = 0; i < ARRAY_COUNT(this->colliderCylinders); i++) { + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinders[i].base); } } - for (i = 0; i < ARRAY_COUNT(this->cylinder); i++) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->cylinder[i].base); + for (i = 0; i < ARRAY_COUNT(this->colliderCylinders); i++) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinders[i].base); } if (this->collider.base.acFlags & AC_ON) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h index fc6ca9ac7a..c04da49c86 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.h @@ -2,11 +2,11 @@ #define Z_EN_BIGOKUTA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnBigokuta; -typedef void (*EnBigokutaActionFunc)(struct EnBigokuta*, PlayState*); +typedef void (*EnBigokutaActionFunc)(struct EnBigokuta*, struct PlayState*); typedef struct EnBigokuta { /* 0x0000 */ Actor actor; @@ -20,8 +20,8 @@ typedef struct EnBigokuta { /* 0x019C */ Vec3s jointTable[20]; /* 0x0214 */ Vec3s morphTable[20]; /* 0x028C */ ColliderJntSph collider; - /* 0x02AC */ ColliderJntSphElement element; - /* 0x02EC */ ColliderCylinder cylinder[2]; + /* 0x02AC */ ColliderJntSphElement colliderElements[1]; + /* 0x02EC */ ColliderCylinder colliderCylinders[2]; } EnBigokuta; // size = 0x0384 #endif diff --git a/src/overlays/actors/ovl_En_Bili/z_en_bili.c b/src/overlays/actors/ovl_En_Bili/z_en_bili.c index 8e9eba0c60..82f7b62796 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.c +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.c @@ -5,7 +5,21 @@ */ #include "z_en_bili.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "rand.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" #include "versions.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/object_bl/object_bl.h" #define FLAGS \ diff --git a/src/overlays/actors/ovl_En_Bili/z_en_bili.h b/src/overlays/actors/ovl_En_Bili/z_en_bili.h index 0882a288c0..3199639c9d 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.h +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.h @@ -2,11 +2,11 @@ #define Z_EN_BILI_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnBili; -typedef void (*EnBiliActionFunc)(struct EnBili*, PlayState*); +typedef void (*EnBiliActionFunc)(struct EnBili*, struct PlayState*); typedef enum EnBiliLimb { /* 0 */ EN_BILI_LIMB_NONE, diff --git a/src/overlays/actors/ovl_En_Bird/z_en_bird.c b/src/overlays/actors/ovl_En_Bird/z_en_bird.c index 6ca50edeeb..c93d682ee1 100644 --- a/src/overlays/actors/ovl_En_Bird/z_en_bird.c +++ b/src/overlays/actors/ovl_En_Bird/z_en_bird.c @@ -5,6 +5,11 @@ */ #include "z_en_bird.h" + +#include "ichain.h" +#include "z_lib.h" +#include "z64play.h" + #include "assets/objects/object_bird/object_bird.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_En_Bird/z_en_bird.h b/src/overlays/actors/ovl_En_Bird/z_en_bird.h index 1cc9858b13..beaf60a3d4 100644 --- a/src/overlays/actors/ovl_En_Bird/z_en_bird.h +++ b/src/overlays/actors/ovl_En_Bird/z_en_bird.h @@ -2,11 +2,11 @@ #define Z_EN_BIRD_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnBird; -typedef void (*EnBirdActionFunc)(struct EnBird*, PlayState*); +typedef void (*EnBirdActionFunc)(struct EnBird*, struct PlayState*); typedef struct EnBird { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c b/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c index 2e1141ffea..1d8d606cf3 100644 --- a/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c +++ b/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c @@ -5,6 +5,14 @@ */ #include "z_en_blkobj.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sys_matrix.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_blkobj/object_blkobj.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.h b/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.h index 4218c64664..babddb4e5d 100644 --- a/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.h +++ b/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.h @@ -2,11 +2,11 @@ #define Z_EN_BLKOBJ_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnBlkobj; -typedef void (*EnBlkobjActionFunc)(struct EnBlkobj*, PlayState*); +typedef void (*EnBlkobjActionFunc)(struct EnBlkobj*, struct PlayState*); typedef struct EnBlkobj { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/src/overlays/actors/ovl_En_Bom/z_en_bom.c index 7fefe03243..31acad8cec 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -112,8 +112,8 @@ void EnBom_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->bombCollider); Collider_InitJntSph(play, &this->explosionCollider); Collider_SetCylinder(play, &this->bombCollider, thisx, &sCylinderInit); - Collider_SetJntSph(play, &this->explosionCollider, thisx, &sJntSphInit, &this->explosionColliderItems[0]); - this->explosionColliderItems[0].base.atDmgInfo.damage += (thisx->shape.rot.z & 0xFF00) >> 8; + Collider_SetJntSph(play, &this->explosionCollider, thisx, &sJntSphInit, &this->explosionColliderElements[0]); + this->explosionColliderElements[0].base.atDmgInfo.damage += (thisx->shape.rot.z & 0xFF00) >> 8; thisx->shape.rot.z &= 0xFF; if (thisx->shape.rot.z & 0x80) { diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.h b/src/overlays/actors/ovl_En_Bom/z_en_bom.h index 9fcb0fe029..88c8feef5c 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.h +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.h @@ -12,7 +12,7 @@ typedef struct EnBom { /* 0x0000 */ Actor actor; /* 0x014C */ ColliderCylinder bombCollider; /* 0x0198 */ ColliderJntSph explosionCollider; - /* 0x01B8 */ ColliderJntSphElement explosionColliderItems[1]; + /* 0x01B8 */ ColliderJntSphElement explosionColliderElements[1]; /* 0x01F8 */ s16 timer; /* 0x01FA */ s16 flashSpeedScale; /* 0x01FC */ f32 flashIntensity; diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c index 2935faa451..1bbc6bbb7c 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c @@ -4,6 +4,7 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "one_point_cutscene.h" +#include "printf.h" #include "rand.h" #include "regs.h" #include "segmented_address.h" @@ -12,6 +13,7 @@ #include "z64effect.h" #include "z64play.h" #include "z64player.h" +#include "z64save.h" #include "assets/objects/object_bg/object_bg.h" diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c b/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c index 81442e856a..a911548df0 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c @@ -1,12 +1,14 @@ #include "z_en_bom_bowl_pit.h" #include "overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.h" +#include "printf.h" #include "regs.h" #include "sfx.h" #include "terminal.h" #include "z_lib.h" #include "z64play.h" #include "z64player.h" +#include "z64save.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c index 8d1df99a4d..7ce476d4ef 100644 --- a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c +++ b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c @@ -2,6 +2,7 @@ #include "overlays/actors/ovl_En_Bom/z_en_bom.h" #include "libc64/math64.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" @@ -41,7 +42,7 @@ ActorProfile En_Bom_Chu_Profile = { /**/ EnBomChu_Draw, }; -static ColliderJntSphElementInit sJntSphElemInit[] = { +static ColliderJntSphElementInit sJntSphElementsInit[] = { { { ELEM_MATERIAL_UNK0, @@ -64,8 +65,8 @@ static ColliderJntSphInit sJntSphInit = { OC2_TYPE_2, COLSHAPE_JNTSPH, }, - ARRAY_COUNT(sJntSphElemInit), - sJntSphElemInit, + ARRAY_COUNT(sJntSphElementsInit), + sJntSphElementsInit, }; static InitChainEntry sInitChain[] = { diff --git a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c index 34dd30010e..ed1d7eed79 100644 --- a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c +++ b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c @@ -5,9 +5,22 @@ */ #include "z_en_bombf.h" -#include "assets/objects/object_bombf/object_bombf.h" #include "overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "regs.h" +#include "rumble.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + +#include "assets/objects/object_bombf/object_bombf.h" + #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_UPDATE_CULLING_DISABLED) void EnBombf_Init(Actor* thisx, PlayState* play); @@ -94,7 +107,7 @@ void EnBombf_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->bombCollider); Collider_InitJntSph(play, &this->explosionCollider); Collider_SetCylinder(play, &this->bombCollider, thisx, &sCylinderInit); - Collider_SetJntSph(play, &this->explosionCollider, thisx, &sJntSphInit, &this->explosionColliderItems[0]); + Collider_SetJntSph(play, &this->explosionCollider, thisx, &sJntSphInit, &this->explosionColliderElements[0]); if (thisx->params == BOMBFLOWER_BODY) { shapeUnk10 = 1000.0f; diff --git a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h index 14bc9c6ece..840da79c19 100644 --- a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h +++ b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h @@ -2,7 +2,7 @@ #define Z_EN_BOMBF_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnBombf; @@ -12,7 +12,7 @@ typedef struct EnBombf { /* 0x0000 */ Actor actor; /* 0x014C */ ColliderCylinder bombCollider; /* 0x0198 */ ColliderJntSph explosionCollider; - /* 0x01B8 */ ColliderJntSphElement explosionColliderItems[1]; + /* 0x01B8 */ ColliderJntSphElement explosionColliderElements[1]; /* 0x01F8 */ s16 timer; /* 0x01FC */ EnBombfActionFunc actionFunc; /* 0x0200 */ s32 isFuseEnabled; // enables the ability to ignite and tick down to explode diff --git a/src/overlays/actors/ovl_En_Boom/z_en_boom.c b/src/overlays/actors/ovl_En_Boom/z_en_boom.c index 982df71a03..b9dcbacb76 100644 --- a/src/overlays/actors/ovl_En_Boom/z_en_boom.c +++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.c @@ -5,7 +5,16 @@ */ #include "z_en_boom.h" -#include "global.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.c b/src/overlays/actors/ovl_En_Box/z_en_box.c index 2d7c748b47..c4ef15919a 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -1,6 +1,25 @@ #include "z_en_box.h" -#include "global.h" #include "overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_math3d.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64curve.h" +#include "z64effect.h" +#include "z64ocarina.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_box/object_box.h" #define FLAGS 0 @@ -171,7 +190,9 @@ void EnBox_Init(Actor* thisx, PlayState* play2) { this->dyna.actor.world.rot.y += 0x8000; this->dyna.actor.home.rot.z = this->dyna.actor.world.rot.z = this->dyna.actor.shape.rot.z = 0; - SkelAnime_Init(play, &this->skelanime, &gTreasureChestSkel, anim, this->jointTable, this->morphTable, 5); + //! @bug Flex skeleton is used as normal skeleton + SkelAnime_Init(play, &this->skelanime, (SkeletonHeader*)&gTreasureChestSkel, anim, this->jointTable, + this->morphTable, 5); Animation_Change(&this->skelanime, anim, 1.5f, animFrameStart, endFrame, ANIMMODE_ONCE, 0.0f); switch (this->type) { @@ -619,7 +640,7 @@ void EnBox_Draw(Actor* thisx, PlayState* play) { and cleared by Open */ if ((this->alpha == 255 && !(this->type == ENBOX_TYPE_4 || this->type == ENBOX_TYPE_6)) || - (!CHECK_FLAG_ALL(this->dyna.actor.flags, ACTOR_FLAG_REACT_TO_LENS) && + (!ACTOR_FLAGS_CHECK_ALL(&this->dyna.actor, ACTOR_FLAG_REACT_TO_LENS) && (this->type == ENBOX_TYPE_4 || this->type == ENBOX_TYPE_6))) { gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); diff --git a/src/overlays/actors/ovl_En_Brob/z_en_brob.c b/src/overlays/actors/ovl_En_Brob/z_en_brob.c index 89edf9c5f6..436f4740c5 100644 --- a/src/overlays/actors/ovl_En_Brob/z_en_brob.c +++ b/src/overlays/actors/ovl_En_Brob/z_en_brob.c @@ -5,6 +5,15 @@ */ #include "z_en_brob.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/object_brob/object_brob.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE) diff --git a/src/overlays/actors/ovl_En_Brob/z_en_brob.h b/src/overlays/actors/ovl_En_Brob/z_en_brob.h index a3dd0c8f8a..02516f4e9b 100644 --- a/src/overlays/actors/ovl_En_Brob/z_en_brob.h +++ b/src/overlays/actors/ovl_En_Brob/z_en_brob.h @@ -2,11 +2,11 @@ #define Z_EN_BROB_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnBrob; -typedef void (*EnBrobActionFunc)(struct EnBrob* this, PlayState* play); +typedef void (*EnBrobActionFunc)(struct EnBrob* this, struct PlayState* play); typedef struct EnBrob { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c index 466ebfce65..79860d7f7f 100644 --- a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c +++ b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c @@ -1,4 +1,16 @@ #include "z_en_bubble.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sfx.h" +#include "sys_math3d.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/object_bubble/object_bubble.h" #define FLAGS ACTOR_FLAG_ATTENTION_ENABLED @@ -95,7 +107,7 @@ void EnBubble_SetDimensions(EnBubble* this, f32 dim) { } u32 func_809CBCBC(EnBubble* this) { - ColliderElement* elem = &this->colliderSphere.elements[0].base; + ColliderElement* elem = &this->colliderJntSph.elements[0].base; elem->atDmgInfo.dmgFlags = DMG_EXPLOSIVE; elem->atDmgInfo.effect = 0; @@ -112,7 +124,7 @@ u32 func_809CBCEC(EnBubble* this) { } void EnBubble_DamagePlayer(EnBubble* this, PlayState* play) { - s32 damage = -this->colliderSphere.elements[0].base.atDmgInfo.damage; + s32 damage = -this->colliderJntSph.elements[0].base.atDmgInfo.damage; play->damagePlayer(play, damage); Actor_SetPlayerKnockbackSmallNoDamage(play, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f); @@ -206,8 +218,8 @@ void EnBubble_Fly(EnBubble* this, PlayState* play) { s32 bgId; u8 bounceCount; - if (this->colliderSphere.elements[1].base.acElemFlags & ACELEM_HIT) { - attackerActor = this->colliderSphere.base.ac; + if (this->colliderJntSph.elements[1].base.acElemFlags & ACELEM_HIT) { + attackerActor = this->colliderJntSph.base.ac; this->normalizedAttackerVelocity = attackerActor->velocity; EnBubble_Vec3fNormalize(&this->normalizedAttackerVelocity); this->velocityFromAttack.x += (this->normalizedAttackerVelocity.x * 3.0f); @@ -280,14 +292,14 @@ void EnBubble_Fly(EnBubble* this, PlayState* play) { } u32 func_809CC648(EnBubble* this) { - if (((this->colliderSphere.base.acFlags & AC_HIT) != 0) == false) { + if (((this->colliderJntSph.base.acFlags & AC_HIT) != 0) == false) { return false; } - this->colliderSphere.base.acFlags &= ~AC_HIT; - if (this->colliderSphere.elements[1].base.acElemFlags & ACELEM_HIT) { - this->unk_1F0.x = this->colliderSphere.base.ac->velocity.x / 10.0f; - this->unk_1F0.y = this->colliderSphere.base.ac->velocity.y / 10.0f; - this->unk_1F0.z = this->colliderSphere.base.ac->velocity.z / 10.0f; + this->colliderJntSph.base.acFlags &= ~AC_HIT; + if (this->colliderJntSph.elements[1].base.acElemFlags & ACELEM_HIT) { + this->unk_1F0.x = this->colliderJntSph.base.ac->velocity.x / 10.0f; + this->unk_1F0.y = this->colliderJntSph.base.ac->velocity.y / 10.0f; + this->unk_1F0.z = this->colliderJntSph.base.ac->velocity.z / 10.0f; this->graphicRotSpeed = 128.0f; this->graphicEccentricity = 0.48f; return false; @@ -300,8 +312,8 @@ u32 EnBubble_DetectPop(EnBubble* this, PlayState* play) { if (DECR(this->unk_208) != 0 || this->actionFunc == EnBubble_Pop) { return false; } - if (this->colliderSphere.base.ocFlags2 & OC2_HIT_PLAYER) { - this->colliderSphere.base.ocFlags2 &= ~OC2_HIT_PLAYER; + if (this->colliderJntSph.base.ocFlags2 & OC2_HIT_PLAYER) { + this->colliderJntSph.base.ocFlags2 &= ~OC2_HIT_PLAYER; EnBubble_DamagePlayer(this, play); this->unk_208 = 8; return true; @@ -314,7 +326,7 @@ void func_809CC774(EnBubble* this) { Vec3f src; Vec3f dest; - dim = &this->colliderSphere.elements[0].dim; + dim = &this->colliderJntSph.elements[0].dim; src.x = dim->modelSphere.center.x; src.y = dim->modelSphere.center.y; src.z = dim->modelSphere.center.z; @@ -324,7 +336,7 @@ void func_809CC774(EnBubble* this) { dim->worldSphere.center.y = dest.y; dim->worldSphere.center.z = dest.z; dim->worldSphere.radius = dim->modelSphere.radius * (1.0f + this->expansionWidth); - this->colliderSphere.elements[1].dim = *dim; + this->colliderJntSph.elements[1].dim = *dim; } void EnBubble_Init(Actor* thisx, PlayState* play) { @@ -332,8 +344,8 @@ void EnBubble_Init(Actor* thisx, PlayState* play) { u32 pad; ActorShape_Init(&this->actor.shape, 16.0f, ActorShadow_DrawCircle, 0.2f); - Collider_InitJntSph(play, &this->colliderSphere); - Collider_SetJntSph(play, &this->colliderSphere, &this->actor, &sJntSphInit, this->colliderSphereItems); + Collider_InitJntSph(play, &this->colliderJntSph); + Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElements); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(9), &sColChkInfoInit2); this->actor.naviEnemyId = NAVI_ENEMY_SHABOM; this->bounceDirection.x = Rand_ZeroOne(); @@ -350,7 +362,7 @@ void EnBubble_Init(Actor* thisx, PlayState* play) { void EnBubble_Destroy(Actor* thisx, PlayState* play) { EnBubble* this = (EnBubble*)thisx; - Collider_DestroyJntSph(play, &this->colliderSphere); + Collider_DestroyJntSph(play, &this->colliderJntSph); } void EnBubble_Wait(EnBubble* this, PlayState* play) { @@ -360,8 +372,8 @@ void EnBubble_Wait(EnBubble* this, PlayState* play) { } else { EnBubble_Fly(this, play); this->actor.shape.yOffset = ((this->expansionHeight + 1.0f) * 16.0f); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSphere.base); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderSphere.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderJntSph.base); } } @@ -389,8 +401,8 @@ void EnBubble_Regrow(EnBubble* this, PlayState* play) { if (func_809CC020(this)) { this->actionFunc = EnBubble_Wait; } - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSphere.base); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderSphere.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderJntSph.base); } void EnBubble_Update(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.h b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.h index d753768811..9b183ae2bc 100644 --- a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.h +++ b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.h @@ -2,17 +2,17 @@ #define Z_EN_BUBBLE_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnBubble; -typedef void (*EnBubbleActionFunc)(struct EnBubble*, PlayState*); +typedef void (*EnBubbleActionFunc)(struct EnBubble*, struct PlayState*); typedef struct EnBubble { /* 0x0000 */ Actor actor; /* 0x014C */ EnBubbleActionFunc actionFunc; - /* 0x0150 */ ColliderJntSph colliderSphere; - /* 0x0170 */ ColliderJntSphElement colliderSphereItems[2]; + /* 0x0150 */ ColliderJntSph colliderJntSph; + /* 0x0170 */ ColliderJntSphElement colliderJntSphElements[2]; /* 0x01F0 */ Vec3f unk_1F0; // set but never used /* 0x01FC */ Vec3f unk_1FC; // randomly generated, set but never used /* 0x0208 */ s16 unk_208; // set to 8 when about to pop diff --git a/src/overlays/actors/ovl_En_Butte/z_en_butte.c b/src/overlays/actors/ovl_En_Butte/z_en_butte.c index b3deb35f9e..c206adfbf5 100644 --- a/src/overlays/actors/ovl_En_Butte/z_en_butte.c +++ b/src/overlays/actors/ovl_En_Butte/z_en_butte.c @@ -6,6 +6,20 @@ #include "z_en_butte.h" #include "overlays/actors/ovl_En_Elf/z_en_elf.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_math3d.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/gameplay_field_keep/gameplay_field_keep.h" @@ -159,7 +173,7 @@ void EnButte_Init(Actor* thisx, PlayState* play) { SkelAnime_Init(play, &this->skelAnime, &gButterflySkel, &gButterflyAnim, this->jointTable, this->morphTable, 8); Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sColliderInit, this->colliderItems); + Collider_SetJntSph(play, &this->collider, &this->actor, &sColliderInit, this->colliderElements); this->actor.colChkInfo.mass = 0; this->unk_25C = Rand_ZeroOne() * 0xFFFF; this->unk_25E = Rand_ZeroOne() * 0xFFFF; diff --git a/src/overlays/actors/ovl_En_Butte/z_en_butte.h b/src/overlays/actors/ovl_En_Butte/z_en_butte.h index 1a34747dbd..1a1764520c 100644 --- a/src/overlays/actors/ovl_En_Butte/z_en_butte.h +++ b/src/overlays/actors/ovl_En_Butte/z_en_butte.h @@ -2,16 +2,16 @@ #define Z_EN_BUTTE_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnButte; -typedef void (*EnButteActionFunc)(struct EnButte*, PlayState*); +typedef void (*EnButteActionFunc)(struct EnButte*, struct PlayState*); typedef struct EnButte { /* 0x0000 */ Actor actor; /* 0x014C */ ColliderJntSph collider; - /* 0x016C */ ColliderJntSphElement colliderItems[1]; + /* 0x016C */ ColliderJntSphElement colliderElements[1]; /* 0x01AC */ SkelAnime skelAnime; /* 0x01F0 */ Vec3s jointTable[8]; /* 0x0220 */ Vec3s morphTable[8]; diff --git a/src/overlays/actors/ovl_En_Bw/z_en_bw.c b/src/overlays/actors/ovl_En_Bw/z_en_bw.c index 6ab5fd6fcf..0aad9cccae 100644 --- a/src/overlays/actors/ovl_En_Bw/z_en_bw.c +++ b/src/overlays/actors/ovl_En_Bw/z_en_bw.c @@ -5,7 +5,24 @@ */ #include "z_en_bw.h" + +#include "libc64/math64.h" +#include "libc64/qrand.h" +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "rand.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_math.h" +#include "sys_matrix.h" #include "versions.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_bw/object_bw.h" diff --git a/src/overlays/actors/ovl_En_Bw/z_en_bw.h b/src/overlays/actors/ovl_En_Bw/z_en_bw.h index 5f74f70c4d..7c0698d22c 100644 --- a/src/overlays/actors/ovl_En_Bw/z_en_bw.h +++ b/src/overlays/actors/ovl_En_Bw/z_en_bw.h @@ -2,10 +2,10 @@ #define Z_EN_BW_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnBw; -typedef void (*EnBwActionFunc)(struct EnBw*, PlayState*); +typedef void (*EnBwActionFunc)(struct EnBw*, struct PlayState*); typedef enum TorchSlugLimb { /* 0 */ TORCH_SLUG_LIMB_NONE, diff --git a/src/overlays/actors/ovl_En_Bx/z_en_bx.c b/src/overlays/actors/ovl_En_Bx/z_en_bx.c index efc4d4f5cf..51896cbb7d 100644 --- a/src/overlays/actors/ovl_En_Bx/z_en_bx.c +++ b/src/overlays/actors/ovl_En_Bx/z_en_bx.c @@ -5,6 +5,19 @@ */ #include "z_en_bx.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "rand.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_bxa/object_bxa.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_En_Bx/z_en_bx.h b/src/overlays/actors/ovl_En_Bx/z_en_bx.h index 189349a0f1..077def413d 100644 --- a/src/overlays/actors/ovl_En_Bx/z_en_bx.h +++ b/src/overlays/actors/ovl_En_Bx/z_en_bx.h @@ -2,7 +2,7 @@ #define Z_EN_BX_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnBx; diff --git a/src/overlays/actors/ovl_En_Changer/z_en_changer.c b/src/overlays/actors/ovl_En_Changer/z_en_changer.c index 60594097ce..95debf0273 100644 --- a/src/overlays/actors/ovl_En_Changer/z_en_changer.c +++ b/src/overlays/actors/ovl_En_Changer/z_en_changer.c @@ -5,9 +5,17 @@ */ #include "z_en_changer.h" -#include "terminal.h" -#include "overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h" +#include "overlays/actors/ovl_En_Box/z_en_box.h" #include "overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h" +#include "overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h" + +#include "printf.h" +#include "rand.h" +#include "regs.h" +#include "terminal.h" +#include "z64debug_display.h" +#include "z64play.h" +#include "z64save.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_En_Changer/z_en_changer.h b/src/overlays/actors/ovl_En_Changer/z_en_changer.h index 75281b2343..6807287787 100644 --- a/src/overlays/actors/ovl_En_Changer/z_en_changer.h +++ b/src/overlays/actors/ovl_En_Changer/z_en_changer.h @@ -2,19 +2,18 @@ #define Z_EN_CHANGER_H #include "ultra64.h" -#include "global.h" -#include "overlays/actors/ovl_En_Box/z_en_box.h" +#include "z64actor.h" struct EnChanger; -typedef void (*EnChangerActionFunc)(struct EnChanger*, PlayState*); +typedef void (*EnChangerActionFunc)(struct EnChanger*, struct PlayState*); typedef struct EnChanger { /* 0x0000 */ Actor actor; /* 0x014C */ EnChangerActionFunc actionFunc; - /* 0x0150 */ EnBox* leftChest; - /* 0x0154 */ EnBox* rightChest; - /* 0x0158 */ EnBox* finalChest; + /* 0x0150 */ struct EnBox* leftChest; + /* 0x0154 */ struct EnBox* rightChest; + /* 0x0158 */ struct EnBox* finalChest; /* 0x015C */ s16 leftChestNum; /* 0x015E */ s16 rightChestNum; /* 0x0160 */ s16 leftChestGetItemId; diff --git a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c index c6cf2c7ad3..6bcbd62323 100644 --- a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c +++ b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c @@ -1,5 +1,18 @@ #include "z_en_clear_tag.h" +#include "libc64/math64.h" +#include "libc64/qrand.h" +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "rand.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" + #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ ACTOR_FLAG_DRAW_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h index 945a5462d6..6978941868 100644 --- a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h +++ b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h @@ -2,7 +2,7 @@ #define Z_EN_CLEAR_TAG_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnClearTag; diff --git a/src/overlays/actors/ovl_En_Cow/z_en_cow.c b/src/overlays/actors/ovl_En_Cow/z_en_cow.c index 30d16077f5..d459c93f6f 100644 --- a/src/overlays/actors/ovl_En_Cow/z_en_cow.c +++ b/src/overlays/actors/ovl_En_Cow/z_en_cow.c @@ -6,6 +6,18 @@ #include "z_en_cow.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "rand.h" +#include "regs.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64ocarina.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY) void EnCow_Init(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Cow/z_en_cow.h b/src/overlays/actors/ovl_En_Cow/z_en_cow.h index cdec79fca8..e5602967e1 100644 --- a/src/overlays/actors/ovl_En_Cow/z_en_cow.h +++ b/src/overlays/actors/ovl_En_Cow/z_en_cow.h @@ -2,7 +2,7 @@ #define Z_EN_COW_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" #include "assets/objects/object_cow/object_cow.h" #define COW_FLAG_PLAYER_NEARBY (1 << 1) @@ -23,7 +23,7 @@ typedef enum CowCollider { struct EnCow; -typedef void (*EnCowActionFunc)(struct EnCow*, PlayState*); +typedef void (*EnCowActionFunc)(struct EnCow*, struct PlayState*); typedef struct EnCow { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Crow/z_en_crow.c b/src/overlays/actors/ovl_En_Crow/z_en_crow.c index a2533df3d5..3ce86ff9d3 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.c +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.c @@ -1,4 +1,16 @@ #include "z_en_crow.h" + +#include "gfx_setupdl.h" +#include "ichain.h" +#include "rand.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_crow/object_crow.h" #define FLAGS \ @@ -112,7 +124,7 @@ void EnCrow_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); SkelAnime_InitFlex(play, &this->skelAnime, &gGuaySkel, &gGuayFlyAnim, this->jointTable, this->morphTable, 9); Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); this->collider.elements[0].dim.worldSphere.radius = sJntSphInit.elements[0].dim.modelSphere.radius; CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); ActorShape_Init(&this->actor.shape, 2000.0f, ActorShadow_DrawCircle, 20.0f); diff --git a/src/overlays/actors/ovl_En_Crow/z_en_crow.h b/src/overlays/actors/ovl_En_Crow/z_en_crow.h index 87e9ae0542..fb13e7bca6 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.h +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.h @@ -2,11 +2,11 @@ #define Z_EN_CROW_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnCrow; -typedef void (*EnCrowActionFunc)(struct EnCrow*, PlayState*); +typedef void (*EnCrowActionFunc)(struct EnCrow*, struct PlayState*); typedef struct EnCrow { /* 0x0000 */ Actor actor; @@ -19,7 +19,7 @@ typedef struct EnCrow { /* 0x01CA */ Vec3s jointTable[9]; /* 0x0200 */ Vec3s morphTable[9]; /* 0x0238 */ ColliderJntSph collider; - /* 0x0258 */ ColliderJntSphElement colliderItems[1]; + /* 0x0258 */ ColliderJntSphElement colliderElements[1]; } EnCrow; // size = 0x0298 #endif diff --git a/src/overlays/actors/ovl_En_Cs/z_en_cs.c b/src/overlays/actors/ovl_En_Cs/z_en_cs.c index 807abac5ec..8b74a6063e 100644 --- a/src/overlays/actors/ovl_En_Cs/z_en_cs.c +++ b/src/overlays/actors/ovl_En_Cs/z_en_cs.c @@ -1,4 +1,18 @@ #include "z_en_cs.h" + +#include "libc64/math64.h" +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64face_reaction.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_cs/object_cs.h" #include "assets/objects/object_link_child/object_link_child.h" diff --git a/src/overlays/actors/ovl_En_Cs/z_en_cs.h b/src/overlays/actors/ovl_En_Cs/z_en_cs.h index 843c8ad510..8e1d665f54 100644 --- a/src/overlays/actors/ovl_En_Cs/z_en_cs.h +++ b/src/overlays/actors/ovl_En_Cs/z_en_cs.h @@ -2,11 +2,11 @@ #define Z_EN_CS_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnCs; -typedef void (*EnCsActionFunc)(struct EnCs*, PlayState*); +typedef void (*EnCsActionFunc)(struct EnCs*, struct PlayState*); typedef struct EnCs { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c index 64b3cc1088..98a09bb25e 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c @@ -1,10 +1,27 @@ #include "z_en_daiku.h" #include "overlays/actors/ovl_En_GeldB/z_en_geldb.h" + +#include "libc64/math64.h" +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_daiku/object_daiku.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED) #define ENDAIKU_GET_TYPE(thisx) PARAMS_GET_U((thisx)->params, 0, 2) +#define ENDAIKU_GET_PATH_INDEX(thisx) PARAMS_GET_U((thisx)->params, 4, 4) +#define ENDAIKU_GET_DOOR_SWITCH_FLAG(thisx) PARAMS_GET_U((thisx)->params, 8, 6) typedef struct EnDaikuEscapeSubCamParam { Vec3f eyePosDeltaLocal; @@ -13,10 +30,10 @@ typedef struct EnDaikuEscapeSubCamParam { // state flags -// probably related to animating torso and head to look towards the player -#define ENDAIKU_STATEFLAG_1 (1 << 1) -// same -#define ENDAIKU_STATEFLAG_2 (1 << 2) +// the carpenter tracks the player position +#define ENDAIKU_STATEFLAG_TRACK_PLAYER (1 << 1) +// if tracking the player, track with the carpenter's full body +#define ENDAIKU_STATEFLAG_TRACK_WITH_FULL_BODY (1 << 2) // the gerudo guard appeared (after talking to the carpenter) #define ENDAIKU_STATEFLAG_GERUDOFIGHTING (1 << 3) // the gerudo guard was defeated @@ -121,9 +138,9 @@ typedef enum EnDaikuAnimation { } EnDaikuAnimation; static AnimationFrameCountInfo sAnimationInfo[] = { - { &object_daiku_Anim_001AB0, 1.0f, 0, 0 }, { &object_daiku_Anim_007DE0, 1.0f, 0, 0 }, - { &object_daiku_Anim_00885C, 1.0f, 0, 0 }, { &object_daiku_Anim_000C44, 1.0f, 0, 0 }, - { &object_daiku_Anim_008164, 1.0f, 0, 0 }, + { &object_daiku_Anim_001AB0, 1.0f, ANIMMODE_LOOP, 0 }, { &object_daiku_Anim_007DE0, 1.0f, ANIMMODE_LOOP, 0 }, + { &object_daiku_Anim_00885C, 1.0f, ANIMMODE_LOOP, 0 }, { &object_daiku_Anim_000C44, 1.0f, ANIMMODE_LOOP, 0 }, + { &object_daiku_Anim_008164, 1.0f, ANIMMODE_LOOP, 0 }, }; static EnDaikuEscapeSubCamParam sEscapeSubCamParams[] = { @@ -199,15 +216,15 @@ void EnDaiku_Init(Actor* thisx, PlayState* play) { if (play->sceneId == SCENE_THIEVES_HIDEOUT) { EnDaiku_ChangeAnim(this, ENDAIKU_ANIM_STAND, &this->currentAnimIndex); - this->stateFlags |= ENDAIKU_STATEFLAG_1 | ENDAIKU_STATEFLAG_2; + this->stateFlags |= ENDAIKU_STATEFLAG_TRACK_PLAYER | ENDAIKU_STATEFLAG_TRACK_WITH_FULL_BODY; this->actionFunc = EnDaiku_Jailed; } else { if (ENDAIKU_GET_TYPE(&this->actor) == ENDAIKU_TYPE1 || ENDAIKU_GET_TYPE(&this->actor) == ENDAIKU_TYPE3) { EnDaiku_ChangeAnim(this, ENDAIKU_ANIM_SIT, &this->currentAnimIndex); - this->stateFlags |= ENDAIKU_STATEFLAG_1; + this->stateFlags |= ENDAIKU_STATEFLAG_TRACK_PLAYER; } else { EnDaiku_ChangeAnim(this, ENDAIKU_ANIM_SHOUT, &this->currentAnimIndex); - this->stateFlags |= ENDAIKU_STATEFLAG_1 | ENDAIKU_STATEFLAG_2; + this->stateFlags |= ENDAIKU_STATEFLAG_TRACK_PLAYER | ENDAIKU_STATEFLAG_TRACK_WITH_FULL_BODY; } this->skelAnime.curFrame = (s32)(Rand_ZeroOne() * this->skelAnime.endFrame); @@ -257,17 +274,17 @@ s32 EnDaiku_UpdateTalking(EnDaiku* this, PlayState* play) { void EnDaiku_UpdateText(EnDaiku* this, PlayState* play) { s32 carpenterType; s32 rescuedCount; - s16 sp2E; - s16 sp2C; + s16 screenX; + s16 screenY; if (this->talkState == ENDAIKU_STATE_TALKING) { this->talkState = EnDaiku_UpdateTalking(this, play); } else if (Actor_TalkOfferAccepted(&this->actor, play)) { this->talkState = ENDAIKU_STATE_TALKING; } else { - Actor_GetScreenPos(play, &this->actor, &sp2E, &sp2C); - if (sp2E >= 0 && sp2E <= 320 && sp2C >= 0 && sp2C <= 240 && this->talkState == ENDAIKU_STATE_CAN_TALK && - Actor_OfferTalk(&this->actor, play, 100.0f) == 1) { + Actor_GetScreenPos(play, &this->actor, &screenX, &screenY); + if ((screenX >= 0) && (screenX <= SCREEN_WIDTH) && (screenY >= 0) && (screenY <= SCREEN_HEIGHT) && + (this->talkState == ENDAIKU_STATE_CAN_TALK) && (Actor_OfferTalk(&this->actor, play, 100.0f) == true)) { if (play->sceneId == SCENE_THIEVES_HIDEOUT) { if (this->stateFlags & ENDAIKU_STATEFLAG_GERUDODEFEATED) { rescuedCount = 0; @@ -352,8 +369,6 @@ void EnDaiku_TentIdle(EnDaiku* this, PlayState* play) { */ void EnDaiku_Jailed(EnDaiku* this, PlayState* play) { EnGeldB* gerudo; - s32 temp_t9; - s32 temp_v1; if (!(this->stateFlags & ENDAIKU_STATEFLAG_GERUDOFIGHTING)) { EnDaiku_UpdateText(this, play); @@ -379,7 +394,7 @@ void EnDaiku_Jailed(EnDaiku* this, PlayState* play) { void EnDaiku_WaitFreedom(EnDaiku* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6))) { + if (Flags_GetSwitch(play, ENDAIKU_GET_DOOR_SWITCH_FLAG(&this->actor))) { this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY; EnDaiku_UpdateText(this, play); } @@ -398,7 +413,7 @@ void EnDaiku_InitEscape(EnDaiku* this, PlayState* play) { Audio_PlayFanfare(NA_BGM_APPEAR); EnDaiku_ChangeAnim(this, ENDAIKU_ANIM_RUN, &this->currentAnimIndex); - this->stateFlags &= ~(ENDAIKU_STATEFLAG_1 | ENDAIKU_STATEFLAG_2); + this->stateFlags &= ~(ENDAIKU_STATEFLAG_TRACK_PLAYER | ENDAIKU_STATEFLAG_TRACK_WITH_FULL_BODY); ENDAIKU_SET_CARPENTER_RESCUED(ENDAIKU_GET_TYPE(&this->actor)); @@ -407,7 +422,7 @@ void EnDaiku_InitEscape(EnDaiku* this, PlayState* play) { EnDaiku_InitSubCamera(this, play); exitLoop = false; - path = &play->pathList[PARAMS_GET_U(this->actor.params, 4, 4)]; + path = &play->pathList[ENDAIKU_GET_PATH_INDEX(&this->actor)]; while (!exitLoop) { pointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->waypoint; dx = pointPos->x - this->actor.world.pos.x; @@ -524,7 +539,7 @@ void EnDaiku_EscapeRun(EnDaiku* this, PlayState* play) { f32 dxz; Vec3s* pointPos; - path = &play->pathList[PARAMS_GET_U(this->actor.params, 4, 4)]; + path = &play->pathList[ENDAIKU_GET_PATH_INDEX(&this->actor)]; pointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->waypoint; dx = pointPos->x - this->actor.world.pos.x; dz = pointPos->z - this->actor.world.pos.z; @@ -574,12 +589,12 @@ void EnDaiku_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if (this->stateFlags & ENDAIKU_STATEFLAG_1) { + if (this->stateFlags & ENDAIKU_STATEFLAG_TRACK_PLAYER) { this->interactInfo.trackPos.x = player->actor.focus.pos.x; this->interactInfo.trackPos.y = player->actor.focus.pos.y; this->interactInfo.trackPos.z = player->actor.focus.pos.z; - if (this->stateFlags & ENDAIKU_STATEFLAG_2) { + if (this->stateFlags & ENDAIKU_STATEFLAG_TRACK_WITH_FULL_BODY) { Npc_TrackPoint(&this->actor, &this->interactInfo, 0, NPC_TRACKING_FULL_BODY); } else { Npc_TrackPoint(&this->actor, &this->interactInfo, 0, NPC_TRACKING_HEAD_AND_TORSO); diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h index 69136f6a92..b191c1d79f 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h @@ -2,11 +2,11 @@ #define Z_EN_DAIKU_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnDaiku; -typedef void (*EnDaikuActionFunc)(struct EnDaiku*, PlayState*); +typedef void (*EnDaikuActionFunc)(struct EnDaiku*, struct PlayState*); typedef enum EnDaikuType { ENDAIKU_TYPE0, diff --git a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c index 6b27191f79..f469d5626f 100644 --- a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c +++ b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c @@ -5,10 +5,28 @@ */ #include "z_en_daiku_kakariko.h" + +#include "libc64/math64.h" +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64face_reaction.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_daiku/object_daiku.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED) +#define ENDAIKUKAKARIKO_GET_TYPE(thisx) PARAMS_GET_U((thisx)->params, 0, 2) +#define ENDAIKUKAKARIKO_GET_PATH_INDEX(thisx) PARAMS_GET_U((thisx)->params, 8, 8) + typedef enum KakarikoCarpenterType { /* 0x0 */ CARPENTER_ICHIRO, // Red and purple pants, normal hair /* 0x1 */ CARPENTER_SABOORO, // Light blue pants @@ -103,9 +121,12 @@ typedef enum EnDaikuKakarikoAnimation { } EnDaikuKakarikoAnimation; static AnimationFrameCountInfo sAnimationInfo[] = { - { &object_daiku_Anim_001AB0, 1.0f, 2, -7.0f }, { &object_daiku_Anim_007DE0, 1.0f, 0, -7.0f }, - { &object_daiku_Anim_00885C, 1.0f, 0, -7.0f }, { &object_daiku_Anim_000C44, 1.0f, 0, -7.0f }, - { &object_daiku_Anim_000600, 1.0f, 0, -7.0f }, { &object_daiku_Anim_008164, 1.0f, 0, -7.0f }, + { &object_daiku_Anim_001AB0, 1.0f, ANIMMODE_ONCE, -7.0f }, + { &object_daiku_Anim_007DE0, 1.0f, ANIMMODE_LOOP, -7.0f }, + { &object_daiku_Anim_00885C, 1.0f, ANIMMODE_LOOP, -7.0f }, + { &object_daiku_Anim_000C44, 1.0f, ANIMMODE_LOOP, -7.0f }, + { &object_daiku_Anim_000600, 1.0f, ANIMMODE_LOOP, -7.0f }, + { &object_daiku_Anim_008164, 1.0f, ANIMMODE_LOOP, -7.0f }, }; void EnDaikuKakariko_ChangeAnim(EnDaikuKakariko* this, s32 index, s32* currentIndex) { @@ -133,7 +154,7 @@ void EnDaikuKakariko_Init(Actor* thisx, PlayState* play) { case SCENE_KAKARIKO_VILLAGE: if (IS_DAY) { this->flags |= 1; - this->flags |= initFlags[PARAMS_GET_U(this->actor.params, 0, 2)]; + this->flags |= initFlags[ENDAIKUKAKARIKO_GET_TYPE(&this->actor)]; } break; case SCENE_KAKARIKO_CENTER_GUEST_HOUSE: @@ -184,8 +205,8 @@ void EnDaikuKakariko_Init(Actor* thisx, PlayState* play) { this->actionFunc = EnDaikuKakariko_Run; } else { if (this->flags & 8) { - if ((PARAMS_GET_U(this->actor.params, 0, 2) == CARPENTER_SABOORO) || - (PARAMS_GET_U(this->actor.params, 0, 2) == CARPENTER_SHIRO)) { + if ((ENDAIKUKAKARIKO_GET_TYPE(&this->actor) == CARPENTER_SABOORO) || + (ENDAIKUKAKARIKO_GET_TYPE(&this->actor) == CARPENTER_SHIRO)) { EnDaikuKakariko_ChangeAnim(this, ENDAIKUKAKARIKO_ANIM_5, &this->currentAnimIndex); this->flags |= 0x800; } else { @@ -233,23 +254,23 @@ void EnDaikuKakariko_HandleTalking(EnDaikuKakariko* this, PlayState* play) { MASK_REACTION_SET_CARPENTER_3, MASK_REACTION_SET_CARPENTER_4, }; - s16 sp26; - s16 sp24; + s16 screenX; + s16 screenY; if (this->talkState == 2) { this->talkState = EnDaikuKakariko_GetTalkState(this, play); } else if (Actor_TalkOfferAccepted(&this->actor, play)) { this->talkState = 2; } else { - Actor_GetScreenPos(play, &this->actor, &sp26, &sp24); + Actor_GetScreenPos(play, &this->actor, &screenX, &screenY); - if ((sp26 >= 0) && (sp26 <= 320) && (sp24 >= 0) && (sp24 <= 240) && (this->talkState == 0) && - (Actor_OfferTalk(&this->actor, play, 100.0f) == 1)) { + if ((screenX >= 0) && (screenX <= SCREEN_WIDTH) && (screenY >= 0) && (screenY <= SCREEN_HEIGHT) && + (this->talkState == 0) && (Actor_OfferTalk(&this->actor, play, 100.0f) == true)) { this->actor.textId = - MaskReaction_GetTextId(play, sMaskReactionSets[PARAMS_GET_U(this->actor.params, 0, 2)]); + MaskReaction_GetTextId(play, sMaskReactionSets[ENDAIKUKAKARIKO_GET_TYPE(&this->actor)]); if (this->actor.textId == 0) { - switch (PARAMS_GET_U(this->actor.params, 0, 2)) { + switch (ENDAIKUKAKARIKO_GET_TYPE(&this->actor)) { case 0: if (this->flags & 8) { this->actor.textId = 0x5076; @@ -366,7 +387,7 @@ void EnDaikuKakariko_Run(EnDaikuKakariko* this, PlayState* play) { s32 run; do { - path = &play->pathList[PARAMS_GET_U(this->actor.params, 8, 8)]; + path = &play->pathList[ENDAIKUKAKARIKO_GET_PATH_INDEX(&this->actor)]; pathPos = &((Vec3s*)SEGMENTED_TO_VIRTUAL(path->points))[this->waypoint]; xDist = pathPos->x - this->actor.world.pos.x; zDist = pathPos->z - this->actor.world.pos.z; @@ -538,7 +559,7 @@ void EnDaikuKakariko_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, V if (limbIndex == 15) { Matrix_MultVec3f(&unkVec, &this->actor.focus.pos); - gSPDisplayList(POLY_OPA_DISP++, carpenterHeadDLists[PARAMS_GET_U(this->actor.params, 0, 2)]); + gSPDisplayList(POLY_OPA_DISP++, carpenterHeadDLists[ENDAIKUKAKARIKO_GET_TYPE(&this->actor)]); } CLOSE_DISPS(play->state.gfxCtx, "../z_en_daiku_kakariko.c", 1113); @@ -551,13 +572,13 @@ void EnDaikuKakariko_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL_25Opa(play->state.gfxCtx); - if (PARAMS_GET_U(thisx->params, 0, 2) == CARPENTER_ICHIRO) { + if (ENDAIKUKAKARIKO_GET_TYPE(thisx) == CARPENTER_ICHIRO) { gDPSetEnvColor(POLY_OPA_DISP++, 170, 10, 70, 255); - } else if (PARAMS_GET_U(thisx->params, 0, 2) == CARPENTER_SABOORO) { + } else if (ENDAIKUKAKARIKO_GET_TYPE(thisx) == CARPENTER_SABOORO) { gDPSetEnvColor(POLY_OPA_DISP++, 170, 200, 255, 255); - } else if (PARAMS_GET_U(thisx->params, 0, 2) == CARPENTER_JIRO) { + } else if (ENDAIKUKAKARIKO_GET_TYPE(thisx) == CARPENTER_JIRO) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 230, 70, 255); - } else if (PARAMS_GET_U(thisx->params, 0, 2) == CARPENTER_SHIRO) { + } else if (ENDAIKUKAKARIKO_GET_TYPE(thisx) == CARPENTER_SHIRO) { gDPSetEnvColor(POLY_OPA_DISP++, 200, 0, 150, 255); } diff --git a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.h b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.h index 5d3596d58f..1395b6e259 100644 --- a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.h +++ b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.h @@ -2,11 +2,11 @@ #define Z_EN_DAIKU_KAKARIKO_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnDaikuKakariko; -typedef void (*EnDaikuKakarikoActionFunc)(struct EnDaikuKakariko*, PlayState*); +typedef void (*EnDaikuKakarikoActionFunc)(struct EnDaikuKakariko*, struct PlayState*); typedef struct EnDaikuKakariko { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c index a770abcb63..df9b566f87 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -1,8 +1,22 @@ #include "z_en_dekubaba.h" -#include "assets/objects/object_dekubaba/object_dekubaba.h" -#include "assets/objects/gameplay_keep/gameplay_keep.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/gameplay_keep/gameplay_keep.h" +#include "assets/objects/object_dekubaba/object_dekubaba.h" + #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE) void EnDekubaba_Init(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h index b1d53307ce..46a8b8dbdf 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h @@ -2,11 +2,11 @@ #define Z_EN_DEKUBABA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnDekubaba; -typedef void (*EnDekubabaActionFunc)(struct EnDekubaba*, PlayState*); +typedef void (*EnDekubabaActionFunc)(struct EnDekubaba*, struct PlayState*); typedef enum DekuBabaType { /* 0 */ DEKUBABA_NORMAL, @@ -25,7 +25,7 @@ typedef struct EnDekubaba { /* 0x01D0 */ Vec3s jointTable[8]; /* 0x0200 */ Vec3s morphTable[8]; /* 0x0230 */ f32 size; // Used everywhere to rescale offsets etc. for Big ones - /* 0x0234 */ CollisionPoly* boundFloor; + /* 0x0234 */ struct CollisionPoly* boundFloor; /* 0x0238 */ ColliderJntSph collider; /* 0x0258 */ ColliderJntSphElement colliderElements[7]; } EnDekubaba; // size = 0x0418 diff --git a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c index c21d760eb9..cf498eb726 100644 --- a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c +++ b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c @@ -6,6 +6,15 @@ #include "z_en_dekunuts.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" + +#include "ichain.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/object_dekunuts/object_dekunuts.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE) diff --git a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h index 6beefc7c3b..76f23bdecf 100644 --- a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h +++ b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.h @@ -2,11 +2,11 @@ #define Z_EN_DEKUNUTS_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnDekunuts; -typedef void (*EnDekunutsActionFunc)(struct EnDekunuts*, PlayState*); +typedef void (*EnDekunutsActionFunc)(struct EnDekunuts*, struct PlayState*); typedef struct EnDekunuts { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Dh/z_en_dh.c b/src/overlays/actors/ovl_En_Dh/z_en_dh.c index d0b44336bf..34acb2d982 100644 --- a/src/overlays/actors/ovl_En_Dh/z_en_dh.c +++ b/src/overlays/actors/ovl_En_Dh/z_en_dh.c @@ -1,4 +1,29 @@ +/* + * File: z_en_dh.c + * Overlay: ovl_En_Dh + * Description: Dead Hand + */ + #include "z_en_dh.h" + +#include "libc64/qrand.h" +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "rand.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_math.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_dh/object_dh.h" #define FLAGS \ @@ -153,8 +178,8 @@ void EnDh_Init(Actor* thisx, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; Collider_InitCylinder(play, &this->collider1); Collider_SetCylinder(play, &this->collider1, &this->actor, &sCylinderInit); - Collider_InitJntSph(play, &this->collider2); - Collider_SetJntSph(play, &this->collider2, &this->actor, &sJntSphInit, this->elements); + Collider_InitJntSph(play, &this->colliderJntSph); + Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElements); EnDh_SetupWait(this); } @@ -164,7 +189,7 @@ void EnDh_Destroy(Actor* thisx, PlayState* play) { func_800F5B58(); Collider_DestroyCylinder(play, &this->collider1); - Collider_DestroyJntSph(play, &this->collider2); + Collider_DestroyJntSph(play, &this->colliderJntSph); } void EnDh_SpawnDebris(PlayState* play, EnDh* this, Vec3f* spawnPos, f32 spread, s32 arg4, f32 accelXZ, f32 scale) { @@ -304,8 +329,10 @@ void EnDh_Attack(EnDh* this, PlayState* play) { Animation_Change(&this->skelAnime, &object_dh_Anim_004658, -1.0f, this->skelAnime.curFrame, 0.0f, ANIMMODE_ONCE, -4.0f); this->actionState = 4; - this->collider2.base.atFlags = this->collider2.elements[0].base.atElemFlags = AT_NONE; // also ATELEM_NONE - this->collider2.elements[0].base.atDmgInfo.dmgFlags = this->collider2.elements[0].base.atDmgInfo.damage = 0; + this->colliderJntSph.base.atFlags = this->colliderJntSph.elements[0].base.atElemFlags = + AT_NONE; // also ATELEM_NONE + this->colliderJntSph.elements[0].base.atDmgInfo.dmgFlags = + this->colliderJntSph.elements[0].base.atDmgInfo.damage = 0; } switch (this->actionState) { case 1: @@ -318,20 +345,20 @@ void EnDh_Attack(EnDh* this, PlayState* play) { break; case 2: if (this->skelAnime.curFrame >= 4.0f) { - this->collider2.base.atFlags = this->collider2.elements[0].base.atElemFlags = + this->colliderJntSph.base.atFlags = this->colliderJntSph.elements[0].base.atElemFlags = AT_ON | AT_TYPE_ENEMY; // also ATELEM_ON | ATELEM_SFX_WOOD - this->collider2.elements[0].base.atDmgInfo.dmgFlags = DMG_DEFAULT; - this->collider2.elements[0].base.atDmgInfo.damage = 8; + this->colliderJntSph.elements[0].base.atDmgInfo.dmgFlags = DMG_DEFAULT; + this->colliderJntSph.elements[0].base.atDmgInfo.damage = 8; } - if (this->collider2.base.atFlags & AT_BOUNCED) { - this->collider2.base.atFlags &= ~(AT_HIT | AT_BOUNCED); - this->collider2.base.atFlags = this->collider2.elements[0].base.atElemFlags = + if (this->colliderJntSph.base.atFlags & AT_BOUNCED) { + this->colliderJntSph.base.atFlags &= ~(AT_HIT | AT_BOUNCED); + this->colliderJntSph.base.atFlags = this->colliderJntSph.elements[0].base.atElemFlags = AT_NONE; // also ATELEM_NONE - this->collider2.elements[0].base.atDmgInfo.dmgFlags = - this->collider2.elements[0].base.atDmgInfo.damage = 0; + this->colliderJntSph.elements[0].base.atDmgInfo.dmgFlags = + this->colliderJntSph.elements[0].base.atDmgInfo.damage = 0; this->actionState++; - } else if (this->collider2.base.atFlags & AT_HIT) { - this->collider2.base.atFlags &= ~AT_HIT; + } else if (this->colliderJntSph.base.atFlags & AT_HIT) { + this->colliderJntSph.base.atFlags &= ~AT_HIT; Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 8.0f, this->actor.shape.rot.y, 8.0f); } break; @@ -346,10 +373,10 @@ void EnDh_Attack(EnDh* this, PlayState* play) { Animation_Change(&this->skelAnime, &object_dh_Anim_004658, -1.0f, Animation_GetLastFrame(&object_dh_Anim_004658), 0.0f, ANIMMODE_ONCE, -4.0f); this->actionState++; - this->collider2.base.atFlags = this->collider2.elements[0].base.atElemFlags = + this->colliderJntSph.base.atFlags = this->colliderJntSph.elements[0].base.atElemFlags = AT_NONE; // also ATELEM_NONE - this->collider2.elements[0].base.atDmgInfo.dmgFlags = - this->collider2.elements[0].base.atDmgInfo.damage = 0; + this->colliderJntSph.elements[0].base.atDmgInfo.dmgFlags = + this->colliderJntSph.elements[0].base.atDmgInfo.damage = 0; } break; case 5: @@ -478,11 +505,13 @@ void EnDh_CollisionCheck(EnDh* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 lastHealth; - if ((this->collider2.base.acFlags & AC_HIT) && !this->retreat) { - this->collider2.base.acFlags &= ~AC_HIT; + if ((this->colliderJntSph.base.acFlags & AC_HIT) && !this->retreat) { + this->colliderJntSph.base.acFlags &= ~AC_HIT; if ((this->actor.colChkInfo.damageEffect != 0) && (this->actor.colChkInfo.damageEffect != 6)) { - this->collider2.base.atFlags = this->collider2.elements[0].base.atElemFlags = AT_NONE; // also ATELEM_NONE - this->collider2.elements[0].base.atDmgInfo.dmgFlags = this->collider2.elements[0].base.atDmgInfo.damage = 0; + this->colliderJntSph.base.atFlags = this->colliderJntSph.elements[0].base.atElemFlags = + AT_NONE; // also ATELEM_NONE + this->colliderJntSph.elements[0].base.atDmgInfo.dmgFlags = + this->colliderJntSph.elements[0].base.atDmgInfo.damage = 0; if (player->unk_844 != 0) { this->unk_258 = player->unk_845; } @@ -527,13 +556,13 @@ void EnDh_Update(Actor* thisx, PlayState* play) { if (((this->curAction != DH_DAMAGE) && (this->actor.shape.yOffset == 0.0f)) || ((player->unk_844 != 0) && (player->unk_845 != this->unk_258))) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider2.base); - CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider2.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderJntSph.base); CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider1.base); } } else { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider2.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderJntSph.base); } } @@ -545,7 +574,7 @@ void EnDh_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Matrix_MultVec3f(&headOffset, &this->headPos); Matrix_Push(); Matrix_Translate(headOffset.x, headOffset.y, headOffset.z, MTXMODE_APPLY); - Collider_UpdateSpheres(1, &this->collider2); + Collider_UpdateSpheres(1, &this->colliderJntSph); Matrix_Pop(); } } diff --git a/src/overlays/actors/ovl_En_Dh/z_en_dh.h b/src/overlays/actors/ovl_En_Dh/z_en_dh.h index 21872aafce..0feb3069b5 100644 --- a/src/overlays/actors/ovl_En_Dh/z_en_dh.h +++ b/src/overlays/actors/ovl_En_Dh/z_en_dh.h @@ -2,11 +2,11 @@ #define Z_EN_DH_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnDh; -typedef void (*EnDhActionFunc)(struct EnDh*, PlayState*); +typedef void (*EnDhActionFunc)(struct EnDh*, struct PlayState*); typedef struct EnDh { /* 0x0000 */ Actor actor; @@ -24,8 +24,8 @@ typedef struct EnDh { /* 0x025C */ s16 timer; /* 0x025E */ s16 dirtWavePhase; /* 0x0260 */ ColliderCylinder collider1; - /* 0x02AC */ ColliderJntSph collider2; - /* 0x02CC */ ColliderJntSphElement elements[1]; + /* 0x02AC */ ColliderJntSph colliderJntSph; + /* 0x02CC */ ColliderJntSphElement colliderJntSphElements[1]; /* 0x030C */ Vec3f headPos; /* 0x0318 */ f32 dirtWaveSpread; /* 0x031C */ f32 dirtWaveHeight; diff --git a/src/overlays/actors/ovl_En_Dha/z_en_dha.c b/src/overlays/actors/ovl_En_Dha/z_en_dha.c index 8ecca0200a..5754d8ae1e 100644 --- a/src/overlays/actors/ovl_En_Dha/z_en_dha.c +++ b/src/overlays/actors/ovl_En_Dha/z_en_dha.c @@ -5,8 +5,21 @@ */ #include "z_en_dha.h" -#include "versions.h" #include "overlays/actors/ovl_En_Dh/z_en_dh.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "versions.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_dh/object_dh.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED) @@ -166,7 +179,7 @@ void EnDha_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.health = 8; this->limbAngleX[0] = -0x4000; Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItem); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; EnDha_SetupWait(this); diff --git a/src/overlays/actors/ovl_En_Dha/z_en_dha.h b/src/overlays/actors/ovl_En_Dha/z_en_dha.h index 2ef37c54c9..f7cbd78d7b 100644 --- a/src/overlays/actors/ovl_En_Dha/z_en_dha.h +++ b/src/overlays/actors/ovl_En_Dha/z_en_dha.h @@ -2,11 +2,11 @@ #define Z_EN_DHA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnDha; -typedef void (*EnDhaActionFunc)(struct EnDha*, PlayState*); +typedef void (*EnDhaActionFunc)(struct EnDha*, struct PlayState*); typedef struct EnDha { /* 0x0000 */ Actor actor; @@ -24,7 +24,7 @@ typedef struct EnDha { /* 0x01DC */ Vec3f handPos[2]; /* 0x01F4 */ Vec3f armPos; /* 0x0200 */ ColliderJntSph collider; - /* 0x0220 */ ColliderJntSphElement colliderItem[5]; + /* 0x0220 */ ColliderJntSphElement colliderElements[5]; } EnDha; // size = 0x0360 #endif diff --git a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c index 504b26eaa9..a946c33bf2 100644 --- a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c +++ b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c @@ -6,8 +6,26 @@ #include "z_en_diving_game.h" #include "overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.h" -#include "assets/objects/object_zo/object_zo.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "rand.h" +#include "regs.h" +#include "segmented_address.h" +#include "sequence.h" +#include "sfx.h" #include "terminal.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64effect.h" +#include "z64face_reaction.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/object_zo/object_zo.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h index c873e075e3..ccc211dc8b 100644 --- a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h +++ b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h @@ -2,11 +2,11 @@ #define Z_EN_DIVING_GAME_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnDivingGame; -typedef void (*EnDivingGameActionFunc)(struct EnDivingGame*, PlayState*); +typedef void (*EnDivingGameActionFunc)(struct EnDivingGame*, struct PlayState*); typedef struct EnDivingGame { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c index 5aa697f494..c690638570 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -5,7 +5,21 @@ */ #include "z_en_dns.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "sfx.h" #include "terminal.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/object_shopnuts/object_shopnuts.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY) diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.h b/src/overlays/actors/ovl_En_Dns/z_en_dns.h index d86e96eb43..3a91a5362a 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.h +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.h @@ -2,7 +2,7 @@ #define Z_EN_DNS_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" #include "assets/objects/object_shopnuts/object_shopnuts.h" #define DNS_GET_TYPE(thisx) ((thisx)->params) @@ -37,7 +37,7 @@ typedef enum EnDnsAnimation { struct EnDns; -typedef void (*EnDnsActionFunc)(struct EnDns*, PlayState*); +typedef void (*EnDnsActionFunc)(struct EnDns*, struct PlayState*); typedef u32 (*EnDnsCanBuyFunc)(struct EnDns*); typedef void (*EnDnsPaymentFunc)(struct EnDns*); diff --git a/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c b/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c index ad1eb7e58f..f0b940a744 100644 --- a/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c +++ b/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c @@ -5,10 +5,24 @@ */ #include "z_en_dnt_demo.h" - #include "overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.h" #include "overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.h" + +#include "attributes.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "rand.h" +#include "regs.h" +#include "seqcmd.h" +#include "sequence.h" +#include "sfx.h" #include "terminal.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64debug_display.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h b/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h index 607810629c..29c302aed2 100644 --- a/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h +++ b/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h @@ -2,11 +2,11 @@ #define Z_EN_DNT_DEMO_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnDntDemo; -typedef void (*EnDntDemoActionFunc)(struct EnDntDemo*, PlayState*); +typedef void (*EnDntDemoActionFunc)(struct EnDntDemo*, struct PlayState*); typedef struct EnDntDemo { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c b/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c index 9f88469f2b..442c0a3569 100644 --- a/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c +++ b/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c @@ -5,10 +5,29 @@ */ #include "z_en_dnt_jiji.h" -#include "assets/objects/object_dns/object_dns.h" #include "overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" + +#include "libc64/math64.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "rand.h" +#include "regs.h" +#include "segmented_address.h" +#include "seqcmd.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" #include "terminal.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/object_dns/object_dns.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.h b/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.h index 20199a7c2e..540a8951a3 100644 --- a/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.h +++ b/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.h @@ -2,11 +2,11 @@ #define Z_EN_DNT_JIJI_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnDntJiji; -typedef void (*EnDntJijiActionFunc)(struct EnDntJiji*, PlayState*); +typedef void (*EnDntJijiActionFunc)(struct EnDntJiji*, struct PlayState*); typedef struct EnDntJiji { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c b/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c index b1631fe434..f5d3f0b9dd 100644 --- a/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c +++ b/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c @@ -5,14 +5,31 @@ */ #include "z_en_dnt_nomal.h" -#include "assets/objects/object_dnk/object_dnk.h" #include "overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h" #include "overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.h" #include "overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" -#include "assets/objects/object_hintnuts/object_hintnuts.h" + +#include "libc64/math64.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "rand.h" +#include "regs.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" #include "terminal.h" #include "versions.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/object_dnk/object_dnk.h" +#include "assets/objects/object_hintnuts/object_hintnuts.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) @@ -134,16 +151,16 @@ void EnDntNomal_Init(Actor* thisx, PlayState* play) { PRINTF("\n\n"); // "Deku Scrub target" PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ デグナッツ的当て ☆☆☆☆☆ \n" VT_RST); - Collider_InitQuad(play, &this->targetQuad); - Collider_SetQuad(play, &this->targetQuad, &this->actor, &sTargetQuadInit); + Collider_InitQuad(play, &this->targetColliderQuad); + Collider_SetQuad(play, &this->targetColliderQuad, &this->actor, &sTargetQuadInit); this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->objectId = OBJECT_HINTNUTS; } else { PRINTF("\n\n"); // "Deku Scrub mask show audience" PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ デグナッツお面品評会一般人 ☆☆☆☆☆ \n" VT_RST); - Collider_InitCylinder(play, &this->bodyCyl); - Collider_SetCylinder(play, &this->bodyCyl, &this->actor, &sBodyCylinderInit); + Collider_InitCylinder(play, &this->bodyColliderCylinder); + Collider_SetCylinder(play, &this->bodyColliderCylinder, &this->actor, &sBodyCylinderInit); this->objectId = OBJECT_DNK; } if (this->objectId >= 0) { @@ -167,22 +184,23 @@ void EnDntNomal_Destroy(Actor* thisx, PlayState* play) { EnDntNomal* this = (EnDntNomal*)thisx; if (this->type == ENDNTNOMAL_TARGET) { - Collider_DestroyQuad(play, &this->targetQuad); + Collider_DestroyQuad(play, &this->targetColliderQuad); } else { - Collider_DestroyCylinder(play, &this->bodyCyl); + Collider_DestroyCylinder(play, &this->bodyColliderCylinder); } } void EnDntNomal_WaitForObject(EnDntNomal* this, PlayState* play) { if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); this->actor.objectSlot = this->requiredObjectSlot; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); this->actor.gravity = -2.0f; Actor_SetScale(&this->actor, 0.01f); if (this->type == ENDNTNOMAL_TARGET) { - SkelAnime_Init(play, &this->skelAnime, &gHintNutsSkel, &gHintNutsBurrowAnim, this->jointTable, - this->morphTable, 10); + //! @bug Flex skeleton is used as normal skeleton + SkelAnime_Init(play, &this->skelAnime, (SkeletonHeader*)&gHintNutsSkel, &gHintNutsBurrowAnim, + this->jointTable, this->morphTable, 10); this->actor.draw = EnDntNomal_DrawTargetScrub; } else { SkelAnime_Init(play, &this->skelAnime, &gDntStageSkel, &gDntStageHideAnim, this->jointTable, @@ -241,16 +259,16 @@ void EnDntNomal_TargetWait(EnDntNomal* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); #if OOT_VERSION < PAL_1_0 - if (this->targetQuad.base.acFlags & AC_HIT) + if (this->targetColliderQuad.base.acFlags & AC_HIT) #else - if ((this->targetQuad.base.acFlags & AC_HIT) || BREG(0)) + if ((this->targetColliderQuad.base.acFlags & AC_HIT) || BREG(0)) #endif { - this->targetQuad.base.acFlags &= ~AC_HIT; + this->targetColliderQuad.base.acFlags &= ~AC_HIT; - dx = fabsf(targetX - this->targetQuad.elem.acDmgInfo.hitPos.x); - dy = fabsf(targetY - this->targetQuad.elem.acDmgInfo.hitPos.y); - dz = fabsf(targetZ - this->targetQuad.elem.acDmgInfo.hitPos.z); + dx = fabsf(targetX - this->targetColliderQuad.elem.acDmgInfo.hitPos.x); + dy = fabsf(targetY - this->targetColliderQuad.elem.acDmgInfo.hitPos.y); + dz = fabsf(targetZ - this->targetColliderQuad.elem.acDmgInfo.hitPos.z); scoreVel.y = 5.0f; @@ -839,13 +857,13 @@ void EnDntNomal_Update(Actor* thisx, PlayState* play) { UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); if (this->type == ENDNTNOMAL_TARGET) { - Collider_SetQuadVertices(&this->targetQuad, &this->targetVtx[0], &this->targetVtx[1], &this->targetVtx[2], - &this->targetVtx[3]); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->targetQuad.base); + Collider_SetQuadVertices(&this->targetColliderQuad, &this->targetVtx[0], &this->targetVtx[1], + &this->targetVtx[2], &this->targetVtx[3]); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->targetColliderQuad.base); } else { - Collider_UpdateCylinder(&this->actor, &this->bodyCyl); + Collider_UpdateCylinder(&this->actor, &this->bodyColliderCylinder); if (this->isSolid) { - CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCyl.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyColliderCylinder.base); } } } diff --git a/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.h b/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.h index 13974bb1b1..21f77798a0 100644 --- a/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.h +++ b/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.h @@ -2,11 +2,11 @@ #define Z_EN_DNT_NOMAL_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnDntNomal; -typedef void (*EnDntNomalActionFunc)(struct EnDntNomal*, PlayState*); +typedef void (*EnDntNomalActionFunc)(struct EnDntNomal*, struct PlayState*); typedef struct EnDntNomal { /* 0x0000 */ Actor actor; @@ -38,8 +38,8 @@ typedef struct EnDntNomal { /* 0x0279 */ s8 requiredObjectSlot; /* 0x027C */ Vec3f mouthPos; /* 0x0288 */ Vec3f targetPos; - /* 0x0294 */ ColliderQuad targetQuad; - /* 0x0314 */ ColliderCylinder bodyCyl; + /* 0x0294 */ ColliderQuad targetColliderQuad; + /* 0x0314 */ ColliderCylinder bodyColliderCylinder; } EnDntNomal; // size = 0x0360 #define ENDNTNOMAL_TARGET 0 diff --git a/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c b/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c index 5438c03f4b..1d967ed5fa 100644 --- a/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c +++ b/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c @@ -6,6 +6,18 @@ #include "z_en_dodojr.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_dodojr/object_dodojr.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE) diff --git a/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.h b/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.h index bef171c584..615304cb01 100644 --- a/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.h +++ b/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.h @@ -2,11 +2,11 @@ #define Z_EN_DODOJR_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnDodojr; -typedef void (*EnDodojrActionFunc)(struct EnDodojr*, PlayState*); +typedef void (*EnDodojrActionFunc)(struct EnDodojr*, struct PlayState*); typedef struct EnDodojr { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c index 5cd7fec6c5..5d013911eb 100644 --- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c +++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c @@ -1,6 +1,21 @@ #include "z_en_dodongo.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.h" #include "overlays/actors/ovl_En_Bombf/z_en_bombf.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "rand.h" +#include "sfx.h" +#include "sys_math.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_dodongo/object_dodongo.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED) @@ -322,10 +337,10 @@ void EnDodongo_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.damageTable = &sDamageTable; Collider_InitQuad(play, &this->colliderAT); Collider_InitTris(play, &this->colliderHard); - Collider_InitJntSph(play, &this->colliderBody); + Collider_InitJntSph(play, &this->bodyCollider); Collider_SetQuad(play, &this->colliderAT, &this->actor, &sAttackQuadInit); Collider_SetTris(play, &this->colliderHard, &this->actor, &sHardTrisInit, this->trisElements); - Collider_SetJntSph(play, &this->colliderBody, &this->actor, &sBodyJntSphInit, this->sphElements); + Collider_SetJntSph(play, &this->bodyCollider, &this->actor, &sBodyJntSphInit, this->bodyColliderElements); blureInit.p1StartColor[0] = blureInit.p1StartColor[1] = blureInit.p1StartColor[2] = blureInit.p1StartColor[3] = blureInit.p2StartColor[0] = blureInit.p2StartColor[1] = blureInit.p2StartColor[2] = blureInit.p1EndColor[0] = @@ -351,7 +366,7 @@ void EnDodongo_Destroy(Actor* thisx, PlayState* play) { Effect_Delete(play, this->blureIdx); Collider_DestroyTris(play, &this->colliderHard); - Collider_DestroyJntSph(play, &this->colliderBody); + Collider_DestroyJntSph(play, &this->bodyCollider); Collider_DestroyQuad(play, &this->colliderAT); } @@ -490,9 +505,9 @@ void EnDodongo_SwallowBomb(EnDodongo* this, PlayState* play) { deathFireAccel.x = deathFireVel.x * -0.1f; deathFireAccel.y = deathFireVel.y * -0.1f; deathFireAccel.z = deathFireVel.z * -0.1f; - pos.x = this->sphElements[0].dim.worldSphere.center.x + deathFireVel.x; - pos.y = this->sphElements[0].dim.worldSphere.center.y + deathFireVel.y; - pos.z = this->sphElements[0].dim.worldSphere.center.z + deathFireVel.z; + pos.x = this->bodyColliderElements[0].dim.worldSphere.center.x + deathFireVel.x; + pos.y = this->bodyColliderElements[0].dim.worldSphere.center.y + deathFireVel.y; + pos.z = this->bodyColliderElements[0].dim.worldSphere.center.z + deathFireVel.z; func_8002836C(play, &pos, &deathFireVel, &deathFireAccel, &this->bombSmokePrimColor, &this->bombSmokeEnvColor, 400, 10, 10); } @@ -605,13 +620,13 @@ void EnDodongo_SweepTail(EnDodongo* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if ((this->timer != 0) || (ABS(yawDiff1) < 0x4000)) { - this->sphElements[2].base.atElemFlags = ATELEM_NONE; - this->sphElements[1].base.atElemFlags = ATELEM_NONE; - this->colliderBody.base.atFlags = AT_NONE; - this->sphElements[2].base.atDmgInfo.dmgFlags = 0; - this->sphElements[1].base.atDmgInfo.dmgFlags = 0; - this->sphElements[2].base.atDmgInfo.damage = 0; - this->sphElements[1].base.atDmgInfo.damage = 0; + this->bodyColliderElements[2].base.atElemFlags = ATELEM_NONE; + this->bodyColliderElements[1].base.atElemFlags = ATELEM_NONE; + this->bodyCollider.base.atFlags = AT_NONE; + this->bodyColliderElements[2].base.atDmgInfo.dmgFlags = 0; + this->bodyColliderElements[1].base.atDmgInfo.dmgFlags = 0; + this->bodyColliderElements[2].base.atDmgInfo.damage = 0; + this->bodyColliderElements[1].base.atDmgInfo.damage = 0; EnDodongo_SetupBreatheFire(this); this->timer = Rand_S16Offset(5, 10); } else { @@ -628,33 +643,36 @@ void EnDodongo_SweepTail(EnDodongo* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_DODO_J_TAIL); Animation_PlayOnceSetSpeed(&this->skelAnime, animation, 2.0f); this->timer = 18; - this->colliderBody.base.atFlags = this->sphElements[1].base.atElemFlags = - this->sphElements[2].base.atElemFlags = AT_ON | AT_TYPE_ENEMY; // also ATELEM_ON | ATELEM_SFX_WOOD - this->sphElements[1].base.atDmgInfo.dmgFlags = this->sphElements[2].base.atDmgInfo.dmgFlags = DMG_DEFAULT; - this->sphElements[1].base.atDmgInfo.damage = this->sphElements[2].base.atDmgInfo.damage = 8; + this->bodyCollider.base.atFlags = this->bodyColliderElements[1].base.atElemFlags = + this->bodyColliderElements[2].base.atElemFlags = + AT_ON | AT_TYPE_ENEMY; // also ATELEM_ON | ATELEM_SFX_WOOD + this->bodyColliderElements[1].base.atDmgInfo.dmgFlags = + this->bodyColliderElements[2].base.atDmgInfo.dmgFlags = DMG_DEFAULT; + this->bodyColliderElements[1].base.atDmgInfo.damage = this->bodyColliderElements[2].base.atDmgInfo.damage = + 8; } } else if (this->timer > 1) { Vec3f tailPos; this->timer--; this->actor.shape.rot.y = this->actor.world.rot.y += this->tailSwipeSpeed; - tailPos.x = this->sphElements[1].dim.worldSphere.center.x; - tailPos.y = this->sphElements[1].dim.worldSphere.center.y; - tailPos.z = this->sphElements[1].dim.worldSphere.center.z; + tailPos.x = this->bodyColliderElements[1].dim.worldSphere.center.x; + tailPos.y = this->bodyColliderElements[1].dim.worldSphere.center.y; + tailPos.z = this->bodyColliderElements[1].dim.worldSphere.center.z; Actor_SpawnFloorDustRing(play, &this->actor, &tailPos, 5.0f, 2, 2.0f, 100, 15, false); - tailPos.x = this->sphElements[2].dim.worldSphere.center.x; - tailPos.y = this->sphElements[2].dim.worldSphere.center.y; - tailPos.z = this->sphElements[2].dim.worldSphere.center.z; + tailPos.x = this->bodyColliderElements[2].dim.worldSphere.center.x; + tailPos.y = this->bodyColliderElements[2].dim.worldSphere.center.y; + tailPos.z = this->bodyColliderElements[2].dim.worldSphere.center.z; Actor_SpawnFloorDustRing(play, &this->actor, &tailPos, 5.0f, 2, 2.0f, 100, 15, false); - if (this->colliderBody.base.atFlags & AT_HIT) { + if (this->bodyCollider.base.atFlags & AT_HIT) { Player* player = GET_PLAYER(play); - if (this->colliderBody.base.at == &player->actor) { + if (this->bodyCollider.base.at == &player->actor) { Actor_PlaySfx(&player->actor, NA_SE_PL_BODY_HIT); } } - CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->bodyCollider.base); } } @@ -711,10 +729,10 @@ void EnDodongo_Stunned(EnDodongo* this, PlayState* play) { void EnDodongo_CollisionCheck(EnDodongo* this, PlayState* play) { if (this->colliderHard.base.acFlags & AC_BOUNCED) { this->colliderHard.base.acFlags &= ~AC_BOUNCED; - this->colliderBody.base.acFlags &= ~AC_HIT; - } else if ((this->colliderBody.base.acFlags & AC_HIT) && (this->actionState > DODONGO_DEATH)) { - this->colliderBody.base.acFlags &= ~AC_HIT; - Actor_SetDropFlagJntSph(&this->actor, &this->colliderBody, false); + this->bodyCollider.base.acFlags &= ~AC_HIT; + } else if ((this->bodyCollider.base.acFlags & AC_HIT) && (this->actionState > DODONGO_DEATH)) { + this->bodyCollider.base.acFlags &= ~AC_HIT; + Actor_SetDropFlagJntSph(&this->actor, &this->bodyCollider, false); if (this->actor.colChkInfo.damageEffect != 0xE) { this->damageEffect = this->actor.colChkInfo.damageEffect; if ((this->actor.colChkInfo.damageEffect == 1) || (this->actor.colChkInfo.damageEffect == 0xF)) { @@ -775,12 +793,12 @@ void EnDodongo_Update(Actor* thisx, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_DOWN); } } - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); if (this->actionState != DODONGO_DEATH) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderHard.base); } if (this->actionState > DODONGO_DEATH) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderBody.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); } if ((this->actionState >= DODONGO_IDLE) && EnDodongo_AteBomb(this, play)) { EnDodongo_SetupSwallowBomb(this); @@ -837,7 +855,7 @@ void EnDodongo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* Vec3f mouthOffset = { 1800.0f, 1200.0f, 0.0f }; Vec3f headOffset = { 1500.0f, 300.0f, 0.0f }; - Collider_UpdateSpheres(limbIndex, &this->colliderBody); + Collider_UpdateSpheres(limbIndex, &this->bodyCollider); switch (limbIndex) { case 2: diff --git a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.h b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.h index 664b175799..7785030d49 100644 --- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.h +++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.h @@ -2,11 +2,11 @@ #define Z_EN_DODONGO_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnDodongo; -typedef void (*EnDodongoActionFunc)(struct EnDodongo*, PlayState*); +typedef void (*EnDodongoActionFunc)(struct EnDodongo*, struct PlayState*); typedef struct EnDodongo { /* 0x0000 */ Actor actor; @@ -35,8 +35,8 @@ typedef struct EnDodongo { /* 0x03D4 */ ColliderQuad colliderAT; /* 0x0454 */ ColliderTris colliderHard; /* 0x0474 */ ColliderTrisElement trisElements[3]; - /* 0x0588 */ ColliderJntSph colliderBody; - /* 0x05A8 */ ColliderJntSphElement sphElements[6]; + /* 0x0588 */ ColliderJntSph bodyCollider; + /* 0x05A8 */ ColliderJntSphElement bodyColliderElements[6]; } EnDodongo; // size = 0x0728 typedef enum EnDodongoParam { diff --git a/src/overlays/actors/ovl_En_Dog/z_en_dog.c b/src/overlays/actors/ovl_En_Dog/z_en_dog.c index 49b8c83ba3..0255b01626 100644 --- a/src/overlays/actors/ovl_En_Dog/z_en_dog.c +++ b/src/overlays/actors/ovl_En_Dog/z_en_dog.c @@ -5,6 +5,14 @@ */ #include "z_en_dog.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sfx.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_dog/object_dog.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_En_Dog/z_en_dog.h b/src/overlays/actors/ovl_En_Dog/z_en_dog.h index dec2b5c180..c3cdfd913b 100644 --- a/src/overlays/actors/ovl_En_Dog/z_en_dog.h +++ b/src/overlays/actors/ovl_En_Dog/z_en_dog.h @@ -2,18 +2,18 @@ #define Z_EN_DOG_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnDog; -typedef void (*EnDogActionFunc)(struct EnDog*, PlayState*); +typedef void (*EnDogActionFunc)(struct EnDog*, struct PlayState*); typedef struct EnDog { /* 0x0000 */ Actor actor; /* 0x014C */ SkelAnime skelAnime; /* 0x0190 */ EnDogActionFunc actionFunc; /* 0x0194 */ ColliderCylinder collider; - /* 0x01E0 */ Path* path; + /* 0x01E0 */ struct Path* path; /* 0x01E4 */ u8 reverse; /* 0x01E6 */ s16 waypoint; /* 0x01E8 */ s16 unusedAngle; diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index 4d650f0a1b..9f5bd8723e 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -5,7 +5,19 @@ */ #include "z_en_door.h" -#include "global.h" + +#include "libc64/qrand.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sfx.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/gameplay_field_keep/gameplay_field_keep.h" #include "assets/objects/object_hidan_objects/object_hidan_objects.h" diff --git a/src/overlays/actors/ovl_En_Ds/z_en_ds.c b/src/overlays/actors/ovl_En_Ds/z_en_ds.c index c76713a756..3c879ee1ac 100644 --- a/src/overlays/actors/ovl_En_Ds/z_en_ds.c +++ b/src/overlays/actors/ovl_En_Ds/z_en_ds.c @@ -5,6 +5,16 @@ */ #include "z_en_ds.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_ds/object_ds.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY) diff --git a/src/overlays/actors/ovl_En_Ds/z_en_ds.h b/src/overlays/actors/ovl_En_Ds/z_en_ds.h index 8f10ce8285..9c7df969c6 100644 --- a/src/overlays/actors/ovl_En_Ds/z_en_ds.h +++ b/src/overlays/actors/ovl_En_Ds/z_en_ds.h @@ -2,11 +2,11 @@ #define Z_EN_DS_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnDs; -typedef void (*EnDsActionFunc)(struct EnDs*, PlayState*); +typedef void (*EnDsActionFunc)(struct EnDs*, struct PlayState*); typedef struct EnDs { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Du/z_en_du.c b/src/overlays/actors/ovl_En_Du/z_en_du.c index f77bec5a85..1f716b977d 100644 --- a/src/overlays/actors/ovl_En_Du/z_en_du.c +++ b/src/overlays/actors/ovl_En_Du/z_en_du.c @@ -1,4 +1,19 @@ #include "z_en_du.h" + +#include "gfx.h" +#include "one_point_cutscene.h" +#include "segmented_address.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64face_reaction.h" +#include "z64ocarina.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_du/object_du.h" #include "assets/scenes/overworld/spot18/spot18_scene.h" diff --git a/src/overlays/actors/ovl_En_Du/z_en_du.h b/src/overlays/actors/ovl_En_Du/z_en_du.h index 541b4368e8..9e3ecb8805 100644 --- a/src/overlays/actors/ovl_En_Du/z_en_du.h +++ b/src/overlays/actors/ovl_En_Du/z_en_du.h @@ -2,11 +2,11 @@ #define Z_EN_DU_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnDu; -typedef void (*EnDuActionFunc)(struct EnDu*, PlayState*); +typedef void (*EnDuActionFunc)(struct EnDu*, struct PlayState*); typedef struct EnDu { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c b/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c index 59a8b41ec6..d65d703e68 100644 --- a/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c +++ b/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c @@ -8,6 +8,7 @@ #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "segmented_address.h" #include "sfx.h" #include "sys_matrix.h" diff --git a/src/overlays/actors/ovl_En_Eg/z_en_eg.c b/src/overlays/actors/ovl_En_Eg/z_en_eg.c index c646cdf249..b4da54551d 100644 --- a/src/overlays/actors/ovl_En_Eg/z_en_eg.c +++ b/src/overlays/actors/ovl_En_Eg/z_en_eg.c @@ -5,7 +5,17 @@ */ #include "z_en_eg.h" + +#include "printf.h" +#include "regs.h" +#include "seqcmd.h" +#include "sequence.h" +#include "sfx.h" #include "terminal.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64save.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -65,8 +75,8 @@ void EnEg_Update(Actor* thisx, PlayState* play) { s32 action = this->action; if (((action < 0) || (0 < action)) || (sActionFuncs[action] == NULL)) { - // "Main Mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!" - PRINTF(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The main mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); } else { sActionFuncs[action](this, play); } diff --git a/src/overlays/actors/ovl_En_Eg/z_en_eg.h b/src/overlays/actors/ovl_En_Eg/z_en_eg.h index ad02d8a6b7..c42994f61c 100644 --- a/src/overlays/actors/ovl_En_Eg/z_en_eg.h +++ b/src/overlays/actors/ovl_En_Eg/z_en_eg.h @@ -2,11 +2,11 @@ #define Z_EN_EG_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnEg; -typedef void (*EnEgActionFunc)(struct EnEg*, PlayState*); +typedef void (*EnEgActionFunc)(struct EnEg*, struct PlayState*); typedef struct EnEg { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c b/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c index 554512b148..d60d91c222 100644 --- a/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c +++ b/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c @@ -1,4 +1,16 @@ #include "z_en_eiyer.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sfx.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_ei/object_ei.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE) diff --git a/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.h b/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.h index 7f756596aa..7626924496 100644 --- a/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.h +++ b/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.h @@ -2,11 +2,11 @@ #define Z_EN_EIYER_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnEiyer; -typedef void (*EnEiyerActionFunc)(struct EnEiyer*, PlayState*); +typedef void (*EnEiyerActionFunc)(struct EnEiyer*, struct PlayState*); typedef struct EnEiyer { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index cd3658756e..58cd30f3ff 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -5,7 +5,28 @@ */ #include "z_en_elf.h" -#include "global.h" +#include "overlays/actors/ovl_Elf_Msg/z_elf_msg.h" + +#include "libc64/qrand.h" +#include "libu64/debug.h" +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "rand.h" +#include "regs.h" +#include "sfx.h" +#include "sys_math.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64effect.h" +#include "z64light.h" +#include "z64play.h" +#include "z64player.h" +#include "z64quest_hint.h" +#include "z64save.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED | ACTOR_FLAG_UPDATE_DURING_OCARINA) diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.h b/src/overlays/actors/ovl_En_Elf/z_en_elf.h index 2190065f71..60e9940d75 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.h +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.h @@ -4,7 +4,6 @@ #include "ultra64.h" #include "z64actor.h" #include "z64light.h" -#include "overlays/actors/ovl_Elf_Msg/z_elf_msg.h" struct EnElf; @@ -23,7 +22,7 @@ typedef struct EnElf { /* 0x0278 */ LightInfo lightInfoNoGlow; /* 0x0288 */ LightNode* lightNodeNoGlow; /* 0x028C */ Vec3f unk_28C; - /* 0x0298 */ ElfMsg* elfMsg; + /* 0x0298 */ struct ElfMsg* elfMsg; /* 0x029C */ f32 unk_29C; /* 0x02A0 */ f32 unk_2A0; /* 0x02A4 */ f32 unk_2A4; diff --git a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c index e513de558e..92374ad12a 100644 --- a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c +++ b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c @@ -1,6 +1,17 @@ #include "z_en_encount1.h" -#include "terminal.h" #include "overlays/actors/ovl_En_Tite/z_en_tite.h" +#include "overlays/actors/ovl_En_Reeba/z_en_reeba.h" + +#include "printf.h" +#include "rand.h" +#include "regs.h" +#include "terminal.h" +#include "translation.h" +#include "z_lib.h" +#include "z64debug_display.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_LOCK_ON_DISABLED) diff --git a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.h b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.h index 2dc033f98c..b9c8c1d882 100644 --- a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.h +++ b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.h @@ -2,14 +2,13 @@ #define Z_EN_ENCOUNT1_H #include "ultra64.h" -#include "global.h" -#include "overlays/actors/ovl_En_Reeba/z_en_reeba.h" +#include "z64actor.h" #define SPAWNER_PARAMS(type, number, total) ((type << 0xB) | (number << 0x6) | total) struct EnEncount1; -typedef void (*EnEncount1UpdateFunc)(struct EnEncount1*, PlayState*); +typedef void (*EnEncount1UpdateFunc)(struct EnEncount1*, struct PlayState*); typedef struct EnEncount1 { /* 0x0000 */ Actor actor; @@ -27,7 +26,7 @@ typedef struct EnEncount1 { /* 0x0164 */ s16 timer; /* 0x0166 */ u8 reduceLeevers; /* 0x0168 */ f32 spawnRange; - /* 0x016C */ EnReeba* bigLeever; + /* 0x016C */ struct EnReeba* bigLeever; } EnEncount1; // size = 0x0170 typedef enum EnEncount1type { diff --git a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c index 6ff21c428c..847f5d34a1 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -4,6 +4,7 @@ #include "libc64/qrand.h" #include "attributes.h" #include "gfx.h" +#include "printf.h" #include "quake.h" #include "rand.h" #include "sfx.h" @@ -12,6 +13,7 @@ #include "z_lib.h" #include "z64play.h" #include "z64player.h" +#include "z64save.h" #include "assets/objects/object_efc_star_field/object_efc_star_field.h" diff --git a/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c b/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c index 40f0b99eb8..cbbb4fa0ee 100644 --- a/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c +++ b/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c @@ -10,6 +10,7 @@ #include "attributes.h" #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "segmented_address.h" #include "sfx.h" #include "sys_matrix.h" @@ -18,6 +19,7 @@ #include "z64draw.h" #include "z64play.h" #include "z64player.h" +#include "z64save.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" diff --git a/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c b/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c index 55f97c3686..8cd6e5c4a1 100644 --- a/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c +++ b/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c @@ -1,6 +1,21 @@ #include "z_en_ex_ruppy.h" +#include "overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "rand.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" #include "terminal.h" -#include "../ovl_En_Diving_Game/z_en_diving_game.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.h b/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.h index 33dcca4447..7ba20450e8 100644 --- a/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.h +++ b/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.h @@ -2,11 +2,11 @@ #define Z_EN_EX_RUPPY_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnExRuppy; -typedef void (*EnExRuppyActionFunc)(struct EnExRuppy*, PlayState*); +typedef void (*EnExRuppyActionFunc)(struct EnExRuppy*, struct PlayState*); typedef struct EnExRuppy { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Fd/z_en_fd.c b/src/overlays/actors/ovl_En_Fd/z_en_fd.c index 785b4937aa..475c476bb5 100644 --- a/src/overlays/actors/ovl_En_Fd/z_en_fd.c +++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.c @@ -5,7 +5,21 @@ */ #include "z_en_fd.h" + +#include "libc64/math64.h" +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" #include "versions.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_fw/object_fw.h" @@ -230,7 +244,7 @@ s32 EnFd_SpawnCore(EnFd* this, PlayState* play) { this->actor.child->colChkInfo.health = 8; } - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { + if (ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { Actor_SwapHookshotAttachment(play, &this->actor, this->actor.child); } @@ -460,7 +474,7 @@ void EnFd_Init(Actor* thisx, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gFlareDancerSkel, NULL, this->jointTable, this->morphTable, 27); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 32.0f); Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colSphs); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0xF), &sColChkInit); this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; @@ -670,7 +684,7 @@ void EnFd_Update(Actor* thisx, PlayState* play) { EnFd_SpawnDot(this, play); } - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { + if (ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { if (EnFd_SpawnCore(this, play)) { this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; this->invincibilityTimer = 30; diff --git a/src/overlays/actors/ovl_En_Fd/z_en_fd.h b/src/overlays/actors/ovl_En_Fd/z_en_fd.h index 3559410526..3fc40a54cf 100644 --- a/src/overlays/actors/ovl_En_Fd/z_en_fd.h +++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.h @@ -2,11 +2,11 @@ #define Z_EN_FD_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnFd; -typedef void (*EnFdActionFunc)(struct EnFd* this, PlayState* play); +typedef void (*EnFdActionFunc)(struct EnFd* this, struct PlayState* play); typedef enum FDEffectType { FD_EFFECT_NONE, @@ -34,7 +34,7 @@ typedef struct EnFd { /* 0x014C */ SkelAnime skelAnime; /* 0x0190 */ EnFdActionFunc actionFunc; /* 0x0194 */ ColliderJntSph collider; - /* 0x01B4 */ ColliderJntSphElement colSphs[12]; + /* 0x01B4 */ ColliderJntSphElement colliderElements[12]; /* 0x04B4 */ u8 coreActive; /* 0x04B6 */ s16 initYawToInitPos; /* 0x04B8 */ s16 curYawToInitPos; diff --git a/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c b/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c index d408b7b9ac..b124094a2c 100644 --- a/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c +++ b/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c @@ -1,4 +1,14 @@ #include "z_en_fd_fire.h" + +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "rand.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.h b/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.h index 414fdf997a..d027a07972 100644 --- a/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.h +++ b/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.h @@ -2,11 +2,11 @@ #define Z_EN_FD_FIRE_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnFdFire; -typedef void (*EnFdFireActionFunc)(struct EnFdFire* this, PlayState* play); +typedef void (*EnFdFireActionFunc)(struct EnFdFire* this, struct PlayState* play); typedef struct EnFdFire { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c index aa3f190cee..2fdf9525d7 100644 --- a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c +++ b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c @@ -5,12 +5,29 @@ */ #include "z_en_fhg_fire.h" -#include "assets/objects/object_fhg/object_fhg.h" -#include "assets/objects/gameplay_keep/gameplay_keep.h" #include "overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.h" #include "overlays/actors/ovl_En_fHG/z_en_fhg.h" #include "overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h" +#include "libc64/math64.h" +#include "libc64/qrand.h" +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "rand.h" +#include "rumble.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + +#include "assets/objects/gameplay_keep/gameplay_keep.h" +#include "assets/objects/object_fhg/object_fhg.h" + #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) typedef enum StrikeMode { diff --git a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.h b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.h index ac2682aaf1..59136f7dfd 100644 --- a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.h +++ b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.h @@ -2,11 +2,12 @@ #define Z_EN_FHG_FIRE_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" +#include "z64light.h" struct EnFhgFire; -typedef void (*EnFhgFireUpdateFunc)(struct EnFhgFire*, PlayState*); +typedef void (*EnFhgFireUpdateFunc)(struct EnFhgFire*, struct PlayState*); typedef enum FhgFireParam { /* 1 */ FHGFIRE_LIGHTNING_STRIKE = 1, diff --git a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c index e4d6d3e049..60f7198875 100644 --- a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c +++ b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c @@ -4,18 +4,18 @@ #include "attributes.h" #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "rand.h" #include "regs.h" #include "sfx.h" #include "sys_matrix.h" #include "terminal.h" #include "z_lib.h" +#include "z64debug_display.h" #include "z64effect.h" #include "z64play.h" #include "z64player.h" -#include "global.h" - #include "assets/objects/object_efc_star_field/object_efc_star_field.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c index 6a72e29224..e674ee9bf5 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -5,10 +5,24 @@ */ #include "z_en_firefly.h" -#include "versions.h" -#include "assets/objects/object_firefly/object_firefly.h" #include "overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.h" +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "rand.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "versions.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + +#include "assets/objects/object_firefly/object_firefly.h" + #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_CAN_ATTACH_TO_ARROW) @@ -145,7 +159,7 @@ void EnFirefly_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); SkelAnime_Init(play, &this->skelAnime, &gKeeseSkeleton, &gKeeseFlyAnim, this->jointTable, this->morphTable, 28); Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); if (PARAMS_GET_NOSHIFT(this->actor.params, 15, 1) != 0) { diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h index 165cc5c26e..7638036a82 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h @@ -2,11 +2,11 @@ #define Z_EN_FIREFLY_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnFirefly; -typedef void (*EnFireflyActionFunc)(struct EnFirefly*, PlayState*); +typedef void (*EnFireflyActionFunc)(struct EnFirefly*, struct PlayState*); typedef struct EnFirefly { /* 0x0000 */ Actor actor; @@ -21,7 +21,7 @@ typedef struct EnFirefly { /* 0x0266 */ Vec3s morphTable[28]; /* 0x0310 */ f32 maxAltitude; /* 0x0314 */ ColliderJntSph collider; - /* 0x0344 */ ColliderJntSphElement colliderItems[1]; + /* 0x0344 */ ColliderJntSphElement colliderElements[1]; } EnFirefly; // size = 0x0374 typedef enum KeeseType { diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/src/overlays/actors/ovl_En_Fish/z_en_fish.c index 8ef16187f3..9de3dbe4f8 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -5,9 +5,20 @@ */ #include "z_en_fish.h" -#include "global.h" -#include "assets/objects/gameplay_keep/gameplay_keep.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "sfx.h" #include "terminal.h" +#include "z_lib.h" +#include "z64item.h" +#include "z64play.h" +#include "z64player.h" + +#include "assets/objects/gameplay_keep/gameplay_keep.h" #define FLAGS 0 @@ -135,7 +146,7 @@ void EnFish_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); SkelAnime_InitFlex(play, &this->skelAnime, &gFishSkel, &gFishInWaterAnim, this->jointTable, this->morphTable, 7); Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); this->actor.colChkInfo.mass = 50; this->slowPhase = Rand_ZeroOne() * (0xFFFF + 0.5f); this->fastPhase = Rand_ZeroOne() * (0xFFFF + 0.5f); diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.h b/src/overlays/actors/ovl_En_Fish/z_en_fish.h index 01cdbd0b36..d75de5b0a5 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.h +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.h @@ -11,7 +11,7 @@ typedef void (*EnFishActionFunc)(struct EnFish*, struct PlayState*); typedef struct EnFish { /* 0x0000 */ Actor actor; /* 0x014C */ ColliderJntSph collider; - /* 0x016C */ ColliderJntSphElement colliderItems[1]; + /* 0x016C */ ColliderJntSphElement colliderElements[1]; /* 0x01AC */ SkelAnime skelAnime; /* 0x01F0 */ Vec3s jointTable[7]; /* 0x021A */ Vec3s morphTable[7]; diff --git a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c index 035a825073..a9d9036e9f 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -5,6 +5,19 @@ */ #include "z_en_floormas.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_wallmaster/object_wallmaster.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER) @@ -280,7 +293,7 @@ void EnFloormas_SetupLand(EnFloormas* this) { void EnFloormas_SetupSplit(EnFloormas* this) { Actor_SetScale(&this->actor, 0.004f); this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { + if (ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_REACT_TO_LENS)) { this->actor.draw = EnFloormas_DrawHighlighted; } else { this->actor.draw = EnFloormas_Draw; diff --git a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.h b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.h index 4c30b8773b..4aefd1ad97 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.h +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.h @@ -2,11 +2,11 @@ #define Z_EN_FLOORMAS_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" typedef struct EnFloormas EnFloormas; -typedef void (*EnFloormasActionFunc)(EnFloormas* this, PlayState* play); +typedef void (*EnFloormasActionFunc)(EnFloormas* this, struct PlayState* play); struct EnFloormas{ /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Fr/z_en_fr.c b/src/overlays/actors/ovl_En_Fr/z_en_fr.c index ee133164c2..2d741172b2 100644 --- a/src/overlays/actors/ovl_En_Fr/z_en_fr.c +++ b/src/overlays/actors/ovl_En_Fr/z_en_fr.c @@ -1,6 +1,29 @@ #include "z_en_fr.h" -#include "assets/objects/gameplay_field_keep/gameplay_field_keep.h" + +#include "array_count.h" +#include "controller.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "rand.h" +#include "regs.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" #include "terminal.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64debug_display.h" +#include "z64effect.h" +#include "z64light.h" +#include "z64ocarina.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/gameplay_field_keep/gameplay_field_keep.h" #include "assets/objects/object_fr/object_fr.h" #define FLAGS \ diff --git a/src/overlays/actors/ovl_En_Fr/z_en_fr.h b/src/overlays/actors/ovl_En_Fr/z_en_fr.h index 95a365dd9b..2bed02b4a0 100644 --- a/src/overlays/actors/ovl_En_Fr/z_en_fr.h +++ b/src/overlays/actors/ovl_En_Fr/z_en_fr.h @@ -2,11 +2,12 @@ #define Z_EN_FR_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" +#include "z64light.h" struct EnFr; -typedef void (*EnFrActionFunc)(struct EnFr*, PlayState*); +typedef void (*EnFrActionFunc)(struct EnFr*, struct PlayState*); typedef void (*EnFrBlinkFunc)(struct EnFr*); typedef enum FrogType { diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index 8069e6cb26..24818477d7 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -5,6 +5,19 @@ */ #include "z_en_fu.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64face_reaction.h" +#include "z64ocarina.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_fu/object_fu.h" #include "assets/scenes/indoors/hakasitarelay/hakasitarelay_scene.h" diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.h b/src/overlays/actors/ovl_En_Fu/z_en_fu.h index dbbcacfc54..af90b2cf05 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.h +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.h @@ -2,11 +2,11 @@ #define Z_EN_FU_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnFu; -typedef void (*EnFuActionFunc)(struct EnFu*, PlayState*); +typedef void (*EnFuActionFunc)(struct EnFu*, struct PlayState*); typedef enum EnFuLimb { /* 0x00 */ FU_LIMB_ROOT, diff --git a/src/overlays/actors/ovl_En_Fw/z_en_fw.c b/src/overlays/actors/ovl_En_Fw/z_en_fw.c index bb11ab8f58..ba002aefbe 100644 --- a/src/overlays/actors/ovl_En_Fw/z_en_fw.c +++ b/src/overlays/actors/ovl_En_Fw/z_en_fw.c @@ -5,9 +5,22 @@ */ #include "z_en_fw.h" -#include "assets/objects/object_fw/object_fw.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.h" + +#include "libc64/math64.h" +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" +#include "assets/objects/object_fw/object_fw.h" #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ @@ -193,7 +206,7 @@ void EnFw_Init(Actor* thisx, PlayState* play) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENFW_ANIM_0); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->sphs); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x10), &D_80A1FB94); Actor_SetScale(&this->actor, 0.01f); this->runDirection = -this->actor.params; @@ -363,7 +376,7 @@ void EnFw_Update(Actor* thisx, PlayState* play) { EnFw* this = (EnFw*)thisx; SkelAnime_Update(&this->skelAnime); - if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { + if (!ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { Actor_MoveXZGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 20.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); this->actionFunc(this, play); diff --git a/src/overlays/actors/ovl_En_Fw/z_en_fw.h b/src/overlays/actors/ovl_En_Fw/z_en_fw.h index 7940a98157..b19f967111 100644 --- a/src/overlays/actors/ovl_En_Fw/z_en_fw.h +++ b/src/overlays/actors/ovl_En_Fw/z_en_fw.h @@ -2,11 +2,11 @@ #define Z_EN_FW_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnFw; -typedef void (*EnFwActionFunc)(struct EnFw* this, PlayState* play); +typedef void (*EnFwActionFunc)(struct EnFw* this, struct PlayState* play); #define EN_FW_EFFECT_COUNT 20 @@ -28,7 +28,7 @@ typedef struct EnFw { /* 0x014C */ SkelAnime skelAnime; /* 0x0190 */ EnFwActionFunc actionFunc; /* 0x0194 */ ColliderJntSph collider; - /* 0x01B4 */ ColliderJntSphElement sphs[1]; + /* 0x01B4 */ ColliderJntSphElement colliderElements[1]; /* 0x01F4 */ Vec3f bompPos; /* 0x0200 */ u8 lastDmgHook; /* 0x0202 */ s16 runDirection; diff --git a/src/overlays/actors/ovl_En_Fz/z_en_fz.c b/src/overlays/actors/ovl_En_Fz/z_en_fz.c index af3ca60170..6ded127aef 100644 --- a/src/overlays/actors/ovl_En_Fz/z_en_fz.c +++ b/src/overlays/actors/ovl_En_Fz/z_en_fz.c @@ -1,4 +1,17 @@ #include "z_en_fz.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "rand.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/object_fz/object_fz.h" #define FLAGS \ diff --git a/src/overlays/actors/ovl_En_Fz/z_en_fz.h b/src/overlays/actors/ovl_En_Fz/z_en_fz.h index a7fa2d7134..277e039e2d 100644 --- a/src/overlays/actors/ovl_En_Fz/z_en_fz.h +++ b/src/overlays/actors/ovl_En_Fz/z_en_fz.h @@ -2,11 +2,11 @@ #define Z_EN_FZ_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnFz; -typedef void (*EnFzActionFunc)(struct EnFz*, PlayState*); +typedef void (*EnFzActionFunc)(struct EnFz*, struct PlayState*); typedef void (*EnFzSpawnIceSmokeFunc)(struct EnFz*); typedef struct EnFzEffect { diff --git a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c index 8cfec63ce1..8bca3e607a 100644 --- a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c +++ b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c @@ -5,10 +5,29 @@ */ #include "z_en_g_switch.h" -#include "terminal.h" #include "overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.h" #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" #include "overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "rand.h" +#include "regs.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "terminal.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64debug_display.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_tsubo/object_tsubo.h" @@ -202,7 +221,7 @@ void EnGSwitch_Break(EnGSwitch* this, PlayState* play) { void EnGSwitch_WaitForObject(EnGSwitch* this, PlayState* play) { if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); this->actor.objectSlot = this->requiredObjectSlot; this->actor.draw = EnGSwitch_DrawPot; this->actionFunc = EnGSwitch_ArcheryPot; diff --git a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h index 58e19ea9c1..c680fb1440 100644 --- a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h +++ b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h @@ -2,11 +2,11 @@ #define Z_EN_G_SWITCH_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnGSwitch; -typedef void (*EnGSwitchActionFunc)(struct EnGSwitch*, PlayState*); +typedef void (*EnGSwitchActionFunc)(struct EnGSwitch*, struct PlayState*); typedef enum EnGSwitchMoveMode { /* 0 */ GSWITCH_NONE, diff --git a/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c b/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c index ca06391dcf..d40a9a446d 100644 --- a/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c +++ b/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c @@ -6,6 +6,7 @@ #include "z_en_ganon_mant.h" +#include "array_count.h" #include "gfx.h" #include "rand.h" #include "segmented_address.h" diff --git a/src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.c b/src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.c index d64111fb9d..a002ce5e1b 100644 --- a/src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.c +++ b/src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.c @@ -5,6 +5,13 @@ */ #include "z_en_ganon_organ.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "sys_matrix.h" +#include "z64play.h" + #include "overlays/actors/ovl_Boss_Ganon/z_boss_ganon.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.h b/src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.h index 0c301bddca..8d20bee4d3 100644 --- a/src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.h +++ b/src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.h @@ -2,7 +2,7 @@ #define Z_EN_GANON_ORGAN_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnGanonOrgan; diff --git a/src/overlays/actors/ovl_En_Gb/z_en_gb.c b/src/overlays/actors/ovl_En_Gb/z_en_gb.c index 388a11cc30..9565ceba98 100644 --- a/src/overlays/actors/ovl_En_Gb/z_en_gb.c +++ b/src/overlays/actors/ovl_En_Gb/z_en_gb.c @@ -5,6 +5,22 @@ */ #include "z_en_gb.h" + +#include "libc64/qrand.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "rand.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64light.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_ps/object_ps.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY) diff --git a/src/overlays/actors/ovl_En_Gb/z_en_gb.h b/src/overlays/actors/ovl_En_Gb/z_en_gb.h index 4005075c4c..24b7d30560 100644 --- a/src/overlays/actors/ovl_En_Gb/z_en_gb.h +++ b/src/overlays/actors/ovl_En_Gb/z_en_gb.h @@ -2,11 +2,12 @@ #define Z_EN_GB_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" +#include "z64light.h" struct EnGb; -typedef void (*EnGbActionFunc)(struct EnGb*, PlayState*); +typedef void (*EnGbActionFunc)(struct EnGb*, struct PlayState*); typedef struct EnGbCagedSoulInfo { /* 0x00 */ Color_RGBA8 prim; diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c index 8082c7d87c..c47c8271e5 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -5,8 +5,22 @@ */ #include "z_en_ge1.h" -#include "z64horse.h" + +#include "libu64/debug.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" #include "terminal.h" +#include "z_lib.h" +#include "z64face_reaction.h" +#include "z64horse.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_ge1/object_ge1.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY) diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h index 7fb1692f62..6aaaf2ab37 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h @@ -2,12 +2,12 @@ #define Z_EN_GE1_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnGe1; typedef void (*EnGe1AnimFunc)(struct EnGe1*); -typedef void (*EnGe1ActionFunc)(struct EnGe1*, PlayState*); +typedef void (*EnGe1ActionFunc)(struct EnGe1*, struct PlayState*); typedef enum EnGe1Type { /* 0x00 */ GE1_TYPE_GATE_GUARD, diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c index 0df133fe4f..cae8d14bf1 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -5,8 +5,21 @@ */ #include "z_en_ge2.h" -#include "z64horse.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" #include "terminal.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64horse.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_gla/object_gla.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h index 7c78ad91a6..b453531040 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h @@ -2,11 +2,11 @@ #define Z_EN_GE2_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnGe2; -typedef void (*EnGe2ActionFunc)(struct EnGe2*, PlayState*); +typedef void (*EnGe2ActionFunc)(struct EnGe2*, struct PlayState*); typedef struct EnGe2 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c index 614936d3bc..5e0783bc30 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c @@ -5,8 +5,19 @@ */ #include "z_en_ge3.h" -#include "assets/objects/object_geldb/object_geldb.h" + +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "sys_matrix.h" #include "versions.h" +#include "z_lib.h" +#include "z64item.h" +#include "z64play.h" +#include "z64player.h" + +#include "assets/objects/object_geldb/object_geldb.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h index 4bb5c7b3fc..d767ba6d9a 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h @@ -2,12 +2,12 @@ #define Z_EN_GE3_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" #include "overlays/actors/ovl_En_GeldB/z_en_geldb.h" struct EnGe3; -typedef void (*EnGe3ActionFunc)(struct EnGe3*, PlayState*); +typedef void (*EnGe3ActionFunc)(struct EnGe3*, struct PlayState*); typedef struct EnGe3 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c index 8ecd36af5e..33b53f4dcd 100644 --- a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c +++ b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c @@ -5,6 +5,24 @@ */ #include "z_en_geldb.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "rand.h" +#include "segmented_address.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_geldb/object_geldb.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.h b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.h index 8ca9f1ac6a..e1a7ff3ea0 100644 --- a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.h +++ b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.h @@ -2,7 +2,7 @@ #define Z_EN_GELDB_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnGeldB; @@ -34,7 +34,7 @@ typedef enum EnGeldBLimb { /* 0x18 */ GELDB_LIMB_MAX } EnGeldBLimb; -typedef void (*EnGeldBActionFunc)(struct EnGeldB*, PlayState*); +typedef void (*EnGeldBActionFunc)(struct EnGeldB*, struct PlayState*); typedef struct EnGeldB { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c index 47e40b5af1..aebb758cd7 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c @@ -5,8 +5,15 @@ */ #include "z_en_girla.h" + +#include "printf.h" +#include "rand.h" +#include "sys_matrix.h" #include "terminal.h" +#include "z_lib.h" #include "z64draw.h" +#include "z64play.h" +#include "z64save.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_En_GirlA/z_en_girla.h b/src/overlays/actors/ovl_En_GirlA/z_en_girla.h index 971d0109c4..504837044e 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.h +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.h @@ -2,14 +2,14 @@ #define Z_EN_GIRLA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnGirlA; -typedef void (*EnGirlAActionFunc)(struct EnGirlA*, PlayState*); -typedef void (*EnGirlA2Func)(PlayState*, struct EnGirlA*); -typedef void (*EnGirlA3Func)(Actor*, PlayState*, s32); -typedef s32 (*EnGirlA4Func)(PlayState*, struct EnGirlA*); +typedef void (*EnGirlAActionFunc)(struct EnGirlA*, struct PlayState*); +typedef void (*EnGirlA2Func)(struct PlayState*, struct EnGirlA*); +typedef void (*EnGirlA3Func)(Actor*, struct PlayState*, s32); +typedef s32 (*EnGirlA4Func)(struct PlayState*, struct EnGirlA*); typedef struct EnGirlA { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c index 3ed42e5119..4b6a979b58 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -5,9 +5,22 @@ */ #include "z_en_gm.h" + +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "rand.h" +#include "segmented_address.h" +#include "sys_matrix.h" +#include "terminal.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_oF1d_map/object_oF1d_map.h" #include "assets/objects/object_gm/object_gm.h" -#include "terminal.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED) @@ -105,7 +118,7 @@ void func_80A3D838(EnGm* this, PlayState* play) { if (Object_IsLoaded(&play->objectCtx, this->gmObjectSlot)) { this->actor.flags &= ~ACTOR_FLAG_UPDATE_CULLING_DISABLED; SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, this->jointTable, this->morphTable, 18); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->gmObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->gmObjectSlot].segment); Animation_Change(&this->skelAnime, &object_gm_Anim_0002B8, 1.0f, 0.0f, Animation_GetLastFrame(&object_gm_Anim_0002B8), ANIMMODE_LOOP, 0.0f); this->actor.draw = EnGm_Draw; @@ -274,7 +287,7 @@ void func_80A3DF60(EnGm* this, PlayState* play) { } void func_80A3DFBC(EnGm* this, PlayState* play) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->gmObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->gmObjectSlot].segment); this->timer++; this->actionFunc(this, play); this->actor.focus.rot.x = this->actor.world.rot.x; diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.h b/src/overlays/actors/ovl_En_Gm/z_en_gm.h index 3cfedca015..d5234bde14 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.h +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.h @@ -2,12 +2,12 @@ #define Z_EN_GM_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnGm; -typedef void (*EnGmUpdateFunc)(struct EnGm*, PlayState*); -typedef void (*EnGmActionFunc)(struct EnGm*, PlayState*); +typedef void (*EnGmUpdateFunc)(struct EnGm*, struct PlayState*); +typedef void (*EnGmActionFunc)(struct EnGm*, struct PlayState*); typedef struct EnGm { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 7a50157de5..4f7f47630f 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -1,5 +1,20 @@ #include "z_en_go.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.h" + +#include "libc64/math64.h" +#include "libc64/qrand.h" +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "one_point_cutscene.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_oF1d_map/object_oF1d_map.h" diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.h b/src/overlays/actors/ovl_En_Go/z_en_go.h index bd673c9521..691472aef6 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.h +++ b/src/overlays/actors/ovl_En_Go/z_en_go.h @@ -2,13 +2,13 @@ #define Z_EN_GO_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnGo; -typedef void (*EnGoActionFunc)(struct EnGo*, PlayState*); -typedef u16 (*callback1_80A3ED24)(PlayState*, struct EnGo*); -typedef s16 (*callback2_80A3ED24)(PlayState*, struct EnGo*); +typedef void (*EnGoActionFunc)(struct EnGo*, struct PlayState*); +typedef u16 (*callback1_80A3ED24)(struct PlayState*, struct EnGo*); +typedef s16 (*callback2_80A3ED24)(struct PlayState*, struct EnGo*); // WIP type docs // /* 0x00 */ GORON1_CITY_LINK, diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 50680850d0..61c3d5f6e1 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -1,9 +1,27 @@ #include "z_en_go2.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.h" + +#include "libc64/qrand.h" +#include "array_count.h" +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "one_point_cutscene.h" +#include "quake.h" +#include "segmented_address.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "versions.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64face_reaction.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_oF1d_map/object_oF1d_map.h" -#include "quake.h" -#include "versions.h" #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.h b/src/overlays/actors/ovl_En_Go2/z_en_go2.h index 6fb6229355..0c49a30363 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.h +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.h @@ -2,12 +2,12 @@ #define Z_EN_GO2_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" #include "overlays/actors/ovl_En_Go/z_en_go.h" struct EnGo2; -typedef void (*EnGo2ActionFunc)(struct EnGo2*, PlayState*); +typedef void (*EnGo2ActionFunc)(struct EnGo2*, struct PlayState*); typedef enum GoronType { /* 0x00 */ GORON_CITY_ROLLING_BIG, @@ -73,7 +73,7 @@ typedef struct EnGo2 { /* 0x0190 */ EnGo2ActionFunc actionFunc; /* 0x0194 */ NpcInteractInfo interactInfo; /* 0x01BC */ ColliderCylinder collider; - /* 0x0208 */ Path* path; + /* 0x0208 */ struct Path* path; /* 0x020C */ u8 unk_20C; // counter for GORON_CITY_LINK animation /* 0x020D */ u8 dialogState; /* 0x020E */ u8 reverse; diff --git a/src/overlays/actors/ovl_En_Goma/z_en_goma.c b/src/overlays/actors/ovl_En_Goma/z_en_goma.c index 575df93e53..82175795bd 100644 --- a/src/overlays/actors/ovl_En_Goma/z_en_goma.c +++ b/src/overlays/actors/ovl_En_Goma/z_en_goma.c @@ -5,11 +5,26 @@ */ #include "z_en_goma.h" -#include "assets/objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" -#include "assets/objects/object_gol/object_gol.h" #include "overlays/actors/ovl_Boss_Goma/z_boss_goma.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" +#include "libc64/math64.h" +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "rand.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + +#include "assets/objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" +#include "assets/objects/object_gol/object_gol.h" + #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ ACTOR_FLAG_DRAW_CULLING_DISABLED) @@ -170,10 +185,10 @@ void EnGoma_Init(Actor* thisx, PlayState* play) { this->eggScale = 1.0f; this->eggSquishAngle = Rand_ZeroOne() * 1000.0f; this->actionTimer = 50; - Collider_InitCylinder(play, &this->colCyl1); - Collider_SetCylinder(play, &this->colCyl1, &this->actor, &D_80A4B7A0); - Collider_InitCylinder(play, &this->colCyl2); - Collider_SetCylinder(play, &this->colCyl2, &this->actor, &D_80A4B7CC); + Collider_InitCylinder(play, &this->colliderCylinder1); + Collider_SetCylinder(play, &this->colliderCylinder1, &this->actor, &D_80A4B7A0); + Collider_InitCylinder(play, &this->colliderCylinder2); + Collider_SetCylinder(play, &this->colliderCylinder2, &this->actor, &D_80A4B7CC); } } @@ -181,8 +196,8 @@ void EnGoma_Destroy(Actor* thisx, PlayState* play) { EnGoma* this = (EnGoma*)thisx; if (this->actor.params < 10) { - Collider_DestroyCylinder(play, &this->colCyl1); - Collider_DestroyCylinder(play, &this->colCyl2); + Collider_DestroyCylinder(play, &this->colliderCylinder1); + Collider_DestroyCylinder(play, &this->colliderCylinder2); } } @@ -620,15 +635,15 @@ void EnGoma_UpdateHit(EnGoma* this, PlayState* play) { ColliderElement* acHitElem; u8 swordDamage; - if ((this->colCyl1.base.atFlags & AT_HIT) && this->actionFunc == EnGoma_Jump) { + if ((this->colliderCylinder1.base.atFlags & AT_HIT) && this->actionFunc == EnGoma_Jump) { EnGoma_SetupLand(this); this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; } - if ((this->colCyl2.base.acFlags & AC_HIT) && (s8)this->actor.colChkInfo.health > 0) { - acHitElem = this->colCyl2.elem.acHitElem; - this->colCyl2.base.acFlags &= ~AC_HIT; + if ((this->colliderCylinder2.base.acFlags & AC_HIT) && (s8)this->actor.colChkInfo.health > 0) { + acHitElem = this->colliderCylinder2.elem.acHitElem; + this->colliderCylinder2.base.acFlags &= ~AC_HIT; if (this->gomaType == ENGOMA_NORMAL) { u32 dmgFlags = acHitElem->atDmgInfo.dmgFlags; @@ -738,20 +753,20 @@ void EnGoma_Update(Actor* thisx, PlayState* play) { EnGoma_UpdateEyeEnvColor(this); this->visualState = 1; if (player->meleeWeaponState != 0) { - this->colCyl2.dim.radius = 35; - this->colCyl2.dim.height = 35; - this->colCyl2.dim.yShift = 0; + this->colliderCylinder2.dim.radius = 35; + this->colliderCylinder2.dim.height = 35; + this->colliderCylinder2.dim.yShift = 0; } else { - this->colCyl2.dim.radius = 15; - this->colCyl2.dim.height = 30; - this->colCyl2.dim.yShift = 10; + this->colliderCylinder2.dim.radius = 15; + this->colliderCylinder2.dim.height = 30; + this->colliderCylinder2.dim.yShift = 10; } if (this->invincibilityTimer == 0) { - Collider_UpdateCylinder(&this->actor, &this->colCyl1); - Collider_UpdateCylinder(&this->actor, &this->colCyl2); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colCyl1.base); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCyl2.base); - CollisionCheck_SetAT(play, &play->colChkCtx, &this->colCyl1.base); + Collider_UpdateCylinder(&this->actor, &this->colliderCylinder1); + Collider_UpdateCylinder(&this->actor, &this->colliderCylinder2); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder1.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder2.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderCylinder1.base); } } } diff --git a/src/overlays/actors/ovl_En_Goma/z_en_goma.h b/src/overlays/actors/ovl_En_Goma/z_en_goma.h index a0a97f20fb..6b2f7cf309 100644 --- a/src/overlays/actors/ovl_En_Goma/z_en_goma.h +++ b/src/overlays/actors/ovl_En_Goma/z_en_goma.h @@ -2,7 +2,7 @@ #define Z_EN_GOMA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" typedef enum GomaType { /* 0 */ ENGOMA_NORMAL, @@ -13,7 +13,7 @@ typedef enum GomaType { struct EnGoma; -typedef void (*EnGomaActionFunc)(struct EnGoma*, PlayState*); +typedef void (*EnGomaActionFunc)(struct EnGoma*, struct PlayState*); typedef enum EnGomaLimb { /* 0 */ GOMA_LIMB_NONE, @@ -73,8 +73,8 @@ typedef struct EnGoma { /* 0x2F8 */ s16 stunTimer; /* 0x2FC */ Vec3f shieldKnockbackVel; /* 0x308 */ Gfx* bossLimbDL; // set by z_boss_goma - /* 0x30C */ ColliderCylinder colCyl1; - /* 0x358 */ ColliderCylinder colCyl2; + /* 0x30C */ ColliderCylinder colliderCylinder1; + /* 0x358 */ ColliderCylinder colliderCylinder2; } EnGoma; // size = 0x03A4 #endif diff --git a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c index 56f7b6d975..10ba10d18d 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -6,10 +6,24 @@ #include "z_en_goroiwa.h" #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" + +#include "libc64/qrand.h" +#include "ichain.h" +#include "printf.h" +#include "quake.h" +#include "regs.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_math3d.h" +#include "sys_matrix.h" +#include "terminal.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_goroiwa/object_goroiwa.h" -#include "quake.h" -#include "terminal.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -105,7 +119,7 @@ void EnGoroiwa_InitCollider(EnGoroiwa* this, PlayState* play) { s32 pad; Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); EnGoroiwa_UpdateCollider(this); this->collider.elements[0].dim.worldSphere.radius = 58; } diff --git a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.h b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.h index 6285432936..26a5810a2d 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.h +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.h @@ -2,17 +2,17 @@ #define Z_EN_GOROIWA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnGoroiwa; -typedef void (*EnGoroiwaActionFunc)(struct EnGoroiwa*, PlayState*); +typedef void (*EnGoroiwaActionFunc)(struct EnGoroiwa*, struct PlayState*); typedef struct EnGoroiwa { /* 0x0000 */ Actor actor; /* 0x014C */ EnGoroiwaActionFunc actionFunc; /* 0x0150 */ ColliderJntSph collider; - /* 0x0170 */ ColliderJntSphElement colliderItems[1]; + /* 0x0170 */ ColliderJntSphElement colliderElements[1]; /* 0x01B0 */ Vec3f prevUnitRollAxis; /* 0x01BC */ f32 prevRollAngleDiff; /* 0x01C0 */ f32 rollRotSpeed; diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index 46d470c330..4e590217f0 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -5,9 +5,23 @@ */ #include "z_en_gs.h" -#include "assets/objects/object_gs/object_gs.h" #include "overlays/actors/ovl_En_Elf/z_en_elf.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "rand.h" +#include "regs.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64ocarina.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" +#include "assets/objects/object_gs/object_gs.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_DURING_OCARINA) diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.h b/src/overlays/actors/ovl_En_Gs/z_en_gs.h index 47edd278db..d7abdc676f 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.h +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.h @@ -2,11 +2,11 @@ #define Z_EN_GS_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnGs; -typedef void (*EnGsActionFunc)(struct EnGs*, PlayState*); +typedef void (*EnGsActionFunc)(struct EnGs*, struct PlayState*); typedef struct EnGs { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Guest/z_en_guest.c b/src/overlays/actors/ovl_En_Guest/z_en_guest.c index 5c0a14f9d0..474912abb6 100644 --- a/src/overlays/actors/ovl_En_Guest/z_en_guest.c +++ b/src/overlays/actors/ovl_En_Guest/z_en_guest.c @@ -5,9 +5,22 @@ */ #include "z_en_guest.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "rand.h" +#include "segmented_address.h" +#include "sys_matrix.h" +#include "terminal.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_os_anime/object_os_anime.h" #include "assets/objects/object_boj/object_boj.h" -#include "terminal.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED) @@ -81,7 +94,7 @@ void EnGuest_Update(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); SkelAnime_InitFlex(play, &this->skelAnime, &gHylianMan2Skel, NULL, this->jointTable, this->morphTable, 16); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); Animation_Change(&this->skelAnime, &gObjOsAnim_42AC, 1.0f, 0.0f, Animation_GetLastFrame(&gObjOsAnim_42AC), ANIMMODE_LOOP, 0.0f); @@ -159,7 +172,7 @@ void func_80A505CC(Actor* thisx, PlayState* play) { Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, 16); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); SkelAnime_Update(&this->skelAnime); Actor_SetFocus(&this->actor, 60.0f); diff --git a/src/overlays/actors/ovl_En_Guest/z_en_guest.h b/src/overlays/actors/ovl_En_Guest/z_en_guest.h index 2130ebc74e..92dbc72d5c 100644 --- a/src/overlays/actors/ovl_En_Guest/z_en_guest.h +++ b/src/overlays/actors/ovl_En_Guest/z_en_guest.h @@ -2,11 +2,11 @@ #define Z_EN_GUEST_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnGuest; -typedef void (*EnGuestActionFunc)(struct EnGuest* this, PlayState* play); +typedef void (*EnGuestActionFunc)(struct EnGuest* this, struct PlayState* play); typedef struct EnGuest { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Hata/z_en_hata.c b/src/overlays/actors/ovl_En_Hata/z_en_hata.c index 6cdb51f59b..27cd1341ce 100644 --- a/src/overlays/actors/ovl_En_Hata/z_en_hata.c +++ b/src/overlays/actors/ovl_En_Hata/z_en_hata.c @@ -5,6 +5,15 @@ */ #include "z_en_hata.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "rand.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" + #include "assets/objects/object_hata/object_hata.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_En_Hata/z_en_hata.h b/src/overlays/actors/ovl_En_Hata/z_en_hata.h index e098bcaab3..82f6ba1a8b 100644 --- a/src/overlays/actors/ovl_En_Hata/z_en_hata.h +++ b/src/overlays/actors/ovl_En_Hata/z_en_hata.h @@ -2,7 +2,7 @@ #define Z_EN_HATA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" typedef enum EnHataLimb { diff --git a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c index 0bc4ac8119..0736896895 100644 --- a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c +++ b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c @@ -5,8 +5,26 @@ */ #include "z_en_heishi1.h" -#include "assets/objects/object_sd/object_sd.h" + +#include "libc64/math64.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "rand.h" +#include "regs.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" #include "terminal.h" +#include "z_lib.h" +#include "z64debug_display.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/object_sd/object_sd.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.h b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.h index 93bc570223..bc1837241e 100644 --- a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.h +++ b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.h @@ -2,11 +2,11 @@ #define Z_EN_HEISHI1_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnHeishi1; -typedef void (*EnHeishi1ActionFunc)(struct EnHeishi1*, PlayState*); +typedef void (*EnHeishi1ActionFunc)(struct EnHeishi1*, struct PlayState*); typedef struct EnHeishi1 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c index b31974f3b3..c071d40c53 100644 --- a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c +++ b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c @@ -4,13 +4,26 @@ * Description: Hyrulian Guards */ -#include "terminal.h" #include "z_en_heishi2.h" +#include "overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.h" +#include "overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.h" +#include "overlays/actors/ovl_En_Bom/z_en_bom.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "rand.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "terminal.h" +#include "z_lib.h" +#include "z64face_reaction.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_sd/object_sd.h" #include "assets/objects/object_link_child/object_link_child.h" -#include "overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.h" -#include "overlays/actors/ovl_En_Bom/z_en_bom.h" -#include "overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY) diff --git a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.h b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.h index b4f6ea5e7b..3753012bee 100644 --- a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.h +++ b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.h @@ -2,12 +2,12 @@ #define Z_EN_HEISHI2_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnHeishi2; -typedef void (*EnHeishi2ActionFunc)(struct EnHeishi2*, PlayState*); +typedef void (*EnHeishi2ActionFunc)(struct EnHeishi2*, struct PlayState*); typedef struct EnHeishi2 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c b/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c index 8a10e8f96e..354c3f3058 100644 --- a/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c +++ b/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c @@ -5,9 +5,19 @@ */ #include "z_en_heishi3.h" -#include "assets/objects/object_sd/object_sd.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "sfx.h" #include "terminal.h" #include "versions.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/object_sd/object_sd.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.h b/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.h index 63b4311393..57eb11c61c 100644 --- a/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.h +++ b/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.h @@ -2,11 +2,11 @@ #define Z_EN_HEISHI3_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnHeishi3; -typedef void (*EnHeishi3ActionFunc)(struct EnHeishi3*, PlayState*); +typedef void (*EnHeishi3ActionFunc)(struct EnHeishi3*, struct PlayState*); typedef struct EnHeishi3 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c index 51588714c8..b90c778114 100644 --- a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c +++ b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c @@ -1,6 +1,15 @@ #include "z_en_heishi4.h" -#include "assets/objects/object_sd/object_sd.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" #include "terminal.h" +#include "z64face_reaction.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/object_sd/object_sd.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY) diff --git a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h index 48e09ca458..9ab928fe3e 100644 --- a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h +++ b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.h @@ -2,7 +2,7 @@ #define Z_EN_HEISHI4_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" typedef enum Heishi4Type { /* 0x00 */ HEISHI4_AT_KAKARIKO_ENTRANCE, @@ -13,7 +13,7 @@ typedef enum Heishi4Type { struct EnHeishi4; -typedef void (*EnHeishi4ActionFunc)(struct EnHeishi4*, PlayState*); +typedef void (*EnHeishi4ActionFunc)(struct EnHeishi4*, struct PlayState*); typedef struct EnHeishi4 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c b/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c index 541e8b8519..454f83c2d0 100644 --- a/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c +++ b/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c @@ -5,6 +5,13 @@ */ #include "z_en_hintnuts.h" + +#include "ichain.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" + #include "assets/objects/object_hintnuts/object_hintnuts.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE) @@ -78,8 +85,9 @@ void EnHintnuts_Init(Actor* thisx, PlayState* play) { this->actor.flags &= ~(ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE); } else { ActorShape_Init(&this->actor.shape, 0x0, ActorShadow_DrawCircle, 35.0f); - SkelAnime_Init(play, &this->skelAnime, &gHintNutsSkel, &gHintNutsStandAnim, this->jointTable, this->morphTable, - 10); + //! @bug Flex skeleton is used as normal skeleton + SkelAnime_Init(play, &this->skelAnime, (SkeletonHeader*)&gHintNutsSkel, &gHintNutsStandAnim, this->jointTable, + this->morphTable, 10); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); diff --git a/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.h b/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.h index fcc0201659..a24b387fe1 100644 --- a/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.h +++ b/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.h @@ -2,11 +2,11 @@ #define Z_EN_HINTNUTS_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnHintnuts; -typedef void (*EnHintnutsActionFunc)(struct EnHintnuts*, PlayState*); +typedef void (*EnHintnutsActionFunc)(struct EnHintnuts*, struct PlayState*); typedef struct EnHintnuts { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Holl/z_en_holl.c b/src/overlays/actors/ovl_En_Holl/z_en_holl.c index c17ff7e58f..c3f8fa40ad 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.c +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.c @@ -1,5 +1,14 @@ #include "z_en_holl.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED /* diff --git a/src/overlays/actors/ovl_En_Holl/z_en_holl.h b/src/overlays/actors/ovl_En_Holl/z_en_holl.h index 2c87dc346b..4a9409373a 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.h +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.h @@ -2,7 +2,7 @@ #define Z_EN_HOLL_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" #define ENHOLL_GET_TYPE(thisx) PARAMS_GET_U((thisx)->params, 6, 3) #define ENHOLL_GET_SWITCH_FLAG(thisx) PARAMS_GET_U((thisx)->params, 0, 6) @@ -35,7 +35,7 @@ typedef enum EnHollType { struct EnHoll; -typedef void (*EnHollActionFunc)(struct EnHoll*, PlayState*); +typedef void (*EnHollActionFunc)(struct EnHoll*, struct PlayState*); typedef struct EnHoll { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c index 9a77366416..5f884f8997 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c @@ -5,6 +5,22 @@ */ #include "z_en_honotrap.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_math.h" +#include "sys_math3d.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" diff --git a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h index f1b085686c..debd2bfb7c 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.h @@ -2,11 +2,11 @@ #define Z_EN_HONOTRAP_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnHonotrap; -typedef void (*EnHonotrapActionFunc)(struct EnHonotrap*, PlayState*); +typedef void (*EnHonotrapActionFunc)(struct EnHonotrap*, struct PlayState*); typedef union EnHonotrapCollider { struct { diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 075facff4d..dded516560 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -5,10 +5,32 @@ */ #include "z_en_horse.h" -#include "z64horse.h" -#include "global.h" -#include "versions.h" #include "overlays/actors/ovl_En_In/z_en_in.h" + +#include "libc64/math64.h" +#include "libc64/qrand.h" +#include "array_count.h" +#include "controller.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "regs.h" +#include "rumble.h" +#include "segmented_address.h" +#include "seqcmd.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_math3d.h" +#include "versions.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64effect.h" +#include "z64horse.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" +#include "z64skin_matrix.h" + #include "assets/objects/object_horse/object_horse.h" #include "assets/objects/object_hni/object_hni.h" #include "assets/scenes/overworld/spot09/spot09_scene.h" @@ -121,7 +143,7 @@ static ColliderCylinderInit sCylinderInit2 = { { 20, 70, 0, { 0, 0, 0 } }, }; -static ColliderJntSphElementInit sJntSphItemsInit[1] = { +static ColliderJntSphElementInit sJntSphElementsInit[1] = { { { ELEM_MATERIAL_UNK0, @@ -145,7 +167,7 @@ static ColliderJntSphInit sJntSphInit = { COLSHAPE_JNTSPH, }, 1, - sJntSphItemsInit, + sJntSphElementsInit, }; static CollisionCheckInfoInit D_80A65F38 = { 10, 35, 100, MASS_HEAVY }; @@ -561,7 +583,7 @@ void EnHorse_UpdateIngoRaceInfo(EnHorse* this, PlayState* play, RaceInfo* raceIn EnHorse_RotateToPoint(this, play, &curWaypointPos, 400); if (distSq < SQ(300.0f)) { - if (this->actor.xzDistToPlayer < 130.0f || this->jntSph.elements[0].base.ocElemFlags & OCELEM_HIT) { + if (this->actor.xzDistToPlayer < 130.0f || this->colliderJntSph.elements[0].base.ocElemFlags & OCELEM_HIT) { s32 pad; if (Math_SinS(this->actor.yawTowardsPlayer - this->actor.world.rot.y) > 0.0f) { @@ -818,12 +840,12 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawHorse, 20.0f); this->action = ENHORSE_ACT_IDLE; this->actor.speed = 0.0f; - Collider_InitCylinder(play, &this->cyl1); - Collider_SetCylinder(play, &this->cyl1, &this->actor, &sCylinderInit1); - Collider_InitCylinder(play, &this->cyl2); - Collider_SetCylinder(play, &this->cyl2, &this->actor, &sCylinderInit2); - Collider_InitJntSph(play, &this->jntSph); - Collider_SetJntSph(play, &this->jntSph, &this->actor, &sJntSphInit, &this->jntSphList); + Collider_InitCylinder(play, &this->colliderCylinder1); + Collider_SetCylinder(play, &this->colliderCylinder1, &this->actor, &sCylinderInit1); + Collider_InitCylinder(play, &this->colliderCylinder2); + Collider_SetCylinder(play, &this->colliderCylinder2, &this->actor, &sCylinderInit2); + Collider_InitJntSph(play, &this->colliderJntSph); + Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElements); CollisionCheck_SetInfo(&this->actor.colChkInfo, DamageTable_Get(0xB), &D_80A65F38); this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 70.0f; @@ -906,9 +928,9 @@ void EnHorse_Destroy(Actor* thisx, PlayState* play) { Audio_StopSfxByPos(&this->unk_21C); } Skin_Free(play, &this->skin); - Collider_DestroyCylinder(play, &this->cyl1); - Collider_DestroyCylinder(play, &this->cyl2); - Collider_DestroyJntSph(play, &this->jntSph); + Collider_DestroyCylinder(play, &this->colliderCylinder1); + Collider_DestroyCylinder(play, &this->colliderCylinder2); + Collider_DestroyJntSph(play, &this->colliderJntSph); } void EnHorse_RotateToPlayer(EnHorse* this, PlayState* play) { @@ -927,9 +949,9 @@ void EnHorse_Freeze(EnHorse* this) { } this->prevAction = this->action; this->action = ENHORSE_ACT_FROZEN; - this->cyl1.base.ocFlags1 &= ~OC1_ON; - this->cyl2.base.ocFlags1 &= ~OC1_ON; - this->jntSph.base.ocFlags1 &= ~OC1_ON; + this->colliderCylinder1.base.ocFlags1 &= ~OC1_ON; + this->colliderCylinder2.base.ocFlags1 &= ~OC1_ON; + this->colliderJntSph.base.ocFlags1 &= ~OC1_ON; this->animationIdx = ENHORSE_ANIM_IDLE; } } @@ -943,9 +965,9 @@ void EnHorse_Frozen(EnHorse* this, PlayState* play) { this->actor.speed = 0.0f; this->noInputTimer--; if (this->noInputTimer < 0) { - this->cyl1.base.ocFlags1 |= OC1_ON; - this->cyl2.base.ocFlags1 |= OC1_ON; - this->jntSph.base.ocFlags1 |= OC1_ON; + this->colliderCylinder1.base.ocFlags1 |= OC1_ON; + this->colliderCylinder2.base.ocFlags1 |= OC1_ON; + this->colliderJntSph.base.ocFlags1 |= OC1_ON; if (this->playerControlled == true) { this->stateFlags &= ~ENHORSE_FLAG_7; if (this->actor.params == HORSE_PTYPE_4) { @@ -1728,9 +1750,9 @@ void EnHorse_HighJump(EnHorse* this, PlayState* play) { } void EnHorse_InitInactive(EnHorse* this) { - this->cyl1.base.ocFlags1 &= ~OC1_ON; - this->cyl2.base.ocFlags1 &= ~OC1_ON; - this->jntSph.base.ocFlags1 &= ~OC1_ON; + this->colliderCylinder1.base.ocFlags1 &= ~OC1_ON; + this->colliderCylinder2.base.ocFlags1 &= ~OC1_ON; + this->colliderJntSph.base.ocFlags1 &= ~OC1_ON; this->action = ENHORSE_ACT_INACTIVE; this->animationIdx = ENHORSE_ANIM_WALK; this->stateFlags |= ENHORSE_INACTIVE; @@ -1762,9 +1784,9 @@ void EnHorse_Inactive(EnHorse* this, PlayState* play2) { this->followTimer = 0; EnHorse_SetFollowAnimation(this, play); this->actor.params = HORSE_PTYPE_0; - this->cyl1.base.ocFlags1 |= OC1_ON; - this->cyl2.base.ocFlags1 |= OC1_ON; - this->jntSph.base.ocFlags1 |= OC1_ON; + this->colliderCylinder1.base.ocFlags1 |= OC1_ON; + this->colliderCylinder2.base.ocFlags1 |= OC1_ON; + this->colliderJntSph.base.ocFlags1 |= OC1_ON; } } @@ -3548,12 +3570,12 @@ void EnHorse_Update(Actor* thisx, PlayState* play2) { this->rider->shape.rot.y = thisx->shape.rot.y; } } - if (this->jntSph.elements[0].base.ocElemFlags & OCELEM_HIT) { + if (this->colliderJntSph.elements[0].base.ocElemFlags & OCELEM_HIT) { if (thisx->speed > 6.0f) { thisx->speed -= 1.0f; } } - if (this->jntSph.base.acFlags & AC_HIT) { + if (this->colliderJntSph.base.acFlags & AC_HIT) { this->unk_21C = this->unk_228; if (this->stateFlags & ENHORSE_DRAW) { Audio_PlaySfxGeneral(NA_SE_EV_HORSE_NEIGH, &this->unk_21C, 4, &gSfxDefaultFreqAndVolScale, @@ -3563,17 +3585,21 @@ void EnHorse_Update(Actor* thisx, PlayState* play2) { if (this->action != ENHORSE_ACT_INGO_RACE) { EnHorse_TiltBody(this, play); } - Collider_UpdateCylinder(thisx, &this->cyl1); - Collider_UpdateCylinder(thisx, &this->cyl2); + Collider_UpdateCylinder(thisx, &this->colliderCylinder1); + Collider_UpdateCylinder(thisx, &this->colliderCylinder2); // Required to match - this->cyl1.dim.pos.x = this->cyl1.dim.pos.x + (s16)(Math_SinS(thisx->shape.rot.y) * 11.0f); - this->cyl1.dim.pos.z = this->cyl1.dim.pos.z + (s16)(Math_CosS(thisx->shape.rot.y) * 11.0f); - this->cyl2.dim.pos.x = this->cyl2.dim.pos.x + (s16)(Math_SinS(thisx->shape.rot.y) * -18.0f); - this->cyl2.dim.pos.z = this->cyl2.dim.pos.z + (s16)(Math_CosS(thisx->shape.rot.y) * -18.0f); - CollisionCheck_SetAT(play, &play->colChkCtx, &this->cyl1.base); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->cyl1.base); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->cyl2.base); + this->colliderCylinder1.dim.pos.x = + this->colliderCylinder1.dim.pos.x + (s16)(Math_SinS(thisx->shape.rot.y) * 11.0f); + this->colliderCylinder1.dim.pos.z = + this->colliderCylinder1.dim.pos.z + (s16)(Math_CosS(thisx->shape.rot.y) * 11.0f); + this->colliderCylinder2.dim.pos.x = + this->colliderCylinder2.dim.pos.x + (s16)(Math_SinS(thisx->shape.rot.y) * -18.0f); + this->colliderCylinder2.dim.pos.z = + this->colliderCylinder2.dim.pos.z + (s16)(Math_CosS(thisx->shape.rot.y) * -18.0f); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderCylinder1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder1.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder2.base); if ((player->stateFlags1 & PLAYER_STATE1_0) && player->rideActor != NULL) { if (play->sceneId != SCENE_LON_LON_RANCH || (play->sceneId == SCENE_LON_LON_RANCH && (thisx->world.pos.z < -2400.0f))) { @@ -3617,9 +3643,9 @@ void EnHorse_Update(Actor* thisx, PlayState* play2) { } if (thisx->speed >= 5.0f) { - this->cyl1.base.atFlags |= AT_ON; + this->colliderCylinder1.base.atFlags |= AT_ON; } else { - this->cyl1.base.atFlags &= ~AT_ON; + this->colliderCylinder1.base.atFlags &= ~AT_ON; } if (gSaveContext.save.entranceIndex != ENTR_LON_LON_RANCH_0 || gSaveContext.sceneLayer != 9) { @@ -3814,17 +3840,17 @@ void EnHorse_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { } } - for (i = 0; i < this->jntSph.count; i++) { - center.x = this->jntSph.elements[i].dim.modelSphere.center.x; - center.y = this->jntSph.elements[i].dim.modelSphere.center.y; - center.z = this->jntSph.elements[i].dim.modelSphere.center.z; + for (i = 0; i < this->colliderJntSph.count; i++) { + center.x = this->colliderJntSph.elements[i].dim.modelSphere.center.x; + center.y = this->colliderJntSph.elements[i].dim.modelSphere.center.y; + center.z = this->colliderJntSph.elements[i].dim.modelSphere.center.z; - Skin_GetLimbPos(skin, this->jntSph.elements[i].dim.limb, ¢er, &newCenter); - this->jntSph.elements[i].dim.worldSphere.center.x = newCenter.x; - this->jntSph.elements[i].dim.worldSphere.center.y = newCenter.y; - this->jntSph.elements[i].dim.worldSphere.center.z = newCenter.z; - this->jntSph.elements[i].dim.worldSphere.radius = - this->jntSph.elements[i].dim.modelSphere.radius * this->jntSph.elements[i].dim.scale; + Skin_GetLimbPos(skin, this->colliderJntSph.elements[i].dim.limb, ¢er, &newCenter); + this->colliderJntSph.elements[i].dim.worldSphere.center.x = newCenter.x; + this->colliderJntSph.elements[i].dim.worldSphere.center.y = newCenter.y; + this->colliderJntSph.elements[i].dim.worldSphere.center.z = newCenter.z; + this->colliderJntSph.elements[i].dim.worldSphere.radius = + this->colliderJntSph.elements[i].dim.modelSphere.radius * this->colliderJntSph.elements[i].dim.scale; } //! @bug Setting colliders in a draw function allows for duplicate entries to be added to their respective lists @@ -3832,8 +3858,8 @@ void EnHorse_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { //! Actors will draw for a couple of frames between the pauses, but some important logic updates will not occur. //! In the case of OC, this can cause unwanted effects such as a very large amount of displacement being applied to //! a colliding actor. - CollisionCheck_SetOC(play, &play->colChkCtx, &this->jntSph.base); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->jntSph.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); } // unused diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.h b/src/overlays/actors/ovl_En_Horse/z_en_horse.h index 059cf67682..0eed5c001c 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.h +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.h @@ -140,10 +140,10 @@ typedef struct EnHorse { /* 0x0264 */ Vec2f curStick; /* 0x026C */ Vec2f lastStick; /* 0x0274 */ f32 jumpStartY; - /* 0x0278 */ ColliderCylinder cyl1; - /* 0x02C4 */ ColliderCylinder cyl2; - /* 0x0310 */ ColliderJntSph jntSph; - /* 0x0330 */ ColliderJntSphElement jntSphList; + /* 0x0278 */ ColliderCylinder colliderCylinder1; + /* 0x02C4 */ ColliderCylinder colliderCylinder2; + /* 0x0310 */ ColliderJntSph colliderJntSph; + /* 0x0330 */ ColliderJntSphElement colliderJntSphElements[1]; /* 0x0370 */ u32 playerDir; /* 0x0374 */ s16 unk_374; /* 0x0376 */ s16 angleToPlayer; diff --git a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c index 9675ab1218..eefef20798 100644 --- a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c +++ b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c @@ -6,8 +6,19 @@ #include "z_en_horse_game_check.h" #include "overlays/actors/ovl_En_Horse/z_en_horse.h" + #include "libu64/debug.h" #include "line_numbers.h" +#include "printf.h" +#include "regs.h" +#include "sfx.h" +#include "seqcmd.h" +#include "sequence.h" +#include "sys_math3d.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h index 96834860e3..84ab117216 100644 --- a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h +++ b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h @@ -2,11 +2,11 @@ #define Z_EN_HORSE_GAME_CHECK_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnHorseGameCheckBase; -typedef s32 (*EnHorseGameCheckFunc)(struct EnHorseGameCheckBase* this, PlayState* play); +typedef s32 (*EnHorseGameCheckFunc)(struct EnHorseGameCheckBase* this, struct PlayState* play); typedef struct EnHorseGameCheckBase { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c b/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c index 0ce01f2d6e..e1991688a1 100644 --- a/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c +++ b/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c @@ -5,6 +5,18 @@ */ #include "z_en_horse_ganon.h" + +#include "libc64/math64.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sfx.h" +#include "sys_math3d.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64skin.h" + #include "assets/objects/object_horse_ganon/object_horse_ganon.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -181,10 +193,10 @@ void EnHorseGanon_Init(Actor* thisx, PlayState* play) { this->currentAnimation = 0; Animation_PlayOnce(&this->skin.skelAnime, sAnimations[0]); - Collider_InitCylinder(play, &this->colliderBody); - Collider_SetCylinder(play, &this->colliderBody, &this->actor, &sCylinderInit); - Collider_InitJntSph(play, &this->colliderHead); - Collider_SetJntSph(play, &this->colliderHead, &this->actor, &sJntSphInit, this->headElements); + Collider_InitCylinder(play, &this->bodyCollider); + Collider_SetCylinder(play, &this->bodyCollider, &this->actor, &sCylinderInit); + Collider_InitJntSph(play, &this->headCollider); + Collider_SetJntSph(play, &this->headCollider, &this->actor, &sJntSphInit, this->headColliderElements); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); func_80A68AC4(this); @@ -194,8 +206,8 @@ void EnHorseGanon_Destroy(Actor* thisx, PlayState* play) { EnHorseGanon* this = (EnHorseGanon*)thisx; Skin_Free(play, &this->skin); - Collider_DestroyCylinder(play, &this->colliderBody); - Collider_DestroyJntSph(play, &this->colliderHead); + Collider_DestroyCylinder(play, &this->bodyCollider); + Collider_DestroyJntSph(play, &this->headCollider); } void func_80A68AC4(EnHorseGanon* this) { @@ -293,8 +305,8 @@ void EnHorseGanon_Update(Actor* thisx, PlayState* play) { UPDBGCHECKINFO_FLAG_4); this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 70.0f; - Collider_UpdateCylinder(&this->actor, &this->colliderBody); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderBody.base); + Collider_UpdateCylinder(&this->actor, &this->bodyCollider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); } void EnHorseGanon_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { @@ -303,23 +315,23 @@ void EnHorseGanon_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { EnHorseGanon* this = (EnHorseGanon*)thisx; s32 index; - for (index = 0; index < this->colliderHead.count; index++) { - sp4C.x = this->colliderHead.elements[index].dim.modelSphere.center.x; - sp4C.y = this->colliderHead.elements[index].dim.modelSphere.center.y; - sp4C.z = this->colliderHead.elements[index].dim.modelSphere.center.z; + for (index = 0; index < this->headCollider.count; index++) { + sp4C.x = this->headCollider.elements[index].dim.modelSphere.center.x; + sp4C.y = this->headCollider.elements[index].dim.modelSphere.center.y; + sp4C.z = this->headCollider.elements[index].dim.modelSphere.center.z; - Skin_GetLimbPos(skin, this->colliderHead.elements[index].dim.limb, &sp4C, &sp40); + Skin_GetLimbPos(skin, this->headCollider.elements[index].dim.limb, &sp4C, &sp40); - this->colliderHead.elements[index].dim.worldSphere.center.x = sp40.x; - this->colliderHead.elements[index].dim.worldSphere.center.y = sp40.y; - this->colliderHead.elements[index].dim.worldSphere.center.z = sp40.z; + this->headCollider.elements[index].dim.worldSphere.center.x = sp40.x; + this->headCollider.elements[index].dim.worldSphere.center.y = sp40.y; + this->headCollider.elements[index].dim.worldSphere.center.z = sp40.z; - this->colliderHead.elements[index].dim.worldSphere.radius = - this->colliderHead.elements[index].dim.modelSphere.radius * this->colliderHead.elements[index].dim.scale; + this->headCollider.elements[index].dim.worldSphere.radius = + this->headCollider.elements[index].dim.modelSphere.radius * this->headCollider.elements[index].dim.scale; } //! @bug see relevant comment in `EnHorse_SkinCallback1` - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderHead.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->headCollider.base); } void EnHorseGanon_Draw(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.h b/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.h index 8083adeee6..473f6cecb4 100644 --- a/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.h +++ b/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.h @@ -2,11 +2,12 @@ #define Z_EN_HORSE_GANON_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" +#include "z64skin.h" struct EnHorseGanon; -typedef void (*EnHorseGanonActionFunc)(struct EnHorseGanon*, PlayState*); +typedef void (*EnHorseGanonActionFunc)(struct EnHorseGanon*, struct PlayState*); typedef struct EnHorseGanon { /* 0x0000 */ Actor actor; @@ -19,9 +20,9 @@ typedef struct EnHorseGanon { /* 0x01F0 */ u8 unk_1F0[0x04]; /* 0x01F4 */ f32 unk_1F4; /* 0x01F8 */ u8 unk_1F8[0x04]; - /* 0x01FC */ ColliderCylinder colliderBody; - /* 0x0248 */ ColliderJntSph colliderHead; - /* 0x0268 */ ColliderJntSphElement headElements[1]; + /* 0x01FC */ ColliderCylinder bodyCollider; + /* 0x0248 */ ColliderJntSph headCollider; + /* 0x0268 */ ColliderJntSphElement headColliderElements[1]; } EnHorseGanon; // size = 0x02A8 #endif diff --git a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c index 755916a390..1610147130 100644 --- a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c +++ b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c @@ -4,18 +4,25 @@ * Description: Young Epona */ -#include "global.h" +#include "z_en_horse_link_child.h" + +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" #include "rand.h" #include "regs.h" +#include "segmented_address.h" #include "sfx.h" +#include "sys_math3d.h" +#include "z_lib.h" #include "z64actor.h" #include "z64horse.h" #include "z64player.h" #include "z64play.h" -#include "z_en_horse_link_child.h" +#include "z64save.h" +#include "z64skin.h" + #include "assets/objects/object_horse_link_child/object_horse_link_child.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_UPDATE_DURING_OCARINA) @@ -66,7 +73,7 @@ static ColliderCylinderInitType1 sCylinderInit = { { 20, 100, 0, { 0, 0, 0 } }, }; -static ColliderJntSphElementInit sJntSphElementInit[1] = { +static ColliderJntSphElementInit sJntSphElementsInit[1] = { { { ELEM_MATERIAL_UNK0, @@ -90,7 +97,7 @@ static ColliderJntSphInit sJntSphInit = { COLSHAPE_JNTSPH, }, 1, - sJntSphElementInit, + sJntSphElementsInit, }; static CollisionCheckInfoInit sColCheckInfoInit = { 10, 35, 100, MASS_HEAVY }; @@ -168,7 +175,7 @@ void EnHorseLinkChild_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->bodyCollider); Collider_SetCylinderType1(play, &this->bodyCollider, &this->actor, &sCylinderInit); Collider_InitJntSph(play, &this->headCollider); - Collider_SetJntSph(play, &this->headCollider, &this->actor, &sJntSphInit, this->headElements); + Collider_SetJntSph(play, &this->headCollider, &this->actor, &sJntSphInit, this->headColliderElements); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColCheckInfoInit); this->unk_1F0 = 0; this->eyeTexIndex = 0; diff --git a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.h b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.h index 3ad5a449af..a4e9b512d7 100644 --- a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.h +++ b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.h @@ -20,7 +20,7 @@ typedef struct EnHorseLinkChild { /* 0x01F0 */ s32 unk_1F0; /* 0x01F4 */ ColliderCylinder bodyCollider; /* 0x0240 */ ColliderJntSph headCollider; - /* 0x0260 */ ColliderJntSphElement headElements[1]; + /* 0x0260 */ ColliderJntSphElement headColliderElements[1]; /* 0x02A0 */ s32 unk_2A0; } EnHorseLinkChild; // size = 0x02A4 diff --git a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c index c760dc54d7..300711ff37 100644 --- a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c +++ b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c @@ -5,6 +5,23 @@ */ #include "z_en_horse_normal.h" + +#include "libc64/math64.h" +#include "libc64/qrand.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "regs.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64save.h" +#include "z64skin.h" +#include "z64skin_matrix.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_horse_normal/object_horse_normal.h" @@ -197,7 +214,7 @@ void EnHorseNormal_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->bodyCollider); Collider_SetCylinder(play, &this->bodyCollider, &this->actor, &sCylinderInit1); Collider_InitJntSph(play, &this->headCollider); - Collider_SetJntSph(play, &this->headCollider, &this->actor, &sJntSphInit, this->headElements); + Collider_SetJntSph(play, &this->headCollider, &this->actor, &sJntSphInit, this->headColliderElements); Collider_InitCylinder(play, &this->cloneCollider); Collider_SetCylinder(play, &this->cloneCollider, &this->actor, &sCylinderInit2); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); @@ -706,7 +723,7 @@ void EnHorseNormal_Draw(Actor* thisx, PlayState* play2) { if (mtx == NULL) { return; } - gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPMatrix(POLY_OPA_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); func_800A63CC(&this->actor, play, &this->skin, NULL, NULL, true, 0, SKIN_DRAW_FLAG_CUSTOM_TRANSFORMS | SKIN_DRAW_FLAG_CUSTOM_MATRIX); diff --git a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.h b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.h index f9445eb186..01ddd44608 100644 --- a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.h +++ b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.h @@ -2,11 +2,12 @@ #define Z_EN_HORSE_NORMAL_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" +#include "z64skin.h" struct EnHorseNormal; -typedef void (*EnHorseNormalActionFunc)(struct EnHorseNormal*, PlayState*); +typedef void (*EnHorseNormalActionFunc)(struct EnHorseNormal*, struct PlayState*); typedef struct EnHorseNormal { /* 0x0000 */ Actor actor; @@ -26,7 +27,7 @@ typedef struct EnHorseNormal { /* 0x0224 */ char unk_224[0x04]; /* 0x0228 */ ColliderCylinder bodyCollider; /* 0x0274 */ ColliderJntSph headCollider; - /* 0x0294 */ ColliderJntSphElement headElements[1]; + /* 0x0294 */ ColliderJntSphElement headColliderElements[1]; /* 0x02D4 */ ColliderCylinder cloneCollider; /* 0x0320 */ char unk_320[0x04]; /* 0x0324 */ s32 waypoint; diff --git a/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c b/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c index 04b7b19336..fb59c5b84a 100644 --- a/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c +++ b/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c @@ -5,6 +5,18 @@ */ #include "z_en_horse_zelda.h" + +#include "libc64/math64.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sfx.h" +#include "sys_math3d.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_horse_zelda/object_horse_zelda.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -163,8 +175,8 @@ void EnHorseZelda_Init(Actor* thisx, PlayState* play) { Animation_PlayOnce(&this->skin.skelAnime, sAnimationHeaders[0]); Collider_InitCylinder(play, &this->colliderCylinder); Collider_SetCylinderType1(play, &this->colliderCylinder, &this->actor, &sCylinderInit); - Collider_InitJntSph(play, &this->colliderSphere); - Collider_SetJntSph(play, &this->colliderSphere, &this->actor, &sJntSphInit, &this->colliderSphereItem); + Collider_InitJntSph(play, &this->colliderJntSph); + Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElements); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); this->animationIndex = 0; EnHorseZelda_SetupStop(this); @@ -174,7 +186,7 @@ void EnHorseZelda_Destroy(Actor* thisx, PlayState* play) { EnHorseZelda* this = (EnHorseZelda*)thisx; Collider_DestroyCylinder(play, &this->colliderCylinder); - Collider_DestroyJntSph(play, &this->colliderSphere); + Collider_DestroyJntSph(play, &this->colliderJntSph); Skin_Free(play, &this->skin); } @@ -250,23 +262,23 @@ void EnHorseZelda_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { EnHorseZelda* this = (EnHorseZelda*)thisx; s32 i; - for (i = 0; i < this->colliderSphere.count; i++) { - offset.x = this->colliderSphere.elements[i].dim.modelSphere.center.x; - offset.y = this->colliderSphere.elements[i].dim.modelSphere.center.y; - offset.z = this->colliderSphere.elements[i].dim.modelSphere.center.z; + for (i = 0; i < this->colliderJntSph.count; i++) { + offset.x = this->colliderJntSph.elements[i].dim.modelSphere.center.x; + offset.y = this->colliderJntSph.elements[i].dim.modelSphere.center.y; + offset.z = this->colliderJntSph.elements[i].dim.modelSphere.center.z; - Skin_GetLimbPos(skin, this->colliderSphere.elements[i].dim.limb, &offset, &dst); + Skin_GetLimbPos(skin, this->colliderJntSph.elements[i].dim.limb, &offset, &dst); - this->colliderSphere.elements[i].dim.worldSphere.center.x = dst.x; - this->colliderSphere.elements[i].dim.worldSphere.center.y = dst.y; - this->colliderSphere.elements[i].dim.worldSphere.center.z = dst.z; + this->colliderJntSph.elements[i].dim.worldSphere.center.x = dst.x; + this->colliderJntSph.elements[i].dim.worldSphere.center.y = dst.y; + this->colliderJntSph.elements[i].dim.worldSphere.center.z = dst.z; - this->colliderSphere.elements[i].dim.worldSphere.radius = - this->colliderSphere.elements[i].dim.modelSphere.radius * this->colliderSphere.elements[i].dim.scale; + this->colliderJntSph.elements[i].dim.worldSphere.radius = + this->colliderJntSph.elements[i].dim.modelSphere.radius * this->colliderJntSph.elements[i].dim.scale; } //! @bug see relevant comment in `EnHorse_SkinCallback1` - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderSphere.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderJntSph.base); } void EnHorseZelda_Draw(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.h b/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.h index 7ce6cace3a..86b851c77b 100644 --- a/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.h +++ b/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.h @@ -2,11 +2,12 @@ #define Z_EN_HORSE_ZELDA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" +#include "z64skin.h" struct EnHorseZelda; -typedef void (*EnHorseZeldaActionFunc)(struct EnHorseZelda*, PlayState*); +typedef void (*EnHorseZeldaActionFunc)(struct EnHorseZelda*, struct PlayState*); typedef struct EnHorseZelda { /* 0x0000 */ Actor actor; @@ -19,8 +20,8 @@ typedef struct EnHorseZelda { /* 0x01F4 */ f32 floorYForwards; /* 0x01F8 */ char unk_1F8[0x4]; /* 0x01FC */ ColliderCylinder colliderCylinder; - /* 0x0248 */ ColliderJntSph colliderSphere; - /* 0x0268 */ ColliderJntSphElement colliderSphereItem; + /* 0x0248 */ ColliderJntSph colliderJntSph; + /* 0x0268 */ ColliderJntSphElement colliderJntSphElements[1]; } EnHorseZelda; // size = 0x02A8 #endif diff --git a/src/overlays/actors/ovl_En_Hs/z_en_hs.c b/src/overlays/actors/ovl_En_Hs/z_en_hs.c index 66d12bafb2..935fdedd97 100644 --- a/src/overlays/actors/ovl_En_Hs/z_en_hs.c +++ b/src/overlays/actors/ovl_En_Hs/z_en_hs.c @@ -5,7 +5,18 @@ */ #include "z_en_hs.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "sfx.h" +#include "sys_matrix.h" #include "terminal.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_hs/object_hs.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY) diff --git a/src/overlays/actors/ovl_En_Hs/z_en_hs.h b/src/overlays/actors/ovl_En_Hs/z_en_hs.h index f4b89ce153..f938b51518 100644 --- a/src/overlays/actors/ovl_En_Hs/z_en_hs.h +++ b/src/overlays/actors/ovl_En_Hs/z_en_hs.h @@ -2,11 +2,11 @@ #define Z_EN_HS_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnHs; -typedef void (*EnHsActionFunc)(struct EnHs*, PlayState*); +typedef void (*EnHsActionFunc)(struct EnHs*, struct PlayState*); typedef struct EnHs { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c b/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c index b1b04107f0..71005a3afb 100644 --- a/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c +++ b/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c @@ -5,7 +5,16 @@ */ #include "z_en_hs2.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "sys_matrix.h" #include "terminal.h" +#include "z_lib.h" +#include "z64face_reaction.h" +#include "z64play.h" + #include "assets/objects/object_hs/object_hs.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY) diff --git a/src/overlays/actors/ovl_En_Hs2/z_en_hs2.h b/src/overlays/actors/ovl_En_Hs2/z_en_hs2.h index e2f66f79c3..dec1533f89 100644 --- a/src/overlays/actors/ovl_En_Hs2/z_en_hs2.h +++ b/src/overlays/actors/ovl_En_Hs2/z_en_hs2.h @@ -2,11 +2,11 @@ #define Z_EN_HS2_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnHs2; -typedef void (*EnHs2ActionFunc)(struct EnHs2*, PlayState*); +typedef void (*EnHs2ActionFunc)(struct EnHs2*, struct PlayState*); typedef struct EnHs2 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Hy/z_en_hy.c b/src/overlays/actors/ovl_En_Hy/z_en_hy.c index 2aa163d0fb..655ebd4789 100644 --- a/src/overlays/actors/ovl_En_Hy/z_en_hy.c +++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.c @@ -5,7 +5,22 @@ */ #include "z_en_hy.h" + +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" #include "versions.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64face_reaction.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_aob/object_aob.h" #include "assets/objects/object_ahg/object_ahg.h" #include "assets/objects/object_bob/object_bob.h" @@ -1147,12 +1162,12 @@ void EnHy_Destroy(Actor* thisx, PlayState* play) { void EnHy_WaitForObjects(EnHy* this, PlayState* play) { if (EnHy_IsOsAnimeObjectLoaded(this, play) && EnHy_AreSkelAndHeadObjectsLoaded(this, play)) { this->actor.objectSlot = this->objectSlotLowerSkel; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->actor.objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->actor.objectSlot].segment); SkelAnime_InitFlex(play, &this->skelAnime, sSkeletonInfo[sModelInfo[ENHY_GET_TYPE(&this->actor)].lowerSkelInfoIndex].skeleton, NULL, this->jointTable, this->morphTable, ENHY_LIMB_MAX); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotOsAnime].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotOsAnime].segment); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sColCylInit); EnHy_InitCollider(this); @@ -1335,7 +1350,7 @@ void EnHy_Update(Actor* thisx, PlayState* play) { EnHy* this = (EnHy*)thisx; if (this->actionFunc != EnHy_WaitForObjects) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotOsAnime].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotOsAnime].segment); SkelAnime_Update(&this->skelAnime); EnHy_UpdateEyes(this); @@ -1362,7 +1377,7 @@ s32 EnHy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po if (limbIndex == ENHY_LIMB_HEAD) { gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->objectSlotHead].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotHead].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotHead].segment); headInfoIndex = sModelInfo[ENHY_GET_TYPE(&this->actor)].headInfoIndex; *dList = sHeadInfo[headInfoIndex].headDList; @@ -1371,7 +1386,7 @@ s32 EnHy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(eyeTex)); } - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotLowerSkel].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotLowerSkel].segment); } if (limbIndex == ENHY_LIMB_HEAD) { @@ -1408,7 +1423,7 @@ void EnHy_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, if (limbIndex == ENHY_LIMB_RIGHT_FOOT) { gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->objectSlotUpperSkel].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotUpperSkel].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotUpperSkel].segment); } if (ENHY_GET_TYPE(&this->actor) == ENHY_TYPE_MAN_2_BALD && limbIndex == ENHY_LIMB_TORSO) { diff --git a/src/overlays/actors/ovl_En_Hy/z_en_hy.h b/src/overlays/actors/ovl_En_Hy/z_en_hy.h index a5c04ed3ab..50bdc90933 100644 --- a/src/overlays/actors/ovl_En_Hy/z_en_hy.h +++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.h @@ -2,7 +2,7 @@ #define Z_EN_HY_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" #define ENHY_GET_TYPE(thisx) PARAMS_GET_S((thisx)->params, 0, 7) #define ENHY_GET_PATH_INDEX(thisx) PARAMS_GET_S((thisx)->params, 7, 4) @@ -54,7 +54,7 @@ typedef enum EnHyLimb { struct EnHy; -typedef void (*EnHyActionFunc)(struct EnHy*, PlayState*); +typedef void (*EnHyActionFunc)(struct EnHy*, struct PlayState*); typedef struct EnHy { /* 0x0000 */ Actor actor; @@ -68,7 +68,7 @@ typedef struct EnHy { /* 0x0199 */ s8 objectSlotOsAnime; /* 0x019C */ ColliderCylinder collider; /* 0x01E8 */ NpcInteractInfo interactInfo; - /* 0x0210 */ Path* path; + /* 0x0210 */ struct Path* path; /* 0x0214 */ s8 waypoint; /* 0x0215 */ s8 playedSfx; /* 0x0216 */ char unk_216[2]; // unused diff --git a/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c b/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c index a0fc6e7bde..8db6b38d0f 100644 --- a/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c +++ b/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c @@ -5,6 +5,20 @@ */ #include "z_en_ice_hono.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64item.h" +#include "z64light.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.h b/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.h index e5ad5fd1cf..ea975199aa 100644 --- a/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.h +++ b/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.h @@ -2,11 +2,12 @@ #define Z_EN_ICE_HONO_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" +#include "z64light.h" struct EnIceHono; -typedef void (*EnIceHonoActionFunc)(struct EnIceHono*, PlayState*); +typedef void (*EnIceHonoActionFunc)(struct EnIceHono*, struct PlayState*); typedef struct EnIceHono { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index e95e5d4fac..a0533d4569 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -5,10 +5,31 @@ */ #include "z_en_ik.h" + +#include "libc64/qrand.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "rand.h" +#include "rumble.h" +#include "sfx.h" +#include "sequence.h" +#include "sys_matrix.h" +#include "terminal.h" +#include "translation.h" +#include "versions.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" +#include "z64skin_matrix.h" + #include "assets/scenes/dungeons/jyasinboss/jyasinboss_scene.h" #include "assets/objects/object_ik/object_ik.h" -#include "terminal.h" -#include "versions.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -1359,7 +1380,8 @@ void EnIk_HandleCsCues(EnIk* this, PlayState* play) { break; default: - PRINTF("En_Ik_inConfrontion_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); + PRINTF(T("En_Ik_inConfrontion_Check_DemoMode:そんな動作は無い!!!!!!!!\n", + "En_Ik_inConfrontion_Check_DemoMode: There is no such action!!!!!!!!\n")); } this->cueId = nextCueId; @@ -1394,7 +1416,8 @@ void EnIk_UpdateCutscene(Actor* thisx, PlayState* play) { EnIk* this = (EnIk*)thisx; if (this->csAction < 0 || this->csAction >= ARRAY_COUNT(sCsActionFuncs) || sCsActionFuncs[this->csAction] == NULL) { - PRINTF(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The main mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } @@ -1488,7 +1511,8 @@ void EnIk_DrawCutscene(Actor* thisx, PlayState* play) { if (this->csDrawMode < 0 || this->csDrawMode >= ARRAY_COUNT(sCsDrawFuncs) || sCsDrawFuncs[this->csDrawMode] == NULL) { - PRINTF(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The drawing mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.h b/src/overlays/actors/ovl_En_Ik/z_en_ik.h index 70c45063b5..a0ecd34d0f 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.h +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.h @@ -2,11 +2,11 @@ #define Z_EN_IK_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnIk; -typedef void (*EnIkActionFunc)(struct EnIk*, PlayState*); +typedef void (*EnIkActionFunc)(struct EnIk*, struct PlayState*); #define IK_GET_UPPER_PARAMS(thisx) PARAMS_GET_NOSHIFT(this->actor.params, 8, 8) #define IK_GET_ARMOR_TYPE(thisx) PARAMS_GET_U((thisx)->params, 0, 8) diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index 7ce346f633..521b8dcbfa 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -1,6 +1,25 @@ #include "z_en_in.h" -#include "versions.h" #include "overlays/actors/ovl_En_Horse/z_en_horse.h" + +#include "libc64/qrand.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "letterbox.h" +#include "printf.h" +#include "regs.h" +#include "segmented_address.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "versions.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64face_reaction.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_in/object_in.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_En_In/z_en_in.h b/src/overlays/actors/ovl_En_In/z_en_in.h index 84b5db8bac..00774d0ddb 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.h +++ b/src/overlays/actors/ovl_En_In/z_en_in.h @@ -2,11 +2,11 @@ #define Z_EN_IN_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnIn; -typedef void (*EnInActionFunc)(struct EnIn*, PlayState*); +typedef void (*EnInActionFunc)(struct EnIn*, struct PlayState*); typedef enum IngoLimb { /* 0x00 */ INGO_LIMB_NONE, diff --git a/src/overlays/actors/ovl_En_Insect/z_en_insect.c b/src/overlays/actors/ovl_En_Insect/z_en_insect.c index 4740bbc791..bc3640c4ac 100644 --- a/src/overlays/actors/ovl_En_Insect/z_en_insect.c +++ b/src/overlays/actors/ovl_En_Insect/z_en_insect.c @@ -5,8 +5,22 @@ */ #include "z_en_insect.h" -#include "global.h" +#include "overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "sfx.h" +#include "sys_math3d.h" #include "terminal.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define FLAGS 0 @@ -55,7 +69,7 @@ ActorProfile En_Insect_Profile = { /**/ EnInsect_Draw, }; -static ColliderJntSphElementInit sColliderItemInit[1] = { +static ColliderJntSphElementInit sColliderElementsInit[1] = { { { ELEM_MATERIAL_UNK0, @@ -79,7 +93,7 @@ static ColliderJntSphInit sColliderInit = { COLSHAPE_JNTSPH, }, 1, - sColliderItemInit, + sColliderElementsInit, }; /** @@ -192,7 +206,7 @@ void EnInsect_Init(Actor* thisx, PlayState* play2) { SkelAnime_Init(play, &this->skelAnime, &gBugSkel, &gBugCrawlAnim, this->jointTable, this->morphTable, 24); Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sColliderInit, &this->colliderItem); + Collider_SetJntSph(play, &this->collider, &this->actor, &sColliderInit, this->colliderElements); this->actor.colChkInfo.mass = 30; diff --git a/src/overlays/actors/ovl_En_Insect/z_en_insect.h b/src/overlays/actors/ovl_En_Insect/z_en_insect.h index 31d2c1d050..7bf443a2ea 100644 --- a/src/overlays/actors/ovl_En_Insect/z_en_insect.h +++ b/src/overlays/actors/ovl_En_Insect/z_en_insect.h @@ -3,7 +3,6 @@ #include "ultra64.h" #include "z64actor.h" -#include "overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.h" struct EnInsect; @@ -22,7 +21,7 @@ typedef void (*EnInsectActionFunc)(struct EnInsect*, struct PlayState*); typedef struct EnInsect { /* 0x0000 */ Actor actor; /* 0x014C */ ColliderJntSph collider; - /* 0x016C */ ColliderJntSphElement colliderItem; + /* 0x016C */ ColliderJntSphElement colliderElements[1]; /* 0x01AC */ SkelAnime skelAnime; /* 0x01F0 */ Vec3s jointTable[24]; /* 0x0280 */ Vec3s morphTable[24]; @@ -33,7 +32,7 @@ typedef struct EnInsect { /* 0x031A */ s16 actionTimer; /* 0x031C */ s16 lifeTimer; /* 0x031E */ s16 crawlSoundDelay; - /* 0x0320 */ ObjMakekinsuta* soilActor; + /* 0x0320 */ struct ObjMakekinsuta* soilActor; /* 0x0324 */ f32 unk_324; /* 0x0328 */ s16 unk_328; /* 0x032A */ u8 unk_32A; diff --git a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c index 7e84670426..bcf59dfbe7 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c @@ -7,9 +7,26 @@ #include "z_en_ishi.h" #include "overlays/actors/ovl_En_Insect/z_en_insect.h" #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" -#include "assets/objects/gameplay_field_keep/gameplay_field_keep.h" + +#include "libc64/qrand.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "rand.h" +#include "rumble.h" +#include "sfx.h" +#include "sys_matrix.h" #include "quake.h" #include "terminal.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64item.h" +#include "z64play.h" + +#include "assets/objects/gameplay_field_keep/gameplay_field_keep.h" #define FLAGS ACTOR_FLAG_THROW_ONLY diff --git a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.h b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.h index f4469ea7bc..731929a384 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.h +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.h @@ -2,7 +2,7 @@ #define Z_EN_ISHI_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" // The switch flag value for this actor is constructed in a unique way. // There are two separate param values which get OR'd together to create one final switch flag index. @@ -25,9 +25,9 @@ typedef enum EnIshiType { struct EnIshi; -typedef void (*EnIshiActionFunc)(struct EnIshi*, PlayState*); -typedef void (*EnIshiEffectSpawnFunc)(struct EnIshi*, PlayState*); -typedef void (*EnIshiDrawFunc)(struct EnIshi*, PlayState*); +typedef void (*EnIshiActionFunc)(struct EnIshi*, struct PlayState*); +typedef void (*EnIshiEffectSpawnFunc)(struct EnIshi*, struct PlayState*); +typedef void (*EnIshiDrawFunc)(struct EnIshi*, struct PlayState*); typedef struct EnIshi { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_It/z_en_it.c b/src/overlays/actors/ovl_En_It/z_en_it.c index 312ceec96e..975fe8411f 100644 --- a/src/overlays/actors/ovl_En_It/z_en_it.c +++ b/src/overlays/actors/ovl_En_It/z_en_it.c @@ -6,6 +6,8 @@ #include "z_en_it.h" +#include "z64play.h" + #define FLAGS 0 void EnIt_Init(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_It/z_en_it.h b/src/overlays/actors/ovl_En_It/z_en_it.h index fb150fcb0d..9f1f794e4f 100644 --- a/src/overlays/actors/ovl_En_It/z_en_it.h +++ b/src/overlays/actors/ovl_En_It/z_en_it.h @@ -2,7 +2,7 @@ #define Z_EN_IT_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnIt; diff --git a/src/overlays/actors/ovl_En_Jj/z_en_jj.c b/src/overlays/actors/ovl_En_Jj/z_en_jj.c index a03c20c9ea..3f6b3c587c 100644 --- a/src/overlays/actors/ovl_En_Jj/z_en_jj.c +++ b/src/overlays/actors/ovl_En_Jj/z_en_jj.c @@ -5,9 +5,21 @@ */ #include "z_en_jj.h" -#include "assets/objects/object_jj/object_jj.h" #include "overlays/actors/ovl_Eff_Dust/z_eff_dust.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/object_jj/object_jj.h" + #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) typedef enum EnJjEyeState { diff --git a/src/overlays/actors/ovl_En_Jj/z_en_jj.h b/src/overlays/actors/ovl_En_Jj/z_en_jj.h index c5d6241204..9ac2df8bb4 100644 --- a/src/overlays/actors/ovl_En_Jj/z_en_jj.h +++ b/src/overlays/actors/ovl_En_Jj/z_en_jj.h @@ -2,11 +2,11 @@ #define Z_EN_JJ_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnJj; -typedef void (*EnJjActionFunc)(struct EnJj*, PlayState*); +typedef void (*EnJjActionFunc)(struct EnJj*, struct PlayState*); typedef struct EnJj { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_En_Js/z_en_js.c b/src/overlays/actors/ovl_En_Js/z_en_js.c index 6cd5163aec..f5aee34c6a 100644 --- a/src/overlays/actors/ovl_En_Js/z_en_js.c +++ b/src/overlays/actors/ovl_En_Js/z_en_js.c @@ -5,6 +5,15 @@ */ #include "z_en_js.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "regs.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_js/object_js.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY) diff --git a/src/overlays/actors/ovl_En_Js/z_en_js.h b/src/overlays/actors/ovl_En_Js/z_en_js.h index f1e356b2c1..e1e22f547d 100644 --- a/src/overlays/actors/ovl_En_Js/z_en_js.h +++ b/src/overlays/actors/ovl_En_Js/z_en_js.h @@ -2,11 +2,11 @@ #define Z_EN_JS_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnJs; -typedef void (*EnJsActionFunc)(struct EnJs*, PlayState*); +typedef void (*EnJsActionFunc)(struct EnJs*, struct PlayState*); typedef struct EnJs { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c b/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c index 6650e31715..fce6c4ef03 100644 --- a/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c +++ b/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c @@ -7,6 +7,17 @@ #include "z_en_jsjutan.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "sys_math.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY) void EnJsjutan_Init(Actor* thisx, PlayState* play); @@ -27,6 +38,8 @@ ActorProfile En_Jsjutan_Profile = { }; // Shadow texture. 32x64 I8. +#define sShadowTex_WIDTH 32 +#define sShadowTex_HEIGHT 64 static u8 sShadowTex[0x800]; static Vec3s D_80A8EE10[0x90]; diff --git a/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.h b/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.h index 63a694bad6..b6c4b07591 100644 --- a/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.h +++ b/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.h @@ -2,7 +2,7 @@ #define Z_EN_JSJUTAN_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnJsjutan; diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index d5ada18305..d2d807cd28 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -5,7 +5,22 @@ */ #include "z_en_kakasi.h" + +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "rand.h" +#include "regs.h" +#include "sfx.h" #include "terminal.h" +#include "z_lib.h" +#include "z64ocarina.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_ka/object_ka.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_DURING_OCARINA) diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h index ceef6afe9c..c2eff368ca 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h @@ -2,11 +2,11 @@ #define Z_EN_KAKASI_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnKakasi; -typedef void (*EnKakasiFunc)(struct EnKakasi*, PlayState*); +typedef void (*EnKakasiFunc)(struct EnKakasi*, struct PlayState*); typedef struct EnKakasi { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c index 45a9390f63..7651842925 100644 --- a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c +++ b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c @@ -5,7 +5,20 @@ */ #include "z_en_kakasi2.h" + +#include "gfx_setupdl.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "regs.h" +#include "sfx.h" #include "terminal.h" +#include "z_lib.h" +#include "z64debug_display.h" +#include "z64ocarina.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_ka/object_ka.h" #define FLAGS \ diff --git a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.h b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.h index 9309c16725..c3398d7e7f 100644 --- a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.h +++ b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.h @@ -2,11 +2,11 @@ #define Z_EN_KAKASI2_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnKakasi2; -typedef void (*EnKakasi2ActionFunc)(struct EnKakasi2*, PlayState*); +typedef void (*EnKakasi2ActionFunc)(struct EnKakasi2*, struct PlayState*); typedef struct EnKakasi2 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c index c670a19efb..8f4d21e36d 100644 --- a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c +++ b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c @@ -5,7 +5,22 @@ */ #include "z_en_kakasi3.h" + +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "rand.h" +#include "regs.h" +#include "sfx.h" #include "terminal.h" +#include "z_lib.h" +#include "z64ocarina.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_ka/object_ka.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_DURING_OCARINA) diff --git a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.h b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.h index f402ab5ded..e09b98a9fb 100644 --- a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.h +++ b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.h @@ -2,11 +2,11 @@ #define Z_EN_KAKASI3_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnKakasi3; -typedef void (*EnKakasi3ActionFunc)(struct EnKakasi3*, PlayState*); +typedef void (*EnKakasi3ActionFunc)(struct EnKakasi3*, struct PlayState*); typedef struct EnKakasi3 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c index 03242220e0..844a7ee2a8 100644 --- a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c +++ b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c @@ -5,10 +5,28 @@ */ #include "z_en_kanban.h" -#include "global.h" + +#include "libc64/math64.h" +#include "libc64/qrand.h" +#include "array_count.h" +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "rand.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "terminal.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64ocarina.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_kanban/object_kanban.h" -#include "terminal.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_En_Kanban/z_en_kanban_gfx.inc.c b/src/overlays/actors/ovl_En_Kanban/z_en_kanban_gfx.inc.c index c38e9df942..3dca1d6259 100644 --- a/src/overlays/actors/ovl_En_Kanban/z_en_kanban_gfx.inc.c +++ b/src/overlays/actors/ovl_En_Kanban/z_en_kanban_gfx.inc.c @@ -1,4 +1,4 @@ -#include "z_en_kanban.h" +#include "ultra64.h" static u16 sShadowTexFlags[] = { 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x100, diff --git a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c index cdba59e661..be3b0eacb5 100644 --- a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c +++ b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c @@ -5,9 +5,21 @@ */ #include "z_en_karebaba.h" +#include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_dekubaba/object_dekubaba.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" -#include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE) diff --git a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h index 0687ade588..97b04f1a7f 100644 --- a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h +++ b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h @@ -2,11 +2,11 @@ #define Z_EN_KAREBABA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnKarebaba; -typedef void (*EnKarebabaActionFunc)(struct EnKarebaba*, PlayState*); +typedef void (*EnKarebabaActionFunc)(struct EnKarebaba*, struct PlayState*); typedef struct EnKarebaba { /* 0x0000 */ Actor actor; @@ -14,7 +14,7 @@ typedef struct EnKarebaba { /* 0x0190 */ EnKarebabaActionFunc actionFunc; /* 0x0194 */ Vec3s jointTable[8]; /* 0x01C4 */ Vec3s morphTable[8]; - /* 0x01F4 */ CollisionPoly* boundFloor; + /* 0x01F4 */ struct CollisionPoly* boundFloor; /* 0x01F8 */ ColliderCylinder headCollider; /* 0x0244 */ ColliderCylinder bodyCollider; } EnKarebaba; // size = 0x0290 diff --git a/src/overlays/actors/ovl_En_Ko/z_en_ko.c b/src/overlays/actors/ovl_En_Ko/z_en_ko.c index 32f3829721..2ba0af36ef 100644 --- a/src/overlays/actors/ovl_En_Ko/z_en_ko.c +++ b/src/overlays/actors/ovl_En_Ko/z_en_ko.c @@ -5,12 +5,25 @@ */ #include "z_en_ko.h" + +#include "attributes.h" +#include "gfx.h" +#include "printf.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "terminal.h" +#include "versions.h" +#include "z_lib.h" +#include "z64face_reaction.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_fa/object_fa.h" #include "assets/objects/object_os_anime/object_os_anime.h" #include "assets/objects/object_km1/object_km1.h" #include "assets/objects/object_kw1/object_kw1.h" -#include "terminal.h" -#include "versions.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED) @@ -1173,11 +1186,11 @@ void func_80A99048(EnKo* this, PlayState* play) { if (EnKo_IsOsAnimeLoaded(this, play) && EnKo_AreObjectsLoaded(this, play)) { this->actor.flags &= ~ACTOR_FLAG_UPDATE_CULLING_DISABLED; this->actor.objectSlot = this->legsObjectSlot; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->actor.objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->actor.objectSlot].segment); SkelAnime_InitFlex(play, &this->skelAnime, sSkeleton[sModelInfo[ENKO_TYPE].legsId].flexSkeletonHeader, NULL, this->jointTable, this->morphTable, 16); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); @@ -1292,7 +1305,7 @@ void EnKo_Update(Actor* thisx, PlayState* play) { if (this->actionFunc != func_80A99048) { if ((s32)this->modelAlpha != 0) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); SkelAnime_Update(&this->skelAnime); func_80A98DB4(this, play); EnKo_Blink(this); @@ -1325,7 +1338,7 @@ s32 EnKo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po if (limbIndex == 15) { gSPSegment((*gfx)++, 0x06, play->objectCtx.slots[this->headObjectSlot].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->headObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->headObjectSlot].segment); headId = sModelInfo[ENKO_TYPE].headId; *dList = sHead[headId].dList; @@ -1333,7 +1346,7 @@ s32 EnKo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po eyeTexture = sHead[headId].eyeTextures[this->eyeTextureIndex]; gSPSegment((*gfx)++, 0x0A, SEGMENTED_TO_VIRTUAL(eyeTexture)); } - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->legsObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->legsObjectSlot].segment); } if (limbIndex == 8) { limbRot = this->interactInfo.torsoRot; @@ -1361,7 +1374,7 @@ void EnKo_PostLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3s* rot, if (limbIndex == 7) { gSPSegment((*gfx)++, 0x06, play->objectCtx.slots[this->bodyObjectSlot].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->bodyObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->bodyObjectSlot].segment); } if (limbIndex == 15) { Matrix_MultVec3f(&D_80A9A774, &this->actor.focus.pos); diff --git a/src/overlays/actors/ovl_En_Ko/z_en_ko.h b/src/overlays/actors/ovl_En_Ko/z_en_ko.h index 085e9aca54..d9531e57e6 100644 --- a/src/overlays/actors/ovl_En_Ko/z_en_ko.h +++ b/src/overlays/actors/ovl_En_Ko/z_en_ko.h @@ -2,11 +2,11 @@ #define Z_EN_KO_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnKo; -typedef void (*EnKoActionFunc)(struct EnKo*, PlayState*); +typedef void (*EnKoActionFunc)(struct EnKo*, struct PlayState*); typedef struct EnKo { /* 0x0000 */ Actor actor; @@ -17,7 +17,7 @@ typedef struct EnKo { /* 0x0196 */ s8 legsObjectSlot; /* 0x0197 */ s8 osAnimeObjectSlot; /* 0x0198 */ ColliderCylinder collider; - /* 0x01E4 */ Path* path; + /* 0x01E4 */ struct Path* path; /* 0x01E8 */ NpcInteractInfo interactInfo; /* 0x0210 */ u8 unk_210; // block trade quest sfx /* 0x0212 */ s16 forestQuestState; diff --git a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c index e46125878e..aa955365dd 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -7,10 +7,22 @@ #include "z_en_kusa.h" #include "overlays/actors/ovl_En_Insect/z_en_insect.h" #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" + +#include "libc64/qrand.h" +#include "array_count.h" +#include "ichain.h" +#include "printf.h" +#include "rand.h" +#include "sfx.h" +#include "terminal.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/gameplay_field_keep/gameplay_field_keep.h" #include "assets/objects/object_kusa/object_kusa.h" -#include "terminal.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_THROW_ONLY) diff --git a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h index 4a895fe15a..a375581cf9 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h @@ -2,11 +2,11 @@ #define Z_EN_KUSA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnKusa; -typedef void (*EnKusaActionFunc)(struct EnKusa*, PlayState*); +typedef void (*EnKusaActionFunc)(struct EnKusa*, struct PlayState*); typedef enum EnKusaType { /* 0 */ ENKUSA_TYPE_0, diff --git a/src/overlays/actors/ovl_En_Kz/z_en_kz.c b/src/overlays/actors/ovl_En_Kz/z_en_kz.c index a4aaf4e1ca..7caa735739 100644 --- a/src/overlays/actors/ovl_En_Kz/z_en_kz.c +++ b/src/overlays/actors/ovl_En_Kz/z_en_kz.c @@ -5,7 +5,21 @@ */ #include "z_en_kz.h" + +#include "libc64/math64.h" +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" #include "versions.h" +#include "z_lib.h" +#include "z64face_reaction.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_kz/object_kz.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY) diff --git a/src/overlays/actors/ovl_En_Kz/z_en_kz.h b/src/overlays/actors/ovl_En_Kz/z_en_kz.h index b5cd380791..933fbe2617 100644 --- a/src/overlays/actors/ovl_En_Kz/z_en_kz.h +++ b/src/overlays/actors/ovl_En_Kz/z_en_kz.h @@ -2,11 +2,11 @@ #define Z_EN_KZ_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnKz; -typedef void (*EnKzActionFunc)(struct EnKz*, PlayState*); +typedef void (*EnKzActionFunc)(struct EnKz*, struct PlayState*); typedef struct EnKz { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Light/z_en_light.c b/src/overlays/actors/ovl_En_Light/z_en_light.c index 33d671a95f..f0cc5dddc6 100644 --- a/src/overlays/actors/ovl_En_Light/z_en_light.c +++ b/src/overlays/actors/ovl_En_Light/z_en_light.c @@ -5,6 +5,17 @@ */ #include "z_en_light.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64light.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" diff --git a/src/overlays/actors/ovl_En_Light/z_en_light.h b/src/overlays/actors/ovl_En_Light/z_en_light.h index 1cbf786b00..035471f47d 100644 --- a/src/overlays/actors/ovl_En_Light/z_en_light.h +++ b/src/overlays/actors/ovl_En_Light/z_en_light.h @@ -2,7 +2,8 @@ #define Z_EN_LIGHT_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" +#include "z64light.h" struct EnLight; diff --git a/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c b/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c index c2b6ca1d6c..b4bd3af91b 100644 --- a/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c +++ b/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c @@ -5,6 +5,12 @@ */ #include "z_en_lightbox.h" + +#include "regs.h" +#include "sfx.h" +#include "z_lib.h" +#include "z64play.h" + #include "assets/objects/object_lightbox/object_lightbox.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.h b/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.h index e24afd44e1..c09c77f850 100644 --- a/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.h +++ b/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.h @@ -2,7 +2,7 @@ #define Z_EN_LIGHTBOX_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnLightbox; diff --git a/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c b/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c index 9acedc1552..2097bb9d26 100644 --- a/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c +++ b/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c @@ -6,6 +6,9 @@ #include "z_en_m_fire1.h" +#include "z_lib.h" +#include "z64play.h" + #define FLAGS 0 void EnMFire1_Init(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.h b/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.h index 10d3e3fef7..59ebb44318 100644 --- a/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.h +++ b/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.h @@ -2,7 +2,7 @@ #define Z_EN_M_FIRE1_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnMFire1; diff --git a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c index eb7745aa86..ba34f9adcc 100644 --- a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c +++ b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c @@ -1,4 +1,17 @@ #include "z_en_m_thunder.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "rumble.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64light.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.h b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.h index 4cb7ad215c..8c7cdd7a1f 100644 --- a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.h +++ b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.h @@ -2,11 +2,12 @@ #define Z_EN_M_THUNDER_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" +#include "z64light.h" struct EnMThunder; -typedef void (*EnMThunderActionFunc)(struct EnMThunder*, PlayState*); +typedef void (*EnMThunderActionFunc)(struct EnMThunder*, struct PlayState*); typedef struct EnMThunder { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c index d0c16c3a72..9c1689a524 100644 --- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c +++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c @@ -5,6 +5,20 @@ */ #include "z_en_ma1.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "sequence.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64face_reaction.h" +#include "z64ocarina.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_ma1/object_ma1.h" #define FLAGS \ diff --git a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.h b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.h index ef69c0c8e4..3664fc98a8 100644 --- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.h +++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.h @@ -2,11 +2,11 @@ #define Z_EN_MA1_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnMa1; -typedef void (*EnMa1ActionFunc)(struct EnMa1*, PlayState*); +typedef void (*EnMa1ActionFunc)(struct EnMa1*, struct PlayState*); typedef struct EnMa1 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c index a4a4a17049..aed88bb92c 100644 --- a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c +++ b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c @@ -1,4 +1,19 @@ #include "z_en_ma2.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64face_reaction.h" +#include "z64ocarina.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_ma2/object_ma2.h" #define FLAGS \ diff --git a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.h b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.h index 390c61da21..81fddf7672 100644 --- a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.h +++ b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.h @@ -2,11 +2,11 @@ #define Z_EN_MA2_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnMa2; -typedef void (*EnMa2ActionFunc)(struct EnMa2*, PlayState*); +typedef void (*EnMa2ActionFunc)(struct EnMa2*, struct PlayState*); typedef enum AdultMalonLimb { /* 0x00 */ MALON_ADULT_LIMB_NONE, diff --git a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c index 69dc0d907a..cdac009221 100644 --- a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c +++ b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c @@ -5,8 +5,21 @@ */ #include "z_en_ma3.h" -#include "assets/objects/object_ma2/object_ma2.h" + +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "sequence.h" +#include "sys_matrix.h" +#include "z_lib.h" #include "versions.h" +#include "z64audio.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/object_ma2/object_ma2.h" #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ diff --git a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.h b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.h index 2b9dea812d..ecf637561e 100644 --- a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.h +++ b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.h @@ -2,11 +2,11 @@ #define Z_EN_MA3_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnMa3; -typedef void (*EnMa3ActionFunc)(struct EnMa3*, PlayState*); +typedef void (*EnMa3ActionFunc)(struct EnMa3*, struct PlayState*); typedef enum AdultMalonLimb { /* 0x00 */ MALON_ADULT_LIMB_NONE, diff --git a/src/overlays/actors/ovl_En_Mag/z_en_mag.c b/src/overlays/actors/ovl_En_Mag/z_en_mag.c index a56c9e5fd1..ef02aacdd3 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -5,12 +5,29 @@ */ #include "z_en_mag.h" -#include "versions.h" -#include "assets/objects/object_mag/object_mag.h" + +#include "array_count.h" +#include "avoid_ub.h" +#include "controller.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "gfxalloc.h" #if PLATFORM_N64 #include "n64dd.h" #endif +#include "printf.h" +#include "regs.h" +#include "sfx.h" +#include "translation.h" #include "versions.h" +#include "z64audio.h" +#include "z64cutscene_flags.h" +#include "z64ocarina.h" +#include "z64play.h" +#include "z64save.h" +#include "z64ss_sram.h" + +#include "assets/objects/object_mag/object_mag.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) @@ -58,8 +75,8 @@ void EnMag_ResetSram(void) { SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8007000), buffer, 0x800, 1); SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8007800), buffer, 0x800, 1); - gSaveContext.audioSetting = gSaveContext.zTargetSetting = 0; - func_800F6700(gSaveContext.audioSetting); + gSaveContext.soundSetting = gSaveContext.zTargetSetting = 0; // SOUND_SETTING_STEREO/Z_TARGET_SETTING_SWITCH + Audio_SetSoundOutputMode(gSaveContext.soundSetting); } #endif diff --git a/src/overlays/actors/ovl_En_Mag/z_en_mag.h b/src/overlays/actors/ovl_En_Mag/z_en_mag.h index e7c516c629..ace8427278 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.h +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.h @@ -2,7 +2,8 @@ #define Z_EN_MAG_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" +#include "z64message.h" struct EnMag; diff --git a/src/overlays/actors/ovl_En_Mb/z_en_mb.c b/src/overlays/actors/ovl_En_Mb/z_en_mb.c index 1e97b32486..485052002e 100644 --- a/src/overlays/actors/ovl_En_Mb/z_en_mb.c +++ b/src/overlays/actors/ovl_En_Mb/z_en_mb.c @@ -5,8 +5,24 @@ */ #include "z_en_mb.h" -#include "assets/objects/object_mb/object_mb.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "rand.h" +#include "rumble.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" #include "versions.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + +#include "assets/objects/object_mb/object_mb.h" /* * This actor can have three behaviors: diff --git a/src/overlays/actors/ovl_En_Mb/z_en_mb.h b/src/overlays/actors/ovl_En_Mb/z_en_mb.h index 66afb9eeb1..8c3ddc6029 100644 --- a/src/overlays/actors/ovl_En_Mb/z_en_mb.h +++ b/src/overlays/actors/ovl_En_Mb/z_en_mb.h @@ -2,11 +2,11 @@ #define Z_EN_MB_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnMb; -typedef void (*EnMbActionFunc)(struct EnMb*, PlayState*); +typedef void (*EnMbActionFunc)(struct EnMb*, struct PlayState*); typedef enum EnMbState { /* 0 */ ENMB_STATE_SPEAR_SPEARPATH_DAMAGED, diff --git a/src/overlays/actors/ovl_En_Md/z_en_md.c b/src/overlays/actors/ovl_En_Md/z_en_md.c index 93ba4f894c..296f4d42af 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -5,9 +5,23 @@ */ #include "z_en_md.h" -#include "assets/objects/object_md/object_md.h" #include "overlays/actors/ovl_En_Elf/z_en_elf.h" +#include "libc64/math64.h" +#include "attributes.h" +#include "gfx.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64face_reaction.h" +#include "z64ocarina.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/object_md/object_md.h" + #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ ACTOR_FLAG_UPDATE_DURING_OCARINA) diff --git a/src/overlays/actors/ovl_En_Md/z_en_md.h b/src/overlays/actors/ovl_En_Md/z_en_md.h index 6a78a24904..bfd9b0450a 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.h +++ b/src/overlays/actors/ovl_En_Md/z_en_md.h @@ -2,7 +2,7 @@ #define Z_EN_MD_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnMd; @@ -27,7 +27,7 @@ typedef enum EnMdLimb { ENMD_LIMB_MAX } EnMdLimb; -typedef void (*EnMdActionFunc)(struct EnMd*, PlayState*); +typedef void (*EnMdActionFunc)(struct EnMd*, struct PlayState*); #define ENMD_GET_PATH_INDEX(this) PARAMS_GET_S(this->actor.params, 8, 8) #define ENMD_GET_PATH_INDEX_NOSHIFT(this) PARAMS_GET_NOSHIFT(this->actor.params, 8, 8) diff --git a/src/overlays/actors/ovl_En_Mk/z_en_mk.c b/src/overlays/actors/ovl_En_Mk/z_en_mk.c index df7708a699..f035f2d331 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.c +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.c @@ -5,6 +5,17 @@ */ #include "z_en_mk.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64face_reaction.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_mk/object_mk.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_En_Mk/z_en_mk.h b/src/overlays/actors/ovl_En_Mk/z_en_mk.h index 5b8a438a00..53df56b76a 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.h +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.h @@ -2,11 +2,11 @@ #define Z_EN_MK_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnMk; -typedef void (*EnMkActionFunc)(struct EnMk*, PlayState*); +typedef void (*EnMkActionFunc)(struct EnMk*, struct PlayState*); typedef struct EnMk { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Mm/z_en_mm.c b/src/overlays/actors/ovl_En_Mm/z_en_mm.c index b081f8304c..75969dd224 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.c +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.c @@ -5,6 +5,20 @@ */ #include "z_en_mm.h" + +#include "libc64/math64.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64face_reaction.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_mm/object_mm.h" #include "assets/objects/object_link_child/object_link_child.h" diff --git a/src/overlays/actors/ovl_En_Mm/z_en_mm.h b/src/overlays/actors/ovl_En_Mm/z_en_mm.h index 7646e1f044..555073753f 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.h +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.h @@ -2,11 +2,11 @@ #define Z_EN_MM_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnMm; -typedef void (*EnMmActionFunc)(struct EnMm*, PlayState*); +typedef void (*EnMmActionFunc)(struct EnMm*, struct PlayState*); typedef struct EnMm { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c index 3082b5c35d..d2f444a193 100644 --- a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c +++ b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c @@ -5,7 +5,19 @@ */ #include "z_en_mm2.h" + +#include "libu64/debug.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "segmented_address.h" +#include "sys_matrix.h" #include "terminal.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_mm/object_mm.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.h b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.h index a5edeb9cb5..8e48261d7c 100644 --- a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.h +++ b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.h @@ -2,11 +2,11 @@ #define Z_EN_MM2_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnMm2; -typedef void (*EnMm2ActionFunc)(struct EnMm2*, PlayState*); +typedef void (*EnMm2ActionFunc)(struct EnMm2*, struct PlayState*); typedef struct EnMm2 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Ms/z_en_ms.c b/src/overlays/actors/ovl_En_Ms/z_en_ms.c index 35796e1eb7..18ebac054a 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.c +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.c @@ -5,6 +5,15 @@ */ #include "z_en_ms.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "z64face_reaction.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_ms/object_ms.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY) diff --git a/src/overlays/actors/ovl_En_Ms/z_en_ms.h b/src/overlays/actors/ovl_En_Ms/z_en_ms.h index 53c6bbeaca..9ace7bc2d0 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.h +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.h @@ -2,11 +2,11 @@ #define Z_EN_MS_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnMs; -typedef void (*EnMsActionFunc)(struct EnMs*, PlayState*); +typedef void (*EnMsActionFunc)(struct EnMs*, struct PlayState*); typedef struct EnMs { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Mu/z_en_mu.c b/src/overlays/actors/ovl_En_Mu/z_en_mu.c index 4f4221820f..7360dd7f18 100644 --- a/src/overlays/actors/ovl_En_Mu/z_en_mu.c +++ b/src/overlays/actors/ovl_En_Mu/z_en_mu.c @@ -5,6 +5,15 @@ */ #include "z_en_mu.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64face_reaction.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_mu/object_mu.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY) diff --git a/src/overlays/actors/ovl_En_Mu/z_en_mu.h b/src/overlays/actors/ovl_En_Mu/z_en_mu.h index 1b098eb417..417ce242b1 100644 --- a/src/overlays/actors/ovl_En_Mu/z_en_mu.h +++ b/src/overlays/actors/ovl_En_Mu/z_en_mu.h @@ -2,7 +2,7 @@ #define Z_EN_MU_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnMu; diff --git a/src/overlays/actors/ovl_En_Nb/z_en_nb.c b/src/overlays/actors/ovl_En_Nb/z_en_nb.c index 983af06780..2a00eb9ef6 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -5,10 +5,29 @@ */ #include "z_en_nb.h" -#include "terminal.h" -#include "assets/objects/object_nb/object_nb.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" +#include "libc64/math64.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "regs.h" +#include "segmented_address.h" +#include "seqcmd.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "terminal.h" +#include "translation.h" +#include "z_lib.h" +#include "z64face_reaction.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/object_nb/object_nb.h" + #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED typedef enum EnNbAction { @@ -676,8 +695,8 @@ void EnNb_CheckKidnapCsMode(EnNb* this, PlayState* play) { Actor_Kill(&this->actor); break; default: - // "Operation Doesn't Exist!!!!!!!!" - PRINTF("En_Nb_Kidnap_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); + PRINTF(T("En_Nb_Kidnap_Check_DemoMode:そんな動作は無い!!!!!!!!\n", + "En_Nb_Kidnap_Check_DemoMode: There is no such action!!!!!!!!\n")); break; } this->cueId = nextCueId; @@ -895,8 +914,8 @@ void EnNb_CheckConfrontationCsMode(EnNb* this, PlayState* play) { EnNb_SetupConfrontationDestroy(this); break; default: - // "En_Nb_Confrontion_Check_DemoMode: Operation doesn't exist!!!!!!!!" - PRINTF("En_Nb_Confrontion_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); + PRINTF(T("En_Nb_Confrontion_Check_DemoMode:そんな動作は無い!!!!!!!!\n", + "En_Nb_Confrontion_Check_DemoMode: There is no such action!!!!!!!!\n")); break; } this->cueId = nextCueId; @@ -1083,8 +1102,8 @@ void EnNb_CheckCreditsCsModeImpl(EnNb* this, PlayState* play) { EnNb_SetupCreditsHeadTurn(this); break; default: - // "En_Nb_inEnding_Check_DemoMode: Operation doesn't exist!!!!!!!!" - PRINTF("En_Nb_inEnding_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); + PRINTF(T("En_Nb_inEnding_Check_DemoMode:そんな動作は無い!!!!!!!!\n", + "En_Nb_inEnding_Check_DemoMode: There is no such action!!!!!!!!\n")); break; } this->cueId = nextCueId; @@ -1442,8 +1461,8 @@ void EnNb_Update(Actor* thisx, PlayState* play) { EnNb* this = (EnNb*)thisx; if (this->action < 0 || this->action > 30 || sActionFuncs[this->action] == NULL) { - // "Main mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!" - PRINTF(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The main mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } @@ -1550,8 +1569,8 @@ void EnNb_Draw(Actor* thisx, PlayState* play) { EnNb* this = (EnNb*)thisx; if (this->drawMode < 0 || this->drawMode >= 5 || sDrawFuncs[this->drawMode] == NULL) { - // "Draw mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!" - PRINTF(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The drawing mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } diff --git a/src/overlays/actors/ovl_En_Nb/z_en_nb.h b/src/overlays/actors/ovl_En_Nb/z_en_nb.h index 997af0f573..3ed08cbf8e 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.h +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.h @@ -2,7 +2,7 @@ #define Z_EN_NB_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnNb; @@ -29,8 +29,8 @@ typedef enum EnNbLimb { /* 0x13 */ NB_LIMB_MAX } EnNbLimb; -typedef void (*EnNbActionFunc)(struct EnNb*, PlayState*); -typedef void (*EnNbDrawFunc)(struct EnNb*, PlayState*); +typedef void (*EnNbActionFunc)(struct EnNb*, struct PlayState*); +typedef void (*EnNbDrawFunc)(struct EnNb*, struct PlayState*); typedef struct EnNb { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/src/overlays/actors/ovl_En_Niw/z_en_niw.c index 144c76b2cb..6be5e39db0 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -5,10 +5,30 @@ */ #include "z_en_niw.h" -#include "assets/objects/object_niw/object_niw.h" #include "overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.h" + +#include "libc64/math64.h" +#include "libc64/qrand.h" +#include "array_count.h" +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "rand.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" #include "terminal.h" #include "versions.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/object_niw/object_niw.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_THROW_ONLY) diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.h b/src/overlays/actors/ovl_En_Niw/z_en_niw.h index 283b6a52cd..a0f58d0a35 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.h +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.h @@ -2,11 +2,11 @@ #define Z_EN_NIW_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnNiw; -typedef void (*EnNiwActionFunc)(struct EnNiw*, PlayState*); +typedef void (*EnNiwActionFunc)(struct EnNiw*, struct PlayState*); typedef struct EnNiwEffect { /* 0x0000 */ u8 type; diff --git a/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c b/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c index 6af946ddeb..6a2468f93f 100644 --- a/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c +++ b/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c @@ -5,8 +5,22 @@ */ #include "z_en_niw_girl.h" -#include "assets/objects/object_gr/object_gr.h" +#include "overlays/actors/ovl_En_Niw/z_en_niw.h" + +#include "libc64/math64.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "rand.h" +#include "segmented_address.h" +#include "sys_matrix.h" #include "terminal.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/object_gr/object_gr.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.h b/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.h index e63e2df72f..422cf33e48 100644 --- a/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.h +++ b/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.h @@ -2,12 +2,11 @@ #define Z_EN_NIW_GIRL_H #include "ultra64.h" -#include "global.h" -#include "../ovl_En_Niw/z_en_niw.h" +#include "z64actor.h" struct EnNiwGirl; -typedef void (*EnNiwGirlActionFunc)(struct EnNiwGirl*, PlayState*); +typedef void (*EnNiwGirlActionFunc)(struct EnNiwGirl*, struct PlayState*); typedef struct EnNiwGirl { /* 0x0000 */ Actor actor; @@ -27,7 +26,7 @@ typedef struct EnNiwGirl { /* 0x027A */ s16 unk_27A; /* 0x027C */ f32 unk_27C; /* 0x0280 */ f32 unk_280; - /* 0x0284 */ EnNiw* chasedEnNiw; + /* 0x0284 */ struct EnNiw* chasedEnNiw; /* 0x0288 */ ColliderCylinder collider; /* 0x02D4 */ NpcInteractInfo interactInfo; } EnNiwGirl; // size = 0x02FC diff --git a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c index 0415f95bb9..2d00504577 100644 --- a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c +++ b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c @@ -1,9 +1,24 @@ #include "z_en_niw_lady.h" -#include "assets/objects/object_ane/object_ane.h" -#include "assets/objects/object_os_anime/object_os_anime.h" #include "overlays/actors/ovl_En_Niw/z_en_niw.h" + +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "rand.h" +#include "regs.h" +#include "segmented_address.h" +#include "sfx.h" #include "terminal.h" #include "versions.h" +#include "z_lib.h" +#include "z64face_reaction.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/object_ane/object_ane.h" +#include "assets/objects/object_os_anime/object_os_anime.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED) @@ -156,9 +171,9 @@ void func_80AB9F24(EnNiwLady* this, PlayState* play) { if (Object_IsLoaded(&play->objectCtx, this->aneObjectSlot) && Object_IsLoaded(&play->objectCtx, this->osAnimeObjectSlot)) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->aneObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->aneObjectSlot].segment); SkelAnime_InitFlex(play, &this->skelAnime, &gCuccoLadySkel, NULL, this->jointTable, this->morphTable, 16); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); this->unk_27E = 1; this->actor.gravity = -3.0f; Actor_SetScale(&this->actor, 0.01f); @@ -519,7 +534,7 @@ void EnNiwLady_Update(Actor* thisx, PlayState* play) { if (this->unk_276 == 0) { Math_SmoothStepToS(&this->headRot.y, 0, 5, 3000, 0); } - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment); if (this->osAnimeObjectSlot >= 0) { if (this->unk_27E != 0) { if (this->unk_26E != 0) { diff --git a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.h b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.h index 7ecb165cca..a6167454da 100644 --- a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.h +++ b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.h @@ -2,11 +2,11 @@ #define Z_EN_NIW_LADY_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnNiwLady; -typedef void (*EnNiwLadyActionFunc)(struct EnNiwLady*, PlayState*); +typedef void (*EnNiwLadyActionFunc)(struct EnNiwLady*, struct PlayState*); typedef struct EnNiwLady { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c index 114971a1de..3511a3c45d 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c @@ -6,6 +6,16 @@ #include "z_en_nutsball.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_dekunuts/object_dekunuts.h" #include "assets/objects/object_hintnuts/object_hintnuts.h" #include "assets/objects/object_shopnuts/object_shopnuts.h" diff --git a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h index 00fe77a05c..bcd4e0a936 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.h @@ -2,7 +2,7 @@ #define Z_EN_NUTSBALL_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" #define NUTSBALL_GET_TYPE(thisx) ((thisx)->params) @@ -16,7 +16,7 @@ typedef enum EnNutsballType { struct EnNutsball; -typedef void (*EnNutsballActionFunc)(struct EnNutsball*, PlayState*); +typedef void (*EnNutsballActionFunc)(struct EnNutsball*, struct PlayState*); typedef struct EnNutsball { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c index a990438adb..a5f322def6 100644 --- a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c +++ b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c @@ -5,6 +5,14 @@ */ #include "z_en_nwc.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" + #include "assets/objects/object_nwc/object_nwc.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.h b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.h index e927cb3b66..fbb64d1ca2 100644 --- a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.h +++ b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.h @@ -2,13 +2,13 @@ #define Z_EN_NWC_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnNwc; struct EnNwcChick; -typedef void (*EnNwcUpdateFunc)(struct EnNwc*, PlayState*); -typedef void (*EnNwcChickFunc)(struct EnNwcChick*, struct EnNwc*, PlayState*); +typedef void (*EnNwcUpdateFunc)(struct EnNwc*, struct PlayState*); +typedef void (*EnNwcChickFunc)(struct EnNwcChick*, struct EnNwc*, struct PlayState*); typedef struct EnNwcChick { /* 0x00 */ s8 type; @@ -21,8 +21,8 @@ typedef struct EnNwcChick { /* 0x2C */ f32 velY; /* 0x30 */ Vec3s rot; /* 0x36 */ u16 height; - /* 0x38 */ CollisionPoly* floorPoly; - /* 0x44 */ char unk_3C[0x20]; + /* 0x38 */ struct CollisionPoly* floorPoly; + /* 0x3C */ char unk_3C[0x20]; } EnNwcChick; // size = 0x5C typedef struct EnNwc { diff --git a/src/overlays/actors/ovl_En_Ny/z_en_ny.c b/src/overlays/actors/ovl_En_Ny/z_en_ny.c index e31bd37d52..d7f4537512 100644 --- a/src/overlays/actors/ovl_En_Ny/z_en_ny.c +++ b/src/overlays/actors/ovl_En_Ny/z_en_ny.c @@ -1,4 +1,19 @@ #include "z_en_ny.h" + +#include "libc64/math64.h" +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "rand.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/object_ny/object_ny.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE) @@ -110,7 +125,7 @@ void EnNy_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.damageTable = &sDamageTable; this->actor.colChkInfo.health = 2; Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sColliderInit, this->elements); + Collider_SetJntSph(play, &this->collider, &this->actor, &sColliderInit, this->colliderElements); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); this->unk_1CA = 0; this->unk_1D0 = 0; diff --git a/src/overlays/actors/ovl_En_Ny/z_en_ny.h b/src/overlays/actors/ovl_En_Ny/z_en_ny.h index 18c109cc51..03cace42fb 100644 --- a/src/overlays/actors/ovl_En_Ny/z_en_ny.h +++ b/src/overlays/actors/ovl_En_Ny/z_en_ny.h @@ -2,17 +2,17 @@ #define Z_EN_NY_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnNy; -typedef void (*EnNyActionFunc)(struct EnNy*, PlayState*); +typedef void (*EnNyActionFunc)(struct EnNy*, struct PlayState*); typedef struct EnNy { /* 0x0000 */ Actor actor; /* 0x014C */ EnNyActionFunc actionFunc; /* 0x0150 */ ColliderJntSph collider; - /* 0x0170 */ ColliderJntSphElement elements[1]; + /* 0x0170 */ ColliderJntSphElement colliderElements[1]; /* 0x01B0 */ char unk_1B0[0x18]; /* 0x01C8 */ s16 timer; /* 0x01CA */ s16 unk_1CA; diff --git a/src/overlays/actors/ovl_En_OE2/z_en_oe2.c b/src/overlays/actors/ovl_En_OE2/z_en_oe2.c index f89eb3ce99..f568d1812b 100644 --- a/src/overlays/actors/ovl_En_OE2/z_en_oe2.c +++ b/src/overlays/actors/ovl_En_OE2/z_en_oe2.c @@ -6,6 +6,8 @@ #include "z_en_oe2.h" +#include "z64play.h" + #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY) void EnOE2_Init(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_OE2/z_en_oe2.h b/src/overlays/actors/ovl_En_OE2/z_en_oe2.h index 635495bb7d..062e103819 100644 --- a/src/overlays/actors/ovl_En_OE2/z_en_oe2.h +++ b/src/overlays/actors/ovl_En_OE2/z_en_oe2.h @@ -2,11 +2,11 @@ #define Z_EN_OE2_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnOE2; -typedef void (*EnOE2ActionFunc)(struct EnOE2*, PlayState*); +typedef void (*EnOE2ActionFunc)(struct EnOE2*, struct PlayState*); typedef struct EnOE2 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c index 40eef58eb4..eb9941b46b 100644 --- a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c +++ b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c @@ -5,10 +5,18 @@ */ #include "z_en_okarina_effect.h" + +#include "printf.h" +#include "regs.h" +#include "sequence.h" #include "terminal.h" #include "versions.h" - +#include "z64audio.h" +#include "z64cutscene_flags.h" +#include "z64debug_display.h" #include "z64frame_advance.h" +#include "z64play.h" +#include "z64save.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_UPDATE_DURING_OCARINA) diff --git a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.h b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.h index f45c4a88ee..bca8c99234 100644 --- a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.h +++ b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.h @@ -2,11 +2,11 @@ #define Z_EN_OKARINA_EFFECT_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnOkarinaEffect; -typedef void (*EnOkarinaEffectActionFunc)(struct EnOkarinaEffect*, PlayState*); +typedef void (*EnOkarinaEffectActionFunc)(struct EnOkarinaEffect*, struct PlayState*); typedef struct EnOkarinaEffect { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c index 96928130ae..2ec4c8f08f 100644 --- a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c +++ b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c @@ -5,10 +5,24 @@ */ #include "z_en_okarina_tag.h" -#include "assets/scenes/misc/hakaana_ouke/hakaana_ouke_scene.h" -#include "assets/scenes/overworld/spot02/spot02_scene.h" + +#include "attributes.h" +#include "printf.h" +#include "regs.h" +#include "segmented_address.h" +#include "sfx.h" #include "terminal.h" #include "versions.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64debug_display.h" +#include "z64ocarina.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/scenes/misc/hakaana_ouke/hakaana_ouke_scene.h" +#include "assets/scenes/overworld/spot02/spot02_scene.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_UPDATE_DURING_OCARINA) diff --git a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.h b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.h index 1192d0cfce..76ac1581a5 100644 --- a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.h +++ b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.h @@ -2,11 +2,11 @@ #define Z_EN_OKARINA_TAG_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnOkarinaTag; -typedef void (*EnOkarinaTagActionFunc)(struct EnOkarinaTag*, PlayState*); +typedef void (*EnOkarinaTagActionFunc)(struct EnOkarinaTag*, struct PlayState*); typedef struct EnOkarinaTag { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag_cutscene_data.c b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag_cutscene_data.c index f0c0b4d3b3..2ff69c780e 100644 --- a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag_cutscene_data.c +++ b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag_cutscene_data.c @@ -1,5 +1,6 @@ -#include "z_en_okarina_tag.h" +#include "sequence.h" #include "z64cutscene_commands.h" +#include "z64player.h" // clang-format off CutsceneData gWindmillSpinningFasterCs[] = { diff --git a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c index 0baff94145..b7063e0f00 100644 --- a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c +++ b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c @@ -1,4 +1,18 @@ #include "z_en_okuta.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_okuta/object_okuta.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE) diff --git a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.h b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.h index 01c2ba1140..5409481022 100644 --- a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.h +++ b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.h @@ -2,11 +2,11 @@ #define Z_EN_OKUTA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnOkuta; -typedef void (*EnOkutaActionFunc)(struct EnOkuta*, PlayState*); +typedef void (*EnOkutaActionFunc)(struct EnOkuta*, struct PlayState*); typedef struct EnOkuta { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index a083ef85d7..9d70c9019a 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -1,5 +1,23 @@ #include "z_en_ossan.h" +#include "overlays/actors/ovl_En_Elf/z_en_elf.h" +#include "overlays/actors/ovl_En_GirlA/z_en_girla.h" +#include "overlays/actors/ovl_En_Tana/z_en_tana.h" + +#include "libc64/qrand.h" +#include "controller.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "regs.h" +#include "segmented_address.h" +#include "sfx.h" #include "terminal.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_ossan/object_ossan.h" #include "assets/objects/object_oF1d_map/object_oF1d_map.h" @@ -7,7 +25,6 @@ #include "assets/objects/object_zo/object_zo.h" #include "assets/objects/object_rs/object_rs.h" #include "assets/objects/object_ds2/object_ds2.h" -#include "overlays/actors/ovl_En_Elf/z_en_elf.h" #include "assets/objects/object_masterkokiri/object_masterkokiri.h" #include "assets/objects/object_km1/object_km1.h" #include "assets/objects/object_mastergolon/object_mastergolon.h" @@ -2008,7 +2025,7 @@ void EnOssan_InitBazaarShopkeeper(EnOssan* this, PlayState* play) { void EnOssan_InitKokiriShopkeeper(EnOssan* this, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gKm1Skel, NULL, NULL, NULL, 0); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot3].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot3].segment); Animation_Change(&this->skelAnime, &object_masterkokiri_Anim_0004A8, 1.0f, 0.0f, Animation_GetLastFrame(&object_masterkokiri_Anim_0004A8), 0, 0.0f); this->actor.draw = EnOssan_DrawKokiriShopkeeper; @@ -2019,7 +2036,7 @@ void EnOssan_InitKokiriShopkeeper(EnOssan* this, PlayState* play) { void EnOssan_InitGoronShopkeeper(EnOssan* this, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, NULL, NULL, 0); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot3].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot3].segment); Animation_Change(&this->skelAnime, &gGoronShopkeeperAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gGoronShopkeeperAnim), 0, 0.0f); this->actor.draw = EnOssan_DrawGoronShopkeeper; @@ -2028,7 +2045,7 @@ void EnOssan_InitGoronShopkeeper(EnOssan* this, PlayState* play) { void EnOssan_InitZoraShopkeeper(EnOssan* this, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gZoraSkel, NULL, NULL, NULL, 0); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot3].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot3].segment); Animation_Change(&this->skelAnime, &gZoraShopkeeperAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gZoraShopkeeperAnim), 0, 0.0f); this->actor.draw = EnOssan_DrawZoraShopkeeper; @@ -2211,7 +2228,7 @@ void EnOssan_InitActionFunc(EnOssan* this, PlayState* play) { } void EnOssan_Obj3ToSeg6(EnOssan* this, PlayState* play) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot3].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot3].segment); } void EnOssan_MainActionFunc(EnOssan* this, PlayState* play) { @@ -2381,7 +2398,7 @@ s32 EnOssan_OverrideLimbDrawKokiriShopkeeper(PlayState* play, s32 limbIndex, Gfx if (limbIndex == 15) { gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->objectSlot2].segment); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot2].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot2].segment); *dList = gKokiriShopkeeperHeadDL; gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(sKokiriShopkeeperEyeTextures[this->eyeTextureIdx])); } diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h index c2101e9d9e..7df4be57b8 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h @@ -2,17 +2,15 @@ #define Z_EN_OSSAN_H #include "ultra64.h" -#include "global.h" -#include "overlays/actors/ovl_En_Tana/z_en_tana.h" -#include "overlays/actors/ovl_En_GirlA/z_en_girla.h" +#include "z64actor.h" struct EnOssan; -typedef void (*EnOssanActionFunc)(struct EnOssan*, PlayState*); -typedef void (*EnOssanTalkOwnerFunc)(PlayState*); -typedef void (*EnOssanInitFunc)(struct EnOssan*, PlayState*); +typedef void (*EnOssanActionFunc)(struct EnOssan*, struct PlayState*); +typedef void (*EnOssanTalkOwnerFunc)(struct PlayState*); +typedef void (*EnOssanInitFunc)(struct EnOssan*, struct PlayState*); typedef s16 (*EnOssanGetGirlAParamsFunc)(s16); -typedef void (*EnOssanStateFunc)(struct EnOssan*, PlayState*, Player*); +typedef void (*EnOssanStateFunc)(struct EnOssan*, struct PlayState*, struct Player*); typedef struct StickDirectionPrompt { /* 0x00 */ u32 stickColorR; @@ -37,7 +35,7 @@ typedef struct EnOssan { /* 0x0000 */ Actor actor; /* 0x014C */ SkelAnime skelAnime; /* 0x0190 */ EnOssanActionFunc actionFunc; - /* 0x0194 */ void (*obj3ToSeg6Func)(struct EnOssan*, PlayState*); + /* 0x0194 */ void (*obj3ToSeg6Func)(struct EnOssan*, struct PlayState*); /* 0x0198 */ ColliderCylinder collider; // unused /* 0x01E4 */ s16 timer; /* 0x01E6 */ s16 delayTimer; @@ -53,11 +51,11 @@ typedef struct EnOssan { /* 0x01F8 */ void (*blinkFunc)(struct EnOssan*); /* 0x01FC */ s16 stateFlag; /* 0x01FE */ s16 tempStateFlag; - /* 0x0200 */ EnGirlA* shelfSlots[8]; + /* 0x0200 */ struct EnGirlA* shelfSlots[8]; // Shelves are indexed as such: /* 7 5 3 1 */ /* 6 4 2 0 */ - /* 0x0220 */ EnTana* shelves; + /* 0x0220 */ struct EnTana* shelves; /* 0x0224 */ s32 stickAccumX; /* 0x0228 */ s32 stickAccumY; /* 0x022C */ u8 moveHorizontal; diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/src/overlays/actors/ovl_En_Owl/z_en_owl.c index 46696027f4..3ec065c696 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -5,10 +5,31 @@ */ #include "z_en_owl.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "rand.h" +#include "segmented_address.h" +#include "seqcmd.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_math3d.h" +#include "sys_matrix.h" +#include "terminal.h" +#include "translation.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_owl/object_owl.h" #include "assets/scenes/overworld/spot06/spot06_scene.h" #include "assets/scenes/overworld/spot16/spot16_scene.h" -#include "terminal.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.h b/src/overlays/actors/ovl_En_Owl/z_en_owl.h index 4f92ef1b41..2f9e0939f8 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.h +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.h @@ -2,11 +2,11 @@ #define Z_EN_OWL_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnOwl; -typedef void (*EnOwlActionFunc)(struct EnOwl*, PlayState*); +typedef void (*EnOwlActionFunc)(struct EnOwl*, struct PlayState*); typedef void (*OwlFunc)(struct EnOwl*); typedef struct EnOwl { diff --git a/src/overlays/actors/ovl_En_Part/z_en_part.c b/src/overlays/actors/ovl_En_Part/z_en_part.c index 215442f52e..c10a8edcb4 100644 --- a/src/overlays/actors/ovl_En_Part/z_en_part.c +++ b/src/overlays/actors/ovl_En_Part/z_en_part.c @@ -5,6 +5,20 @@ */ #include "z_en_part.h" + +#include "libc64/qrand.h" +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "rand.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_tite/object_tite.h" #include "assets/objects/object_ik/object_ik.h" diff --git a/src/overlays/actors/ovl_En_Part/z_en_part.h b/src/overlays/actors/ovl_En_Part/z_en_part.h index 3502d80a80..405e795e75 100644 --- a/src/overlays/actors/ovl_En_Part/z_en_part.h +++ b/src/overlays/actors/ovl_En_Part/z_en_part.h @@ -2,11 +2,11 @@ #define Z_EN_PART_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnPart; -typedef void (*EnPartActionFunc)(struct EnPart*, PlayState*); +typedef void (*EnPartActionFunc)(struct EnPart*, struct PlayState*); typedef struct EnPart { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c index 6265f2c5f3..2246b3df16 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c @@ -1,8 +1,24 @@ #include "z_en_peehat.h" -#include "assets/objects/object_peehat/object_peehat.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "rand.h" +#include "sfx.h" +#include "sys_math.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/object_peehat/object_peehat.h" + #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT) @@ -74,7 +90,7 @@ static ColliderCylinderInit sCylinderInit = { { 50, 160, -70, { 0, 0, 0 } }, }; -static ColliderJntSphElementInit sJntSphElemInit[1] = { +static ColliderJntSphElementInit sJntSphElementsInit[1] = { { { ELEM_MATERIAL_UNK0, @@ -98,7 +114,7 @@ static ColliderJntSphInit sJntSphInit = { COLSHAPE_JNTSPH, }, 1, - sJntSphElemInit, + sJntSphElementsInit, }; static ColliderQuadInit sQuadInit = { @@ -203,12 +219,12 @@ void EnPeehat_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.health = 6; this->actor.colChkInfo.damageTable = &sDamageTable; this->actor.floorHeight = this->actor.world.pos.y; - Collider_InitCylinder(play, &this->colCylinder); - Collider_SetCylinder(play, &this->colCylinder, &this->actor, &sCylinderInit); - Collider_InitQuad(play, &this->colQuad); - Collider_SetQuad(play, &this->colQuad, &this->actor, &sQuadInit); - Collider_InitJntSph(play, &this->colJntSph); - Collider_SetJntSph(play, &this->colJntSph, &this->actor, &sJntSphInit, this->colJntSphItemList); + Collider_InitCylinder(play, &this->colliderCylinder); + Collider_SetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit); + Collider_InitQuad(play, &this->colliderQuad); + Collider_SetQuad(play, &this->colliderQuad, &this->actor, &sQuadInit); + Collider_InitJntSph(play, &this->colliderJntSph); + Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElements); this->actor.naviEnemyId = NAVI_ENEMY_PEAHAT; this->xzDistToRise = 740.0f; @@ -230,12 +246,12 @@ void EnPeehat_Init(Actor* thisx, PlayState* play) { case PEAHAT_TYPE_LARVA: this->actor.scale.x = this->actor.scale.z = 0.006f; this->actor.scale.y = 0.003f; - this->colCylinder.dim.radius = 25; - this->colCylinder.dim.height = 15; - this->colCylinder.dim.yShift = -5; - this->colCylinder.elem.acDmgInfo.dmgFlags = DMG_ARROW | DMG_SLINGSHOT; - this->colQuad.base.atFlags = AT_ON | AT_TYPE_ENEMY; - this->colQuad.base.acFlags = AC_ON | AC_TYPE_PLAYER; + this->colliderCylinder.dim.radius = 25; + this->colliderCylinder.dim.height = 15; + this->colliderCylinder.dim.yShift = -5; + this->colliderCylinder.elem.acDmgInfo.dmgFlags = DMG_ARROW | DMG_SLINGSHOT; + this->colliderQuad.base.atFlags = AT_ON | AT_TYPE_ENEMY; + this->colliderQuad.base.acFlags = AC_ON | AC_TYPE_PLAYER; this->actor.naviEnemyId = NAVI_ENEMY_PEAHAT_LARVA; EnPeehat_Larva_SetStateSeekPlayer(this); break; @@ -246,8 +262,8 @@ void EnPeehat_Destroy(Actor* thisx, PlayState* play) { EnPeehat* this = (EnPeehat*)thisx; EnPeehat* parent; - Collider_DestroyCylinder(play, &this->colCylinder); - Collider_DestroyJntSph(play, &this->colJntSph); + Collider_DestroyCylinder(play, &this->colliderCylinder); + Collider_DestroyJntSph(play, &this->colliderJntSph); // If PEAHAT_TYPE_LARVA, decrement total larva spawned if (this->actor.params > 0) { @@ -280,7 +296,7 @@ void EnPeehat_SpawnDust(PlayState* play, EnPeehat* this, Vec3f* pos, f32 arg3, s * Handles being hit when on the ground */ void EnPeehat_HitWhenGrounded(EnPeehat* this, PlayState* play) { - this->colCylinder.base.acFlags &= ~AC_HIT; + this->colliderCylinder.base.acFlags &= ~AC_HIT; if ((play->gameplayFrames & 0xF) == 0) { Vec3f itemDropPos = this->actor.world.pos; @@ -292,7 +308,7 @@ void EnPeehat_HitWhenGrounded(EnPeehat* this, PlayState* play) { } else { s32 i; - this->colCylinder.base.acFlags &= ~AC_HIT; + this->colliderCylinder.base.acFlags &= ~AC_HIT; for (i = MAX_LARVA - this->unk_2FA; i > 0; i--) { Actor* larva = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_PEEHAT, @@ -318,7 +334,7 @@ void EnPeehat_Ground_SetStateGround(EnPeehat* this) { this->unk_2D4 = 0; this->unk_2FA = 0; this->state = PEAHAT_STATE_3; - this->colCylinder.base.acFlags &= ~AC_HIT; + this->colliderCylinder.base.acFlags &= ~AC_HIT; EnPeehat_SetupAction(this, EnPeehat_Ground_StateGround); } @@ -343,7 +359,7 @@ void EnPeehat_Ground_StateGround(EnPeehat* this, PlayState* play) { } else { Math_SmoothStepToF(&this->scaleShift, 0.0f, 1.0f, 0.005f, 0.0f); } - } else if (this->colCylinder.base.acFlags & AC_HIT) { + } else if (this->colliderCylinder.base.acFlags & AC_HIT) { EnPeehat_HitWhenGrounded(this, play); } } @@ -373,7 +389,7 @@ void EnPeehat_Flying_StateGrounded(EnPeehat* this, PlayState* play) { } else { Math_SmoothStepToF(&this->scaleShift, 0.0f, 1.0f, 0.005f, 0.0f); } - } else if (this->colCylinder.base.acFlags & AC_HIT) { + } else if (this->colliderCylinder.base.acFlags & AC_HIT) { EnPeehat_HitWhenGrounded(this, play); } } @@ -560,22 +576,22 @@ void EnPeehat_Larva_StateSeekPlayer(EnPeehat* this, PlayState* play) { this->bladeRot += this->bladeRotVel; Math_SmoothStepToF(&this->scaleShift, 0.075f, 1.0f, 0.005f, 0.0f); Actor_PlaySfx(&this->actor, NA_SE_EN_PIHAT_SM_FLY - SFX_FLAG); - if (this->colQuad.base.atFlags & AT_BOUNCED) { + if (this->colliderQuad.base.atFlags & AT_BOUNCED) { this->actor.colChkInfo.health = 0; - this->colQuad.base.acFlags &= ~AC_BOUNCED; + this->colliderQuad.base.acFlags &= ~AC_BOUNCED; EnPeehat_SetStateAttackRecoil(this); - } else if ((this->colQuad.base.atFlags & AT_HIT) || (this->colCylinder.base.acFlags & AC_HIT) || + } else if ((this->colliderQuad.base.atFlags & AT_HIT) || (this->colliderCylinder.base.acFlags & AC_HIT) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { Player* player = GET_PLAYER(play); - this->colQuad.base.atFlags &= ~AT_HIT; - if (!(this->colCylinder.base.acFlags & AC_HIT) && &player->actor == this->colQuad.base.at) { + this->colliderQuad.base.atFlags &= ~AT_HIT; + if (!(this->colliderCylinder.base.acFlags & AC_HIT) && &player->actor == this->colliderQuad.base.at) { if (Rand_ZeroOne() > 0.5f) { this->actor.world.rot.y += 0x2000; } else { this->actor.world.rot.y -= 0x2000; } this->unk_2D4 = 40; - } else if (this->colCylinder.base.acFlags & AC_HIT || this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + } else if (this->colliderCylinder.base.acFlags & AC_HIT || this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Vec3f zeroVec = { 0, 0, 0 }; s32 i; for (i = 4; i >= 0; i--) { @@ -586,7 +602,7 @@ void EnPeehat_Larva_StateSeekPlayer(EnPeehat* this, PlayState* play) { EffectSsDeadDb_Spawn(play, &pos, &zeroVec, &zeroVec, 40, 7, 255, 255, 255, 255, 255, 0, 0, 1, 9, 1); } } - if (&player->actor != this->colQuad.base.at || this->colCylinder.base.acFlags & AC_HIT) { + if (&player->actor != this->colliderQuad.base.at || this->colliderCylinder.base.acFlags & AC_HIT) { if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { EffectSsDeadSound_SpawnStationary(play, &this->actor.projectedPos, NA_SE_EN_PIHAT_SM_DEAD, 1, 1, 40); } @@ -879,13 +895,13 @@ void EnPeehat_StateExplode(EnPeehat* this, PlayState* play) { } void EnPeehat_Adult_CollisionCheck(EnPeehat* this, PlayState* play) { - if ((this->colCylinder.base.acFlags & AC_BOUNCED) || (this->colQuad.base.acFlags & AC_BOUNCED)) { - this->colQuad.base.acFlags &= ~AC_BOUNCED; - this->colCylinder.base.acFlags &= ~AC_BOUNCED; - this->colJntSph.base.acFlags &= ~AC_HIT; - } else if (this->colJntSph.base.acFlags & AC_HIT) { - this->colJntSph.base.acFlags &= ~AC_HIT; - Actor_SetDropFlagJntSph(&this->actor, &this->colJntSph, true); + if ((this->colliderCylinder.base.acFlags & AC_BOUNCED) || (this->colliderQuad.base.acFlags & AC_BOUNCED)) { + this->colliderQuad.base.acFlags &= ~AC_BOUNCED; + this->colliderCylinder.base.acFlags &= ~AC_BOUNCED; + this->colliderJntSph.base.acFlags &= ~AC_HIT; + } else if (this->colliderJntSph.base.acFlags & AC_HIT) { + this->colliderJntSph.base.acFlags &= ~AC_HIT; + Actor_SetDropFlagJntSph(&this->actor, &this->colliderJntSph, true); if (this->actor.colChkInfo.damageEffect == PEAHAT_DMG_EFF_NUT || this->actor.colChkInfo.damageEffect == PEAHAT_DMG_EFF_LIGHT_ICE_ARROW) { return; @@ -948,9 +964,9 @@ void EnPeehat_Update(Actor* thisx, PlayState* play) { // if PEAHAT_TYPE_GROUNDED if (thisx->params < 0) { // Set the Z-Target point on the Peahat's weak point - thisx->focus.pos.x = this->colJntSph.elements[0].dim.worldSphere.center.x; - thisx->focus.pos.y = this->colJntSph.elements[0].dim.worldSphere.center.y; - thisx->focus.pos.z = this->colJntSph.elements[0].dim.worldSphere.center.z; + thisx->focus.pos.x = this->colliderJntSph.elements[0].dim.worldSphere.center.x; + thisx->focus.pos.y = this->colliderJntSph.elements[0].dim.worldSphere.center.y; + thisx->focus.pos.z = this->colliderJntSph.elements[0].dim.worldSphere.center.z; if (this->state == PEAHAT_STATE_SEEK_PLAYER) { Math_SmoothStepToS(&thisx->shape.rot.x, 6000, 1, 300, 0); } else { @@ -959,21 +975,21 @@ void EnPeehat_Update(Actor* thisx, PlayState* play) { } else { thisx->focus.pos = thisx->world.pos; } - Collider_UpdateCylinder(thisx, &this->colCylinder); + Collider_UpdateCylinder(thisx, &this->colliderCylinder); if (thisx->colChkInfo.health > 0) { // If Adult Peahat if (thisx->params <= 0) { - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colCylinder.base); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colJntSph.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderJntSph.base); if (thisx->colorFilterTimer == 0 || !(thisx->colorFilterParams & 0x4000)) { if (this->state != PEAHAT_STATE_EXPLODE) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colJntSph.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); } } } - if (thisx->params != PEAHAT_TYPE_FLYING && this->colQuad.base.atFlags & AT_HIT) { - this->colQuad.base.atFlags &= ~AT_HIT; - if (&player->actor == this->colQuad.base.at) { + if (thisx->params != PEAHAT_TYPE_FLYING && this->colliderQuad.base.atFlags & AT_HIT) { + this->colliderQuad.base.atFlags &= ~AT_HIT; + if (&player->actor == this->colliderQuad.base.at) { EnPeehat_SetStateAttackRecoil(this); } } @@ -981,8 +997,8 @@ void EnPeehat_Update(Actor* thisx, PlayState* play) { if (this->state == PEAHAT_STATE_15 || this->state == PEAHAT_STATE_SEEK_PLAYER || this->state == PEAHAT_STATE_FLY || this->state == PEAHAT_STATE_RETURN_HOME || this->state == PEAHAT_STATE_EXPLODE) { if (thisx->params != PEAHAT_TYPE_FLYING) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->colQuad.base); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colQuad.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderQuad.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderQuad.base); } // if PEAHAT_TYPE_GROUNDED if (thisx->params < 0 && (thisx->flags & ACTOR_FLAG_INSIDE_CULLING_VOLUME)) { @@ -997,10 +1013,10 @@ void EnPeehat_Update(Actor* thisx, PlayState* play) { } } } else if (thisx->params != PEAHAT_TYPE_FLYING) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCylinder.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder.base); } } else { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCylinder.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder.base); } Math_SmoothStepToF(&this->scaleShift, 0.0f, 1.0f, 0.001f, 0.0f); } @@ -1049,7 +1065,7 @@ void EnPeehat_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* r OPEN_DISPS(play->state.gfxCtx, "../z_en_peehat.c", 1981); Matrix_Push(); Matrix_Translate(-1000.0f, 0.0f, 0.0f, MTXMODE_APPLY); - Collider_UpdateSpheres(0, &this->colJntSph); + Collider_UpdateSpheres(0, &this->colliderJntSph); Matrix_Translate(500.0f, 0.0f, 0.0f, MTXMODE_APPLY); if (this->actor.colorFilterTimer != 0 && (this->actor.colorFilterParams & 0x4000)) { damageYRot = Math_SinS(this->actor.colorFilterTimer * 0x4E20) * 0.35f; @@ -1073,11 +1089,11 @@ void EnPeehat_Draw(Actor* thisx, PlayState* play) { SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnPeehat_OverrideLimbDraw, EnPeehat_PostLimbDraw, this); if (this->actor.speed != 0.0f || this->actor.velocity.y != 0.0f) { - Matrix_MultVec3f(&D_80AD285C[0], &this->colQuad.dim.quad[1]); - Matrix_MultVec3f(&D_80AD285C[1], &this->colQuad.dim.quad[0]); - Matrix_MultVec3f(&D_80AD285C[2], &this->colQuad.dim.quad[3]); - Matrix_MultVec3f(&D_80AD285C[3], &this->colQuad.dim.quad[2]); - Collider_SetQuadVertices(&this->colQuad, &this->colQuad.dim.quad[0], &this->colQuad.dim.quad[1], - &this->colQuad.dim.quad[2], &this->colQuad.dim.quad[3]); + Matrix_MultVec3f(&D_80AD285C[0], &this->colliderQuad.dim.quad[1]); + Matrix_MultVec3f(&D_80AD285C[1], &this->colliderQuad.dim.quad[0]); + Matrix_MultVec3f(&D_80AD285C[2], &this->colliderQuad.dim.quad[3]); + Matrix_MultVec3f(&D_80AD285C[3], &this->colliderQuad.dim.quad[2]); + Collider_SetQuadVertices(&this->colliderQuad, &this->colliderQuad.dim.quad[0], &this->colliderQuad.dim.quad[1], + &this->colliderQuad.dim.quad[2], &this->colliderQuad.dim.quad[3]); } } diff --git a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h index 2449fc3405..deb24089f6 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h @@ -2,7 +2,7 @@ #define Z_EN_PEEHAT_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" typedef enum PeahatType { /* -1 */ PEAHAT_TYPE_GROUNDED = -1, @@ -12,7 +12,7 @@ typedef enum PeahatType { struct EnPeehat; -typedef void (*EnPeehatActionFunc)(struct EnPeehat*, PlayState*); +typedef void (*EnPeehatActionFunc)(struct EnPeehat*, struct PlayState*); typedef struct EnPeehat { /* 0x0000 */ Actor actor; @@ -38,10 +38,10 @@ typedef struct EnPeehat { /* 0x02FA */ s16 unk_2FA; // larva count (PEAHAT_TYPE_FLYING, PEAHAT_TYPE_GROUNDED), // shape rotation direction (PEAHAT_TYPE_GROUNDED) /* 0x02FC */ s16 animTimer; - /* 0x0300 */ ColliderCylinder colCylinder; - /* 0x034C */ ColliderJntSph colJntSph; - /* 0x036C */ ColliderJntSphElement colJntSphItemList[1]; - /* 0x03AC */ ColliderQuad colQuad; + /* 0x0300 */ ColliderCylinder colliderCylinder; + /* 0x034C */ ColliderJntSph colliderJntSph; + /* 0x036C */ ColliderJntSphElement colliderJntSphElements[1]; + /* 0x03AC */ ColliderQuad colliderQuad; } EnPeehat; // size = 0x042C #endif diff --git a/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c b/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c index fefa80aecc..282d6249f1 100644 --- a/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c +++ b/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c @@ -5,6 +5,18 @@ */ #include "z_en_po_desert.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64light.h" +#include "z64play.h" + #include "assets/objects/object_po_field/object_po_field.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_REACT_TO_LENS | ACTOR_FLAG_IGNORE_QUAKE) @@ -214,7 +226,7 @@ s32 EnPoDesert_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec mtxScale = this->actionTimer / 16.0f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); } - if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { + if (!ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_REACT_TO_LENS)) { *dList = NULL; } return false; @@ -234,7 +246,7 @@ void EnPoDesert_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* color.r = (s16)(rand * 30.0f) + 225; color.g = (s16)(rand * 100.0f) + 155; color.b = (s16)(rand * 160.0f) + 95; - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { + if (ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_REACT_TO_LENS)) { gDPPipeSync((*gfxP)++); gDPSetEnvColor((*gfxP)++, color.r, color.g, color.b, 255); MATRIX_FINALIZE_AND_LOAD((*gfxP)++, play->state.gfxCtx, "../z_en_po_desert.c", 523); diff --git a/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.h b/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.h index aeb2503edc..3f93eeb01d 100644 --- a/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.h +++ b/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.h @@ -2,11 +2,12 @@ #define Z_EN_PO_DESERT_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" +#include "z64light.h" struct EnPoDesert; -typedef void (*EnPoDesertActionFunc)(struct EnPoDesert*, PlayState*); +typedef void (*EnPoDesertActionFunc)(struct EnPoDesert*, struct PlayState*); typedef struct EnPoDesert { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c b/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c index 00eff4a39f..30218e20e5 100644 --- a/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c +++ b/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c @@ -5,6 +5,21 @@ */ #include "z_en_po_field.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64light.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_po_field/object_po_field.h" @@ -143,8 +158,8 @@ static EnPoFieldInfo sPoFieldInfo[2] = { static Vec3f D_80AD714C = { 0.0f, 1400.0f, 0.0f }; -#pragma increment_block_number "gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128 ntsc-1.2:128 pal-1.0:128" \ - "pal-1.1:128" +#pragma increment_block_number "gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128 ntsc-1.0:128 ntsc-1.1:128" \ + "ntsc-1.2:128 pal-1.0:128 pal-1.1:128" static Vec3s sSpawnPositions[10]; static u8 sSpawnSwitchFlags[10]; diff --git a/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.h b/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.h index f07a9233d7..17e08ee999 100644 --- a/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.h +++ b/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.h @@ -2,11 +2,12 @@ #define Z_EN_PO_FIELD_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" +#include "z64light.h" struct EnPoField; -typedef void (*EnPoFieldActionFunc)(struct EnPoField*, PlayState*); +typedef void (*EnPoFieldActionFunc)(struct EnPoField*, struct PlayState*); typedef enum EnPoFieldSize { EN_PO_FIELD_SMALL, diff --git a/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c b/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c index e515efabed..983dbf0d71 100644 --- a/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c +++ b/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c @@ -6,6 +6,23 @@ #include "z_en_po_relay.h" #include "overlays/actors/ovl_En_Honotrap/z_en_honotrap.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_math3d.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64light.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_tk/object_tk.h" #define FLAGS \ diff --git a/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.h b/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.h index 70567ada79..e4a440d940 100644 --- a/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.h +++ b/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.h @@ -2,11 +2,12 @@ #define Z_EN_PO_RELAY_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" +#include "z64light.h" struct EnPoRelay; -typedef void (*EnPoRelayActionFunc)(struct EnPoRelay*, PlayState*); +typedef void (*EnPoRelayActionFunc)(struct EnPoRelay*, struct PlayState*); typedef struct EnPoRelay { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index 3af363a28f..ba165bd3ad 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -5,6 +5,24 @@ */ #include "z_en_po_sisters.h" + +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "one_point_cutscene.h" +#include "rand.h" +#include "sequence.h" +#include "sfx.h" +#include "ichain.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64effect.h" +#include "z64light.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_po_sisters/object_po_sisters.h" diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h index 524f8a867f..bc25e9d035 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.h @@ -2,11 +2,12 @@ #define Z_EN_PO_SISTERS_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" +#include "z64light.h" struct EnPoSisters; -typedef void (*EnPoSistersActionFunc)(struct EnPoSisters*, PlayState*); +typedef void (*EnPoSistersActionFunc)(struct EnPoSisters*, struct PlayState*); typedef struct EnPoSisters { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.c b/src/overlays/actors/ovl_En_Poh/z_en_poh.c index 2168c89e6b..fceb18ef7c 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.c +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.c @@ -5,6 +5,21 @@ */ #include "z_en_poh.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64light.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_poh/object_poh.h" #include "assets/objects/object_po_composer/object_po_composer.h" @@ -75,7 +90,7 @@ static ColliderCylinderInit sCylinderInit = { { 20, 40, 20, { 0, 0, 0 } }, }; -static ColliderJntSphElementInit D_80AE1AA0[1] = { +static ColliderJntSphElementInit sJntSphElementsInit[1] = { { { ELEM_MATERIAL_UNK0, @@ -99,7 +114,7 @@ static ColliderJntSphInit sJntSphInit = { COLSHAPE_JNTSPH, }, 1, - D_80AE1AA0, + sJntSphElementsInit, }; static CollisionCheckInfoInit sColChkInfoInit = { 4, 25, 50, 40 }; @@ -189,14 +204,14 @@ void EnPoh_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - Collider_InitJntSph(play, &this->colliderSph); - Collider_SetJntSph(play, &this->colliderSph, &this->actor, &sJntSphInit, &this->colliderSphItem); - this->colliderSph.elements[0].dim.worldSphere.radius = 0; - this->colliderSph.elements[0].dim.worldSphere.center.x = this->actor.world.pos.x; - this->colliderSph.elements[0].dim.worldSphere.center.y = this->actor.world.pos.y; - this->colliderSph.elements[0].dim.worldSphere.center.z = this->actor.world.pos.z; - Collider_InitCylinder(play, &this->colliderCyl); - Collider_SetCylinder(play, &this->colliderCyl, &this->actor, &sCylinderInit); + Collider_InitJntSph(play, &this->colliderJntSph); + Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElements); + this->colliderJntSph.elements[0].dim.worldSphere.radius = 0; + this->colliderJntSph.elements[0].dim.worldSphere.center.x = this->actor.world.pos.x; + this->colliderJntSph.elements[0].dim.worldSphere.center.y = this->actor.world.pos.y; + this->colliderJntSph.elements[0].dim.worldSphere.center.z = this->actor.world.pos.z; + Collider_InitCylinder(play, &this->colliderCylinder); + Collider_SetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->unk_194 = 0; this->unk_195 = 32; @@ -249,8 +264,8 @@ void EnPoh_Destroy(Actor* thisx, PlayState* play) { EnPoh* this = (EnPoh*)thisx; LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); - Collider_DestroyJntSph(play, &this->colliderSph); - Collider_DestroyCylinder(play, &this->colliderCyl); + Collider_DestroyJntSph(play, &this->colliderJntSph); + Collider_DestroyCylinder(play, &this->colliderCylinder); if (this->actor.params == EN_POH_RUPEE) { D_80AE1A50--; } @@ -294,12 +309,12 @@ void func_80ADE28C(EnPoh* this) { } else { Animation_PlayOnce(&this->skelAnime, &gPoeComposerDamagedAnim); } - if (this->colliderCyl.elem.acHitElem->atDmgInfo.dmgFlags & (DMG_ARROW | DMG_SLINGSHOT)) { - this->actor.world.rot.y = this->colliderCyl.base.ac->world.rot.y; + if (this->colliderCylinder.elem.acHitElem->atDmgInfo.dmgFlags & (DMG_ARROW | DMG_SLINGSHOT)) { + this->actor.world.rot.y = this->colliderCylinder.base.ac->world.rot.y; } else { - this->actor.world.rot.y = Actor_WorldYawTowardActor(&this->actor, this->colliderCyl.base.ac) + 0x8000; + this->actor.world.rot.y = Actor_WorldYawTowardActor(&this->actor, this->colliderCylinder.base.ac) + 0x8000; } - this->colliderCyl.base.acFlags &= ~AC_ON; + this->colliderCylinder.base.acFlags &= ~AC_ON; this->actor.speed = 5.0f; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 16); this->actionFunc = func_80ADEECC; @@ -309,7 +324,7 @@ void func_80ADE368(EnPoh* this) { Animation_MorphToLoop(&this->skelAnime, this->info->fleeAnim, -5.0f); this->actor.speed = 5.0f; this->actor.world.rot.y = this->actor.shape.rot.y + 0x8000; - this->colliderCyl.base.acFlags |= AC_ON; + this->colliderCylinder.base.acFlags |= AC_ON; this->unk_198 = 200; this->actionFunc = func_80ADF894; } @@ -413,13 +428,13 @@ void func_80ADE6D4(EnPoh* this) { void EnPoh_Talk(EnPoh* this, PlayState* play) { this->actor.home.pos.y = this->actor.world.pos.y; Actor_SetFocus(&this->actor, -10.0f); - this->colliderCyl.dim.radius = 13; - this->colliderCyl.dim.height = 30; - this->colliderCyl.dim.yShift = 0; - this->colliderCyl.dim.pos.x = this->actor.world.pos.x; - this->colliderCyl.dim.pos.y = this->actor.world.pos.y - 20.0f; - this->colliderCyl.dim.pos.z = this->actor.world.pos.z; - this->colliderCyl.base.ocFlags1 = OC1_ON | OC1_TYPE_PLAYER; + this->colliderCylinder.dim.radius = 13; + this->colliderCylinder.dim.height = 30; + this->colliderCylinder.dim.yShift = 0; + this->colliderCylinder.dim.pos.x = this->actor.world.pos.x; + this->colliderCylinder.dim.pos.y = this->actor.world.pos.y - 20.0f; + this->colliderCylinder.dim.pos.z = this->actor.world.pos.z; + this->colliderCylinder.base.ocFlags1 = OC1_ON | OC1_TYPE_PLAYER; if (this->actor.params == EN_POH_FLAT || this->actor.params == EN_POH_SHARP) { if (CHECK_QUEST_ITEM(QUEST_SONG_SUN)) { this->actor.textId = 0x5000; @@ -777,12 +792,12 @@ void func_80ADFE80(EnPoh* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; return; } - if (this->colliderCyl.base.ocFlags1 & OC1_HIT) { + if (this->colliderCylinder.base.ocFlags1 & OC1_HIT) { this->actor.flags |= ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; Actor_OfferTalkNearColChkInfoCylinder(&this->actor, play); } else { this->actor.flags &= ~ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCyl.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder.base); } this->actor.world.pos.y = Math_SinS(this->unk_195 * 0x800) * 5.0f + this->actor.home.pos.y; if (this->unk_195 != 0) { @@ -791,7 +806,7 @@ void func_80ADFE80(EnPoh* this, PlayState* play) { if (this->unk_195 == 0) { this->unk_195 = 32; } - this->colliderCyl.dim.pos.y = this->actor.world.pos.y - 20.0f; + this->colliderCylinder.dim.pos.y = this->actor.world.pos.y - 20.0f; Actor_SetFocus(&this->actor, -10.0f); Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->info->lightColor.r, this->info->lightColor.g, @@ -863,8 +878,8 @@ void EnPoh_TalkComposer(EnPoh* this, PlayState* play) { } void func_80AE032C(EnPoh* this, PlayState* play) { - if (this->colliderCyl.base.acFlags & AC_HIT) { - this->colliderCyl.base.acFlags &= ~AC_HIT; + if (this->colliderCylinder.base.acFlags & AC_HIT) { + this->colliderCylinder.base.acFlags &= ~AC_HIT; if (this->actor.colChkInfo.damageEffect != 0 || this->actor.colChkInfo.damage != 0) { if (Actor_ApplyDamage(&this->actor) == 0) { Enemy_StartFinishingBlow(play, &this->actor); @@ -918,12 +933,12 @@ void EnPoh_Update(Actor* thisx, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gPoeComposerSkel, &gPoeComposerFloatAnim, this->jointTable, this->morphTable, 12); this->actor.draw = EnPoh_DrawComposer; - this->colliderSph.elements[0].dim.limb = 9; - this->colliderSph.elements[0].dim.modelSphere.center.y *= -1; + this->colliderJntSph.elements[0].dim.limb = 9; + this->colliderJntSph.elements[0].dim.modelSphere.center.y *= -1; this->actor.shape.rot.y = this->actor.world.rot.y = -0x4000; - this->colliderCyl.dim.radius = 20; - this->colliderCyl.dim.height = 55; - this->colliderCyl.dim.yShift = 15; + this->colliderCylinder.dim.radius = 20; + this->colliderCylinder.dim.height = 55; + this->colliderCylinder.dim.yShift = 15; } this->actor.flags &= ~ACTOR_FLAG_UPDATE_CULLING_DISABLED; EnPoh_SetupInitialAction(this); @@ -988,8 +1003,8 @@ void EnPoh_UpdateLiving(Actor* thisx, PlayState* play) { Vec3f checkPos; s32 bgId; - if (this->colliderSph.base.atFlags & AT_HIT) { - this->colliderSph.base.atFlags &= ~AT_HIT; + if (this->colliderJntSph.base.atFlags & AT_HIT) { + this->colliderJntSph.base.atFlags &= ~AT_HIT; func_80ADE4C8(this); } func_80AE032C(this, play); @@ -998,14 +1013,14 @@ void EnPoh_UpdateLiving(Actor* thisx, PlayState* play) { Actor_MoveXZGravity(&this->actor); if (this->actionFunc == EnPoh_Attack && this->unk_198 < 10) { this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; - CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderSph.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderJntSph.base); } - Collider_UpdateCylinder(&this->actor, &this->colliderCyl); - if ((this->colliderCyl.base.acFlags & AC_ON) && this->lightColor.a == 255) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCyl.base); + Collider_UpdateCylinder(&this->actor, &this->colliderCylinder); + if ((this->colliderCylinder.base.acFlags & AC_ON) && this->lightColor.a == 255) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder.base); } - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCyl.base); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderSph.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderJntSph.base); Actor_SetFocus(&this->actor, 42.0f); if (this->actionFunc != func_80ADEECC && this->actionFunc != func_80ADF574) { if (this->actionFunc == func_80ADF894) { @@ -1044,7 +1059,7 @@ s32 EnPoh_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p void EnPoh_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfxP) { EnPoh* this = (EnPoh*)thisx; - Collider_UpdateSpheres(limbIndex, &this->colliderSph); + Collider_UpdateSpheres(limbIndex, &this->colliderJntSph); if (this->actionFunc == func_80ADF15C && this->unk_198 >= 2 && limbIndex == this->info->unk_7) { MATRIX_FINALIZE_AND_LOAD((*gfxP)++, play->state.gfxCtx, "../z_en_poh.c", 2460); gSPDisplayList((*gfxP)++, this->info->burnDisplayList); @@ -1060,9 +1075,9 @@ void EnPoh_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, this->actor.world.pos.y = this->unk_368.yw; this->actor.world.pos.z = this->unk_368.zw; } - Lights_PointGlowSetInfo(&this->lightInfo, this->colliderSph.elements[0].dim.worldSphere.center.x, - this->colliderSph.elements[0].dim.worldSphere.center.y, - this->colliderSph.elements[0].dim.worldSphere.center.z, this->envColor.r, + Lights_PointGlowSetInfo(&this->lightInfo, this->colliderJntSph.elements[0].dim.worldSphere.center.x, + this->colliderJntSph.elements[0].dim.worldSphere.center.y, + this->colliderJntSph.elements[0].dim.worldSphere.center.z, this->envColor.r, this->envColor.g, this->envColor.b, this->envColor.a * (200.0f / 255)); } } diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.h b/src/overlays/actors/ovl_En_Poh/z_en_poh.h index 749047b75f..7e7db7d997 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.h +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.h @@ -2,11 +2,12 @@ #define Z_EN_POH_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" +#include "z64light.h" struct EnPoh; -typedef void (*EnPohActionFunc)(struct EnPoh*, PlayState*); +typedef void (*EnPohActionFunc)(struct EnPoh*, struct PlayState*); typedef enum EnPohType { EN_POH_NORMAL, @@ -53,9 +54,9 @@ typedef struct EnPoh { /* 0x02A4 */ EnPohInfo* info; /* 0x02A8 */ LightNode* lightNode; /* 0x02AC */ LightInfo lightInfo; - /* 0x02BC */ ColliderCylinder colliderCyl; - /* 0x0308 */ ColliderJntSph colliderSph; - /* 0x0328 */ ColliderJntSphElement colliderSphItem; + /* 0x02BC */ ColliderCylinder colliderCylinder; + /* 0x0308 */ ColliderJntSph colliderJntSph; + /* 0x0328 */ ColliderJntSphElement colliderJntSphElements[1]; /* 0x0368 */ MtxF unk_368; } EnPoh; // size = 0x03A8 diff --git a/src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.c b/src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.c index 495046f95d..e984f316f7 100644 --- a/src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.c +++ b/src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.c @@ -5,6 +5,11 @@ */ #include "z_en_pu_box.h" + +#include "sfx.h" +#include "z_lib.h" +#include "z64play.h" + #include "assets/objects/object_pu_box/object_pu_box.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.h b/src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.h index 0aa0aaaf4b..cd15c66c18 100644 --- a/src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.h +++ b/src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.h @@ -2,7 +2,7 @@ #define Z_EN_PU_BOX_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnPubox; diff --git a/src/overlays/actors/ovl_En_Rd/z_en_rd.c b/src/overlays/actors/ovl_En_Rd/z_en_rd.c index d5766aaf9c..af9ed8f112 100644 --- a/src/overlays/actors/ovl_En_Rd/z_en_rd.c +++ b/src/overlays/actors/ovl_En_Rd/z_en_rd.c @@ -14,12 +14,12 @@ #include "rumble.h" #include "sfx.h" #include "sys_matrix.h" +#include "z_en_item00.h" #include "z_lib.h" #include "z64effect.h" #include "z64play.h" #include "z64player.h" - -#include "global.h" +#include "z64save.h" #include "assets/objects/object_rd/object_rd.h" diff --git a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c index 1fbcc178ad..856958e81e 100644 --- a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c +++ b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c @@ -7,7 +7,23 @@ #include "z_en_reeba.h" #include "overlays/actors/ovl_En_Encount1/z_en_encount1.h" + +#include "libc64/qrand.h" +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "rand.h" +#include "regs.h" +#include "sfx.h" #include "terminal.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64debug_display.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_reeba/object_reeba.h" #define FLAGS \ diff --git a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.h b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.h index 36173bf355..a357af86ef 100644 --- a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.h +++ b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.h @@ -2,11 +2,11 @@ #define Z_EN_REEBA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnReeba; -typedef void (*EnReebaActionFunc)(struct EnReeba*, PlayState*); +typedef void (*EnReebaActionFunc)(struct EnReeba*, struct PlayState*); typedef struct EnReeba { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c b/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c index a3861adec4..871cf6668f 100644 --- a/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c +++ b/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c @@ -6,6 +6,15 @@ #include "z_en_river_sound.h" +#include "segmented_address.h" +#include "sequence.h" +#include "sfx.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) void EnRiverSound_Init(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.h b/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.h index c647185217..4332af6021 100644 --- a/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.h +++ b/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.h @@ -2,7 +2,7 @@ #define Z_EN_RIVER_SOUND_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnRiverSound; diff --git a/src/overlays/actors/ovl_En_Rl/z_en_rl.c b/src/overlays/actors/ovl_En_Rl/z_en_rl.c index 6d79ef6288..ff57761161 100644 --- a/src/overlays/actors/ovl_En_Rl/z_en_rl.c +++ b/src/overlays/actors/ovl_En_Rl/z_en_rl.c @@ -5,7 +5,19 @@ */ #include "z_en_rl.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "regs.h" +#include "segmented_address.h" #include "terminal.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_rl/object_rl.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -339,7 +351,8 @@ void EnRl_Update(Actor* thisx, PlayState* play) { EnRl* this = (EnRl*)thisx; if ((this->action < 0) || (this->action > 7) || (sActionFuncs[this->action] == NULL)) { - PRINTF(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The main mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } sActionFuncs[this->action](this, play); @@ -388,7 +401,8 @@ void EnRl_Draw(Actor* thisx, PlayState* play) { EnRl* this = (EnRl*)thisx; if (this->drawConfig < 0 || this->drawConfig >= 3 || sDrawFuncs[this->drawConfig] == NULL) { - PRINTF(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The drawing mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } sDrawFuncs[this->drawConfig](this, play); diff --git a/src/overlays/actors/ovl_En_Rl/z_en_rl.h b/src/overlays/actors/ovl_En_Rl/z_en_rl.h index 9aa6b9ae6c..9ce9949aa6 100644 --- a/src/overlays/actors/ovl_En_Rl/z_en_rl.h +++ b/src/overlays/actors/ovl_En_Rl/z_en_rl.h @@ -2,12 +2,12 @@ #define Z_EN_RL_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnRl; -typedef void (*EnRlActionFunc)(struct EnRl*, PlayState*); -typedef void (*EnRlDrawFunc)(struct EnRl*, PlayState*); +typedef void (*EnRlActionFunc)(struct EnRl*, struct PlayState*); +typedef void (*EnRlDrawFunc)(struct EnRl*, struct PlayState*); typedef struct EnRl { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.c b/src/overlays/actors/ovl_En_Rr/z_en_rr.c index ff67d09329..b4e136a75a 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -5,9 +5,26 @@ */ #include "z_en_rr.h" -#include "assets/objects/object_rr/object_rr.h" + +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "rand.h" +#include "rumble.h" +#include "sfx.h" +#include "sys_matrix.h" #include "terminal.h" #include "versions.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/object_rr/object_rr.h" #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.h b/src/overlays/actors/ovl_En_Rr/z_en_rr.h index 44ac232668..f0ed5b5c30 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.h +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.h @@ -2,11 +2,11 @@ #define Z_EN_RR_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnRr; -typedef void (*EnRrActionFunc)(struct EnRr*, PlayState*); +typedef void (*EnRrActionFunc)(struct EnRr*, struct PlayState*); typedef struct EnRrBodySegment { /* 0x00 */ f32 height; diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c index 3586ed73d7..85ef778479 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -5,11 +5,31 @@ */ #include "z_en_ru1.h" -#include "assets/objects/object_ru1/object_ru1.h" -#include "terminal.h" -#include "versions.h" #include "overlays/actors/ovl_Demo_Effect/z_demo_effect.h" +#include "libc64/math64.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "regs.h" +#include "segmented_address.h" +#include "seqcmd.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "terminal.h" +#include "translation.h" +#include "versions.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64face_reaction.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/object_ru1/object_ru1.h" + #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_CAN_PRESS_SWITCHES) void EnRu1_Init(Actor* thisx, PlayState* play); @@ -2249,8 +2269,8 @@ void EnRu1_Update(Actor* thisx, PlayState* play) { EnRu1* this = (EnRu1*)thisx; if (this->action < 0 || this->action >= ARRAY_COUNT(sActionFuncs) || sActionFuncs[this->action] == NULL) { - // "Main mode is improper!" - PRINTF(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The main mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } @@ -2403,8 +2423,8 @@ void EnRu1_Draw(Actor* thisx, PlayState* play) { EnRu1* this = (EnRu1*)thisx; if (this->drawConfig < 0 || this->drawConfig >= ARRAY_COUNT(sDrawFuncs) || sDrawFuncs[this->drawConfig] == NULL) { - // "Draw mode is improper!" - PRINTF(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The drawing mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } sDrawFuncs[this->drawConfig](this, play); diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h index 8223bfda43..8778174ef5 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h @@ -2,16 +2,16 @@ #define Z_EN_RU1_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" #include "overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" struct EnRu1; -typedef void (*EnRu1ActionFunc)(struct EnRu1*, PlayState*); -typedef void (*EnRu1DrawFunc)(struct EnRu1*, PlayState*); -typedef void (*EnRu1PreLimbDrawFunc)(struct EnRu1*, PlayState*, s32, Vec3s*); +typedef void (*EnRu1ActionFunc)(struct EnRu1*, struct PlayState*); +typedef void (*EnRu1DrawFunc)(struct EnRu1*, struct PlayState*); +typedef void (*EnRu1PreLimbDrawFunc)(struct EnRu1*, struct PlayState*, s32, Vec3s*); typedef struct EnRu1 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c index eff82bc1ec..b6c7405a03 100644 --- a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c +++ b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c @@ -5,9 +5,26 @@ */ #include "z_en_ru2.h" -#include "assets/objects/object_ru2/object_ru2.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" + +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "regs.h" +#include "segmented_address.h" +#include "sequence.h" +#include "sfx.h" #include "terminal.h" +#include "translation.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/object_ru2/object_ru2.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -686,8 +703,8 @@ void EnRu2_NextCreditsAction(EnRu2* this, PlayState* play) { EnRu2_SetupTurnHeadDownLeftAnimation(this); break; default: - // "There is no such action!" - PRINTF("En_Ru2_inEnding_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); + PRINTF(T("En_Ru2_inEnding_Check_DemoMode:そんな動作は無い!!!!!!!!\n", + "En_Ru2_inEnding_Check_DemoMode: There is no such action!!!!!!!!\n")); break; } this->cueId = nextCueId; @@ -907,8 +924,8 @@ void EnRu2_Update(Actor* thisx, PlayState* play) { EnRu2* this = (EnRu2*)thisx; if ((this->action < 0) || (this->action >= ARRAY_COUNT(sActionFuncs)) || (sActionFuncs[this->action] == NULL)) { - // "Main Mode is improper!" - PRINTF(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The main mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } sActionFuncs[this->action](this, play); @@ -968,8 +985,8 @@ void EnRu2_Draw(Actor* thisx, PlayState* play) { if ((this->drawConfig < 0) || (this->drawConfig >= ARRAY_COUNT(sDrawFuncs)) || (sDrawFuncs[this->drawConfig] == NULL)) { - // "Draw Mode is improper!" - PRINTF(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The drawing mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } sDrawFuncs[this->drawConfig](this, play); diff --git a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.h b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.h index 12333051b6..ca051d1800 100644 --- a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.h +++ b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.h @@ -2,15 +2,15 @@ #define Z_EN_RU2_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" #define ENRU2_GET_SWITCH_FLAG(thisx) PARAMS_GET_U(thisx->actor.params, 8, 8) #define ENRU2_GET_TYPE(thisx) PARAMS_GET_U(thisx->actor.params, 0, 8) struct EnRu2; -typedef void (*EnRu2ActionFunc)(struct EnRu2*, PlayState*); -typedef void (*EnRu2DrawFunc)(struct EnRu2*, PlayState*); +typedef void (*EnRu2ActionFunc)(struct EnRu2*, struct PlayState*); +typedef void (*EnRu2DrawFunc)(struct EnRu2*, struct PlayState*); typedef struct EnRu2 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Sa/z_en_sa.c b/src/overlays/actors/ovl_En_Sa/z_en_sa.c index b2543c317e..fb834576fb 100644 --- a/src/overlays/actors/ovl_En_Sa/z_en_sa.c +++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.c @@ -1,5 +1,17 @@ #include "z_en_sa.h" #include "overlays/actors/ovl_En_Elf/z_en_elf.h" + +#include "attributes.h" +#include "gfx.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64face_reaction.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_sa/object_sa.h" #include "assets/scenes/overworld/spot04/spot04_scene.h" #include "assets/scenes/overworld/spot05/spot05_scene.h" diff --git a/src/overlays/actors/ovl_En_Sa/z_en_sa.h b/src/overlays/actors/ovl_En_Sa/z_en_sa.h index 27c2c740f0..0132877731 100644 --- a/src/overlays/actors/ovl_En_Sa/z_en_sa.h +++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.h @@ -2,11 +2,11 @@ #define Z_EN_SA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnSa; -typedef void (*EnSaActionFunc)(struct EnSa*, PlayState*); +typedef void (*EnSaActionFunc)(struct EnSa*, struct PlayState*); typedef struct EnSa { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Sb/z_en_sb.c b/src/overlays/actors/ovl_En_Sb/z_en_sb.c index 647d321273..152f5ea753 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.c +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.c @@ -5,7 +5,18 @@ */ #include "z_en_sb.h" + +#include "attributes.h" +#include "ichain.h" +#include "printf.h" +#include "rand.h" +#include "sfx.h" #include "terminal.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/object_sb/object_sb.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE) diff --git a/src/overlays/actors/ovl_En_Sb/z_en_sb.h b/src/overlays/actors/ovl_En_Sb/z_en_sb.h index a6dbd2cdf8..f2f0e42adb 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.h +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.h @@ -2,11 +2,11 @@ #define Z_EN_SB_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnSb; -typedef void (*EnSbActionFunc)(struct EnSb*, PlayState*); +typedef void (*EnSbActionFunc)(struct EnSb*, struct PlayState*); typedef struct EnSb { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.c b/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.c index 26d322f9b5..425b30b8f4 100644 --- a/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.c +++ b/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.c @@ -6,6 +6,10 @@ #include "z_en_scene_change.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "z64play.h" + #define FLAGS 0 void EnSceneChange_Init(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.h b/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.h index 4add7d11ee..d1fcb16d90 100644 --- a/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.h +++ b/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.h @@ -2,11 +2,11 @@ #define Z_ITEM_SCENE_CHANGE_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnSceneChange; -typedef void (*EnSceneChangeActionFunc)(struct EnSceneChange*, PlayState*); +typedef void (*EnSceneChangeActionFunc)(struct EnSceneChange*, struct PlayState*); typedef struct EnSceneChange { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Sda/z_en_sda.c b/src/overlays/actors/ovl_En_Sda/z_en_sda.c index 62bd38cc11..7cec1579b8 100644 --- a/src/overlays/actors/ovl_En_Sda/z_en_sda.c +++ b/src/overlays/actors/ovl_En_Sda/z_en_sda.c @@ -6,6 +6,14 @@ #include "z_en_sda.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "regs.h" +#include "sys_matrix.h" +#include "z64play.h" +#include "z64player.h" + #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) void EnSda_Init(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Sda/z_en_sda.h b/src/overlays/actors/ovl_En_Sda/z_en_sda.h index 4dd2abd3a6..27cba99665 100644 --- a/src/overlays/actors/ovl_En_Sda/z_en_sda.h +++ b/src/overlays/actors/ovl_En_Sda/z_en_sda.h @@ -2,7 +2,7 @@ #define Z_EN_SDA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnSda; diff --git a/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c b/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c index 8eb853a808..4e082fcd47 100644 --- a/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c +++ b/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c @@ -5,6 +5,18 @@ */ #include "z_en_shopnuts.h" +#include "overlays/actors/ovl_En_Dns/z_en_dns.h" +#include "overlays/actors/ovl_En_Nutsball/z_en_nutsball.h" + +#include "gfx.h" +#include "ichain.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64save.h" + +#include "assets/objects/object_shopnuts/object_shopnuts.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE) diff --git a/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.h b/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.h index 33971269f7..8bea3a0a68 100644 --- a/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.h +++ b/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.h @@ -2,15 +2,14 @@ #define Z_EN_SHOPNUTS_H #include "ultra64.h" -#include "global.h" -#include "overlays/actors/ovl_En_Dns/z_en_dns.h" -#include "overlays/actors/ovl_En_Nutsball/z_en_nutsball.h" +#include "z64actor.h" +#include "assets/objects/object_shopnuts/object_shopnuts.h" struct EnShopnuts; #define SHOPNUTS_GET_TYPE(thisx) ((thisx)->params) -typedef void (*EnShopnutsActionFunc)(struct EnShopnuts*, PlayState*); +typedef void (*EnShopnutsActionFunc)(struct EnShopnuts*, struct PlayState*); typedef struct EnShopnuts { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Si/z_en_si.c b/src/overlays/actors/ovl_En_Si/z_en_si.c index 38735ea340..b5bf27be16 100644 --- a/src/overlays/actors/ovl_En_Si/z_en_si.c +++ b/src/overlays/actors/ovl_En_Si/z_en_si.c @@ -5,7 +5,14 @@ */ #include "z_en_si.h" + +#include "sequence.h" +#include "z_lib.h" +#include "z64audio.h" #include "z64draw.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOOKSHOT_PULLS_ACTOR) @@ -81,7 +88,7 @@ s32 func_80AFB748(EnSi* this, PlayState* play) { void func_80AFB768(EnSi* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { + if (ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { this->actionFunc = func_80AFB89C; } else { Math_SmoothStepToF(&this->actor.scale.x, 0.25f, 0.4f, 1.0f, 0.0f); @@ -114,7 +121,7 @@ void func_80AFB89C(EnSi* this, PlayState* play) { Actor_SetScale(&this->actor, this->actor.scale.x); this->actor.shape.rot.y += 0x400; - if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { + if (!ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_HOOKSHOT_ATTACHED)) { Item_Give(play, ITEM_SKULL_TOKEN); player->actor.freezeTimer = 10; Message_StartTextbox(play, 0xB4, NULL); diff --git a/src/overlays/actors/ovl_En_Si/z_en_si.h b/src/overlays/actors/ovl_En_Si/z_en_si.h index b52e831a30..a4ec863028 100644 --- a/src/overlays/actors/ovl_En_Si/z_en_si.h +++ b/src/overlays/actors/ovl_En_Si/z_en_si.h @@ -2,11 +2,11 @@ #define Z_EN_SI_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnSi; -typedef void (*EnSiActionFunc)(struct EnSi*, PlayState*); +typedef void (*EnSiActionFunc)(struct EnSi*, struct PlayState*); typedef struct EnSi { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c b/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c index 1a1093f229..ecdab8d5b2 100644 --- a/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c +++ b/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c @@ -5,6 +5,20 @@ */ #include "z_en_siofuki.h" + +#include "libc64/math64.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_siofuki/object_siofuki.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.h b/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.h index 23074bfac1..56a08bff6f 100644 --- a/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.h +++ b/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.h @@ -2,7 +2,7 @@ #define Z_EN_SIOFUKI_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" typedef enum EnSiofukiType { /* 0x00 */ EN_SIOFUKI_RAISING, @@ -11,7 +11,7 @@ typedef enum EnSiofukiType { struct EnSiofuki; -typedef void (*EnSiofukiActionFunc)(struct EnSiofuki*, PlayState*); +typedef void (*EnSiofukiActionFunc)(struct EnSiofuki*, struct PlayState*); typedef struct EnSiofuki { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.c b/src/overlays/actors/ovl_En_Skb/z_en_skb.c index 1a61fcfb9d..52e521df9c 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -6,6 +6,21 @@ #include "z_en_skb.h" #include "overlays/actors/ovl_En_Encount1/z_en_encount1.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "rand.h" +#include "sfx.h" +#include "sys_math.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_skb/object_skb.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED) @@ -168,7 +183,7 @@ void EnSkb_Init(Actor* thisx, PlayState* play) { this->actor.naviEnemyId = NAVI_ENEMY_STALCHILD; Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItem); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); Actor_SetScale(&this->actor, ((this->actor.params * 0.1f) + 1.0f) * 0.01f); this->collider.elements[0].dim.modelSphere.radius = this->collider.elements[0].dim.worldSphere.radius = diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.h b/src/overlays/actors/ovl_En_Skb/z_en_skb.h index 216b5848cc..dd96d9e16e 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.h +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.h @@ -2,11 +2,11 @@ #define Z_EN_SKB_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnSkb; -typedef void (*EnSkbActionFunc)(struct EnSkb*, PlayState*); +typedef void (*EnSkbActionFunc)(struct EnSkb*, struct PlayState*); typedef struct EnSkb { /* 0x0000 */ Actor actor; @@ -21,7 +21,7 @@ typedef struct EnSkb { /* 0x0288 */ s16 headlessYawOffset; /* 0x028C */ BodyBreak bodyBreak; /* 0x02A4 */ ColliderJntSph collider; - /* 0x02C4 */ ColliderJntSphElement colliderItem[2]; + /* 0x02C4 */ ColliderJntSphElement colliderElements[2]; } EnSkb; // size = 0x0344 #endif diff --git a/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/src/overlays/actors/ovl_En_Skj/z_en_skj.c index 2c576afbcb..52b1c4ae3f 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -1,5 +1,26 @@ #include "z_en_skj.h" #include "overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "rand.h" +#include "regs.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64debug_display.h" +#include "z64face_reaction.h" +#include "z64ocarina.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_skj/object_skj.h" #define FLAGS \ diff --git a/src/overlays/actors/ovl_En_Skj/z_en_skj.h b/src/overlays/actors/ovl_En_Skj/z_en_skj.h index dc0f97cc92..1d49c81c42 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.h +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.h @@ -2,11 +2,11 @@ #define Z_EN_SKJ_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnSkj; -typedef void (*EnSkjActionFunc)(struct EnSkj*, PlayState*); +typedef void (*EnSkjActionFunc)(struct EnSkj*, struct PlayState*); typedef struct EnSkj { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c b/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c index 0804263355..91e9273054 100644 --- a/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c +++ b/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c @@ -5,6 +5,13 @@ */ #include "z_en_skjneedle.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sys_matrix.h" +#include "z64play.h" + #include "assets/objects/object_skj/object_skj.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_HOOKSHOT_PULLS_ACTOR) diff --git a/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.h b/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.h index 1c4f444946..08ec8f4639 100644 --- a/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.h +++ b/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.h @@ -2,7 +2,7 @@ #define Z_EN_SKJNEEDLE_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnSkjneedle; diff --git a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c index 09b9df91c1..43a59dce46 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c @@ -1,4 +1,17 @@ #include "z_en_ssh.h" + +#include "array_count.h" +#include "gfx.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64face_reaction.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_ssh/object_ssh.h" #define FLAGS \ @@ -198,25 +211,25 @@ void EnSsh_InitColliders(EnSsh* this, PlayState* play) { s32 pad; for (i = 0; i < ARRAY_COUNT(cylinders); i++) { - Collider_InitCylinder(play, &this->colCylinder[i]); - Collider_SetCylinder(play, &this->colCylinder[i], &this->actor, cylinders[i]); + Collider_InitCylinder(play, &this->colliderCylinders[i]); + Collider_SetCylinder(play, &this->colliderCylinders[i], &this->actor, cylinders[i]); } - this->colCylinder[0].elem.acDmgInfo.dmgFlags = + this->colliderCylinders[0].elem.acDmgInfo.dmgFlags = DMG_ARROW | DMG_MAGIC_FIRE | DMG_HOOKSHOT | DMG_HAMMER_SWING | DMG_EXPLOSIVE | DMG_DEKU_NUT; - this->colCylinder[1].elem.acDmgInfo.dmgFlags = + this->colliderCylinders[1].elem.acDmgInfo.dmgFlags = DMG_DEFAULT & ~(DMG_ARROW | DMG_MAGIC_FIRE | DMG_HOOKSHOT | DMG_HAMMER_SWING | DMG_EXPLOSIVE | DMG_DEKU_NUT) & ~(DMG_MAGIC_LIGHT | DMG_MAGIC_ICE); - this->colCylinder[2].base.colMaterial = COL_MATERIAL_METAL; - this->colCylinder[2].elem.acElemFlags = ACELEM_ON | ACELEM_HOOKABLE | ACELEM_NO_AT_INFO; - this->colCylinder[2].elem.elemMaterial = ELEM_MATERIAL_UNK2; - this->colCylinder[2].elem.acDmgInfo.dmgFlags = + this->colliderCylinders[2].base.colMaterial = COL_MATERIAL_METAL; + this->colliderCylinders[2].elem.acElemFlags = ACELEM_ON | ACELEM_HOOKABLE | ACELEM_NO_AT_INFO; + this->colliderCylinders[2].elem.elemMaterial = ELEM_MATERIAL_UNK2; + this->colliderCylinders[2].elem.acDmgInfo.dmgFlags = DMG_DEFAULT & ~(DMG_ARROW | DMG_MAGIC_FIRE | DMG_HOOKSHOT | DMG_HAMMER_SWING | DMG_EXPLOSIVE | DMG_DEKU_NUT); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(2), &sColChkInfoInit); - Collider_InitJntSph(play, &this->colSph); - Collider_SetJntSph(play, &this->colSph, &this->actor, &sJntSphInit, this->colSphElements); + Collider_InitJntSph(play, &this->colliderJntSph); + Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElements); } f32 EnSsh_SetAnimation(EnSsh* this, s32 animIndex) { @@ -270,21 +283,21 @@ void EnSsh_SetColliderScale(EnSsh* this, f32 scale, f32 radiusMod) { f32 yShift; s32 i; - radius = this->colSph.elements[0].dim.modelSphere.radius; + radius = this->colliderJntSph.elements[0].dim.modelSphere.radius; radius *= scale; - this->colSph.elements[0].dim.modelSphere.radius = radius; + this->colliderJntSph.elements[0].dim.modelSphere.radius = radius; for (i = 0; i < 6; i++) { - yShift = this->colCylinder[i].dim.yShift; - radius = this->colCylinder[i].dim.radius; - height = this->colCylinder[i].dim.height; + yShift = this->colliderCylinders[i].dim.yShift; + radius = this->colliderCylinders[i].dim.radius; + height = this->colliderCylinders[i].dim.height; yShift *= scale; radius *= scale * radiusMod; height *= scale; - this->colCylinder[i].dim.yShift = yShift; - this->colCylinder[i].dim.radius = radius; - this->colCylinder[i].dim.height = height; + this->colliderCylinders[i].dim.yShift = yShift; + this->colliderCylinders[i].dim.radius = radius; + this->colliderCylinders[i].dim.height = height; } Actor_SetScale(&this->actor, 0.04f * scale); this->floorHeightOffset = 40.0f * scale; @@ -436,17 +449,17 @@ void EnSsh_Sway(EnSsh* this) { } void EnSsh_CheckBodyStickHit(EnSsh* this, PlayState* play) { - ColliderElement* elem = &this->colCylinder[0].elem; + ColliderElement* elem = &this->colliderCylinders[0].elem; Player* player = GET_PLAYER(play); if (player->unk_860 != 0) { elem->acDmgInfo.dmgFlags |= DMG_DEKU_STICK; - this->colCylinder[1].elem.acDmgInfo.dmgFlags &= ~DMG_DEKU_STICK; - this->colCylinder[2].elem.acDmgInfo.dmgFlags &= ~DMG_DEKU_STICK; + this->colliderCylinders[1].elem.acDmgInfo.dmgFlags &= ~DMG_DEKU_STICK; + this->colliderCylinders[2].elem.acDmgInfo.dmgFlags &= ~DMG_DEKU_STICK; } else { elem->acDmgInfo.dmgFlags &= ~DMG_DEKU_STICK; - this->colCylinder[1].elem.acDmgInfo.dmgFlags |= DMG_DEKU_STICK; - this->colCylinder[2].elem.acDmgInfo.dmgFlags |= DMG_DEKU_STICK; + this->colliderCylinders[1].elem.acDmgInfo.dmgFlags |= DMG_DEKU_STICK; + this->colliderCylinders[2].elem.acDmgInfo.dmgFlags |= DMG_DEKU_STICK; } } @@ -458,8 +471,8 @@ s32 EnSsh_CheckHitPlayer(EnSsh* this, PlayState* play) { return false; } for (i = 0; i < 3; i++) { - if (this->colCylinder[i + 3].base.ocFlags2 & OC2_HIT_PLAYER) { - this->colCylinder[i + 3].base.ocFlags2 &= ~OC2_HIT_PLAYER; + if (this->colliderCylinders[i + 3].base.ocFlags2 & OC2_HIT_PLAYER) { + this->colliderCylinders[i + 3].base.ocFlags2 &= ~OC2_HIT_PLAYER; hit = true; } } @@ -481,13 +494,13 @@ s32 EnSsh_CheckHitPlayer(EnSsh* this, PlayState* play) { s32 EnSsh_CheckHitFront(EnSsh* this) { u32 acFlags; - if (this->colCylinder[2].base.acFlags) {} // Needed for matching - acFlags = this->colCylinder[2].base.acFlags; + if (this->colliderCylinders[2].base.acFlags) {} // Needed for matching + acFlags = this->colliderCylinders[2].base.acFlags; if (!!(acFlags & AC_HIT) == 0) { return 0; } else { - this->colCylinder[2].base.acFlags &= ~AC_HIT; + this->colliderCylinders[2].base.acFlags &= ~AC_HIT; this->invincibilityTimer = 8; if ((this->swayTimer == 0) && (this->hitTimer == 0) && (this->stunTimer == 0)) { this->swayTimer = 60; @@ -497,14 +510,14 @@ s32 EnSsh_CheckHitFront(EnSsh* this) { } s32 EnSsh_CheckHitBack(EnSsh* this, PlayState* play) { - ColliderCylinder* cyl = &this->colCylinder[0]; + ColliderCylinder* cyl = &this->colliderCylinders[0]; s32 hit = false; if (cyl->base.acFlags & AC_HIT) { cyl->base.acFlags &= ~AC_HIT; hit = true; } - cyl = &this->colCylinder[1]; + cyl = &this->colliderCylinders[1]; if (cyl->base.acFlags & AC_HIT) { cyl->base.acFlags &= ~AC_HIT; hit = true; @@ -547,19 +560,19 @@ s32 EnSsh_CollisionCheck(EnSsh* this, PlayState* play) { } void EnSsh_SetBodyCylinderAC(EnSsh* this, PlayState* play) { - Collider_UpdateCylinder(&this->actor, &this->colCylinder[0]); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCylinder[0].base); + Collider_UpdateCylinder(&this->actor, &this->colliderCylinders[0]); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinders[0].base); } void EnSsh_SetLegsCylinderAC(EnSsh* this, PlayState* play) { s16 angleTowardsLink = ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)); if (angleTowardsLink < 90 * (0x10000 / 360)) { - Collider_UpdateCylinder(&this->actor, &this->colCylinder[2]); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCylinder[2].base); + Collider_UpdateCylinder(&this->actor, &this->colliderCylinders[2]); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinders[2].base); } else { - Collider_UpdateCylinder(&this->actor, &this->colCylinder[1]); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCylinder[1].base); + Collider_UpdateCylinder(&this->actor, &this->colliderCylinders[1]); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinders[1].base); } } @@ -582,18 +595,18 @@ s32 EnSsh_SetCylinderOC(EnSsh* this, PlayState* play) { Matrix_RotateY(BINANG_TO_RAD_ALT(this->initialYaw), MTXMODE_APPLY); Matrix_MultVec3f(&cyloffsets[i], &cylPos); Matrix_Pop(); - this->colCylinder[i + 3].dim.pos.x = cylPos.x; - this->colCylinder[i + 3].dim.pos.y = cylPos.y; - this->colCylinder[i + 3].dim.pos.z = cylPos.z; - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colCylinder[i + 3].base); + this->colliderCylinders[i + 3].dim.pos.x = cylPos.x; + this->colliderCylinders[i + 3].dim.pos.y = cylPos.y; + this->colliderCylinders[i + 3].dim.pos.z = cylPos.z; + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinders[i + 3].base); } return 1; } void EnSsh_SetColliders(EnSsh* this, PlayState* play) { if (this->actor.colChkInfo.health == 0) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->colSph.base); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colSph.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderJntSph.base); } else { if (this->hitTimer == 0) { EnSsh_SetCylinderOC(this, play); @@ -645,9 +658,9 @@ void EnSsh_Destroy(Actor* thisx, PlayState* play) { Effect_Delete(play, this->blureIdx); for (i = 0; i < 6; i++) { - Collider_DestroyCylinder(play, &this->colCylinder[i]); + Collider_DestroyCylinder(play, &this->colliderCylinders[i]); } - Collider_DestroyJntSph(play, &this->colSph); + Collider_DestroyJntSph(play, &this->colliderJntSph); } void EnSsh_Wait(EnSsh* this, PlayState* play) { @@ -869,7 +882,7 @@ s32 EnSsh_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p void EnSsh_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnSsh* this = (EnSsh*)thisx; - Collider_UpdateSpheres(limbIndex, &this->colSph); + Collider_UpdateSpheres(limbIndex, &this->colliderJntSph); } void EnSsh_Draw(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h index 3060fb6fb7..741770cec5 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.h @@ -2,11 +2,11 @@ #define Z_EN_SSH_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnSsh; -typedef void (*EnSshActionFunc)(struct EnSsh*, PlayState*); +typedef void (*EnSshActionFunc)(struct EnSsh*, struct PlayState*); typedef struct EnSsh { /* 0x0000 */ Actor actor; @@ -14,9 +14,9 @@ typedef struct EnSsh { /* 0x0190 */ Vec3s jointTable[30]; /* 0x0244 */ Vec3s morphTable[30]; /* 0x02F8 */ EnSshActionFunc actionFunc; - /* 0x02FC */ ColliderCylinder colCylinder[6]; - /* 0x04C4 */ ColliderJntSph colSph; - /* 0x04E4 */ ColliderJntSphElement colSphElements[1]; + /* 0x02FC */ ColliderCylinder colliderCylinders[6]; + /* 0x04C4 */ ColliderJntSph colliderJntSph; + /* 0x04E4 */ ColliderJntSphElement colliderJntSphElements[1]; /* 0x0524 */ s16 initialYaw; /* 0x0526 */ s16 maxTurnRate; /* 0x0528 */ s16 unkTimer; diff --git a/src/overlays/actors/ovl_En_St/z_en_st.c b/src/overlays/actors/ovl_En_St/z_en_st.c index d7b6a20e50..7f8bf6497a 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.c +++ b/src/overlays/actors/ovl_En_St/z_en_st.c @@ -5,6 +5,19 @@ */ #include "z_en_st.h" + +#include "libc64/qrand.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_st/object_st.h" #define FLAGS \ @@ -283,58 +296,58 @@ void EnSt_InitColliders(EnSt* this, PlayState* play) { s32 pad; for (i = 0; i < ARRAY_COUNT(cylinders); i++) { - Collider_InitCylinder(play, &this->colCylinder[i]); - Collider_SetCylinder(play, &this->colCylinder[i], &this->actor, cylinders[i]); + Collider_InitCylinder(play, &this->colliderCylinders[i]); + Collider_SetCylinder(play, &this->colliderCylinders[i], &this->actor, cylinders[i]); } - this->colCylinder[0].elem.acDmgInfo.dmgFlags = + this->colliderCylinders[0].elem.acDmgInfo.dmgFlags = DMG_MAGIC_FIRE | DMG_ARROW | DMG_HOOKSHOT | DMG_HAMMER_SWING | DMG_BOOMERANG | DMG_EXPLOSIVE | DMG_DEKU_NUT; - this->colCylinder[1].elem.acDmgInfo.dmgFlags = + this->colliderCylinders[1].elem.acDmgInfo.dmgFlags = DMG_DEFAULT & ~(DMG_MAGIC_FIRE | DMG_ARROW | DMG_HOOKSHOT | DMG_HAMMER_SWING | DMG_BOOMERANG | DMG_EXPLOSIVE | DMG_DEKU_NUT) & ~(DMG_MAGIC_LIGHT | DMG_MAGIC_ICE); - this->colCylinder[2].base.colMaterial = COL_MATERIAL_METAL; - this->colCylinder[2].elem.acElemFlags = ACELEM_ON | ACELEM_HOOKABLE | ACELEM_NO_AT_INFO; - this->colCylinder[2].elem.elemMaterial = ELEM_MATERIAL_UNK2; - this->colCylinder[2].elem.acDmgInfo.dmgFlags = + this->colliderCylinders[2].base.colMaterial = COL_MATERIAL_METAL; + this->colliderCylinders[2].elem.acElemFlags = ACELEM_ON | ACELEM_HOOKABLE | ACELEM_NO_AT_INFO; + this->colliderCylinders[2].elem.elemMaterial = ELEM_MATERIAL_UNK2; + this->colliderCylinders[2].elem.acDmgInfo.dmgFlags = DMG_DEFAULT & ~(DMG_MAGIC_FIRE | DMG_ARROW | DMG_HOOKSHOT | DMG_HAMMER_SWING | DMG_BOOMERANG | DMG_EXPLOSIVE | DMG_DEKU_NUT); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(2), &sColChkInit); - Collider_InitJntSph(play, &this->colSph); - Collider_SetJntSph(play, &this->colSph, &this->actor, &sJntSphInit, this->colSphItems); + Collider_InitJntSph(play, &this->colliderJntSph); + Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElements); } void EnSt_CheckBodyStickHit(EnSt* this, PlayState* play) { - ColliderElement* bodyElem = &this->colCylinder[0].elem; + ColliderElement* bodyElem = &this->colliderCylinders[0].elem; Player* player = GET_PLAYER(play); if (player->unk_860 != 0) { bodyElem->acDmgInfo.dmgFlags |= DMG_DEKU_STICK; - this->colCylinder[1].elem.acDmgInfo.dmgFlags &= ~DMG_DEKU_STICK; - this->colCylinder[2].elem.acDmgInfo.dmgFlags &= ~DMG_DEKU_STICK; + this->colliderCylinders[1].elem.acDmgInfo.dmgFlags &= ~DMG_DEKU_STICK; + this->colliderCylinders[2].elem.acDmgInfo.dmgFlags &= ~DMG_DEKU_STICK; } else { bodyElem->acDmgInfo.dmgFlags &= ~DMG_DEKU_STICK; - this->colCylinder[1].elem.acDmgInfo.dmgFlags |= DMG_DEKU_STICK; - this->colCylinder[2].elem.acDmgInfo.dmgFlags |= DMG_DEKU_STICK; + this->colliderCylinders[1].elem.acDmgInfo.dmgFlags |= DMG_DEKU_STICK; + this->colliderCylinders[2].elem.acDmgInfo.dmgFlags |= DMG_DEKU_STICK; } } void EnSt_SetBodyCylinderAC(EnSt* this, PlayState* play) { - Collider_UpdateCylinder(&this->actor, &this->colCylinder[0]); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCylinder[0].base); + Collider_UpdateCylinder(&this->actor, &this->colliderCylinders[0]); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinders[0].base); } void EnSt_SetLegsCylinderAC(EnSt* this, PlayState* play) { s16 angleTowardsLink = ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)); if (angleTowardsLink < 0x3FFC) { - Collider_UpdateCylinder(&this->actor, &this->colCylinder[2]); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCylinder[2].base); + Collider_UpdateCylinder(&this->actor, &this->colliderCylinders[2]); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinders[2].base); } else { - Collider_UpdateCylinder(&this->actor, &this->colCylinder[1]); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colCylinder[1].base); + Collider_UpdateCylinder(&this->actor, &this->colliderCylinders[1]); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinders[1].base); } } @@ -357,10 +370,10 @@ s32 EnSt_SetCylinderOC(EnSt* this, PlayState* play) { Matrix_RotateY(BINANG_TO_RAD_ALT(this->initialYaw), MTXMODE_APPLY); Matrix_MultVec3f(&cyloffsets[i], &cylPos); Matrix_Pop(); - this->colCylinder[i + 3].dim.pos.x = cylPos.x; - this->colCylinder[i + 3].dim.pos.y = cylPos.y; - this->colCylinder[i + 3].dim.pos.z = cylPos.z; - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colCylinder[i + 3].base); + this->colliderCylinders[i + 3].dim.pos.x = cylPos.x; + this->colliderCylinders[i + 3].dim.pos.y = cylPos.y; + this->colliderCylinders[i + 3].dim.pos.z = cylPos.z; + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinders[i + 3].base); } return true; @@ -388,10 +401,10 @@ s32 EnSt_CheckHitPlayer(EnSt* this, PlayState* play) { s32 i; for (i = 0, hit = 0; i < 3; i++) { - if (((this->colCylinder[i + 3].base.ocFlags2 & OC2_HIT_PLAYER) != 0) == 0) { + if (((this->colliderCylinders[i + 3].base.ocFlags2 & OC2_HIT_PLAYER) != 0) == 0) { continue; } - this->colCylinder[i + 3].base.ocFlags2 &= ~OC2_HIT_PLAYER; + this->colliderCylinders[i + 3].base.ocFlags2 &= ~OC2_HIT_PLAYER; hit = true; } @@ -411,13 +424,13 @@ s32 EnSt_CheckHitPlayer(EnSt* this, PlayState* play) { } s32 EnSt_CheckHitFrontside(EnSt* this) { - u8 acFlags = this->colCylinder[2].base.acFlags; + u8 acFlags = this->colliderCylinders[2].base.acFlags; if (!!(acFlags & AC_HIT) == 0) { // not hit return false; } else { - this->colCylinder[2].base.acFlags &= ~AC_HIT; + this->colliderCylinders[2].base.acFlags &= ~AC_HIT; this->invulnerableTimer = 8; this->playSwayFlag = 0; this->swayTimer = 60; @@ -426,7 +439,7 @@ s32 EnSt_CheckHitFrontside(EnSt* this) { } s32 EnSt_CheckHitBackside(EnSt* this, PlayState* play) { - ColliderCylinder* cyl = &this->colCylinder[0]; + ColliderCylinder* cyl = &this->colliderCylinders[0]; s32 flags = 0; // damage flags from colliders 0 and 1 s32 hit = false; @@ -436,7 +449,7 @@ s32 EnSt_CheckHitBackside(EnSt* this, PlayState* play) { flags |= cyl->elem.acHitElem->atDmgInfo.dmgFlags; } - cyl = &this->colCylinder[1]; + cyl = &this->colliderCylinders[1]; if (cyl->base.acFlags & AC_HIT) { cyl->base.acFlags &= ~AC_HIT; hit = true; @@ -521,21 +534,21 @@ void EnSt_SetColliderScale(EnSt* this) { scaleAmount = 1.4f; } - radius = this->colSph.elements[0].dim.modelSphere.radius; + radius = this->colliderJntSph.elements[0].dim.modelSphere.radius; radius *= scaleAmount; - this->colSph.elements[0].dim.modelSphere.radius = radius; + this->colliderJntSph.elements[0].dim.modelSphere.radius = radius; for (i = 0; i < 6; i++) { - yShift = this->colCylinder[i].dim.yShift; - radius = this->colCylinder[i].dim.radius; - height = this->colCylinder[i].dim.height; + yShift = this->colliderCylinders[i].dim.yShift; + radius = this->colliderCylinders[i].dim.radius; + height = this->colliderCylinders[i].dim.height; yShift *= scaleAmount; radius *= scaleAmount; height *= scaleAmount; - this->colCylinder[i].dim.yShift = yShift; - this->colCylinder[i].dim.radius = radius; - this->colCylinder[i].dim.height = height; + this->colliderCylinders[i].dim.yShift = yShift; + this->colliderCylinders[i].dim.radius = radius; + this->colliderCylinders[i].dim.height = height; } Actor_SetScale(&this->actor, 0.04f * scaleAmount); this->colliderScale = scaleAmount; @@ -816,9 +829,9 @@ void EnSt_Destroy(Actor* thisx, PlayState* play) { Effect_Delete(play, this->blureIdx); for (i = 0; i < 6; i++) { - Collider_DestroyCylinder(play, &this->colCylinder[i]); + Collider_DestroyCylinder(play, &this->colliderCylinders[i]); } - Collider_DestroyJntSph(play, &this->colSph); + Collider_DestroyJntSph(play, &this->colliderJntSph); } void EnSt_WaitOnCeiling(EnSt* this, PlayState* play) { @@ -1085,7 +1098,7 @@ s32 EnSt_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dListP, Vec3f* p void EnSt_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dListP, Vec3s* rot, void* thisx) { EnSt* this = (EnSt*)thisx; - Collider_UpdateSpheres(limbIndex, &this->colSph); + Collider_UpdateSpheres(limbIndex, &this->colliderJntSph); } void EnSt_Draw(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_St/z_en_st.h b/src/overlays/actors/ovl_En_St/z_en_st.h index 4200ca0d32..08e9e8bd8d 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.h +++ b/src/overlays/actors/ovl_En_St/z_en_st.h @@ -2,19 +2,19 @@ #define Z_EN_ST_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnSt; -typedef void (*EnStActionFunc)(struct EnSt* this, PlayState* play); +typedef void (*EnStActionFunc)(struct EnSt* this, struct PlayState* play); typedef struct EnSt { /* 0x0000 */ Actor actor; /* 0x014C */ SkelAnime skelAnime; /* 0x0190 */ EnStActionFunc actionFunc; - /* 0x0194 */ ColliderCylinder colCylinder[6]; - /* 0x035C */ ColliderJntSph colSph; - /* 0x037C */ ColliderJntSphElement colSphItems[1]; + /* 0x0194 */ ColliderCylinder colliderCylinders[6]; + /* 0x035C */ ColliderJntSph colliderJntSph; + /* 0x037C */ ColliderJntSphElement colliderJntSphElements[1]; /* 0x03BC */ s16 initialYaw; /* 0x03BE */ s16 deathYawTarget; /* 0x03C0 */ s16 groundBounces; diff --git a/src/overlays/actors/ovl_En_Sth/z_en_sth.c b/src/overlays/actors/ovl_En_Sth/z_en_sth.c index ac10651812..9eb1679a56 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.c +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.c @@ -4,8 +4,18 @@ * Description: Uncursed House of Skulltula People */ -#include "terminal.h" #include "z_en_sth.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "segmented_address.h" +#include "sys_matrix.h" +#include "terminal.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_ahg/object_ahg.h" #include "assets/objects/object_boj/object_boj.h" @@ -148,7 +158,7 @@ void EnSth_SetupAfterObjectLoaded(EnSth* this, PlayState* play) { s16* params; EnSth_SetupShapeColliderUpdate2AndDraw(this, play); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); SkelAnime_InitFlex(play, &this->skelAnime, sSkeletons[this->actor.params], NULL, this->jointTable, this->morphTable, 16); Animation_PlayLoop(&this->skelAnime, sAnimations[this->actor.params]); @@ -391,7 +401,7 @@ void EnSth_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_sth.c", 2133); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment); Gfx_SetupDL_37Opa(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, diff --git a/src/overlays/actors/ovl_En_Sth/z_en_sth.h b/src/overlays/actors/ovl_En_Sth/z_en_sth.h index 9408c542dd..a135fea2aa 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.h +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.h @@ -2,11 +2,11 @@ #define Z_EN_STH_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnSth; -typedef void (*EnSthActionFunc)(struct EnSth*, PlayState*); +typedef void (*EnSthActionFunc)(struct EnSth*, struct PlayState*); typedef struct EnSth { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Stream/z_en_stream.c b/src/overlays/actors/ovl_En_Stream/z_en_stream.c index dc73048393..118328e793 100644 --- a/src/overlays/actors/ovl_En_Stream/z_en_stream.c +++ b/src/overlays/actors/ovl_En_Stream/z_en_stream.c @@ -5,6 +5,17 @@ */ #include "z_en_stream.h" + +#include "libc64/math64.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_stream/object_stream.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_En_Stream/z_en_stream.h b/src/overlays/actors/ovl_En_Stream/z_en_stream.h index 199d1c6797..0a21d54d84 100644 --- a/src/overlays/actors/ovl_En_Stream/z_en_stream.h +++ b/src/overlays/actors/ovl_En_Stream/z_en_stream.h @@ -2,11 +2,11 @@ #define Z_EN_STREAM_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnStream; -typedef void (*EnStreamActionFunc)(struct EnStream*, PlayState*); +typedef void (*EnStreamActionFunc)(struct EnStream*, struct PlayState*); typedef struct EnStream { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/src/overlays/actors/ovl_En_Sw/z_en_sw.c index b9b6b47c94..8e10154c10 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -1,4 +1,20 @@ #include "z_en_sw.h" + +#include "libc64/math64.h" +#include "libc64/qrand.h" +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sfx.h" +#include "sys_math3d.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_st/object_st.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED) @@ -32,7 +48,7 @@ ActorProfile En_Sw_Profile = { /**/ EnSw_Draw, }; -static ColliderJntSphElementInit sJntSphItemsInit[1] = { +static ColliderJntSphElementInit sJntSphElementsInit[1] = { { { ELEM_MATERIAL_UNK0, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFC3FFFE, 0x00, 0x00 }, 0x01, 0x05, 0x01 }, { 2, { { 0, -300, 0 }, 21 }, 100 }, @@ -42,7 +58,7 @@ static ColliderJntSphElementInit sJntSphItemsInit[1] = { static ColliderJntSphInit sJntSphInit = { { COL_MATERIAL_HIT6, 0x11, 0x09, 0x39, 0x10, COLSHAPE_JNTSPH }, 1, - sJntSphItemsInit, + sJntSphElementsInit, }; static CollisionCheckInfoInit2 D_80B0F074 = { 1, 2, 25, 25, MASS_IMMOVABLE }; @@ -240,7 +256,7 @@ void EnSw_Init(Actor* thisx, PlayState* play) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENSW_ANIM_0); ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f); Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->sphs); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0xE), &D_80B0F074); this->actor.scale.x = 0.02f; diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.h b/src/overlays/actors/ovl_En_Sw/z_en_sw.h index c766e9f9e9..fe68092667 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.h +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.h @@ -2,18 +2,18 @@ #define Z_EN_SW_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnSw; -typedef void (*EnSwActionFunc)(struct EnSw* this, PlayState* play); +typedef void (*EnSwActionFunc)(struct EnSw* this, struct PlayState* play); typedef struct EnSw { /* 0x0000 */ Actor actor; /* 0x014C */ SkelAnime skelAnime; /* 0x0190 */ EnSwActionFunc actionFunc; /* 0x0194 */ ColliderJntSph collider; - /* 0x01B4 */ ColliderJntSphElement sphs[1]; + /* 0x01B4 */ ColliderJntSphElement colliderElements[1]; /* 0x01F4 */ Color_RGBA8 unk_1F4; /* 0x01F8 */ Vec3s jointTable[30]; /* 0x02AC */ Vec3s morphTable[30]; @@ -34,7 +34,7 @@ typedef struct EnSw { /* 0x0420 */ f32 unk_420; /* 0x0424 */ char unk_424[0x8]; /* 0x042C */ u8 unk_42C; - /* 0x0430 */ CollisionPoly* unk_430; + /* 0x0430 */ struct CollisionPoly* unk_430; /* 0x0434 */ Vec3f unk_434; /* 0x0440 */ s16 unk_440; /* 0x0442 */ s16 unk_442; diff --git a/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c b/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c index ed7d99541f..e409e9c246 100644 --- a/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c +++ b/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c @@ -1,9 +1,19 @@ #include "z_en_syateki_itm.h" -#include "terminal.h" #include "overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h" #include "overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.h" #include "overlays/actors/ovl_En_G_Switch/z_en_g_switch.h" +#include "printf.h" +#include "rand.h" +#include "regs.h" +#include "sfx.h" +#include "terminal.h" +#include "z_lib.h" +#include "z64debug_display.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED typedef enum EnSyatekItemRound { diff --git a/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.h b/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.h index c670208bec..46f54b7c79 100644 --- a/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.h +++ b/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.h @@ -2,11 +2,11 @@ #define Z_EN_SYATEKI_ITM_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnSyatekiItm; -typedef void (*EnSyatekiItmActionFunc)(struct EnSyatekiItm*, PlayState*); +typedef void (*EnSyatekiItmActionFunc)(struct EnSyatekiItm*, struct PlayState*); typedef enum EnSyatekiSignal { /* 0 */ ENSYATEKI_NONE, diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c index 5575182fe6..f2744b5d57 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c @@ -1,6 +1,19 @@ #include "z_en_syateki_man.h" -#include "terminal.h" #include "overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "regs.h" +#include "seqcmd.h" +#include "sequence.h" +#include "terminal.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_ossan/object_ossan.h" #define FLAGS \ diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h index eea46817ff..306c33104f 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h @@ -2,11 +2,11 @@ #define Z_EN_SYATEKI_MAN_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnSyatekiMan; -typedef void (*EnSyatekiManActionFunc) (struct EnSyatekiMan*, PlayState*); +typedef void (*EnSyatekiManActionFunc) (struct EnSyatekiMan*, struct PlayState*); typedef void (*EnSyatekiManOtherFunc) (struct EnSyatekiMan*); typedef struct EnSyatekiMan { diff --git a/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c b/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c index a55d234477..970ebb32d3 100644 --- a/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c +++ b/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c @@ -10,6 +10,7 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" +#include "printf.h" #include "rand.h" #include "sfx.h" #include "sys_matrix.h" @@ -18,8 +19,8 @@ #include "z64effect.h" #include "z64play.h" #include "z64player.h" +#include "z64save.h" -#include "z64.h" #include "assets/objects/object_niw/object_niw.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_En_Ta/z_en_ta.c b/src/overlays/actors/ovl_En_Ta/z_en_ta.c index bea60cf889..68335d64b2 100644 --- a/src/overlays/actors/ovl_En_Ta/z_en_ta.c +++ b/src/overlays/actors/ovl_En_Ta/z_en_ta.c @@ -5,7 +5,28 @@ */ #include "z_en_ta.h" +#include "overlays/actors/ovl_En_Niw/z_en_niw.h" + +#include "libc64/qrand.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "rand.h" +#include "segmented_address.h" +#include "seqcmd.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" #include "terminal.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64face_reaction.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_ta/object_ta.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY) diff --git a/src/overlays/actors/ovl_En_Ta/z_en_ta.h b/src/overlays/actors/ovl_En_Ta/z_en_ta.h index eeab7dc775..d230c2b757 100644 --- a/src/overlays/actors/ovl_En_Ta/z_en_ta.h +++ b/src/overlays/actors/ovl_En_Ta/z_en_ta.h @@ -2,13 +2,11 @@ #define Z_EN_TA_H #include "ultra64.h" -#include "global.h" - -#include "overlays/actors/ovl_En_Niw/z_en_niw.h" +#include "z64actor.h" struct EnTa; -typedef void (*EnTaActionFunc)(struct EnTa*, PlayState*); +typedef void (*EnTaActionFunc)(struct EnTa*, struct PlayState*); typedef void (*EnTaBlinkFunc)(struct EnTa*); typedef void (*EnTaAnimFunc)(struct EnTa*); @@ -50,7 +48,7 @@ typedef struct EnTa { /* 0x02B0 */ EnTaBlinkFunc blinkFunc; /* 0x02B4 */ s16 eyeIndex; /* 0x02B6 */ s16 blinkTimer; - /* 0x02B8 */ EnNiw* superCuccos[3]; + /* 0x02B8 */ struct EnNiw* superCuccos[3]; /* 0x02C4 */ s16 superCuccoTimers[3]; // This is used to time animations and actions for super-cuccos /* 0x02CA */ u8 lastFoundSuperCuccoIdx; /* 0x02CC */ s16 timer; diff --git a/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c b/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c index bcc60b5f1a..8d51dae459 100644 --- a/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c +++ b/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c @@ -5,8 +5,17 @@ */ #include "z_en_takara_man.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "rand.h" +#include "segmented_address.h" #include "terminal.h" #include "versions.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_ts/object_ts.h" #define FLAGS \ diff --git a/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.h b/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.h index 48898909bc..e7d51c4b07 100644 --- a/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.h +++ b/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.h @@ -2,11 +2,11 @@ #define Z_EN_TAKARA_MAN_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnTakaraMan; -typedef void (*EnTakaraManActionFunc)(struct EnTakaraMan*, PlayState*); +typedef void (*EnTakaraManActionFunc)(struct EnTakaraMan*, struct PlayState*); typedef struct EnTakaraMan { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Tana/z_en_tana.c b/src/overlays/actors/ovl_En_Tana/z_en_tana.c index 866329c2ab..ddb9e8d8d9 100644 --- a/src/overlays/actors/ovl_En_Tana/z_en_tana.c +++ b/src/overlays/actors/ovl_En_Tana/z_en_tana.c @@ -5,6 +5,14 @@ */ #include "z_en_tana.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "segmented_address.h" +#include "sys_matrix.h" +#include "z64play.h" + #include "assets/objects/object_shop_dungen/object_shop_dungen.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY) diff --git a/src/overlays/actors/ovl_En_Tana/z_en_tana.h b/src/overlays/actors/ovl_En_Tana/z_en_tana.h index 763d1303c6..1804bcd798 100644 --- a/src/overlays/actors/ovl_En_Tana/z_en_tana.h +++ b/src/overlays/actors/ovl_En_Tana/z_en_tana.h @@ -2,7 +2,7 @@ #define Z_EN_TANA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnTana; diff --git a/src/overlays/actors/ovl_En_Test/z_en_test.c b/src/overlays/actors/ovl_En_Test/z_en_test.c index c8257aa85e..61628f342c 100644 --- a/src/overlays/actors/ovl_En_Test/z_en_test.c +++ b/src/overlays/actors/ovl_En_Test/z_en_test.c @@ -13,13 +13,13 @@ #include "ichain.h" #include "sfx.h" #include "sys_matrix.h" +#include "z_en_item00.h" #include "z_lib.h" #include "z64audio.h" #include "z64effect.h" #include "z64play.h" #include "z64player.h" -#include "global.h" #include "assets/objects/object_sk2/object_sk2.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED) @@ -1853,7 +1853,7 @@ s32 EnTest_OverrideLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3f* } if ((this->actor.params == STALFOS_TYPE_INVISIBLE) && - !CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { + !ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_REACT_TO_LENS)) { *dList = NULL; } diff --git a/src/overlays/actors/ovl_En_Tg/z_en_tg.c b/src/overlays/actors/ovl_En_Tg/z_en_tg.c index 42f32f0eb7..1fc830181b 100644 --- a/src/overlays/actors/ovl_En_Tg/z_en_tg.c +++ b/src/overlays/actors/ovl_En_Tg/z_en_tg.c @@ -5,6 +5,12 @@ */ #include "z_en_tg.h" + +#include "gfx.h" +#include "sys_matrix.h" +#include "z64face_reaction.h" +#include "z64play.h" + #include "assets/objects/object_mu/object_mu.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY) diff --git a/src/overlays/actors/ovl_En_Tg/z_en_tg.h b/src/overlays/actors/ovl_En_Tg/z_en_tg.h index 4571638d77..b4d9bfe063 100644 --- a/src/overlays/actors/ovl_En_Tg/z_en_tg.h +++ b/src/overlays/actors/ovl_En_Tg/z_en_tg.h @@ -2,11 +2,11 @@ #define Z_EN_TG_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnTg; -typedef void (*EnTgActionFunc)(struct EnTg*, PlayState*); +typedef void (*EnTgActionFunc)(struct EnTg*, struct PlayState*); typedef struct EnTg { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.c b/src/overlays/actors/ovl_En_Tite/z_en_tite.c index b253b7ea0b..3435b040fc 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -7,7 +7,22 @@ #include "z_en_tite.h" #include "overlays/actors/ovl_En_Encount1/z_en_encount1.h" #include "overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" #include "terminal.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_tite/object_tite.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED) @@ -191,7 +206,7 @@ void EnTite_Init(Actor* thisx, PlayState* play) { thisx->colChkInfo.health = 2; thisx->colChkInfo.mass = MASS_HEAVY; Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, thisx, &sJntSphInit, &this->colliderItem); + Collider_SetJntSph(play, &this->collider, thisx, &sJntSphInit, this->colliderElements); this->unk_2DC = UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4; if (this->actor.params == TEKTITE_BLUE) { this->unk_2DC |= UPDBGCHECKINFO_FLAG_6; // Don't use the actor engine's ripple spawning code diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.h b/src/overlays/actors/ovl_En_Tite/z_en_tite.h index a049cabaae..d4ec9ab8dd 100755 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.h +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.h @@ -2,11 +2,11 @@ #define Z_EN_TITE_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnTite; -typedef void (*EnTiteActionFunc)(struct EnTite*, PlayState*); +typedef void (*EnTiteActionFunc)(struct EnTite*, struct PlayState*); typedef enum EnTiteType { /* -2 */ TEKTITE_BLUE = -2, @@ -28,7 +28,7 @@ typedef struct EnTite { /* 0x02E3 */ u8 spawnIceTimer; /* 0x02E4 */ u8 damageEffect; /* 0x02E8 */ ColliderJntSph collider; - /* 0x0308 */ ColliderJntSphElement colliderItem; + /* 0x0308 */ ColliderJntSphElement colliderElements[1]; /* 0x0348 */ Vec3f frontLeftFootPos; /* 0x0354 */ Vec3f frontRightFootPos; /* 0x0360 */ Vec3f backRightFootPos; diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c index 747b0085c6..4f697c29b8 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -5,6 +5,22 @@ */ #include "z_en_tk.h" + +#include "libc64/math64.h" +#include "libc64/qrand.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "rand.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64face_reaction.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_tk/object_tk.h" diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.h b/src/overlays/actors/ovl_En_Tk/z_en_tk.h index 208b4e81d7..2ce0b9ef87 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.h +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.h @@ -2,8 +2,7 @@ #define Z_EN_TK_H #include "ultra64.h" -#include "global.h" -#include "z64.h" +#include "z64actor.h" /* Dirt particle effect */ struct EnTkEff; @@ -22,7 +21,7 @@ typedef struct EnTkEff { struct EnTk; -typedef void (*EnTkActionFunc)(struct EnTk*, PlayState*); +typedef void (*EnTkActionFunc)(struct EnTk*, struct PlayState*); typedef struct EnTk { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Torch/z_en_torch.c b/src/overlays/actors/ovl_En_Torch/z_en_torch.c index e60e16c0de..6e406c6bab 100644 --- a/src/overlays/actors/ovl_En_Torch/z_en_torch.c +++ b/src/overlays/actors/ovl_En_Torch/z_en_torch.c @@ -1,10 +1,14 @@ /* * File: z_en_torch.c * Overlay: ovl_En_Torch - * Description: Spawns a chest with the appropriate contents then unloads. Used in grottos. + * Description: Spawns a chest with the appropriate contents then dies. Used in grottos. */ #include "z_en_torch.h" +#include "overlays/actors/ovl_En_Box/z_en_box.h" + +#include "z64play.h" +#include "z64save.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_En_Torch/z_en_torch.h b/src/overlays/actors/ovl_En_Torch/z_en_torch.h index 78be1fb2dd..fc3e2dabac 100644 --- a/src/overlays/actors/ovl_En_Torch/z_en_torch.h +++ b/src/overlays/actors/ovl_En_Torch/z_en_torch.h @@ -2,7 +2,7 @@ #define Z_EN_TORCH_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnTorch; diff --git a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index 8e69a1537f..a02e9bc3bb 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -5,9 +5,25 @@ */ #include "z_en_torch2.h" -#include "assets/objects/object_torch2/object_torch2.h" + +#include "libc64/qrand.h" #include "libu64/pad.h" +#include "controller.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "rand.h" +#include "sfx.h" +#include "sequence.h" #include "versions.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/object_torch2/object_torch2.h" #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ diff --git a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.h b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.h index d96b08527e..bb132bc91e 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.h +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.h @@ -2,7 +2,7 @@ #define Z_EN_TORCH2_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" // Uses the Player struct (from z64player.h) diff --git a/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c b/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c index 5b31c32f84..2ac84162c6 100644 --- a/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c +++ b/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c @@ -5,6 +5,17 @@ */ #include "z_en_toryo.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64face_reaction.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_toryo/object_toryo.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY) diff --git a/src/overlays/actors/ovl_En_Toryo/z_en_toryo.h b/src/overlays/actors/ovl_En_Toryo/z_en_toryo.h index 769ea637b9..f8d04e74ac 100644 --- a/src/overlays/actors/ovl_En_Toryo/z_en_toryo.h +++ b/src/overlays/actors/ovl_En_Toryo/z_en_toryo.h @@ -2,11 +2,11 @@ #define Z_EN_TORYO_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnToryo; -typedef void (*EnToryoActionFunc)(struct EnToryo* this, PlayState* play); +typedef void (*EnToryoActionFunc)(struct EnToryo* this, struct PlayState* play); typedef struct EnToryo { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Tp/z_en_tp.c b/src/overlays/actors/ovl_En_Tp/z_en_tp.c index 79500059b5..a1ce22995c 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.c +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.c @@ -5,7 +5,23 @@ */ #include "z_en_tp.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "rand.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_math.h" +#include "sys_matrix.h" #include "versions.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_tp/object_tp.h" #define FLAGS 0 @@ -145,7 +161,7 @@ void EnTp_Init(Actor* thisx, PlayState* play2) { now = this; this->alpha = 255; Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); if (this->actor.params <= TAILPASARAN_HEAD) { this->actor.naviEnemyId = NAVI_ENEMY_TAILPASARAN; diff --git a/src/overlays/actors/ovl_En_Tp/z_en_tp.h b/src/overlays/actors/ovl_En_Tp/z_en_tp.h index f878ab934a..71fdca8188 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.h +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.h @@ -2,11 +2,11 @@ #define Z_EN_TP_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnTp; -typedef void (*EnTpActionFunc)(struct EnTp*, PlayState*); +typedef void (*EnTpActionFunc)(struct EnTp*, struct PlayState*); typedef struct EnTp { /* 0x0000 */ Actor actor; @@ -24,7 +24,7 @@ typedef struct EnTp { /* 0x016C */ f32 horizontalVariation; /* 0x0170 */ f32 extraHeightVariation; /* 0x0174 */ ColliderJntSph collider; - /* 0x0194 */ ColliderJntSphElement colliderItems[1]; + /* 0x0194 */ ColliderJntSphElement colliderElements[1]; /* 0x01D4 */ struct EnTp* head; } EnTp; // size = 0x01D8 diff --git a/src/overlays/actors/ovl_En_Tr/z_en_tr.c b/src/overlays/actors/ovl_En_Tr/z_en_tr.c index 6cd63e00f8..3f2672cde4 100644 --- a/src/overlays/actors/ovl_En_Tr/z_en_tr.c +++ b/src/overlays/actors/ovl_En_Tr/z_en_tr.c @@ -5,6 +5,18 @@ */ #include "z_en_tr.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_math.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_tr/object_tr.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_En_Tr/z_en_tr.h b/src/overlays/actors/ovl_En_Tr/z_en_tr.h index faf45d7400..091aa5c52f 100644 --- a/src/overlays/actors/ovl_En_Tr/z_en_tr.h +++ b/src/overlays/actors/ovl_En_Tr/z_en_tr.h @@ -2,11 +2,11 @@ #define Z_EN_TR_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnTr; -typedef void (*EnTrActionFunc)(struct EnTr*, PlayState*); +typedef void (*EnTrActionFunc)(struct EnTr*, struct PlayState*); typedef enum KotakeKoumeLimb { /* 0 */ KOTAKE_KOUME_LIMB_NONE, diff --git a/src/overlays/actors/ovl_En_Trap/z_en_trap.c b/src/overlays/actors/ovl_En_Trap/z_en_trap.c index 640332ecba..848e6701b0 100644 --- a/src/overlays/actors/ovl_En_Trap/z_en_trap.c +++ b/src/overlays/actors/ovl_En_Trap/z_en_trap.c @@ -5,6 +5,12 @@ */ #include "z_en_trap.h" + +#include "sfx.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/object_trap/object_trap.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_En_Trap/z_en_trap.h b/src/overlays/actors/ovl_En_Trap/z_en_trap.h index 6f69707aca..fcd62dd170 100644 --- a/src/overlays/actors/ovl_En_Trap/z_en_trap.h +++ b/src/overlays/actors/ovl_En_Trap/z_en_trap.h @@ -2,7 +2,7 @@ #define Z_EN_TRAP_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" // Different movement modes (set in params): #define SPIKETRAP_MODE_LINEAR 0x10 diff --git a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c index 8db28db170..31ae178197 100644 --- a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c +++ b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c @@ -5,9 +5,21 @@ */ #include "z_en_tubo_trap.h" -#include "assets/objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" + +#include "libc64/qrand.h" +#include "printf.h" +#include "regs.h" +#include "sfx.h" #include "terminal.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.h b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.h index 17dc2f2054..3abe8b625a 100644 --- a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.h +++ b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.h @@ -2,11 +2,11 @@ #define Z_EN_TUBO_TRAP_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnTuboTrap; -typedef void (*EnTuboTrapActionFunc)(struct EnTuboTrap*, PlayState*); +typedef void (*EnTuboTrapActionFunc)(struct EnTuboTrap*, struct PlayState*); typedef struct EnTuboTrap { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Vali/z_en_vali.c b/src/overlays/actors/ovl_En_Vali/z_en_vali.c index fa83618611..011b004b68 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.c +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.c @@ -5,6 +5,19 @@ */ #include "z_en_vali.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "rand.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/object_vali/object_vali.h" #define FLAGS \ diff --git a/src/overlays/actors/ovl_En_Vali/z_en_vali.h b/src/overlays/actors/ovl_En_Vali/z_en_vali.h index c5df42825b..1a031d964b 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.h +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.h @@ -2,11 +2,11 @@ #define Z_EN_VALI_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnVali; -typedef void (*EnValiActionFunc)(struct EnVali*, PlayState*); +typedef void (*EnValiActionFunc)(struct EnVali*, struct PlayState*); typedef enum EnValiLimb { /* 0x00 */ EN_VALI_LIMB_NONE, diff --git a/src/overlays/actors/ovl_En_Vase/z_en_vase.c b/src/overlays/actors/ovl_En_Vase/z_en_vase.c index 9861413414..30f8b32b18 100644 --- a/src/overlays/actors/ovl_En_Vase/z_en_vase.c +++ b/src/overlays/actors/ovl_En_Vase/z_en_vase.c @@ -5,6 +5,9 @@ */ #include "z_en_vase.h" + +#include "z64play.h" + #include "assets/objects/object_vase/object_vase.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_En_Vase/z_en_vase.h b/src/overlays/actors/ovl_En_Vase/z_en_vase.h index 57ee0d5779..04a8381e29 100644 --- a/src/overlays/actors/ovl_En_Vase/z_en_vase.h +++ b/src/overlays/actors/ovl_En_Vase/z_en_vase.h @@ -2,7 +2,7 @@ #define Z_EN_VASE_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnVase; diff --git a/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c b/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c index e31e9ca9a7..8791409d01 100644 --- a/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c +++ b/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c @@ -5,9 +5,21 @@ */ #include "z_en_vb_ball.h" +#include "overlays/actors/ovl_Boss_Fd/z_boss_fd.h" + +#include "libc64/math64.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "rand.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_fd/object_fd.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" -#include "overlays/actors/ovl_Boss_Fd/z_boss_fd.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.h b/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.h index 8675b440c4..e81bc1ac25 100644 --- a/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.h +++ b/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.h @@ -2,7 +2,7 @@ #define Z_EN_VB_BALL_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnVbBall; diff --git a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c index c7a231c0a2..165065d714 100644 --- a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c +++ b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c @@ -7,6 +7,24 @@ #include "z_en_viewer.h" #include "overlays/actors/ovl_Boss_Ganon/z_boss_ganon.h" #include "overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.h" + +#include "libc64/qrand.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "regs.h" +#include "segmented_address.h" +#include "seqcmd.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64play.h" +#include "z64save.h" +#include "z64skin.h" + #include "assets/objects/object_zl4/object_zl4.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_horse_zelda/object_horse_zelda.h" @@ -123,7 +141,7 @@ void EnViewer_InitAnimGanondorfOrZelda(EnViewer* this, PlayState* play, void* sk SkelAnime_Init(play, &this->skin.skelAnime, skeletonHeaderSeg, NULL, NULL, NULL, 0); } - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); if (type == ENVIEWER_TYPE_3_GANONDORF || type == ENVIEWER_TYPE_7_GANONDORF || type == ENVIEWER_TYPE_8_GANONDORF || type == ENVIEWER_TYPE_9_GANONDORF) { Animation_PlayLoopSetSpeed(&this->skin.skelAnime, anim, 1.0f); @@ -134,7 +152,7 @@ void EnViewer_InitAnimGanondorfOrZelda(EnViewer* this, PlayState* play, void* sk void EnViewer_InitAnimImpa(EnViewer* this, PlayState* play, void* skeletonHeaderSeg, AnimationHeader* anim) { SkelAnime_InitFlex(play, &this->skin.skelAnime, skeletonHeaderSeg, NULL, NULL, NULL, 0); - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); Animation_PlayLoopSetSpeed(&this->skin.skelAnime, anim, 3.0f); } @@ -487,7 +505,7 @@ void EnViewer_UpdateImpl(EnViewer* this, PlayState* play) { void EnViewer_Update(Actor* thisx, PlayState* play) { EnViewer* this = (EnViewer*)thisx; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); this->actionFunc(this, play); } diff --git a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h index de2bf8ba27..a06435d553 100644 --- a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h +++ b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.h @@ -2,13 +2,14 @@ #define Z_EN_VIEWER_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" +#include "z64skin.h" struct EnViewer; -typedef void (*EnViewerActionFunc)(struct EnViewer*, PlayState*); -typedef void (*EnViewerDrawFunc)(struct EnViewer*, PlayState*); -typedef void (*EnViewerInitAnimFunc)(struct EnViewer*, PlayState*, void*, AnimationHeader*); +typedef void (*EnViewerActionFunc)(struct EnViewer*, struct PlayState*); +typedef void (*EnViewerDrawFunc)(struct EnViewer*, struct PlayState*); +typedef void (*EnViewerInitAnimFunc)(struct EnViewer*, struct PlayState*, void*, AnimationHeader*); typedef enum EnViewerType { /* 0 */ ENVIEWER_TYPE_0_HORSE_ZELDA, diff --git a/src/overlays/actors/ovl_En_Vm/z_en_vm.c b/src/overlays/actors/ovl_En_Vm/z_en_vm.c index 9847d4fa8d..2ee230d9bd 100644 --- a/src/overlays/actors/ovl_En_Vm/z_en_vm.c +++ b/src/overlays/actors/ovl_En_Vm/z_en_vm.c @@ -5,8 +5,23 @@ */ #include "z_en_vm.h" -#include "assets/objects/object_vm/object_vm.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "rand.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + +#include "assets/objects/object_vm/object_vm.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_UPDATE_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_En_Vm/z_en_vm.h b/src/overlays/actors/ovl_En_Vm/z_en_vm.h index 5b0fe1629e..7705d87032 100644 --- a/src/overlays/actors/ovl_En_Vm/z_en_vm.h +++ b/src/overlays/actors/ovl_En_Vm/z_en_vm.h @@ -2,11 +2,11 @@ #define Z_EN_VM_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnVm; -typedef void (*EnVmActionFunc)(struct EnVm*, PlayState*); +typedef void (*EnVmActionFunc)(struct EnVm*, struct PlayState*); typedef struct EnVm { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c index c650e79e85..149eba4700 100644 --- a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c +++ b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c @@ -12,14 +12,14 @@ #include "rand.h" #include "regs.h" #include "sfx.h" +#include "printf.h" #include "quake.h" #include "terminal.h" #include "z_lib.h" +#include "z64debug_display.h" #include "z64effect.h" #include "z64play.h" -#include "global.h" - #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED void EnWallTubo_Init(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c index abbf3ecaa0..abb91c80b9 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -5,8 +5,22 @@ */ #include "z_en_wallmas.h" -#include "assets/objects/object_wallmaster/object_wallmaster.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" +#include "assets/objects/object_wallmaster/object_wallmaster.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h index c82df375dc..76ee52d9e0 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.h @@ -2,7 +2,7 @@ #define Z_EN_WALLMAS_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" typedef enum WallmasType { /* 0x00 */ WMT_TIMER, @@ -12,7 +12,7 @@ typedef enum WallmasType { struct EnWallmas; -typedef void (*EnWallmasActionFunc)(struct EnWallmas*, PlayState*); +typedef void (*EnWallmasActionFunc)(struct EnWallmas*, struct PlayState*); typedef struct EnWallmas { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c index a7268efc97..04082aa10f 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c @@ -5,8 +5,16 @@ */ #include "z_en_weather_tag.h" + +#include "printf.h" +#include "regs.h" #include "terminal.h" #include "versions.h" +#include "z_lib.h" +#include "z64debug_display.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h index ccfc0e3f67..52b617a0e7 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h @@ -2,11 +2,11 @@ #define Z_EN_WEATHER_TAG_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnWeatherTag; -typedef void (*EnWeatherTagActionFunc)(struct EnWeatherTag*, PlayState*); +typedef void (*EnWeatherTagActionFunc)(struct EnWeatherTag*, struct PlayState*); typedef struct EnWeatherTag { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c b/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c index 3d3387fcd2..2e19328961 100644 --- a/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c +++ b/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c @@ -5,6 +5,18 @@ */ #include "z_en_weiyer.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sfx.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_ei/object_ei.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE) diff --git a/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.h b/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.h index fbaefbd9a5..ab1b81c34f 100644 --- a/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.h +++ b/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.h @@ -2,11 +2,11 @@ #define Z_EN_WEIYER_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnWeiyer; -typedef void (*EnWeiyerActionFunc)(struct EnWeiyer*, PlayState*); +typedef void (*EnWeiyerActionFunc)(struct EnWeiyer*, struct PlayState*); typedef struct EnWeiyer { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Wf/z_en_wf.c b/src/overlays/actors/ovl_En_Wf/z_en_wf.c index 36aaac2344..4014597de7 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -5,8 +5,27 @@ */ #include "z_en_wf.h" -#include "terminal.h" #include "overlays/actors/ovl_En_Encount1/z_en_encount1.h" + +#include "libc64/qrand.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "rand.h" +#include "segmented_address.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "terminal.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_wf/object_wf.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED) @@ -43,7 +62,7 @@ void EnWf_SetupDie(EnWf* this); void EnWf_Die(EnWf* this, PlayState* play); s32 EnWf_DodgeRanged(PlayState* play, EnWf* this); -static ColliderJntSphElementInit sJntSphItemsInit[4] = { +static ColliderJntSphElementInit sJntSphElementsInit[4] = { { { ELEM_MATERIAL_UNK0, @@ -99,8 +118,8 @@ static ColliderJntSphInit sJntSphInit = { OC2_TYPE_1, COLSHAPE_JNTSPH, }, - ARRAY_COUNT(sJntSphItemsInit), - sJntSphItemsInit, + ARRAY_COUNT(sJntSphElementsInit), + sJntSphElementsInit, }; static ColliderCylinderInit sBodyCylinderInit = { @@ -225,12 +244,12 @@ void EnWf_Init(Actor* thisx, PlayState* play) { this->eyeIndex = 0; this->unk_2F4 = 10.0f; // Set and not used - Collider_InitJntSph(play, &this->colliderSpheres); - Collider_SetJntSph(play, &this->colliderSpheres, thisx, &sJntSphInit, this->colliderSpheresElements); - Collider_InitCylinder(play, &this->colliderCylinderBody); - Collider_SetCylinder(play, &this->colliderCylinderBody, thisx, &sBodyCylinderInit); - Collider_InitCylinder(play, &this->colliderCylinderTail); - Collider_SetCylinder(play, &this->colliderCylinderTail, thisx, &sTailCylinderInit); + Collider_InitJntSph(play, &this->colliderJntSph); + Collider_SetJntSph(play, &this->colliderJntSph, thisx, &sJntSphInit, this->colliderJntSphElements); + Collider_InitCylinder(play, &this->bodyColliderCylinder); + Collider_SetCylinder(play, &this->bodyColliderCylinder, thisx, &sBodyCylinderInit); + Collider_InitCylinder(play, &this->tailColliderCylinder); + Collider_SetCylinder(play, &this->tailColliderCylinder, thisx, &sTailCylinderInit); if (thisx->params == WOLFOS_NORMAL) { SkelAnime_InitFlex(play, &this->skelAnime, &gWolfosNormalSkel, &gWolfosWaitingAnim, this->jointTable, @@ -241,8 +260,8 @@ void EnWf_Init(Actor* thisx, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gWolfosWhiteSkel, &gWolfosWaitingAnim, this->jointTable, this->morphTable, WOLFOS_LIMB_MAX); Actor_SetScale(thisx, 0.01f); - this->colliderSpheres.elements[0].base.atDmgInfo.damage = - this->colliderSpheres.elements[1].base.atDmgInfo.damage = 8; + this->colliderJntSph.elements[0].base.atDmgInfo.damage = + this->colliderJntSph.elements[1].base.atDmgInfo.damage = 8; thisx->naviEnemyId = NAVI_ENEMY_WHITE_WOLFOS; } @@ -256,9 +275,9 @@ void EnWf_Init(Actor* thisx, PlayState* play) { void EnWf_Destroy(Actor* thisx, PlayState* play) { EnWf* this = (EnWf*)thisx; - Collider_DestroyJntSph(play, &this->colliderSpheres); - Collider_DestroyCylinder(play, &this->colliderCylinderBody); - Collider_DestroyCylinder(play, &this->colliderCylinderTail); + Collider_DestroyJntSph(play, &this->colliderJntSph); + Collider_DestroyCylinder(play, &this->bodyColliderCylinder); + Collider_DestroyCylinder(play, &this->tailColliderCylinder); if ((this->actor.params != WOLFOS_NORMAL) && (this->switchFlag != 0xFF)) { func_800F5B58(); @@ -716,7 +735,7 @@ void EnWf_RunAroundPlayer(EnWf* this, PlayState* play) { void EnWf_SetupSlash(EnWf* this) { Animation_PlayOnce(&this->skelAnime, &gWolfosSlashingAnim); - this->colliderSpheres.base.atFlags &= ~AT_BOUNCED; + this->colliderJntSph.base.atFlags &= ~AT_BOUNCED; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->action = WOLFOS_ACTION_SLASH; this->unk_2FA = 0; // Set and not used @@ -1246,27 +1265,27 @@ void func_80B36F40(EnWf* this, PlayState* play) { } void EnWf_UpdateDamage(EnWf* this, PlayState* play) { - if (this->colliderSpheres.base.acFlags & AC_BOUNCED) { - this->colliderSpheres.base.acFlags &= ~(AC_HIT | AC_BOUNCED); - this->colliderCylinderBody.base.acFlags &= ~AC_HIT; - this->colliderCylinderTail.base.acFlags &= ~AC_HIT; - } else if ((this->colliderCylinderBody.base.acFlags & AC_HIT) || - (this->colliderCylinderTail.base.acFlags & AC_HIT)) { + if (this->colliderJntSph.base.acFlags & AC_BOUNCED) { + this->colliderJntSph.base.acFlags &= ~(AC_HIT | AC_BOUNCED); + this->bodyColliderCylinder.base.acFlags &= ~AC_HIT; + this->tailColliderCylinder.base.acFlags &= ~AC_HIT; + } else if ((this->bodyColliderCylinder.base.acFlags & AC_HIT) || + (this->tailColliderCylinder.base.acFlags & AC_HIT)) { if (this->action >= WOLFOS_ACTION_WAIT) { s16 yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if ((!(this->colliderCylinderBody.base.acFlags & AC_HIT) && - (this->colliderCylinderTail.base.acFlags & AC_HIT)) || + if ((!(this->bodyColliderCylinder.base.acFlags & AC_HIT) && + (this->tailColliderCylinder.base.acFlags & AC_HIT)) || (ABS(yawDiff) > 19000)) { this->actor.colChkInfo.damage *= 4; } - this->colliderCylinderBody.base.acFlags &= ~AC_HIT; - this->colliderCylinderTail.base.acFlags &= ~AC_HIT; + this->bodyColliderCylinder.base.acFlags &= ~AC_HIT; + this->tailColliderCylinder.base.acFlags &= ~AC_HIT; if (this->actor.colChkInfo.damageEffect != ENWF_DMGEFF_ICE_MAGIC) { this->damageEffect = this->actor.colChkInfo.damageEffect; - Actor_SetDropFlag(&this->actor, &this->colliderCylinderBody.elem, true); + Actor_SetDropFlag(&this->actor, &this->bodyColliderCylinder.elem, true); #if OOT_VERSION >= PAL_1_0 this->slashStatus = 0; #endif @@ -1320,23 +1339,23 @@ void EnWf_Update(Actor* thisx, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.z, 0, 1, 1000, 0); } - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderSpheres.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderJntSph.base); if (this->action >= WOLFOS_ACTION_WAIT) { if ((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000)) { - Collider_UpdateCylinder(&this->actor, &this->colliderCylinderBody); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinderTail.base); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinderBody.base); + Collider_UpdateCylinder(&this->actor, &this->bodyColliderCylinder); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->tailColliderCylinder.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyColliderCylinder.base); } } if (this->action == WOLFOS_ACTION_BLOCKING) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSpheres.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); } if (this->slashStatus > 0) { - if (!(this->colliderSpheres.base.atFlags & AT_BOUNCED)) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderSpheres.base); + if (!(this->colliderJntSph.base.atFlags & AT_BOUNCED)) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderJntSph.base); } else { EnWf_SetupRecoilFromBlockedSlash(this); } @@ -1370,16 +1389,16 @@ void EnWf_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, EnWf* this = (EnWf*)thisx; s32 bodyPartIndex = -1; - Collider_UpdateSpheres(limbIndex, &this->colliderSpheres); + Collider_UpdateSpheres(limbIndex, &this->colliderJntSph); if (limbIndex == WOLFOS_LIMB_TAIL) { Vec3f colliderPos; bodyPartIndex = -1; Matrix_MultVec3f(&colliderVec, &colliderPos); - this->colliderCylinderTail.dim.pos.x = colliderPos.x; - this->colliderCylinderTail.dim.pos.y = colliderPos.y; - this->colliderCylinderTail.dim.pos.z = colliderPos.z; + this->tailColliderCylinder.dim.pos.x = colliderPos.x; + this->tailColliderCylinder.dim.pos.y = colliderPos.y; + this->tailColliderCylinder.dim.pos.z = colliderPos.z; } if ((this->fireTimer != 0) || ((this->actor.colorFilterTimer != 0) && (this->actor.colorFilterParams & 0x4000))) { diff --git a/src/overlays/actors/ovl_En_Wf/z_en_wf.h b/src/overlays/actors/ovl_En_Wf/z_en_wf.h index 83e46e6d19..afc18f7d01 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.h +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.h @@ -2,11 +2,11 @@ #define Z_EN_WF_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnWf; -typedef void (*EnWfActionFunc)(struct EnWf*, PlayState*); +typedef void (*EnWfActionFunc)(struct EnWf*, struct PlayState*); typedef enum EnWfLimb { /* 0 */ WOLFOS_LIMB_NONE, @@ -74,10 +74,10 @@ typedef struct EnWf { /* 0x02FE */ s16 runAngle; /* 0x0300 */ s16 unk_300; // Set, but ineffectual (see comment in Draw) /* 0x0302 */ u8 eyeIndex; - /* 0x0304 */ ColliderJntSph colliderSpheres; - /* 0x0324 */ ColliderJntSphElement colliderSpheresElements[4]; - /* 0x0424 */ ColliderCylinder colliderCylinderBody; - /* 0x0470 */ ColliderCylinder colliderCylinderTail; + /* 0x0304 */ ColliderJntSph colliderJntSph; + /* 0x0324 */ ColliderJntSphElement colliderJntSphElements[4]; + /* 0x0424 */ ColliderCylinder bodyColliderCylinder; + /* 0x0470 */ ColliderCylinder tailColliderCylinder; /* 0x04BC */ Vec3f unk_4BC; /* 0x04C8 */ Vec3f unk_4C8; /* 0x04D4 */ Vec3s unk_4D4; diff --git a/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c b/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c index b60361d810..a1cf8f5be6 100644 --- a/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c +++ b/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c @@ -5,7 +5,17 @@ */ #include "z_en_wonder_item.h" + +#include "printf.h" +#include "regs.h" +#include "sfx.h" #include "terminal.h" +#include "translation.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64debug_display.h" +#include "z64play.h" +#include "z64player.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.h b/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.h index 4aca3ffe0a..5b99e235c3 100644 --- a/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.h +++ b/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.h @@ -2,11 +2,11 @@ #define Z_EN_WONDER_ITEM_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnWonderItem; -typedef void (*EnWonderItemUpdateFunc)(struct EnWonderItem*, PlayState*); +typedef void (*EnWonderItemUpdateFunc)(struct EnWonderItem*, struct PlayState*); typedef struct EnWonderItem { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c b/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c index ba76e3877b..fb455390a7 100644 --- a/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c +++ b/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c @@ -5,7 +5,13 @@ */ #include "z_en_wonder_talk.h" + +#include "printf.h" +#include "regs.h" #include "terminal.h" +#include "z64debug_display.h" +#include "z64play.h" +#include "z64save.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_LOCK_ON_DISABLED) diff --git a/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.h b/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.h index ae21c5b41f..a42c3febfc 100644 --- a/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.h +++ b/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.h @@ -2,11 +2,11 @@ #define Z_EN_WONDER_TALK_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnWonderTalk; -typedef void (*EnWonderTalkFunc)(struct EnWonderTalk*, PlayState*); +typedef void (*EnWonderTalkFunc)(struct EnWonderTalk*, struct PlayState*); typedef struct EnWonderTalk { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c b/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c index 578c9851dc..bb58339fc1 100644 --- a/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c +++ b/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c @@ -5,7 +5,14 @@ */ #include "z_en_wonder_talk2.h" + +#include "printf.h" +#include "regs.h" #include "terminal.h" +#include "z64debug_display.h" +#include "z64item.h" +#include "z64play.h" +#include "z64player.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_LOCK_ON_DISABLED) diff --git a/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.h b/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.h index f58775426f..0dad49d375 100644 --- a/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.h +++ b/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.h @@ -2,11 +2,11 @@ #define Z_EN_WONDER_TALK2_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnWonderTalk2; -typedef void (*EnWonderTalk2Func)(struct EnWonderTalk2*, PlayState*); +typedef void (*EnWonderTalk2Func)(struct EnWonderTalk2*, struct PlayState*); typedef struct EnWonderTalk2 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c index c66a2232dd..bf32807226 100644 --- a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c +++ b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c @@ -5,6 +5,21 @@ */ #include "z_en_wood02.h" + +#include "libc64/qrand.h" +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "rand.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64skin_matrix.h" + #include "assets/objects/object_wood02/object_wood02.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.h b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.h index 14ca5b967e..89242188ae 100644 --- a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.h +++ b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.h @@ -2,7 +2,7 @@ #define Z_EN_WOOD02_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnWood02; diff --git a/src/overlays/actors/ovl_En_Xc/z_en_xc.c b/src/overlays/actors/ovl_En_Xc/z_en_xc.c index f9c4cfb632..c8b6685587 100644 --- a/src/overlays/actors/ovl_En_Xc/z_en_xc.c +++ b/src/overlays/actors/ovl_En_Xc/z_en_xc.c @@ -7,15 +7,34 @@ #include "z_en_xc.h" #include "overlays/actors/ovl_En_Arrow/z_en_arrow.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" + +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "regs.h" +#include "segmented_address.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_math3d.h" +#include "sys_matrix.h" +#include "terminal.h" +#include "translation.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64save.h" +#include "z64skin_matrix.h" + #include "assets/objects/object_xc/object_xc.h" #include "assets/scenes/overworld/spot05/spot05_scene.h" #include "assets/scenes/overworld/spot17/spot17_scene.h" #include "assets/scenes/indoors/tokinoma/tokinoma_scene.h" #include "assets/scenes/dungeons/ice_doukutu/ice_doukutu_scene.h" -#include "terminal.h" -#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:128" \ - "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" +#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ + "ique-cn:128 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -1396,8 +1415,8 @@ void func_80B3F3D8(void) { Sfx_PlaySfxCentered2(NA_SE_PL_SKIP); } -#pragma increment_block_number "gc-eu:64 gc-eu-mq:64 gc-jp:64 gc-jp-ce:64 gc-jp-mq:64 gc-us:64 gc-us-mq:64" \ - "ique-cn:128 ntsc-1.0:64 ntsc-1.1:64 ntsc-1.2:64 pal-1.0:64 pal-1.1:64" +#pragma increment_block_number "gc-eu:64 gc-eu-mq:64 gc-jp:64 gc-jp-ce:64 gc-jp-mq:64 gc-us:64 gc-us-mq:64 ique-cn:64" \ + "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" void EnXc_PlayDiveSFX(Vec3f* src, PlayState* play) { static Vec3f D_80B42DA0; @@ -2024,7 +2043,8 @@ s32 EnXc_SetupNocturneState(Actor* thisx, PlayState* play) { Actor_Kill(thisx); break; default: - PRINTF("En_Oa2_Stalker_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); + PRINTF(T("En_Oa2_Stalker_Check_DemoMode:そんな動作は無い!!!!!!!!\n", + "En_Oa2_Stalker_Check_DemoMode: There is no such action!!!!!!!!\n")); break; } @@ -2333,7 +2353,8 @@ void EnXc_Update(Actor* thisx, PlayState* play) { s32 action = this->action; if ((action < 0) || (action >= ARRAY_COUNT(sActionFuncs)) || (sActionFuncs[action] == NULL)) { - PRINTF(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The main mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); } else { sActionFuncs[action](this, play); } @@ -2450,8 +2471,8 @@ void EnXc_Draw(Actor* thisx, PlayState* play) { EnXc* this = (EnXc*)thisx; if (this->drawMode < 0 || this->drawMode > 5 || sDrawFuncs[this->drawMode] == NULL) { - // "Draw mode is abnormal!!!!!!!!!!!!!!!!!!!!!!!!!" - PRINTF(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The drawing mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); } else { sDrawFuncs[this->drawMode](thisx, play); } diff --git a/src/overlays/actors/ovl_En_Xc/z_en_xc.h b/src/overlays/actors/ovl_En_Xc/z_en_xc.h index c01b98a842..1cc56f68e6 100644 --- a/src/overlays/actors/ovl_En_Xc/z_en_xc.h +++ b/src/overlays/actors/ovl_En_Xc/z_en_xc.h @@ -2,12 +2,12 @@ #define Z_EN_XC_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnXc; -typedef void (*EnXcActionFunc)(struct EnXc*, PlayState*); -typedef void (*EnXcDrawFunc)(struct Actor*, PlayState*); +typedef void (*EnXcActionFunc)(struct EnXc*, struct PlayState*); +typedef void (*EnXcDrawFunc)(struct Actor*, struct PlayState*); typedef enum EnXcType { /* 0 */ SHEIK_TYPE_0, diff --git a/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c b/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c index f294fb60c2..e5f75d60df 100644 --- a/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c +++ b/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c @@ -5,7 +5,18 @@ */ #include "z_en_yabusame_mark.h" + +#include "printf.h" +#include "regs.h" +#include "sequence.h" +#include "sfx.h" #include "terminal.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64debug_display.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64save.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.h b/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.h index f4ec71bec5..12cfb46cbb 100644 --- a/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.h +++ b/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.h @@ -2,11 +2,11 @@ #define Z_EN_YABUSAME_MARK_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnYabusameMark; -typedef void (*EnYabusameMarkActionFunc)(struct EnYabusameMark*, PlayState*); +typedef void (*EnYabusameMarkActionFunc)(struct EnYabusameMark*, struct PlayState*); typedef struct EnYabusameMark { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c b/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c index 4a6d3bc397..22d454fb61 100644 --- a/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c +++ b/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c @@ -5,6 +5,17 @@ */ #include "z_en_yukabyun.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/object_yukabyun/object_yukabyun.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.h b/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.h index 773237fbce..a695fb4c1f 100644 --- a/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.h +++ b/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.h @@ -2,11 +2,11 @@ #define Z_EN_YUKABYUN_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnYukabyun; -typedef void (*EnYukabyunActionFunc)(struct EnYukabyun*, PlayState*); +typedef void (*EnYukabyunActionFunc)(struct EnYukabyun*, struct PlayState*); typedef struct EnYukabyun { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Zf/z_en_zf.c b/src/overlays/actors/ovl_En_Zf/z_en_zf.c index 70812e3f0f..b49481e881 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -5,6 +5,24 @@ */ #include "z_en_zf.h" + +#include "libc64/qrand.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "rand.h" +#include "regs.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_zf/object_zf.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_En_Zf/z_en_zf.h b/src/overlays/actors/ovl_En_Zf/z_en_zf.h index c5ade78544..9dfb3119b9 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.h +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.h @@ -2,11 +2,11 @@ #define Z_EN_ZF_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnZf; -typedef void (*EnZfActionFunc)(struct EnZf*, PlayState*); +typedef void (*EnZfActionFunc)(struct EnZf*, struct PlayState*); typedef enum EnZfType { /* -2 */ ENZF_TYPE_DINOLFOS = -2, diff --git a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c index 8a01936fff..5c60653b4e 100644 --- a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c +++ b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c @@ -5,6 +5,20 @@ */ #include "z_en_zl1.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "letterbox.h" +#include "segmented_address.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_zl1/object_zl1.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.h b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.h index 4b9f2984e0..ada1335819 100644 --- a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.h +++ b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.h @@ -2,11 +2,11 @@ #define Z_EN_ZL1_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnZl1; -typedef void (*EnZl1ActionFunc)(struct EnZl1*, PlayState*); +typedef void (*EnZl1ActionFunc)(struct EnZl1*, struct PlayState*); typedef struct EnZl1 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Zl1/z_en_zl1_camera_data.inc.c b/src/overlays/actors/ovl_En_Zl1/z_en_zl1_camera_data.inc.c index fb4776673e..f6fac8940a 100644 --- a/src/overlays/actors/ovl_En_Zl1/z_en_zl1_camera_data.inc.c +++ b/src/overlays/actors/ovl_En_Zl1/z_en_zl1_camera_data.inc.c @@ -1,4 +1,3 @@ -#include "z_en_zl1.h" #include "z64cutscene_commands.h" static CutsceneCameraDirection D_80B4D5C0[] = { diff --git a/src/overlays/actors/ovl_En_Zl1/z_en_zl1_cutscene_data.c b/src/overlays/actors/ovl_En_Zl1/z_en_zl1_cutscene_data.c index 6c268600ec..4a8622cbba 100644 --- a/src/overlays/actors/ovl_En_Zl1/z_en_zl1_cutscene_data.c +++ b/src/overlays/actors/ovl_En_Zl1/z_en_zl1_cutscene_data.c @@ -1,5 +1,6 @@ -#include "z_en_zl1.h" +#include "sequence.h" #include "z64cutscene_commands.h" +#include "z64player.h" // clang-format off CutsceneData gTriforceCreationStartCs[] = { diff --git a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c index dbc45b62c6..c00790e02c 100644 --- a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c +++ b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c @@ -5,11 +5,24 @@ */ #include "z_en_zl2.h" -#include "terminal.h" - -#include "z64frame_advance.h" - #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" + +#include "libc64/math64.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "regs.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "terminal.h" +#include "translation.h" +#include "z_lib.h" +#include "z64frame_advance.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_zl2/object_zl2.h" #include "assets/objects/object_zl2_anime1/object_zl2_anime1.h" @@ -579,7 +592,7 @@ void EnZl2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void func_80B4FCCC(EnZl2* this, PlayState* play) { s32 objectSlot = this->zl2Anime1ObjectSlot; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); } void func_80B4FD00(EnZl2* this, AnimationHeader* animation, u8 arg2, f32 morphFrames, s32 arg4) { @@ -992,7 +1005,8 @@ void func_80B50A04(EnZl2* this, PlayState* play) { func_80B50644(this, play); break; default: - PRINTF("En_Zl2_inAgain_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); + PRINTF(T("En_Zl2_inAgain_Check_DemoMode:そんな動作は無い!!!!!!!!\n", + "En_Zl2_inAgain_Check_DemoMode: There is no such action!!!!!!!!\n")); } this->cueId = nextCueId; } @@ -1383,7 +1397,8 @@ void func_80B51948(EnZl2* this, PlayState* play) { func_80B513A8(this, play); break; default: - PRINTF("En_Zl2_inEnding_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); + PRINTF(T("En_Zl2_inEnding_Check_DemoMode:そんな動作は無い!!!!!!!!\n", + "En_Zl2_inEnding_Check_DemoMode: There is no such action!!!!!!!!\n")); } this->cueId = nextCueId; } @@ -1547,7 +1562,8 @@ void func_80B51FA8(EnZl2* this, PlayState* play) { Actor_Kill(&this->actor); break; default: - PRINTF("En_Zl2_inRunning_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); + PRINTF(T("En_Zl2_inRunning_Check_DemoMode:そんな動作は無い!!!!!!!!\n", + "En_Zl2_inRunning_Check_DemoMode: There is no such action!!!!!!!!\n")); break; } this->cueId = nextCueId; @@ -1617,7 +1633,8 @@ void EnZl2_Update(Actor* thisx, PlayState* play) { EnZl2* this = (EnZl2*)thisx; if (this->action < 0 || this->action >= 0x24 || sActionFuncs[this->action] == NULL) { - PRINTF(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The main mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } sActionFuncs[this->action](this, play); @@ -1713,7 +1730,8 @@ void EnZl2_Draw(Actor* thisx, PlayState* play) { EnZl2* this = (EnZl2*)thisx; if ((this->drawConfig < 0) || (this->drawConfig >= 3) || (sDrawFuncs[this->drawConfig] == NULL)) { - PRINTF(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The drawing mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } sDrawFuncs[this->drawConfig](this, play); diff --git a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.h b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.h index c477ea57e1..4bd0730de7 100644 --- a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.h +++ b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.h @@ -2,12 +2,12 @@ #define Z_EN_ZL2_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnZl2; -typedef void (*EnZl2ActionFunc)(struct EnZl2*, PlayState*); -typedef void (*EnZl2DrawFunc)(struct EnZl2*, PlayState*); +typedef void (*EnZl2ActionFunc)(struct EnZl2*, struct PlayState*); +typedef void (*EnZl2DrawFunc)(struct EnZl2*, struct PlayState*); typedef struct EnZl2 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c index dfefdf63b9..ca44cb5731 100644 --- a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c +++ b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c @@ -8,10 +8,12 @@ #include "libc64/math64.h" #include "libc64/qrand.h" +#include "array_count.h" #include "attributes.h" #include "gfx.h" #include "gfx_setupdl.h" #include "one_point_cutscene.h" +#include "printf.h" #include "regs.h" #include "segmented_address.h" #include "seqcmd.h" @@ -19,13 +21,14 @@ #include "sfx.h" #include "sys_matrix.h" #include "terminal.h" +#include "translation.h" +#include "z_en_item00.h" #include "z_lib.h" #include "z64audio.h" #include "z64frame_advance.h" #include "z64play.h" #include "z64player.h" - -#include "global.h" +#include "z64save.h" #include "overlays/actors/ovl_En_Encount2/z_en_encount2.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" @@ -763,7 +766,7 @@ s32 func_80B54DD4(EnZl3* this) { void func_80B54DE0(EnZl3* this, PlayState* play) { s32 objectSlot = this->zl2Anime2ObjectSlot; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); } void func_80B54E14(EnZl3* this, AnimationHeader* animation, u8 arg2, f32 morphFrames, s32 arg4) { @@ -965,7 +968,8 @@ void func_80B55444(EnZl3* this, PlayState* play) { this->unk_328 = 1; FALLTHROUGH; default: - PRINTF("En_Zl3_inFinal_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); + PRINTF(T("En_Zl3_inFinal_Check_DemoMode:そんな動作は無い!!!!!!!!\n", + "En_Zl3_inFinal_Check_DemoMode: There is no such action!!!!!!!!\n")); break; } this->unk_2F0 = temp_v0; @@ -1381,7 +1385,8 @@ void func_80B564A8(EnZl3* this, PlayState* play) { Actor_Kill(&this->actor); break; default: - PRINTF("En_Zl3_inFinal2_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); + PRINTF(T("En_Zl3_inFinal2_Check_DemoMode:そんな動作は無い!!!!!!!!\n", + "En_Zl3_inFinal2_Check_DemoMode: There is no such action!!!!!!!!\n")); } this->unk_2F0 = temp_v0; } @@ -2690,7 +2695,8 @@ void EnZl3_Update(Actor* thisx, PlayState* play) { EnZl3* this = (EnZl3*)thisx; if (this->action < 0 || this->action >= ARRAY_COUNT(sActionFuncs) || sActionFuncs[this->action] == NULL) { - PRINTF(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The main mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } sActionFuncs[this->action](this, play); @@ -2799,7 +2805,8 @@ void EnZl3_Draw(Actor* thisx, PlayState* play) { EnZl3* this = (EnZl3*)thisx; if (this->drawConfig < 0 || this->drawConfig >= 3 || sDrawFuncs[this->drawConfig] == NULL) { - PRINTF(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + PRINTF(VT_FGCOL(RED) T("描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", + "The drawing mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } sDrawFuncs[this->drawConfig](this, play); diff --git a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c index e3b8a51af3..a18efd4ba9 100644 --- a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c +++ b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c @@ -5,6 +5,23 @@ */ #include "z_en_zl4.h" + +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "letterbox.h" +#include "rumble.h" +#include "segmented_address.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64face_reaction.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_zl4/object_zl4.h" #include "assets/scenes/indoors/nakaniwa/nakaniwa_scene.h" diff --git a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.h b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.h index 8710cc9cf9..b371092e08 100644 --- a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.h +++ b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.h @@ -2,12 +2,12 @@ #define Z_EN_ZL4_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnZl4; -typedef void (*EnZl4ActionFunc)(struct EnZl4*, PlayState*); -typedef void (*EnZl4DrawFunc)(struct EnZl4*, PlayState*); +typedef void (*EnZl4ActionFunc)(struct EnZl4*, struct PlayState*); +typedef void (*EnZl4DrawFunc)(struct EnZl4*, struct PlayState*); typedef struct EnZl4 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Zl4/z_en_zl4_cutscene_data.inc.c b/src/overlays/actors/ovl_En_Zl4/z_en_zl4_cutscene_data.inc.c index 3ad3b996be..933f7e0aaa 100644 --- a/src/overlays/actors/ovl_En_Zl4/z_en_zl4_cutscene_data.inc.c +++ b/src/overlays/actors/ovl_En_Zl4/z_en_zl4_cutscene_data.inc.c @@ -1,4 +1,4 @@ -#include "z_en_zl4.h" +#include "z64cutscene_commands.h" static CutsceneCameraDirection sCamDirections[] = { { { -490.0f, 120.0f, 0.0f }, { -440.0f, 117.0f, 0.0f }, 0, 45 }, diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c index 6eb051e47a..95a9f6e07c 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -5,6 +5,20 @@ */ #include "z_en_zo.h" + +#include "libc64/qrand.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64face_reaction.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_zo/object_zo.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY) diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.h b/src/overlays/actors/ovl_En_Zo/z_en_zo.h index 4d7a02ddf0..5f26a20230 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.h +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.h @@ -2,7 +2,7 @@ #define Z_EN_ZO_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EnZo; @@ -19,7 +19,7 @@ typedef struct EnZoEffect { /* 0x2C */ Vec3f vec; // Usage specific } EnZoEffect; // size = 0x38 -typedef void (*EnZoActionFunc)(struct EnZo*, PlayState*); +typedef void (*EnZoActionFunc)(struct EnZo*, struct PlayState*); typedef struct EnZo { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_fHG/z_en_fhg.c b/src/overlays/actors/ovl_En_fHG/z_en_fhg.c index bce528552b..02e24ff540 100644 --- a/src/overlays/actors/ovl_En_fHG/z_en_fhg.c +++ b/src/overlays/actors/ovl_En_fHG/z_en_fhg.c @@ -5,11 +5,28 @@ */ #include "z_en_fhg.h" -#include "assets/objects/object_fhg/object_fhg.h" #include "overlays/actors/ovl_Door_Shutter/z_door_shutter.h" #include "overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.h" #include "overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.h" +#include "libc64/qrand.h" +#include "attributes.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "segmented_address.h" +#include "seqcmd.h" +#include "sequence.h" +#include "sfx.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" +#include "z64skin.h" + +#include "assets/objects/object_fhg/object_fhg.h" + #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED typedef struct EnfHGPainting { diff --git a/src/overlays/actors/ovl_En_fHG/z_en_fhg.h b/src/overlays/actors/ovl_En_fHG/z_en_fhg.h index 5432f82341..dca6eeb82a 100644 --- a/src/overlays/actors/ovl_En_fHG/z_en_fhg.h +++ b/src/overlays/actors/ovl_En_fHG/z_en_fhg.h @@ -2,11 +2,12 @@ #define Z_EN_FHG_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" +#include "z64skin.h" struct EnfHG; -typedef void (*EnfHGActionFunc)(struct EnfHG*, PlayState*); +typedef void (*EnfHGActionFunc)(struct EnfHG*, struct PlayState*); typedef enum EnfHGSignal { /* 0 */ FHG_NO_SIGNAL, diff --git a/src/overlays/actors/ovl_End_Title/z_end_title.c b/src/overlays/actors/ovl_End_Title/z_end_title.c index 961f96f64f..3e2d26e509 100644 --- a/src/overlays/actors/ovl_End_Title/z_end_title.c +++ b/src/overlays/actors/ovl_End_Title/z_end_title.c @@ -5,7 +5,13 @@ */ #include "z_end_title.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sys_matrix.h" #include "versions.h" +#include "z64play.h" +#include "z64player.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) diff --git a/src/overlays/actors/ovl_End_Title/z_end_title.h b/src/overlays/actors/ovl_End_Title/z_end_title.h index 9897c0fbf2..cd29ff507c 100644 --- a/src/overlays/actors/ovl_End_Title/z_end_title.h +++ b/src/overlays/actors/ovl_End_Title/z_end_title.h @@ -2,7 +2,7 @@ #define Z_END_TITLE_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct EndTitle; diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index 2034187934..58929bd248 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -15,6 +15,7 @@ #include "gfx_setupdl.h" #include "ichain.h" #include "letterbox.h" +#include "printf.h" #include "rand.h" #include "regs.h" #include "rumble.h" @@ -26,17 +27,18 @@ #include "sys_matrix.h" #include "terminal.h" #include "versions.h" +#include "z_lib.h" #include "z64audio.h" #include "z64play.h" #include "z64player.h" +#include "z64save.h" #include "z64skin_matrix.h" -#include "z_lib.h" #if PLATFORM_N64 #include "cic6105.h" #endif -#pragma increment_block_number "gc-eu:170 gc-eu-mq:170 gc-jp:170 gc-jp-ce:170 gc-jp-mq:170 gc-us:170 gc-us-mq:170" \ - "ntsc-1.0:121 ntsc-1.1:121 ntsc-1.2:121 pal-1.0:121 pal-1.1:121" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.0:0" \ + "ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c b/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c index da8ddad524..a690bfa73f 100644 --- a/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c +++ b/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c @@ -5,6 +5,15 @@ */ #include "z_item_b_heart.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64item.h" +#include "z64play.h" + #include "assets/objects/object_gi_hearts/object_gi_hearts.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h b/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h index 432a7ef499..ef92f86b86 100644 --- a/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h +++ b/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h @@ -2,7 +2,7 @@ #define Z_ITEM_B_HEART_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ItemBHeart; diff --git a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c index e845f465a5..3909fb72f9 100644 --- a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c +++ b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c @@ -5,7 +5,15 @@ */ #include "z_item_etcetera.h" + +#include "libc64/qrand.h" +#include "libu64/debug.h" +#include "printf.h" +#include "rand.h" #include "z64draw.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64save.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h index c5054884bd..e938c81267 100644 --- a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h +++ b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h @@ -2,11 +2,11 @@ #define Z_ITEM_ETC_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ItemEtcetera; -typedef void (*ItemEtceteraActionFunc)(struct ItemEtcetera*, PlayState*); +typedef void (*ItemEtceteraActionFunc)(struct ItemEtcetera*, struct PlayState*); typedef struct ItemEtcetera { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c b/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c index 3f36c3da17..40594c86f6 100644 --- a/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c +++ b/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c @@ -6,6 +6,7 @@ #include "z_item_inbox.h" #include "z64draw.h" +#include "z64play.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY) diff --git a/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.h b/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.h index 3bf3cf1570..d13bad0053 100644 --- a/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.h +++ b/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.h @@ -2,11 +2,11 @@ #define Z_ITEM_INBOX_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ItemInbox; -typedef void (*ItemInboxActionFunc)(struct ItemInbox*, PlayState*); +typedef void (*ItemInboxActionFunc)(struct ItemInbox*, struct PlayState*); typedef struct ItemInbox { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.c b/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.c index 434322abc5..fa4f500c87 100644 --- a/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.c +++ b/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.c @@ -5,7 +5,15 @@ */ #include "z_item_ocarina.h" + +#include "libu64/debug.h" +#include "segmented_address.h" +#include "sfx.h" #include "z64draw.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/scenes/overworld/spot00/spot00_scene.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.h b/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.h index 9a02b99ed0..3ae598e7d1 100644 --- a/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.h +++ b/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.h @@ -2,11 +2,11 @@ #define Z_ITEM_OCARINA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ItemOcarina; -typedef void (*ItemOcarinaActionFunc)(struct ItemOcarina*, PlayState*); +typedef void (*ItemOcarinaActionFunc)(struct ItemOcarina*, struct PlayState*); typedef struct ItemOcarina { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Item_Shield/z_item_shield.c b/src/overlays/actors/ovl_Item_Shield/z_item_shield.c index 0307862327..2f281a17d2 100644 --- a/src/overlays/actors/ovl_Item_Shield/z_item_shield.c +++ b/src/overlays/actors/ovl_Item_Shield/z_item_shield.c @@ -4,8 +4,22 @@ * Description: Deku Shield */ -#include "terminal.h" #include "z_item_shield.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "rand.h" +#include "segmented_address.h" +#include "sys_math.h" +#include "sys_matrix.h" +#include "terminal.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64item.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_link_child/object_link_child.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_Item_Shield/z_item_shield.h b/src/overlays/actors/ovl_Item_Shield/z_item_shield.h index c7984f4a4d..564170e465 100644 --- a/src/overlays/actors/ovl_Item_Shield/z_item_shield.h +++ b/src/overlays/actors/ovl_Item_Shield/z_item_shield.h @@ -2,11 +2,11 @@ #define Z_ITEM_SHIELD_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ItemShield; -typedef void (*ItemShieldActionFunc)(struct ItemShield*, PlayState*); +typedef void (*ItemShieldActionFunc)(struct ItemShield*, struct PlayState*); typedef struct ItemShield { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c b/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c index d809a82ebe..d2912c7ea5 100644 --- a/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c +++ b/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c @@ -5,6 +5,17 @@ */ #include "z_magic_dark.h" + +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_UPDATE_DURING_OCARINA) diff --git a/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.h b/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.h index 3d7ef82298..59344baff1 100644 --- a/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.h +++ b/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.h @@ -2,7 +2,7 @@ #define Z_MAGIC_DARK_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct MagicDark; diff --git a/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c b/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c index ede5f3691c..e60e524b84 100644 --- a/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c +++ b/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c @@ -6,6 +6,15 @@ #include "z_magic_fire.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" + #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_UPDATE_DURING_OCARINA) void MagicFire_Init(Actor* thisx, PlayState* play); @@ -232,7 +241,7 @@ void MagicFire_Draw(Actor* thisx, PlayState* play) { (u8)(s32)(120 * this->screenTintIntensity)); gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_DISABLE); gDPSetColorDither(POLY_XLU_DISP++, G_CD_DISABLE); - gDPFillRectangle(POLY_XLU_DISP++, 0, 0, 319, 239); + gDPFillRectangle(POLY_XLU_DISP++, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1); Gfx_SetupDL_25Xlu(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 128, 255, 200, 0, (u8)(this->alphaMultiplier * 255)); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, (u8)(this->alphaMultiplier * 255)); diff --git a/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.h b/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.h index 4a9cb5188c..ae953c0d3c 100644 --- a/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.h +++ b/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.h @@ -2,7 +2,7 @@ #define Z_MAGIC_FIRE_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct MagicFire; diff --git a/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c b/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c index 0694e07128..57761244ba 100644 --- a/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c +++ b/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c @@ -6,6 +6,16 @@ #include "z_magic_wind.h" +#include "libu64/debug.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "sfx.h" +#include "z64curve.h" +#include "z64play.h" +#include "z64player.h" + #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_UPDATE_DURING_OCARINA) void MagicWind_Init(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.h b/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.h index e9521f7002..b7ba93c264 100644 --- a/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.h +++ b/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.h @@ -2,11 +2,12 @@ #define Z_MAGIC_WIND_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" +#include "z64curve.h" struct MagicWind; -typedef void (*MagicWindFunc)(struct MagicWind* this, PlayState* play); +typedef void (*MagicWindFunc)(struct MagicWind* this, struct PlayState* play); typedef struct MagicWind { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c index 1915999df6..861d72881f 100644 --- a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c +++ b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c @@ -5,6 +5,20 @@ */ #include "z_mir_ray.h" + +#include "libu64/debug.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "sfx.h" +#include "sys_math3d.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64light.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/object_mir_ray/object_mir_ray.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) @@ -118,10 +132,11 @@ void MirRay_SetupCollider(MirRay* this) { colliderOffset.x = (this->poolPt.x - this->sourcePt.x) * dataEntry->unk_10; colliderOffset.y = (this->poolPt.y - this->sourcePt.y) * dataEntry->unk_10; colliderOffset.z = (this->poolPt.z - this->sourcePt.z) * dataEntry->unk_10; - this->colliderSph.elements[0].dim.worldSphere.center.x = colliderOffset.x + this->sourcePt.x; - this->colliderSph.elements[0].dim.worldSphere.center.y = colliderOffset.y + this->sourcePt.y; - this->colliderSph.elements[0].dim.worldSphere.center.z = colliderOffset.z + this->sourcePt.z; - this->colliderSph.elements[0].dim.worldSphere.radius = dataEntry->unk_14 * this->colliderSph.elements->dim.scale; + this->colliderJntSph.elements[0].dim.worldSphere.center.x = colliderOffset.x + this->sourcePt.x; + this->colliderJntSph.elements[0].dim.worldSphere.center.y = colliderOffset.y + this->sourcePt.y; + this->colliderJntSph.elements[0].dim.worldSphere.center.z = colliderOffset.z + this->sourcePt.z; + this->colliderJntSph.elements[0].dim.worldSphere.radius = + dataEntry->unk_14 * this->colliderJntSph.elements->dim.scale; } // Set up a light point between source point and reflection point. Reflection point is the pool point (for windows) or @@ -208,8 +223,8 @@ void MirRay_Init(Actor* thisx, PlayState* play) { this->shieldCorners[5].y = -800.0f; if (PARAMS_GET_NOSHIFT(dataEntry->params, 1, 1)) { - Collider_InitJntSph(play, &this->colliderSph); - Collider_SetJntSph(play, &this->colliderSph, &this->actor, &sJntSphInit, &this->colliderSphItem); + Collider_InitJntSph(play, &this->colliderJntSph); + Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElements); if (!PARAMS_GET_NOSHIFT(dataEntry->params, 2, 1)) { // Beams not from mirrors MirRay_SetupCollider(this); } @@ -230,7 +245,7 @@ void MirRay_Destroy(Actor* thisx, PlayState* play) { LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); if (sMirRayData[this->actor.params].params & 2) { - Collider_DestroyJntSph(play, &this->colliderSph); + Collider_DestroyJntSph(play, &this->colliderJntSph); } Collider_DestroyQuad(play, &this->shieldRay); @@ -248,7 +263,7 @@ void MirRay_Update(Actor* thisx, PlayState* play) { if (sMirRayData[this->actor.params].params & 4) { // Beams from mirrors MirRay_SetupCollider(this); } - CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderSph.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderJntSph.base); } if (this->reflectIntensity > 0.0f) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->shieldRay.base); diff --git a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.h b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.h index 4e93149075..245cf1007b 100644 --- a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.h +++ b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.h @@ -2,7 +2,8 @@ #define Z_MIR_RAY_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" +#include "z64light.h" struct MirRay; @@ -22,14 +23,14 @@ typedef struct MirRayDataEntry { typedef struct MirRayShieldReflection { /* 0x00 */ Vec3f pos; /* 0x0C */ MtxF mtx; - /* 0x4C */ CollisionPoly* reflectionPoly; + /* 0x4C */ struct CollisionPoly* reflectionPoly; /* 0x50 */ u8 opacity; } MirRayShieldReflection; // size = 0x54 typedef struct MirRay { /* 0x0000 */ Actor actor; - /* 0x014C */ ColliderJntSph colliderSph; - /* 0x016C */ ColliderJntSphElement colliderSphItem; + /* 0x014C */ ColliderJntSph colliderJntSph; + /* 0x016C */ ColliderJntSphElement colliderJntSphElements[1]; /* 0x01AC */ ColliderQuad shieldRay; /* 0x022C */ f32 reflectIntensity; // Reflection occurs if it is positive, brightness depends on it /* 0x0230 */ Vec3f shieldCorners[6]; diff --git a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c index a7bf1716d7..88638e1ed8 100644 --- a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c +++ b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c @@ -5,9 +5,27 @@ */ #include "z_obj_bean.h" -#include "assets/objects/object_mamenoki/object_mamenoki.h" -#include "assets/objects/gameplay_keep/gameplay_keep.h" + +#include "libc64/qrand.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "regs.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_math3d.h" +#include "sys_matrix.h" #include "terminal.h" +#include "translation.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64cutscene_flags.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64save.h" + +#include "assets/objects/gameplay_keep/gameplay_keep.h" +#include "assets/objects/object_mamenoki/object_mamenoki.h" #define FLAGS ACTOR_FLAG_IGNORE_POINT_LIGHTS @@ -145,8 +163,9 @@ void ObjBean_InitDynaPoly(ObjBean* this, PlayState* play, CollisionHeader* colli if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; - PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_bean.c", 374, - this->dyna.actor.id, this->dyna.actor.params); + PRINTF(T("Warning : move BG 登録失敗", + "Warning : move BG registration failed") "(%s %d)(name %d)(arg_data 0x%04x)\n", + "../z_obj_bean.c", 374, this->dyna.actor.id, this->dyna.actor.params); } #endif } @@ -473,16 +492,17 @@ void ObjBean_Init(Actor* thisx, PlayState* play) { path = PARAMS_GET_U(this->dyna.actor.params, 8, 5); if (path == 0x1F) { PRINTF_COLOR_ERROR(); - // "No path data?" - PRINTF("パスデータが無い?(%s %d)(arg_data %xH)\n", "../z_obj_bean.c", 909, this->dyna.actor.params); + PRINTF(T("パスデータが無い?(%s %d)(arg_data %xH)\n", "No path data? (%s %d)(arg_data %xH)\n"), + "../z_obj_bean.c", 909, this->dyna.actor.params); PRINTF_RST(); Actor_Kill(&this->dyna.actor); return; } if (play->pathList[path].count < 3) { PRINTF_COLOR_ERROR(); - // "Incorrect number of path data" - PRINTF("パスデータ数が不正(%s %d)(arg_data %xH)\n", "../z_obj_bean.c", 921, this->dyna.actor.params); + PRINTF(T("パスデータ数が不正(%s %d)(arg_data %xH)\n", + "Path data count is invalid (%s %d)(arg_data %xH)\n"), + "../z_obj_bean.c", 921, this->dyna.actor.params); PRINTF_RST(); Actor_Kill(&this->dyna.actor); return; @@ -511,8 +531,8 @@ void ObjBean_Init(Actor* thisx, PlayState* play) { ObjBean_SetupWaitForBean(this); } this->dyna.actor.world.rot.z = this->dyna.actor.home.rot.z = this->dyna.actor.shape.rot.z = 0; - // "Magic bean tree lift" - PRINTF("(魔法の豆の木リフト)(arg_data 0x%04x)\n", this->dyna.actor.params); + PRINTF(T("(魔法の豆の木リフト)(arg_data 0x%04x)\n", "(Magic beanstalk lift)(arg_data 0x%04x)\n"), + this->dyna.actor.params); } void ObjBean_Destroy(Actor* thisx, PlayState* play) { @@ -889,8 +909,7 @@ void ObjBean_Update(Actor* thisx, PlayState* play) { if (ObjBean_CheckForHorseTrample(this, play)) { PRINTF_COLOR_CYAN(); - // "Horse and bean tree lift collision" - PRINTF("馬と豆の木リフト衝突!!!\n"); + PRINTF(T("馬と豆の木リフト衝突!!!\n", "Horse and beanstalk lift collide!!!\n")); PRINTF_RST(); ObjBean_Break(this, play); DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); diff --git a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.h b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.h index 317db48216..42ba39261c 100644 --- a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.h +++ b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.h @@ -2,11 +2,11 @@ #define Z_OBJ_BEAN_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ObjBean; -typedef void (*ObjBeanActionFunc)(struct ObjBean*, PlayState*); +typedef void (*ObjBeanActionFunc)(struct ObjBean*, struct PlayState*); typedef void (*ObjBeanTransformFunc)(struct ObjBean*); typedef struct ObjBean { diff --git a/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c b/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c index cb7cba62c0..8f24b7e647 100644 --- a/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c +++ b/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c @@ -7,6 +7,10 @@ #include "z_obj_blockstop.h" #include "overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h" +#include "sfx.h" +#include "z_lib.h" +#include "z64play.h" + #define FLAGS 0 void ObjBlockstop_Init(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.h b/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.h index f6ff149e9d..e0159e0f97 100644 --- a/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.h +++ b/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.h @@ -2,7 +2,7 @@ #define Z_OBJ_BLOCKSTOP_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ObjBlockstop; diff --git a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c index 68e1687aa8..c6d7b1da3f 100644 --- a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c +++ b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c @@ -6,6 +6,16 @@ #include "z_obj_bombiwa.h" #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" + +#include "libc64/qrand.h" +#include "array_count.h" +#include "ichain.h" +#include "rand.h" +#include "sfx.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/object_bombiwa/object_bombiwa.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.h b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.h index 33597276b0..9c5c38d127 100644 --- a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.h +++ b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.h @@ -2,7 +2,7 @@ #define Z_OBJ_BOMBIWA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ObjBombiwa; diff --git a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c index 6f86b829a4..d3affc90a9 100644 --- a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c +++ b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c @@ -6,6 +6,17 @@ #include "z_obj_comb.h" #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "sys_matrix.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/gameplay_field_keep/gameplay_field_keep.h" #define FLAGS 0 @@ -151,7 +162,7 @@ void ObjComb_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItems); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); ObjComb_SetupWait(this); } diff --git a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h index 3a6ce86413..acda97f16d 100644 --- a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h +++ b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h @@ -2,17 +2,17 @@ #define Z_OBJ_COMB_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ObjComb; -typedef void (*ObjCombActionFunc)(struct ObjComb*, PlayState*); +typedef void (*ObjCombActionFunc)(struct ObjComb*, struct PlayState*); typedef struct ObjComb { /* 0x0000 */ Actor actor; /* 0x014C */ ObjCombActionFunc actionFunc; /* 0x0150 */ ColliderJntSph collider; - /* 0x0170 */ ColliderJntSphElement colliderItems[1]; + /* 0x0170 */ ColliderJntSphElement colliderElements[1]; /* 0x01B0 */ s16 unk_1B0; /* 0x01B2 */ s16 unk_1B2; } ObjComb; // size = 0x01B4 diff --git a/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c b/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c index 3a0d603aae..2c77570a41 100644 --- a/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c +++ b/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c @@ -5,6 +5,14 @@ */ #include "z_obj_dekujr.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/object_dekujr/object_dekujr.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY) diff --git a/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.h b/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.h index 88818776a2..68b483f8dc 100644 --- a/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.h +++ b/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.h @@ -2,7 +2,7 @@ #define Z_OBJ_DEKUJR_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ObjDekujr; diff --git a/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c b/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c index 411d3e2ad9..2163114cd2 100644 --- a/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c +++ b/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c @@ -5,6 +5,14 @@ */ #include "z_obj_elevator.h" + +#include "ichain.h" +#include "printf.h" +#include "sfx.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" + #include "assets/objects/object_d_elevator/object_d_elevator.h" #define FLAGS 0 @@ -55,8 +63,9 @@ void func_80B92B08(ObjElevator* this, PlayState* play, CollisionHeader* collisio if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; - PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_elevator.c", 136, - this->dyna.actor.id, this->dyna.actor.params); + PRINTF(T("Warning : move BG 登録失敗", + "Warning : move BG registration failed") "(%s %d)(name %d)(arg_data 0x%04x)\n", + "../z_obj_elevator.c", 136, this->dyna.actor.id, this->dyna.actor.params); } #endif } diff --git a/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.h b/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.h index e77d04a9ae..e6b8d4b6d8 100644 --- a/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.h +++ b/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.h @@ -2,11 +2,11 @@ #define Z_OBJ_ELEVATOR_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ObjElevator; -typedef void (*ObjElevatorActionFunc)(struct ObjElevator*, PlayState*); +typedef void (*ObjElevatorActionFunc)(struct ObjElevator*, struct PlayState*); typedef struct ObjElevator { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c b/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c index 3f45341e30..39d6de7d65 100644 --- a/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c +++ b/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c @@ -5,6 +5,19 @@ */ #include "z_obj_hamishi.h" + +#include "libc64/qrand.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "rand.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/gameplay_field_keep/gameplay_field_keep.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.h b/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.h index a897177f64..8a2256bf04 100644 --- a/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.h +++ b/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.h @@ -2,7 +2,7 @@ #define Z_OBJ_HAMISHI_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ObjHamishi; diff --git a/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c b/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c index badd99186d..f1f8000063 100644 --- a/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c +++ b/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c @@ -5,6 +5,11 @@ */ #include "z_obj_hana.h" + +#include "ichain.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/objects/gameplay_field_keep/gameplay_field_keep.h" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.h b/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.h index 7fdd3bfa89..69c08b4cb6 100644 --- a/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.h +++ b/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.h @@ -2,7 +2,7 @@ #define Z_OBJ_HANA_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ObjHana; diff --git a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c index d946077670..c057c6b875 100644 --- a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c +++ b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c @@ -5,6 +5,17 @@ */ #include "z_obj_hsblock.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "regs.h" +#include "sys_matrix.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" + #include "assets/objects/object_d_hsblock/object_d_hsblock.h" #define FLAGS 0 @@ -64,8 +75,9 @@ void func_80B93B68(ObjHsblock* this, PlayState* play, CollisionHeader* collision if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; - PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_hsblock.c", 163, - this->dyna.actor.id, this->dyna.actor.params); + PRINTF(T("Warning : move BG 登録失敗", + "Warning : move BG registration failed") "(%s %d)(name %d)(arg_data 0x%04x)\n", + "../z_obj_hsblock.c", 163, this->dyna.actor.id, this->dyna.actor.params); } #endif } diff --git a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.h b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.h index 6548ca9b97..299ba7d3d6 100644 --- a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.h +++ b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.h @@ -2,11 +2,11 @@ #define Z_OBJ_HSBLOCK_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ObjHsblock; -typedef void (*ObjHsblockActionFunc)(struct ObjHsblock*, PlayState*); +typedef void (*ObjHsblockActionFunc)(struct ObjHsblock*, struct PlayState*); typedef struct ObjHsblock { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c index 23b1728fcc..71ff43d277 100644 --- a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c +++ b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c @@ -5,6 +5,17 @@ */ #include "z_obj_ice_poly.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "one_point_cutscene.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -85,18 +96,18 @@ void ObjIcePoly_Init(Actor* thisx, PlayState* play) { } Actor_SetScale(thisx, sScale[thisx->params]); thisx->world.pos.y = sOffsetY[thisx->params] + thisx->home.pos.y; - Collider_InitCylinder(play, &this->colliderIce); - Collider_SetCylinder(play, &this->colliderIce, thisx, &sCylinderInitIce); - Collider_InitCylinder(play, &this->colliderHard); - Collider_SetCylinder(play, &this->colliderHard, thisx, &sCylinderInitHard); - Collider_UpdateCylinder(thisx, &this->colliderIce); - Collider_UpdateCylinder(thisx, &this->colliderHard); + Collider_InitCylinder(play, &this->iceCollider); + Collider_SetCylinder(play, &this->iceCollider, thisx, &sCylinderInitIce); + Collider_InitCylinder(play, &this->hardCollider); + Collider_SetCylinder(play, &this->hardCollider, thisx, &sCylinderInitHard); + Collider_UpdateCylinder(thisx, &this->iceCollider); + Collider_UpdateCylinder(thisx, &this->hardCollider); thisx->colChkInfo.mass = MASS_IMMOVABLE; this->alpha = 255; - this->colliderIce.dim.radius *= thisx->scale.x; - this->colliderIce.dim.height *= thisx->scale.y; - this->colliderHard.dim.radius *= thisx->scale.x; - this->colliderHard.dim.height *= thisx->scale.y; + this->iceCollider.dim.radius *= thisx->scale.x; + this->iceCollider.dim.height *= thisx->scale.y; + this->hardCollider.dim.radius *= thisx->scale.x; + this->hardCollider.dim.height *= thisx->scale.y; Actor_SetFocus(thisx, thisx->scale.y * 30.0f); this->actionFunc = ObjIcePoly_Idle; } @@ -106,8 +117,8 @@ void ObjIcePoly_Destroy(Actor* thisx, PlayState* play) { ObjIcePoly* this = (ObjIcePoly*)thisx; if ((this->actor.params >= 0) && (this->actor.params < 3)) { - Collider_DestroyCylinder(play, &this->colliderIce); - Collider_DestroyCylinder(play, &this->colliderHard); + Collider_DestroyCylinder(play, &this->iceCollider); + Collider_DestroyCylinder(play, &this->hardCollider); } } @@ -116,17 +127,17 @@ void ObjIcePoly_Idle(ObjIcePoly* this, PlayState* play) { s32 pad; Vec3f pos; - if (this->colliderIce.base.acFlags & AC_HIT) { - this->meltTimer = -this->colliderIce.elem.acHitElem->atDmgInfo.damage; + if (this->iceCollider.base.acFlags & AC_HIT) { + this->meltTimer = -this->iceCollider.elem.acHitElem->atDmgInfo.damage; this->actor.focus.rot.y = this->actor.yawTowardsPlayer; OnePointCutscene_Init(play, 5120, 40, &this->actor, CAM_ID_MAIN); this->actionFunc = ObjIcePoly_Melt; } else if (this->actor.parent != NULL) { this->actor.parent->freezeTimer = 40; - CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderIce.base); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderIce.base); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderIce.base); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderHard.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->iceCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->iceCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->iceCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->hardCollider.base); } else { Actor_Kill(&this->actor); } diff --git a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.h b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.h index 8ebbe8d128..c6a56d16f1 100644 --- a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.h +++ b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.h @@ -2,11 +2,11 @@ #define Z_OBJ_ICE_POLY_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ObjIcePoly; -typedef void (*ObjIcePolyActionFunc)(struct ObjIcePoly*, PlayState*); +typedef void (*ObjIcePolyActionFunc)(struct ObjIcePoly*, struct PlayState*); typedef struct ObjIcePoly { /* 0x0000 */ Actor actor; @@ -14,8 +14,8 @@ typedef struct ObjIcePoly { /* 0x0150 */ u8 alpha; /* 0x0151 */ u8 unk_151; // Unused. Probably intended to be a switch flag. /* 0x0152 */ s16 meltTimer; - /* 0x0154 */ ColliderCylinder colliderIce; - /* 0x01A0 */ ColliderCylinder colliderHard; + /* 0x0154 */ ColliderCylinder iceCollider; + /* 0x01A0 */ ColliderCylinder hardCollider; } ObjIcePoly; // size = 0x01EC #endif diff --git a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c index 0f26d40611..8501c29f5b 100644 --- a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c +++ b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c @@ -5,9 +5,21 @@ */ #include "z_obj_kibako.h" -#include "assets/objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" +#include "libc64/qrand.h" +#include "ichain.h" +#include "printf.h" +#include "sfx.h" +#include "translation.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + +#include "assets/objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" + #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_CAN_PRESS_SWITCHES) void ObjKibako_Init(Actor* thisx, PlayState* play); @@ -97,8 +109,8 @@ void ObjKibako_Init(Actor* thisx, PlayState* play) { ObjKibako_InitCollider(&this->actor, play); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sCCInfoInit); ObjKibako_SetupIdle(this); - // "wooden box" - PRINTF("(dungeon keep 木箱)(arg_data 0x%04x)\n", this->actor.params); + PRINTF(T("(dungeon keep 木箱)(arg_data 0x%04x)\n", "(dungeon keep wooden box)(arg_data 0x%04x)\n"), + this->actor.params); } void ObjKibako_Destroy(Actor* thisx, PlayState* play2) { diff --git a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.h b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.h index 9378a51ce7..7538b53705 100644 --- a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.h +++ b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.h @@ -2,11 +2,11 @@ #define Z_OBJ_KIBAKO_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ObjKibako; -typedef void (*ObjKibakoActionFunc)(struct ObjKibako*, PlayState*); +typedef void (*ObjKibakoActionFunc)(struct ObjKibako*, struct PlayState*); typedef struct ObjKibako { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c index 035dbb9b09..9233f00c7a 100644 --- a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c +++ b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c @@ -5,9 +5,20 @@ */ #include "z_obj_kibako2.h" -#include "assets/objects/object_kibako2/object_kibako2.h" #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" +#include "libc64/qrand.h" +#include "ichain.h" +#include "printf.h" +#include "sfx.h" +#include "translation.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + +#include "assets/objects/object_kibako2/object_kibako2.h" + #define FLAGS 0 void ObjKibako2_Init(Actor* thisx, PlayState* play); @@ -130,9 +141,8 @@ void ObjKibako2_Init(Actor* thisx, PlayState* play) { this->actionFunc = ObjKibako2_Idle; this->dyna.actor.home.rot.z = this->dyna.actor.world.rot.z = this->dyna.actor.shape.rot.z = this->dyna.actor.world.rot.x = this->dyna.actor.shape.rot.x = 0; - // "Wooden box (stationary)" - PRINTF("木箱(据置)(arg %04xH)(item %04xH %d)\n", this->dyna.actor.params, this->collectibleFlag, - this->dyna.actor.home.rot.x); + PRINTF(T("木箱(据置)(arg %04xH)(item %04xH %d)\n", "Wooden box (stationary)(arg %04xH)(item %04xH %d)\n"), + this->dyna.actor.params, this->collectibleFlag, this->dyna.actor.home.rot.x); } void ObjKibako2_Destroy(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.h b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.h index 73f0e90b67..177ef0b04c 100644 --- a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.h +++ b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.h @@ -2,11 +2,11 @@ #define Z_OBJ_KIBAKO2_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ObjKibako2; -typedef void (*ObjKibako2ActionFunc)(struct ObjKibako2*, PlayState*); +typedef void (*ObjKibako2ActionFunc)(struct ObjKibako2*, struct PlayState*); typedef struct ObjKibako2 { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c index e13352a5a3..0a5866d1d1 100644 --- a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c +++ b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c @@ -5,9 +5,20 @@ */ #include "z_obj_lift.h" -#include "assets/objects/object_d_lift/object_d_lift.h" #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" + +#include "libc64/qrand.h" +#include "array_count.h" +#include "ichain.h" +#include "printf.h" #include "quake.h" +#include "sfx.h" +#include "translation.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + +#include "assets/objects/object_d_lift/object_d_lift.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -73,8 +84,9 @@ void ObjLift_InitDynaPoly(ObjLift* this, PlayState* play, CollisionHeader* colli if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; - PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_lift.c", 188, - this->dyna.actor.id, this->dyna.actor.params); + PRINTF(T("Warning : move BG 登録失敗", + "Warning : move BG registration failed") "(%s %d)(name %d)(arg_data 0x%04x)\n", + "../z_obj_lift.c", 188, this->dyna.actor.id, this->dyna.actor.params); } #endif } diff --git a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h index 6ca27dddac..e3f217b930 100644 --- a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h +++ b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.h @@ -2,11 +2,11 @@ #define Z_OBJ_LIFT_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ObjLift; -typedef void (*ObjLiftActionFunc)(struct ObjLift*, PlayState*); +typedef void (*ObjLiftActionFunc)(struct ObjLift*, struct PlayState*); typedef struct ObjLift { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c index adecf7e08b..05fe7a206f 100644 --- a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c +++ b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c @@ -5,8 +5,23 @@ */ #include "z_obj_lightswitch.h" -#include "terminal.h" #include "overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "terminal.h" +#include "translation.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/object_lightswitch/object_lightswitch.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -47,7 +62,7 @@ ActorProfile Obj_Lightswitch_Profile = { /**/ ObjLightswitch_Draw, }; -static ColliderJntSphElementInit sColliderJntSphElementInit[] = { +static ColliderJntSphElementInit sColliderJntSphElementsInit[] = { { { ELEM_MATERIAL_UNK0, @@ -70,7 +85,7 @@ static ColliderJntSphInit sColliderJntSphInit = { COLSHAPE_JNTSPH, }, 1, - sColliderJntSphElementInit, + sColliderJntSphElementsInit, }; static CollisionCheckInfoInit sColChkInfoInit = { 0, 12, 60, MASS_IMMOVABLE }; @@ -92,7 +107,7 @@ void ObjLightswitch_InitCollider(ObjLightswitch* this, PlayState* play) { s32 pad; Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sColliderJntSphInit, this->colliderItems); + Collider_SetJntSph(play, &this->collider, &this->actor, &sColliderJntSphInit, this->colliderElements); Matrix_SetTranslateRotateYXZ(this->actor.world.pos.x, this->actor.world.pos.y + (this->actor.shape.yOffset * this->actor.scale.y), this->actor.world.pos.z, &this->actor.shape.rot); @@ -189,8 +204,9 @@ void ObjLightswitch_Init(Actor* thisx, PlayState* play) { this->actor.home.pos.y, this->actor.home.pos.z, 0, this->actor.home.rot.y, 0, (0xFF << 8) | PUSHBLOCK_SMALL_START_ON) == NULL) { PRINTF_COLOR_ERROR(); - // "Push-pull block occurrence failure" - PRINTF("押引ブロック発生失敗(%s %d)(arg_data 0x%04x)\n", "../z_obj_lightswitch.c", 452, this->actor.params); + PRINTF(T("押引ブロック発生失敗(%s %d)(arg_data 0x%04x)\n", + "Push/pull block failure(%s %d)(arg_data 0x%04x)\n"), + "../z_obj_lightswitch.c", 452, this->actor.params); PRINTF_RST(); removeSelf = true; } @@ -200,8 +216,7 @@ void ObjLightswitch_Init(Actor* thisx, PlayState* play) { if (removeSelf) { Actor_Kill(&this->actor); } - // "Light switch" - PRINTF("(光スイッチ)(arg_data 0x%04x)\n", this->actor.params); + PRINTF(T("(光スイッチ)(arg_data 0x%04x)\n", "(Light switch)(arg_data 0x%04x)\n"), this->actor.params); } void ObjLightswitch_Destroy(Actor* thisx, PlayState* play2) { diff --git a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h index 78af71ed99..7f0834a240 100644 --- a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h +++ b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.h @@ -2,11 +2,11 @@ #define Z_OBJ_LIGHTSWITCH_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ObjLightswitch; -typedef void (*ObjLightswitchActionFunc)(struct ObjLightswitch*, PlayState*); +typedef void (*ObjLightswitchActionFunc)(struct ObjLightswitch*, struct PlayState*); typedef enum ObjLightswitch_Type { /* 0 */ OBJLIGHTSWITCH_TYPE_STAY_ON, // doesn't turn off unless the switch flag is cleared some other way @@ -19,7 +19,7 @@ typedef struct ObjLightswitch { /* 0x0000 */ Actor actor; /* 0x014C */ ObjLightswitchActionFunc actionFunc; /* 0x0150 */ ColliderJntSph collider; - /* 0x0170 */ ColliderJntSphElement colliderItems[1]; + /* 0x0170 */ ColliderJntSphElement colliderElements[1]; /* 0x01B0 */ s16 timer; // collision-related threshold and controls animation/logic when turning on/off /* 0x01B2 */ s16 toggleDelay; // timer ticking down used for delaying tuning on/off or disappearing, can be bypassed /* 0x01B4 */ s16 faceTextureIndex; // texture used by the center part of the sun diff --git a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c index 7ac997ae62..cc7651b6b4 100644 --- a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c +++ b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c @@ -5,8 +5,12 @@ */ #include "z_obj_makekinsuta.h" -#include "global.h" + +#include "printf.h" #include "terminal.h" +#include "translation.h" +#include "z64play.h" +#include "z64player.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -33,13 +37,12 @@ void ObjMakekinsuta_Init(Actor* thisx, PlayState* play) { if (PARAMS_GET_NOSHIFT(this->actor.params, 13, 2) == 0x4000) { PRINTF_COLOR_BLUE(); - // "Gold Star Enemy(arg_data %x)" - PRINTF("金スタ発生敵(arg_data %x)\n", this->actor.params); + PRINTF(T("金スタ発生敵(arg_data %x)\n", "Gold Star Enemy(arg_data %x)\n"), this->actor.params); PRINTF_RST(); } else { PRINTF_COLOR_WARNING(); - // "Invalid Argument (arg_data %x)(%s %d)" - PRINTF("引数不正 (arg_data %x)(%s %d)\n", this->actor.params, "../z_obj_makekinsuta.c", 119); + PRINTF(T("引数不正 (arg_data %x)(%s %d)\n", "Invalid Argument (arg_data %x)(%s %d)\n"), this->actor.params, + "../z_obj_makekinsuta.c", 119); PRINTF_RST(); } this->actionFunc = func_80B98320; diff --git a/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c b/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c index 3ea20567ef..ee2e8801c5 100644 --- a/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c +++ b/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c @@ -6,7 +6,15 @@ #include "z_obj_makeoshihiki.h" #include "overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h" + +#include "printf.h" +#include "sfx.h" +#include "sys_math3d.h" +#include "sys_matrix.h" #include "terminal.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" #define FLAGS ACTOR_FLAG_DRAW_CULLING_DISABLED @@ -71,9 +79,9 @@ void ObjMakeoshihiki_Init(Actor* thisx, PlayState* play) { if (Actor_SpawnAsChild(&play->actorCtx, thisx, play, ACTOR_OBJ_OSHIHIKI, spawnPos->x, spawnPos->y, spawnPos->z, 0, block->rotY, 0, ((block->color << 6) & 0xC0) | (block->type & 0xF) | 0xFF00) == NULL) { - // "Push-pull block failure" PRINTF_COLOR_ERROR(); - PRINTF("Error : 押し引きブロック発生失敗(%s %d)\n", "../z_obj_makeoshihiki.c", 194); + PRINTF(T("Error : 押し引きブロック発生失敗(%s %d)\n", "Error : Push/pull block failure (%s %d)\n"), + "../z_obj_makeoshihiki.c", 194); PRINTF_RST(); Actor_Kill(thisx); return; diff --git a/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.h b/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.h index 16dc3ba470..84938f578a 100644 --- a/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.h +++ b/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.h @@ -2,7 +2,7 @@ #define Z_OBJ_MAKEOSHIHIKI_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ObjMakeoshihiki; diff --git a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c index 90e1b5dda7..126e2c42ec 100644 --- a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c +++ b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c @@ -7,6 +7,12 @@ #include "z_obj_mure.h" #include "overlays/actors/ovl_En_Insect/z_en_insect.h" +#include "libc64/qrand.h" +#include "ichain.h" +#include "printf.h" +#include "translation.h" +#include "z64play.h" + #define FLAGS 0 void ObjMure_Init(Actor* thisx, PlayState* play); @@ -71,9 +77,9 @@ s32 ObjMure_SetCullingImpl(Actor* thisx, PlayState* play) { result = true; break; default: - // "Error : Culling is not set.(%s %d)(arg_data 0x%04x)" - PRINTF("Error : カリングの設定がされていません。(%s %d)(arg_data 0x%04x)\n", "../z_obj_mure.c", 204, - this->actor.params); + PRINTF(T("Error : カリングの設定がされていません。(%s %d)(arg_data 0x%04x)\n", + "Error : Culling is not set. (%s %d)(arg_data 0x%04x)\n"), + "../z_obj_mure.c", 204, this->actor.params); return false; } return result; @@ -95,11 +101,13 @@ void ObjMure_Init(Actor* thisx, PlayState* play) { this->type = PARAMS_GET_U(thisx->params, 0, 5); if (this->ptn >= 4) { - PRINTF("Error 群れな敵 (%s %d)(arg_data 0x%04x)\n", "../z_obj_mure.c", 237, thisx->params); + PRINTF(T("Error 群れな敵 (%s %d)(arg_data 0x%04x)\n", "Error Swarm of enemies (%s %d)(arg_data 0x%04x)\n"), + "../z_obj_mure.c", 237, thisx->params); Actor_Kill(&this->actor); return; } else if (this->type >= 5) { - PRINTF("Error 群れな敵 (%s %d)(arg_data 0x%04x)\n", "../z_obj_mure.c", 245, thisx->params); + PRINTF(T("Error 群れな敵 (%s %d)(arg_data 0x%04x)\n", "Error Swarm of enemies (%s %d)(arg_data 0x%04x)\n"), + "../z_obj_mure.c", 245, thisx->params); Actor_Kill(&this->actor); return; } else if (!ObjMure_SetCulling(thisx, play)) { @@ -107,12 +115,15 @@ void ObjMure_Init(Actor* thisx, PlayState* play) { return; } this->actionFunc = ObjMure_InitialAction; - PRINTF("群れな敵 (arg_data 0x%04x)(chNum(%d) ptn(%d) svNum(%d) type(%d))\n", thisx->params, this->chNum, this->ptn, - this->svNum, this->type); + PRINTF(T("群れな敵 (arg_data 0x%04x)(chNum(%d) ptn(%d) svNum(%d) type(%d))\n", + "Swarm of enemies (arg_data 0x%04x)(chNum(%d) ptn(%d) svNum(%d) type(%d))\n"), + thisx->params, this->chNum, this->ptn, this->svNum, this->type); #if DEBUG_FEATURES if (ObjMure_GetMaxChildSpawns(this) <= 0) { - PRINTF("Warning : 個体数が設定されていません(%s %d)(arg_data 0x%04x)\n", "../z_obj_mure.c", 268, thisx->params); + PRINTF(T("Warning : 個体数が設定されていません(%s %d)(arg_data 0x%04x)\n", + "Warning : The number of individuals is not set(%s %d)(arg_data 0x%04x)\n"), + "../z_obj_mure.c", 268, thisx->params); } #endif } @@ -130,7 +141,7 @@ s32 ObjMure_GetMaxChildSpawns(ObjMure* this) { void ObjMure_GetSpawnPos(Vec3f* outPos, Vec3f* inPos, s32 ptn, s32 idx) { #if DEBUG_FEATURES if (ptn >= 4) { - PRINTF("おかしなの (%s %d)\n", "../z_obj_mure.c", 307); + PRINTF(T("おかしなの (%s %d)\n", "That's strange (%s %d)\n"), "../z_obj_mure.c", 307); } #endif @@ -147,8 +158,9 @@ void ObjMure_SpawnActors0(ObjMure* this, PlayState* play) { for (i = 0; i < maxChildren; i++) { #if DEBUG_FEATURES if (this->children[i] != NULL) { - // "Error: I already have a child(%s %d)(arg_data 0x%04x)" - PRINTF("Error : 既に子供がいる(%s %d)(arg_data 0x%04x)\n", "../z_obj_mure.c", 333, actor->params); + PRINTF(T("Error : 既に子供がいる(%s %d)(arg_data 0x%04x)\n", + "Error : I already have a child (%s %d)(arg_data 0x%04x)\n"), + "../z_obj_mure.c", 333, actor->params); } #endif @@ -164,7 +176,8 @@ void ObjMure_SpawnActors0(ObjMure* this, PlayState* play) { this->children[i]->flags |= ACTOR_FLAG_GRASS_DESTROYED; this->children[i]->room = actor->room; } else { - PRINTF("warning 発生失敗 (%s %d)\n", "../z_obj_mure.c", 359); + PRINTF(T("warning 発生失敗 (%s %d)\n", "warning failed to occur (%s %d)\n"), "../z_obj_mure.c", + 359); } break; default: @@ -175,7 +188,8 @@ void ObjMure_SpawnActors0(ObjMure* this, PlayState* play) { if (this->children[i] != NULL) { this->children[i]->room = actor->room; } else { - PRINTF("warning 発生失敗 (%s %d)\n", "../z_obj_mure.c", 382); + PRINTF(T("warning 発生失敗 (%s %d)\n", "warning failed to occur (%s %d)\n"), "../z_obj_mure.c", + 382); } break; } @@ -192,7 +206,9 @@ void ObjMure_SpawnActors1(ObjMure* this, PlayState* play2) { for (i = 0; i < maxChildren; i++) { #if DEBUG_FEATURES if (this->children[i] != NULL) { - PRINTF("Error : 既に子供がいる(%s %d)(arg_data 0x%04x)\n", "../z_obj_mure.c", 407, actor->params); + PRINTF(T("Error : 既に子供がいる(%s %d)(arg_data 0x%04x)\n", + "Error : I already have a child (%s %d)(arg_data 0x%04x)\n"), + "../z_obj_mure.c", 407, actor->params); } #endif @@ -205,7 +221,7 @@ void ObjMure_SpawnActors1(ObjMure* this, PlayState* play2) { this->children[i]->room = actor->room; } else { this->childrenStates[i] = OBJMURE_CHILD_STATE_1; - PRINTF("warning 発生失敗 (%s %d)\n", "../z_obj_mure.c", 438); + PRINTF(T("warning 発生失敗 (%s %d)\n", "warning failed to occur (%s %d)\n"), "../z_obj_mure.c", 438); } } } diff --git a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.h b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.h index 386c6ed0d8..20cf667daa 100644 --- a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.h +++ b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.h @@ -2,11 +2,11 @@ #define Z_OBJ_MURE_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ObjMure; -typedef void (*ObjMureActionFunc)(struct ObjMure*, PlayState*); +typedef void (*ObjMureActionFunc)(struct ObjMure*, struct PlayState*); #define OBJMURE_MAX_SPAWNS 15 diff --git a/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c b/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c index bcdb0558e7..eca8b0d933 100644 --- a/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c +++ b/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c @@ -6,6 +6,13 @@ #include "z_obj_mure2.h" +#include "ichain.h" +#include "printf.h" +#include "sys_math3d.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" + #define FLAGS 0 typedef void (*ObjMure2SetPosFunc)(Vec3f* vec, ObjMure2* this); @@ -111,8 +118,9 @@ void ObjMure2_SpawnActors(ObjMure2* this, PlayState* play) { for (i = 0; i < D_80B9A818[actorNum]; i++) { if (this->actorSpawnPtrList[i] != NULL) { - // "Warning : I already have a child (%s %d)(arg_data 0x%04x)" - PRINTF("Warning : 既に子供がいる(%s %d)(arg_data 0x%04x)\n", "../z_obj_mure2.c", 269, this->actor.params); + PRINTF(T("Warning : 既に子供がいる(%s %d)(arg_data 0x%04x)\n", + "Warning : I already have a child (%s %d)(arg_data 0x%04x)\n"), + "../z_obj_mure2.c", 269, this->actor.params); continue; } diff --git a/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.h b/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.h index a197e9f7b0..8643d477e1 100644 --- a/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.h +++ b/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.h @@ -2,11 +2,11 @@ #define Z_OBJ_MURE2_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ObjMure2; -typedef void (*ObjMure2ActionFunc)(struct ObjMure2*, PlayState*); +typedef void (*ObjMure2ActionFunc)(struct ObjMure2*, struct PlayState*); typedef struct ObjMure2 { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c index c9ed01e3c9..51035c0678 100644 --- a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c +++ b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c @@ -6,6 +6,12 @@ #include "z_obj_mure3.h" +#include "ichain.h" +#include "sys_math3d.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64play.h" + #define FLAGS 0 void ObjMure3_Init(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.h b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.h index 415babc61b..fc9a3e83aa 100644 --- a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.h +++ b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.h @@ -2,17 +2,17 @@ #define Z_OBJ_MURE3_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ObjMure3; -typedef void (*ObjMure3ActionFunc)(struct ObjMure3*, PlayState*); -typedef void (*ObjMure3SpawnFunc)(struct ObjMure3*, PlayState*); +typedef void (*ObjMure3ActionFunc)(struct ObjMure3*, struct PlayState*); +typedef void (*ObjMure3SpawnFunc)(struct ObjMure3*, struct PlayState*); typedef struct ObjMure3 { /* 0x0000 */ Actor actor; /* 0x014C */ ObjMure3ActionFunc actionFunc; - /* 0x0150 */ EnItem00* unk_150[7]; + /* 0x0150 */ struct EnItem00* unk_150[7]; /* 0x016C */ u16 unk_16C; } ObjMure3; // size = 0x0170 diff --git a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c index 2d4457d3e8..efa0fe3f46 100644 --- a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c +++ b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c @@ -6,6 +6,21 @@ #include "z_obj_oshihiki.h" #include "overlays/actors/ovl_Obj_Switch/z_obj_switch.h" + +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "regs.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -96,9 +111,9 @@ void ObjOshihiki_InitDynapoly(ObjOshihiki* this, PlayState* play, CollisionHeade if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; - // "Warning : move BG registration failure" - PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_oshihiki.c", 280, - this->dyna.actor.id, this->dyna.actor.params); + PRINTF(T("Warning : move BG 登録失敗", + "Warning : move BG registration failed") "(%s %d)(name %d)(arg_data 0x%04x)\n", + "../z_obj_oshihiki.c", 280, this->dyna.actor.id, this->dyna.actor.params); } #endif } @@ -215,9 +230,9 @@ void ObjOshihiki_CheckType(ObjOshihiki* this, PlayState* play) { ObjOshihiki_InitDynapoly(this, play, &gPushBlockCol, 1); break; default: - // "Error : type cannot be determined" - PRINTF("Error : タイプが判別できない(%s %d)(arg_data 0x%04x)\n", "../z_obj_oshihiki.c", 444, - this->dyna.actor.params); + PRINTF(T("Error : タイプが判別できない(%s %d)(arg_data 0x%04x)\n", + "Error : type cannot be determined (%s %d)(arg_data 0x%04x)\n"), + "../z_obj_oshihiki.c", 444, this->dyna.actor.params); break; } } @@ -259,8 +274,9 @@ void ObjOshihiki_SetColor(ObjOshihiki* this, PlayState* play2) { } if (i >= ARRAY_COUNT(sColors)) { - // "Error : scene_data_ID cannot be determined" - PRINTF("Error : scene_data_ID が判別できない。(%s %d)\n", "../z_obj_oshihiki.c", 579); + PRINTF(T("Error : scene_data_ID が判別できない。(%s %d)\n", + "Error : scene_data_ID cannot be determined. (%s %d)\n"), + "../z_obj_oshihiki.c", 579); color->r = color->g = color->b = 255; } else { src = &sColors[i][paramsColorIdx]; @@ -305,8 +321,8 @@ void ObjOshihiki_Init(Actor* thisx, PlayState* play2) { ObjOshihiki_SetColor(this, play); ObjOshihiki_ResetFloors(this); ObjOshihiki_SetupOnActor(this, play); - // "(dungeon keep push-pull block)" - PRINTF("(dungeon keep 押し引きブロック)(arg_data 0x%04x)\n", this->dyna.actor.params); + PRINTF(T("(dungeon keep 押し引きブロック)(arg_data 0x%04x)\n", "(dungeon keep push/pull block)(arg_data 0x%04x)\n"), + this->dyna.actor.params); } void ObjOshihiki_Destroy(Actor* thisx, PlayState* play) { @@ -372,9 +388,9 @@ s32 ObjOshihiki_CheckFloor(ObjOshihiki* this, PlayState* play) { s32 ObjOshihiki_CheckGround(ObjOshihiki* this, PlayState* play) { if (this->dyna.actor.world.pos.y <= BGCHECK_Y_MIN + 10.0f) { - // "Warning : Push-pull block fell too much" - PRINTF("Warning : 押し引きブロック落ちすぎた(%s %d)(arg_data 0x%04x)\n", "../z_obj_oshihiki.c", 809, - this->dyna.actor.params); + PRINTF(T("Warning : 押し引きブロック落ちすぎた(%s %d)(arg_data 0x%04x)\n", + "Warning : Push/pull block fell too much (%s %d)(arg_data 0x%04x)\n"), + "../z_obj_oshihiki.c", 809, this->dyna.actor.params); Actor_Kill(&this->dyna.actor); return 0; } diff --git a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h index 90dce5ca45..265ba4691c 100644 --- a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h +++ b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h @@ -2,7 +2,7 @@ #define Z_OBJ_OSHIHIKI_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ObjOshihiki; @@ -27,7 +27,7 @@ typedef enum PushBlockType { #define PUSHBLOCK_SETUP_FALL (1 << 7) #define PUSHBLOCK_MOVE_UNDER (1 << 8) -typedef void (*ObjOshihikiActionFunc)(struct ObjOshihiki*, PlayState*); +typedef void (*ObjOshihikiActionFunc)(struct ObjOshihiki*, struct PlayState*); typedef struct ObjOshihiki { /* 0x0000 */ DynaPolyActor dyna; @@ -40,7 +40,7 @@ typedef struct ObjOshihiki { /* 0x0178 */ f32 pushDist; /* 0x017C */ f32 direction; /* 0x0180 */ s32 floorBgIds[5]; - /* 0x0194 */ CollisionPoly* floorPolys[5]; + /* 0x0194 */ struct CollisionPoly* floorPolys[5]; /* 0x01A8 */ f32 floorHeights[5]; /* 0x01BC */ s16 highestFloor; /* 0x01BE */ u8 cantMove; diff --git a/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c b/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c index 8ed5e8558e..6eca379686 100644 --- a/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c +++ b/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c @@ -6,6 +6,11 @@ #include "z_obj_roomtimer.h" +#include "sfx.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64save.h" + #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED void ObjRoomtimer_Init(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.h b/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.h index 2f1b08d9c9..ee8e74eaa2 100644 --- a/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.h +++ b/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.h @@ -2,12 +2,11 @@ #define Z_OBJ_ROOMTIMER_H #include "ultra64.h" -#include "global.h" -#include "z64.h" +#include "z64actor.h" struct ObjRoomtimer; -typedef void (*ObjRoomtimerActionFunc)(struct ObjRoomtimer*, PlayState*); +typedef void (*ObjRoomtimerActionFunc)(struct ObjRoomtimer*, struct PlayState*); typedef struct ObjRoomtimer { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c index e791de6297..2ad4bbf09a 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c @@ -5,8 +5,24 @@ */ #include "z_obj_switch.h" -#include "assets/objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" + +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "rumble.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_matrix.h" #include "terminal.h" +#include "translation.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" + +#include "assets/objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -147,7 +163,7 @@ static ColliderTrisInit sEyeTrisInit = { sEyeTrisElementsInit, }; -static ColliderJntSphElementInit sCrystalJntSphElementInit[1] = { +static ColliderJntSphElementInit sCrystalJntSphElementsInit[1] = { { { ELEM_MATERIAL_UNK0, @@ -170,8 +186,8 @@ static ColliderJntSphInit sCrystalJntSphInit = { OC2_TYPE_2, COLSHAPE_JNTSPH, }, - ARRAY_COUNT(sCrystalJntSphElementInit), - sCrystalJntSphElementInit, + ARRAY_COUNT(sCrystalJntSphElementsInit), + sCrystalJntSphElementsInit, }; static InitChainEntry sInitChain[] = { @@ -202,18 +218,18 @@ void ObjSwitch_InitDynaPoly(ObjSwitch* this, PlayState* play, CollisionHeader* c if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; - // "Warning : move BG registration failure" - PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_switch.c", 531, - this->dyna.actor.id, this->dyna.actor.params); + PRINTF(T("Warning : move BG 登録失敗", + "Warning : move BG registration failed") "(%s %d)(name %d)(arg_data 0x%04x)\n", + "../z_obj_switch.c", 531, this->dyna.actor.id, this->dyna.actor.params); } #endif } void ObjSwitch_InitJntSphCollider(ObjSwitch* this, PlayState* play, ColliderJntSphInit* colliderJntSphInit) { - ColliderJntSph* colliderJntSph = &this->jntSph.col; + ColliderJntSph* colliderJntSph = &this->jntSph.collider; Collider_InitJntSph(play, colliderJntSph); - Collider_SetJntSph(play, colliderJntSph, &this->dyna.actor, colliderJntSphInit, this->jntSph.items); + Collider_SetJntSph(play, colliderJntSph, &this->dyna.actor, colliderJntSphInit, this->jntSph.colliderElements); Matrix_SetTranslateRotateYXZ(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + this->dyna.actor.shape.yOffset * this->dyna.actor.scale.y, @@ -223,13 +239,13 @@ void ObjSwitch_InitJntSphCollider(ObjSwitch* this, PlayState* play, ColliderJntS } void ObjSwitch_InitTrisCollider(ObjSwitch* this, PlayState* play, ColliderTrisInit* colliderTrisInit) { - ColliderTris* colliderTris = &this->tris.col; + ColliderTris* colliderTris = &this->tris.collider; s32 i; s32 j; Vec3f pos[3]; Collider_InitTris(play, colliderTris); - Collider_SetTris(play, colliderTris, &this->dyna.actor, colliderTrisInit, this->tris.items); + Collider_SetTris(play, colliderTris, &this->dyna.actor, colliderTrisInit, this->tris.colliderElements); for (i = 0; i < 2; i++) { for (j = 0; j < 3; j++) { @@ -323,7 +339,7 @@ void ObjSwitch_Init(Actor* thisx, PlayState* play) { if (OBJSWITCH_FROZEN(&this->dyna.actor) && (ObjSwitch_SpawnIce(this, play) == NULL)) { PRINTF_COLOR_RED(); - PRINTF("Error : 氷発生失敗 (%s %d)\n", "../z_obj_switch.c", 732); + PRINTF(T("Error : 氷発生失敗 (%s %d)\n", "Error : Ice generation failure (%s %d)\n"), "../z_obj_switch.c", 732); PRINTF_RST(); this->dyna.actor.params &= ~OBJSWITCH_FROZEN_FLAG; } @@ -368,12 +384,12 @@ void ObjSwitch_Destroy(Actor* thisx, PlayState* play) { switch (OBJSWITCH_TYPE(&this->dyna.actor)) { case OBJSWITCH_TYPE_FLOOR_RUSTY: case OBJSWITCH_TYPE_EYE: - Collider_DestroyTris(play, &this->tris.col); + Collider_DestroyTris(play, &this->tris.collider); break; case OBJSWITCH_TYPE_CRYSTAL: case OBJSWITCH_TYPE_CRYSTAL_TARGETABLE: - Collider_DestroyJntSph(play, &this->jntSph.col); + Collider_DestroyJntSph(play, &this->jntSph.collider); break; } } @@ -385,12 +401,12 @@ void ObjSwitch_FloorUpInit(ObjSwitch* this) { void ObjSwitch_FloorUp(ObjSwitch* this, PlayState* play) { if (OBJSWITCH_TYPE(&this->dyna.actor) == OBJSWITCH_TYPE_FLOOR_RUSTY) { - if (this->tris.col.base.acFlags & AC_HIT) { + if (this->tris.collider.base.acFlags & AC_HIT) { ObjSwitch_FloorPressInit(this); ObjSwitch_SetOn(this, play); - this->tris.col.base.acFlags &= ~AC_HIT; + this->tris.collider.base.acFlags &= ~AC_HIT; } else { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->tris.col.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->tris.collider.base); } } else { switch (OBJSWITCH_SUBTYPE(&this->dyna.actor)) { @@ -509,8 +525,8 @@ s32 ObjSwitch_EyeIsHit(ObjSwitch* this) { Actor* collidingActor; s16 yawDiff; - if ((this->tris.col.base.acFlags & AC_HIT) && !(this->prevColFlags & AC_HIT)) { - collidingActor = this->tris.col.base.ac; + if ((this->tris.collider.base.acFlags & AC_HIT) && !(this->prevColFlags & AC_HIT)) { + collidingActor = this->tris.collider.base.ac; if (collidingActor != NULL) { yawDiff = collidingActor->world.rot.y - this->dyna.actor.shape.rot.y; if (ABS(yawDiff) > 0x5000) { @@ -613,7 +629,7 @@ void ObjSwitch_CrystalOffInit(ObjSwitch* this) { void ObjSwitch_CrystalOff(ObjSwitch* this, PlayState* play) { switch (OBJSWITCH_SUBTYPE(&this->dyna.actor)) { case OBJSWITCH_SUBTYPE_ONCE: - if ((this->jntSph.col.base.acFlags & AC_HIT) && this->disableAcTimer <= 0) { + if ((this->jntSph.collider.base.acFlags & AC_HIT) && this->disableAcTimer <= 0) { this->disableAcTimer = 10; ObjSwitch_SetOn(this, play); ObjSwitch_CrystalTurnOnInit(this); @@ -621,7 +637,7 @@ void ObjSwitch_CrystalOff(ObjSwitch* this, PlayState* play) { break; case OBJSWITCH_SUBTYPE_SYNC: - if (((this->jntSph.col.base.acFlags & AC_HIT) && this->disableAcTimer <= 0) || + if (((this->jntSph.collider.base.acFlags & AC_HIT) && this->disableAcTimer <= 0) || Flags_GetSwitch(play, OBJSWITCH_SWITCH_FLAG(&this->dyna.actor))) { this->disableAcTimer = 10; @@ -631,7 +647,7 @@ void ObjSwitch_CrystalOff(ObjSwitch* this, PlayState* play) { break; case OBJSWITCH_SUBTYPE_TOGGLE: - if ((this->jntSph.col.base.acFlags & AC_HIT) && !(this->prevColFlags & AC_HIT) && + if ((this->jntSph.collider.base.acFlags & AC_HIT) && !(this->prevColFlags & AC_HIT) && this->disableAcTimer <= 0) { this->disableAcTimer = 10; ObjSwitch_SetOn(this, play); @@ -675,7 +691,7 @@ void ObjSwitch_CrystalOn(ObjSwitch* this, PlayState* play) { break; case OBJSWITCH_SUBTYPE_TOGGLE: - if ((this->jntSph.col.base.acFlags & AC_HIT) && !(this->prevColFlags & AC_HIT) && + if ((this->jntSph.collider.base.acFlags & AC_HIT) && !(this->prevColFlags & AC_HIT) && this->disableAcTimer <= 0) { this->disableAcTimer = 10; ObjSwitch_CrystalTurnOffInit(this); @@ -719,9 +735,9 @@ void ObjSwitch_Update(Actor* thisx, PlayState* play) { break; case OBJSWITCH_TYPE_EYE: - this->prevColFlags = this->tris.col.base.acFlags; - this->tris.col.base.acFlags &= ~AC_HIT; - CollisionCheck_SetAC(play, &play->colChkCtx, &this->tris.col.base); + this->prevColFlags = this->tris.collider.base.acFlags; + this->tris.collider.base.acFlags &= ~AC_HIT; + CollisionCheck_SetAC(play, &play->colChkCtx, &this->tris.collider.base); break; case OBJSWITCH_TYPE_CRYSTAL: @@ -729,12 +745,12 @@ void ObjSwitch_Update(Actor* thisx, PlayState* play) { if (!Player_InCsMode(play) && this->disableAcTimer > 0) { this->disableAcTimer--; } - this->prevColFlags = this->jntSph.col.base.acFlags; - this->jntSph.col.base.acFlags &= ~AC_HIT; + this->prevColFlags = this->jntSph.collider.base.acFlags; + this->jntSph.collider.base.acFlags &= ~AC_HIT; if (this->disableAcTimer <= 0) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->jntSph.col.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->jntSph.collider.base); } - CollisionCheck_SetOC(play, &play->colChkCtx, &this->jntSph.col.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->jntSph.collider.base); break; } } diff --git a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h index b6fb243f70..b4d3ae8b20 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h @@ -2,12 +2,12 @@ #define Z_OBJ_SWITCH_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ObjSwitch; -typedef void (*ObjSwitchActionFunc)(struct ObjSwitch*, PlayState*); -typedef void (*ObjSwitchDrawFunc)(Actor*, PlayState*); +typedef void (*ObjSwitchActionFunc)(struct ObjSwitch*, struct PlayState*); +typedef void (*ObjSwitchDrawFunc)(Actor*, struct PlayState*); typedef enum ObjSwitchType { /* 0 */ OBJSWITCH_TYPE_FLOOR, @@ -26,13 +26,13 @@ typedef enum ObjSwitchSubType { } ObjSwitchSubType; typedef struct ObjSwitchJntSph { - /* 0x00 */ ColliderJntSph col; - /* 0x20 */ ColliderJntSphElement items[1]; + /* 0x00 */ ColliderJntSph collider; + /* 0x20 */ ColliderJntSphElement colliderElements[1]; } ObjSwitchJntSph; typedef struct ObjSwitchTris { - /* 0x00 */ ColliderTris col; - /* 0x20 */ ColliderTrisElement items[2]; + /* 0x00 */ ColliderTris collider; + /* 0x20 */ ColliderTrisElement colliderElements[2]; } ObjSwitchTris; typedef struct ObjSwitch { diff --git a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c index 7c221da0b8..a189fe4345 100644 --- a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c +++ b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c @@ -6,6 +6,17 @@ #include "z_obj_syokudai.h" #include "overlays/actors/ovl_En_Arrow/z_en_arrow.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64play.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_syokudai/object_syokudai.h" @@ -86,12 +97,12 @@ void ObjSyokudai_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); - Collider_InitCylinder(play, &this->colliderStand); - Collider_SetCylinder(play, &this->colliderStand, &this->actor, &sCylInitStand); - this->colliderStand.base.colMaterial = sColMaterialsStand[PARAMS_GET_NOMASK(this->actor.params, 12)]; + Collider_InitCylinder(play, &this->standCollider); + Collider_SetCylinder(play, &this->standCollider, &this->actor, &sCylInitStand); + this->standCollider.base.colMaterial = sColMaterialsStand[PARAMS_GET_NOMASK(this->actor.params, 12)]; - Collider_InitCylinder(play, &this->colliderFlame); - Collider_SetCylinder(play, &this->colliderFlame, &this->actor, &sCylInitFlame); + Collider_InitCylinder(play, &this->flameCollider); + Collider_SetCylinder(play, &this->flameCollider, &this->actor, &sCylInitFlame); this->actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -113,8 +124,8 @@ void ObjSyokudai_Destroy(Actor* thisx, PlayState* play) { s32 pad; ObjSyokudai* this = (ObjSyokudai*)thisx; - Collider_DestroyCylinder(play, &this->colliderStand); - Collider_DestroyCylinder(play, &this->colliderFlame); + Collider_DestroyCylinder(play, &this->standCollider); + Collider_DestroyCylinder(play, &this->flameCollider); LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); } @@ -171,8 +182,8 @@ void ObjSyokudai_Update(Actor* thisx, PlayState* play2) { this->litTimer = 20; } } - if (this->colliderFlame.base.acFlags & AC_HIT) { - dmgFlags = this->colliderFlame.elem.acHitElem->atDmgInfo.dmgFlags; + if (this->flameCollider.base.acFlags & AC_HIT) { + dmgFlags = this->flameCollider.elem.acHitElem->atDmgInfo.dmgFlags; if (dmgFlags & (DMG_FIRE | DMG_ARROW_NORMAL)) { interactionType = 1; } @@ -195,7 +206,7 @@ void ObjSyokudai_Update(Actor* thisx, PlayState* play2) { player->unk_860 = 200; } } else if (dmgFlags & DMG_ARROW_NORMAL) { - arrow = (EnArrow*)this->colliderFlame.base.ac; + arrow = (EnArrow*)this->flameCollider.base.ac; if ((arrow->actor.update != NULL) && (arrow->actor.id == ACTOR_EN_ARROW)) { arrow->actor.params = 0; arrow->collider.elem.atDmgInfo.dmgFlags = DMG_ARROW_FIRE; @@ -232,12 +243,12 @@ void ObjSyokudai_Update(Actor* thisx, PlayState* play2) { } } - Collider_UpdateCylinder(&this->actor, &this->colliderStand); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderStand.base); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderStand.base); + Collider_UpdateCylinder(&this->actor, &this->standCollider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->standCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->standCollider.base); - Collider_UpdateCylinder(&this->actor, &this->colliderFlame); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderFlame.base); + Collider_UpdateCylinder(&this->actor, &this->flameCollider); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->flameCollider.base); if (this->litTimer > 0) { this->litTimer--; diff --git a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.h b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.h index 8c4e1b7d16..4dee2ba671 100644 --- a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.h +++ b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.h @@ -2,14 +2,15 @@ #define Z_OBJ_SYOKUDAI_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" +#include "z64light.h" struct ObjSyokudai; typedef struct ObjSyokudai { /* 0x0000 */ Actor actor; - /* 0x014C */ ColliderCylinder colliderStand; - /* 0x0198 */ ColliderCylinder colliderFlame; + /* 0x014C */ ColliderCylinder standCollider; + /* 0x0198 */ ColliderCylinder flameCollider; /* 0x01E4 */ s16 litTimer; /* 0x01E6 */ u8 flameTexScroll; /* 0x01E8 */ LightNode* lightNode; diff --git a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c index bc231076ce..b3dc890ca8 100644 --- a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c +++ b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c @@ -5,6 +5,21 @@ */ #include "z_obj_timeblock.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "translation.h" +#include "z_lib.h" +#include "z64ocarina.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_timeblock/object_timeblock.h" #define FLAGS \ @@ -135,10 +150,10 @@ void ObjTimeblock_Init(Actor* thisx, PlayState* play) { ObjTimeblock_SetupAltBehaviourNotVisible(this); } - // "Block of time" - PRINTF("時のブロック ( %04xH save:%d color:%d range:%d move:%d)\n", (u16)this->dyna.actor.params, - this->unk_177, this->dyna.actor.home.rot.z & 7, PARAMS_GET_U(this->dyna.actor.params, 11, 3), - PARAMS_GET_U(this->dyna.actor.params, 10, 1)); + PRINTF(T("時のブロック ( %04xH save:%d color:%d range:%d move:%d)\n", + "Time Block ( %04xH save:%d color:%d range:%d move:%d)\n"), + (u16)this->dyna.actor.params, this->unk_177, this->dyna.actor.home.rot.z & 7, + PARAMS_GET_U(this->dyna.actor.params, 11, 3), PARAMS_GET_U(this->dyna.actor.params, 10, 1)); } void ObjTimeblock_Destroy(Actor* thisx, PlayState* play) { @@ -219,8 +234,9 @@ void ObjTimeblock_Normal(ObjTimeblock* this, PlayState* play) { // Possibly points the camera to this actor OnePointCutscene_Attention(play, &this->dyna.actor); - // "◯◯◯◯ Time Block Attention Camera (frame counter %d)\n" - PRINTF("◯◯◯◯ Time Block 注目カメラ (frame counter %d)\n", play->state.frames); + PRINTF(T("◯◯◯◯ Time Block 注目カメラ (frame counter %d)\n", + "◯◯◯◯ Time Block Attention Camera (frame counter %d)\n"), + play->state.frames); this->demoEffectFirstPartTimer = 12; @@ -277,8 +293,9 @@ void ObjTimeblock_AltBehaviorVisible(ObjTimeblock* this, PlayState* play) { ObjTimeblock_SpawnDemoEffect(this, play); this->demoEffectTimer = 160; OnePointCutscene_Attention(play, &this->dyna.actor); - // "Time Block Attention Camera (frame counter)" - PRINTF("◯◯◯◯ Time Block 注目カメラ (frame counter %d)\n", play->state.frames); + PRINTF(T("◯◯◯◯ Time Block 注目カメラ (frame counter %d)\n", + "◯◯◯◯ Time Block Attention Camera (frame counter %d)\n"), + play->state.frames); ObjTimeblock_ToggleSwitchFlag(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)); } diff --git a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.h b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.h index 9bd393b194..966f474496 100644 --- a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.h +++ b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.h @@ -2,12 +2,12 @@ #define Z_OBJ_TIMEBLOCK_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ObjTimeblock; -typedef s32 (*ObjTimeblockSongObserverFunc)(struct ObjTimeblock*, PlayState*); -typedef void (*ObjTimeblockActionFunc)(struct ObjTimeblock*, PlayState*); +typedef s32 (*ObjTimeblockSongObserverFunc)(struct ObjTimeblock*, struct PlayState*); +typedef void (*ObjTimeblockActionFunc)(struct ObjTimeblock*, struct PlayState*); typedef struct ObjTimeblock { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c index a5911678e4..9afd53ae53 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -6,6 +6,19 @@ #include "z_obj_tsubo.h" #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" + +#include "libc64/qrand.h" +#include "ichain.h" +#include "printf.h" +#include "sfx.h" +#include "translation.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64item.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" #include "assets/objects/object_tsubo/object_tsubo.h" @@ -112,7 +125,7 @@ s32 ObjTsubo_SnapToFloor(ObjTsubo* this, PlayState* play) { Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos); return true; } else { - PRINTF("地面に付着失敗\n"); + PRINTF(T("地面に付着失敗\n", "Failed to attach to ground\n")); return false; } } @@ -137,11 +150,12 @@ void ObjTsubo_Init(Actor* thisx, PlayState* play) { } this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[PARAMS_GET_U(this->actor.params, 8, 1)]); if (this->requiredObjectSlot < 0) { - PRINTF("Error : バンク危険! (arg_data 0x%04x)(%s %d)\n", this->actor.params, "../z_obj_tsubo.c", 410); + PRINTF(T("Error : バンク危険! (arg_data 0x%04x)(%s %d)\n", "Error : Bank danger! (arg_data 0x%04x)(%s %d)\n"), + this->actor.params, "../z_obj_tsubo.c", 410); Actor_Kill(&this->actor); } else { ObjTsubo_SetupWaitForObject(this); - PRINTF("(dungeon keep 壷)(arg_data 0x%04x)\n", this->actor.params); + PRINTF(T("(dungeon keep 壷)(arg_data 0x%04x)\n", "(dungeon keep pot)(arg_data 0x%04x)\n"), this->actor.params); } } diff --git a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h index aa30398c78..8e27cc8310 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h @@ -2,11 +2,11 @@ #define Z_OBJ_TSUBO_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ObjTsubo; -typedef void (*ObjTsuboActionFunc)(struct ObjTsubo*, PlayState*); +typedef void (*ObjTsuboActionFunc)(struct ObjTsubo*, struct PlayState*); typedef struct ObjTsubo { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c index 94c6618470..55023cccc1 100644 --- a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c +++ b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c @@ -5,8 +5,23 @@ */ #include "z_obj_warp2block.h" -#include "assets/objects/object_timeblock/object_timeblock.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "sfx.h" +#include "sys_math3d.h" +#include "sys_matrix.h" #include "terminal.h" +#include "translation.h" +#include "z_lib.h" +#include "z64ocarina.h" +#include "z64play.h" +#include "z64player.h" + +#include "assets/objects/object_timeblock/object_timeblock.h" #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_UPDATE_DURING_OCARINA | \ @@ -220,7 +235,8 @@ void ObjWarp2block_Init(Actor* thisx, PlayState* play2) { ObjWarp2block_SetInactive(this); } - PRINTF("時のブロック(ワープ2) ( %04xH color:%d range:%d)\n", + PRINTF(T("時のブロック(ワープ2) ( %04xH color:%d range:%d)\n", + "Time Block (Warp 2) ( %04xH color:%d range:%d)\n"), PARAMS_GET_U(this->dyna.actor.params, 0, 16), this->dyna.actor.home.rot.z & 7, PARAMS_GET_U(this->dyna.actor.params, 11, 3)); } @@ -265,7 +281,9 @@ void func_80BA24F8(ObjWarp2block* this, PlayState* play) { this->unk_174++; if (this->unk_174 > 60) { PRINTF_COLOR_ERROR(); - PRINTF("Error : 時のブロック(ワープ2)が対でセットされていません(%s %d)\n", "../z_obj_warp2block.c", 505); + PRINTF(T("Error : 時のブロック(ワープ2)が対でセットされていません(%s %d)\n", + "Error : Time Blocks (Warp 2) are not set in pairs (%s %d)\n"), + "../z_obj_warp2block.c", 505); PRINTF_RST(); Actor_Kill(&this->dyna.actor); } diff --git a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.h b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.h index 3e09d976c2..8f22398db7 100644 --- a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.h +++ b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.h @@ -2,12 +2,12 @@ #define Z_OBJ_WARP2BLOCK_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ObjWarp2block; -typedef void (*ObjWarp2blockActionFunc)(struct ObjWarp2block*, PlayState*); -typedef s32 (*ObjWarp2blockFunc168)(struct ObjWarp2block*, PlayState*); +typedef void (*ObjWarp2blockActionFunc)(struct ObjWarp2block*, struct PlayState*); +typedef s32 (*ObjWarp2blockFunc168)(struct ObjWarp2block*, struct PlayState*); typedef struct ObjWarp2block { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c index 25048f5349..c170279758 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -5,6 +5,22 @@ */ #include "z_object_kankyo.h" + +#include "libc64/qrand.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_math3d.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_demo_kekkai/object_demo_kekkai.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_spot02_objects/object_spot02_objects.h" diff --git a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.h b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.h index 4449fa013c..40307f5e91 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.h +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.h @@ -2,11 +2,11 @@ #define Z_OBJECT_KANKYO_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ObjectKankyo; -typedef void (*ObjectKankyoActionFunc)(struct ObjectKankyo*, PlayState*); +typedef void (*ObjectKankyoActionFunc)(struct ObjectKankyo*, struct PlayState*); typedef struct ObjectKankyoEffect { /* 0x00 */ u8 state; diff --git a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c index 5aeb61031a..8a24d5cf2c 100644 --- a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c +++ b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c @@ -5,7 +5,20 @@ */ #include "z_oceff_spot.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "printf.h" +#include "regs.h" +#include "sys_matrix.h" #include "terminal.h" +#include "z_lib.h" +#include "z64light.h" +#include "z64ocarina.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_UPDATE_DURING_OCARINA) diff --git a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.h b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.h index a96f1878af..222c977fc2 100644 --- a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.h +++ b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.h @@ -2,11 +2,12 @@ #define Z_OCEFF_SPOT_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" +#include "z64light.h" struct OceffSpot; -typedef void (*OceffSpotActionFunc)(struct OceffSpot*, PlayState*); +typedef void (*OceffSpotActionFunc)(struct OceffSpot*, struct PlayState*); typedef struct OceffSpot { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c index c7c63690b7..5e236c86f4 100644 --- a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c +++ b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c @@ -6,6 +6,13 @@ #include "z_oceff_storm.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sys_matrix.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED | ACTOR_FLAG_UPDATE_DURING_OCARINA) void OceffStorm_Init(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.h b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.h index e4b831a208..aebc002780 100644 --- a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.h +++ b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.h @@ -2,11 +2,11 @@ #define Z_OCEFF_STORM_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct OceffStorm; -typedef void (*OceffStormActionFunc)(struct OceffStorm*, PlayState*); +typedef void (*OceffStormActionFunc)(struct OceffStorm*, struct PlayState*); typedef struct OceffStorm { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c index f9b14bc7de..36177c0729 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c +++ b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c @@ -5,7 +5,16 @@ */ #include "z_oceff_wipe.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "sys_matrix.h" #include "terminal.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_UPDATE_DURING_OCARINA) diff --git a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.h b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.h index 9e5131737c..65a18468a3 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.h +++ b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.h @@ -2,7 +2,7 @@ #define Z_OCEFF_WIPE_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" typedef enum OceffWipeType { /* 0x00 */ OCEFF_WIPE_ZL, diff --git a/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c b/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c index 9e3b03a8f9..db8171b362 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c +++ b/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c @@ -5,7 +5,16 @@ */ #include "z_oceff_wipe2.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "sys_matrix.h" #include "terminal.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_UPDATE_DURING_OCARINA) diff --git a/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.h b/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.h index c7f9c7b870..6276bb33c4 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.h +++ b/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.h @@ -2,7 +2,7 @@ #define Z_OCEFF_WIPE2_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct OceffWipe2; diff --git a/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c b/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c index 757e9b116d..7aec9136f2 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c +++ b/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c @@ -5,7 +5,16 @@ */ #include "z_oceff_wipe3.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "sys_matrix.h" #include "terminal.h" +#include "z_lib.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_UPDATE_DURING_OCARINA) diff --git a/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.h b/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.h index a5bc2bbe4c..5e6abb0456 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.h +++ b/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.h @@ -2,7 +2,7 @@ #define Z_OCEFF_WIPE3_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct OceffWipe3; diff --git a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c index 9ad0dbf68e..0828ba289f 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c +++ b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c @@ -5,7 +5,14 @@ */ #include "z_oceff_wipe4.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "sys_matrix.h" #include "terminal.h" +#include "z_lib.h" +#include "z64play.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_UPDATE_DURING_OCARINA) diff --git a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.h b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.h index 3986c1fce5..bd82ddc7c4 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.h +++ b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.h @@ -2,7 +2,7 @@ #define Z_OCEFF_WIPE4_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" typedef enum OceffWipe4Type { /* 0x00 */ OCEFF_WIPE4_SCARECROWS, diff --git a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c index a91fb67154..7a38b72139 100644 --- a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c +++ b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c @@ -7,8 +7,22 @@ #include "z_shot_sun.h" #include "overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h" #include "overlays/actors/ovl_En_Elf/z_en_elf.h" -#include "assets/scenes/overworld/spot06/spot06_scene.h" + +#include "one_point_cutscene.h" +#include "printf.h" +#include "segmented_address.h" +#include "sfx.h" +#include "sys_math3d.h" #include "terminal.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "z64environment.h" +#include "z64ocarina.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + +#include "assets/scenes/overworld/spot06/spot06_scene.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY) diff --git a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.h b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.h index 9687e5940e..4415e6e98f 100644 --- a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.h +++ b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.h @@ -2,11 +2,11 @@ #define Z_SHOT_SUN_H #include "ultra64.h" -#include "global.h" +#include "z64actor.h" struct ShotSun; -typedef void (*ShotSunActionFunc)(struct ShotSun*, PlayState*); +typedef void (*ShotSunActionFunc)(struct ShotSun*, struct PlayState*); typedef struct ShotSun { /* 0x0000 */ Actor actor; diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 8ec56b193c..e8b9428026 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -4,11 +4,6 @@ * Description: Link */ -#include "ultra64.h" -#include "global.h" -#include "quake.h" -#include "versions.h" - #include "overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.h" #include "overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h" #include "overlays/actors/ovl_En_Boom/z_en_boom.h" @@ -20,6 +15,42 @@ #include "overlays/actors/ovl_En_Horse/z_en_horse.h" #include "overlays/actors/ovl_En_Insect/z_en_insect.h" #include "overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h" + +#include "libc64/qrand.h" +#include "libu64/debug.h" +#include "array_count.h" +#include "avoid_ub.h" +#include "controller.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "ichain.h" +#include "letterbox.h" +#include "map.h" +#include "one_point_cutscene.h" +#include "printf.h" +#include "quake.h" +#include "rand.h" +#include "regs.h" +#include "rumble.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_math.h" +#include "sys_math3d.h" +#include "sys_matrix.h" +#include "ultra64.h" +#include "versions.h" +#include "z_en_item00.h" +#include "z_lib.h" +#include "zelda_arena.h" +#include "z64audio.h" +#include "z64debug.h" +#include "z64effect.h" +#include "z64lifemeter.h" +#include "z64ocarina.h" +#include "z64play.h" +#include "z64save.h" +#include "z64skin_matrix.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_link_child/object_link_child.h" @@ -331,15 +362,15 @@ void Player_Action_CsAction(Player* this, PlayState* play); // .bss part 1 -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ique-cn:128 ntsc-1.0:64 ntsc-1.1:64 ntsc-1.2:64 pal-1.0:64 pal-1.1:64" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ + "ique-cn:128 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" static s32 D_80858AA0; // TODO: There's probably a way to match BSS ordering with less padding by spreading the variables out and moving // data around. It would be easier if we had more options for controlling BSS ordering in debug. -#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ique-cn:128 ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" +#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ + "ique-cn:192 ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" static s32 sSavedCurrentMask; static Vec3f sInteractWallCheckResult; @@ -1708,7 +1739,7 @@ BAD_RETURN(s32) func_80832224(Player* this) { s32 Player_IsTalking(PlayState* play) { Player* this = GET_PLAYER(play); - return CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_TALK); + return ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_TALK); } void Player_AnimPlayOnce(PlayState* play, Player* this, LinkAnimationHeader* anim) { @@ -2527,7 +2558,7 @@ s32 Player_FriendlyLockOnOrParallel(Player* this) { */ s32 Player_UpdateHostileLockOn(Player* this) { if ((this->focusActor != NULL) && - CHECK_FLAG_ALL(this->focusActor->flags, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE)) { + ACTOR_FLAGS_CHECK_ALL(this->focusActor, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE)) { this->stateFlags1 |= PLAYER_STATE1_HOSTILE_LOCK_ON; return true; @@ -3972,7 +4003,7 @@ void Player_UpdateZTargeting(Player* this, PlayState* play) { // is hostile. This is a special case to allow Player to have more freedom of movement and be able // to throw a carried actor at the lock-on actor, even if it is hostile. if ((this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) || - !CHECK_FLAG_ALL(this->focusActor->flags, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE)) { + !ACTOR_FLAGS_CHECK_ALL(this->focusActor, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE)) { this->stateFlags1 |= PLAYER_STATE1_FRIENDLY_ACTOR_FOCUS; } } else { @@ -6146,7 +6177,7 @@ s32 Player_ActionHandler_Talk(Player* this, PlayState* play) { canTalkToLockOnWithCUp = (lockOnActor != NULL) && - (CHECK_FLAG_ALL(lockOnActor->flags, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_TALK_WITH_C_UP) || + (ACTOR_FLAGS_CHECK_ALL(lockOnActor, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_TALK_WITH_C_UP) || (lockOnActor->naviEnemyId != NAVI_ENEMY_NONE)); if (canTalkToLockOnWithCUp || (this->naviTextId != 0)) { @@ -6261,7 +6292,7 @@ s32 Player_ActionHandler_0(Player* this, PlayState* play) { } if ((this->focusActor != NULL) && - (CHECK_FLAG_ALL(this->focusActor->flags, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_TALK_WITH_C_UP) || + (ACTOR_FLAGS_CHECK_ALL(this->focusActor, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_TALK_WITH_C_UP) || (this->focusActor->naviEnemyId != NAVI_ENEMY_NONE))) { this->stateFlags2 |= PLAYER_STATE2_21; } else if ((this->naviTextId == 0) && !Player_CheckHostileLockOn(this) && @@ -11347,7 +11378,7 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) { } else if (this->stateFlags2 & PLAYER_STATE2_8) { camMode = CAM_MODE_PUSH_PULL; } else if ((focusActor = this->focusActor) != NULL) { - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_TALK)) { + if (ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_TALK)) { camMode = CAM_MODE_TALK; } else if (this->stateFlags1 & PLAYER_STATE1_FRIENDLY_ACTOR_FOCUS) { if (this->stateFlags1 & PLAYER_STATE1_BOOMERANG_THROWN) { @@ -11969,7 +12000,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { Player_UpdateShapeYaw(this, play); - if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_TALK)) { + if (ACTOR_FLAGS_CHECK_ALL(&this->actor, ACTOR_FLAG_TALK)) { this->talkActorDistance = 0.0f; } else { this->talkActor = NULL; @@ -12533,7 +12564,7 @@ void Player_Action_Talk(Player* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->actor.flags &= ~ACTOR_FLAG_TALK; - if (!CHECK_FLAG_ALL(this->talkActor->flags, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE)) { + if (!ACTOR_FLAGS_CHECK_ALL(this->talkActor, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE)) { this->stateFlags2 &= ~PLAYER_STATE2_LOCK_ON_WITH_SWITCH; } @@ -16124,7 +16155,7 @@ void Player_StartTalking(PlayState* play, Actor* actor) { s32 pad; if ((this->talkActor != NULL) || (actor == this->naviActor) || - CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_TALK_WITH_C_UP)) { + ACTOR_FLAGS_CHECK_ALL(actor, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_TALK_WITH_C_UP)) { actor->flags |= ACTOR_FLAG_TALK; } diff --git a/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c b/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c index f107473306..9ff1bd5a96 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c +++ b/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c @@ -5,6 +5,15 @@ */ #include "z_eff_ss_blast.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define rInnerColorR regs[0] diff --git a/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.h b/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.h index b38f343e8e..bfceec5856 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.h +++ b/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.h @@ -2,7 +2,8 @@ #define Z_EFF_SS_BLAST_H #include "ultra64.h" -#include "global.h" +#include "color.h" +#include "z64math.h" typedef struct EffectSsBlastParams { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c b/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c index 4fd99e3626..2ab88a16b1 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c +++ b/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c @@ -5,6 +5,18 @@ */ #include "z_eff_ss_bomb.h" + +#include "libc64/qrand.h" +#include "array_count.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64skin_matrix.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define EFFSSBOMB_LIFESPAN 20 @@ -67,7 +79,7 @@ void EffectSsBomb_Draw(PlayState* play, u32 index, EffectSs* this) { SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard); SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfScale, &mfResult); - gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult); diff --git a/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.h b/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.h index 5d42b118c8..923739819b 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.h +++ b/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.h @@ -2,7 +2,7 @@ #define Z_EFF_SS_BOMB_H #include "ultra64.h" -#include "global.h" +#include "z64math.h" typedef struct EffectSsBombInitParams { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c b/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c index e848dd47b8..4ec61bc8ea 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c +++ b/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c @@ -5,6 +5,16 @@ */ #include "z_eff_ss_bomb2.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64skin_matrix.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define rScale regs[0] diff --git a/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.h b/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.h index 249a2a6507..8aea4d3cc5 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.h +++ b/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.h @@ -2,7 +2,7 @@ #define Z_EFF_SS_BOMB2_H #include "ultra64.h" -#include "global.h" +#include "z64math.h" typedef struct EffectSsBomb2InitParams { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c index be7d160712..f23d0a9aab 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c +++ b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c @@ -5,6 +5,16 @@ */ #include "z_eff_ss_bubble.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define rScale regs[0] diff --git a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.h b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.h index 3c3c8f80df..7701365bdc 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.h +++ b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.h @@ -2,7 +2,7 @@ #define Z_EFF_SS_BUBBLE_H #include "ultra64.h" -#include "global.h" +#include "z64math.h" typedef struct EffectSsBubbleInitParams { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c index 5b178002d1..c32349e1fa 100644 --- a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c @@ -5,6 +5,14 @@ */ #include "z_eff_ss_d_fire.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64skin_matrix.h" + #include "assets/objects/object_dodongo/object_dodongo.h" #define rScale regs[0] @@ -79,7 +87,7 @@ void EffectSsDFire_Draw(PlayState* play, u32 index, EffectSs* this) { OPEN_DISPS(gfxCtx, "../z_eff_ss_d_fire.c", 276); if (Object_GetSlot(&play->objectCtx, OBJECT_DODONGO) >= 0) { - gSegments[6] = VIRTUAL_TO_PHYSICAL(objectPtr); + gSegments[6] = OS_K0_TO_PHYSICAL(objectPtr); gSPSegment(POLY_XLU_DISP++, 0x06, objectPtr); scale = this->rScale / 100.0f; SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); @@ -95,7 +103,7 @@ void EffectSsDFire_Draw(PlayState* play, u32 index, EffectSs* this) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB, this->rPrimColorA); - gSegments[6] = VIRTUAL_TO_PHYSICAL(objectPtr); + gSegments[6] = OS_K0_TO_PHYSICAL(objectPtr); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sTextures[this->rTexIndex])); gSPDisplayList(POLY_XLU_DISP++, this->gfx); } diff --git a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.h b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.h index c59c9add92..fbaa8aa28c 100644 --- a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.h +++ b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.h @@ -2,7 +2,7 @@ #define Z_EFF_SS_D_FIRE_H #include "ultra64.h" -#include "global.h" +#include "z64math.h" typedef struct EffectSsDFireInitParams { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.c b/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.c index 56b7b4db36..e8b904a4b6 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.c @@ -5,6 +5,15 @@ */ #include "z_eff_ss_dead_db.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "sfx.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64skin_matrix.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define rScale regs[0] diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.h b/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.h index 0ea6bd0fda..fb7fc84af1 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.h +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_eff_ss_dead_db.h @@ -2,7 +2,8 @@ #define Z_EFF_SS_DEAD_DB_H #include "ultra64.h" -#include "global.h" +#include "color.h" +#include "z64math.h" typedef struct EffectSsDeadDbInitParams { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c b/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c index ac0df1b437..9343e7a549 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c @@ -5,6 +5,15 @@ */ #include "z_eff_ss_dead_dd.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64skin_matrix.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define rScale regs[0] diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.h b/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.h index 80d46899e7..c9c91ec609 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.h +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.h @@ -2,7 +2,8 @@ #define Z_EFF_SS_DEAD_DD_H #include "ultra64.h" -#include "global.h" +#include "color.h" +#include "z64math.h" typedef struct EffectSsDeadDdInitParams { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c b/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c index 9d9c695d88..4d649d4be4 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c @@ -5,6 +5,13 @@ */ #include "z_eff_ss_dead_ds.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sys_matrix.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define rScale regs[0] diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.h b/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.h index 3714bf41ba..7a7d57363a 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.h +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.h @@ -2,7 +2,7 @@ #define Z_EFF_SS_DEAD_DS_H #include "ultra64.h" -#include "global.h" +#include "z64math.h" typedef struct EffectSsDeadDsInitParams { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.c b/src/overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.c index c0e0e9babb..f0b3c8fce4 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.c @@ -5,6 +5,7 @@ */ #include "z_eff_ss_dead_sound.h" +#include "printf.h" #include "sfx.h" #include "z64effect.h" #include "z64play.h" diff --git a/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.c b/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.c index 07335e2488..2f5901ca2e 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.c @@ -5,6 +5,16 @@ */ #include "z_eff_ss_dt_bubble.h" + +#include "libc64/qrand.h" +#include "color.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "sys_matrix.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define rPrimColorR regs[0] diff --git a/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.h b/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.h index cac4c1a08c..6138c86046 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.h +++ b/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_eff_ss_dt_bubble.h @@ -2,7 +2,8 @@ #define Z_EFF_SS_DT_BUBBLE_H #include "ultra64.h" -#include "global.h" +#include "color.h" +#include "z64math.h" typedef struct EffectSsDtBubbleInitParams { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c index cdb56fc74e..899e9f2a2d 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c @@ -5,6 +5,17 @@ */ #include "z_eff_ss_dust.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64skin_matrix.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define rPrimColorR regs[0] @@ -96,7 +107,7 @@ void EffectSsDust_Draw(PlayState* play, u32 index, EffectSs* this) { SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f); SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard); SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfScale, &mfResult); - gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult); diff --git a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.h b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.h index 5cb686ae94..958bde91f8 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.h +++ b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.h @@ -2,7 +2,8 @@ #define Z_EFF_SS_DUST_H #include "ultra64.h" -#include "global.h" +#include "color.h" +#include "z64math.h" typedef struct EffectSsDustInitParams { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c index 73795ab2d4..56dc375337 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c @@ -5,6 +5,15 @@ */ #include "z_eff_ss_en_fire.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define rScaleMax regs[0] diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.h b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.h index c511827ecf..14acb95e40 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.h +++ b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.h @@ -2,10 +2,10 @@ #define Z_EFF_SS_EN_FIRE_H #include "ultra64.h" -#include "global.h" +#include "z64math.h" typedef struct EffectSsEnFireInitParams { - /* 0x00 */ Actor* actor; + /* 0x00 */ struct Actor* actor; /* 0x04 */ Vec3f pos; /* 0x10 */ s16 scale; /* 0x12 */ s16 unk_12; diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c index 4a2d5a584c..17af3ac9eb 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c +++ b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c @@ -5,7 +5,18 @@ */ #include "z_eff_ss_en_ice.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "rand.h" +#include "sys_math.h" +#include "sys_matrix.h" #include "versions.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define rLifespan regs[0] diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h index 22929d39dd..238b005bcc 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h +++ b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.h @@ -2,10 +2,11 @@ #define Z_EFF_SS_EN_ICE_H #include "ultra64.h" -#include "global.h" +#include "color.h" +#include "z64math.h" typedef struct EffectSsEnIceInitParams { - /* 0x00 */ Actor* actor; + /* 0x00 */ struct Actor* actor; /* 0x04 */ Vec3f pos; /* 0x10 */ f32 scale; /* 0x14 */ Vec3f velocity; diff --git a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c index e3506295da..c5cee8db21 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c +++ b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c @@ -5,6 +5,14 @@ */ #include "z_eff_ss_extra.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "sys_matrix.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/object_yabusame_point/object_yabusame_point.h" #define rObjectSlot regs[0] @@ -31,7 +39,7 @@ u32 EffectSsExtra_Init(PlayState* play, u32 index, EffectSs* this, void* initPar if ((objectSlot >= 0) && Object_IsLoaded(&play->objectCtx, objectSlot)) { uintptr_t oldSeg6 = gSegments[6]; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); this->pos = initParams->pos; this->velocity = initParams->velocity; this->accel = initParams->accel; @@ -63,7 +71,7 @@ void EffectSsExtra_Draw(PlayState* play, u32 index, EffectSs* this) { OPEN_DISPS(play->state.gfxCtx, "../z_eff_ss_extra.c", 168); - gSegments[6] = VIRTUAL_TO_PHYSICAL(objectPtr); + gSegments[6] = OS_K0_TO_PHYSICAL(objectPtr); gSPSegment(POLY_XLU_DISP++, 0x06, objectPtr); Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); diff --git a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.h b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.h index c8047d21fa..1bf5a5d30c 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.h +++ b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.h @@ -2,7 +2,7 @@ #define Z_EFF_SS_EXTRA_H #include "ultra64.h" -#include "global.h" +#include "z64math.h" typedef struct EffectSsExtraInitParams { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/effects/ovl_Effect_Ss_Fcircle/z_eff_ss_fcircle.c b/src/overlays/effects/ovl_Effect_Ss_Fcircle/z_eff_ss_fcircle.c index 6b07df0582..9f00f52e30 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fcircle/z_eff_ss_fcircle.c +++ b/src/overlays/effects/ovl_Effect_Ss_Fcircle/z_eff_ss_fcircle.c @@ -5,6 +5,14 @@ */ #include "z_eff_ss_fcircle.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define rUnused regs[3] // probably supposed to be an alpha diff --git a/src/overlays/effects/ovl_Effect_Ss_Fcircle/z_eff_ss_fcircle.h b/src/overlays/effects/ovl_Effect_Ss_Fcircle/z_eff_ss_fcircle.h index 2e3eb74184..fc2a4ec2de 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fcircle/z_eff_ss_fcircle.h +++ b/src/overlays/effects/ovl_Effect_Ss_Fcircle/z_eff_ss_fcircle.h @@ -2,10 +2,10 @@ #define Z_EFF_SS_FCIRCLE_H #include "ultra64.h" -#include "global.h" +#include "z64math.h" typedef struct EffectSsFcircleInitParams { - /* 0x00 */ Actor* actor; + /* 0x00 */ struct Actor* actor; /* 0x04 */ Vec3f pos; /* 0x10 */ s16 radius; /* 0x12 */ s16 height; diff --git a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c index c4ab534692..60cad10d01 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c +++ b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c @@ -6,6 +6,19 @@ #include "z_eff_ss_fhg_flash.h" #include "overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "rand.h" +#include "segmented_address.h" +#include "sys_matrix.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64skin.h" + #include "assets/objects/object_fhg/object_fhg.h" #define rAlpha regs[0] @@ -42,7 +55,7 @@ u32 EffectSsFhgFlash_Init(PlayState* play, u32 index, EffectSs* this, void* init if ((objectSlot >= 0) && Object_IsLoaded(&play->objectCtx, objectSlot)) { prevSeg6 = gSegments[6]; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); this->rObjectSlot = objectSlot; this->pos = initParams->pos; this->velocity = initParams->velocity; @@ -98,7 +111,7 @@ void EffectSsFhgFlash_DrawLightBall(PlayState* play, u32 index, EffectSs* this) Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSegments[6] = VIRTUAL_TO_PHYSICAL(objectPtr); + gSegments[6] = OS_K0_TO_PHYSICAL(objectPtr); gSPSegment(POLY_XLU_DISP++, 0x06, objectPtr); Gfx_SetupDL_25Xlu(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, this->rAlpha); diff --git a/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c b/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c index 089c7f73eb..de4ae887bb 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c +++ b/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c @@ -5,6 +5,15 @@ */ #include "z_eff_ss_fire_tail.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define rScale regs[0] diff --git a/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.h b/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.h index 70f5df7e19..ebe8a7203d 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.h +++ b/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.h @@ -2,10 +2,11 @@ #define Z_EFF_SS_FIRE_TAIL_H #include "ultra64.h" -#include "global.h" +#include "color.h" +#include "z64math.h" typedef struct EffectSsFireTailInitParams { - /* 0x00 */ Actor* actor; + /* 0x00 */ struct Actor* actor; /* 0x04 */ Vec3f pos; /* 0x10 */ f32 scale; /* 0x14 */ Vec3f unk_14; diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c b/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c index 351fadab7c..05e4a3d8bf 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.c @@ -5,6 +5,11 @@ */ #include "z_eff_ss_g_fire.h" + +#include "segmented_address.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" u32 EffectSsGFire_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.h b/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.h index cfb5dcfafb..52312527d9 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.h +++ b/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_eff_ss_g_fire.h @@ -2,7 +2,7 @@ #define Z_EFF_SS_G_FIRE_H #include "ultra64.h" -#include "global.h" +#include "z64math.h" typedef struct EffectSsGFireInitParams { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Magma/z_eff_ss_g_magma.c b/src/overlays/effects/ovl_Effect_Ss_G_Magma/z_eff_ss_g_magma.c index f93bb0e7d6..9610917043 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Magma/z_eff_ss_g_magma.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Magma/z_eff_ss_g_magma.c @@ -5,6 +5,12 @@ */ #include "z_eff_ss_g_magma.h" + +#include "libc64/qrand.h" +#include "segmented_address.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" u32 EffectSsGMagma_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Magma/z_eff_ss_g_magma.h b/src/overlays/effects/ovl_Effect_Ss_G_Magma/z_eff_ss_g_magma.h index ab1b97a1de..55215239d2 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Magma/z_eff_ss_g_magma.h +++ b/src/overlays/effects/ovl_Effect_Ss_G_Magma/z_eff_ss_g_magma.h @@ -2,7 +2,7 @@ #define Z_EFF_SS_G_MAGMA_H #include "ultra64.h" -#include "global.h" +#include "z64math.h" typedef struct EffectSsGMagmaInitParams { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c b/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c index 11fc08606b..316f65258a 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c @@ -5,6 +5,14 @@ */ #include "z_eff_ss_g_magma2.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "sys_matrix.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/object_kingdodongo/object_kingdodongo.h" #define rPrimColorR regs[0] @@ -45,7 +53,7 @@ u32 EffectSsGMagma2_Init(PlayState* play, u32 index, EffectSs* this, void* initP Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; EffectSsGMagma2InitParams* initParams = (EffectSsGMagma2InitParams*)initParamsx; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); this->rObjectSlot = objectSlot; this->pos = initParams->pos; this->velocity = zeroVec; @@ -84,7 +92,7 @@ void EffectSsGMagma2_Draw(PlayState* play, u32 index, EffectSs* this) { Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSegments[6] = VIRTUAL_TO_PHYSICAL(objectPtr); + gSegments[6] = OS_K0_TO_PHYSICAL(objectPtr); gSPSegment(POLY_XLU_DISP++, 0x06, objectPtr); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, gfxCtx, "../z_eff_ss_g_magma2.c", 282); diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.h b/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.h index 715e01e7db..2ddc9f4ce7 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.h +++ b/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.h @@ -2,7 +2,8 @@ #define Z_EFF_SS_G_MAGMA2_H #include "ultra64.h" -#include "global.h" +#include "color.h" +#include "z64math.h" typedef struct EffectSsGMagma2InitParams { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c b/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c index 48a2eec4f0..2c83108d35 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c @@ -5,6 +5,15 @@ */ #include "z_eff_ss_g_ripple.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64skin_matrix.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define rWaterBoxNum regs[0] diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.h b/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.h index 63487ee0ca..86a7d8378e 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.h +++ b/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.h @@ -2,7 +2,7 @@ #define Z_EFF_SS_G_RIPPLE_H #include "ultra64.h" -#include "global.h" +#include "z64math.h" typedef struct EffectSsGRippleInitParams { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c b/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c index f43f4f3a52..a5472c29fa 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c @@ -5,6 +5,16 @@ */ #include "z_eff_ss_g_spk.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64skin_matrix.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define rPrimColorR regs[0] diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.h b/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.h index 8627bc0528..0d94bd7e0a 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.h +++ b/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.h @@ -2,10 +2,11 @@ #define Z_EFF_SS_G_SPK_H #include "ultra64.h" -#include "global.h" +#include "color.h" +#include "z64math.h" typedef struct EffectSsGSpkInitParams { - /* 0x00 */ Actor* actor; + /* 0x00 */ struct Actor* actor; /* 0x04 */ Vec3f pos; /* 0x10 */ Vec3f velocity; /* 0x1C */ Vec3f accel; diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c b/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c index 4e7c26308c..3baab32db9 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.c @@ -5,6 +5,11 @@ */ #include "z_eff_ss_g_splash.h" + +#include "segmented_address.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" //! @bug the reuse of regs[11] means that EffectSs_DrawGEffect will treat the type as an object slot (`rgObjectSlot`) diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.h b/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.h index c13e19cd1c..fa1907f667 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.h +++ b/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_eff_ss_g_splash.h @@ -2,7 +2,8 @@ #define Z_EFF_SS_G_SPLASH_H #include "ultra64.h" -#include "global.h" +#include "color.h" +#include "z64math.h" typedef struct EffectSsGSplashInitParams { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.c b/src/overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.c index 2e279a5b12..9be42db8d9 100644 --- a/src/overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.c +++ b/src/overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.c @@ -5,7 +5,15 @@ */ #include "z_eff_ss_hitmark.h" -#include "global.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "sys_matrix.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64skin_matrix.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define rTexIndex regs[0] @@ -87,7 +95,7 @@ void EffectSsHitMark_Draw(PlayState* play, u32 index, EffectSs* this) { SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f); SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard); SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfScale, &mfResult); - gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult); diff --git a/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c b/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c index 7f0fc02fa1..9ce9885de3 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c +++ b/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c @@ -5,6 +5,15 @@ */ #include "z_eff_ss_ice_piece.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "rand.h" +#include "sys_math.h" +#include "sys_matrix.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define rLifespan regs[0] diff --git a/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.h b/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.h index f7b376a7ad..afb96c213c 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.h +++ b/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.h @@ -2,7 +2,7 @@ #define Z_EFF_SS_ICE_PIECE_H #include "ultra64.h" -#include "global.h" +#include "z64math.h" typedef struct EffectSsIcePieceInitParams { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c index 9997240be7..1445e61d02 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c +++ b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c @@ -5,6 +5,16 @@ */ #include "z_eff_ss_ice_smoke.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "segmented_address.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/object_fz/object_fz.h" #define rObjectSlot regs[0] @@ -30,7 +40,7 @@ u32 EffectSsIceSmoke_Init(PlayState* play, u32 index, EffectSs* this, void* init if ((objectSlot >= 0) && Object_IsLoaded(&play->objectCtx, objectSlot)) { uintptr_t prevSeg6 = gSegments[6]; - gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); + gSegments[6] = OS_K0_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); Math_Vec3f_Copy(&this->pos, &initParams->pos); Math_Vec3f_Copy(&this->velocity, &initParams->velocity); Math_Vec3f_Copy(&this->accel, &initParams->accel); @@ -66,7 +76,7 @@ void EffectSsIceSmoke_Draw(PlayState* play, u32 index, EffectSs* this) { if ((objectSlot >= 0) && Object_IsLoaded(&play2->objectCtx, objectSlot)) { gDPPipeSync(POLY_XLU_DISP++); Gfx_SetupDL_25Xlu(play->state.gfxCtx); - gSegments[6] = VIRTUAL_TO_PHYSICAL(objectPtr); + gSegments[6] = OS_K0_TO_PHYSICAL(objectPtr); gSPSegment(POLY_XLU_DISP++, 0x06, objectPtr); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gFreezardSteamStartDL)); gDPPipeSync(POLY_XLU_DISP++); diff --git a/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.h b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.h index 64833be518..24c27f1cf6 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.h +++ b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.h @@ -2,7 +2,7 @@ #define Z_EFF_SS_ICE_SMOKE_H #include "ultra64.h" -#include "global.h" +#include "z64math.h" typedef struct EffectSsIceSmokeInitParams { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c b/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c index 10a3b668ab..12d9c5a5eb 100644 --- a/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c @@ -5,6 +5,14 @@ */ #include "z_eff_ss_k_fire.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "rand.h" +#include "sys_matrix.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define rAlpha regs[0] diff --git a/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.h b/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.h index 1896b47a73..eb8e8764d7 100644 --- a/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.h +++ b/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.h @@ -2,7 +2,7 @@ #define Z_EFF_SS_K_FIRE_H #include "ultra64.h" -#include "global.h" +#include "z64math.h" typedef struct EffectSsKFireInitParams { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c b/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c index 4fbd637855..fda08ca8b8 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c +++ b/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c @@ -11,6 +11,7 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "line_numbers.h" +#include "printf.h" #include "sys_matrix.h" #include "versions.h" #include "z64effect.h" diff --git a/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.c b/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.c index 5973ca9e1e..f7c22aaa19 100644 --- a/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.c +++ b/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.c @@ -5,6 +5,18 @@ */ #include "z_eff_ss_kirakira.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "rand.h" +#include "segmented_address.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64skin_matrix.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define rRotSpeed regs[0] @@ -97,7 +109,7 @@ void EffectSsKiraKira_Draw(PlayState* play, u32 index, EffectSs* this) { SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard); SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfRotY, &mfTransBillboardRotY); SkinMatrix_MtxFMtxFMult(&mfTransBillboardRotY, &mfScale, &mfResult); - gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult); diff --git a/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.h b/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.h index 7f8c18da3e..0c128ff7ab 100644 --- a/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.h +++ b/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.h @@ -2,7 +2,8 @@ #define Z_EFF_SS_KIRAKIRA_H #include "ultra64.h" -#include "global.h" +#include "color.h" +#include "z64math.h" typedef struct EffectSsKiraKiraInitParams { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c b/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c index 0e2560e34f..f44ac38496 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c +++ b/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c @@ -5,6 +5,17 @@ */ #include "z_eff_ss_lightning.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64skin_matrix.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define rPrimColorR regs[0] @@ -100,7 +111,7 @@ void EffectSsLightning_Draw(PlayState* play, u32 index, EffectSs* this) { SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfRotate, &mfTransBillboardRotate); SkinMatrix_MtxFMtxFMult(&mfTransBillboardRotate, &mfScale, &mfResult); - gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_XLU_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult); diff --git a/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.h b/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.h index ad352e9013..39f5d51841 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.h +++ b/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.h @@ -2,7 +2,8 @@ #define Z_EFF_SS_LIGHTNING_H #include "ultra64.h" -#include "global.h" +#include "color.h" +#include "z64math.h" typedef struct EffectSsLightningInitParams { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c b/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c index f707251cba..1dadd7f069 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c +++ b/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c @@ -5,6 +5,18 @@ */ #include "z_eff_ss_sibuki.h" + +#include "libc64/qrand.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "regs.h" +#include "segmented_address.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define rPrimColorR regs[0] diff --git a/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.h b/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.h index 18aaf0d200..e45c2c6f2a 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.h +++ b/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.h @@ -2,7 +2,7 @@ #define Z_EFF_SS_SIBUKI_H #include "ultra64.h" -#include "global.h" +#include "z64math.h" typedef struct EffectSsSibukiInitParams { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.c b/src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.c index e85a53e890..8566be1623 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.c +++ b/src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.c @@ -5,6 +5,14 @@ */ #include "z_eff_ss_sibuki2.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "segmented_address.h" +#include "sys_matrix.h" +#include "z64effect.h" +#include "z64play.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define rPrimColorR regs[0] diff --git a/src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.h b/src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.h index 7fb20d8b33..37a9425dc7 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.h +++ b/src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.h @@ -2,7 +2,7 @@ #define Z_EFF_SS_SIBUKI2_H #include "ultra64.h" -#include "global.h" +#include "z64math.h" typedef struct EffectSsSibuki2InitParams { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c b/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c index ed1d5edccf..2277a71d85 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c +++ b/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c @@ -6,6 +6,11 @@ #include "z_eff_ss_solder_srch_ball.h" +#include "z64bgcheck.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" + #define rUnused regs[1] u32 EffectSsSolderSrchBall_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); diff --git a/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.h b/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.h index 70aa558b65..b105f063d5 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.h +++ b/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.h @@ -2,7 +2,7 @@ #define Z_EFF_SS_SOLDERSRCHBALL_H #include "ultra64.h" -#include "global.h" +#include "z64math.h" typedef struct EffectSsSolderSrchBallInitParams { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c b/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c index ba327e465a..520f8af02a 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c +++ b/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c @@ -5,6 +5,16 @@ */ #include "z_eff_ss_stick.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "sys_matrix.h" +#include "z_lib.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/objects/object_link_boy/object_link_boy.h" #include "assets/objects/object_link_child/object_link_child.h" diff --git a/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.h b/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.h index 8e01aeb003..4b5ccda965 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.h +++ b/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.h @@ -2,7 +2,7 @@ #define Z_EFF_SS_STICK_H #include "ultra64.h" -#include "global.h" +#include "z64math.h" typedef struct EffectSsStickInitParams { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c b/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c index e1083373b8..5ecd83add1 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c +++ b/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c @@ -5,6 +5,17 @@ */ #include "z_eff_ss_stone1.h" + +#include "color.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "regs.h" +#include "segmented_address.h" +#include "sys_matrix.h" +#include "z64effect.h" +#include "z64play.h" +#include "z64skin_matrix.h" + #include "assets/objects/gameplay_keep/gameplay_keep.h" #define rReg0 regs[0] diff --git a/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.h b/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.h index d329161277..efb8df225d 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.h +++ b/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.h @@ -2,7 +2,7 @@ #define Z_EFF_SS_STONE1_H #include "ultra64.h" -#include "global.h" +#include "z64math.h" typedef struct EffectSsStone1InitParams { /* 0x00 */ Vec3f pos; diff --git a/src/overlays/gamestates/ovl_file_choose/file_select.h b/src/overlays/gamestates/ovl_file_choose/file_select.h index 122ba09af0..ae41c4dced 100644 --- a/src/overlays/gamestates/ovl_file_choose/file_select.h +++ b/src/overlays/gamestates/ovl_file_choose/file_select.h @@ -3,8 +3,9 @@ #include "libc/stddef.h" #include "ultra64.h" -#include "global.h" +#include "gfx.h" #include "versions.h" +#include "z64game.h" #define GET_NEWF(sramCtx, slotNum, index) (sramCtx->readBuff[gSramSlotOffsets[slotNum] + offsetof(SaveContext, save.info.playerData.newf[index])]) @@ -154,13 +155,6 @@ typedef enum SettingIndex { /* */ FS_SETTING_MAX } SettingIndex; -typedef enum AudioOption { - /* 0 */ FS_AUDIO_STEREO, - /* 1 */ FS_AUDIO_MONO, - /* 2 */ FS_AUDIO_HEADSET, - /* 3 */ FS_AUDIO_SURROUND -} AudioOption; - typedef enum CharPage { /* 0 */ FS_CHAR_PAGE_HIRA, /* 1 */ FS_CHAR_PAGE_KATA, diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index 6c641e1da5..e8934c3731 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -1,14 +1,43 @@ #include "file_select.h" +#include "file_select_state.h" + +#include "attributes.h" +#include "controller.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "language_array.h" +#include "letterbox.h" +#include "main.h" +#include "map_select_state.h" +#include "memory_utils.h" +#if PLATFORM_N64 +#include "n64dd.h" +#endif +#include "printf.h" +#include "regs.h" +#include "rumble.h" +#include "segment_symbols.h" +#include "seqcmd.h" +#include "sequence.h" +#include "sfx.h" +#include "sys_matrix.h" #include "terminal.h" #include "versions.h" +#include "z_lib.h" +#include "z64audio.h" +#include "z64environment.h" +#include "z64play.h" +#include "z64save.h" +#include "z64skybox.h" +#include "z64sram.h" +#include "z64ss_sram.h" +#include "z64view.h" + #if OOT_PAL_N64 #include "assets/objects/object_mag/object_mag.h" #endif #include "assets/textures/title_static/title_static.h" #include "assets/textures/parameter_static/parameter_static.h" -#if PLATFORM_N64 -#include "n64dd.h" -#endif #if OOT_PAL_N64 static s32 sInitialLanguageAlphaAsInt = 100; @@ -721,12 +750,12 @@ void FileSelect_PulsateCursor(GameState* thisx) { SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, 3, OS_WRITE); PRINTF("1:read_buff[]=%x, %x, %x, %x\n", sramCtx->readBuff[SRAM_HEADER_SOUND], - sramCtx->readBuff[SRAM_HEADER_ZTARGET], sramCtx->readBuff[SRAM_HEADER_LANGUAGE], + sramCtx->readBuff[SRAM_HEADER_Z_TARGET], sramCtx->readBuff[SRAM_HEADER_LANGUAGE], sramCtx->readBuff[SRAM_HEADER_MAGIC]); SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_READ); PRINTF("read_buff[]=%x, %x, %x, %x\n", sramCtx->readBuff[SRAM_HEADER_SOUND], - sramCtx->readBuff[SRAM_HEADER_ZTARGET], sramCtx->readBuff[SRAM_HEADER_LANGUAGE], + sramCtx->readBuff[SRAM_HEADER_Z_TARGET], sramCtx->readBuff[SRAM_HEADER_LANGUAGE], sramCtx->readBuff[SRAM_HEADER_MAGIC]); } else if (CHECK_BTN_ALL(debugInput->press.button, BTN_DUP)) { sramCtx->readBuff[SRAM_HEADER_LANGUAGE] = gSaveContext.language = LANGUAGE_GER; @@ -734,11 +763,11 @@ void FileSelect_PulsateCursor(GameState* thisx) { SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, 3, OS_WRITE); PRINTF("1:read_buff[]=%x, %x, %x, %x\n", sramCtx->readBuff[SRAM_HEADER_SOUND], - sramCtx->readBuff[SRAM_HEADER_ZTARGET], sramCtx->readBuff[SRAM_HEADER_LANGUAGE], + sramCtx->readBuff[SRAM_HEADER_Z_TARGET], sramCtx->readBuff[SRAM_HEADER_LANGUAGE], sramCtx->readBuff[SRAM_HEADER_MAGIC]); SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_READ); PRINTF("read_buff[]=%x, %x, %x, %x\n", sramCtx->readBuff[SRAM_HEADER_SOUND], - sramCtx->readBuff[SRAM_HEADER_ZTARGET], sramCtx->readBuff[SRAM_HEADER_LANGUAGE], + sramCtx->readBuff[SRAM_HEADER_Z_TARGET], sramCtx->readBuff[SRAM_HEADER_LANGUAGE], sramCtx->readBuff[SRAM_HEADER_MAGIC]); } else if (CHECK_BTN_ALL(debugInput->press.button, BTN_DRIGHT)) { sramCtx->readBuff[SRAM_HEADER_LANGUAGE] = gSaveContext.language = LANGUAGE_FRA; @@ -746,12 +775,12 @@ void FileSelect_PulsateCursor(GameState* thisx) { SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, 3, OS_WRITE); PRINTF("1:read_buff[]=%x, %x, %x, %x\n", sramCtx->readBuff[SRAM_HEADER_SOUND], - sramCtx->readBuff[SRAM_HEADER_ZTARGET], sramCtx->readBuff[SRAM_HEADER_LANGUAGE], + sramCtx->readBuff[SRAM_HEADER_Z_TARGET], sramCtx->readBuff[SRAM_HEADER_LANGUAGE], sramCtx->readBuff[SRAM_HEADER_MAGIC]); SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_READ); PRINTF("read_buff[]=%x, %x, %x, %x\n", sramCtx->readBuff[SRAM_HEADER_SOUND], - sramCtx->readBuff[SRAM_HEADER_ZTARGET], sramCtx->readBuff[SRAM_HEADER_LANGUAGE], + sramCtx->readBuff[SRAM_HEADER_Z_TARGET], sramCtx->readBuff[SRAM_HEADER_LANGUAGE], sramCtx->readBuff[SRAM_HEADER_MAGIC]); } #endif @@ -1926,7 +1955,16 @@ void FileSelect_LoadGame(GameState* thisx) { swordEquipValue = (gEquipMasks[EQUIP_TYPE_SWORD] & gSaveContext.save.info.equips.equipment) >> (EQUIP_TYPE_SWORD * 4); gSaveContext.save.info.equips.equipment &= gEquipNegMasks[EQUIP_TYPE_SWORD]; +#ifndef AVOID_UB + //! @bug swordEquipValue can be 0 (EQUIP_VALUE_SWORD_NONE) here (typically, when first starting the game). + //! This leads to reading gBitFlags[-1] (out of bounds). + // gBitFlags[-1] turns out to be 0 in matching versions so this is inconsequential. gSaveContext.save.info.inventory.equipment ^= OWNED_EQUIP_FLAG(EQUIP_TYPE_SWORD, swordEquipValue - 1); +#else + if (swordEquipValue != EQUIP_VALUE_SWORD_NONE) { + gSaveContext.save.info.inventory.equipment ^= OWNED_EQUIP_FLAG(EQUIP_TYPE_SWORD, swordEquipValue - 1); + } +#endif } #if PLATFORM_N64 diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c b/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c index 9c6e8ff2db..03fb5d0f12 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c @@ -1,4 +1,13 @@ #include "file_select.h" +#include "file_select_state.h" + +#include "controller.h" +#include "printf.h" +#include "regs.h" +#include "rumble.h" +#include "sfx.h" +#include "z64save.h" +#include "z64sram.h" // In iQue versions, this file contains many workarounds for EGCS internal // compiler errors (see docs/compilers.md) diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c b/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c index 9bafd123bd..bc7ae7edc1 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_nameset.c @@ -1,6 +1,21 @@ #include "file_select.h" +#include "file_select_state.h" + +#include "array_count.h" +#include "controller.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "language_array.h" +#include "printf.h" +#include "regs.h" +#include "rumble.h" +#include "sfx.h" +#include "sys_matrix.h" #include "terminal.h" #include "versions.h" +#include "z64audio.h" +#include "z64save.h" + #include "assets/textures/title_static/title_static.h" #include "assets/overlays/ovl_file_choose/ovl_file_choose.h" @@ -1340,7 +1355,7 @@ void FileSelect_UpdateOptionsMenu(GameState* thisx) { Audio_PlaySfxGeneral(NA_SE_SY_FSEL_DECIDE_L, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); this->configMode = CM_OPTIONS_TO_MAIN; - sramCtx->readBuff[0] = gSaveContext.audioSetting; + sramCtx->readBuff[0] = gSaveContext.soundSetting; sramCtx->readBuff[1] = gSaveContext.zTargetSetting; #if OOT_PAL_N64 sramCtx->readBuff[2] = gSaveContext.language; @@ -1350,11 +1365,11 @@ void FileSelect_UpdateOptionsMenu(GameState* thisx) { PRINTF_COLOR_YELLOW(); PRINTF("sram->read_buff[2] = J_N = %x\n", sramCtx->readBuff[2]); PRINTF("sram->read_buff[2] = J_N = %x\n", &sramCtx->readBuff[2]); - PRINTF("Na_SetSoundOutputMode = %d\n", gSaveContext.audioSetting); - PRINTF("Na_SetSoundOutputMode = %d\n", gSaveContext.audioSetting); - PRINTF("Na_SetSoundOutputMode = %d\n", gSaveContext.audioSetting); + PRINTF("Na_SetSoundOutputMode = %d\n", gSaveContext.soundSetting); + PRINTF("Na_SetSoundOutputMode = %d\n", gSaveContext.soundSetting); + PRINTF("Na_SetSoundOutputMode = %d\n", gSaveContext.soundSetting); PRINTF_RST(); - func_800F6700(gSaveContext.audioSetting); + Audio_SetSoundOutputMode(gSaveContext.soundSetting); PRINTF("終了\n"); return; } @@ -1364,11 +1379,11 @@ void FileSelect_UpdateOptionsMenu(GameState* thisx) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); if (sSelectedSetting == FS_SETTING_AUDIO) { - gSaveContext.audioSetting--; + gSaveContext.soundSetting--; // because audio setting is unsigned, can't check for < 0 - if (gSaveContext.audioSetting > 0xF0) { - gSaveContext.audioSetting = FS_AUDIO_SURROUND; + if (gSaveContext.soundSetting > 0xF0) { + gSaveContext.soundSetting = SOUND_SETTING_SURROUND; } } else { #if !OOT_PAL_N64 @@ -1389,10 +1404,10 @@ void FileSelect_UpdateOptionsMenu(GameState* thisx) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); if (sSelectedSetting == FS_SETTING_AUDIO) { - gSaveContext.audioSetting++; + gSaveContext.soundSetting++; - if (gSaveContext.audioSetting > FS_AUDIO_SURROUND) { - gSaveContext.audioSetting = FS_AUDIO_STEREO; + if (gSaveContext.soundSetting > SOUND_SETTING_SURROUND) { + gSaveContext.soundSetting = SOUND_SETTING_STEREO; } } else { #if !OOT_PAL_N64 @@ -1706,7 +1721,7 @@ void FileSelect_DrawOptionsImpl(GameState* thisx) { for (i = 0, vtx = 0; i < 4; i++, vtx += 4) { gDPPipeSync(POLY_OPA_DISP++); - if (i == gSaveContext.audioSetting) { + if (i == gSaveContext.soundSetting) { if (sSelectedSetting == FS_SETTING_AUDIO) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, cursorPrimRed, cursorPrimGreen, cursorPrimBlue, this->titleAlpha[0]); diff --git a/src/overlays/gamestates/ovl_opening/z_opening.c b/src/overlays/gamestates/ovl_opening/z_opening.c index 7b24564cfc..ad36b6e205 100644 --- a/src/overlays/gamestates/ovl_opening/z_opening.c +++ b/src/overlays/gamestates/ovl_opening/z_opening.c @@ -4,7 +4,15 @@ * Description: Initializes the game into the title screen */ -#include "global.h" +#include "gfx.h" +#include "regs.h" +#include "sys_matrix.h" +#include "title_setup_state.h" +#include "z64game.h" +#include "z64play.h" +#include "z64save.h" +#include "z64sram.h" +#include "z64view.h" void TitleSetup_SetupTitleScreen(TitleSetupState* this) { gSaveContext.gameMode = GAMEMODE_TITLE_SCREEN; diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index 6a9b1e1b3d..84b1cb69ae 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -4,15 +4,30 @@ * Description: Debug Scene Select Menu */ -#include "ultra64.h" -#include "global.h" -#include "terminal.h" +#include "libc64/qrand.h" +#include "libu64/gfxprint.h" #include "alloca.h" -#include "z64.h" - +#include "array_count.h" +#include "console_logo_state.h" +#include "controller.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "map_select_state.h" #if PLATFORM_N64 #include "n64dd.h" #endif +#include "printf.h" +#include "regs.h" +#include "segment_symbols.h" +#include "seqcmd.h" +#include "sequence.h" +#include "sfx.h" +#include "terminal.h" +#include "translation.h" +#include "ultra64.h" +#include "z64play.h" +#include "z64save.h" +#include "z64sram.h" void MapSelect_LoadTitle(MapSelectState* this) { this->state.running = false; @@ -63,7 +78,7 @@ void func_80800B08_unknown(MapSelectState* this, s32 arg1) { } #endif -static SceneSelectEntry sScenes[] = { +static MapSelectEntry sMapSelectEntries[] = { { " 1:SPOT00", MapSelect_LoadGame, ENTR_HYRULE_FIELD_0 }, { " 2:SPOT01", MapSelect_LoadGame, ENTR_KAKARIKO_VILLAGE_0 }, { " 3:SPOT02", MapSelect_LoadGame, ENTR_GRAVEYARD_0 }, @@ -276,13 +291,13 @@ static SceneSelectEntry sScenes[] = { void MapSelect_UpdateMenu(MapSelectState* this) { Input* input = &this->state.input[0]; s32 pad; - SceneSelectEntry* selectedScene; + MapSelectEntry* selectedEntry; if (this->verticalInputAccumulator == 0) { if (CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_START)) { - selectedScene = &this->scenes[this->currentScene]; - if (selectedScene->loadFunc != NULL) { - selectedScene->loadFunc(this, selectedScene->entranceIndex); + selectedEntry = &this->entries[this->currentEntry]; + if (selectedEntry->loadFunc != NULL) { + selectedEntry->loadFunc(this, selectedEntry->entranceIndex); } } @@ -420,7 +435,7 @@ void MapSelect_UpdateMenu(MapSelectState* this) { this->pageDownIndex++; this->pageDownIndex = (this->pageDownIndex + ARRAY_COUNT(this->pageDownStops)) % ARRAY_COUNT(this->pageDownStops); - this->currentScene = this->topDisplayedScene = this->pageDownStops[this->pageDownIndex]; + this->currentEntry = this->topDisplayedEntry = this->pageDownStops[this->pageDownIndex]; } this->verticalInputAccumulator += this->verticalInput; @@ -429,12 +444,12 @@ void MapSelect_UpdateMenu(MapSelectState* this) { this->verticalInput = 0; this->verticalInputAccumulator = 0; - this->currentScene++; - this->currentScene = (this->currentScene + this->count) % this->count; + this->currentEntry++; + this->currentEntry = (this->currentEntry + this->count) % this->count; - if (this->currentScene == ((this->topDisplayedScene + this->count + 19) % this->count)) { - this->topDisplayedScene++; - this->topDisplayedScene = (this->topDisplayedScene + this->count) % this->count; + if (this->currentEntry == ((this->topDisplayedEntry + this->count + 19) % this->count)) { + this->topDisplayedEntry++; + this->topDisplayedEntry = (this->topDisplayedEntry + this->count) % this->count; } } @@ -442,25 +457,25 @@ void MapSelect_UpdateMenu(MapSelectState* this) { this->verticalInput = 0; this->verticalInputAccumulator = 0; - if (this->currentScene == this->topDisplayedScene) { - this->topDisplayedScene -= 2; - this->topDisplayedScene = (this->topDisplayedScene + this->count) % this->count; + if (this->currentEntry == this->topDisplayedEntry) { + this->topDisplayedEntry -= 2; + this->topDisplayedEntry = (this->topDisplayedEntry + this->count) % this->count; } - this->currentScene--; - this->currentScene = (this->currentScene + this->count) % this->count; + this->currentEntry--; + this->currentEntry = (this->currentEntry + this->count) % this->count; - if (this->currentScene == ((this->topDisplayedScene + this->count) % this->count)) { - this->topDisplayedScene--; - this->topDisplayedScene = (this->topDisplayedScene + this->count) % this->count; + if (this->currentEntry == ((this->topDisplayedEntry + this->count) % this->count)) { + this->topDisplayedEntry--; + this->topDisplayedEntry = (this->topDisplayedEntry + this->count) % this->count; } } - this->currentScene = (this->currentScene + this->count) % this->count; - this->topDisplayedScene = (this->topDisplayedScene + this->count) % this->count; + this->currentEntry = (this->currentEntry + this->count) % this->count; + this->topDisplayedEntry = (this->topDisplayedEntry + this->count) % this->count; - dREG(80) = this->currentScene; - dREG(81) = this->topDisplayedScene; + dREG(80) = this->currentEntry; + dREG(81) = this->topDisplayedEntry; dREG(82) = this->pageDownIndex; if (this->timerUp != 0) { @@ -493,14 +508,14 @@ void MapSelect_PrintMenu(MapSelectState* this, GfxPrint* printer) { for (i = 0; i < 20; i++) { GfxPrint_SetPos(printer, 9, i + 4); - scene = (this->topDisplayedScene + i + this->count) % this->count; - if (scene == this->currentScene) { + scene = (this->topDisplayedEntry + i + this->count) % this->count; + if (scene == this->currentEntry) { GfxPrint_SetColor(printer, 255, 20, 20, 255); } else { GfxPrint_SetColor(printer, 200, 200, 55, 255); } - name = this->scenes[scene].name; + name = this->entries[scene].name; if (name == NULL) { name = "**Null**"; } @@ -689,9 +704,9 @@ void MapSelect_Init(GameState* thisx) { this->state.main = MapSelect_Main; this->state.destroy = MapSelect_Destroy; - this->scenes = sScenes; - this->topDisplayedScene = 0; - this->currentScene = 0; + this->entries = sMapSelectEntries; + this->topDisplayedEntry = 0; + this->currentEntry = 0; this->pageDownStops[0] = 0; // Hyrule Field this->pageDownStops[1] = 19; // Temple Of Time this->pageDownStops[2] = 37; // Treasure Chest Game @@ -701,7 +716,7 @@ void MapSelect_Init(GameState* thisx) { this->pageDownStops[6] = 91; // Escaping Ganon's Tower 3 this->pageDownIndex = 0; this->opt = 0; - this->count = ARRAY_COUNT(sScenes); + this->count = ARRAY_COUNT(sMapSelectEntries); View_Init(&this->view, this->state.gfxCtx); this->view.flags = (VIEW_PROJECTION_ORTHO | VIEW_VIEWPORT); this->verticalInputAccumulator = 0; @@ -713,8 +728,8 @@ void MapSelect_Init(GameState* thisx) { this->unk_234 = 0; if ((dREG(80) >= 0) && (dREG(80) < this->count)) { - this->currentScene = dREG(80); - this->topDisplayedScene = dREG(81); + this->currentEntry = dREG(80); + this->topDisplayedEntry = dREG(81); this->pageDownIndex = dREG(82); } diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index 8613d7bd37..588588b243 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -4,15 +4,31 @@ * Description: Displays the Nintendo Logo */ -#include "global.h" -#include "alloca.h" -#include "versions.h" - +#include "libu64/gfxprint.h" #if PLATFORM_N64 #include "cic6105.h" #include "n64dd.h" #endif +#include "alloca.h" +#include "build.h" +#include "console_logo_state.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "padmgr.h" +#include "printf.h" +#include "regs.h" +#include "segment_symbols.h" +#include "sequence.h" +#include "sys_matrix.h" +#include "sys_debug_controller.h" +#include "sys_freeze.h" +#include "title_setup_state.h" +#include "versions.h" +#include "z64actor.h" +#include "z64environment.h" +#include "z64save.h" + #include "assets/textures/nintendo_rogo_static/nintendo_rogo_static.h" #if DEBUG_FEATURES diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c index 26ba15dccc..aefe4b3a60 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c @@ -1,4 +1,15 @@ #include "z_kaleido_scope.h" + +#include "array_count.h" +#include "controller.h" +#include "gfx.h" +#include "printf.h" +#include "regs.h" +#include "sfx.h" +#include "z64ocarina.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/textures/parameter_static/parameter_static.h" #include "assets/textures/icon_item_static/icon_item_static.h" diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c index 6cf75817a5..a8433e9f2e 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c @@ -1,4 +1,14 @@ #include "z_kaleido_scope.h" + +#include "libu64/gfxprint.h" +#include "controller.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "gfxalloc.h" +#include "printf.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/textures/parameter_static/parameter_static.h" // Positions of each input section in the editor diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c index 88931f745b..6b7da76bbd 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c @@ -1,4 +1,15 @@ #include "z_kaleido_scope.h" + +#include "controller.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "regs.h" +#include "sfx.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/textures/icon_item_static/icon_item_static.h" #include "assets/textures/parameter_static/parameter_static.h" @@ -156,8 +167,10 @@ void KaleidoScope_DrawPlayerWork(PlayState* play) { BOOTS_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_BOOTS))); } +#ifndef AVOID_UB // Wrong prototype; this function is called with `play` even though it has no arguments void KaleidoScope_ProcessPlayerPreRender(PlayState* play); +#endif void KaleidoScope_DrawEquipment(PlayState* play) { static s16 sEquipTimer = 0; @@ -678,8 +691,12 @@ void KaleidoScope_DrawEquipment(PlayState* play) { } if ((pauseCtx->mainState == PAUSE_MAIN_STATE_EQUIP_CHANGED) && (sEquipTimer == 9)) { +#ifndef AVOID_UB //! @bug: This function shouldn't take any arguments KaleidoScope_ProcessPlayerPreRender(play); +#else + KaleidoScope_ProcessPlayerPreRender(); +#endif } gSPSegment(POLY_OPA_DISP++, 0x07, pauseCtx->playerSegment); diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c index 543f679bd9..f01d2d6137 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c @@ -1,4 +1,15 @@ #include "z_kaleido_scope.h" + +#include "libu64/pad.h" +#include "controller.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "printf.h" +#include "regs.h" +#include "sfx.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/textures/parameter_static/parameter_static.h" u8 gAmmoItems[] = { diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.c index 29bb488b3b..8c58493ccf 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.c @@ -1,5 +1,17 @@ #include "z_kaleido_scope.h" + +#include "gfx.h" +#include "gfx_setupdl.h" +#include "language_array.h" +#include "map.h" +#include "printf.h" +#include "regs.h" +#include "sfx.h" +#include "sys_ucode.h" #include "versions.h" +#include "z64play.h" +#include "z64save.h" + #include "assets/textures/icon_item_24_static/icon_item_24_static.h" #if OOT_NTSC #include "assets/textures/icon_item_jpn_static/icon_item_jpn_static.h" diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c index c784ab0b4a..6264c4147c 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c @@ -1,5 +1,10 @@ #include "z_kaleido_scope.h" +#include "libu64/pad.h" +#include "regs.h" +#include "sfx.h" +#include "z64play.h" + static s16 sKaleidoPromptCursorAlphaVals[] = { 100, 255 }; void KaleidoScope_UpdatePrompt(PlayState* play) { diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c index 0df4c60a95..48a1b60cfc 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c @@ -1,7 +1,32 @@ +#include "z_kaleido_scope.h" + +#include "libc64/sleep.h" +#include "array_count.h" +#include "controller.h" +#include "gfx.h" +#include "gfx_setupdl.h" +#include "gfxalloc.h" +#include "language_array.h" +#include "map.h" #if PLATFORM_N64 #include "n64dd.h" #endif -#include "z_kaleido_scope.h" +#include "printf.h" +#include "regs.h" +#include "segment_symbols.h" +#include "segmented_address.h" +#include "seqcmd.h" +#include "sfx.h" +#include "sys_matrix.h" +#include "terminal.h" +#include "title_setup_state.h" +#include "versions.h" +#include "z64audio.h" +#include "z64ocarina.h" +#include "z64play.h" +#include "z64player.h" +#include "z64save.h" + #include "assets/textures/icon_item_static/icon_item_static.h" #include "assets/textures/icon_item_24_static/icon_item_24_static.h" #if OOT_NTSC @@ -13,10 +38,9 @@ #include "assets/textures/icon_item_fra_static/icon_item_fra_static.h" #endif #include "assets/textures/icon_item_gameover_static/icon_item_gameover_static.h" -#include "terminal.h" -#include "versions.h" -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ + "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" #if !PLATFORM_GC #define KALEIDO_PROMPT_CURSOR_R 100 @@ -3724,7 +3748,7 @@ void KaleidoScope_Update(PlayState* play) { DMA_REQUEST_SYNC(pauseCtx->iconItemSegment, (uintptr_t)_icon_item_staticSegmentRomStart, iconItemStaticSize, "../z_kaleido_scope_PAL.c", 3662); - gSegments[8] = VIRTUAL_TO_PHYSICAL(pauseCtx->iconItemSegment); + gSegments[8] = OS_K0_TO_PHYSICAL(pauseCtx->iconItemSegment); for (i = 0; i < ARRAY_COUNTU(gItemAgeReqs); i++) { if (!CHECK_AGE_REQ_ITEM(i)) { diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h index 916b8f826f..fcc84c5395 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h @@ -2,7 +2,11 @@ #define Z_KALEIDO_SCOPE_H #include "ultra64.h" -#include "global.h" +#include "gfx.h" +#include "z64inventory.h" +#include "z64pause.h" + +struct PlayState; extern u8 gAmmoItems[]; extern s16 gVtxPageMapWorldQuadsWidth[]; @@ -214,26 +218,28 @@ typedef enum ItemQuad { /* 41 */ ITEM_QUAD_MAX } ItemQuad; -void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx); +void KaleidoScope_DrawQuestStatus(struct PlayState* play, GraphicsContext* gfxCtx); s32 KaleidoScope_UpdateQuestStatusPoint(PauseContext* pauseCtx, s32 point); -void KaleidoScope_DrawDebugEditor(PlayState* play); -void KaleidoScope_DrawPlayerWork(PlayState* play); -void KaleidoScope_DrawEquipment(PlayState* play); +void KaleidoScope_DrawDebugEditor(struct PlayState* play); +void KaleidoScope_DrawPlayerWork(struct PlayState* play); +void KaleidoScope_DrawEquipment(struct PlayState* play); void KaleidoScope_SetCursorPos(PauseContext* pauseCtx, u16 index, Vtx* vtx); -void KaleidoScope_DrawItemSelect(PlayState* play); -void KaleidoScope_UpdateItemEquip(PlayState* play); -void KaleidoScope_DrawDungeonMap(PlayState* play, GraphicsContext* gfxCtx); -void KaleidoScope_DrawWorldMap(PlayState* play, GraphicsContext* gfxCtx); -void KaleidoScope_UpdatePrompt(PlayState* play); +void KaleidoScope_DrawItemSelect(struct PlayState* play); +void KaleidoScope_UpdateItemEquip(struct PlayState* play); +void KaleidoScope_DrawDungeonMap(struct PlayState* play, GraphicsContext* gfxCtx); +void KaleidoScope_DrawWorldMap(struct PlayState* play, GraphicsContext* gfxCtx); +void KaleidoScope_UpdatePrompt(struct PlayState* play); Gfx* KaleidoScope_QuadTextureIA4(Gfx* gfx, void* texture, s16 width, s16 height, u16 point); Gfx* KaleidoScope_QuadTextureIA8(Gfx* gfx, void* texture, s16 width, s16 height, u16 point); -void KaleidoScope_MoveCursorToSpecialPos(PlayState* play, u16 specialPos); +void KaleidoScope_MoveCursorToSpecialPos(struct PlayState* play, u16 specialPos); void KaleidoScope_DrawQuadTextureRGBA32(GraphicsContext* gfxCtx, void* texture, u16 width, u16 height, u16 point); -void KaleidoScope_ProcessPlayerPreRender(); -void KaleidoScope_SetupPlayerPreRender(PlayState* play); -void KaleidoScope_DrawCursor(PlayState* play, u16 pageIndex); -void KaleidoScope_UpdateDungeonMap(PlayState* play); +#ifdef AVOID_UB +void KaleidoScope_ProcessPlayerPreRender(void); +#endif +void KaleidoScope_SetupPlayerPreRender(struct PlayState* play); +void KaleidoScope_DrawCursor(struct PlayState* play, u16 pageIndex); +void KaleidoScope_UpdateDungeonMap(struct PlayState* play); -void PauseMapMark_Draw(PlayState* play); +void PauseMapMark_Draw(struct PlayState* play); #endif diff --git a/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c b/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c index 89283bfc16..ec2c566ece 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c @@ -1,7 +1,12 @@ #if PLATFORM_N64 #include "n64dd.h" #endif +#include "regs.h" +#include "sys_matrix.h" #include "z_kaleido_scope.h" +#include "z_lib.h" +#include "z64play.h" + #include "assets/textures/parameter_static/parameter_static.h" typedef struct PauseMapMarkInfo { diff --git a/sym_info.py b/sym_info.py index 9fec30b581..0b8936bb54 100755 --- a/sym_info.py +++ b/sym_info.py @@ -1,42 +1,362 @@ #!/usr/bin/env python3 -import argparse -from pathlib import Path +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 +import argparse +import bisect +from dataclasses import dataclass +import os +from pathlib import Path +from typing import Optional +import struct +import sys + +import colorama +import elftools.elf.elffile import mapfile_parser -def symInfoMain(): - parser = argparse.ArgumentParser(description="Display various information about a symbol or address.") - parser.add_argument("symname", help="symbol name or VROM/VRAM address to lookup") - parser.add_argument("-v", "--version", dest="oot_version", help="Which version should be processed", default="gc-eu-mq-dbg") - parser.add_argument("-e", "--expected", dest="use_expected", action="store_true", help="use the map file in expected/build/ instead of build/") +@dataclass +class MdebugSymbolicHeader: + magic: int + vstamp: int + ilineMax: int + cbLine: int + cbLineOffset: int + idnMax: int + cbDnOffset: int + ipdMax: int + cbPdOffset: int + isymMax: int + cbSymOffset: int + ioptMax: int + cbOptOffset: int + iauxMax: int + cbAuxOffset: int + issMax: int + cbSsOffset: int + issExtMax: int + cbSsExtOffset: int + ifdMax: int + cbFdOffset: int + crfd: int + cbRfdOffset: int + iextMax: int + cbExtOffset: int - args = parser.parse_args() - BUILTMAP = Path("build") / args.oot_version / f"oot-{args.oot_version}.map" +@dataclass +class MdebugFileDescriptor: + adr: int + rss: int + issBase: int + cbSs: int + isymBase: int + csym: int + ilineBase: int + cline: int + ioptBase: int + copt: int + ipdFirst: int + cpd: int + iauxBase: int + caux: int + rfdBase: int + crfd: int + bitfield: int + cbLineOffset: int + cbLine: int - mapPath = BUILTMAP - if args.use_expected: - mapPath = "expected" / BUILTMAP - # Guess if the input is an VROM/VRAM or a symbol name - as_vram = False - as_vrom = False - as_name = False - try: - address = int(args.symname, 0) - if address >= 0x01000000: - as_vram = True - else: - as_vrom = True - except ValueError: - as_name = True +@dataclass +class MdebugSymbol: + iss: int + value: int + st: int + sc: int + index: int - mapfile_parser.frontends.sym_info.doSymInfo( - mapPath, args.symname, as_vram=as_vram, as_vrom=as_vrom, as_name=as_name + +@dataclass +class LocalSymbol: + name: str + address: int + + +def read_mdebug_symbolic_header(f, offset: int) -> MdebugSymbolicHeader: + f.seek(offset) + data = f.read(96) + return MdebugSymbolicHeader(*struct.unpack(">2H23I", data)) + + +def read_mdebug_file_descriptor(f, offset: int) -> MdebugFileDescriptor: + f.seek(offset) + data = f.read(72) + return MdebugFileDescriptor(*struct.unpack(">I2iI6iHh4iI2I", data)) + + +def read_mdebug_symbol(f, offset: int) -> MdebugSymbol: + f.seek(offset) + data = f.read(12) + word0, word1, word2 = struct.unpack(">III", data) + return MdebugSymbol( + word0, word1, (word2 >> 26) & 0x3F, (word2 >> 21) & 0x1F, word2 & 0xFFFFF ) +def read_mdebug_string(f, offset: int) -> str: + f.seek(offset) + data = bytearray() + while True: + char = f.read(1)[0] + if char == 0: + break + data.append(char) + return data.decode("ascii") + + +def read_local_symbols_from_mdebug(elf_path: Path) -> list[LocalSymbol]: + local_symbols = [] + + with open(elf_path, "r+b") as f: + elf = elftools.elf.elffile.ELFFile(f) + + mdebug_offset = 0 + for section in elf.iter_sections(): + if section.name == ".mdebug": + mdebug_offset = section["sh_offset"] + break + + if mdebug_offset == 0: + print(f"No .mdebug section found in '{elf_path}'") + return [] + + symbolic_header = read_mdebug_symbolic_header(f, mdebug_offset) + + for fd_num in range(symbolic_header.ifdMax): + fd = read_mdebug_file_descriptor( + f, symbolic_header.cbFdOffset + fd_num * 72 + ) + + for sym_num in range(fd.isymBase, fd.isymBase + fd.csym): + sym = read_mdebug_symbol(f, symbolic_header.cbSymOffset + sym_num * 12) + if sym.st == 2: # stStatic + if not ( + sym.sc == 2 or sym.sc == 3 or sym.sc == 15 + ): # scData, scBss, scRData + continue + + sym_name = read_mdebug_string( + f, symbolic_header.cbSsOffset + fd.issBase + sym.iss + ) + + # EGCS mangles names of internal variables, and seemingly ":V" is for in-function static variables + if "." in sym_name: + continue + if ":" in sym_name: + sym_name, rest = sym_name.split(":", 1) + if not rest.startswith("V"): + continue + + local_symbols.append(LocalSymbol(sym_name, sym.value)) + elif sym.st == 14: # stStaticProc + sym_name = read_mdebug_string( + f, symbolic_header.cbSsOffset + fd.issBase + sym.iss + ) + local_symbols.append(LocalSymbol(sym_name, sym.value)) + + return local_symbols + + +def merge_local_symbols( + map_file: mapfile_parser.mapfile.MapFile, local_symbols: list[LocalSymbol] +): + local_symbols.sort(key=lambda s: s.address) + + for segment in map_file: + for file in segment: + # TODO: handle segmented addresses? + if file.vram < 0x80000000: + continue + + start_address = file.vram + end_address = file.vram + file.size + + start_index = bisect.bisect_left( + local_symbols, start_address, key=lambda s: s.address + ) + end_index = bisect.bisect_left( + local_symbols, end_address, key=lambda s: s.address + ) + if start_index == end_index: + continue + + symbols = file.copySymbolList() + for sym in local_symbols[start_index:end_index]: + if file.vrom is None: + vrom = None + else: + vrom = sym.address - start_address + file.vrom + symbols.append( + mapfile_parser.mapfile.Symbol( + sym.name, sym.address, None, vrom, None + ) + ) + + symbols.sort(key=lambda s: s.vram) + + # Recompute symbol sizes + for i in range(len(symbols)): + if i == len(symbols) - 1: + symbols[i].size = end_address - symbols[i].vram + else: + symbols[i].size = symbols[i + 1].vram - symbols[i].vram + + file.setSymbolList(symbols) + + +def find_symbols_by_name( + map_file: mapfile_parser.mapfile.MapFile, sym_name: str +) -> list[mapfile_parser.mapfile.FoundSymbolInfo]: + infos = [] + + for segment in map_file: + for file in segment: + for sym in file: + if sym.name == sym_name: + infos.append(mapfile_parser.mapfile.FoundSymbolInfo(file, sym)) + + return infos + + +def print_map_file(map_file: mapfile_parser.mapfile.MapFile, *, colors: bool): + for segment in map_file: + print( + f"{colorama.Fore.GREEN if colors else ""}" + f"{segment.name}" + f"{colorama.Fore.RESET if colors else ""}" + ) + for file in segment: + # Ignore debug sections + if ( + file.sectionType in (".pdr", ".line", ".gnu.attributes") + or file.sectionType.startswith(".debug") + or file.sectionType.startswith(".mdebug") + ): + continue + print( + f"{colorama.Fore.CYAN if colors else ""}" + f" {file.asStr()}" + f"{colorama.Fore.RESET if colors else ""}" + ) + for sym in file: + vram_str = f"{sym.vram:08X}" + if sym.vrom is None: + vrom_str = " " + else: + vrom_str = f"{sym.vrom:06X}" + print(f" {vram_str} {vrom_str} {sym.name}") + + +def sym_info_main(): + parser = argparse.ArgumentParser( + description="Display various information about symbol or addresses." + ) + parser.add_argument( + "symname", + nargs="?", + help="symbol name or VROM/VRAM address to lookup. If not given, all symbols will be printed.", + ) + parser.add_argument( + "-e", + "--expected", + dest="use_expected", + action="store_true", + help="use the map file and elf in expected/build/ instead of build/", + ) + parser.add_argument( + "--color", + help="Whether to print using colors or not", + choices=("never", "always", "auto"), + default="auto", + ) + parser.add_argument( + "-v", + "--version", + dest="oot_version", + help="which version should be processed (default: gc-eu-mq-dbg)", + default="gc-eu-mq-dbg", + ) + + args = parser.parse_args() + + if args.color == "never": + colors = False + elif args.color == "always": + colors = True + else: + # auto + if os.getenv("NO_COLOR"): + colors = False + else: + colors = sys.stdout.isatty() + + BUILTMAP = Path("build") / args.oot_version / f"oot-{args.oot_version}.map" + BUILTELF = Path("build") / args.oot_version / f"oot-{args.oot_version}.elf" + + map_path = BUILTMAP + elf_path = BUILTELF + if args.use_expected: + map_path = "expected" / BUILTMAP + elf_path = "expected" / BUILTELF + + if not map_path.exists(): + print(f"Could not find map_file at '{map_path}'") + sys.exit(1) + + map_file = mapfile_parser.mapfile.MapFile() + map_file.readMapFile(map_path) + + if elf_path.exists(): + local_symbols = read_local_symbols_from_mdebug(elf_path) + merge_local_symbols(map_file, local_symbols) + else: + print( + f"Could not find ELF file at '{elf_path}', local symbols will not be available" + ) + + sym_name = args.symname + if sym_name is None: + print_map_file(map_file, colors=colors) + sys.exit(0) + + infos: list[mapfile_parser.mapfile.FoundSymbolInfo] = [] + possible_files: list[mapfile_parser.mapfile.File] = [] + try: + address = int(sym_name, 0) + if address >= 0x01000000: + info, possible_files = map_file.findSymbolByVram(address) + if info is not None: + infos = [info] + else: + info, possible_files = map_file.findSymbolByVrom(address) + if info is not None: + infos = [info] + except ValueError: + infos = find_symbols_by_name(map_file, sym_name) + + if not infos: + print(f"'{sym_name}' not found in map file '{map_path}'") + if len(possible_files) > 0: + print("But it may be a local symbol of either of the following files:") + for f in possible_files: + print(f" {f.asStr()})") + sys.exit(1) + + for info in infos: + print(info.getAsStrPlusOffset(sym_name)) + + if __name__ == "__main__": - symInfoMain() + sym_info_main() diff --git a/tools/.gitignore b/tools/.gitignore index 8d3a321faa..5345868178 100644 --- a/tools/.gitignore +++ b/tools/.gitignore @@ -1,5 +1,6 @@ # Output files *.exe +bin2c elf2rom makeromfs mkdmadata diff --git a/tools/Makefile b/tools/Makefile index dae70625d5..7f6eef55a1 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,5 +1,5 @@ -CFLAGS := -Wall -Wextra -pedantic -std=c99 -g -O2 -PROGRAMS := elf2rom makeromfs mkdmadata mkldscript preprocess_pragmas reloc_prereq vtxdis +CFLAGS := -Wall -Wextra -pedantic -std=gnu99 -g -O2 +PROGRAMS := bin2c elf2rom makeromfs mkdmadata mkldscript preprocess_pragmas reloc_prereq vtxdis UNAME_S := $(shell uname -s) ifeq ($(UNAME_S),Linux) @@ -35,25 +35,27 @@ ifneq ($(LLD),0) endif all: $(PROGRAMS) $(IDO_RECOMP_5_3_DIR) $(IDO_RECOMP_7_1_DIR) $(EGCS_DIR) - $(MAKE) -C ZAPD $(MAKE) -C fado $(MAKE) -C audio $(MAKE) -C com-plugin + $(MAKE) -C assets clean: $(RM) $(PROGRAMS) $(addsuffix .exe,$(PROGRAMS)) $(RM) -r ido_recomp egcs - $(MAKE) -C ZAPD clean $(MAKE) -C fado clean $(MAKE) -C audio clean $(MAKE) -C com-plugin clean + $(MAKE) -C assets clean distclean: clean $(MAKE) -C audio distclean + $(MAKE) -C assets distclean .PHONY: all clean distclean elf2rom_SOURCES := elf2rom.c elf32.c n64chksum.c util.c +bin2c_SOURCES := bin2c.c makeromfs_SOURCES := makeromfs.c n64chksum.c util.c mkdmadata_SOURCES := mkdmadata.c spec.c util.c mkldscript_SOURCES := mkldscript.c spec.c util.c diff --git a/tools/ZAPD/.clang-format b/tools/ZAPD/.clang-format deleted file mode 100644 index 5ba1c4a955..0000000000 --- a/tools/ZAPD/.clang-format +++ /dev/null @@ -1,84 +0,0 @@ ---- -AccessModifierOffset: -4 -AlignAfterOpenBracket: Align -AlignConsecutiveAssignments: false -AlignConsecutiveDeclarations: false -AlignEscapedNewlinesLeft: false -AlignOperands: true -AlignTrailingComments: true -AllowAllParametersOfDeclarationOnNextLine: true -AllowShortBlocksOnASingleLine: false -AllowShortCaseLabelsOnASingleLine: false -AllowShortFunctionsOnASingleLine: InlineOnly -AllowShortIfStatementsOnASingleLine: false -AllowShortLoopsOnASingleLine: false -AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: None -AlwaysBreakBeforeMultilineStrings: false -AlwaysBreakTemplateDeclarations: true -BinPackArguments: true -BinPackParameters: true -BraceWrapping: - AfterCaseLabel: true - AfterClass: true - AfterControlStatement: true - AfterEnum: true - AfterFunction: true - AfterNamespace: true - AfterStruct: true - AfterUnion: true - BeforeCatch: true - BeforeElse: true - IndentBraces: false -BreakBeforeBinaryOperators: None -BreakBeforeBraces: Custom -BreakBeforeTernaryOperators: false -BreakConstructorInitializersBeforeComma: false -ColumnLimit: 100 -CommentPragmas: '^ (IWYU pragma:|NOLINT)' -ConstructorInitializerAllOnOneLineOrOnePerLine: false -ConstructorInitializerIndentWidth: 4 -ContinuationIndentWidth: 4 -Cpp11BracedListStyle: true -DerivePointerAlignment: false -DisableFormat: false -ForEachMacros: [ ] -IncludeCategories: - - Regex: '^<[Ww]indows\.h>$' - Priority: 1 - - Regex: '^<' - Priority: 2 - - Regex: '^"' - Priority: 3 -IndentCaseLabels: false -IndentWidth: 4 -IndentWrappedFunctionNames: false -KeepEmptyLinesAtTheStartOfBlocks: false -MacroBlockBegin: '' -MacroBlockEnd: '' -MaxEmptyLinesToKeep: 1 -NamespaceIndentation: None -PenaltyBreakBeforeFirstCallParameter: 19 -PenaltyBreakComment: 300 -PenaltyBreakFirstLessLess: 120 -PenaltyBreakString: 1000 -PenaltyExcessCharacter: 1000000 -PenaltyReturnTypeOnItsOwnLine: 60 -PointerAlignment: Left -ReflowComments: true -SortIncludes: false -SpaceAfterCStyleCast: false -SpaceBeforeAssignmentOperators: true -SpaceBeforeParens: ControlStatements -SpaceInEmptyParentheses: false -SpacesBeforeTrailingComments: 2 -SpacesInAngles: false -SpacesInContainerLiterals: true -SpacesInCStyleCastParentheses: false -SpacesInParentheses: false -SpacesInSquareBrackets: false -Standard: Latest -TabWidth: 4 -UseTab: AlignWithSpaces -... - diff --git a/tools/ZAPD/.github/workflows/main.yml b/tools/ZAPD/.github/workflows/main.yml deleted file mode 100644 index 604c18c961..0000000000 --- a/tools/ZAPD/.github/workflows/main.yml +++ /dev/null @@ -1,98 +0,0 @@ -name: Build ZAPD - -on: - push: - pull_request: - branches: - - master - -jobs: - build: - runs-on: self-hosted-runner - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Build ZAPD - run: make -j WERROR=1 - - - name: Checkout Repos - run: echo "Checkout Repos" - - - name: Checkout oot - run: | - cd ../ - rm -rf oot/ - git clone https://github.com/zeldaret/oot.git - cd oot - echo $(pwd) - git submodule update --init --recursive - - - name: Checkout mm - run: | - cd ../ - rm -rf mm/ - git clone https://github.com/zeldaret/mm.git - cd mm - echo $(pwd) - - - name: Set up repos - run: echo "Set up repos" - - - name: Setup OOT - run: | - cd ../ - cd oot - echo $(pwd) - mkdir -p baseroms/gc-eu-mq-dbg/segments - cp ~/baserom_original.z64 ./baseroms/gc-eu-mq-dbg/baserom.z64 - cd tools - rm -rf ZAPD/ - ln -s ../../ZAPD - cd ../ - make -j $(nproc) setup - - - name: Setup MM - run: | - cd ../ - cd mm - echo $(pwd) - python3 -m venv .mm-env - source .mm-env/bin/activate - python3 -m pip install -r requirements.txt - cp ~/baserom.mm.us.rev1.z64 ./baserom.mm.us.rev1.z64 - cd tools - rm -rf ZAPD/ - ln -s ../../ZAPD - cd ../ - make -C tools -j - python3 tools/fixbaserom.py - python3 tools/extract_baserom.py - python3 tools/decompress_yars.py - python3 extract_assets.py -j $(nproc) - - - name: Build Repos - run: echo "Build Repos" - - - name: Build oot - run: | - cd ../ - cd oot - echo $(pwd) - make venv - make -j - - - name: Build mm - run: | - cd ../ - cd mm - echo $(pwd) - python3 -m venv .mm-env - source .mm-env/bin/activate - python3 -m pip install -r requirements.txt - make -j disasm - make -j - - - name: Clean workspace - run: git clean -fdX diff --git a/tools/ZAPD/.gitignore b/tools/ZAPD/.gitignore deleted file mode 100644 index 68c502e36a..0000000000 --- a/tools/ZAPD/.gitignore +++ /dev/null @@ -1,341 +0,0 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. -## -## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore - -# User-specific files -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ - -# Visual Studio 2015/2017 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# Visual Studio 2017 auto generated files -Generated\ Files/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUNIT -*.VisualState.xml -TestResult.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# Benchmark Results -BenchmarkDotNet.Artifacts/ - -# .NET Core -project.lock.json -project.fragment.lock.json -artifacts/ -**/Properties/launchSettings.json - -# StyleCop -StyleCopReport.xml - -# Files built by Visual Studio -*_i.c -*_p.c -*_i.h -*.ilk -*.meta -*.obj -*.iobj -*.pch -*.pdb -*.ipdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# Visual Studio Trace Files -*.e2e - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# JustCode is a .NET coding add-in -.JustCode - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# AxoCover is a Code Coverage Tool -.axoCover/* -!.axoCover/settings.json - -# Visual Studio code coverage results -*.coverage -*.coveragexml - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# The packages folder can be ignored because of Package Restore -**/[Pp]ackages/* -# except build/, which is used as an MSBuild target. -!**/[Pp]ackages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/[Pp]ackages/repositories.config -# NuGet v3's project.json files produces more ignorable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt -*.appx - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -orleans.codegen.cs - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) -#*.snk - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm -ServiceFabricBackup/ -*.rptproj.bak - -# SQL Server files -*.mdf -*.ldf -*.ndf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings -*.rptproj.rsuser - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat -node_modules/ - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) -*.vbw - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# JetBrains Rider -.idea/ -*.sln.iml - -# CodeRush -.cr/ - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio -*.tss - -# Telerik's JustMock configuration file -*.jmconfig - -# BizTalk build output -*.btp.cs -*.btm.cs -*.odx.cs -*.xsd.cs - -# OpenCover UI analysis results -OpenCover/ - -# Azure Stream Analytics local run output -ASALocalRun/ - -# MSBuild Binary and Structured Log -*.binlog - -# NVidia Nsight GPU debugger configuration file -*.nvuser - -# MFractors (Xamarin productivity tool) working folder -.mfractor/ - -*.out -*.o -*.d -lib/libgfxd/libgfxd.a -ExporterTest/ExporterTest.a -ZAPDUtils/ZAPDUtils.a -.vscode/ -build/ -ZAPDUtils/build/ -ZAPD/BuildInfo.h diff --git a/tools/ZAPD/.gitrepo b/tools/ZAPD/.gitrepo deleted file mode 100644 index 801b2b6383..0000000000 --- a/tools/ZAPD/.gitrepo +++ /dev/null @@ -1,12 +0,0 @@ -; DO NOT EDIT (unless you know what you are doing) -; -; This subdirectory is a git "subrepo", and this file is maintained by the -; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme -; -[subrepo] - remote = https://github.com/zeldaret/ZAPD.git - branch = master - commit = 35ea376daf003fdd3297a2e7355ad82e70ec1e8c - parent = b97a21c2532622a83e9153996e303c3edc2727a8 - method = merge - cmdver = 0.4.6 diff --git a/tools/ZAPD/ExporterTest/CollisionExporter.cpp b/tools/ZAPD/ExporterTest/CollisionExporter.cpp deleted file mode 100644 index 6431a4593c..0000000000 --- a/tools/ZAPD/ExporterTest/CollisionExporter.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include "CollisionExporter.h" - -void ExporterExample_Collision::Save(ZResource* res, [[maybe_unused]] fs::path outPath, - BinaryWriter* writer) -{ - ZCollisionHeader* col = (ZCollisionHeader*)res; - - writer->Write(col->absMinX); - writer->Write(col->absMinY); - writer->Write(col->absMinZ); - - writer->Write(col->absMaxX); - writer->Write(col->absMaxY); - writer->Write(col->absMaxZ); - - writer->Write(col->numVerts); - writer->Write(col->vtxAddress); - - writer->Write(col->numPolygons); - writer->Write(col->polyAddress); - writer->Write(col->polyTypeDefAddress); - writer->Write(col->camDataAddress); - - writer->Write(col->numWaterBoxes); - writer->Write(col->waterBoxAddress); - - writer->Write(col->vtxSegmentOffset); - writer->Write(col->polySegmentOffset); - writer->Write(col->polyTypeDefSegmentOffset); - writer->Write(col->camDataSegmentOffset); - writer->Write(col->waterBoxSegmentOffset); - - uint32_t oldOffset = writer->GetBaseAddress(); - - writer->Seek(col->vtxSegmentOffset, SeekOffsetType::Start); - - for (uint16_t i = 0; i < col->vertices.size(); i++) - { - for (uint32_t j = 0; j < col->vertices[i].dimensions; j++) - { - writer->Write(col->vertices[i].scalars[j].scalarData.s16); - } - } - - writer->Seek(col->polySegmentOffset, SeekOffsetType::Start); - - for (uint16_t i = 0; i < col->polygons.size(); i++) - { - writer->Write(col->polygons[i].type); - writer->Write(col->polygons[i].vtxA); - writer->Write(col->polygons[i].vtxB); - writer->Write(col->polygons[i].vtxC); - writer->Write(col->polygons[i].normX); - writer->Write(col->polygons[i].normY); - writer->Write(col->polygons[i].normZ); - writer->Write(col->polygons[i].dist); - } - - writer->Seek(col->polyTypeDefSegmentOffset, SeekOffsetType::Start); - - for (const auto& poly : col->polygonTypes) - { - writer->Write(poly.data[0]); - writer->Write(poly.data[1]); - } - writer->Seek(col->camDataSegmentOffset, SeekOffsetType::Start); - - for (auto entry : col->camData->entries) - { - writer->Write(entry.cameraSType); - writer->Write(entry.numData); - writer->Write(entry.cameraPosDataSeg); - } - - writer->Seek(oldOffset, SeekOffsetType::Start); -} diff --git a/tools/ZAPD/ExporterTest/CollisionExporter.h b/tools/ZAPD/ExporterTest/CollisionExporter.h deleted file mode 100644 index 5f48e6557e..0000000000 --- a/tools/ZAPD/ExporterTest/CollisionExporter.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -#include "ZCollision.h" -#include "ZResource.h" - -class ExporterExample_Collision : public ZResourceExporter -{ -public: - void Save(ZResource* res, fs::path outPath, BinaryWriter* writer) override; -}; \ No newline at end of file diff --git a/tools/ZAPD/ExporterTest/ExporterTest.vcxproj b/tools/ZAPD/ExporterTest/ExporterTest.vcxproj deleted file mode 100644 index 341f72ceb1..0000000000 --- a/tools/ZAPD/ExporterTest/ExporterTest.vcxproj +++ /dev/null @@ -1,160 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 16.0 - Win32Proj - {65608eb0-1a47-45ad-ab66-192fb64c762c} - ExporterTest - 10.0 - ExporterExample - - - - Application - true - v142 - Unicode - - - Application - false - v143 - true - Unicode - - - StaticLibrary - true - v142 - Unicode - - - Application - false - v143 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - - - false - - - true - $(ProjectDir)..\ZAPD\;$(ProjectDir)..\ZAPDUtils;$(ProjectDir)..\lib\tinyxml2;$(ProjectDir)..\lib\libgfxd;$(ProjectDir)..\lib\elfio;$(ProjectDir)..\lib\stb;$(ProjectDir);$(IncludePath) - - - false - - - - Level3 - true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - - - - - Level3 - true - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - Level3 - true - _DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - stdcpp17 - stdc11 - MultiThreadedDebug - - - Console - true - - - - - Level3 - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tools/ZAPD/ExporterTest/ExporterTest.vcxproj.filters b/tools/ZAPD/ExporterTest/ExporterTest.vcxproj.filters deleted file mode 100644 index 166f563a17..0000000000 --- a/tools/ZAPD/ExporterTest/ExporterTest.vcxproj.filters +++ /dev/null @@ -1,42 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/tools/ZAPD/ExporterTest/Main.cpp b/tools/ZAPD/ExporterTest/Main.cpp deleted file mode 100644 index 07fdbeeced..0000000000 --- a/tools/ZAPD/ExporterTest/Main.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#include "CollisionExporter.h" -#include "Globals.h" -#include "RoomExporter.h" -#include "TextureExporter.h" - -enum class ExporterFileMode -{ - ModeExample1 = (int)ZFileMode::Custom + 1, - ModeExample2 = (int)ZFileMode::Custom + 2, - ModeExample3 = (int)ZFileMode::Custom + 3, -}; - -static void ExporterParseFileMode(const std::string& buildMode, ZFileMode& fileMode) -{ - if (buildMode == "me1") - fileMode = (ZFileMode)ExporterFileMode::ModeExample1; - else if (buildMode == "me2") - fileMode = (ZFileMode)ExporterFileMode::ModeExample2; - else if (buildMode == "me3") - fileMode = (ZFileMode)ExporterFileMode::ModeExample3; -} - -static void ExporterParseArgs([[maybe_unused]] int argc, char* argv[], int& i) -{ - std::string arg = argv[i]; - - if (arg == "--do-x") - { - } - else if (arg == "--do-y") - { - } -} - -static bool ExporterProcessFileMode(ZFileMode fileMode) -{ - // Do whatever work is associated with these custom file modes... - // Return true to indicate one of our own file modes is being processed - if (fileMode == (ZFileMode)ExporterFileMode::ModeExample1) - return true; - else if (fileMode == (ZFileMode)ExporterFileMode::ModeExample2) - return true; - else if (fileMode == (ZFileMode)ExporterFileMode::ModeExample3) - return true; - - return false; -} - -static void ExporterFileBegin(ZFile* file) -{ - printf("ExporterFileBegin() called on ZFile %s.\n", file->GetName().c_str()); -} - -static void ExporterFileEnd(ZFile* file) -{ - printf("ExporterFileEnd() called on ZFile %s.\n", file->GetName().c_str()); -} - -static void ImportExporters() -{ - // In this example we set up a new exporter called "EXAMPLE". - // By running ZAPD with the argument -se EXAMPLE, we tell it that we want to use this exporter - // for our resources. - ExporterSet* exporterSet = new ExporterSet(); - exporterSet->processFileModeFunc = ExporterProcessFileMode; - exporterSet->parseFileModeFunc = ExporterParseFileMode; - exporterSet->parseArgsFunc = ExporterParseArgs; - exporterSet->beginFileFunc = ExporterFileBegin; - exporterSet->endFileFunc = ExporterFileEnd; - exporterSet->exporters[ZResourceType::Texture] = new ExporterExample_Texture(); - exporterSet->exporters[ZResourceType::Room] = new ExporterExample_Room(); - exporterSet->exporters[ZResourceType::CollisionHeader] = new ExporterExample_Collision(); - - Globals::AddExporter("EXAMPLE", exporterSet); -} - -// When ZAPD starts up, it will automatically call the below function, which in turn sets up our -// exporters. -REGISTER_EXPORTER(ImportExporters); diff --git a/tools/ZAPD/ExporterTest/Makefile b/tools/ZAPD/ExporterTest/Makefile deleted file mode 100644 index 98e0475254..0000000000 --- a/tools/ZAPD/ExporterTest/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -# Only used for standalone compilation, usually inherits these from the main makefile -CXXFLAGS ?= -Wall -Wextra -O2 -g -std=c++17 - -SRC_DIRS := $(shell find . -type d -not -path "*build*") -CPP_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.cpp)) -H_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.h)) - -O_FILES := $(foreach f,$(CPP_FILES:.cpp=.o),build/$f) -LIB := ExporterTest.a - -# create build directories -$(shell mkdir -p $(foreach dir,$(SRC_DIRS),build/$(dir))) - -all: $(LIB) - -clean: - rm -rf build $(LIB) - -format: - clang-format-14 -i $(CPP_FILES) $(H_FILES) - -.PHONY: all clean format - -build/%.o: %.cpp - $(CXX) $(CXXFLAGS) $(OPTFLAGS) -I ./ -I ../ZAPD -I ../ZAPDUtils -I ../lib/tinyxml2 -c $(OUTPUT_OPTION) $< - -$(LIB): $(O_FILES) - $(AR) rcs $@ $^ diff --git a/tools/ZAPD/ExporterTest/RoomExporter.cpp b/tools/ZAPD/ExporterTest/RoomExporter.cpp deleted file mode 100644 index 4cc06b76f5..0000000000 --- a/tools/ZAPD/ExporterTest/RoomExporter.cpp +++ /dev/null @@ -1,372 +0,0 @@ -#include "RoomExporter.h" -#include "CollisionExporter.h" -#include "Utils/BinaryWriter.h" -#include "Utils/File.h" -#include "Utils/MemoryStream.h" -#include "ZRoom/Commands/SetCameraSettings.h" -#include "ZRoom/Commands/SetCollisionHeader.h" -#include "ZRoom/Commands/SetCsCamera.h" -#include "ZRoom/Commands/SetEchoSettings.h" -#include "ZRoom/Commands/SetEntranceList.h" -#include "ZRoom/Commands/SetLightingSettings.h" -#include "ZRoom/Commands/SetMesh.h" -#include "ZRoom/Commands/SetRoomBehavior.h" -#include "ZRoom/Commands/SetRoomList.h" -#include "ZRoom/Commands/SetSkyboxModifier.h" -#include "ZRoom/Commands/SetSkyboxSettings.h" -#include "ZRoom/Commands/SetSoundSettings.h" -#include "ZRoom/Commands/SetSpecialObjects.h" -#include "ZRoom/Commands/SetStartPositionList.h" -#include "ZRoom/Commands/SetTimeSettings.h" -#include "ZRoom/Commands/SetWind.h" - -void ExporterExample_Room::Save(ZResource* res, fs::path outPath, BinaryWriter* writer) -{ - ZRoom* room = dynamic_cast(res); - - // MemoryStream* memStream = new MemoryStream(); - // BinaryWriter* writer = new BinaryWriter(memStream); - - for (size_t i = 0; i < room->commands.size() * 8; i++) - writer->Write((uint8_t)0); - - for (size_t i = 0; i < room->commands.size(); i++) - { - ZRoomCommand* cmd = room->commands[i]; - - writer->Seek(i * 8, SeekOffsetType::Start); - - writer->Write((uint8_t)cmd->cmdID); - - switch (cmd->cmdID) - { - case RoomCommand::SetWind: - { - SetWind* cmdSetWind = (SetWind*)cmd; - - writer->Write((uint8_t)0); // 0x01 - writer->Write((uint8_t)0); // 0x02 - writer->Write((uint8_t)0); // 0x03 - - writer->Write(cmdSetWind->windWest); // 0x04 - writer->Write(cmdSetWind->windVertical); // 0x05 - writer->Write(cmdSetWind->windSouth); // 0x06 - writer->Write(cmdSetWind->clothFlappingStrength); // 0x07 - } - break; - case RoomCommand::SetTimeSettings: - { - SetTimeSettings* cmdTime = (SetTimeSettings*)cmd; - - writer->Write((uint8_t)0); // 0x01 - writer->Write((uint8_t)0); // 0x02 - writer->Write((uint8_t)0); // 0x03 - - writer->Write(cmdTime->hour); // 0x04 - writer->Write(cmdTime->min); // 0x05 - writer->Write(cmdTime->unk); // 0x06 - writer->Write((uint8_t)0); // 0x07 - } - break; - case RoomCommand::SetSkyboxModifier: - { - SetSkyboxModifier* cmdSkybox = (SetSkyboxModifier*)cmd; - - writer->Write((uint8_t)0); // 0x01 - writer->Write((uint8_t)0); // 0x02 - writer->Write((uint8_t)0); // 0x03 - - writer->Write(cmdSkybox->disableSky); // 0x04 - writer->Write(cmdSkybox->disableSunMoon); // 0x05 - writer->Write((uint8_t)0); // 0x06 - writer->Write((uint8_t)0); // 0x07 - } - break; - case RoomCommand::SetEchoSettings: - { - SetEchoSettings* cmdEcho = (SetEchoSettings*)cmd; - - writer->Write((uint8_t)0); // 0x01 - writer->Write((uint8_t)0); // 0x02 - writer->Write((uint8_t)0); // 0x03 - writer->Write((uint8_t)0); // 0x04 - writer->Write((uint8_t)0); // 0x05 - writer->Write((uint8_t)0); // 0x06 - writer->Write((uint8_t)cmdEcho->echo); // 0x07 - } - break; - case RoomCommand::SetSoundSettings: - { - SetSoundSettings* cmdSound = (SetSoundSettings*)cmd; - - writer->Write((uint8_t)cmdSound->reverb); // 0x01 - writer->Write((uint8_t)0); // 0x02 - writer->Write((uint8_t)0); // 0x03 - writer->Write((uint8_t)0); // 0x04 - writer->Write((uint8_t)0); // 0x05 - - writer->Write(cmdSound->nightTimeSFX); // 0x06 - writer->Write(cmdSound->musicSequence); // 0x07 - } - break; - case RoomCommand::SetSkyboxSettings: - { - SetSkyboxSettings* cmdSkybox = (SetSkyboxSettings*)cmd; - - writer->Write((uint8_t)cmdSkybox->unk1); // 0x01 - writer->Write((uint8_t)0); // 0x02 - writer->Write((uint8_t)0); // 0x03 - writer->Write((uint8_t)cmdSkybox->skyboxNumber); // 0x04 - writer->Write((uint8_t)cmdSkybox->cloudsType); // 0x05 - writer->Write((uint8_t)cmdSkybox->isIndoors); // 0x06 - } - break; - case RoomCommand::SetRoomBehavior: - { - SetRoomBehavior* cmdRoom = (SetRoomBehavior*)cmd; - - writer->Write((uint8_t)cmdRoom->gameplayFlags); // 0x01 - writer->Write((uint8_t)0); // 0x02 - writer->Write((uint8_t)0); // 0x03 - writer->Write(cmdRoom->gameplayFlags2); // 0x04 - } - break; - case RoomCommand::SetCsCamera: - { - SetCsCamera* cmdCsCam = (SetCsCamera*)cmd; - - writer->Write((uint8_t)cmdCsCam->cameras.size()); // 0x01 - writer->Write((uint8_t)0); // 0x02 - writer->Write((uint8_t)0); // 0x03 - - writer->Write(cmdCsCam->segmentOffset); // 0x04 - } - break; - case RoomCommand::SetMesh: - { - SetMesh* cmdMesh = (SetMesh*)cmd; - - int baseStreamEnd = writer->GetStream().get()->GetLength(); - - writer->Write((uint8_t)cmdMesh->data); // 0x01 - writer->Write((uint8_t)0); // 0x02 - writer->Write((uint8_t)0); // 0x03 - - writer->Write(baseStreamEnd); // 0x04 - - uint32_t oldOffset = writer->GetBaseAddress(); - writer->Seek(baseStreamEnd, SeekOffsetType::Start); - - // TODO: NOT DONE - - writer->Write(cmdMesh->meshHeaderType); - - if (cmdMesh->meshHeaderType == 0) - { - // writer->Write(cmdMesh->) - } - else if (cmdMesh->meshHeaderType == 1) - { - } - else if (cmdMesh->meshHeaderType == 2) - { - } - - writer->Seek(oldOffset, SeekOffsetType::Start); - } - break; - case RoomCommand::SetCameraSettings: - { - SetCameraSettings* cmdCam = (SetCameraSettings*)cmd; - - writer->Write((uint8_t)cmdCam->cameraMovement); // 0x01 - writer->Write((uint8_t)0); // 0x02 - writer->Write((uint8_t)0); // 0x03 - writer->Write(cmdCam->mapHighlight); // 0x04 - } - break; - case RoomCommand::SetLightingSettings: - { - SetLightingSettings* cmdLight = (SetLightingSettings*)cmd; - - writer->Write((uint8_t)cmdLight->settings.size()); // 0x01 - writer->Write((uint8_t)0); // 0x02 - writer->Write((uint8_t)0); // 0x03 - writer->Write(cmdLight->segmentOffset); // 0x04 - - uint32_t oldOffset = writer->GetBaseAddress(); - writer->Seek(cmdLight->segmentOffset, SeekOffsetType::Start); - - for (LightingSettings setting : cmdLight->settings) - { - writer->Write(setting.ambientClrR); - writer->Write(setting.ambientClrG); - writer->Write(setting.ambientClrB); - - writer->Write(setting.diffuseClrA_R); - writer->Write(setting.diffuseClrA_G); - writer->Write(setting.diffuseClrA_B); - - writer->Write(setting.diffuseDirA_X); - writer->Write(setting.diffuseDirA_Y); - writer->Write(setting.diffuseDirA_Z); - - writer->Write(setting.diffuseClrB_R); - writer->Write(setting.diffuseClrB_G); - writer->Write(setting.diffuseClrB_B); - - writer->Write(setting.diffuseDirB_X); - writer->Write(setting.diffuseDirB_Y); - writer->Write(setting.diffuseDirB_Z); - - writer->Write(setting.fogClrR); - writer->Write(setting.fogClrG); - writer->Write(setting.fogClrB); - - writer->Write(setting.unk); - writer->Write(setting.drawDistance); - } - - writer->Seek(oldOffset, SeekOffsetType::Start); - } - break; - case RoomCommand::SetRoomList: - { - SetRoomList* cmdRoom = (SetRoomList*)cmd; - - writer->Write((uint8_t)cmdRoom->romfile->rooms.size()); // 0x01 - writer->Write((uint8_t)0); // 0x02 - writer->Write((uint8_t)0); // 0x03 - - auto baseStreamEnd = writer->GetLength(); - writer->Write(baseStreamEnd); // 0x04 - - uint32_t oldOffset = writer->GetBaseAddress(); - writer->Seek(baseStreamEnd, SeekOffsetType::Start); - - for (const auto& entry : cmdRoom->romfile->rooms) - { - writer->Write(entry.virtualAddressStart); - writer->Write(entry.virtualAddressEnd); - } - - writer->Seek(oldOffset, SeekOffsetType::Start); - } - break; - case RoomCommand::SetCollisionHeader: - { - SetCollisionHeader* cmdCollHeader = (SetCollisionHeader*)cmd; - - int streamEnd = writer->GetStream().get()->GetLength(); - - writer->Write((uint8_t)0); // 0x01 - writer->Write((uint8_t)0); // 0x02 - writer->Write((uint8_t)0); // 0x03 - writer->Write(streamEnd); // 0x04 - - // TODO: NOT DONE - - uint32_t oldOffset = writer->GetBaseAddress(); - writer->Seek(streamEnd, SeekOffsetType::Start); - - ExporterExample_Collision colExp = ExporterExample_Collision(); - - colExp.Save(cmdCollHeader->collisionHeader, outPath, writer); - - writer->Seek(oldOffset, SeekOffsetType::Start); - } - break; - case RoomCommand::SetEntranceList: - { - SetEntranceList* cmdEntrance = (SetEntranceList*)cmd; - - uint32_t baseStreamEnd = writer->GetStream().get()->GetLength(); - - writer->Write((uint8_t)0); // 0x01 - writer->Write((uint8_t)0); // 0x02 - writer->Write((uint8_t)0); // 0x03 - writer->Write(baseStreamEnd); // 0x04 - - uint32_t oldOffset = writer->GetBaseAddress(); - writer->Seek(baseStreamEnd, SeekOffsetType::Start); - - for (Spawn entry : cmdEntrance->entrances) - { - writer->Write((uint8_t)entry.startPositionIndex); - writer->Write((uint8_t)entry.roomToLoad); - } - - writer->Seek(oldOffset, SeekOffsetType::Start); - } - break; - case RoomCommand::SetSpecialObjects: - { - SetSpecialObjects* cmdSpecObj = (SetSpecialObjects*)cmd; - - writer->Write((uint8_t)cmdSpecObj->elfMessage); // 0x01 - writer->Write((uint8_t)0); // 0x02 - writer->Write((uint8_t)0); // 0x03 - writer->Write((uint8_t)0); // 0x04 - writer->Write((uint8_t)0); // 0x05 - writer->Write((uint16_t)cmdSpecObj->globalObject); // 0x06 - } - break; - case RoomCommand::SetStartPositionList: - { - SetStartPositionList* cmdStartPos = (SetStartPositionList*)cmd; - - uint32_t baseStreamEnd = writer->GetStream().get()->GetLength(); - - writer->Write((uint8_t)cmdStartPos->actors.size()); // 0x01 - writer->Write((uint8_t)0); // 0x02 - writer->Write((uint8_t)0); // 0x03 - writer->Write(baseStreamEnd); // 0x04 - - uint32_t oldOffset = writer->GetBaseAddress(); - writer->Seek(baseStreamEnd, SeekOffsetType::Start); - - for (ActorSpawnEntry entry : cmdStartPos->actors) - { - writer->Write(entry.actorNum); - writer->Write(entry.posX); - writer->Write(entry.posY); - writer->Write(entry.posZ); - writer->Write(entry.rotX); - writer->Write(entry.rotY); - writer->Write(entry.rotZ); - writer->Write(entry.params); - } - - writer->Seek(oldOffset, SeekOffsetType::Start); - } - break; - case RoomCommand::EndMarker: - { - writer->Write((uint8_t)0); // 0x01 - writer->Write((uint8_t)0); // 0x02 - writer->Write((uint8_t)0); // 0x03 - writer->Write((uint8_t)0); // 0x04 - writer->Write((uint8_t)0); // 0x05 - writer->Write((uint8_t)0); // 0x06 - writer->Write((uint8_t)0); // 0x07 - } - break; - default: - printf("UNIMPLEMENTED COMMAND: %i\n", (int)cmd->cmdID); - - writer->Write((uint8_t)0); // 0x01 - writer->Write((uint8_t)0); // 0x02 - writer->Write((uint8_t)0); // 0x03 - writer->Write((uint8_t)0); // 0x04 - writer->Write((uint8_t)0); // 0x05 - writer->Write((uint8_t)0); // 0x06 - writer->Write((uint8_t)0); // 0x07 - - break; - } - } - - // writer->Close(); - // File::WriteAllBytes(StringHelper::Sprintf("%s", res->GetName().c_str()), - // memStream->ToVector()); -} diff --git a/tools/ZAPD/ExporterTest/RoomExporter.h b/tools/ZAPD/ExporterTest/RoomExporter.h deleted file mode 100644 index ee531dc87b..0000000000 --- a/tools/ZAPD/ExporterTest/RoomExporter.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -#include "ZResource.h" -#include "ZRoom/ZRoom.h" - -class ExporterExample_Room : public ZResourceExporter -{ -public: - void Save(ZResource* res, fs::path outPath, BinaryWriter* writer) override; -}; \ No newline at end of file diff --git a/tools/ZAPD/ExporterTest/TextureExporter.cpp b/tools/ZAPD/ExporterTest/TextureExporter.cpp deleted file mode 100644 index 6488bed3a2..0000000000 --- a/tools/ZAPD/ExporterTest/TextureExporter.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "TextureExporter.h" -#include "../ZAPD/ZFile.h" - -void ExporterExample_Texture::Save(ZResource* res, [[maybe_unused]] fs::path outPath, - BinaryWriter* writer) -{ - ZTexture* tex = (ZTexture*)res; - - auto data = tex->parent->GetRawData(); - - for (offset_t i = tex->GetRawDataIndex(); i < tex->GetRawDataIndex() + tex->GetRawDataSize(); - i++) - writer->Write(data[i]); -} diff --git a/tools/ZAPD/ExporterTest/TextureExporter.h b/tools/ZAPD/ExporterTest/TextureExporter.h deleted file mode 100644 index 41c4e79be2..0000000000 --- a/tools/ZAPD/ExporterTest/TextureExporter.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once - -#include "Utils/BinaryWriter.h" -#include "ZResource.h" -#include "ZTexture.h" - -class ExporterExample_Texture : public ZResourceExporter -{ -public: - void Save(ZResource* res, fs::path outPath, BinaryWriter* writer) override; -}; \ No newline at end of file diff --git a/tools/ZAPD/Jenkinsfile b/tools/ZAPD/Jenkinsfile deleted file mode 100644 index 48535a51cf..0000000000 --- a/tools/ZAPD/Jenkinsfile +++ /dev/null @@ -1,106 +0,0 @@ -pipeline { - agent { - label 'ZAPD' - } - - stages { - // Non-parallel ZAPD stage - stage('Build ZAPD') { - steps { - sh 'make -j WERROR=1' - } - } - - // CHECKOUT THE REPOS - stage('Checkout Repos') { - parallel { - stage('Checkout oot') { - steps { - dir('oot') { - git url: 'https://github.com/zeldaret/oot.git' - } - } - } - - stage('Checkout mm') { - steps{ - dir('mm') { - git url: 'https://github.com/zeldaret/mm.git' - } - } - } - } - } - - // SETUP THE REPOS - stage('Set up repos') { - parallel { - stage('Setup OOT') { - steps { - dir('oot') { - sh 'cp /usr/local/etc/roms/baserom_oot.z64 baserom_original.z64' - - // Identical to `make setup` except for copying our newer ZAPD.out into oot - sh 'git submodule update --init --recursive' - sh 'make -C tools' - sh 'cp ../ZAPD.out tools/ZAPD/' - sh 'python3 fixbaserom.py' - sh 'python3 extract_baserom.py' - sh 'python3 extract_assets.py' - } - } - } - - stage('Setup MM') { - steps { - dir('mm') { - sh 'cp /usr/local/etc/roms/mm.us.rev1.z64 baserom.mm.us.rev1.z64' - - // Identical to `make setup` except for copying our newer ZAPD.out into mm - sh 'make -C tools' - sh 'cp ../ZAPD.out tools/ZAPD/' - sh 'python3 tools/fixbaserom.py' - sh 'python3 tools/extract_baserom.py' - sh 'python3 extract_assets.py -j $(nproc)' - } - } - } - } - } - - // INSTALL PYTHON DEPENDENCIES, currently MM only - stage('Install Python dependencies') { - steps { - dir('mm') { - sh 'python3 -m pip install -r requirements.txt' - } - } - } - - // BUILD THE REPOS - stage('Build repos') { - parallel { - stage('Build oot') { - steps { - dir('oot') { - sh 'make -j' - } - } - } - stage('Build mm') { - steps { - dir('mm') { - sh 'make -j disasm' - sh 'make -j' - } - } - } - } - } - } - post { - always { - cleanWs() - } - } -} diff --git a/tools/ZAPD/LICENSE b/tools/ZAPD/LICENSE deleted file mode 100644 index 90b734bde8..0000000000 --- a/tools/ZAPD/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2020 Zelda Reverse Engineering Team - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/tools/ZAPD/Makefile b/tools/ZAPD/Makefile deleted file mode 100644 index 36331937a7..0000000000 --- a/tools/ZAPD/Makefile +++ /dev/null @@ -1,151 +0,0 @@ -# use variables in submakes -export -OPTIMIZATION_ON ?= 1 -ASAN ?= 0 -DEPRECATION_ON ?= 1 -DEBUG ?= 0 -COPYCHECK_ARGS ?= -LLD ?= 0 -WERROR ?= 0 - -# On MacOS 10.14, use boost::filesystem, because -# the system doesn't supply std::filesystem. -ifneq ($(OS),Windows_NT) - ifeq ($(shell uname -s),Darwin) - MACOS_VERSION := $(shell sw_vers -productVersion | cut -d . -f 1,2) - ifeq ($(MACOS_VERSION),10.14) - USE_BOOST_FS ?= 1 - endif - endif -endif -USE_BOOST_FS ?= 0 - -# Use clang++ if available, else use g++ -ifeq ($(shell command -v clang++ >/dev/null 2>&1; echo $$?),0) - CXX := clang++ -else - CXX := g++ -endif - -INC := -I ZAPD -I lib/libgfxd -I lib/tinyxml2 -I ZAPDUtils -CXXFLAGS := -fpic -std=c++17 -Wall -Wextra -fno-omit-frame-pointer -OPTFLAGS := - -ifneq ($(DEBUG),0) - OPTIMIZATION_ON = 0 - CXXFLAGS += -g3 -DDEVELOPMENT -D_DEBUG - COPYCHECK_ARGS += --devel - DEPRECATION_ON = 0 -endif - -ifneq ($(WERROR),0) - CXXFLAGS += -Werror -endif - -ifeq ($(OPTIMIZATION_ON),0) - OPTFLAGS := -O0 -else - OPTFLAGS := -O2 -endif - -ifneq ($(ASAN),0) - CXXFLAGS += -fsanitize=address -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=undefined -endif -ifneq ($(DEPRECATION_ON),0) - CXXFLAGS += -DDEPRECATION_ON -endif -# CXXFLAGS += -DTEXTURE_DEBUG - -LDFLAGS := -lm -ldl -lpng - -ifneq ($(USE_BOOST_FS),0) - CXXFLAGS += -DUSE_BOOST_FS - LDFLAGS += -lboost_filesystem -endif - -# Use LLD if available. Set LLD=0 to not use it -ifeq ($(shell command -v ld.lld >/dev/null 2>&1; echo $$?),0) - LLD := 1 -endif - -ifneq ($(LLD),0) - LDFLAGS += -fuse-ld=lld -endif - -UNAME := $(shell uname) -UNAMEM := $(shell uname -m) -ifneq ($(UNAME), Darwin) - LDFLAGS += -Wl,-export-dynamic -lstdc++fs - EXPORTERS := -Wl,--whole-archive ExporterTest/ExporterTest.a -Wl,--no-whole-archive -else - EXPORTERS := -Wl,-force_load ExporterTest/ExporterTest.a - ifeq ($(UNAMEM),arm64) - ifeq ($(shell brew list libpng > /dev/null 2>&1; echo $$?),0) - LDFLAGS += -L $(shell brew --prefix)/lib - INC += -I $(shell brew --prefix)/include - else - $(error Please install libpng via Homebrew) - endif - endif -endif - - -ZAPD_SRC_DIRS := $(shell find ZAPD -type d) -SRC_DIRS = $(ZAPD_SRC_DIRS) lib/tinyxml2 - -ZAPD_CPP_FILES := $(foreach dir,$(ZAPD_SRC_DIRS),$(wildcard $(dir)/*.cpp)) -ZAPD_H_FILES := $(foreach dir,$(ZAPD_SRC_DIRS),$(wildcard $(dir)/*.h)) - -CPP_FILES += $(ZAPD_CPP_FILES) lib/tinyxml2/tinyxml2.cpp -O_FILES := $(foreach f,$(CPP_FILES:.cpp=.o),build/$f) -O_FILES += build/ZAPD/BuildInfo.o - -# create build directories -$(shell mkdir -p $(foreach dir,$(SRC_DIRS),build/$(dir))) - - -# Main targets -all: ZAPD.out copycheck - -build/ZAPD/BuildInfo.o: - python3 ZAPD/genbuildinfo.py $(COPYCHECK_ARGS) - $(CXX) $(CXXFLAGS) $(OPTFLAGS) $(INC) -c $(OUTPUT_OPTION) build/ZAPD/BuildInfo.cpp - -copycheck: ZAPD.out - python3 copycheck.py - -clean: - rm -rf build ZAPD.out - $(MAKE) -C lib/libgfxd clean - $(MAKE) -C ZAPDUtils clean - $(MAKE) -C ExporterTest clean - -rebuild: clean all - -format: - clang-format-14 -i $(ZAPD_CPP_FILES) $(ZAPD_H_FILES) - $(MAKE) -C ZAPDUtils format - $(MAKE) -C ExporterTest format - -.PHONY: all build/ZAPD/BuildInfo.o copycheck clean rebuild format - -build/%.o: %.cpp - $(CXX) $(CXXFLAGS) $(OPTFLAGS) $(INC) -c $(OUTPUT_OPTION) $< - - -# Submakes -lib/libgfxd/libgfxd.a: - $(MAKE) -C lib/libgfxd - -.PHONY: ExporterTest -ExporterTest: - $(MAKE) -C ExporterTest - -.PHONY: ZAPDUtils -ZAPDUtils: - $(MAKE) -C ZAPDUtils - - -# Linking -ZAPD.out: $(O_FILES) lib/libgfxd/libgfxd.a ExporterTest ZAPDUtils - $(CXX) $(CXXFLAGS) $(O_FILES) lib/libgfxd/libgfxd.a ZAPDUtils/ZAPDUtils.a $(EXPORTERS) $(LDFLAGS) $(OUTPUT_OPTION) diff --git a/tools/ZAPD/README.md b/tools/ZAPD/README.md deleted file mode 100644 index 5006f8d4b5..0000000000 --- a/tools/ZAPD/README.md +++ /dev/null @@ -1,174 +0,0 @@ -# ZAPD: Zelda Asset Processor for Decomp - -## Compiling - -### Dependencies - -ZAPD needs a compiler with C++17 support. - -ZAPD has the following library dependencies: - -- `libpng` - -In a Debian/Ubuntu based environment, those could be installed with the following command: - -```bash -sudo apt install libpng-dev -``` - -On a Mac, you will need to install libpng with Homebrew or MacPorts; we currently only support Homebrew. You can run - -```bash -brew install libpng -``` - -to install it via Homebrew. - -### Building - -#### Linux / *nix - -ZAPD uses the classic `Makefile` approach. To build just run `make` (or even better `make -j` for faster compilations). - -You can configure a bit your ZAPD build with the following options: - -- `OPTIMIZATION_ON`: If set to `0` optimizations will be disabled (compile with `-O0`). Any other value compiles with `-O2`. Defaults to `1`. -- `ASAN`: If it is set to a non-zero then ZAPD will be compiled with Address Sanitizer enabled (`-fsanitize=address`). Defaults to `0`. -- `DEPRECATION_ON`: If it is set to a zero then deprecation warnings will be disabled. Defaults to `1`. -- `DEBUG`: If non-zero, ZAPD will be compiled in _development mode_. This implies the following: - - Debugging symbols enabled (`-g3`). They are disabled by default. - - `OPTIMIZATION_ON=0`: Disables optimizations (`-O0`). - - `DEPRECATION_ON=0`: Disables deprecation warnings. -- `LLD=1`: builds with the LLVM linker `ld.lld` instead of the system default. - -As an example, if you want to build ZAPD with optimizations disabled and use the address sanitizer, you could use the following command: - -```bash -make -j OPTIMIZATION_ON=0 ASAN=1 -``` - -#### Windows - -This repository contains `vcxproj` files for compiling under Visual Studio environments. See `ZAPD/ZAPD.vcxproj`. - -## Invoking ZAPD - -ZAPD needs a _File parsing mode_ to be passed as first parameter. The options are: - -- `e`: "Extraction" mode. - - In this mode, ZAPD expects a XML file as input, a folder as ouput and a path to the baserom files. - - ZAPD will read the XML and use it as a guide to extract the contents of the specified asset file from the baserom folder. - - For more info of the format of those XMLs, see the [ZAPD extraction XML reference](docs/zapd_extraction_xml_reference.md). -- `bsf`: "Build source file" mode. - - This is an experimental mode. - - It was going to be used to let you have XMLs that aren't just for extraction. Might get used, might not. Still need to experiment on that. -- `btex`: "Build texture" mode. - - In this mode, ZAPD expects a PNG file as input, a filename as ouput and a texture type parameter (`-tt`). - - ZAPD will try to convert the given PNG into the contents of a `uint64_t` C array. -- `bren`: "Build (render) background" mode. - - In this mode, ZAPD expects a JPG file as input and a filename as ouput. - - ZAPD will try to convert the given JPG into the contents of a `uint64_t` C array. -- `blb`: "Build blob" mode. - - In this mode, ZAPD expects a BIN file as input and a filename as ouput. - - ZAPD will try to convert the given BIN into the contents of a `uint8_t` C array. - -ZAPD also accepts the following list of extra parameters: - -- `-i PATH` / `--inputpath PATH`: Set input path. -- `-o PATH` / `--outputpath PATH`: Set output path. -- `-b PATH` / `--baserompath`: Set baserom path. - - Can be used only in `e` or `bsf` modes. -- `-osf PATH`: Set source output path. This is the path where the `.c` and `.h` files will be extracted to. If omitted, it will use the value passed to `--outputpath` parameter. -- `-gsf MODE`: Generate source file during extraction. If `MODE` is `1`, C source files will be generated. - - Can be used only in `e` mode. -- `-crc` / `--output-crc`: Outputs a CRC file for each extracted texture. - - Can be used only in `e` or `bsf` modes. -- `-ulzdl MODE`: Use "Legacy ZDisplayList" instead of `libgfxd`. Set `MODE` to `1` to enable it. - - Can be used only in `e` or `bsf` modes. -- `-profile MODE`: Enable profiling. Set `MODE` to `1` to enable it. -- `-uer MODE`: Split resources into their individual components (enabled by default). Set `MODE` to non-`1` to disable it. -- `-tt TYPE`: Set texture type. - - Can be used only in mode `btex`. - - Valid values: - - `rgba32` - - `rgb5a1` - - `i4` - - `i8` - - `ia4` - - `ia8` - - `ia16` - - `ci4` - - `ci8` -- `-rconf PATH` Read Config File. -- `-eh`: Enable error handler. - - Only available in non-Windows environments. -- `-v MODE`: Enable verbosity. Currently there are 3 possible values: - - `0`: Default. Completely silent (except for warnings and errors). - - `1`: Information. - - `2` (and higher): Debug. -- `-wu` / `--warn-unaccounted`: Enable warnings for each unaccounted block of data found. - - Can be used only in `e` or `bsf` modes. -- `-vu` / `--verbose-unaccounted`: Changes how unaccounteds are outputted. Max 4 bytes per line (a word) and add a comment with the offset of each of those lines. - - Could be useful for looking at raw data or testing. - - Can be used only in `e` or `bsf` modes. -- `-tm MODE`: Test Mode (enables certain experimental features). To enable it, set `MODE` to `1`. -- `-se` / `--set-exporter` : Sets which exporter to use. -- `--gcc-compat` : Enables GCC compatibly mode. Slower. -- `-us` / `--unaccounted-static` : Mark unaccounted data as `static` -- `-s` / `--static` : Mark every asset as `static`. - - This behaviour can be overridden per asset using `Static=` in the respective XML node. -- `--cs-float` : How cutscene floats should be extracted. -- Valid values: - - `hex`: `0x42280000` - - `float`: `42.0f` - - `both`: `CS_FLOAT(0x42280000, 42.0f)` - - `hex-commented-left`: `/* 42.0f */ 0x42280000` - - `hex-commented-right`: `0x42280000 /* 42.0f */` -- `--base-address ADDRESS`: Override base virtual address for input files. -- `--start-offset OFFSET`: Override start offset for input files. -- `--end-offset OFFSET`: Override end offset for input files. -- `-W...`: warning flags, see below - -Additionally, you can pass the flag `--version` to see the current ZAPD version. If that flag is passed, ZAPD will ignore any other parameter passed. - -### Warning flags - -ZAPD contains a variety of warning types, with similar syntax to GCC or Clang's compiler warnings. Warnings can have three levels: - -- Off (does not display anything) -- Warn (print a warning but continue processing) -- Err (behave like an error, i.e. print and throw an exception to crash ZAPD when occurs) - -Each warning type uses one of these by default, but can be modified with flags, similarly to GCC or Clang: - -- `-Wfoo` enables warnings of type `foo` -- `-Wno-foo` disables warnings of type `foo` -- `-Werror=foo` escalates `foo` to behave like an error -- `-Weverything` enables all warnings (they may be turned off using `-Wno-` flags afterwards) -- `-Werror` escalates all enabled warnings to errors - -All warning types currently implemented, with their default levels: - -| Warning type | Default level | Description | -| ----------------------------- | ------------- | ------------------------------------------------------------------------ | -| `-Wdeprecated` | Warn | Deprecated features | -| `-Whardcoded-generic-pointer` | Off | A generic segmented pointer must be produced | -| `-Whardcoded-pointer` | Warn | ZAPD lacks the info to make a symbol, so must output a hardcoded pointer | -| `-Wintersection` | Warn | Two assets intersect | -| `-Winvalid-attribute-value` | Err | Attribute declared in XML is wrong | -| `-Winvalid-extracted-data` | Err | Extracted data does not have correct form | -| `-Winvalid-jpeg` | Err | JPEG file does not conform to the game's format requirements | -| `-Winvalid-png` | Err | Issues arising when processing PNG data | -| `-Winvalid-xml` | Err | XML has syntax errors | -| `-Wmissing-attribute` | Warn | Required attribute missing in XML tag | -| `-Wmissing-offsets` | Warn | Offset attribute missing in XML tag | -| `-Wmissing-segment` | Warn | Segment not given in File tag in XML | -| `-Wnot-implemented` | Warn | ZAPD does not currently support this feature | -| `-Wunaccounted` | Off | Large blocks of unaccounted | -| `-Wunknown-attribute` | Warn | Unknown attribute in XML entry tag | - -There are also errors that do not have a type, and cannot be disabled. - -For example, here we have invoked ZAPD in the usual way to extract using a (rather badly-written) XML, but escalating `-Wintersection` to an error: - -![ZAPD warnings example](docs/zapd_warning_example.png?raw=true) diff --git a/tools/ZAPD/ZAPD.sln b/tools/ZAPD/ZAPD.sln deleted file mode 100644 index 82538dd9f4..0000000000 --- a/tools/ZAPD/ZAPD.sln +++ /dev/null @@ -1,82 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30320.27 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZAPD", "ZAPD\ZAPD.vcxproj", "{B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ExporterExample", "ExporterTest\ExporterTest.vcxproj", "{65608EB0-1A47-45AD-AB66-192FB64C762C}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZAPDUtils", "ZAPDUtils\ZAPDUtils.vcxproj", "{A2E01C3E-D647-45D1-9788-043DEBC1A908}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - MinSizeRel|x64 = MinSizeRel|x64 - MinSizeRel|x86 = MinSizeRel|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - RelWithDebInfo|x64 = RelWithDebInfo|x64 - RelWithDebInfo|x86 = RelWithDebInfo|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Debug|x64.ActiveCfg = Debug|x64 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Debug|x64.Build.0 = Debug|x64 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Debug|x86.ActiveCfg = Debug|Win32 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Debug|x86.Build.0 = Debug|Win32 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.MinSizeRel|x64.ActiveCfg = Release|x64 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.MinSizeRel|x64.Build.0 = Release|x64 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.MinSizeRel|x86.ActiveCfg = Release|Win32 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.MinSizeRel|x86.Build.0 = Release|Win32 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Release|x64.ActiveCfg = Release|x64 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Release|x64.Build.0 = Release|x64 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Release|x86.ActiveCfg = Release|Win32 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.Release|x86.Build.0 = Release|Win32 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.RelWithDebInfo|x64.ActiveCfg = Release|x64 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.RelWithDebInfo|x64.Build.0 = Release|x64 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.RelWithDebInfo|x86.ActiveCfg = Release|Win32 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36}.RelWithDebInfo|x86.Build.0 = Release|Win32 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.Debug|x64.ActiveCfg = Debug|x64 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.Debug|x64.Build.0 = Debug|x64 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.Debug|x86.ActiveCfg = Debug|Win32 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.Debug|x86.Build.0 = Debug|Win32 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.MinSizeRel|x64.ActiveCfg = Debug|x64 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.MinSizeRel|x64.Build.0 = Debug|x64 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.MinSizeRel|x86.ActiveCfg = Debug|Win32 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.MinSizeRel|x86.Build.0 = Debug|Win32 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.Release|x64.ActiveCfg = Release|x64 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.Release|x64.Build.0 = Release|x64 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.Release|x86.ActiveCfg = Release|Win32 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.Release|x86.Build.0 = Release|Win32 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.RelWithDebInfo|x64.ActiveCfg = Release|x64 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.RelWithDebInfo|x64.Build.0 = Release|x64 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.RelWithDebInfo|x86.ActiveCfg = Release|Win32 - {65608EB0-1A47-45AD-AB66-192FB64C762C}.RelWithDebInfo|x86.Build.0 = Release|Win32 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x64.ActiveCfg = Debug|x64 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x64.Build.0 = Debug|x64 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x86.ActiveCfg = Debug|Win32 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Debug|x86.Build.0 = Debug|Win32 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.MinSizeRel|x64.ActiveCfg = Debug|x64 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.MinSizeRel|x64.Build.0 = Debug|x64 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.MinSizeRel|x86.ActiveCfg = Debug|Win32 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.MinSizeRel|x86.Build.0 = Debug|Win32 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x64.ActiveCfg = Release|x64 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x64.Build.0 = Release|x64 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x86.ActiveCfg = Release|Win32 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.Release|x86.Build.0 = Release|Win32 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.RelWithDebInfo|x64.ActiveCfg = Release|x64 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.RelWithDebInfo|x64.Build.0 = Release|x64 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.RelWithDebInfo|x86.ActiveCfg = Release|Win32 - {A2E01C3E-D647-45D1-9788-043DEBC1A908}.RelWithDebInfo|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {C2E1CC72-7A50-3249-AFD5-DFF6FE25CDCA} - EndGlobalSection - GlobalSection(Performance) = preSolution - HasPerformanceSessions = true - EndGlobalSection -EndGlobal diff --git a/tools/ZAPD/ZAPD/CRC32.h b/tools/ZAPD/ZAPD/CRC32.h deleted file mode 100644 index 1f82c75c58..0000000000 --- a/tools/ZAPD/ZAPD/CRC32.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -static uint32_t CRC32B(const unsigned char* message, int32_t size) -{ - int32_t byte, crc; - int32_t mask; - - crc = 0xFFFFFFFF; - - for (int32_t i = 0; i < size; i++) - { - byte = message[i]; - crc = crc ^ byte; - - for (int32_t j = 7; j >= 0; j--) - { - mask = -(crc & 1); - crc = (crc >> 1) ^ (0xEDB88320 & mask); - } - } - - return ~(uint32_t)(crc); -} \ No newline at end of file diff --git a/tools/ZAPD/ZAPD/CrashHandler.cpp b/tools/ZAPD/ZAPD/CrashHandler.cpp deleted file mode 100644 index 7ddec5a7e8..0000000000 --- a/tools/ZAPD/ZAPD/CrashHandler.cpp +++ /dev/null @@ -1,206 +0,0 @@ -#include "CrashHandler.h" -#include "Utils/StringHelper.h" - -#if __has_include() -#define HAS_POSIX 1 -#else -#define HAS_POSIX 0 -#endif - -#include -#include -#include -#include -#include - -#if HAS_POSIX == 1 -#include -#include // for __cxa_demangle -#include // for dladdr -#include -#include -#elif defined(_MSC_VER) -#include -#include - -#include - -#pragma comment(lib, "Dbghelp.lib") -#endif - -// Feel free to add more crash messages. -static std::array crashEasterEgg = { - "\tYou've met with a terrible fate, haven't you?", - "\tSEA BEARS FOAM. SLEEP BEARS DREAMS. \n\tBOTH END IN THE SAME WAY: CRASSSH!", - "\tZAPD has fallen and cannot get up.", - "\tIT'S A SECRET TO EVERYBODY. \n\tBut it shouldn't be, you'd better ask about it!", - "\tI AM ERROR.", - "\tGRUMBLE,GRUMBLE...", - "\tDODONGO DISLIKES SMOKE \n\tAnd ZAPD dislikes whatever you fed it.", - "\tMay the way of the Hero lead \n\tto the debugger.", - "\tTHE WIND FISH SLUMBERS LONG... \n\tTHE HERO'S LIFE GONE... ", - "\tSEA BEARS FOAM, SLEEP BEARS DREAMS. \n\tBOTH END IN THE SAME WAY CRASSSH!", - "\tYou've met with a terrible fate, haven't you?", - "\tMaster, I calculate a 100% probability that ZAPD has crashed. \n\tAdditionally, the " - "batteries in your Wii Remote are nearly depleted.", - "\t CONGRATURATIONS! \n" - "\tAll Pages are displayed.\n" - "\t THANK YOU! \n" - "\t You are great debugger!", - "\tRCP is HUNG UP!!\n" - "\tOh! MY GOD!!", -}; - -#if HAS_POSIX == 1 -void ErrorHandler(int sig) -{ - std::array arr; - constexpr size_t nMaxFrames = arr.size(); - size_t size = backtrace(arr.data(), nMaxFrames); - char** symbols = backtrace_symbols(arr.data(), nMaxFrames); - - fprintf(stderr, "\nZAPD crashed. (Signal: %i)\n", sig); - - srand(time(nullptr)); - auto easterIndex = rand() % crashEasterEgg.size(); - - fprintf(stderr, "\n%s\n\n", crashEasterEgg[easterIndex]); - - fprintf(stderr, "Traceback:\n"); - for (size_t i = 1; i < size; i++) - { - Dl_info info; - uint32_t gotAddress = dladdr(arr[i], &info); - std::string functionName(symbols[i]); - - if (gotAddress != 0 && info.dli_sname != nullptr) - { - int32_t status; - char* demangled = abi::__cxa_demangle(info.dli_sname, nullptr, nullptr, &status); - const char* nameFound = info.dli_sname; - - if (status == 0) - { - nameFound = demangled; - } - - functionName = StringHelper::Sprintf("%s (+0x%X)", nameFound, - (char*)arr[i] - (char*)info.dli_saddr); - free(demangled); - } - - fprintf(stderr, "%-3zd %s\n", i, functionName.c_str()); - } - - fprintf(stderr, "\n"); - - free(symbols); - exit(1); -} -#elif defined(_MSC_VER) - -void printStack(CONTEXT* ctx) -{ - BOOL result; - HANDLE process; - HANDLE thread; - HMODULE hModule; - ULONG frame; - DWORD64 displacement; - DWORD disp; - - srand(time(nullptr)); - auto easterIndex = rand() % crashEasterEgg.size(); - - fprintf(stderr, "\n%s\n\n", crashEasterEgg[easterIndex]); - -#if defined(_M_AMD64) - STACKFRAME64 stack; - memset(&stack, 0, sizeof(STACKFRAME64)); -#else - STACKFRAME stack; - memset(&stack, 0, sizeof(STACKFRAME)); -#endif - - char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME + sizeof(TCHAR)]; - char module[512]; - - PSYMBOL_INFO symbol = (PSYMBOL_INFO)buffer; - - CONTEXT ctx2; - memcpy(&ctx2, ctx, sizeof(CONTEXT)); - - process = GetCurrentProcess(); - thread = GetCurrentThread(); - SymInitialize(process, nullptr, TRUE); - - constexpr DWORD machineType = -#if defined(_M_AMD64) - IMAGE_FILE_MACHINE_AMD64; -#else - IMAGE_FILE_MACHINE_I386; -#endif - - displacement = 0; - - for (frame = 0;; frame++) - { - result = StackWalk(machineType, process, thread, &stack, &ctx2, nullptr, - SymFunctionTableAccess, SymGetModuleBase, nullptr); - if (!result) - { - break; - } - symbol->SizeOfStruct = sizeof(SYMBOL_INFO); - symbol->MaxNameLen = MAX_SYM_NAME; - SymFromAddr(process, (ULONG64)stack.AddrPC.Offset, &displacement, symbol); -#if defined(_M_AMD64) - IMAGEHLP_LINE64 line; - line.SizeOfStruct = sizeof(IMAGEHLP_LINE64); -#else - IMAGEHLP_LINE line; - line.SizeOfStruct = sizeof(IMAGEHLP_LINE); -#endif - if (SymGetLineFromAddr(process, stack.AddrPC.Offset, &disp, &line)) - { - fprintf(stderr, "%u\t %s in %s: line: %lu: \n", frame, symbol->Name, line.FileName, - line.LineNumber); - } - - else - { - fprintf(stderr, "%u\tat % s\n", frame, symbol->Name); - hModule = nullptr; - GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | - GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, - (LPCTSTR)(stack.AddrPC.Offset), &hModule); - - if (hModule != nullptr) - { - GetModuleFileNameA(hModule, module, 512 - 1); - } - fprintf(stderr, "%u\tIn %s\n", frame, module); - } - } -} - -LONG seh_filter(_EXCEPTION_POINTERS* ex) -{ - fprintf(stderr, "EXCEPTION 0x%x occured\n", ex->ExceptionRecord->ExceptionCode); - printStack(ex->ContextRecord); - return EXCEPTION_EXECUTE_HANDLER; -} -#endif - -void CrashHandler_Init() -{ -#if HAS_POSIX == 1 - signal(SIGSEGV, ErrorHandler); - signal(SIGABRT, ErrorHandler); -#elif defined(_MSC_VER) - SetUnhandledExceptionFilter(seh_filter); -#else - HANDLE_WARNING(WarningType::Always, - "tried to set error handler, but this ZAPD build lacks support for one", ""); -#endif -} diff --git a/tools/ZAPD/ZAPD/CrashHandler.h b/tools/ZAPD/ZAPD/CrashHandler.h deleted file mode 100644 index 102778bec1..0000000000 --- a/tools/ZAPD/ZAPD/CrashHandler.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef CRASH_HANDLER_H -#define CRASH_HANDLER_H - -void CrashHandler_Init(); - -#endif diff --git a/tools/ZAPD/ZAPD/Declaration.cpp b/tools/ZAPD/ZAPD/Declaration.cpp deleted file mode 100644 index 30863803a2..0000000000 --- a/tools/ZAPD/ZAPD/Declaration.cpp +++ /dev/null @@ -1,236 +0,0 @@ -#include "Declaration.h" - -#include "Globals.h" -#include "Utils/StringHelper.h" - -Declaration::Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize, - const std::string& nBody) -{ - address = nAddress; - alignment = nAlignment; - size = nSize; - declBody = nBody; -} - -Declaration* Declaration::Create(offset_t declAddr, DeclarationAlignment declAlign, size_t declSize, - const std::string& declType, const std::string& declName, - const std::string& declBody) -{ - Declaration* decl = new Declaration(declAddr, declAlign, declSize, declBody); - - decl->declType = declType; - decl->declName = declName; - decl->declBody = declBody; - - return decl; -} - -Declaration* Declaration::CreateArray(offset_t declAddr, DeclarationAlignment declAlign, - size_t declSize, const std::string& declType, - const std::string& declName, const std::string& declBody, - size_t declArrayItemCnt, bool isDeclExternal) -{ - Declaration* decl = new Declaration(declAddr, declAlign, declSize, declBody); - - decl->declName = declName; - decl->declType = declType; - decl->arrayItemCnt = declArrayItemCnt; - decl->isExternal = isDeclExternal; - decl->isArray = true; - - return decl; -} - -Declaration* Declaration::CreateArray(offset_t declAddr, DeclarationAlignment declAlign, - size_t declSize, const std::string& declType, - const std::string& declName, const std::string& declBody, - const std::string& declArrayItemCntStr, bool isDeclExternal) -{ - Declaration* decl = new Declaration(declAddr, declAlign, declSize, declBody); - - decl->declName = declName; - decl->declType = declType; - decl->arrayItemCntStr = declArrayItemCntStr; - decl->isExternal = isDeclExternal; - decl->isArray = true; - - return decl; -} - -Declaration* Declaration::CreateInclude(offset_t declAddr, const std::string& includePath, - size_t declSize, const std::string& declType, - const std::string& declName, const std::string& defines) -{ - Declaration* decl = new Declaration(declAddr, DeclarationAlignment::Align4, declSize, ""); - decl->includePath = includePath; - decl->declType = declType; - decl->declName = declName; - decl->defines = defines; - - return decl; -} - -Declaration* Declaration::CreatePlaceholder(offset_t declAddr, const std::string& declName) -{ - Declaration* decl = new Declaration(declAddr, DeclarationAlignment::Align4, 0, ""); - decl->declName = declName; - decl->isPlaceholder = true; - - return decl; -} - -bool Declaration::IsStatic() const -{ - switch (staticConf) - { - case StaticConfig::Off: - return false; - - case StaticConfig::Global: - return Globals::Instance->forceStatic; - - case StaticConfig::On: - return true; - } - - return false; -} - -std::string Declaration::GetNormalDeclarationStr() const -{ - std::string output; - - if (IsStatic()) - { - output += "static "; - } - - if (isArray) - { - bool includeArraySize = (IsStatic() || forceArrayCnt); - - if (includeArraySize) - { - if (arrayItemCntStr != "") - output += StringHelper::Sprintf("%s %s[%s];\n", declType.c_str(), declName.c_str(), - arrayItemCntStr.c_str()); - else - output += StringHelper::Sprintf("%s %s[%i] = {\n", declType.c_str(), - declName.c_str(), arrayItemCnt); - } - else - { - output += StringHelper::Sprintf("%s %s[] = {\n", declType.c_str(), declName.c_str()); - } - - output += declBody + "\n"; - } - else - { - output += StringHelper::Sprintf("%s %s = { ", declType.c_str(), declName.c_str()); - output += declBody; - } - - if (output.back() == '\n') - output += "};"; - else - output += " };"; - - output += "\n"; - - output += "\n"; - - return output; -} - -std::string Declaration::GetExternalDeclarationStr() const -{ - std::string output; - - if (IsStatic()) - output += "static "; - - bool includeArraySize = (IsStatic() || forceArrayCnt); - - if (includeArraySize) - { - if (arrayItemCntStr != "") - output += StringHelper::Sprintf("%s %s[%s] = ", declType.c_str(), declName.c_str(), - arrayItemCntStr.c_str()); - else - output += StringHelper::Sprintf("%s %s[%i] = ", declType.c_str(), declName.c_str(), - arrayItemCnt); - } - else - { - output += StringHelper::Sprintf("%s %s[] = ", declType.c_str(), declName.c_str()); - } - - output += StringHelper::Sprintf("{\n#include \"%s\"\n};", includePath.c_str()); - output += "\n\n"; - - return output; -} - -std::string Declaration::GetExternStr() const -{ - if (IsStatic() || declType == "" || isUnaccounted) - { - return ""; - } - - if (isArray) - { - if (arrayItemCntStr != "" && (IsStatic() || forceArrayCnt)) - { - return StringHelper::Sprintf("extern %s %s[%s];\n", declType.c_str(), declName.c_str(), - arrayItemCntStr.c_str()); - } - else if (arrayItemCnt != 0 && (IsStatic() || forceArrayCnt)) - { - return StringHelper::Sprintf("extern %s %s[%i];\n", declType.c_str(), declName.c_str(), - arrayItemCnt); - } - else - return StringHelper::Sprintf("extern %s %s[];\n", declType.c_str(), declName.c_str()); - } - - return StringHelper::Sprintf("extern %s %s;\n", declType.c_str(), declName.c_str()); -} - -std::string Declaration::GetDefinesStr() const -{ - if (IsStatic() || (declType == "")) - { - return ""; - } - return StringHelper::Sprintf("%s", defines.c_str()); -} - -std::string Declaration::GetStaticForwardDeclarationStr() const -{ - if (!IsStatic() || isUnaccounted) - return ""; - - if (isArray) - { - if (arrayItemCntStr == "" && arrayItemCnt == 0) - { - // Forward declaring static arrays without specifying the size is not allowed. - return ""; - } - - if (arrayItemCntStr != "") - { - return StringHelper::Sprintf("static %s %s[%s];\n", declType.c_str(), declName.c_str(), - arrayItemCntStr.c_str()); - } - else - { - return StringHelper::Sprintf("static %s %s[%i];\n", declType.c_str(), declName.c_str(), - arrayItemCnt); - } - } - - return StringHelper::Sprintf("static %s %s;\n", declType.c_str(), declName.c_str()); -} diff --git a/tools/ZAPD/ZAPD/Declaration.h b/tools/ZAPD/ZAPD/Declaration.h deleted file mode 100644 index d079cb8dce..0000000000 --- a/tools/ZAPD/ZAPD/Declaration.h +++ /dev/null @@ -1,182 +0,0 @@ -#pragma once - -#include -#include -#include - -// TODO: should we drop the `_t` suffix because of UNIX compliance? -typedef uint32_t segptr_t; -typedef uint32_t offset_t; - -#define SEGMENTED_NULL ((segptr_t)0) - -enum class DeclarationAlignment -{ - Align4, - Align8 -}; - -enum class StaticConfig -{ - Off, - Global, - On -}; - -/// -/// A declaration is contains the C contents of a symbol for a file. -/// It contains at a minimum the address where the symbol would be in the binary file, alignment -/// settings, the size of the binary data, and the C code that makes it up. Optionally it can also -/// contain comments. -/// -class Declaration -{ -public: - // Where in the binary file (segment) will this C code end up being? - offset_t address = 0; - - // How is this C code aligned? - DeclarationAlignment alignment = DeclarationAlignment::Align4; - - // How many bytes will this C code take up in the resulting binary when compiled? - size_t size = 0; - - // The C type of this declaration - std::string declType = ""; - - // The C variable name of this declaration - std::string declName = ""; - - // The body of the declaration containing the data. - // In "int j = 7;", "7" would be text. - std::string declBody = ""; - - // #define's to be included in the header - std::string defines = ""; - - std::string includePath = ""; - - // Is this declaration in an external file? (ie. a gameplay_keep reference being found in - // another file that wishes to use its data) - bool isExternal = false; - - bool isArray = false; - - // If true, will ensure that the arrays size is included in the declaration - bool forceArrayCnt = false; - - // If this declaration is an array, how many items make it up? - size_t arrayItemCnt = 0; - - // Overrides the brackets for the arrays size with a custom string - std::string arrayItemCntStr = ""; - - std::vector references; - - // If true, this declaration represents data inside the file which we do not understand it's - // purpose for. It will be outputted as just a byte array. - bool isUnaccounted = false; - - // Is this declaration a placeholder that will be replaced later? - bool isPlaceholder = false; - - // Does this declaration come straight from the XML? - // If false, this means that the declaration was created by ZAPD when it was parsing the - // resources. - bool declaredInXml = false; - - StaticConfig staticConf = StaticConfig::Global; - - /// - /// Creates a regular declaration. - /// - /// The address inside a binary file this declaration will be in when - /// compiled. The alignment of this declaration in the compiled - /// binary file. The size of this declaration when it is compiled - /// to binary data. The C variable type this declaration will be - /// declared as. The C variable name this declaration will be - /// declared as. The contents of the C variable - /// declaration. - static Declaration* Create(offset_t declAddr, DeclarationAlignment declAlign, size_t declSize, - const std::string& declType, const std::string& declName, - const std::string& declBody); - - /// - /// Creates an array declaration. - /// - /// The address inside a binary file this declaration will be in when - /// compiled. The alignment of this declaration in the compiled - /// binary file. The size of this declaration when it is compiled - /// to binary data. The C variable type this declaration will be - /// declared as. The C variable name this declaration will be - /// declared as. The contents of the C variable - /// declaration. The number of items in the - /// array. (Optional) Is this declaration from another - /// segment? - static Declaration* CreateArray(offset_t declAddr, DeclarationAlignment declAlign, - size_t declSize, const std::string& declType, - const std::string& declName, const std::string& declBody, - size_t declArrayItemCnt = 0, bool isDeclExternal = false); - - /// - /// Creates an array declaration who's size in the C code uses a custom string. - /// - /// The address inside a binary file this declaration will be in when - /// compiled. The alignment of this declaration in the compiled - /// binary file. The size of this declaration when it is compiled - /// to binary data. The C variable type this declaration will be - /// declared as. The C variable name this declaration will be - /// declared as. The contents of the C variable - /// declaration. The string to be put in the C array's - /// size inbetween the brackets. (Optional) Is this - /// declaration from another segment? - static Declaration* CreateArray(offset_t declAddr, DeclarationAlignment declAlign, - size_t declSize, const std::string& declType, - const std::string& declName, const std::string& declBody, - const std::string& declArrayItemCntStr, - bool isDeclExternal = false); - - /// - /// Creates a declaration who's body uses a #include to include another file - /// - /// The address inside a binary file this declaration will be in when - /// compiled. The path to the file this declaration will be - /// #including. The size of this declaration when it is compiled - /// to binary data. The C variable type this declaration will be - /// declared as. The C variable name this declaration will be - /// declared as. (Optional) Any #define's we want to have - /// outputted by this declaration. - static Declaration* CreateInclude(offset_t declAddr, const std::string& includePath, - size_t declSize, const std::string& declType, - const std::string& declName, const std::string& defines = ""); - - /// - /// Creates a placeholder declaration to be replaced later. - /// - /// The address inside a binary file this declaration will be in when - /// compiled. The C variable name this declaration will be - /// declared as. - static Declaration* CreatePlaceholder(offset_t declAddr, const std::string& declName); - - bool IsStatic() const; - - // Returns the declaration as C code as it would be in the code file when the body contains the - // needed data - std::string GetNormalDeclarationStr() const; - - // Returns the declaration as C code as it would be in the code file when the body #include's - // another file - std::string GetExternalDeclarationStr() const; - - // Generates the extern for this item to be placed in header files. - std::string GetExternStr() const; - - // Generates any #define's needed - std::string GetDefinesStr() const; - - std::string GetStaticForwardDeclarationStr() const; - -protected: - Declaration(offset_t nAddress, DeclarationAlignment nAlignment, size_t nSize, - const std::string& nBody); -}; diff --git a/tools/ZAPD/ZAPD/ExporterSet.h b/tools/ZAPD/ZAPD/ExporterSet.h deleted file mode 100644 index c4dd93445a..0000000000 --- a/tools/ZAPD/ZAPD/ExporterSet.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -typedef void (*ExporterSetFunc)(ZFile*); -typedef bool (*ExporterSetFuncBool)(ZFileMode fileMode); -typedef void (*ExporterSetFuncVoid)(int argc, char* argv[], int& i); -typedef void (*ExporterSetFuncVoid2)(const std::string& buildMode, ZFileMode& fileMode); -typedef void (*ExporterSetFuncVoid3)(); -typedef void (*ExporterSetResSave)(ZResource* res, BinaryWriter& writer); - -class ExporterSet -{ -public: - ~ExporterSet(); - - std::map exporters; - ExporterSetFuncVoid parseArgsFunc = nullptr; - ExporterSetFuncVoid2 parseFileModeFunc = nullptr; - ExporterSetFuncBool processFileModeFunc = nullptr; - ExporterSetFunc beginFileFunc = nullptr; - ExporterSetFunc endFileFunc = nullptr; - ExporterSetFuncVoid3 beginXMLFunc = nullptr; - ExporterSetFuncVoid3 endXMLFunc = nullptr; - ExporterSetResSave resSaveFunc = nullptr; -}; \ No newline at end of file diff --git a/tools/ZAPD/ZAPD/GameConfig.cpp b/tools/ZAPD/ZAPD/GameConfig.cpp deleted file mode 100644 index 2140464ec6..0000000000 --- a/tools/ZAPD/ZAPD/GameConfig.cpp +++ /dev/null @@ -1,301 +0,0 @@ -#include "GameConfig.h" - -#include -#include -#include - -#include "Utils/Directory.h" -#include "Utils/File.h" -#include "Utils/Path.h" -#include "ZFile.h" -#include "tinyxml2.h" - -using ConfigFunc = void (GameConfig::*)(const tinyxml2::XMLElement&); - -GameConfig::~GameConfig() -{ - for (auto& declPair : segmentRefFiles) - { - for (auto& file : declPair.second) - { - delete file; - } - } -} - -void GameConfig::ReadTexturePool(const fs::path& texturePoolXmlPath) -{ - tinyxml2::XMLDocument doc; - tinyxml2::XMLError eResult = doc.LoadFile(texturePoolXmlPath.string().c_str()); - - if (eResult != tinyxml2::XML_SUCCESS) - { - fprintf(stderr, "Warning: Unable to read texture pool XML with error code %i\n", eResult); - return; - } - - tinyxml2::XMLNode* root = doc.FirstChild(); - - if (root == nullptr) - return; - - for (tinyxml2::XMLElement* child = root->FirstChildElement(); child != nullptr; - child = child->NextSiblingElement()) - { - if (std::string_view(child->Name()) == "Texture") - { - std::string crcStr = child->Attribute("CRC"); - fs::path texPath = child->Attribute("Path"); - std::string texName; - - uint32_t crc = strtoul(crcStr.c_str(), nullptr, 16); - - texturePool[crc].path = texPath; - } - } -} - -void GameConfig::GenSymbolMap(const fs::path& symbolMapPath) -{ - auto symbolLines = File::ReadAllLines(symbolMapPath); - - for (std::string& symbolLine : symbolLines) - { - auto split = StringHelper::Split(symbolLine, " "); - uint32_t addr = strtoul(split[0].c_str(), nullptr, 16); - std::string symbolName = split[1]; - - symbolMap[addr] = std::move(symbolName); - } -} - -void GameConfig::ConfigFunc_SymbolMap(const tinyxml2::XMLElement& element) -{ - std::string fileName = element.Attribute("File"); - GenSymbolMap(Path::GetDirectoryName(configFilePath) / fileName); -} - -void GameConfig::ConfigFunc_ActorList(const tinyxml2::XMLElement& element) -{ - std::string fileName = element.Attribute("File"); - std::vector lines = - File::ReadAllLines(Path::GetDirectoryName(configFilePath) / fileName); - - for (auto& line : lines) - actorList.emplace_back(std::move(line)); -} - -void GameConfig::ConfigFunc_ObjectList(const tinyxml2::XMLElement& element) -{ - std::string fileName = element.Attribute("File"); - std::vector lines = - File::ReadAllLines(Path::GetDirectoryName(configFilePath) / fileName); - - for (auto& line : lines) - objectList.emplace_back(std::move(line)); -} - -void GameConfig::ConfigFunc_EntranceList(const tinyxml2::XMLElement& element) -{ - std::string fileName = element.Attribute("File"); - std::vector lines = - File::ReadAllLines(Path::GetDirectoryName(configFilePath) / fileName); - - for (auto& line : lines) - entranceList.emplace_back(std::move(line)); -} - -void GameConfig::ConfigFunc_specialEntranceList(const tinyxml2::XMLElement& element) -{ - std::string fileName = element.Attribute("File"); - std::vector lines = - File::ReadAllLines(Path::GetDirectoryName(configFilePath) / fileName); - - for (auto& line : lines) - specialEntranceList.emplace_back(std::move(line)); -} - -void GameConfig::ConfigFunc_TexturePool(const tinyxml2::XMLElement& element) -{ - std::string fileName = element.Attribute("File"); - ReadTexturePool(Path::GetDirectoryName(configFilePath) / fileName); -} - -void GameConfig::ConfigFunc_BGConfig(const tinyxml2::XMLElement& element) -{ - bgScreenWidth = element.IntAttribute("ScreenWidth", 320); - bgScreenHeight = element.IntAttribute("ScreenHeight", 240); - useScreenWidthHeightConstants = element.BoolAttribute("UseScreenWidthHeightConstants", true); -} - -void GameConfig::ConfigFunc_ExternalXMLFolder(const tinyxml2::XMLElement& element) -{ - const char* pathValue = element.Attribute("Path"); - if (pathValue == nullptr) - { - throw std::runtime_error( - StringHelper::Sprintf("Parse: Fatal error in configuration file.\n" - "\t Missing 'Path' attribute in `ExternalXMLFolder` element.\n")); - } - if (externalXmlFolder != "") - { - throw std::runtime_error(StringHelper::Sprintf("Parse: Fatal error in configuration file.\n" - "\t `ExternalXMLFolder` is duplicated.\n")); - } - externalXmlFolder = pathValue; -} - -void GameConfig::ConfigFunc_ExternalFile(const tinyxml2::XMLElement& element) -{ - const char* xmlPathValue = element.Attribute("XmlPath"); - if (xmlPathValue == nullptr) - { - throw std::runtime_error( - StringHelper::Sprintf("Parse: Fatal error in configuration file.\n" - "\t Missing 'XmlPath' attribute in `ExternalFile` element.\n")); - } - const char* outPathValue = element.Attribute("OutPath"); - if (outPathValue == nullptr) - { - throw std::runtime_error( - StringHelper::Sprintf("Parse: Fatal error in configuration file.\n" - "\t Missing 'OutPath' attribute in `ExternalFile` element.\n")); - } - - externalFiles.push_back(ExternalFile(fs::path(xmlPathValue), fs::path(outPathValue))); -} - -void GameConfig::ConfigFunc_EnumData(const tinyxml2::XMLElement& element) -{ - std::string path = Path::GetDirectoryName(configFilePath).string(); - path = path.append("/").append(element.Attribute("File")); - tinyxml2::XMLDocument doc; - tinyxml2::XMLError eResult = doc.LoadFile(path.c_str()); - - if (eResult != tinyxml2::XML_SUCCESS) - { - throw std::runtime_error("Error: Unable to read enum data."); - } - - tinyxml2::XMLNode* root = doc.FirstChild(); - - if (root == nullptr) - return; - - for (tinyxml2::XMLElement* csEnum = root->FirstChildElement(); csEnum != nullptr; - csEnum = csEnum->NextSiblingElement()) - { - for (tinyxml2::XMLElement* item = csEnum->FirstChildElement(); item != nullptr; - item = item->NextSiblingElement()) - { - std::string enumKey = csEnum->Attribute("Key"); - uint16_t itemIndex = atoi(item->Attribute("Index")); - const char* itemID = item->Attribute("ID"); - - // Common - if (enumKey == "cmd") - enumData.cutsceneCmd[itemIndex] = itemID; - - else if (enumKey == "miscType") - enumData.miscType[itemIndex] = itemID; - - else if (enumKey == "textType") - enumData.textType[itemIndex] = itemID; - - else if (enumKey == "fadeOutSeqPlayer") - enumData.fadeOutSeqPlayer[itemIndex] = itemID; - - else if (enumKey == "transitionType") - enumData.transitionType[itemIndex] = itemID; - - else if (enumKey == "destination") - enumData.destination[itemIndex] = itemID; - - else if (enumKey == "naviQuestHintType") - enumData.naviQuestHintType[itemIndex] = itemID; - - else if (enumKey == "ocarinaSongActionId") - enumData.ocarinaSongActionId[itemIndex] = itemID; - - else if (enumKey == "seqId") - enumData.seqId[itemIndex] = itemID; - - else if (enumKey == "playerCueId") - enumData.playerCueId[itemIndex] = itemID; - - // MM - else if (enumKey == "modifySeqType") - enumData.modifySeqType[itemIndex] = itemID; - - else if (enumKey == "chooseCreditsSceneType") - enumData.chooseCreditsSceneType[itemIndex] = itemID; - - else if (enumKey == "destinationType") - enumData.destinationType[itemIndex] = itemID; - - else if (enumKey == "motionBlurType") - enumData.motionBlurType[itemIndex] = itemID; - - else if (enumKey == "transitionGeneralType") - enumData.transitionGeneralType[itemIndex] = itemID; - - else if (enumKey == "rumbleType") - enumData.rumbleType[itemIndex] = itemID; - - else if (enumKey == "spawnFlag") - enumData.spawnFlag[itemIndex] = itemID; - - else if (enumKey == "endSfx") - enumData.endSfx[itemIndex] = itemID; - - else if (enumKey == "csSplineInterpType") - enumData.interpType[itemIndex] = itemID; - - else if (enumKey == "csSplineRelTo") - enumData.relTo[itemIndex] = itemID; - } - } -} - -void GameConfig::ReadConfigFile(const fs::path& argConfigFilePath) -{ - static const std::unordered_map ConfigFuncDictionary = { - {"SymbolMap", &GameConfig::ConfigFunc_SymbolMap}, - {"ActorList", &GameConfig::ConfigFunc_ActorList}, - {"ObjectList", &GameConfig::ConfigFunc_ObjectList}, - {"EntranceList", &GameConfig::ConfigFunc_EntranceList}, - {"SpecialEntranceList", &GameConfig::ConfigFunc_specialEntranceList}, - {"TexturePool", &GameConfig::ConfigFunc_TexturePool}, - {"BGConfig", &GameConfig::ConfigFunc_BGConfig}, - {"EnumData", &GameConfig::ConfigFunc_EnumData}, - {"ExternalXMLFolder", &GameConfig::ConfigFunc_ExternalXMLFolder}, - {"ExternalFile", &GameConfig::ConfigFunc_ExternalFile}, - }; - - configFilePath = argConfigFilePath.string(); - tinyxml2::XMLDocument doc; - tinyxml2::XMLError eResult = doc.LoadFile(configFilePath.c_str()); - - if (eResult != tinyxml2::XML_SUCCESS) - { - throw std::runtime_error("Error: Unable to read config file."); - } - - tinyxml2::XMLNode* root = doc.FirstChild(); - - if (root == nullptr) - return; - - for (tinyxml2::XMLElement* child = root->FirstChildElement(); child != nullptr; - child = child->NextSiblingElement()) - { - auto it = ConfigFuncDictionary.find(child->Name()); - if (it == ConfigFuncDictionary.end()) - { - fprintf(stderr, "Unsupported configuration variable: %s\n", child->Name()); - continue; - } - - std::invoke(it->second, *this, *child); - } -} diff --git a/tools/ZAPD/ZAPD/GameConfig.h b/tools/ZAPD/ZAPD/GameConfig.h deleted file mode 100644 index 4f3b91f8c7..0000000000 --- a/tools/ZAPD/ZAPD/GameConfig.h +++ /dev/null @@ -1,97 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include "Utils/Directory.h" -#include "tinyxml2.h" - -struct TexturePoolEntry -{ - fs::path path = ""; // Path to Shared Texture -}; - -class ExternalFile -{ -public: - fs::path xmlPath, outPath; - - ExternalFile(fs::path nXmlPath, fs::path nOutPath); -}; - -// Stores data from the XML file, the integer is the index (via ATOI) and the string is the value -class EnumData -{ -public: - // Common - std::map cutsceneCmd; - std::map miscType; - std::map fadeOutSeqPlayer; - std::map transitionType; - std::map naviQuestHintType; - std::map ocarinaSongActionId; - std::map seqId; - - // OoT - std::map textType; - std::map destination; - std::map playerCueId; - - // MM - std::map modifySeqType; - std::map chooseCreditsSceneType; - std::map destinationType; - std::map motionBlurType; - std::map transitionGeneralType; - std::map rumbleType; - std::map spawnFlag; - std::map endSfx; - std::map interpType; - std::map relTo; -}; - -class ZFile; - -class GameConfig -{ -public: - std::string configFilePath; - std::map> segmentRefFiles; - std::map symbolMap; - std::vector actorList; - std::vector objectList; - std::vector entranceList; - std::vector specialEntranceList; - std::map texturePool; // Key = CRC - EnumData enumData; - - // ZBackground - uint32_t bgScreenWidth = 320, bgScreenHeight = 240; - bool useScreenWidthHeightConstants = true; // If true, ZBackground's will be declared with - // SCREEN_WIDTH * SCREEN_HEIGHT in the C file - - // ExternalFile - fs::path externalXmlFolder; - std::vector externalFiles; - - GameConfig() = default; - ~GameConfig(); - - void ReadTexturePool(const fs::path& texturePoolXmlPath); - void GenSymbolMap(const fs::path& symbolMapPath); - - void ConfigFunc_SymbolMap(const tinyxml2::XMLElement& element); - void ConfigFunc_ActorList(const tinyxml2::XMLElement& element); - void ConfigFunc_ObjectList(const tinyxml2::XMLElement& element); - void ConfigFunc_EntranceList(const tinyxml2::XMLElement& element); - void ConfigFunc_specialEntranceList(const tinyxml2::XMLElement& element); - void ConfigFunc_TexturePool(const tinyxml2::XMLElement& element); - void ConfigFunc_BGConfig(const tinyxml2::XMLElement& element); - void ConfigFunc_ExternalXMLFolder(const tinyxml2::XMLElement& element); - void ConfigFunc_ExternalFile(const tinyxml2::XMLElement& element); - void ConfigFunc_EnumData(const tinyxml2::XMLElement& element); - - void ReadConfigFile(const fs::path& configFilePath); -}; diff --git a/tools/ZAPD/ZAPD/Globals.cpp b/tools/ZAPD/ZAPD/Globals.cpp deleted file mode 100644 index 02380f6902..0000000000 --- a/tools/ZAPD/ZAPD/Globals.cpp +++ /dev/null @@ -1,246 +0,0 @@ -#include "Globals.h" - -#include -#include - -#include "Utils/File.h" -#include "Utils/Path.h" -#include "WarningHandler.h" -#include "tinyxml2.h" - -Globals* Globals::Instance; - -Globals::Globals() -{ - Instance = this; - - game = ZGame::OOT_RETAIL; - genSourceFile = true; - testMode = false; - profile = false; - useLegacyZDList = false; - useExternalResources = true; - verbosity = VerbosityLevel::VERBOSITY_SILENT; - outputPath = Directory::GetCurrentDirectory(); -} - -Globals::~Globals() -{ - auto& exporters = GetExporterMap(); - - for (auto& it : exporters) - { - delete it.second; - } -} - -void Globals::AddSegment(int32_t segment, ZFile* file) -{ - if (std::find(segments.begin(), segments.end(), segment) == segments.end()) - segments.push_back(segment); - if (cfg.segmentRefFiles.find(segment) == cfg.segmentRefFiles.end()) - cfg.segmentRefFiles[segment] = std::vector(); - - cfg.segmentRefFiles[segment].push_back(file); -} - -bool Globals::HasSegment(int32_t segment) -{ - return std::find(segments.begin(), segments.end(), segment) != segments.end(); -} - -std::map& Globals::GetExporterMap() -{ - static std::map exporters; - return exporters; -} - -void Globals::AddExporter(std::string exporterName, ExporterSet* exporterSet) -{ - auto& exporters = GetExporterMap(); - exporters[exporterName] = exporterSet; -} - -ZResourceExporter* Globals::GetExporter(ZResourceType resType) -{ - auto& exporters = GetExporterMap(); - - if (currentExporter != "" && exporters[currentExporter]->exporters.find(resType) != - exporters[currentExporter]->exporters.end()) - return exporters[currentExporter]->exporters[resType]; - else - return nullptr; -} - -ExporterSet* Globals::GetExporterSet() -{ - auto& exporters = GetExporterMap(); - - if (currentExporter != "") - return exporters[currentExporter]; - else - return nullptr; -} - -bool Globals::GetSegmentedPtrName(segptr_t segAddress, ZFile* currentFile, - const std::string& expectedType, std::string& declName, - bool warnIfNotFound) -{ - if (segAddress == SEGMENTED_NULL) - { - declName = "NULL"; - return true; - } - - uint8_t segment = GETSEGNUM(segAddress); - uint32_t offset = Seg2Filespace(segAddress, currentFile->baseAddress); - ZSymbol* sym; - - sym = currentFile->GetSymbolResource(offset); - if (sym != nullptr) - { - if (expectedType == "" || expectedType == sym->GetSourceTypeName()) - { - declName = sym->GetName(); - return true; - } - } - sym = currentFile->GetSymbolResource(segAddress); - if (sym != nullptr) - { - if (expectedType == "" || expectedType == sym->GetSourceTypeName()) - { - declName = sym->GetName(); - return true; - } - } - - if (currentFile->IsSegmentedInFilespaceRange(segAddress)) - { - if (currentFile->GetDeclarationPtrName(segAddress, expectedType, declName)) - return true; - } - else if (HasSegment(segment)) - { - for (auto file : cfg.segmentRefFiles[segment]) - { - offset = Seg2Filespace(segAddress, file->baseAddress); - - sym = file->GetSymbolResource(offset); - if (sym != nullptr) - { - if (expectedType == "" || expectedType == sym->GetSourceTypeName()) - { - declName = sym->GetName(); - return true; - } - } - sym = file->GetSymbolResource(segAddress); - if (sym != nullptr) - { - if (expectedType == "" || expectedType == sym->GetSourceTypeName()) - { - declName = sym->GetName(); - return true; - } - } - - if (file->IsSegmentedInFilespaceRange(segAddress)) - { - if (file->GetDeclarationPtrName(segAddress, expectedType, declName)) - return true; - } - } - } - - const auto& symbolFromMap = Globals::Instance->cfg.symbolMap.find(segAddress); - if (symbolFromMap != Globals::Instance->cfg.symbolMap.end()) - { - declName = "&" + symbolFromMap->second; - return true; - } - - declName = StringHelper::Sprintf("0x%08X", segAddress); - if (warnIfNotFound) - { - WarnHardcodedPointer(segAddress, currentFile, nullptr, -1); - } - return false; -} - -bool Globals::GetSegmentedArrayIndexedName(segptr_t segAddress, size_t elementSize, - ZFile* currentFile, const std::string& expectedType, - std::string& declName, bool warnIfNotFound) -{ - if (segAddress == SEGMENTED_NULL) - { - declName = "NULL"; - return true; - } - - uint8_t segment = GETSEGNUM(segAddress); - - if (currentFile->IsSegmentedInFilespaceRange(segAddress)) - { - bool addressFound = currentFile->GetDeclarationArrayIndexedName(segAddress, elementSize, - expectedType, declName); - if (addressFound) - return true; - } - else if (HasSegment(segment)) - { - for (auto file : cfg.segmentRefFiles[segment]) - { - if (file->IsSegmentedInFilespaceRange(segAddress)) - { - bool addressFound = file->GetDeclarationArrayIndexedName(segAddress, elementSize, - expectedType, declName); - if (addressFound) - return true; - } - } - } - - declName = StringHelper::Sprintf("0x%08X", segAddress); - if (warnIfNotFound) - { - WarnHardcodedPointer(segAddress, currentFile, nullptr, -1); - } - return false; -} - -void Globals::WarnHardcodedPointer(segptr_t segAddress, ZFile* currentFile, ZResource* res, - offset_t currentOffset) -{ - uint8_t segment = GETSEGNUM(segAddress); - - if ((segment >= 2 && segment <= 6) || segment == 0x80) - { - std::string errorHeader = "A hardcoded pointer was found"; - std::string errorBody = StringHelper::Sprintf("Pointer: 0x%08X", segAddress); - - HANDLE_WARNING_RESOURCE(WarningType::HardcodedPointer, currentFile, res, currentOffset, - errorHeader, errorBody); - } - else - { - std::string errorHeader = "A general purpose hardcoded pointer was found"; - std::string errorBody = StringHelper::Sprintf("Pointer: 0x%08X", segAddress); - - HANDLE_WARNING_RESOURCE(WarningType::HardcodedGenericPointer, currentFile, res, - currentOffset, errorHeader, errorBody); - } -} - -ExternalFile::ExternalFile(fs::path nXmlPath, fs::path nOutPath) - : xmlPath{nXmlPath}, outPath{nOutPath} -{ -} - -ExporterSet::~ExporterSet() -{ - for (auto& it : exporters) - { - delete it.second; - } -} diff --git a/tools/ZAPD/ZAPD/Globals.h b/tools/ZAPD/ZAPD/Globals.h deleted file mode 100644 index 2cc9c2d4db..0000000000 --- a/tools/ZAPD/ZAPD/Globals.h +++ /dev/null @@ -1,90 +0,0 @@ -#pragma once - -#include -#include -#include -#include "GameConfig.h" -#include "ZFile.h" -#include "ExporterSet.h" - -class ZRoom; - -enum class VerbosityLevel -{ - VERBOSITY_SILENT, - VERBOSITY_INFO, - VERBOSITY_DEBUG -}; - -enum class CsFloatType -{ - HexOnly, - FloatOnly, - HexAndFloat, - HexAndCommentedFloatLeft, - HexAndCommentedFloatRight, -}; - -class Globals -{ -public: - static Globals* Instance; - - bool genSourceFile; // Used for extraction - bool useExternalResources; - bool testMode; // Enables certain experimental features - bool outputCrc = false; - bool profile; // Measure performance of certain operations - bool useLegacyZDList; - VerbosityLevel verbosity; // ZAPD outputs additional information - ZFileMode fileMode; - fs::path baseRomPath, inputPath, outputPath, sourceOutputPath, cfgPath; - TextureType texType; - CsFloatType floatType = CsFloatType::FloatOnly; - int64_t baseAddress = -1; - int64_t startOffset = -1; - int64_t endOffset = -1; - ZGame game; - GameConfig cfg; - bool verboseUnaccounted = false; - bool gccCompat = false; - bool forceStatic = false; - bool forceUnaccountedStatic = false; - - std::vector files; - std::vector externalFiles; - std::vector segments; - - std::string currentExporter; - static std::map& GetExporterMap(); - static void AddExporter(std::string exporterName, ExporterSet* exporterSet); - - Globals(); - ~Globals(); - - void AddSegment(int32_t segment, ZFile* file); - bool HasSegment(int32_t segment); - - ZResourceExporter* GetExporter(ZResourceType resType); - ExporterSet* GetExporterSet(); - - /** - * Search in every file (and the symbol map) for the `segAddress` passed as parameter. - * If the segment of `currentFile` is the same segment of `segAddress`, then that file will be - * used only, otherwise, the search will be performed in every other file. - * The name of that variable will be stored in the `declName` parameter. - * Returns `true` if the address is found. `false` otherwise, - * in which case `declName` will be set to the address formatted as a pointer. - */ - bool GetSegmentedPtrName(segptr_t segAddress, ZFile* currentFile, - const std::string& expectedType, std::string& declName, - bool warnIfNotFound = true); - - bool GetSegmentedArrayIndexedName(segptr_t segAddress, size_t elementSize, ZFile* currentFile, - const std::string& expectedType, std::string& declName, - bool warnIfNotFound = true); - - // TODO: consider moving to another place - void WarnHardcodedPointer(segptr_t segAddress, ZFile* currentFile, ZResource* res, - offset_t currentOffset); -}; diff --git a/tools/ZAPD/ZAPD/ImageBackend.cpp b/tools/ZAPD/ZAPD/ImageBackend.cpp deleted file mode 100644 index 307945b40e..0000000000 --- a/tools/ZAPD/ZAPD/ImageBackend.cpp +++ /dev/null @@ -1,506 +0,0 @@ -#include "ImageBackend.h" - -#include -#include -#include -#include - -#include "Utils/StringHelper.h" -#include "WarningHandler.h" - -/* ImageBackend */ - -ImageBackend::~ImageBackend() -{ - FreeImageData(); -} - -void ImageBackend::ReadPng(const char* filename) -{ - FreeImageData(); - - FILE* fp = fopen(filename, "rb"); - if (fp == nullptr) - { - std::string errorHeader = StringHelper::Sprintf("could not open file '%s'", filename); - HANDLE_ERROR(WarningType::InvalidPNG, errorHeader, ""); - } - - png_structp png = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); - if (png == nullptr) - { - HANDLE_ERROR(WarningType::InvalidPNG, "could not create png struct", ""); - } - - png_infop info = png_create_info_struct(png); - if (info == nullptr) - { - HANDLE_ERROR(WarningType::InvalidPNG, "could not create png info", ""); - } - - if (setjmp(png_jmpbuf(png))) - { - // TODO: better warning explanation - HANDLE_ERROR(WarningType::InvalidPNG, "setjmp(png_jmpbuf(png))", ""); - } - - png_init_io(png, fp); - - png_read_info(png, info); - - width = png_get_image_width(png, info); - height = png_get_image_height(png, info); - colorType = png_get_color_type(png, info); - bitDepth = png_get_bit_depth(png, info); - -#ifdef TEXTURE_DEBUG - printf("Width: %u\n", width); - printf("Height: %u\n", height); - printf("ColorType: "); - switch (colorType) - { - case PNG_COLOR_TYPE_RGBA: - printf("PNG_COLOR_TYPE_RGBA\n"); - break; - - case PNG_COLOR_TYPE_RGB: - printf("PNG_COLOR_TYPE_RGB\n"); - break; - - case PNG_COLOR_TYPE_PALETTE: - printf("PNG_COLOR_TYPE_PALETTE\n"); - break; - - default: - printf("%u\n", colorType); - break; - } - printf("BitDepth: %u\n", bitDepth); - printf("\n"); -#endif - - // Read any color_type into 8bit depth, RGBA format. - // See http://www.libpng.org/pub/png/libpng-manual.txt - - if (bitDepth == 16) - png_set_strip_16(png); - - if (colorType == PNG_COLOR_TYPE_PALETTE) - { - // png_set_palette_to_rgb(png); - isColorIndexed = true; - } - - // PNG_COLOR_TYPE_GRAY_ALPHA is always 8 or 16bit depth. - if (colorType == PNG_COLOR_TYPE_GRAY && bitDepth < 8) - png_set_expand_gray_1_2_4_to_8(png); - - /*if (png_get_valid(png, info, PNG_INFO_tRNS)) - png_set_tRNS_to_alpha(png);*/ - - // These color_type don't have an alpha channel then fill it with 0xff. - /*if(*color_type == PNG_COLOR_TYPE_RGB || - *color_type == PNG_COLOR_TYPE_GRAY || - *color_type == PNG_COLOR_TYPE_PALETTE) - png_set_filler(png, 0xFF, PNG_FILLER_AFTER);*/ - - if (colorType == PNG_COLOR_TYPE_GRAY || colorType == PNG_COLOR_TYPE_GRAY_ALPHA) - png_set_gray_to_rgb(png); - - png_read_update_info(png, info); - - size_t rowBytes = png_get_rowbytes(png, info); - pixelMatrix = (uint8_t**)malloc(sizeof(uint8_t*) * height); - for (size_t y = 0; y < height; y++) - { - pixelMatrix[y] = (uint8_t*)malloc(rowBytes); - } - - png_read_image(png, pixelMatrix); - -#ifdef TEXTURE_DEBUG - printf("rowBytes: %zu\n", rowBytes); - - size_t bytePerPixel = GetBytesPerPixel(); - printf("imgData\n"); - for (size_t y = 0; y < height; y++) - { - for (size_t x = 0; x < width; x++) - { - for (size_t z = 0; z < bytePerPixel; z++) - { - printf("%02X ", pixelMatrix[y][x * bytePerPixel + z]); - } - printf(" "); - } - printf("\n"); - } - printf("\n"); -#endif - - fclose(fp); - - png_destroy_read_struct(&png, &info, nullptr); - - hasImageData = true; -} - -void ImageBackend::ReadPng(const fs::path& filename) -{ - ReadPng(filename.c_str()); -} - -void ImageBackend::WritePng(const char* filename) -{ - assert(hasImageData); - - FILE* fp = fopen(filename, "wb"); - if (fp == nullptr) - { - std::string errorHeader = - StringHelper::Sprintf("could not open file '%s' in write mode", filename); - HANDLE_ERROR(WarningType::InvalidPNG, errorHeader, ""); - } - - png_structp png = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); - if (png == nullptr) - { - HANDLE_ERROR(WarningType::InvalidPNG, "could not create png struct", ""); - } - - png_infop info = png_create_info_struct(png); - if (info == nullptr) - { - HANDLE_ERROR(WarningType::InvalidPNG, "could not create png info", ""); - } - - if (setjmp(png_jmpbuf(png))) - { - // TODO: better warning description - HANDLE_ERROR(WarningType::InvalidPNG, "setjmp(png_jmpbuf(png))", ""); - } - - png_init_io(png, fp); - - png_set_IHDR(png, info, width, height, - bitDepth, // 8, - colorType, // PNG_COLOR_TYPE_RGBA, - PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); - - if (isColorIndexed) - { - png_set_PLTE(png, info, static_cast(colorPalette), paletteSize); - -#ifdef TEXTURE_DEBUG - printf("palette\n"); - png_color* aux = (png_color*)colorPalette; - for (size_t y = 0; y < paletteSize; y++) - { - printf("#%02X%02X%02X ", aux[y].red, aux[y].green, aux[y].blue); - if ((y + 1) % 8 == 0) - printf("\n"); - } - printf("\n"); -#endif - - png_set_tRNS(png, info, alphaPalette, paletteSize, nullptr); - } - - png_write_info(png, info); - - // To remove the alpha channel for PNG_COLOR_TYPE_RGB format, - // Use png_set_filler(). - // png_set_filler(png, 0, PNG_FILLER_AFTER); - -#ifdef TEXTURE_DEBUG - size_t bytePerPixel = GetBytesPerPixel(); - printf("imgData\n"); - for (size_t y = 0; y < height; y++) - { - for (size_t x = 0; x < width * bytePerPixel; x++) - { - printf("%02X ", pixelMatrix[y][x]); - } - printf("\n"); - } - printf("\n"); -#endif - - png_write_image(png, pixelMatrix); - png_write_end(png, nullptr); - - fclose(fp); - - png_destroy_write_struct(&png, &info); -} - -void ImageBackend::WritePng(const fs::path& filename) -{ - // Note: The .string() is necessary for MSVC, due to the implementation of std::filesystem - // differing from GCC. Do not remove! - WritePng(filename.string().c_str()); -} - -void ImageBackend::SetTextureData(const std::vector>& texData, - uint32_t nWidth, uint32_t nHeight, uint8_t nColorType, - uint8_t nBitDepth) -{ - FreeImageData(); - - width = nWidth; - height = nHeight; - colorType = nColorType; - bitDepth = nBitDepth; - - size_t bytePerPixel = GetBytesPerPixel(); - - pixelMatrix = static_cast(malloc(sizeof(uint8_t*) * height)); - for (size_t y = 0; y < height; y++) - { - pixelMatrix[y] = static_cast(malloc(sizeof(uint8_t*) * width * bytePerPixel)); - for (size_t x = 0; x < width; x++) - { - pixelMatrix[y][x * bytePerPixel + 0] = texData.at(y).at(x).r; - pixelMatrix[y][x * bytePerPixel + 1] = texData.at(y).at(x).g; - pixelMatrix[y][x * bytePerPixel + 2] = texData.at(y).at(x).b; - - if (colorType == PNG_COLOR_TYPE_RGBA) - pixelMatrix[y][x * bytePerPixel + 3] = texData.at(y).at(x).a; - } - } - hasImageData = true; -} - -void ImageBackend::InitEmptyRGBImage(uint32_t nWidth, uint32_t nHeight, bool alpha) -{ - FreeImageData(); - - width = nWidth; - height = nHeight; - colorType = PNG_COLOR_TYPE_RGB; - if (alpha) - colorType = PNG_COLOR_TYPE_RGBA; - bitDepth = 8; // nBitDepth; - - size_t bytePerPixel = GetBytesPerPixel(); - - pixelMatrix = static_cast(malloc(sizeof(uint8_t*) * height)); - for (size_t y = 0; y < height; y++) - { - pixelMatrix[y] = static_cast(calloc(width * bytePerPixel, sizeof(uint8_t*))); - } - - hasImageData = true; -} - -void ImageBackend::InitEmptyPaletteImage(uint32_t nWidth, uint32_t nHeight) -{ - FreeImageData(); - - width = nWidth; - height = nHeight; - colorType = PNG_COLOR_TYPE_PALETTE; - bitDepth = 8; - - size_t bytePerPixel = GetBytesPerPixel(); - - pixelMatrix = (uint8_t**)malloc(sizeof(uint8_t*) * height); - for (size_t y = 0; y < height; y++) - { - pixelMatrix[y] = static_cast(calloc(width * bytePerPixel, sizeof(uint8_t*))); - } - colorPalette = calloc(paletteSize, sizeof(png_color)); - alphaPalette = static_cast(calloc(paletteSize, sizeof(uint8_t))); - - hasImageData = true; - isColorIndexed = true; -} - -RGBAPixel ImageBackend::GetPixel(size_t y, size_t x) const -{ - assert(y < height); - assert(x < width); - assert(!isColorIndexed); - - RGBAPixel pixel; - size_t bytePerPixel = GetBytesPerPixel(); - pixel.r = pixelMatrix[y][x * bytePerPixel + 0]; - pixel.g = pixelMatrix[y][x * bytePerPixel + 1]; - pixel.b = pixelMatrix[y][x * bytePerPixel + 2]; - if (colorType == PNG_COLOR_TYPE_RGBA) - pixel.a = pixelMatrix[y][x * bytePerPixel + 3]; - return pixel; -} - -uint8_t ImageBackend::GetIndexedPixel(size_t y, size_t x) const -{ - assert(y < height); - assert(x < width); - assert(isColorIndexed); - - return pixelMatrix[y][x]; -} - -void ImageBackend::SetRGBPixel(size_t y, size_t x, uint8_t nR, uint8_t nG, uint8_t nB, uint8_t nA) -{ - assert(hasImageData); - assert(y < height); - assert(x < width); - - size_t bytePerPixel = GetBytesPerPixel(); - pixelMatrix[y][x * bytePerPixel + 0] = nR; - pixelMatrix[y][x * bytePerPixel + 1] = nG; - pixelMatrix[y][x * bytePerPixel + 2] = nB; - if (colorType == PNG_COLOR_TYPE_RGBA) - pixelMatrix[y][x * bytePerPixel + 3] = nA; -} - -void ImageBackend::SetGrayscalePixel(size_t y, size_t x, uint8_t grayscale, uint8_t alpha) -{ - assert(hasImageData); - assert(y < height); - assert(x < width); - - size_t bytePerPixel = GetBytesPerPixel(); - pixelMatrix[y][x * bytePerPixel + 0] = grayscale; - pixelMatrix[y][x * bytePerPixel + 1] = grayscale; - pixelMatrix[y][x * bytePerPixel + 2] = grayscale; - if (colorType == PNG_COLOR_TYPE_RGBA) - pixelMatrix[y][x * bytePerPixel + 3] = alpha; -} - -void ImageBackend::SetIndexedPixel(size_t y, size_t x, uint8_t index, uint8_t grayscale) -{ - assert(hasImageData); - assert(y < height); - assert(x < width); - - size_t bytePerPixel = GetBytesPerPixel(); - pixelMatrix[y][x * bytePerPixel + 0] = index; - - assert(index < paletteSize); - png_color* pal = static_cast(colorPalette); - pal[index].red = grayscale; - pal[index].green = grayscale; - pal[index].blue = grayscale; - alphaPalette[index] = 255; -} - -void ImageBackend::SetPaletteIndex(size_t index, uint8_t nR, uint8_t nG, uint8_t nB, uint8_t nA) -{ - assert(isColorIndexed); - assert(index < paletteSize); - - png_color* pal = static_cast(colorPalette); - pal[index].red = nR; - pal[index].green = nG; - pal[index].blue = nB; - alphaPalette[index] = nA; -} - -void ImageBackend::SetPalette(const ImageBackend& pal, uint32_t offset) -{ - assert(isColorIndexed); - size_t bytePerPixel = pal.GetBytesPerPixel(); - - for (size_t y = 0; y < pal.height; y++) - { - for (size_t x = 0; x < pal.width; x++) - { - size_t index = y * pal.width + x; - if (index >= paletteSize) - { - /* - * Some TLUTs are bigger than 256 colors. - * For those cases, we will only take the first 256 - * to colorize this CI texture. - */ - return; - } - - uint8_t r = pal.pixelMatrix[y][x * bytePerPixel + 0]; - uint8_t g = pal.pixelMatrix[y][x * bytePerPixel + 1]; - uint8_t b = pal.pixelMatrix[y][x * bytePerPixel + 2]; - uint8_t a = pal.pixelMatrix[y][x * bytePerPixel + 3]; - SetPaletteIndex(index + offset, r, g, b, a); - } - } -} - -uint32_t ImageBackend::GetWidth() const -{ - return width; -} - -uint32_t ImageBackend::GetHeight() const -{ - return height; -} - -uint8_t ImageBackend::GetColorType() const -{ - return colorType; -} - -uint8_t ImageBackend::GetBitDepth() const -{ - return bitDepth; -} - -double ImageBackend::GetBytesPerPixel() const -{ - switch (colorType) - { - case PNG_COLOR_TYPE_RGBA: - return 4 * bitDepth / 8; - - case PNG_COLOR_TYPE_RGB: - return 3 * bitDepth / 8; - - case PNG_COLOR_TYPE_PALETTE: - return 1 * bitDepth / 8; - - default: - HANDLE_ERROR(WarningType::InvalidPNG, "invalid color type", ""); - } -} - -void ImageBackend::FreeImageData() -{ - if (hasImageData) - { - for (size_t y = 0; y < height; y++) - free(pixelMatrix[y]); - free(pixelMatrix); - pixelMatrix = nullptr; - } - - if (isColorIndexed) - { - free(colorPalette); - free(alphaPalette); - colorPalette = nullptr; - alphaPalette = nullptr; - isColorIndexed = false; - } - - hasImageData = false; -} - -/* RGBAPixel */ - -void RGBAPixel::SetRGBA(uint8_t nR, uint8_t nG, uint8_t nB, uint8_t nA) -{ - r = nR; - g = nG; - b = nB; - a = nA; -} - -void RGBAPixel::SetGrayscale(uint8_t grayscale, uint8_t alpha) -{ - r = grayscale; - g = grayscale; - b = grayscale; - a = alpha; -} diff --git a/tools/ZAPD/ZAPD/ImageBackend.h b/tools/ZAPD/ZAPD/ImageBackend.h deleted file mode 100644 index 0b1f4806c0..0000000000 --- a/tools/ZAPD/ZAPD/ImageBackend.h +++ /dev/null @@ -1,72 +0,0 @@ -#pragma once - -#include -#include - -#include "Utils/Directory.h" - -class RGBAPixel -{ -public: - RGBAPixel() = default; - - void SetRGBA(uint8_t nR, uint8_t nG, uint8_t nB, uint8_t nA); - void SetGrayscale(uint8_t grayscale, uint8_t alpha = 0); - - uint8_t r = 0; - uint8_t g = 0; - uint8_t b = 0; - uint8_t a = 0; -}; - -class ImageBackend -{ -public: - ImageBackend() = default; - ~ImageBackend(); - - void ReadPng(const char* filename); - void ReadPng(const fs::path& filename); - void WritePng(const char* filename); - void WritePng(const fs::path& filename); - - void SetTextureData(const std::vector>& texData, uint32_t nWidth, - uint32_t nHeight, uint8_t nColorType, uint8_t nBitDepth); - void InitEmptyRGBImage(uint32_t nWidth, uint32_t nHeight, bool alpha); - void InitEmptyPaletteImage(uint32_t nWidth, uint32_t nHeight); - - RGBAPixel GetPixel(size_t y, size_t x) const; - uint8_t GetIndexedPixel(size_t y, size_t x) const; - - void SetRGBPixel(size_t y, size_t x, uint8_t nR, uint8_t nG, uint8_t nB, uint8_t nA = 0); - void SetGrayscalePixel(size_t y, size_t x, uint8_t grayscale, uint8_t alpha = 0); - - void SetIndexedPixel(size_t y, size_t x, uint8_t index, uint8_t grayscale); - void SetIndexedPixel(size_t y, size_t x, uint8_t index, RGBAPixel pixel); - void SetPaletteIndex(size_t index, uint8_t nR, uint8_t nG, uint8_t nB, uint8_t nA); - void SetPalette(const ImageBackend& pal, uint32_t offset = 0); - - uint32_t GetWidth() const; - uint32_t GetHeight() const; - uint8_t GetColorType() const; - uint8_t GetBitDepth() const; - -protected: - uint8_t** pixelMatrix = nullptr; // height * [width * bytePerPixel] - - void* colorPalette = nullptr; - uint8_t* alphaPalette = nullptr; - size_t paletteSize = 16 * 16; - - uint32_t width = 0; - uint32_t height = 0; - uint8_t colorType = 0; - uint8_t bitDepth = 0; - - bool hasImageData = false; - bool isColorIndexed = false; - - double GetBytesPerPixel() const; - - void FreeImageData(); -}; diff --git a/tools/ZAPD/ZAPD/Main.cpp b/tools/ZAPD/ZAPD/Main.cpp deleted file mode 100644 index 19d10d7d96..0000000000 --- a/tools/ZAPD/ZAPD/Main.cpp +++ /dev/null @@ -1,532 +0,0 @@ -#include "Globals.h" -#include "Utils/Directory.h" -#include "Utils/File.h" -#include "Utils/Path.h" -#include "WarningHandler.h" -#include "ZAnimation.h" -#include "ZBackground.h" -#include "ZBlob.h" -#include "ZFile.h" -#include "ZTexture.h" - -#include -#include "CrashHandler.h" - -#include -#include -#include "tinyxml2.h" - -using ArgFunc = void (*)(int&, char**); - -void Arg_SetOutputPath(int& i, char* argv[]); -void Arg_SetInputPath(int& i, char* argv[]); -void Arg_SetBaseromPath(int& i, char* argv[]); -void Arg_SetSourceOutputPath(int& i, char* argv[]); -void Arg_GenerateSourceFile(int& i, char* argv[]); -void Arg_TestMode(int& i, char* argv[]); -void Arg_LegacyDList(int& i, char* argv[]); -void Arg_EnableProfiling(int& i, char* argv[]); -void Arg_UseExternalResources(int& i, char* argv[]); -void Arg_SetTextureType(int& i, char* argv[]); -void Arg_ReadConfigFile(int& i, char* argv[]); -void Arg_EnableErrorHandler(int& i, char* argv[]); -void Arg_SetVerbosity(int& i, char* argv[]); -void Arg_VerboseUnaccounted(int& i, char* argv[]); -void Arg_SetExporter(int& i, char* argv[]); -void Arg_EnableGCCCompat(int& i, char* argv[]); -void Arg_ForceStatic(int& i, char* argv[]); -void Arg_ForceUnaccountedStatic(int& i, char* argv[]); -void Arg_CsFloatMode(int& i, char* argv[]); -void Arg_BaseAddress(int& i, char* argv[]); -void Arg_StartOffset(int& i, char* argv[]); -void Arg_EndOffset(int& i, char* argv[]); - -int main(int argc, char* argv[]); - -bool Parse(const fs::path& xmlFilePath, const fs::path& basePath, const fs::path& outPath, - ZFileMode fileMode); - -void ParseArgs(int& argc, char* argv[]); - -void BuildAssetTexture(const fs::path& pngFilePath, TextureType texType, const fs::path& outPath); -void BuildAssetBackground(const fs::path& imageFilePath, const fs::path& outPath); -void BuildAssetBlob(const fs::path& blobFilePath, const fs::path& outPath); -ZFileMode ParseFileMode(const std::string& buildMode, ExporterSet* exporterSet); -int HandleExtract(ZFileMode fileMode, ExporterSet* exporterSet); - -extern const char gBuildHash[]; - -int main(int argc, char* argv[]) -{ - int returnCode = 0; - - if (argc < 2) - { - printf("ZAPD.out (%s) [mode (btex/bovl/bsf/bblb/bmdlintr/bamnintr/e)] ...\n", gBuildHash); - return 1; - } - - Globals* g = new Globals(); - WarningHandler::Init(argc, argv); - - for (int i = 1; i < argc; i++) - { - if (!strcmp(argv[i], "--version")) - { - printf("ZAPD.out %s\n", gBuildHash); - return 0; - } - else if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) - { - printf("Congratulations!\n"); - printf("You just found the (unimplemented and undocumented) ZAPD's help message.\n"); - printf("Feel free to implement it if you want :D\n"); - - WarningHandler::PrintHelp(); - return 0; - } - } - - ParseArgs(argc, argv); - - // Parse File Mode - ExporterSet* exporterSet = Globals::Instance->GetExporterSet(); - std::string buildMode = argv[1]; - ZFileMode fileMode = ParseFileMode(buildMode, exporterSet); - - if (fileMode == ZFileMode::Invalid) - { - printf("Error: Invalid file mode '%s'\n", buildMode.c_str()); - return 1; - } - - // We've parsed through our commands once. If an exporter exists, it's been set by now. - // Now we'll parse through them again but pass them on to our exporter if one is available. - if (exporterSet != nullptr && exporterSet->parseArgsFunc != nullptr) - { - for (int32_t i = 2; i < argc; i++) - exporterSet->parseArgsFunc(argc, argv, i); - } - - if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_INFO) - printf("ZAPD: Zelda Asset Processor For Decomp: %s\n", gBuildHash); - - if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_DEBUG) - WarningHandler::PrintWarningsDebugInfo(); - - if (fileMode == ZFileMode::Extract || fileMode == ZFileMode::BuildSourceFile) - returnCode = HandleExtract(fileMode, exporterSet); - else if (fileMode == ZFileMode::BuildTexture) - BuildAssetTexture(Globals::Instance->inputPath, Globals::Instance->texType, - Globals::Instance->outputPath); - else if (fileMode == ZFileMode::BuildBackground) - BuildAssetBackground(Globals::Instance->inputPath, Globals::Instance->outputPath); - else if (fileMode == ZFileMode::BuildBlob) - BuildAssetBlob(Globals::Instance->inputPath, Globals::Instance->outputPath); - - delete g; - return returnCode; -} - -bool Parse(const fs::path& xmlFilePath, const fs::path& basePath, const fs::path& outPath, - ZFileMode fileMode) -{ - tinyxml2::XMLDocument doc; - tinyxml2::XMLError eResult = doc.LoadFile(xmlFilePath.string().c_str()); - - if (eResult != tinyxml2::XML_SUCCESS) - { - // TODO: use XMLDocument::ErrorIDToName to get more specific error messages here - HANDLE_ERROR(WarningType::InvalidXML, - StringHelper::Sprintf("invalid XML file: '%s'", xmlFilePath.c_str()), ""); - return false; - } - - tinyxml2::XMLNode* root = doc.FirstChild(); - - if (root == nullptr) - { - HANDLE_WARNING( - WarningType::InvalidXML, - StringHelper::Sprintf("missing Root tag in xml file: '%s'", xmlFilePath.c_str()), ""); - return false; - } - - for (tinyxml2::XMLElement* child = root->FirstChildElement(); child != NULL; - child = child->NextSiblingElement()) - { - if (std::string_view(child->Name()) == "File") - { - ZFile* file = new ZFile(fileMode, child, basePath, outPath, "", xmlFilePath); - Globals::Instance->files.push_back(file); - if (fileMode == ZFileMode::ExternalFile) - { - Globals::Instance->externalFiles.push_back(file); - file->isExternalFile = true; - } - } - else if (std::string(child->Name()) == "ExternalFile") - { - const char* xmlPathValue = child->Attribute("XmlPath"); - if (xmlPathValue == nullptr) - { - throw std::runtime_error(StringHelper::Sprintf( - "Parse: Fatal error in '%s'.\n" - "\t Missing 'XmlPath' attribute in `ExternalFile` element.\n", - xmlFilePath.c_str())); - } - const char* outPathValue = child->Attribute("OutPath"); - if (outPathValue == nullptr) - { - throw std::runtime_error(StringHelper::Sprintf( - "Parse: Fatal error in '%s'.\n" - "\t Missing 'OutPath' attribute in `ExternalFile` element.\n", - xmlFilePath.c_str())); - } - - fs::path externalXmlFilePath = - Globals::Instance->cfg.externalXmlFolder / fs::path(xmlPathValue); - fs::path externalOutFilePath = fs::path(outPathValue); - - if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_INFO) - { - printf("Parsing external file: '%s'\n", externalXmlFilePath.c_str()); - } - - // Recursion. What can go wrong? - Parse(externalXmlFilePath, basePath, externalOutFilePath, ZFileMode::ExternalFile); - } - else - { - std::string errorHeader = - StringHelper::Sprintf("when parsing file '%s'", xmlFilePath.c_str()); - std::string errorBody = StringHelper::Sprintf( - "Found a resource outside a File element: '%s'", child->Name()); - HANDLE_ERROR(WarningType::InvalidXML, errorHeader, errorBody); - } - } - - if (fileMode != ZFileMode::ExternalFile) - { - ExporterSet* exporterSet = Globals::Instance->GetExporterSet(); - - if (exporterSet != nullptr && exporterSet->beginXMLFunc != nullptr) - exporterSet->beginXMLFunc(); - - for (ZFile* file : Globals::Instance->files) - { - if (fileMode == ZFileMode::BuildSourceFile) - file->BuildSourceFile(); - else - file->ExtractResources(); - } - - if (exporterSet != nullptr && exporterSet->endXMLFunc != nullptr) - exporterSet->endXMLFunc(); - } - - return true; -} - -void ParseArgs(int& argc, char* argv[]) -{ - static const std::unordered_map ArgFuncDictionary = { - {"-o", &Arg_SetOutputPath}, - {"--outputpath", &Arg_SetOutputPath}, - {"-i", &Arg_SetInputPath}, - {"--inputpath", &Arg_SetInputPath}, - {"-b", &Arg_SetBaseromPath}, - {"--baserompath", &Arg_SetBaseromPath}, - {"-osf", &Arg_SetSourceOutputPath}, - {"-gsf", &Arg_GenerateSourceFile}, - {"-tm", &Arg_TestMode}, - {"-ulzdl", &Arg_LegacyDList}, - {"-profile", &Arg_EnableProfiling}, - {"-uer", &Arg_UseExternalResources}, - {"-tt", &Arg_SetTextureType}, - {"-rconf", &Arg_ReadConfigFile}, - {"-eh", &Arg_EnableErrorHandler}, - {"-v", &Arg_SetVerbosity}, - {"-vu", &Arg_VerboseUnaccounted}, - {"--verbose-unaccounted", &Arg_VerboseUnaccounted}, - {"-se", &Arg_SetExporter}, - {"--set-exporter", &Arg_SetExporter}, - {"--gcc-compat", &Arg_EnableGCCCompat}, - {"-s", &Arg_ForceStatic}, - {"--static", &Arg_ForceStatic}, - {"-us", &Arg_ForceUnaccountedStatic}, - {"--unaccounted-static", &Arg_ForceUnaccountedStatic}, - {"--cs-float", &Arg_CsFloatMode}, - {"--base-address", &Arg_BaseAddress}, - {"--start-offset", &Arg_StartOffset}, - {"--end-offset", &Arg_EndOffset}, - }; - - for (int32_t i = 2; i < argc; i++) - { - std::string arg = argv[i]; - - // Ignore warning args as they have already been parsed - if (arg.length() > 2 && arg[0] == '-' && arg[1] == 'W' && arg[2] != '\0') - { - continue; - } - - auto it = ArgFuncDictionary.find(arg); - if (it == ArgFuncDictionary.end()) - { - fprintf(stderr, "Unsupported argument: %s\n", arg.c_str()); - continue; - } - - std::invoke(it->second, i, argv); - } -} - -ZFileMode ParseFileMode(const std::string& buildMode, ExporterSet* exporterSet) -{ - ZFileMode fileMode = ZFileMode::Invalid; - - if (buildMode == "btex") - fileMode = ZFileMode::BuildTexture; - else if (buildMode == "bren") - fileMode = ZFileMode::BuildBackground; - else if (buildMode == "bsf") - fileMode = ZFileMode::BuildSourceFile; - else if (buildMode == "bblb") - fileMode = ZFileMode::BuildBlob; - else if (buildMode == "e") - fileMode = ZFileMode::Extract; - else if (exporterSet != nullptr && exporterSet->parseFileModeFunc != nullptr) - exporterSet->parseFileModeFunc(buildMode, fileMode); - - return fileMode; -} - -void Arg_SetOutputPath(int& i, [[maybe_unused]] char* argv[]) -{ - Globals::Instance->outputPath = argv[++i]; - - if (Globals::Instance->sourceOutputPath == "") - Globals::Instance->sourceOutputPath = Globals::Instance->outputPath; -} - -void Arg_SetInputPath(int& i, char* argv[]) -{ - Globals::Instance->inputPath = argv[++i]; -} - -void Arg_SetBaseromPath(int& i, char* argv[]) -{ - Globals::Instance->baseRomPath = argv[++i]; -} - -void Arg_SetSourceOutputPath(int& i, char* argv[]) -{ - Globals::Instance->sourceOutputPath = argv[++i]; -} - -void Arg_GenerateSourceFile(int& i, char* argv[]) -{ - // Generate source file during extraction - Globals::Instance->genSourceFile = std::string_view(argv[++i]) == "1"; -} - -void Arg_TestMode(int& i, char* argv[]) -{ - // Test Mode (enables certain experimental features) - Globals::Instance->testMode = std::string_view(argv[++i]) == "1"; -} - -void Arg_LegacyDList(int& i, char* argv[]) -{ - Globals::Instance->useLegacyZDList = std::string_view(argv[++i]) == "1"; -} - -void Arg_EnableProfiling(int& i, char* argv[]) -{ - Globals::Instance->profile = std::string_view(argv[++i]) == "1"; -} - -void Arg_UseExternalResources(int& i, char* argv[]) -{ - // Split resources into their individual components(enabled by default) - // TODO: We may wish to make this a part of the config file... - Globals::Instance->useExternalResources = std::string_view(argv[++i]) == "1"; -} - -void Arg_SetTextureType(int& i, char* argv[]) -{ - Globals::Instance->texType = ZTexture::GetTextureTypeFromString(argv[++i]); -} - -void Arg_ReadConfigFile(int& i, char* argv[]) -{ - Globals::Instance->cfg.ReadConfigFile(argv[++i]); -} - -void Arg_EnableErrorHandler([[maybe_unused]] int& i, [[maybe_unused]] char* argv[]) -{ - CrashHandler_Init(); -} - -void Arg_SetVerbosity(int& i, char* argv[]) -{ - Globals::Instance->verbosity = static_cast(strtol(argv[++i], NULL, 16)); -} - -void Arg_VerboseUnaccounted([[maybe_unused]] int& i, [[maybe_unused]] char* argv[]) -{ - Globals::Instance->verboseUnaccounted = true; -} - -void Arg_SetExporter(int& i, char* argv[]) -{ - Globals::Instance->currentExporter = argv[++i]; -} - -void Arg_EnableGCCCompat([[maybe_unused]] int& i, [[maybe_unused]] char* argv[]) -{ - Globals::Instance->gccCompat = true; -} - -void Arg_ForceStatic([[maybe_unused]] int& i, [[maybe_unused]] char* argv[]) -{ - Globals::Instance->forceStatic = true; -} - -void Arg_ForceUnaccountedStatic([[maybe_unused]] int& i, [[maybe_unused]] char* argv[]) -{ - Globals::Instance->forceUnaccountedStatic = true; -} - -void Arg_CsFloatMode([[maybe_unused]] int& i, [[maybe_unused]] char* argv[]) -{ - i++; - if (std::strcmp(argv[i], "hex") == 0) - { - Globals::Instance->floatType = CsFloatType::HexOnly; - } - else if (std::strcmp(argv[i], "float") == 0) - { - Globals::Instance->floatType = CsFloatType::FloatOnly; - } - else if (std::strcmp(argv[i], "both") == 0) - { - Globals::Instance->floatType = CsFloatType::HexAndFloat; - } - else if (std::strcmp(argv[i], "hex-commented-left") == 0) - { - Globals::Instance->floatType = CsFloatType::HexAndCommentedFloatLeft; - } - else if (std::strcmp(argv[i], "hex-commented-right") == 0) - { - Globals::Instance->floatType = CsFloatType::HexAndCommentedFloatRight; - } - else - { - Globals::Instance->floatType = CsFloatType::FloatOnly; - HANDLE_WARNING( - WarningType::Always, "Invalid CS Float Type", - StringHelper::Sprintf("Invalid CS float type entered. Expected \"hex\", \"float\", " - "\"both\", \"hex-commented-left\" or \"hex-commented-right\". " - "Got %s.\n Defaulting to \"float\".", - argv[i])); - } -} - -uint32_t ParseU32Hex(char* str) -{ - static_assert(sizeof(uint32_t) <= sizeof(unsigned long)); - return (uint32_t)std::stoul(str, nullptr, 16); -} - -void Arg_BaseAddress(int& i, char* argv[]) -{ - Globals::Instance->baseAddress = ParseU32Hex(argv[++i]); -} - -void Arg_StartOffset(int& i, char* argv[]) -{ - Globals::Instance->startOffset = ParseU32Hex(argv[++i]); -} - -void Arg_EndOffset(int& i, char* argv[]) -{ - Globals::Instance->endOffset = ParseU32Hex(argv[++i]); -} - -int HandleExtract(ZFileMode fileMode, ExporterSet* exporterSet) -{ - bool procFileModeSuccess = false; - - if (exporterSet != nullptr && exporterSet->processFileModeFunc != nullptr) - procFileModeSuccess = exporterSet->processFileModeFunc(fileMode); - - if (!procFileModeSuccess) - { - bool parseSuccessful; - - for (auto& extFile : Globals::Instance->cfg.externalFiles) - { - fs::path externalXmlFilePath = - Globals::Instance->cfg.externalXmlFolder / extFile.xmlPath; - - if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_INFO) - printf("Parsing external file from config: '%s'\n", externalXmlFilePath.c_str()); - - parseSuccessful = Parse(externalXmlFilePath, Globals::Instance->baseRomPath, - extFile.outPath, ZFileMode::ExternalFile); - - if (!parseSuccessful) - return 1; - } - - parseSuccessful = Parse(Globals::Instance->inputPath, Globals::Instance->baseRomPath, - Globals::Instance->outputPath, fileMode); - if (!parseSuccessful) - return 1; - } - - return 0; -} - -void BuildAssetTexture(const fs::path& pngFilePath, TextureType texType, const fs::path& outPath) -{ - std::string name = outPath.stem().string(); - - ZTexture tex(nullptr); - - if (name.find("u32") != std::string::npos) - tex.dWordAligned = false; - - tex.FromPNG(pngFilePath.string(), texType); - std::string cfgPath = StringHelper::Split(pngFilePath.string(), ".")[0] + ".cfg"; - - if (File::Exists(cfgPath)) - name = File::ReadAllText(cfgPath); - - std::string src = tex.GetBodySourceCode(); - - File::WriteAllText(outPath.string(), src); -} - -void BuildAssetBackground(const fs::path& imageFilePath, const fs::path& outPath) -{ - ZBackground background(nullptr); - background.ParseBinaryFile(imageFilePath.string(), false); - - File::WriteAllText(outPath.string(), background.GetBodySourceCode()); -} - -void BuildAssetBlob(const fs::path& blobFilePath, const fs::path& outPath) -{ - ZBlob* blob = ZBlob::FromFile(blobFilePath.string()); - std::string name = outPath.stem().string(); // filename without extension - - std::string src = blob->GetBodySourceCode(); - - File::WriteAllText(outPath.string(), src); - - delete blob; -} diff --git a/tools/ZAPD/ZAPD/NuGet/libpng.static.txt b/tools/ZAPD/ZAPD/NuGet/libpng.static.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tools/ZAPD/ZAPD/OtherStructs/CutsceneMM_Commands.cpp b/tools/ZAPD/ZAPD/OtherStructs/CutsceneMM_Commands.cpp deleted file mode 100644 index 960404e598..0000000000 --- a/tools/ZAPD/ZAPD/OtherStructs/CutsceneMM_Commands.cpp +++ /dev/null @@ -1,622 +0,0 @@ -#include "CutsceneMM_Commands.h" - -#include -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "WarningHandler.h" - -#include "ZCutscene.h" - -/**** GENERIC ****/ - -// Specific for command lists where each entry has size 8 bytes -const std::unordered_map csCommandsDescMM = { - {CutsceneMM_CommandType::CS_CMD_MISC, {"CS_MISC", "(%s, %i, %i, %i)"}}, - {CutsceneMM_CommandType::CS_CMD_LIGHT_SETTING, {"CS_LIGHT_SETTING", "(0x%02X, %i, %i)"}}, - {CutsceneMM_CommandType::CS_CMD_TRANSITION, {"CS_TRANSITION", "(%s, %i, %i)"}}, - {CutsceneMM_CommandType::CS_CMD_MOTION_BLUR, {"CS_MOTION_BLUR", "(%s, %i, %i)"}}, - {CutsceneMM_CommandType::CS_CMD_GIVE_TATL, {"CS_GIVE_TATL", "(%s, %i, %i)"}}, - {CutsceneMM_CommandType::CS_CMD_START_SEQ, {"CS_START_SEQ", "(%s, %i, %i)"}}, - {CutsceneMM_CommandType::CS_CMD_SFX_REVERB_INDEX_2, - {"CS_SFX_REVERB_INDEX_2", "(0x%04X, %i, %i)"}}, - {CutsceneMM_CommandType::CS_CMD_SFX_REVERB_INDEX_1, - {"CS_SFX_REVERB_INDEX_1", "(0x%04X, %i, %i)"}}, - {CutsceneMM_CommandType::CS_CMD_MODIFY_SEQ, {"CS_MODIFY_SEQ", "(%s, %i, %i)"}}, - {CutsceneMM_CommandType::CS_CMD_STOP_SEQ, {"CS_STOP_SEQ", "(%s, %i, %i, %i)"}}, - {CutsceneMM_CommandType::CS_CMD_START_AMBIENCE, {"CS_START_AMBIENCE", "(0x%04X, %i, %i)"}}, - {CutsceneMM_CommandType::CS_CMD_FADE_OUT_AMBIENCE, - {"CS_FADE_OUT_AMBIENCE", "(0x%04X, %i, %i)"}}, - {CutsceneMM_CommandType::CS_CMD_DESTINATION, {"CS_DESTINATION", "(%s, %i, %i)"}}, - {CutsceneMM_CommandType::CS_CMD_CHOOSE_CREDITS_SCENES, - {"CS_CHOOSE_CREDITS_SCENES", "(%s, %i, %i)"}}, -}; - -CutsceneMMSubCommandEntry_GenericCmd::CutsceneMMSubCommandEntry_GenericCmd( - const std::vector& rawData, offset_t rawDataIndex, CutsceneMM_CommandType cmdId) - : CutsceneSubCommandEntry(rawData, rawDataIndex), commandId(cmdId) -{ -} - -std::string CutsceneMMSubCommandEntry_GenericCmd::GetBodySourceCode() const -{ - EnumData* enumData = &Globals::Instance->cfg.enumData; - const auto& element = csCommandsDescMM.find(commandId); - std::string entryFmt = "CS_UNK_DATA(0x%02X, %i, %i, %i)"; - std::string type = ""; - bool isIndexInSeqId = enumData->seqId.find(base - 1) != enumData->seqId.end(); - - if (element != csCommandsDescMM.end()) - { - entryFmt = element->second.cmdMacro; - entryFmt += element->second.args; - } - - if (commandId == CutsceneMM_CommandType::CS_CMD_MISC && - enumData->miscType.find(base) != enumData->miscType.end()) - type = enumData->miscType[base]; - - else if (commandId == CutsceneMM_CommandType::CS_CMD_TRANSITION && - enumData->transitionType.find(base) != enumData->transitionType.end()) - type = enumData->transitionType[base]; - - else if (commandId == CutsceneMM_CommandType::CS_CMD_MOTION_BLUR && - enumData->motionBlurType.find(base) != enumData->motionBlurType.end()) - type = enumData->motionBlurType[base]; - - else if (commandId == CutsceneMM_CommandType::CS_CMD_MODIFY_SEQ && - enumData->modifySeqType.find(base) != enumData->modifySeqType.end()) - type = enumData->modifySeqType[base]; - - else if (commandId == CutsceneMM_CommandType::CS_CMD_DESTINATION && - enumData->destinationType.find(base) != enumData->destinationType.end()) - type = enumData->destinationType[base]; - - else if (commandId == CutsceneMM_CommandType::CS_CMD_CHOOSE_CREDITS_SCENES && - enumData->chooseCreditsSceneType.find(base) != enumData->chooseCreditsSceneType.end()) - type = enumData->chooseCreditsSceneType[base]; - - else if ((commandId == CutsceneMM_CommandType::CS_CMD_START_SEQ || - commandId == CutsceneMM_CommandType::CS_CMD_STOP_SEQ) && - isIndexInSeqId) - type = enumData->seqId[base - 1]; - - else if (commandId == CutsceneMM_CommandType::CS_CMD_GIVE_TATL) - type = base ? "true" : "false"; - - if (type != "") - return StringHelper::Sprintf(entryFmt.c_str(), type.c_str(), startFrame, endFrame, pad); - - if (commandId == CutsceneMM_CommandType::CS_CMD_LIGHT_SETTING || - commandId == CutsceneMM_CommandType::CS_CMD_START_SEQ || - commandId == CutsceneMM_CommandType::CS_CMD_STOP_SEQ) - { - return StringHelper::Sprintf(entryFmt.c_str(), base - 1, startFrame, endFrame, pad); - } - - return StringHelper::Sprintf(entryFmt.c_str(), base, startFrame, endFrame, pad); -} - -CutsceneMMCommand_GenericCmd::CutsceneMMCommand_GenericCmd(const std::vector& rawData, - offset_t rawDataIndex, - CutsceneMM_CommandType cmdId) - : CutsceneCommand(rawData, rawDataIndex) -{ - rawDataIndex += 4; - - commandID = static_cast(cmdId); - - entries.reserve(numEntries); - for (size_t i = 0; i < numEntries; i++) - { - auto* entry = new CutsceneMMSubCommandEntry_GenericCmd(rawData, rawDataIndex, cmdId); - entries.push_back(entry); - rawDataIndex += entry->GetRawSize(); - } -} - -std::string CutsceneMMCommand_GenericCmd::GetCommandMacro() const -{ - const auto& element = csCommandsDescMM.find(static_cast(commandID)); - - if (element != csCommandsDescMM.end()) - { - return StringHelper::Sprintf("%s_LIST(%i)", element->second.cmdMacro, numEntries); - } - - return StringHelper::Sprintf("CS_UNK_DATA_LIST(0x%X, %i)", commandID, numEntries); -} - -/**** CAMERA ****/ - -CutsceneSubCommandEntry_SplineCamPoint::CutsceneSubCommandEntry_SplineCamPoint( - const std::vector& rawData, offset_t rawDataIndex) - : CutsceneSubCommandEntry(rawData, rawDataIndex) -{ - interpType = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0); - weight = BitConverter::ToUInt8BE(rawData, rawDataIndex + 1); - duration = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2); - posX = BitConverter::ToUInt16BE(rawData, rawDataIndex + 4); - posY = BitConverter::ToUInt16BE(rawData, rawDataIndex + 6); - posZ = BitConverter::ToUInt16BE(rawData, rawDataIndex + 8); - relTo = BitConverter::ToUInt16BE(rawData, rawDataIndex + 10); -} - -std::string CutsceneSubCommandEntry_SplineCamPoint::GetBodySourceCode() const -{ - const auto interpTypeMap = &Globals::Instance->cfg.enumData.interpType; - const auto relToMap = &Globals::Instance->cfg.enumData.relTo; - - return StringHelper::Sprintf("CS_CAM_POINT(%s, 0x%02X, 0x%04X, 0x%04X, 0x%04X, 0x%04X, %s)", - interpTypeMap->at(interpType).c_str(), weight, duration, posX, - posY, posZ, relToMap->at(relTo).c_str()); -} - -size_t CutsceneSubCommandEntry_SplineCamPoint::GetRawSize() const -{ - return 0x0C; -} - -CutsceneSubCommandEntry_SplineMiscPoint::CutsceneSubCommandEntry_SplineMiscPoint( - const std::vector& rawData, offset_t rawDataIndex) - : CutsceneSubCommandEntry(rawData, rawDataIndex) -{ - unused0 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0); - roll = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2); - fov = BitConverter::ToUInt16BE(rawData, rawDataIndex + 4); - unused1 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 6); -} - -std::string CutsceneSubCommandEntry_SplineMiscPoint::GetBodySourceCode() const -{ - return StringHelper::Sprintf("CS_CAM_MISC(0x%04X, 0x%04X, 0x%04X, 0x%04X)", unused0, roll, fov, - unused1); -} - -size_t CutsceneSubCommandEntry_SplineMiscPoint::GetRawSize() const -{ - return 0x08; -} - -CutsceneSubCommandEntry_SplineHeader::CutsceneSubCommandEntry_SplineHeader( - const std::vector& rawData, offset_t rawDataIndex) - : CutsceneSubCommandEntry(rawData, rawDataIndex) -{ - numEntries = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0); - unused0 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2); - unused1 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 4); - duration = BitConverter::ToUInt16BE(rawData, rawDataIndex + 6); -} - -std::string CutsceneSubCommandEntry_SplineHeader::GetBodySourceCode() const -{ - return StringHelper::Sprintf("CS_CAM_SPLINE(0x%04X, 0x%04X, 0x%04X, 0x%04X)", numEntries, - unused0, unused1, duration); -} - -size_t CutsceneSubCommandEntry_SplineHeader::GetRawSize() const -{ - return 0x08; -} - -CutsceneSubCommandEntry_SplineFooter::CutsceneSubCommandEntry_SplineFooter( - const std::vector& rawData, offset_t rawDataIndex) - : CutsceneSubCommandEntry(rawData, rawDataIndex) -{ - uint16_t firstHalfWord = BitConverter::ToUInt16BE(rawData, rawDataIndex); - uint16_t secondHalfWord = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2); - - if (firstHalfWord != 0xFFFF || secondHalfWord != 4) - { - HANDLE_ERROR(WarningType::InvalidExtractedData, "Invalid Spline Footer", - StringHelper::Sprintf( - "Invalid Spline footer. Was expecting 0xFFFF, 0x0004. Got 0x%04X, 0x%04X", - firstHalfWord, secondHalfWord)); - } -} - -std::string CutsceneSubCommandEntry_SplineFooter::GetBodySourceCode() const -{ - return "CS_CAM_END()"; -} - -size_t CutsceneSubCommandEntry_SplineFooter::GetRawSize() const -{ - return 0x04; -} - -CutsceneMMCommand_Spline::CutsceneMMCommand_Spline(const std::vector& rawData, - offset_t rawDataIndex) - : CutsceneCommand(rawData, rawDataIndex) -{ - numHeaders = 0; - totalCommands = 0; - rawDataIndex += 4; - - while (1) - { - if (BitConverter::ToUInt16BE(rawData, rawDataIndex) == 0xFFFF) - { - break; - } - numHeaders++; - - auto* header = new CutsceneSubCommandEntry_SplineHeader(rawData, rawDataIndex); - rawDataIndex += header->GetRawSize(); - entries.push_back(header); - - totalCommands += header->numEntries; - - for (uint32_t i = 0; i < header->numEntries; i++) - { - auto* entry = new CutsceneSubCommandEntry_SplineCamPoint(rawData, rawDataIndex); - entries.push_back(entry); - rawDataIndex += entry->GetRawSize(); - } - - for (uint32_t i = 0; i < header->numEntries; i++) - { - auto* entry = new CutsceneSubCommandEntry_SplineCamPoint(rawData, rawDataIndex); - entries.push_back(entry); - rawDataIndex += entry->GetRawSize(); - } - - for (uint32_t i = 0; i < header->numEntries; i++) - { - auto* entry = new CutsceneSubCommandEntry_SplineMiscPoint(rawData, rawDataIndex); - entries.push_back(entry); - rawDataIndex += entry->GetRawSize(); - } - } - - auto* footer = new CutsceneSubCommandEntry_SplineFooter(rawData, rawDataIndex); - entries.push_back(footer); - rawDataIndex += footer->GetRawSize(); -} - -std::string CutsceneMMCommand_Spline::GetCommandMacro() const -{ - return StringHelper::Sprintf("CS_CAM_SPLINE_LIST(%i)", numEntries); -} - -size_t CutsceneMMCommand_Spline::GetCommandSize() const -{ - // 8 Bytes once for the spline command, 8 Bytes per spline the header, two groups of size 12, 1 - // group of size 8, 4 bytes for the footer. - return 8 + (8 * numHeaders) + ((totalCommands * 2) * 0xC) + (totalCommands * 8) + 4; -} - -/**** TRANSITION GENERAL ****/ - -CutsceneSubCommandEntry_TransitionGeneral::CutsceneSubCommandEntry_TransitionGeneral( - const std::vector& rawData, offset_t rawDataIndex) - : CutsceneSubCommandEntry(rawData, rawDataIndex) -{ - unk_06 = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x06); - unk_07 = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x07); - unk_08 = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x08); - unk_09 = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x09); - unk_0A = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x0A); - unk_0B = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x0B); -} - -std::string CutsceneSubCommandEntry_TransitionGeneral::GetBodySourceCode() const -{ - EnumData* enumData = &Globals::Instance->cfg.enumData; - - if (enumData->transitionGeneralType.find(base) != enumData->transitionGeneralType.end()) - return StringHelper::Sprintf("CS_TRANSITION_GENERAL(%s, %i, %i, %i, %i, %i)", - enumData->transitionGeneralType[base].c_str(), startFrame, - endFrame, unk_06, unk_07, unk_08); - - return StringHelper::Sprintf("CS_TRANSITION_GENERAL(0x%02X, %i, %i, %i, %i, %i)", base, - startFrame, endFrame, unk_06, unk_07, unk_08); -} - -size_t CutsceneSubCommandEntry_TransitionGeneral::GetRawSize() const -{ - return 0x0C; -} - -CutsceneMMCommand_TransitionGeneral::CutsceneMMCommand_TransitionGeneral( - const std::vector& rawData, offset_t rawDataIndex) - : CutsceneCommand(rawData, rawDataIndex) -{ - rawDataIndex += 4; - - entries.reserve(numEntries); - for (size_t i = 0; i < numEntries; i++) - { - auto* entry = new CutsceneSubCommandEntry_TransitionGeneral(rawData, rawDataIndex); - entries.push_back(entry); - rawDataIndex += entry->GetRawSize(); - } -} - -std::string CutsceneMMCommand_TransitionGeneral::GetCommandMacro() const -{ - return StringHelper::Sprintf("CS_TRANSITION_GENERAL_LIST(%i)", numEntries); -} - -CutsceneSubCommandEntry_FadeOutSeq::CutsceneSubCommandEntry_FadeOutSeq( - const std::vector& rawData, offset_t rawDataIndex) - : CutsceneSubCommandEntry(rawData, rawDataIndex) -{ - unk_08 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 8); -} - -/**** FADE OUT SEQUENCE ****/ - -std::string CutsceneSubCommandEntry_FadeOutSeq::GetBodySourceCode() const -{ - EnumData* enumData = &Globals::Instance->cfg.enumData; - - if (enumData->fadeOutSeqPlayer.find(base) != enumData->fadeOutSeqPlayer.end()) - return StringHelper::Sprintf("CS_FADE_OUT_SEQ(%s, %i, %i)", - enumData->fadeOutSeqPlayer[base].c_str(), startFrame, - endFrame); - - return StringHelper::Sprintf("CS_FADE_OUT_SEQ(%i, %i, %i)", base, startFrame, endFrame); -} - -size_t CutsceneSubCommandEntry_FadeOutSeq::GetRawSize() const -{ - return 0x0C; -} - -CutsceneMMCommand_FadeOutSeq::CutsceneMMCommand_FadeOutSeq(const std::vector& rawData, - offset_t rawDataIndex) - : CutsceneCommand(rawData, rawDataIndex) -{ - rawDataIndex += 4; - - entries.reserve(numEntries); - for (size_t i = 0; i < numEntries; i++) - { - auto* entry = new CutsceneSubCommandEntry_FadeOutSeq(rawData, rawDataIndex); - entries.push_back(entry); - rawDataIndex += entry->GetRawSize(); - } -} - -std::string CutsceneMMCommand_FadeOutSeq::GetCommandMacro() const -{ - return StringHelper::Sprintf("CS_FADE_OUT_SEQ_LIST(%i)", numEntries); -} - -/**** NON IMPLEMENTED ****/ - -CutsceneSubCommandEntry_NonImplemented::CutsceneSubCommandEntry_NonImplemented( - const std::vector& rawData, offset_t rawDataIndex) - : CutsceneSubCommandEntry(rawData, rawDataIndex) -{ -} - -CutsceneMMCommand_NonImplemented::CutsceneMMCommand_NonImplemented( - const std::vector& rawData, offset_t rawDataIndex) - : CutsceneCommand(rawData, rawDataIndex) -{ - rawDataIndex += 4; - - entries.reserve(numEntries); - for (size_t i = 0; i < numEntries; i++) - { - auto* entry = new CutsceneSubCommandEntry_NonImplemented(rawData, rawDataIndex); - entries.push_back(entry); - rawDataIndex += entry->GetRawSize(); - } -} - -/**** RUMBLE ****/ - -CutsceneMMSubCommandEntry_Rumble::CutsceneMMSubCommandEntry_Rumble( - const std::vector& rawData, offset_t rawDataIndex) - : CutsceneSubCommandEntry(rawData, rawDataIndex) -{ - intensity = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x06); - decayTimer = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x07); - decayStep = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x08); -} - -std::string CutsceneMMSubCommandEntry_Rumble::GetBodySourceCode() const -{ - EnumData* enumData = &Globals::Instance->cfg.enumData; - - if (enumData->rumbleType.find(base) != enumData->rumbleType.end()) - return StringHelper::Sprintf("CS_RUMBLE(%s, %i, %i, 0x%02X, 0x%02X, 0x%02X)", - enumData->rumbleType[base].c_str(), startFrame, endFrame, - intensity, decayTimer, decayStep); - - return StringHelper::Sprintf("CS_RUMBLE(0x%04X, %i, %i, 0x%02X, 0x%02X, 0x%02X)", base, - startFrame, endFrame, intensity, decayTimer, decayStep); -} - -size_t CutsceneMMSubCommandEntry_Rumble::GetRawSize() const -{ - return 0x0C; -} - -CutsceneMMCommand_Rumble::CutsceneMMCommand_Rumble(const std::vector& rawData, - offset_t rawDataIndex) - : CutsceneCommand(rawData, rawDataIndex) -{ - rawDataIndex += 4; - - entries.reserve(numEntries); - for (size_t i = 0; i < numEntries; i++) - { - auto* entry = new CutsceneMMSubCommandEntry_Rumble(rawData, rawDataIndex); - entries.push_back(entry); - rawDataIndex += entry->GetRawSize(); - } -} - -std::string CutsceneMMCommand_Rumble::GetCommandMacro() const -{ - return StringHelper::Sprintf("CS_RUMBLE_LIST(%i)", numEntries); -} - -/**** TEXT ****/ - -CutsceneMMSubCommandEntry_Text::CutsceneMMSubCommandEntry_Text(const std::vector& rawData, - offset_t rawDataIndex) - : CutsceneSubCommandEntry(rawData, rawDataIndex) -{ - type = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x6); - textId1 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x8); - textId2 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0xA); -} - -std::string CutsceneMMSubCommandEntry_Text::GetBodySourceCode() const -{ - EnumData* enumData = &Globals::Instance->cfg.enumData; - - if (type == 0xFFFF) - { - return StringHelper::Sprintf("CS_TEXT_NONE(%i, %i)", startFrame, endFrame); - } - - if (type == 2 && - enumData->ocarinaSongActionId.find(base) != enumData->ocarinaSongActionId.end()) - { - return StringHelper::Sprintf("CS_TEXT_OCARINA_ACTION(%s, %i, %i, 0x%X)", - enumData->ocarinaSongActionId[base].c_str(), startFrame, - endFrame, textId1); - } - - switch (type) - { - case 0: - return StringHelper::Sprintf("CS_TEXT_DEFAULT(0x%X, %i, %i, 0x%X, 0x%X)", base, startFrame, - endFrame, textId1, textId2); - - case 1: - return StringHelper::Sprintf("CS_TEXT_TYPE_1(0x%X, %i, %i, 0x%X, 0x%X)", base, startFrame, - endFrame, textId1, textId2); - - case 3: - return StringHelper::Sprintf("CS_TEXT_TYPE_3(0x%X, %i, %i, 0x%X, 0x%X)", base, startFrame, - endFrame, textId1, textId2); - - case 4: - return StringHelper::Sprintf("CS_TEXT_BOSSES_REMAINS(0x%X, %i, %i, 0x%X)", base, startFrame, - endFrame, textId1); - - case 5: - return StringHelper::Sprintf("CS_TEXT_ALL_NORMAL_MASKS(0x%X, %i, %i, 0x%X)", base, - startFrame, endFrame, textId1); - } - - return nullptr; -} - -size_t CutsceneMMSubCommandEntry_Text::GetRawSize() const -{ - return 0x0C; -} - -CutsceneMMCommand_Text::CutsceneMMCommand_Text(const std::vector& rawData, - offset_t rawDataIndex) - : CutsceneCommand(rawData, rawDataIndex) -{ - rawDataIndex += 4; - - entries.reserve(numEntries); - for (size_t i = 0; i < numEntries; i++) - { - auto* entry = new CutsceneMMSubCommandEntry_Text(rawData, rawDataIndex); - entries.push_back(entry); - rawDataIndex += entry->GetRawSize(); - } -} - -std::string CutsceneMMCommand_Text::GetCommandMacro() const -{ - return StringHelper::Sprintf("CS_TEXT_LIST(%i)", numEntries); -} - -/**** ACTOR CUE ****/ - -CutsceneMMSubCommandEntry_ActorCue::CutsceneMMSubCommandEntry_ActorCue( - const std::vector& rawData, offset_t rawDataIndex) - : CutsceneSubCommandEntry(rawData, rawDataIndex) -{ - rotX = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x6); - rotY = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x8); - rotZ = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0xA); - startPosX = BitConverter::ToInt32BE(rawData, rawDataIndex + 0xC); - startPosY = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x10); - startPosZ = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x14); - endPosX = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x18); - endPosY = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x1C); - endPosZ = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x20); - normalX = BitConverter::ToFloatBE(rawData, rawDataIndex + 0x24); - normalY = BitConverter::ToFloatBE(rawData, rawDataIndex + 0x28); - normalZ = BitConverter::ToFloatBE(rawData, rawDataIndex + 0x2C); -} - -std::string CutsceneMMSubCommandEntry_ActorCue::GetBodySourceCode() const -{ - EnumData* enumData = &Globals::Instance->cfg.enumData; - std::string normalXStr = - ZCutscene::GetCsEncodedFloat(normalX, Globals::Instance->floatType, true); - std::string normalYStr = - ZCutscene::GetCsEncodedFloat(normalY, Globals::Instance->floatType, true); - std::string normalZStr = - ZCutscene::GetCsEncodedFloat(normalZ, Globals::Instance->floatType, true); - - if (static_cast(commandID) == CutsceneMM_CommandType::CS_CMD_PLAYER_CUE) - { - return StringHelper::Sprintf("CS_PLAYER_CUE(%s, %i, %i, 0x%04X, 0x%04X, 0x%04X, %i, %i, " - "%i, %i, %i, %i, %s, %s, %s)", - enumData->playerCueId[base].c_str(), startFrame, endFrame, - rotX, rotY, rotZ, startPosX, startPosY, startPosZ, endPosX, - endPosY, endPosZ, normalXStr.c_str(), normalYStr.c_str(), - normalZStr.c_str()); - } - else - { - return StringHelper::Sprintf("CS_ACTOR_CUE(%i, %i, %i, 0x%04X, 0x%04X, 0x%04X, %i, %i, " - "%i, %i, %i, %i, %s, %s, %s)", - base, startFrame, endFrame, rotX, rotY, rotZ, startPosX, - startPosY, startPosZ, endPosX, endPosY, endPosZ, - normalXStr.c_str(), normalYStr.c_str(), normalZStr.c_str()); - } -} - -size_t CutsceneMMSubCommandEntry_ActorCue::GetRawSize() const -{ - return 0x30; -} - -CutsceneMMCommand_ActorCue::CutsceneMMCommand_ActorCue(const std::vector& rawData, - offset_t rawDataIndex) - : CutsceneCommand(rawData, rawDataIndex) -{ - rawDataIndex += 4; - - entries.reserve(numEntries); - for (size_t i = 0; i < numEntries; i++) - { - auto* entry = new CutsceneMMSubCommandEntry_ActorCue(rawData, rawDataIndex); - entries.push_back(entry); - rawDataIndex += entry->GetRawSize(); - } -} - -std::string CutsceneMMCommand_ActorCue::GetCommandMacro() const -{ - EnumData* enumData = &Globals::Instance->cfg.enumData; - - if (static_cast(commandID) == CutsceneMM_CommandType::CS_CMD_PLAYER_CUE) - { - return StringHelper::Sprintf("CS_PLAYER_CUE_LIST(%i)", numEntries); - } - - if (enumData->cutsceneCmd.find(commandID) != enumData->cutsceneCmd.end()) - { - return StringHelper::Sprintf("CS_ACTOR_CUE_LIST(%s, %i)", - enumData->cutsceneCmd[commandID].c_str(), numEntries); - } - return StringHelper::Sprintf("CS_ACTOR_CUE_LIST(0x%03X, %i)", commandID, numEntries); -} diff --git a/tools/ZAPD/ZAPD/OtherStructs/CutsceneMM_Commands.h b/tools/ZAPD/ZAPD/OtherStructs/CutsceneMM_Commands.h deleted file mode 100644 index 597f6788bc..0000000000 --- a/tools/ZAPD/ZAPD/OtherStructs/CutsceneMM_Commands.h +++ /dev/null @@ -1,481 +0,0 @@ -#pragma once - -#include "Cutscene_Common.h" - -// https://github.com/zeldaret/mm/blob/0c7b90cf97f26483c8b6a98ae099a295f61e72ab/include/z64cutscene.h#L294-530 -enum class CutsceneMM_CommandType -{ - /* -2 */ CS_CMD_ACTOR_CUE_POST_PROCESS = -2, - /* -1 */ CS_CAM_STOP, - /* 0x00A */ CS_CMD_TEXT = 10, - /* 0x05A */ CS_CMD_CAMERA_SPLINE = 90, - /* 0x064 */ CS_CMD_ACTOR_CUE_100 = 100, - /* 0x065 */ CS_CMD_ACTOR_CUE_101, - /* 0x066 */ CS_CMD_ACTOR_CUE_102, - /* 0x067 */ CS_CMD_ACTOR_CUE_103, - /* 0x068 */ CS_CMD_ACTOR_CUE_104, - /* 0x069 */ CS_CMD_ACTOR_CUE_105, - /* 0x06A */ CS_CMD_ACTOR_CUE_106, - /* 0x06B */ CS_CMD_ACTOR_CUE_107, - /* 0x06C */ CS_CMD_ACTOR_CUE_108, - /* 0x06D */ CS_CMD_ACTOR_CUE_109, - /* 0x06E */ CS_CMD_ACTOR_CUE_110, - /* 0x06F */ CS_CMD_ACTOR_CUE_111, - /* 0x070 */ CS_CMD_ACTOR_CUE_112, - /* 0x071 */ CS_CMD_ACTOR_CUE_113, - /* 0x072 */ CS_CMD_ACTOR_CUE_114, - /* 0x073 */ CS_CMD_ACTOR_CUE_115, - /* 0x074 */ CS_CMD_ACTOR_CUE_116, - /* 0x075 */ CS_CMD_ACTOR_CUE_117, - /* 0x076 */ CS_CMD_ACTOR_CUE_118, - /* 0x077 */ CS_CMD_ACTOR_CUE_119, - /* 0x078 */ CS_CMD_ACTOR_CUE_120, - /* 0x079 */ CS_CMD_ACTOR_CUE_121, - /* 0x07A */ CS_CMD_ACTOR_CUE_122, - /* 0x07B */ CS_CMD_ACTOR_CUE_123, - /* 0x07C */ CS_CMD_ACTOR_CUE_124, - /* 0x07D */ CS_CMD_ACTOR_CUE_125, - /* 0x07E */ CS_CMD_ACTOR_CUE_126, - /* 0x07F */ CS_CMD_ACTOR_CUE_127, - /* 0x080 */ CS_CMD_ACTOR_CUE_128, - /* 0x081 */ CS_CMD_ACTOR_CUE_129, - /* 0x082 */ CS_CMD_ACTOR_CUE_130, - /* 0x083 */ CS_CMD_ACTOR_CUE_131, - /* 0x084 */ CS_CMD_ACTOR_CUE_132, - /* 0x085 */ CS_CMD_ACTOR_CUE_133, - /* 0x086 */ CS_CMD_ACTOR_CUE_134, - /* 0x087 */ CS_CMD_ACTOR_CUE_135, - /* 0x088 */ CS_CMD_ACTOR_CUE_136, - /* 0x089 */ CS_CMD_ACTOR_CUE_137, - /* 0x08A */ CS_CMD_ACTOR_CUE_138, - /* 0x08B */ CS_CMD_ACTOR_CUE_139, - /* 0x08C */ CS_CMD_ACTOR_CUE_140, - /* 0x08D */ CS_CMD_ACTOR_CUE_141, - /* 0x08E */ CS_CMD_ACTOR_CUE_142, - /* 0x08F */ CS_CMD_ACTOR_CUE_143, - /* 0x090 */ CS_CMD_ACTOR_CUE_144, - /* 0x091 */ CS_CMD_ACTOR_CUE_145, - /* 0x092 */ CS_CMD_ACTOR_CUE_146, - /* 0x093 */ CS_CMD_ACTOR_CUE_147, - /* 0x094 */ CS_CMD_ACTOR_CUE_148, - /* 0x095 */ CS_CMD_ACTOR_CUE_149, - /* 0x096 */ CS_CMD_MISC, - /* 0x097 */ CS_CMD_LIGHT_SETTING, - /* 0x098 */ CS_CMD_TRANSITION, - /* 0x099 */ CS_CMD_MOTION_BLUR, - /* 0x09A */ CS_CMD_GIVE_TATL, - /* 0x09B */ CS_CMD_TRANSITION_GENERAL, - /* 0x09C */ CS_CMD_FADE_OUT_SEQ, - /* 0x09D */ CS_CMD_TIME, - /* 0x0C8 */ CS_CMD_PLAYER_CUE = 200, - /* 0x0C9 */ CS_CMD_ACTOR_CUE_201, - /* 0x0FA */ CS_CMD_UNK_DATA_FA = 0xFA, - /* 0x0FE */ CS_CMD_UNK_DATA_FE = 0xFE, - /* 0x0FF */ CS_CMD_UNK_DATA_FF, - /* 0x100 */ CS_CMD_UNK_DATA_100, - /* 0x101 */ CS_CMD_UNK_DATA_101, - /* 0x102 */ CS_CMD_UNK_DATA_102, - /* 0x103 */ CS_CMD_UNK_DATA_103, - /* 0x104 */ CS_CMD_UNK_DATA_104, - /* 0x105 */ CS_CMD_UNK_DATA_105, - /* 0x108 */ CS_CMD_UNK_DATA_108 = 0x108, - /* 0x109 */ CS_CMD_UNK_DATA_109, - /* 0x12C */ CS_CMD_START_SEQ = 300, - /* 0x12D */ CS_CMD_STOP_SEQ, - /* 0x12E */ CS_CMD_START_AMBIENCE, - /* 0x12F */ CS_CMD_FADE_OUT_AMBIENCE, - /* 0x130 */ CS_CMD_SFX_REVERB_INDEX_2, - /* 0x131 */ CS_CMD_SFX_REVERB_INDEX_1, - /* 0x132 */ CS_CMD_MODIFY_SEQ, - /* 0x15E */ CS_CMD_DESTINATION = 350, - /* 0x15F */ CS_CMD_CHOOSE_CREDITS_SCENES, - /* 0x190 */ CS_CMD_RUMBLE = 400, - /* 0x1C2 */ CS_CMD_ACTOR_CUE_450 = 450, - /* 0x1C3 */ CS_CMD_ACTOR_CUE_451, - /* 0x1C4 */ CS_CMD_ACTOR_CUE_452, - /* 0x1C5 */ CS_CMD_ACTOR_CUE_453, - /* 0x1C6 */ CS_CMD_ACTOR_CUE_454, - /* 0x1C7 */ CS_CMD_ACTOR_CUE_455, - /* 0x1C8 */ CS_CMD_ACTOR_CUE_456, - /* 0x1C9 */ CS_CMD_ACTOR_CUE_457, - /* 0x1CA */ CS_CMD_ACTOR_CUE_458, - /* 0x1CB */ CS_CMD_ACTOR_CUE_459, - /* 0x1CC */ CS_CMD_ACTOR_CUE_460, - /* 0x1CD */ CS_CMD_ACTOR_CUE_461, - /* 0x1CE */ CS_CMD_ACTOR_CUE_462, - /* 0x1CF */ CS_CMD_ACTOR_CUE_463, - /* 0x1D0 */ CS_CMD_ACTOR_CUE_464, - /* 0x1D1 */ CS_CMD_ACTOR_CUE_465, - /* 0x1D2 */ CS_CMD_ACTOR_CUE_466, - /* 0x1D3 */ CS_CMD_ACTOR_CUE_467, - /* 0x1D4 */ CS_CMD_ACTOR_CUE_468, - /* 0x1D5 */ CS_CMD_ACTOR_CUE_469, - /* 0x1D6 */ CS_CMD_ACTOR_CUE_470, - /* 0x1D7 */ CS_CMD_ACTOR_CUE_471, - /* 0x1D8 */ CS_CMD_ACTOR_CUE_472, - /* 0x1D9 */ CS_CMD_ACTOR_CUE_473, - /* 0x1DA */ CS_CMD_ACTOR_CUE_474, - /* 0x1DB */ CS_CMD_ACTOR_CUE_475, - /* 0x1DC */ CS_CMD_ACTOR_CUE_476, - /* 0x1DD */ CS_CMD_ACTOR_CUE_477, - /* 0x1DE */ CS_CMD_ACTOR_CUE_478, - /* 0x1DF */ CS_CMD_ACTOR_CUE_479, - /* 0x1E0 */ CS_CMD_ACTOR_CUE_480, - /* 0x1E1 */ CS_CMD_ACTOR_CUE_481, - /* 0x1E2 */ CS_CMD_ACTOR_CUE_482, - /* 0x1E3 */ CS_CMD_ACTOR_CUE_483, - /* 0x1E4 */ CS_CMD_ACTOR_CUE_484, - /* 0x1E5 */ CS_CMD_ACTOR_CUE_485, - /* 0x1E6 */ CS_CMD_ACTOR_CUE_486, - /* 0x1E7 */ CS_CMD_ACTOR_CUE_487, - /* 0x1E8 */ CS_CMD_ACTOR_CUE_488, - /* 0x1E9 */ CS_CMD_ACTOR_CUE_489, - /* 0x1EA */ CS_CMD_ACTOR_CUE_490, - /* 0x1EB */ CS_CMD_ACTOR_CUE_491, - /* 0x1EC */ CS_CMD_ACTOR_CUE_492, - /* 0x1ED */ CS_CMD_ACTOR_CUE_493, - /* 0x1EE */ CS_CMD_ACTOR_CUE_494, - /* 0x1EF */ CS_CMD_ACTOR_CUE_495, - /* 0x1F0 */ CS_CMD_ACTOR_CUE_496, - /* 0x1F1 */ CS_CMD_ACTOR_CUE_497, - /* 0x1F2 */ CS_CMD_ACTOR_CUE_498, - /* 0x1F3 */ CS_CMD_ACTOR_CUE_499, - /* 0x1F4 */ CS_CMD_ACTOR_CUE_500, - /* 0x1F5 */ CS_CMD_ACTOR_CUE_501, - /* 0x1F6 */ CS_CMD_ACTOR_CUE_502, - /* 0x1F7 */ CS_CMD_ACTOR_CUE_503, - /* 0x1F8 */ CS_CMD_ACTOR_CUE_504, - /* 0x1F9 */ CS_CMD_ACTOR_CUE_SOTCS, - /* 0x1FA */ CS_CMD_ACTOR_CUE_506, - /* 0x1FB */ CS_CMD_ACTOR_CUE_507, - /* 0x1FC */ CS_CMD_ACTOR_CUE_508, - /* 0x1FD */ CS_CMD_ACTOR_CUE_509, - /* 0x1FE */ CS_CMD_ACTOR_CUE_510, - /* 0x1FF */ CS_CMD_ACTOR_CUE_511, - /* 0x200 */ CS_CMD_ACTOR_CUE_512, - /* 0x201 */ CS_CMD_ACTOR_CUE_513, - /* 0x202 */ CS_CMD_ACTOR_CUE_514, - /* 0x203 */ CS_CMD_ACTOR_CUE_515, - /* 0x204 */ CS_CMD_ACTOR_CUE_516, - /* 0x205 */ CS_CMD_ACTOR_CUE_517, - /* 0x206 */ CS_CMD_ACTOR_CUE_518, - /* 0x207 */ CS_CMD_ACTOR_CUE_519, - /* 0x208 */ CS_CMD_ACTOR_CUE_520, - /* 0x209 */ CS_CMD_ACTOR_CUE_521, - /* 0x20A */ CS_CMD_ACTOR_CUE_522, - /* 0x20B */ CS_CMD_ACTOR_CUE_523, - /* 0x20C */ CS_CMD_ACTOR_CUE_524, - /* 0x20D */ CS_CMD_ACTOR_CUE_525, - /* 0x20E */ CS_CMD_ACTOR_CUE_526, - /* 0x20F */ CS_CMD_ACTOR_CUE_527, - /* 0x210 */ CS_CMD_ACTOR_CUE_528, - /* 0x211 */ CS_CMD_ACTOR_CUE_529, - /* 0x212 */ CS_CMD_ACTOR_CUE_530, - /* 0x213 */ CS_CMD_ACTOR_CUE_531, - /* 0x214 */ CS_CMD_ACTOR_CUE_532, - /* 0x215 */ CS_CMD_ACTOR_CUE_533, - /* 0x216 */ CS_CMD_ACTOR_CUE_534, - /* 0x217 */ CS_CMD_ACTOR_CUE_535, - /* 0x218 */ CS_CMD_ACTOR_CUE_536, - /* 0x219 */ CS_CMD_ACTOR_CUE_537, - /* 0x21A */ CS_CMD_ACTOR_CUE_538, - /* 0x21B */ CS_CMD_ACTOR_CUE_539, - /* 0x21C */ CS_CMD_ACTOR_CUE_540, - /* 0x21D */ CS_CMD_ACTOR_CUE_541, - /* 0x21E */ CS_CMD_ACTOR_CUE_542, - /* 0x21F */ CS_CMD_ACTOR_CUE_543, - /* 0x220 */ CS_CMD_ACTOR_CUE_544, - /* 0x221 */ CS_CMD_ACTOR_CUE_545, - /* 0x222 */ CS_CMD_ACTOR_CUE_546, - /* 0x223 */ CS_CMD_ACTOR_CUE_547, - /* 0x224 */ CS_CMD_ACTOR_CUE_548, - /* 0x225 */ CS_CMD_ACTOR_CUE_549, - /* 0x226 */ CS_CMD_ACTOR_CUE_550, - /* 0x227 */ CS_CMD_ACTOR_CUE_551, - /* 0x228 */ CS_CMD_ACTOR_CUE_552, - /* 0x229 */ CS_CMD_ACTOR_CUE_553, - /* 0x22A */ CS_CMD_ACTOR_CUE_554, - /* 0x22B */ CS_CMD_ACTOR_CUE_555, - /* 0x22C */ CS_CMD_ACTOR_CUE_556, - /* 0x22D */ CS_CMD_ACTOR_CUE_557, - /* 0x22E */ CS_CMD_ACTOR_CUE_558, - /* 0x22F */ CS_CMD_ACTOR_CUE_559, - /* 0x230 */ CS_CMD_ACTOR_CUE_560, - /* 0x231 */ CS_CMD_ACTOR_CUE_561, - /* 0x232 */ CS_CMD_ACTOR_CUE_562, - /* 0x233 */ CS_CMD_ACTOR_CUE_563, - /* 0x234 */ CS_CMD_ACTOR_CUE_564, - /* 0x235 */ CS_CMD_ACTOR_CUE_565, - /* 0x236 */ CS_CMD_ACTOR_CUE_566, - /* 0x237 */ CS_CMD_ACTOR_CUE_567, - /* 0x238 */ CS_CMD_ACTOR_CUE_568, - /* 0x239 */ CS_CMD_ACTOR_CUE_569, - /* 0x23A */ CS_CMD_ACTOR_CUE_570, - /* 0x23B */ CS_CMD_ACTOR_CUE_571, - /* 0x23C */ CS_CMD_ACTOR_CUE_572, - /* 0x23D */ CS_CMD_ACTOR_CUE_573, - /* 0x23E */ CS_CMD_ACTOR_CUE_574, - /* 0x23F */ CS_CMD_ACTOR_CUE_575, - /* 0x240 */ CS_CMD_ACTOR_CUE_576, - /* 0x241 */ CS_CMD_ACTOR_CUE_577, - /* 0x242 */ CS_CMD_ACTOR_CUE_578, - /* 0x243 */ CS_CMD_ACTOR_CUE_579, - /* 0x244 */ CS_CMD_ACTOR_CUE_580, - /* 0x245 */ CS_CMD_ACTOR_CUE_581, - /* 0x246 */ CS_CMD_ACTOR_CUE_582, - /* 0x247 */ CS_CMD_ACTOR_CUE_583, - /* 0x248 */ CS_CMD_ACTOR_CUE_584, - /* 0x249 */ CS_CMD_ACTOR_CUE_585, - /* 0x24A */ CS_CMD_ACTOR_CUE_586, - /* 0x24B */ CS_CMD_ACTOR_CUE_587, - /* 0x24C */ CS_CMD_ACTOR_CUE_588, - /* 0x24D */ CS_CMD_ACTOR_CUE_589, - /* 0x24E */ CS_CMD_ACTOR_CUE_590, - /* 0x24F */ CS_CMD_ACTOR_CUE_591, - /* 0x250 */ CS_CMD_ACTOR_CUE_592, - /* 0x251 */ CS_CMD_ACTOR_CUE_593, - /* 0x252 */ CS_CMD_ACTOR_CUE_594, - /* 0x253 */ CS_CMD_ACTOR_CUE_595, - /* 0x254 */ CS_CMD_ACTOR_CUE_596, - /* 0x255 */ CS_CMD_ACTOR_CUE_597, - /* 0x256 */ CS_CMD_ACTOR_CUE_598, - /* 0x257 */ CS_CMD_ACTOR_CUE_599 -}; - -/**** GENERIC ****/ - -class CutsceneMMSubCommandEntry_GenericCmd : public CutsceneSubCommandEntry -{ -public: - CutsceneMM_CommandType commandId; - - CutsceneMMSubCommandEntry_GenericCmd(const std::vector& rawData, offset_t rawDataIndex, - CutsceneMM_CommandType cmdId); - - std::string GetBodySourceCode() const override; -}; - -class CutsceneMMCommand_GenericCmd : public CutsceneCommand -{ -public: - CutsceneMMCommand_GenericCmd(const std::vector& rawData, offset_t rawDataIndex, - CutsceneMM_CommandType cmdId); - - std::string GetCommandMacro() const override; -}; - -/**** CAMERA ****/ - -// TODO: MM cutscene camera command is implemented as a placeholder until we better understand how -// it works - -class CutsceneSubCommandEntry_SplineCamPoint : public CutsceneSubCommandEntry -{ -public: - uint8_t interpType; - uint8_t weight; - uint16_t duration; - - uint16_t posX; - uint16_t posY; - - uint16_t posZ; - uint16_t relTo; - - CutsceneSubCommandEntry_SplineCamPoint(const std::vector& rawData, - offset_t rawDataIndex); - - std::string GetBodySourceCode() const override; - - size_t GetRawSize() const override; -}; - -class CutsceneSubCommandEntry_SplineMiscPoint : public CutsceneSubCommandEntry -{ -public: - uint16_t unused0; - uint16_t roll; - uint16_t fov; - uint16_t unused1; - - CutsceneSubCommandEntry_SplineMiscPoint(const std::vector& rawData, - offset_t rawDataIndex); - - std::string GetBodySourceCode() const override; - - size_t GetRawSize() const override; -}; - -class CutsceneSubCommandEntry_SplineFooter : public CutsceneSubCommandEntry -{ -public: - CutsceneSubCommandEntry_SplineFooter(const std::vector& rawData, - offset_t rawDataIndex); - - std::string GetBodySourceCode() const override; - - size_t GetRawSize() const override; -}; - -class CutsceneSubCommandEntry_SplineHeader : public CutsceneSubCommandEntry -{ -public: - uint16_t numEntries; - uint16_t unused0; - uint16_t unused1; - uint16_t duration; - CutsceneSubCommandEntry_SplineHeader(const std::vector& rawData, - offset_t rawDataIndex); - - std::string GetBodySourceCode() const override; - - size_t GetRawSize() const override; -}; - -class CutsceneMMCommand_Spline : public CutsceneCommand -{ -public: - uint32_t numHeaders; - uint32_t totalCommands; - CutsceneMMCommand_Spline(const std::vector& rawData, offset_t rawDataIndex); - - std::string GetCommandMacro() const override; - size_t GetCommandSize() const override; -}; - -/**** TRANSITION GENERAL ****/ - -class CutsceneSubCommandEntry_TransitionGeneral : public CutsceneSubCommandEntry -{ -public: - uint8_t unk_06; - uint8_t unk_07; - uint8_t unk_08; - uint8_t unk_09; - uint8_t unk_0A; - uint8_t unk_0B; - - CutsceneSubCommandEntry_TransitionGeneral(const std::vector& rawData, - offset_t rawDataIndex); - - std::string GetBodySourceCode() const override; - - size_t GetRawSize() const override; -}; - -class CutsceneMMCommand_TransitionGeneral : public CutsceneCommand -{ -public: - CutsceneMMCommand_TransitionGeneral(const std::vector& rawData, offset_t rawDataIndex); - - std::string GetCommandMacro() const override; -}; - -/**** FADE OUT SEQUENCE ****/ - -class CutsceneSubCommandEntry_FadeOutSeq : public CutsceneSubCommandEntry -{ -public: - uint32_t unk_08; - - CutsceneSubCommandEntry_FadeOutSeq(const std::vector& rawData, offset_t rawDataIndex); - - std::string GetBodySourceCode() const override; - - size_t GetRawSize() const override; -}; - -class CutsceneMMCommand_FadeOutSeq : public CutsceneCommand -{ -public: - CutsceneMMCommand_FadeOutSeq(const std::vector& rawData, offset_t rawDataIndex); - - std::string GetCommandMacro() const override; -}; - -/**** NON IMPLEMENTED ****/ - -class CutsceneSubCommandEntry_NonImplemented : public CutsceneSubCommandEntry -{ -public: - CutsceneSubCommandEntry_NonImplemented(const std::vector& rawData, - offset_t rawDataIndex); -}; - -class CutsceneMMCommand_NonImplemented : public CutsceneCommand -{ -public: - CutsceneMMCommand_NonImplemented(const std::vector& rawData, offset_t rawDataIndex); -}; - -/**** RUMBLE ****/ - -class CutsceneMMSubCommandEntry_Rumble : public CutsceneSubCommandEntry -{ -public: - uint8_t intensity; - uint8_t decayTimer; - uint8_t decayStep; - - CutsceneMMSubCommandEntry_Rumble(const std::vector& rawData, offset_t rawDataIndex); - - std::string GetBodySourceCode() const override; - - size_t GetRawSize() const override; -}; - -class CutsceneMMCommand_Rumble : public CutsceneCommand -{ -public: - CutsceneMMCommand_Rumble(const std::vector& rawData, offset_t rawDataIndex); - - std::string GetCommandMacro() const override; -}; - -/**** TEXT ****/ - -class CutsceneMMSubCommandEntry_Text : public CutsceneSubCommandEntry -{ -public: - uint16_t type; - uint16_t textId1; - uint16_t textId2; - - CutsceneMMSubCommandEntry_Text(const std::vector& rawData, offset_t rawDataIndex); - - std::string GetBodySourceCode() const override; - - size_t GetRawSize() const override; -}; - -class CutsceneMMCommand_Text : public CutsceneCommand -{ -public: - CutsceneMMCommand_Text(const std::vector& rawData, offset_t rawDataIndex); - - std::string GetCommandMacro() const override; -}; - -/**** ACTOR CUE ****/ - -class CutsceneMMSubCommandEntry_ActorCue : public CutsceneSubCommandEntry -{ -public: - uint16_t rotX, rotY, rotZ; - int32_t startPosX, startPosY, startPosZ; - int32_t endPosX, endPosY, endPosZ; - float normalX, normalY, normalZ; - - CutsceneMMSubCommandEntry_ActorCue(const std::vector& rawData, offset_t rawDataIndex); - std::string GetBodySourceCode() const override; - - size_t GetRawSize() const override; -}; - -class CutsceneMMCommand_ActorCue : public CutsceneCommand -{ -public: - CutsceneMMCommand_ActorCue(const std::vector& rawData, offset_t rawDataIndex); - - std::string GetCommandMacro() const override; -}; diff --git a/tools/ZAPD/ZAPD/OtherStructs/CutsceneOoT_Commands.cpp b/tools/ZAPD/ZAPD/OtherStructs/CutsceneOoT_Commands.cpp deleted file mode 100644 index 668657e7aa..0000000000 --- a/tools/ZAPD/ZAPD/OtherStructs/CutsceneOoT_Commands.cpp +++ /dev/null @@ -1,472 +0,0 @@ -#include "CutsceneOoT_Commands.h" - -#include -#include -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" - -#include "ZCutscene.h" - -/**** GENERIC ****/ - -// Specific for command lists where each entry has size 0x30 bytes -const std::unordered_map csCommandsDesc = { - {CutsceneOoT_CommandType::CS_CMD_MISC, - {"CS_MISC", "(%s, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"}}, - {CutsceneOoT_CommandType::CS_CMD_LIGHT_SETTING, - {"CS_LIGHT_SETTING", "(0x%02X, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"}}, - {CutsceneOoT_CommandType::CS_CMD_START_SEQ, - {"CS_START_SEQ", "(%s, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"}}, - {CutsceneOoT_CommandType::CS_CMD_STOP_SEQ, - {"CS_STOP_SEQ", "(%s, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"}}, - {CutsceneOoT_CommandType::CS_CMD_FADE_OUT_SEQ, - {"CS_FADE_OUT_SEQ", "(%s, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"}}, -}; - -CutsceneOoTSubCommandEntry_GenericCmd::CutsceneOoTSubCommandEntry_GenericCmd( - const std::vector& rawData, offset_t rawDataIndex, CutsceneOoT_CommandType cmdId) - : CutsceneSubCommandEntry(rawData, rawDataIndex), commandId(cmdId) -{ - word0 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x0); - word1 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x4); - - unused1 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x8); - unused2 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0xC); - unused3 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x10); - unused4 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x14); - unused5 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x18); - unused6 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x1C); - unused7 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x20); - unused8 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x24); - unused9 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x28); - unused10 = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x2C); -} - -std::string CutsceneOoTSubCommandEntry_GenericCmd::GetBodySourceCode() const -{ - EnumData* enumData = &Globals::Instance->cfg.enumData; - const auto& element = csCommandsDesc.find(commandId); - - if (element != csCommandsDesc.end()) - { - bool isIndexInMisc = enumData->miscType.find(base) != enumData->miscType.end(); - bool isIndexInFade = - enumData->fadeOutSeqPlayer.find(base) != enumData->fadeOutSeqPlayer.end(); - bool isIndexInSeqId = enumData->seqId.find(base - 1) != enumData->seqId.end(); - std::string entryFmt = element->second.cmdMacro; - std::string firstArg; - entryFmt += element->second.args; - - if (commandId == CutsceneOoT_CommandType::CS_CMD_MISC && isIndexInMisc) - firstArg = enumData->miscType[base]; - else if (commandId == CutsceneOoT_CommandType::CS_CMD_FADE_OUT_SEQ && isIndexInFade) - firstArg = enumData->fadeOutSeqPlayer[base]; - else if (commandId == CutsceneOoT_CommandType::CS_CMD_START_SEQ && isIndexInSeqId) - firstArg = enumData->seqId[base - 1]; - else if (commandId == CutsceneOoT_CommandType::CS_CMD_STOP_SEQ && isIndexInSeqId) - firstArg = enumData->seqId[base - 1]; - else - { - return StringHelper::Sprintf(entryFmt.c_str(), base - 1, startFrame, endFrame, pad, - unused1, unused2, unused3, unused4, unused5, unused6, - unused7, unused8, unused9, unused10); - } - return StringHelper::Sprintf(entryFmt.c_str(), firstArg.c_str(), startFrame, endFrame, pad, - unused1, unused2, unused3, unused4, unused5, unused6, unused7, - unused8, unused9, unused10); - } - return StringHelper::Sprintf("CS_UNK_DATA(0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X, " - "0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X, 0x%08X)", - word0, word1, unused1, unused2, unused3, unused4, unused5, unused6, - unused7, unused8, unused9, unused10); -} - -size_t CutsceneOoTSubCommandEntry_GenericCmd::GetRawSize() const -{ - return 0x30; -} - -CutsceneOoTCommand_GenericCmd::CutsceneOoTCommand_GenericCmd(const std::vector& rawData, - offset_t rawDataIndex, - CutsceneOoT_CommandType cmdId) - : CutsceneCommand(rawData, rawDataIndex) -{ - rawDataIndex += 4; - - commandID = static_cast(cmdId); - entries.reserve(numEntries); - - for (size_t i = 0; i < numEntries; i++) - { - auto* entry = new CutsceneOoTSubCommandEntry_GenericCmd(rawData, rawDataIndex, cmdId); - entries.push_back(entry); - rawDataIndex += entry->GetRawSize(); - } -} - -std::string CutsceneOoTCommand_GenericCmd::GetCommandMacro() const -{ - const auto& element = csCommandsDesc.find(static_cast(commandID)); - - if (element != csCommandsDesc.end()) - { - return StringHelper::Sprintf("%s_LIST(%i)", element->second.cmdMacro, numEntries); - } - - return StringHelper::Sprintf("CS_UNK_DATA_LIST(0x%X, %i)", commandID, numEntries); -} - -/**** CAMERA ****/ - -CutsceneOoTCommand_CameraPoint::CutsceneOoTCommand_CameraPoint(const std::vector& rawData, - offset_t rawDataIndex) - : CutsceneSubCommandEntry(rawData, rawDataIndex) -{ - continueFlag = BitConverter::ToInt8BE(rawData, rawDataIndex + 0); - cameraRoll = BitConverter::ToInt8BE(rawData, rawDataIndex + 1); - nextPointFrame = BitConverter::ToInt16BE(rawData, rawDataIndex + 2); - viewAngle = BitConverter::ToFloatBE(rawData, rawDataIndex + 4); - - posX = BitConverter::ToInt16BE(rawData, rawDataIndex + 8); - posY = BitConverter::ToInt16BE(rawData, rawDataIndex + 10); - posZ = BitConverter::ToInt16BE(rawData, rawDataIndex + 12); - - unused = BitConverter::ToInt16BE(rawData, rawDataIndex + 14); -} - -std::string CutsceneOoTCommand_CameraPoint::GetBodySourceCode() const -{ - std::string continueMacro = "CS_CAM_CONTINUE"; - if (continueFlag != 0) - continueMacro = "CS_CAM_STOP"; - - return StringHelper::Sprintf( - "CS_CAM_POINT(%s, 0x%02X, %i, %s, %i, %i, %i, 0x%04X)", continueMacro.c_str(), cameraRoll, - nextPointFrame, - ZCutscene::GetCsEncodedFloat(viewAngle, Globals::Instance->floatType, false).c_str(), posX, - posY, posZ, unused); -} - -size_t CutsceneOoTCommand_CameraPoint::GetRawSize() const -{ - return 0x10; -} - -CutsceneOoTCommand_GenericCameraCmd::CutsceneOoTCommand_GenericCameraCmd( - const std::vector& rawData, offset_t rawDataIndex) - : CutsceneCommand(rawData, rawDataIndex) -{ - base = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0); - startFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2); - endFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 4); - unused = BitConverter::ToUInt16BE(rawData, rawDataIndex + 6); - - bool shouldContinue = true; - - uint32_t currentPtr = rawDataIndex + 8; - - while (shouldContinue) - { - CutsceneOoTCommand_CameraPoint* camPoint = - new CutsceneOoTCommand_CameraPoint(rawData, currentPtr); - entries.push_back(camPoint); - - if (camPoint->continueFlag == -1) - shouldContinue = false; - - currentPtr += camPoint->GetRawSize(); - } -} - -std::string CutsceneOoTCommand_GenericCameraCmd::GetCommandMacro() const -{ - std::string result; - const char* listStr; - - if (commandID == (uint32_t)CutsceneOoT_CommandType::CS_CMD_CAM_AT_SPLINE) - { - listStr = "CS_CAM_AT_SPLINE"; - } - else if (commandID == (uint32_t)CutsceneOoT_CommandType::CS_CMD_CAM_AT_SPLINE_REL_TO_PLAYER) - { - listStr = "CS_CAM_AT_SPLINE_REL_TO_PLAYER"; - } - else if (commandID == (uint32_t)CutsceneOoT_CommandType::CS_CMD_CAM_EYE_SPLINE_REL_TO_PLAYER) - { - listStr = "CS_CAM_EYE_SPLINE_REL_TO_PLAYER"; - } - else - { - listStr = "CS_CAM_EYE_SPLINE"; - } - - result += StringHelper::Sprintf("%s(%i, %i)", listStr, startFrame, endFrame); - - return result; -} - -size_t CutsceneOoTCommand_GenericCameraCmd::GetCommandSize() const -{ - return 0x0C + entries.at(0)->GetRawSize() * entries.size(); -} - -/**** RUMBLE ****/ - -CutsceneOoTSubCommandEntry_Rumble::CutsceneOoTSubCommandEntry_Rumble( - const std::vector& rawData, offset_t rawDataIndex) - : CutsceneSubCommandEntry(rawData, rawDataIndex) -{ - sourceStrength = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x06); - duration = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x07); - decreaseRate = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x08); - unk_09 = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x09); - unk_0A = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x0A); -} - -std::string CutsceneOoTSubCommandEntry_Rumble::GetBodySourceCode() const -{ - // Note: the first argument is unused - return StringHelper::Sprintf("CS_RUMBLE_CONTROLLER(%i, %i, %i, %i, %i, %i, 0x%02X, 0x%02X)", - base, startFrame, endFrame, sourceStrength, duration, decreaseRate, - unk_09, unk_0A); -} - -size_t CutsceneOoTSubCommandEntry_Rumble::GetRawSize() const -{ - return 0x0C; -} - -CutsceneOoTCommand_Rumble::CutsceneOoTCommand_Rumble(const std::vector& rawData, - offset_t rawDataIndex) - : CutsceneCommand(rawData, rawDataIndex) -{ - rawDataIndex += 4; - - entries.reserve(numEntries); - for (size_t i = 0; i < numEntries; i++) - { - auto* entry = new CutsceneOoTSubCommandEntry_Rumble(rawData, rawDataIndex); - entries.push_back(entry); - rawDataIndex += entry->GetRawSize(); - } -} - -std::string CutsceneOoTCommand_Rumble::GetCommandMacro() const -{ - return StringHelper::Sprintf("CS_RUMBLE_CONTROLLER_LIST(%i)", numEntries); -} - -/**** TEXT ****/ - -CutsceneOoTSubCommandEntry_Text::CutsceneOoTSubCommandEntry_Text( - const std::vector& rawData, offset_t rawDataIndex) - : CutsceneSubCommandEntry(rawData, rawDataIndex) -{ - type = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x6); - textId1 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x8); - textId2 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0xA); -} - -std::string CutsceneOoTSubCommandEntry_Text::GetBodySourceCode() const -{ - EnumData* enumData = &Globals::Instance->cfg.enumData; - - if (type == 0xFFFF) - { - return StringHelper::Sprintf("CS_TEXT_NONE(%i, %i)", startFrame, endFrame); - } - if (type == 2 && - enumData->ocarinaSongActionId.find(base) != enumData->ocarinaSongActionId.end()) - { - return StringHelper::Sprintf("CS_TEXT_OCARINA_ACTION(%s, %i, %i, 0x%X)", - enumData->ocarinaSongActionId[base].c_str(), startFrame, - endFrame, textId1); - } - - if (enumData->textType.find(type) != enumData->textType.end()) - { - return StringHelper::Sprintf("CS_TEXT(0x%X, %i, %i, %s, 0x%X, 0x%X)", base, startFrame, - endFrame, enumData->textType[type].c_str(), textId1, textId2); - } - - return StringHelper::Sprintf("CS_TEXT(0x%X, %i, %i, %i, 0x%X, 0x%X)", base, startFrame, - endFrame, type, textId1, textId2); -} - -size_t CutsceneOoTSubCommandEntry_Text::GetRawSize() const -{ - return 0x0C; -} - -CutsceneOoTCommand_Text::CutsceneOoTCommand_Text(const std::vector& rawData, - offset_t rawDataIndex) - : CutsceneCommand(rawData, rawDataIndex) -{ - rawDataIndex += 4; - - entries.reserve(numEntries); - for (size_t i = 0; i < numEntries; i++) - { - auto* entry = new CutsceneOoTSubCommandEntry_Text(rawData, rawDataIndex); - entries.push_back(entry); - rawDataIndex += entry->GetRawSize(); - } -} - -std::string CutsceneOoTCommand_Text::GetCommandMacro() const -{ - return StringHelper::Sprintf("CS_TEXT_LIST(%i)", numEntries); -} - -/**** ACTOR CUE ****/ - -CutsceneOoTSubCommandEntry_ActorCue::CutsceneOoTSubCommandEntry_ActorCue( - const std::vector& rawData, offset_t rawDataIndex) - : CutsceneSubCommandEntry(rawData, rawDataIndex) -{ - rotX = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x6); - rotY = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x8); - rotZ = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0xA); - startPosX = BitConverter::ToInt32BE(rawData, rawDataIndex + 0xC); - startPosY = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x10); - startPosZ = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x14); - endPosX = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x18); - endPosY = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x1C); - endPosZ = BitConverter::ToInt32BE(rawData, rawDataIndex + 0x20); - normalX = BitConverter::ToFloatBE(rawData, rawDataIndex + 0x24); - normalY = BitConverter::ToFloatBE(rawData, rawDataIndex + 0x28); - normalZ = BitConverter::ToFloatBE(rawData, rawDataIndex + 0x2C); -} -std::string CutsceneOoTSubCommandEntry_ActorCue::GetBodySourceCode() const -{ - EnumData* enumData = &Globals::Instance->cfg.enumData; - - std::string normalXStr = - ZCutscene::GetCsEncodedFloat(normalX, Globals::Instance->floatType, true); - std::string normalYStr = - ZCutscene::GetCsEncodedFloat(normalY, Globals::Instance->floatType, true); - std::string normalZStr = - ZCutscene::GetCsEncodedFloat(normalZ, Globals::Instance->floatType, true); - - if (static_cast(commandID) == - CutsceneOoT_CommandType::CS_CMD_PLAYER_CUE) - { - return StringHelper::Sprintf("CS_PLAYER_CUE(%s, %i, %i, 0x%04X, 0x%04X, 0x%04X, %i, %i, " - "%i, %i, %i, %i, %s, %s, %s)", - enumData->playerCueId[base].c_str(), startFrame, endFrame, - rotX, rotY, rotZ, startPosX, startPosY, startPosZ, endPosX, - endPosY, endPosZ, normalXStr.c_str(), normalYStr.c_str(), - normalZStr.c_str()); - } - else - { - return StringHelper::Sprintf("CS_ACTOR_CUE(%i, %i, %i, 0x%04X, 0x%04X, 0x%04X, %i, %i, " - "%i, %i, %i, %i, %s, %s, %s)", - base, startFrame, endFrame, rotX, rotY, rotZ, startPosX, - startPosY, startPosZ, endPosX, endPosY, endPosZ, - normalXStr.c_str(), normalYStr.c_str(), normalZStr.c_str()); - } -} - -size_t CutsceneOoTSubCommandEntry_ActorCue::GetRawSize() const -{ - return 0x30; -} - -CutsceneOoTCommand_ActorCue::CutsceneOoTCommand_ActorCue(const std::vector& rawData, - offset_t rawDataIndex) - : CutsceneCommand(rawData, rawDataIndex) -{ - rawDataIndex += 4; - - entries.reserve(numEntries); - for (size_t i = 0; i < numEntries; i++) - { - auto* entry = new CutsceneOoTSubCommandEntry_ActorCue(rawData, rawDataIndex); - entries.push_back(entry); - rawDataIndex += entry->GetRawSize(); - } -} - -std::string CutsceneOoTCommand_ActorCue::GetCommandMacro() const -{ - EnumData* enumData = &Globals::Instance->cfg.enumData; - - if (static_cast(commandID) == - CutsceneOoT_CommandType::CS_CMD_PLAYER_CUE) - { - return StringHelper::Sprintf("CS_PLAYER_CUE_LIST(%i)", entries.size()); - } - - if (enumData->cutsceneCmd.find(commandID) != enumData->cutsceneCmd.end()) - { - return StringHelper::Sprintf("CS_ACTOR_CUE_LIST(%s, %i)", - enumData->cutsceneCmd[commandID].c_str(), entries.size()); - } - - return StringHelper::Sprintf("CS_ACTOR_CUE_LIST(0x%04X, %i)", commandID, entries.size()); -} - -/**** DESTINATION ****/ - -CutsceneOoTCommand_Destination::CutsceneOoTCommand_Destination(const std::vector& rawData, - offset_t rawDataIndex) - : CutsceneCommand(rawData, rawDataIndex) -{ - rawDataIndex += 4; - - base = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0); - startFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2); - endFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 4); - unknown = BitConverter::ToUInt16BE(rawData, rawDataIndex + 6); // endFrame duplicate -} - -std::string CutsceneOoTCommand_Destination::GenerateSourceCode() const -{ - EnumData* enumData = &Globals::Instance->cfg.enumData; - - if (enumData->destination.find(base) != enumData->destination.end()) - { - return StringHelper::Sprintf("CS_DESTINATION(%s, %i, %i),\n", - enumData->destination[base].c_str(), startFrame, endFrame); - } - - return StringHelper::Sprintf("CS_DESTINATION(%i, %i, %i),\n", base, startFrame, endFrame); -} - -size_t CutsceneOoTCommand_Destination::GetCommandSize() const -{ - return 0x10; -} - -/**** TRANSITION ****/ - -CutsceneOoTCommand_Transition::CutsceneOoTCommand_Transition(const std::vector& rawData, - offset_t rawDataIndex) - : CutsceneCommand(rawData, rawDataIndex) -{ - rawDataIndex += 4; - - base = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0); - startFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2); - endFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 4); -} - -std::string CutsceneOoTCommand_Transition::GenerateSourceCode() const -{ - EnumData* enumData = &Globals::Instance->cfg.enumData; - - if (enumData->transitionType.find(base) != enumData->transitionType.end()) - { - return StringHelper::Sprintf("CS_TRANSITION(%s, %i, %i),\n", - enumData->transitionType[base].c_str(), startFrame, endFrame); - } - - return StringHelper::Sprintf("CS_TRANSITION(%i, %i, %i),\n", base, startFrame, endFrame); -} - -size_t CutsceneOoTCommand_Transition::GetCommandSize() const -{ - return 0x10; -} diff --git a/tools/ZAPD/ZAPD/OtherStructs/CutsceneOoT_Commands.h b/tools/ZAPD/ZAPD/OtherStructs/CutsceneOoT_Commands.h deleted file mode 100644 index ff9b6797c3..0000000000 --- a/tools/ZAPD/ZAPD/OtherStructs/CutsceneOoT_Commands.h +++ /dev/null @@ -1,314 +0,0 @@ -#pragma once - -#include "Cutscene_Common.h" - -// https://github.com/zeldaret/oot/blob/7235af2249843fb68740111b70089bad827a4730/include/z64cutscene.h#L35-L165 -enum class CutsceneOoT_CommandType -{ - CS_CMD_CAM_EYE_SPLINE = 0x01, - CS_CMD_CAM_AT_SPLINE, - CS_CMD_MISC, - CS_CMD_LIGHT_SETTING, - CS_CMD_CAM_EYE_SPLINE_REL_TO_PLAYER, - CS_CMD_CAM_AT_SPLINE_REL_TO_PLAYER, - CS_CMD_CAM_EYE, - CS_CMD_CAM_AT, - CS_CMD_RUMBLE_CONTROLLER, - CS_CMD_PLAYER_CUE, - CS_CMD_UNIMPLEMENTED_B, - CS_CMD_UNIMPLEMENTED_D = 0x0D, - CS_CMD_ACTOR_CUE_1_0, - CS_CMD_ACTOR_CUE_0_0, - CS_CMD_ACTOR_CUE_1_1, - CS_CMD_ACTOR_CUE_0_1, - CS_CMD_ACTOR_CUE_0_2, - CS_CMD_TEXT, - CS_CMD_UNIMPLEMENTED_15 = 0x15, - CS_CMD_UNIMPLEMENTED_16, - CS_CMD_ACTOR_CUE_0_3, - CS_CMD_ACTOR_CUE_1_2, - CS_CMD_ACTOR_CUE_2_0, - CS_CMD_UNIMPLEMENTED_1B = 0x1B, - CS_CMD_UNIMPLEMENTED_1C, - CS_CMD_ACTOR_CUE_3_0, - CS_CMD_ACTOR_CUE_4_0, - CS_CMD_ACTOR_CUE_6_0, - CS_CMD_UNIMPLEMENTED_20, - CS_CMD_UNIMPLEMENTED_21, - CS_CMD_ACTOR_CUE_0_4, - CS_CMD_ACTOR_CUE_1_3, - CS_CMD_ACTOR_CUE_2_1, - CS_CMD_ACTOR_CUE_3_1, - CS_CMD_ACTOR_CUE_4_1, - CS_CMD_ACTOR_CUE_0_5, - CS_CMD_ACTOR_CUE_1_4, - CS_CMD_ACTOR_CUE_2_2, - CS_CMD_ACTOR_CUE_3_2, - CS_CMD_ACTOR_CUE_4_2, - CS_CMD_ACTOR_CUE_5_0, - CS_CMD_TRANSITION, - CS_CMD_ACTOR_CUE_0_6, - CS_CMD_ACTOR_CUE_4_3, - CS_CMD_ACTOR_CUE_1_5, - CS_CMD_ACTOR_CUE_7_0, - CS_CMD_ACTOR_CUE_2_3, - CS_CMD_ACTOR_CUE_3_3, - CS_CMD_ACTOR_CUE_6_1, - CS_CMD_ACTOR_CUE_3_4, - CS_CMD_ACTOR_CUE_4_4, - CS_CMD_ACTOR_CUE_5_1, - CS_CMD_ACTOR_CUE_6_2 = 0x39, - CS_CMD_ACTOR_CUE_6_3, - CS_CMD_UNIMPLEMENTED_3B, - CS_CMD_ACTOR_CUE_7_1, - CS_CMD_UNIMPLEMENTED_3D, - CS_CMD_ACTOR_CUE_8_0, - CS_CMD_ACTOR_CUE_3_5, - CS_CMD_ACTOR_CUE_1_6, - CS_CMD_ACTOR_CUE_3_6, - CS_CMD_ACTOR_CUE_3_7, - CS_CMD_ACTOR_CUE_2_4, - CS_CMD_ACTOR_CUE_1_7, - CS_CMD_ACTOR_CUE_2_5, - CS_CMD_ACTOR_CUE_1_8, - CS_CMD_UNIMPLEMENTED_47, - CS_CMD_ACTOR_CUE_2_6, - CS_CMD_UNIMPLEMENTED_49, - CS_CMD_ACTOR_CUE_2_7, - CS_CMD_ACTOR_CUE_3_8, - CS_CMD_ACTOR_CUE_0_7, - CS_CMD_ACTOR_CUE_5_2, - CS_CMD_ACTOR_CUE_1_9, - CS_CMD_ACTOR_CUE_4_5, - CS_CMD_ACTOR_CUE_1_10, - CS_CMD_ACTOR_CUE_2_8, - CS_CMD_ACTOR_CUE_3_9, - CS_CMD_ACTOR_CUE_4_6, - CS_CMD_ACTOR_CUE_5_3, - CS_CMD_ACTOR_CUE_0_8, - CS_CMD_START_SEQ, - CS_CMD_STOP_SEQ, - CS_CMD_ACTOR_CUE_6_4, - CS_CMD_ACTOR_CUE_7_2, - CS_CMD_ACTOR_CUE_5_4, - CS_CMD_ACTOR_CUE_0_9 = 0x5D, - CS_CMD_ACTOR_CUE_1_11, - CS_CMD_ACTOR_CUE_0_10 = 0x69, - CS_CMD_ACTOR_CUE_2_9, - CS_CMD_ACTOR_CUE_0_11, - CS_CMD_ACTOR_CUE_3_10, - CS_CMD_UNIMPLEMENTED_6D, - CS_CMD_ACTOR_CUE_0_12, - CS_CMD_ACTOR_CUE_7_3, - CS_CMD_UNIMPLEMENTED_70, - CS_CMD_UNIMPLEMENTED_71, - CS_CMD_ACTOR_CUE_7_4, - CS_CMD_ACTOR_CUE_6_5, - CS_CMD_ACTOR_CUE_1_12, - CS_CMD_ACTOR_CUE_2_10, - CS_CMD_ACTOR_CUE_1_13, - CS_CMD_ACTOR_CUE_0_13, - CS_CMD_ACTOR_CUE_1_14, - CS_CMD_ACTOR_CUE_2_11, - CS_CMD_ACTOR_CUE_0_14 = 0x7B, - CS_CMD_FADE_OUT_SEQ, - CS_CMD_ACTOR_CUE_1_15, - CS_CMD_ACTOR_CUE_2_12, - CS_CMD_ACTOR_CUE_3_11, - CS_CMD_ACTOR_CUE_4_7, - CS_CMD_ACTOR_CUE_5_5, - CS_CMD_ACTOR_CUE_6_6, - CS_CMD_ACTOR_CUE_1_16, - CS_CMD_ACTOR_CUE_2_13, - CS_CMD_ACTOR_CUE_3_12, - CS_CMD_ACTOR_CUE_7_5, - CS_CMD_ACTOR_CUE_4_8, - CS_CMD_ACTOR_CUE_5_6, - CS_CMD_ACTOR_CUE_6_7, - CS_CMD_ACTOR_CUE_0_15, - CS_CMD_ACTOR_CUE_0_16, - CS_CMD_TIME, - CS_CMD_ACTOR_CUE_1_17, - CS_CMD_ACTOR_CUE_7_6, - CS_CMD_ACTOR_CUE_9_0, - CS_CMD_ACTOR_CUE_0_17, - CS_CMD_DESTINATION = 0x03E8, - CS_CMD_END = 0xFFFF -}; - -/**** GENERIC ****/ - -class CutsceneOoTSubCommandEntry_GenericCmd : public CutsceneSubCommandEntry -{ -public: - CutsceneOoT_CommandType commandId; - - uint32_t word0 = 0; - uint32_t word1 = 0; - - uint32_t unused1 = 0; - uint32_t unused2 = 0; - uint32_t unused3 = 0; - uint32_t unused4 = 0; - uint32_t unused5 = 0; - uint32_t unused6 = 0; - uint32_t unused7 = 0; - uint32_t unused8 = 0; - uint32_t unused9 = 0; - uint32_t unused10 = 0; - - CutsceneOoTSubCommandEntry_GenericCmd(const std::vector& rawData, - offset_t rawDataIndex, CutsceneOoT_CommandType cmdId); - - std::string GetBodySourceCode() const override; - - size_t GetRawSize() const override; -}; - -class CutsceneOoTCommand_GenericCmd : public CutsceneCommand -{ -public: - CutsceneOoTCommand_GenericCmd(const std::vector& rawData, offset_t rawDataIndex, - CutsceneOoT_CommandType cmdId); - - std::string GetCommandMacro() const override; -}; - -/**** CAMERA ****/ - -class CutsceneOoTCommand_CameraPoint : public CutsceneSubCommandEntry -{ -public: - int8_t continueFlag; - int8_t cameraRoll; - int16_t nextPointFrame; - float viewAngle; - int16_t posX, posY, posZ; - int16_t unused; - - CutsceneOoTCommand_CameraPoint(const std::vector& rawData, offset_t rawDataIndex); - - std::string GetBodySourceCode() const override; - - size_t GetRawSize() const override; -}; - -class CutsceneOoTCommand_GenericCameraCmd : public CutsceneCommand -{ -public: - uint16_t base; - uint16_t startFrame; - uint16_t endFrame; - uint16_t unused; - - CutsceneOoTCommand_GenericCameraCmd(const std::vector& rawData, offset_t rawDataIndex); - - std::string GetCommandMacro() const override; - - size_t GetCommandSize() const override; -}; - -/**** TRANSITION ****/ - -class CutsceneOoTCommand_Transition : public CutsceneCommand -{ -public: - uint16_t base; - uint16_t startFrame; - uint16_t endFrame; - - CutsceneOoTCommand_Transition(const std::vector& rawData, offset_t rawDataIndex); - - std::string GenerateSourceCode() const override; - size_t GetCommandSize() const override; -}; - -/**** RUMBLE ****/ - -class CutsceneOoTSubCommandEntry_Rumble : public CutsceneSubCommandEntry -{ -public: - uint8_t sourceStrength; - uint8_t duration; - uint8_t decreaseRate; - uint8_t unk_09; - uint8_t unk_0A; - - CutsceneOoTSubCommandEntry_Rumble(const std::vector& rawData, offset_t rawDataIndex); - - std::string GetBodySourceCode() const override; - - size_t GetRawSize() const override; -}; - -class CutsceneOoTCommand_Rumble : public CutsceneCommand -{ -public: - CutsceneOoTCommand_Rumble(const std::vector& rawData, offset_t rawDataIndex); - - std::string GetCommandMacro() const override; -}; - -/**** TEXT ****/ - -class CutsceneOoTSubCommandEntry_Text : public CutsceneSubCommandEntry -{ -public: - uint16_t type; - uint16_t textId1; - uint16_t textId2; - - CutsceneOoTSubCommandEntry_Text(const std::vector& rawData, offset_t rawDataIndex); - - std::string GetBodySourceCode() const override; - - size_t GetRawSize() const override; -}; - -class CutsceneOoTCommand_Text : public CutsceneCommand -{ -public: - CutsceneOoTCommand_Text(const std::vector& rawData, offset_t rawDataIndex); - - std::string GetCommandMacro() const override; -}; - -/**** ACTOR CUE ****/ - -class CutsceneOoTSubCommandEntry_ActorCue : public CutsceneSubCommandEntry -{ -public: - uint16_t rotX, rotY, rotZ; - int32_t startPosX, startPosY, startPosZ; - int32_t endPosX, endPosY, endPosZ; - float normalX, normalY, normalZ; - - CutsceneOoTSubCommandEntry_ActorCue(const std::vector& rawData, offset_t rawDataIndex); - std::string GetBodySourceCode() const override; - - size_t GetRawSize() const override; -}; - -class CutsceneOoTCommand_ActorCue : public CutsceneCommand -{ -public: - CutsceneOoTCommand_ActorCue(const std::vector& rawData, offset_t rawDataIndex); - - std::string GetCommandMacro() const override; -}; - -/**** DESTINATION ****/ - -class CutsceneOoTCommand_Destination : public CutsceneCommand -{ -public: - uint16_t base; - uint16_t startFrame; - uint16_t endFrame; - uint16_t unknown; - - CutsceneOoTCommand_Destination(const std::vector& rawData, offset_t rawDataIndex); - - std::string GenerateSourceCode() const override; - size_t GetCommandSize() const override; -}; diff --git a/tools/ZAPD/ZAPD/OtherStructs/Cutscene_Common.cpp b/tools/ZAPD/ZAPD/OtherStructs/Cutscene_Common.cpp deleted file mode 100644 index a5ea609af8..0000000000 --- a/tools/ZAPD/ZAPD/OtherStructs/Cutscene_Common.cpp +++ /dev/null @@ -1,128 +0,0 @@ -#include "Cutscene_Common.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" - -/* CutsceneSubCommandEntry */ - -CutsceneSubCommandEntry::CutsceneSubCommandEntry(const std::vector& rawData, - offset_t rawDataIndex) -{ - base = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0); - startFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2); - endFrame = BitConverter::ToUInt16BE(rawData, rawDataIndex + 4); - pad = BitConverter::ToUInt16BE(rawData, rawDataIndex + 6); -} - -std::string CutsceneSubCommandEntry::GetBodySourceCode() const -{ - return StringHelper::Sprintf("CMD_HH(0x%04X, 0x%04X), CMD_HH(0x%04X, 0x%04X)", base, startFrame, - endFrame, pad); -} - -size_t CutsceneSubCommandEntry::GetRawSize() const -{ - return 0x08; -} - -/* CutsceneCommand */ - -CutsceneCommand::CutsceneCommand(const std::vector& rawData, offset_t rawDataIndex) -{ - numEntries = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0); -} - -CutsceneCommand::~CutsceneCommand() -{ - for (auto entry : entries) - { - delete entry; - } -} - -std::string CutsceneCommand::GetCommandMacro() const -{ - return StringHelper::Sprintf("CMD_W(0x%08X), CMD_W(0x%08X)", commandID, numEntries); -} - -std::string CutsceneCommand::GenerateSourceCode() const -{ - std::string result; - - result += GetCommandMacro(); - result += ",\n"; - - for (auto& entry : entries) - { - result += " "; - result += entry->GetBodySourceCode(); - result += ",\n"; - } - - return result; -} - -size_t CutsceneCommand::GetCommandSize() const -{ - size_t size = 0; - if (entries.size() > 0) - { - size = entries.at(0)->GetRawSize() * entries.size(); - } - else - { - size = 0x08 * numEntries; - } - return 0x08 + size; -} - -void CutsceneCommand::SetCommandID(uint32_t nCommandID) -{ - commandID = nCommandID; - - for (auto& entry : entries) - { - entry->commandID = commandID; - } -} - -/*** TIME ****/ - -CutsceneSubCommandEntry_SetTime::CutsceneSubCommandEntry_SetTime( - const std::vector& rawData, offset_t rawDataIndex) - : CutsceneSubCommandEntry(rawData, rawDataIndex) -{ - hour = BitConverter::ToUInt8BE(rawData, rawDataIndex + 6); - minute = BitConverter::ToUInt8BE(rawData, rawDataIndex + 7); -} - -std::string CutsceneSubCommandEntry_SetTime::GetBodySourceCode() const -{ - // Note: Both OoT and MM have the first argument unused - return StringHelper::Sprintf("CS_TIME(%i, %i, %i, %i, %i)", base, startFrame, endFrame, hour, - minute); -} - -size_t CutsceneSubCommandEntry_SetTime::GetRawSize() const -{ - return 0x0C; -} - -CutsceneCommand_Time::CutsceneCommand_Time(const std::vector& rawData, - offset_t rawDataIndex) - : CutsceneCommand(rawData, rawDataIndex) -{ - rawDataIndex += 4; - - entries.reserve(numEntries); - for (size_t i = 0; i < numEntries; i++) - { - auto* entry = new CutsceneSubCommandEntry_SetTime(rawData, rawDataIndex); - entries.push_back(entry); - rawDataIndex += entry->GetRawSize(); - } -} - -std::string CutsceneCommand_Time::GetCommandMacro() const -{ - return StringHelper::Sprintf("CS_TIME_LIST(%i)", numEntries); -} diff --git a/tools/ZAPD/ZAPD/OtherStructs/Cutscene_Common.h b/tools/ZAPD/ZAPD/OtherStructs/Cutscene_Common.h deleted file mode 100644 index 9d8dcf63de..0000000000 --- a/tools/ZAPD/ZAPD/OtherStructs/Cutscene_Common.h +++ /dev/null @@ -1,72 +0,0 @@ -#pragma once - -#include -#include -#include -#include "Declaration.h" - -typedef struct CsCommandListDescriptor -{ - const char* cmdMacro; - const char* args; -} CsCommandListDescriptor; - -class CutsceneSubCommandEntry -{ -public: - uint16_t base; - uint16_t startFrame; - uint16_t endFrame; - uint16_t pad; - - uint32_t commandID; - - CutsceneSubCommandEntry(const std::vector& rawData, offset_t rawDataIndex); - virtual ~CutsceneSubCommandEntry() = default; - - virtual std::string GetBodySourceCode() const; - - virtual size_t GetRawSize() const; -}; - -class CutsceneCommand -{ -public: - uint32_t commandID; - uint32_t commandIndex; - - uint32_t numEntries; - std::vector entries; - - CutsceneCommand(const std::vector& rawData, offset_t rawDataIndex); - virtual ~CutsceneCommand(); - - virtual std::string GetCommandMacro() const; - virtual std::string GenerateSourceCode() const; - virtual size_t GetCommandSize() const; - - virtual void SetCommandID(uint32_t nCommandID); -}; - -/**** TIME ****/ - -class CutsceneSubCommandEntry_SetTime : public CutsceneSubCommandEntry -{ -public: - uint8_t hour; - uint8_t minute; - - CutsceneSubCommandEntry_SetTime(const std::vector& rawData, offset_t rawDataIndex); - - std::string GetBodySourceCode() const override; - - size_t GetRawSize() const override; -}; - -class CutsceneCommand_Time : public CutsceneCommand -{ -public: - CutsceneCommand_Time(const std::vector& rawData, offset_t rawDataIndex); - - std::string GetCommandMacro() const override; -}; diff --git a/tools/ZAPD/ZAPD/OtherStructs/SkinLimbStructs.cpp b/tools/ZAPD/ZAPD/OtherStructs/SkinLimbStructs.cpp deleted file mode 100644 index e85bdefe76..0000000000 --- a/tools/ZAPD/ZAPD/OtherStructs/SkinLimbStructs.cpp +++ /dev/null @@ -1,354 +0,0 @@ -#include "SkinLimbStructs.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "ZDisplayList.h" -#include "ZFile.h" - -/* SkinVertex */ - -SkinVertex::SkinVertex(ZFile* nParent) : ZResource(nParent) -{ -} - -void SkinVertex::ParseRawData() -{ - const auto& rawData = parent->GetRawData(); - - index = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x00); - s = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x02); - t = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x04); - normX = BitConverter::ToInt8BE(rawData, rawDataIndex + 0x06); - normY = BitConverter::ToInt8BE(rawData, rawDataIndex + 0x07); - normZ = BitConverter::ToInt8BE(rawData, rawDataIndex + 0x08); - alpha = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x09); -} - -std::string SkinVertex::GetBodySourceCode() const -{ - return StringHelper::Sprintf("0x%02X, %i, %i, %i, %i, %i, 0x%02X", index, s, t, normX, normY, - normZ, alpha); -} - -std::string SkinVertex::GetSourceTypeName() const -{ - return "SkinVertex"; -} - -ZResourceType SkinVertex::GetResourceType() const -{ - // TODO - return ZResourceType::Error; -} - -size_t SkinVertex::GetRawDataSize() const -{ - return 0x0A; -} - -/* SkinTransformation */ - -SkinTransformation::SkinTransformation(ZFile* nParent) : ZResource(nParent) -{ -} - -void SkinTransformation::ParseRawData() -{ - const auto& rawData = parent->GetRawData(); - - limbIndex = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x00); - x = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x02); - y = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x04); - z = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x06); - scale = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x08); -} - -std::string SkinTransformation::GetBodySourceCode() const -{ - return StringHelper::Sprintf("0x%02X, %i, %i, %i, 0x%02X", limbIndex, x, y, z, scale); -} - -std::string SkinTransformation::GetSourceTypeName() const -{ - return "SkinTransformation"; -} - -ZResourceType SkinTransformation::GetResourceType() const -{ - // TODO - return ZResourceType::Error; -} - -size_t SkinTransformation::GetRawDataSize() const -{ - return 0x0A; -} - -/* SkinLimbModif */ - -SkinLimbModif::SkinLimbModif(ZFile* nParent) : ZResource(nParent) -{ -} - -void SkinLimbModif::ParseRawData() -{ - const auto& rawData = parent->GetRawData(); - - vtxCount = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x00); - transformCount = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x02); - unk_4 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x04); - skinVertices = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x08); - limbTransformations = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x0C); - - if (skinVertices != 0 && GETSEGNUM(skinVertices) == parent->segment) - { - uint32_t unk_8_Offset = Seg2Filespace(skinVertices, parent->baseAddress); - - skinVertices_arr.reserve(vtxCount); - for (size_t i = 0; i < vtxCount; i++) - { - SkinVertex skinVertices_data(parent); - skinVertices_data.ExtractFromFile(unk_8_Offset); - skinVertices_arr.push_back(skinVertices_data); - - unk_8_Offset += skinVertices_data.GetRawDataSize(); - } - } - - if (limbTransformations != 0 && GETSEGNUM(skinVertices) == parent->segment) - { - uint32_t unk_C_Offset = Seg2Filespace(limbTransformations, parent->baseAddress); - - limbTransformations_arr.reserve(transformCount); - for (size_t i = 0; i < transformCount; i++) - { - SkinTransformation limbTransformations_data(parent); - limbTransformations_data.ExtractFromFile(unk_C_Offset); - limbTransformations_arr.push_back(limbTransformations_data); - - unk_C_Offset += limbTransformations_data.GetRawDataSize(); - } - } -} - -void SkinLimbModif::DeclareReferences(const std::string& prefix) -{ - std::string varPrefix = prefix; - if (name != "") - varPrefix = name; - - if (skinVertices != 0 && GETSEGNUM(skinVertices) == parent->segment) - { - const auto& res = skinVertices_arr.at(0); - std::string unk_8_Str = res.GetDefaultName(varPrefix); - - size_t arrayItemCnt = skinVertices_arr.size(); - std::string entryStr = ""; - - for (size_t i = 0; i < arrayItemCnt; i++) - { - auto& child = skinVertices_arr[i]; - child.DeclareReferences(varPrefix); - entryStr += StringHelper::Sprintf("\t{ %s },", child.GetBodySourceCode().c_str()); - - if (i < arrayItemCnt - 1) - entryStr += "\n"; - } - - uint32_t skinVertices_Offset = Seg2Filespace(skinVertices, parent->baseAddress); - Declaration* decl = parent->GetDeclaration(skinVertices_Offset); - if (decl == nullptr) - { - parent->AddDeclarationArray(skinVertices_Offset, res.GetDeclarationAlignment(), - arrayItemCnt * res.GetRawDataSize(), - res.GetSourceTypeName(), unk_8_Str, arrayItemCnt, entryStr); - } - else - decl->declBody = entryStr; - } - - if (limbTransformations != 0 && GETSEGNUM(limbTransformations) == parent->segment) - { - const auto& res = limbTransformations_arr.at(0); - std::string unk_C_Str = res.GetDefaultName(varPrefix); - - size_t arrayItemCnt = limbTransformations_arr.size(); - std::string entryStr = ""; - - for (size_t i = 0; i < arrayItemCnt; i++) - { - auto& child = limbTransformations_arr[i]; - child.DeclareReferences(varPrefix); - entryStr += StringHelper::Sprintf("\t{ %s },", child.GetBodySourceCode().c_str()); - - if (i < arrayItemCnt - 1) - entryStr += "\n"; - } - - uint32_t unk_C_Offset = Seg2Filespace(limbTransformations, parent->baseAddress); - Declaration* decl = parent->GetDeclaration(unk_C_Offset); - if (decl == nullptr) - { - parent->AddDeclarationArray(unk_C_Offset, res.GetDeclarationAlignment(), - arrayItemCnt * res.GetRawDataSize(), - res.GetSourceTypeName(), unk_C_Str, arrayItemCnt, entryStr); - } - else - decl->declBody = entryStr; - } -} - -std::string SkinLimbModif::GetBodySourceCode() const -{ - std::string skinVertices_Str; - std::string unk_C_Str; - Globals::Instance->GetSegmentedPtrName(skinVertices, parent, "SkinVertex", skinVertices_Str); - Globals::Instance->GetSegmentedPtrName(limbTransformations, parent, "SkinTransformation", - unk_C_Str); - - std::string entryStr = StringHelper::Sprintf("\n\t\tARRAY_COUNTU(%s), ARRAY_COUNTU(%s),\n", - skinVertices_Str.c_str(), unk_C_Str.c_str()); - entryStr += StringHelper::Sprintf("\t\t%i, %s, %s\n\t", unk_4, skinVertices_Str.c_str(), - unk_C_Str.c_str()); - - return entryStr; -} - -std::string SkinLimbModif::GetSourceTypeName() const -{ - return "SkinLimbModif"; -} - -ZResourceType SkinLimbModif::GetResourceType() const -{ - // TODO - return ZResourceType::Error; -} - -size_t SkinLimbModif::GetRawDataSize() const -{ - return 0x10; -} - -/* SkinAnimatedLimbData */ - -SkinAnimatedLimbData::SkinAnimatedLimbData(ZFile* nParent) : ZResource(nParent) -{ -} - -void SkinAnimatedLimbData::ParseRawData() -{ - const auto& rawData = parent->GetRawData(); - - totalVtxCount = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x00); - limbModifCount = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x02); - limbModifications = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x04); - dlist = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x08); - - if (limbModifications != 0 && GETSEGNUM(limbModifications) == parent->segment) - { - uint32_t limbModifications_Offset = Seg2Filespace(limbModifications, parent->baseAddress); - - limbModifications_arr.reserve(limbModifCount); - for (size_t i = 0; i < limbModifCount; i++) - { - SkinLimbModif limbModifications_data(parent); - limbModifications_data.ExtractFromFile(limbModifications_Offset); - limbModifications_arr.push_back(limbModifications_data); - - limbModifications_Offset += limbModifications_data.GetRawDataSize(); - } - } -} - -void SkinAnimatedLimbData::DeclareReferences(const std::string& prefix) -{ - std::string varPrefix = prefix; - if (name != "") - varPrefix = name; - - ZResource::DeclareReferences(varPrefix); - - if (limbModifications != SEGMENTED_NULL && GETSEGNUM(limbModifications) == parent->segment) - { - const auto& res = limbModifications_arr.at(0); - std::string limbModifications_Str = res.GetDefaultName(varPrefix); - - size_t arrayItemCnt = limbModifications_arr.size(); - std::string entryStr = ""; - - for (size_t i = 0; i < arrayItemCnt; i++) - { - auto& child = limbModifications_arr[i]; - child.DeclareReferences(varPrefix); - entryStr += StringHelper::Sprintf("\t{ %s },", child.GetBodySourceCode().c_str()); - - if (i < arrayItemCnt - 1) - entryStr += "\n"; - } - - uint32_t limbModifications_Offset = Seg2Filespace(limbModifications, parent->baseAddress); - Declaration* decl = parent->GetDeclaration(limbModifications_Offset); - if (decl == nullptr) - { - parent->AddDeclarationArray(limbModifications_Offset, res.GetDeclarationAlignment(), - arrayItemCnt * res.GetRawDataSize(), - res.GetSourceTypeName(), limbModifications_Str, - arrayItemCnt, entryStr); - } - else - decl->declBody = entryStr; - } - - if (dlist != SEGMENTED_NULL && GETSEGNUM(dlist) == parent->segment) - { - uint32_t dlist_Offset = Seg2Filespace(dlist, parent->baseAddress); - - int32_t dlistLength = ZDisplayList::GetDListLength( - parent->GetRawData(), dlist_Offset, - Globals::Instance->game == ZGame::OOT_SW97 ? DListType::F3DEX : DListType::F3DZEX); - ZDisplayList* dlist_data = new ZDisplayList(parent); - dlist_data->ExtractFromBinary(dlist_Offset, dlistLength); - - std::string dListStr = - StringHelper::Sprintf("%sSkinLimbDL_%06X", varPrefix.c_str(), dlist_Offset); - dlist_data->SetName(dListStr); - dlist_data->DeclareVar(varPrefix, ""); - dlist_data->DeclareReferences(varPrefix); - parent->AddResource(dlist_data); - } -} - -std::string SkinAnimatedLimbData::GetBodySourceCode() const -{ - std::string limbModifications_Str; - std::string dlist_Str; - Globals::Instance->GetSegmentedPtrName(limbModifications, parent, "SkinLimbModif", - limbModifications_Str); - Globals::Instance->GetSegmentedPtrName(dlist, parent, "Gfx", dlist_Str); - - std::string entryStr = "\n"; - entryStr += StringHelper::Sprintf("\t%i, ARRAY_COUNTU(%s),\n", totalVtxCount, - limbModifications_Str.c_str()); - entryStr += - StringHelper::Sprintf("\t%s, %s\n", limbModifications_Str.c_str(), dlist_Str.c_str()); - - return entryStr; -} - -std::string SkinAnimatedLimbData::GetSourceTypeName() const -{ - return "SkinAnimatedLimbData"; -} - -ZResourceType SkinAnimatedLimbData::GetResourceType() const -{ - // TODO - return ZResourceType::Error; -} - -size_t SkinAnimatedLimbData::GetRawDataSize() const -{ - return 0x0C; -} diff --git a/tools/ZAPD/ZAPD/OtherStructs/SkinLimbStructs.h b/tools/ZAPD/ZAPD/OtherStructs/SkinLimbStructs.h deleted file mode 100644 index f338ebeddc..0000000000 --- a/tools/ZAPD/ZAPD/OtherStructs/SkinLimbStructs.h +++ /dev/null @@ -1,111 +0,0 @@ -#pragma once - -#include -#include -#include - -#include "ZResource.h" - -enum class ZLimbSkinType -{ - SkinType_Null, // SkinLimb segment = NULL - SkinType_Animated = 4, // SkinLimb segment = SkinAnimatedLimbData* - SkinType_Normal = 11, // SkinLimb segment = Gfx* -}; - -class SkinVertex : public ZResource -{ -public: - SkinVertex(ZFile* nParent); - - void ParseRawData() override; - - std::string GetBodySourceCode() const override; - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - size_t GetRawDataSize() const override; - -protected: - uint16_t index; - int16_t s; - int16_t t; - int8_t normX; - int8_t normY; - int8_t normZ; - uint8_t alpha; -}; - -class SkinTransformation : public ZResource -{ -public: - SkinTransformation(ZFile* nParent); - - void ParseRawData() override; - - std::string GetBodySourceCode() const override; - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - size_t GetRawDataSize() const override; - -protected: - uint8_t limbIndex; - int16_t x; - int16_t y; - int16_t z; - uint8_t scale; -}; - -class SkinLimbModif : public ZResource -{ -public: - SkinLimbModif(ZFile* nParent); - - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - size_t GetRawDataSize() const override; - -protected: - uint16_t vtxCount; // Number of vertices in this modif entry - uint16_t transformCount; // Length of limbTransformations - uint16_t unk_4; // 0 or 1, used as an index for limbTransformations - segptr_t skinVertices; // SkinVertex* - segptr_t limbTransformations; // SkinTransformation* - - std::vector skinVertices_arr; - std::vector limbTransformations_arr; -}; - -class SkinAnimatedLimbData : public ZResource -{ -public: - SkinAnimatedLimbData(ZFile* nParent); - - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - size_t GetRawDataSize() const override; - -protected: - uint16_t totalVtxCount; - uint16_t limbModifCount; // Length of limbModifications - segptr_t limbModifications; // SkinLimbModif* - segptr_t dlist; // Gfx* - - std::vector limbModifications_arr; - // ZDisplayList* unk_8_dlist = nullptr; -}; diff --git a/tools/ZAPD/ZAPD/OutputFormatter.cpp b/tools/ZAPD/ZAPD/OutputFormatter.cpp deleted file mode 100644 index 393ec1936a..0000000000 --- a/tools/ZAPD/ZAPD/OutputFormatter.cpp +++ /dev/null @@ -1,115 +0,0 @@ -#include "OutputFormatter.h" - -void OutputFormatter::Flush() -{ - if (col > lineLimit) - { - str.append(1, '\n'); - str.append(currentIndent, ' '); - - uint32_t newCol = currentIndent + (wordP - word); - - for (uint32_t i = 0; i < wordNests; i++) - nestIndent[nest - i] -= col - newCol; - - col = newCol; - } - else - { - str.append(space, spaceP - space); - } - spaceP = space; - - str.append(word, wordP - word); - wordP = word; - wordNests = 0; -} - -int OutputFormatter::Write(const char* buf, int count) -{ - for (int i = 0; i < count; i++) - { - char c = buf[i]; - - if (c == ' ' || c == '\t' || c == '\n') - { - if (wordP - word != 0) - { - Flush(); - } - - if (c == '\n') - { - col = 0; - *spaceP++ = c; - } - else if (c == '\t') - { - int n = tabSize - (col % tabSize); - col += n; - for (int j = 0; j < n; j++) - *spaceP++ = ' '; - } - else - { - col++; - *spaceP++ = c; - } - - currentIndent = nestIndent[nest]; - } - else - { - col++; - - if (c == '(') - { - nest++; - nestIndent[nest] = col; - wordNests++; - } - else if (c == ')') - { - if (nest > 0) - nest--; - if (wordNests > 0) - wordNests--; - } - - *wordP++ = c; - } - } - - return count; -} - -int OutputFormatter::Write(const std::string& buf) -{ - return Write(buf.data(), buf.size()); -} - -OutputFormatter* OutputFormatter::Instance; - -int OutputFormatter::WriteStatic(const char* buf, int count) -{ - return Instance->Write(buf, count); -} - -int (*OutputFormatter::StaticWriter())(const char* buf, int count) -{ - Instance = this; - return &WriteStatic; -} - -OutputFormatter::OutputFormatter(uint32_t tabSize, uint32_t indentation, uint32_t lineLimit) - : tabSize{tabSize}, lineLimit{lineLimit}, col{0}, nest{0}, nestIndent{indentation}, - currentIndent{indentation}, wordNests(0), wordP{word}, spaceP{space} -{ -} - -std::string OutputFormatter::GetOutput() -{ - Flush(); - - return std::move(str); -} diff --git a/tools/ZAPD/ZAPD/OutputFormatter.h b/tools/ZAPD/ZAPD/OutputFormatter.h deleted file mode 100644 index ec56b654da..0000000000 --- a/tools/ZAPD/ZAPD/OutputFormatter.h +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -class OutputFormatter -{ -private: - const uint32_t tabSize; - const uint32_t lineLimit; - - uint32_t col; - uint32_t nest; - uint32_t nestIndent[8]; - uint32_t currentIndent; - uint32_t wordNests; - - char word[128]; - char space[128]; - char* wordP; - char* spaceP; - - std::string str; - - void Flush(); - - static OutputFormatter* Instance; - static int WriteStatic(const char* buf, int count); - -public: - OutputFormatter(uint32_t tabSize = 4, uint32_t indentation = 4, uint32_t lineLimit = 120); - - int (*StaticWriter())(const char* buf, int count); // Must be `int` due to libgfxd - - int Write(const char* buf, int count); - int Write(const std::string& buf); - - std::string GetOutput(); -}; diff --git a/tools/ZAPD/ZAPD/WarningHandler.cpp b/tools/ZAPD/ZAPD/WarningHandler.cpp deleted file mode 100644 index f416a5b80c..0000000000 --- a/tools/ZAPD/ZAPD/WarningHandler.cpp +++ /dev/null @@ -1,455 +0,0 @@ -/** - * ZAPD Warning- and Error-handling system - * ======================================= - * - * This provides a common standard way to write ZAPD warnings/errors, which should be used for all - * such. It will pretty-print them in a uniform way, with styles defined in the header. - * - * Warnings/errors should be constructed using the macros given in the header; there are now plenty - * of examples in the codebase of how to do this. Their purposes are noted above each category in - * the header. Each warning has a type, one of the ones in warningStringToInitMap, or - * WarningType::Always, which is used for warnings that cannot be disabled and do not display a - * type. - * - * Currently there are three levels of alert a warning can have: - * - Off (does not display anything) - * - Warn (print a warning but continue processing) - * - Err (behave like an error, i.e. print and throw an exception to crash ZAPD when occurs) - * - * Flag use: - * - -Wfoo enables warnings of type foo - * - -Wno-foo disables warnings of type foo - * - -Werror=foo escalates foo to behave like an error - * - -Weverything enables all warnings - * - -Werror escalates all enabled warnings to errors - * - * Errors do not have types, and will always throw an exception; they cannot be disabled. - * - * Format - * === - * Each printed warning/error contains the same three sections: - * - Preamble: automatically generated; the content varies depending on category. It will print the - * file and function that the warning is from, and information about the files being processed - * or extracted. - * - Header: begins with 'warning: ' or 'error:', should contain essential information about the - * warning/error, ends with the warning type if applicable. Printed with emphasis to make it - * stand out. Does not start with a capital letter or end with a '.' - * - Body (optional): indented, should contain further diagnostic information useful for identifying - * and fixing the warning/error. Can be a sentence with captialisation and '.' on the end. - * - * Please think of what the end user will find most useful when writing the header and body, and try - * to keep it brief without sacrificing important information! Also remember that if the user is - * only looking at stderr, they will normally have no other context. - * - * Warning vs error - * === - * The principle that we have operated on so far is - * - issue a warning if ZAPD will still be able to produce a valid, compilable C file that will - * match - * - if this cannot happen, use an error. - * but at the end of the day, it is up to the programmer's discretion what it should be possible to - * disable. - * - * Documentation - * === - * Remember that all warnings also need to be documented in the README.md. The help is generated - * automatically. - */ -#include "WarningHandler.h" - -#include -#include "Globals.h" -#include "Utils/StringHelper.h" - -typedef struct -{ - WarningType type; - WarningLevel defaultLevel; - std::string description; -} WarningInfoInit; - -typedef struct -{ - WarningLevel level; - std::string name; - std::string description; -} WarningInfo; - -/** - * Master list of all default warning types and features - * - * To add a warning type, fill in a new row of this map. Think carefully about what its default - * level should be, and try and make the description both brief and informative: it is used in the - * help message, so again, think about what the end user needs to know. - */ -// clang-format off -static const std::unordered_map warningStringToInitMap = { - {"deprecated", {WarningType::Deprecated, -#ifdef DEPRECATION_ON - WarningLevel::Warn, -#else - WarningLevel::Off, -#endif - "Deprecated features"}}, - {"unaccounted", {WarningType::Unaccounted, WarningLevel::Off, "Large blocks of unaccounted"}}, - {"missing-offsets", {WarningType::MissingOffsets, WarningLevel::Warn, "Offset attribute missing in XML tag"}}, - {"intersection", {WarningType::Intersection, WarningLevel::Warn, "Two assets intersect"}}, - {"missing-attribute", {WarningType::MissingAttribute, WarningLevel::Warn, "Required attribute missing in XML tag"}}, - {"invalid-attribute-value", {WarningType::InvalidAttributeValue, WarningLevel::Err, "Attribute declared in XML is wrong"}}, - {"unknown-attribute", {WarningType::UnknownAttribute, WarningLevel::Warn, "Unknown attribute in XML entry tag"}}, - {"invalid-xml", {WarningType::InvalidXML, WarningLevel::Err, "XML has syntax errors"}}, - {"invalid-jpeg", {WarningType::InvalidJPEG, WarningLevel::Err, "JPEG file does not conform to the game's format requirements"}}, - {"invalid-png", {WarningType::InvalidPNG, WarningLevel::Err, "Issues arising when processing PNG data"}}, - {"invalid-extracted-data", {WarningType::InvalidExtractedData, WarningLevel::Err, "Extracted data does not have correct form"}}, - {"missing-segment", {WarningType::MissingSegment, WarningLevel::Warn, "Segment not given in File tag in XML"}}, - {"hardcoded-generic-pointer", {WarningType::HardcodedGenericPointer, WarningLevel::Off, "A generic segmented pointer must be produced"}}, - {"hardcoded-pointer", {WarningType::HardcodedPointer, WarningLevel::Warn, "ZAPD lacks the info to make a symbol, so must output a hardcoded pointer"}}, - {"not-implemented", {WarningType::NotImplemented, WarningLevel::Warn, "ZAPD does not currently support this feature"}}, -}; - -/** - * Map constructed at runtime to contain the warning features as set by the user using -W flags. - */ -static std::unordered_map warningTypeToInfoMap; - -void WarningHandler::ConstructTypeToInfoMap() { - for (auto& entry : warningStringToInitMap) { - warningTypeToInfoMap[entry.second.type] = {entry.second.defaultLevel, entry.first, entry.second.description}; - } - warningTypeToInfoMap[WarningType::Always] = {WarningLevel::Warn, "always", "you shouldn't be reading this"}; - assert(warningTypeToInfoMap.size() == static_cast(WarningType::Max)); -} - -/** - * Initialises the main warning type map and reads flags passed to set each warning type's level. - */ -void WarningHandler::Init(int argc, char* argv[]) { - ConstructTypeToInfoMap(); - - bool werror = false; - for (int i = 1; i < argc; i++) { - // If it doesn't start with "-W" skip it. - if (argv[i][0] != '-' || argv[i][1] != 'W' || argv[i][2] == '\0') { - continue; - } - - WarningLevel warningTypeOn = WarningLevel::Warn; - size_t startingIndex = 2; - - // "-Wno-" - if (argv[i][2] == 'n' && argv[i][3] == 'o' && argv[i][4] == '-' && argv[i][5] != '\0') { - warningTypeOn = WarningLevel::Off; - startingIndex = 5; - } - - // Read starting after the "-W" or "-Wno-" - std::string_view currentArgv = &argv[i][startingIndex]; - - if (currentArgv == "error") { - werror = warningTypeOn != WarningLevel::Off; - } else if (currentArgv == "everything") { - for (auto& it: warningTypeToInfoMap) { - if (it.second.level <= WarningLevel::Warn) { - it.second.level = warningTypeOn; - } - } - } else { - // "-Werror=" / "-Wno-error=" parser - if (currentArgv.rfind("error=", 0) == 0) { - // Read starting after the "error=" part - currentArgv = &argv[i][startingIndex + 6]; - warningTypeOn = warningTypeOn != WarningLevel::Off ? WarningLevel::Err : WarningLevel::Warn; - } - - auto it = warningStringToInitMap.find(std::string(currentArgv)); - if (it != warningStringToInitMap.end()) { - warningTypeToInfoMap[it->second.type].level = warningTypeOn; - } - else { - HANDLE_WARNING(WarningType::Always, StringHelper::Sprintf("unknown warning flag '%s'", argv[i]), ""); - } - } - } - - if (werror) { - for (auto& it: warningTypeToInfoMap) { - if (it.second.level >= WarningLevel::Warn) { - it.second.level = WarningLevel::Err; - } - } - } -} - -bool WarningHandler::IsWarningEnabled(WarningType warnType) { - assert(static_cast(warnType) >= 0 && warnType < WarningType::Max); - - return warningTypeToInfoMap.at(warnType).level != WarningLevel::Off; -} - -bool WarningHandler::WasElevatedToError(WarningType warnType) { - assert(static_cast(warnType) >= 0 && warnType < WarningType::Max); - - if (!IsWarningEnabled(warnType)) { - return false; - } - - return warningTypeToInfoMap.at(warnType).level >= WarningLevel::Err; -} - -/** - * Print file/line/function info for debugging - */ -void WarningHandler::FunctionPreamble(const char* filename, int32_t line, const char* function) { - bool forcePrint = false; - -#ifdef DEVELOPMENT - forcePrint = true; -#endif - - fprintf(stderr, "\n"); - - if (forcePrint || Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_DEBUG) { - fprintf(stderr, "%s:%i: in function <%s>:\n", filename, line, function); - } -} - -/** - * Print the information about the file(s) being processed (XML for extraction, png etc. for building) - */ -void WarningHandler::ProcessedFilePreamble() { - if (Globals::Instance->inputPath != "") { - fprintf(stderr, "When processing file %s: ", Globals::Instance->inputPath.c_str()); - } -} - -/** - * Print information about the binary file being extracted - */ -void WarningHandler::ExtractedFilePreamble(const ZFile *parent, const ZResource* res, const uint32_t offset) { - fprintf(stderr, "in input binary file %s, ", parent->GetName().c_str()); - if (res != nullptr) { - fprintf(stderr, "resource '%s' at ", res->GetName().c_str()); - } - if (offset != static_cast(-1)) { - fprintf(stderr, "offset 0x%06X:", offset); - } - fprintf(stderr, "\n\t"); -} - -/** - * Construct the rest of the message, after warning:/error. The message is filled in one character at a time, with indents added after newlines - */ -std::string WarningHandler::ConstructMessage(std::string message, const std::string& header, const std::string& body) { - message.reserve(message.size() + header.size() + body.size() + 10 * (sizeof(HANG_INDT) - 1)); - message += StringHelper::Sprintf(HILITE("%s"), header.c_str()); - message += "\n"; - - if (body == "") { - return message; - } - - message += HANG_INDT; - for (const char* ptr = body.c_str(); *ptr != '\0'; ptr++) { - message += *ptr; - if (*ptr == '\n') { - message += HANG_INDT; - } - } - message += "\n"; - - return message; -} - -/* Error module functions */ - -void WarningHandler::PrintErrorAndThrow(const std::string& header, const std::string& body) { - std::string errorMsg = ERR_FMT("error: "); - throw std::runtime_error(ConstructMessage(errorMsg, header, body)); -} - -/* Error types, to be used via the macros */ - -void WarningHandler::ErrorType(WarningType warnType, const std::string& header, const std::string& body) { - std::string headerMsg = header; - - for (const auto& iter: warningStringToInitMap) { - if (iter.second.type == warnType) { - headerMsg += StringHelper::Sprintf(" [%s]", iter.first.c_str()); - } - } - - PrintErrorAndThrow(headerMsg, body); -} - -void WarningHandler::Error_Plain(const char* filename, int32_t line, const char* function, WarningType warnType, const std::string& header, const std::string& body) { - FunctionPreamble(filename, line, function); - - ErrorType(warnType, header, body); -} - -void WarningHandler::Error_Process(const char* filename, int32_t line, const char* function, WarningType warnType, const std::string& header, const std::string& body) { - FunctionPreamble(filename, line, function); - ProcessedFilePreamble(); - - ErrorType(warnType, header, body); -} - -void WarningHandler::Error_Resource(const char* filename, int32_t line, const char* function, WarningType warnType, const ZFile *parent, const ZResource* res, const uint32_t offset, const std::string& header, const std::string& body) { - assert(parent != nullptr); - - FunctionPreamble(filename, line, function); - ProcessedFilePreamble(); - ExtractedFilePreamble(parent, res, offset); - - ErrorType(warnType, header, body); -} - -/* Warning module functions */ - -void WarningHandler::PrintWarningBody(const std::string& header, const std::string& body) { - std::string errorMsg = WARN_FMT("warning: "); - fprintf(stderr, "%s", ConstructMessage(errorMsg, header, body).c_str()); -} - -void WarningHandler::WarningTypeAndChooseEscalate(WarningType warnType, const std::string& header, const std::string& body) { - std::string headerMsg = header; - - for (const auto& iter: warningStringToInitMap) { - if (iter.second.type == warnType) { - headerMsg += StringHelper::Sprintf(" [-W%s]", iter.first.c_str()); - } - } - - if (WasElevatedToError(warnType)) { - PrintErrorAndThrow(headerMsg, body); - } else { - PrintWarningBody(headerMsg, body); - } -} - - -/* Warning types, to be used via the macros */ - -void WarningHandler::Warning_Plain(const char* filename, int32_t line, const char* function, WarningType warnType, const std::string& header, const std::string& body) { - if (!IsWarningEnabled(warnType)) { - return; - } - - FunctionPreamble(filename, line, function); - - WarningTypeAndChooseEscalate(warnType, header, body); -} - -void WarningHandler::Warning_Process(const char* filename, int32_t line, const char* function, WarningType warnType, const std::string& header, const std::string& body) { - if (!IsWarningEnabled(warnType)) { - return; - } - - FunctionPreamble(filename, line, function); - ProcessedFilePreamble(); - - WarningTypeAndChooseEscalate(warnType, header, body); -} - -void WarningHandler::Warning_Resource(const char* filename, int32_t line, const char* function, WarningType warnType, const ZFile *parent, const ZResource* res, const uint32_t offset, const std::string& header, const std::string& body) { - assert(parent != nullptr); - - if (!IsWarningEnabled(warnType)) { - return; - } - - FunctionPreamble(filename, line, function); - ProcessedFilePreamble(); - ExtractedFilePreamble(parent, res, offset); - - WarningTypeAndChooseEscalate(warnType, header, body); -} - - -/* Help-related functions */ - -#include - -/** - * Print each warning name, default status, and description using the init map - */ -void WarningHandler::PrintHelp() { - std::set sortedKeys; - WarningInfoInit warningInfo; - uint32_t columnWidth = 25; - std::string dt; - - // Sort keys through the magic of `set`, to print in alphabetical order - for (auto& it : warningStringToInitMap) { - sortedKeys.insert(it.first); - } - - printf("\nWarning types ( * means enabled by default)\n"); - for (auto& key : sortedKeys) { - warningInfo = warningStringToInitMap.at(key); - if (warningInfo.defaultLevel <= WarningLevel::Warn) { - dt = "-W"; - dt += key; - if (warningInfo.defaultLevel == WarningLevel::Warn) { - dt += " *"; - } - printf(HELP_DT_INDT "%-*s", columnWidth, dt.c_str()); - - if (dt.length() + 2 > columnWidth) { - printf("\n" HELP_DT_INDT "%-*s", columnWidth, ""); - } - printf("%s\n", warningInfo.description.c_str()); - } - } - - printf("\nDefault errors\n"); - for (auto& key : sortedKeys) { - if (warningInfo.defaultLevel > WarningLevel::Warn) { - dt = "-W"; - dt += key; - printf(HELP_DT_INDT "%-*s", columnWidth, dt.c_str()); - - if (dt.length() + 2 > columnWidth) { - printf("\n" HELP_DT_INDT "%*s", columnWidth, ""); - } - printf("%s\n", warningInfo.description.c_str()); - } - } - - printf("\n"); - printf("Other\n" HELP_DT_INDT "-Weverything will enable all existing warnings.\n" HELP_DT_INDT "-Werror will promote all warnings to errors.\n"); - - printf("\n"); - printf("Warnings can be disabled using -Wno-... instead of -W...; -Weverything will override any -Wno-... flags passed before it.\n"); -} - -/** - * Print which warnings are currently enabled - */ -void WarningHandler::PrintWarningsDebugInfo() -{ - std::string dt; - - printf("Warnings status:\n"); - for (auto& it: warningTypeToInfoMap) { - dt = it.second.name; - dt += ": "; - - printf(HELP_DT_INDT "%-25s", dt.c_str()); - switch (it.second.level) - { - case WarningLevel::Off: - printf(VT_FGCOL(LIGHTGRAY) "Off" VT_RST); - break; - case WarningLevel::Warn: - printf(VT_FGCOL(YELLOW) "Warn" VT_RST); - break; - case WarningLevel::Err: - printf(VT_FGCOL(RED) "Err" VT_RST); - break; - - } - printf("\n"); - } - printf("\n"); -} diff --git a/tools/ZAPD/ZAPD/WarningHandler.h b/tools/ZAPD/ZAPD/WarningHandler.h deleted file mode 100644 index f99330042b..0000000000 --- a/tools/ZAPD/ZAPD/WarningHandler.h +++ /dev/null @@ -1,146 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include "Utils/vt.h" -#include "ZFile.h" - -#ifdef _MSC_VER -#define __PRETTY_FUNCTION__ __FUNCSIG__ -#elif not defined(__GNUC__) -#define __PRETTY_FUNCTION__ __func__ -#endif - -// ======================================= -/* Formatting macros */ - -// TODO: move this somewhere else so it can be used by other help -#define HELP_DT_INDT " " - -/* Macros for formatting warnings/errors */ -#define VT_HILITE VT_BOLD_FGCOL(WHITE) -#define VT_WARN VT_BOLD_FGCOL(PURPLE) -#define VT_ERR VT_BOLD_FGCOL(RED) - -#define HILITE(string) (VT_HILITE string VT_RST) -#define WARN_FMT(string) (VT_WARN string VT_RST) -#define ERR_FMT(string) (VT_ERR string VT_RST) - -// Maybe make WARN_LF instead -// Currently 8 spaces -#define WARN_INDT " " -// Currently 16 spaces -#define HANG_INDT " " - -// ======================================= -/* Warning and error macros */ -// TODO: better names - -// General-purpose, plain style (only prints function,file,line in the preamble) -#define HANDLE_ERROR(warningType, header, body) \ - WarningHandler::Error_Plain(__FILE__, __LINE__, __PRETTY_FUNCTION__, warningType, header, body) -#define HANDLE_WARNING(warningType, header, body) \ - WarningHandler::Warning_Plain(__FILE__, __LINE__, __PRETTY_FUNCTION__, warningType, header, \ - body) - -// For processing XMLs or textures/blobs (preamble contains function,file,line; processed file) -#define HANDLE_ERROR_PROCESS(warningType, header, body) \ - WarningHandler::Error_Process(__FILE__, __LINE__, __PRETTY_FUNCTION__, warningType, header, \ - body) -#define HANDLE_WARNING_PROCESS(warningType, header, body) \ - WarningHandler::Warning_Process(__FILE__, __LINE__, __PRETTY_FUNCTION__, warningType, header, \ - body) - -// For ZResource-related stuff (preamble contains function,file,line; processed file; extracted file -// and offset) -#define HANDLE_ERROR_RESOURCE(warningType, parent, resource, offset, header, body) \ - WarningHandler::Error_Resource(__FILE__, __LINE__, __PRETTY_FUNCTION__, warningType, parent, \ - resource, offset, header, body) -#define HANDLE_WARNING_RESOURCE(warningType, parent, resource, offset, header, body) \ - WarningHandler::Warning_Resource(__FILE__, __LINE__, __PRETTY_FUNCTION__, warningType, parent, \ - resource, offset, header, body) - -// ======================================= - -enum class WarningType -{ - Always, // Warnings of this type are always printed, cannot be disabled. - Deprecated, - Unaccounted, - MissingOffsets, - Intersection, - MissingAttribute, - InvalidAttributeValue, - UnknownAttribute, - InvalidXML, - InvalidJPEG, - InvalidPNG, - InvalidExtractedData, - MissingSegment, - HardcodedPointer, - HardcodedGenericPointer, - NotImplemented, - Max, -}; - -enum class WarningLevel -{ - Off, - Warn, - Err, -}; - -class WarningHandler -{ -public: - static void ConstructTypeToInfoMap(); - - static void Init(int argc, char* argv[]); - - static bool IsWarningEnabled(WarningType warnType); - static bool WasElevatedToError(WarningType warnType); - - static void FunctionPreamble(const char* filename, int32_t line, const char* function); - static void ProcessedFilePreamble(); - static void ExtractedFilePreamble(const ZFile* parent, const ZResource* res, - const uint32_t offset); - static std::string ConstructMessage(std::string message, const std::string& header, - const std::string& body); - - [[noreturn]] static void PrintErrorAndThrow(const std::string& header, const std::string& body); - static void PrintWarningBody(const std::string& header, const std::string& body); - - [[noreturn]] static void ErrorType(WarningType warnType, const std::string& header, - const std::string& body); - [[noreturn]] static void Error_Plain(const char* filename, int32_t line, const char* function, - WarningType warnType, const std::string& header, - const std::string& body); - [[noreturn]] static void Error_Process(const char* filename, int32_t line, const char* function, - WarningType warnType, const std::string& header, - const std::string& body); - [[noreturn]] static void Error_Resource(const char* filename, int32_t line, - const char* function, WarningType warnType, - const ZFile* parent, const ZResource* res, - const uint32_t offset, const std::string& header, - const std::string& body); - - static void WarningTypeAndChooseEscalate(WarningType warnType, const std::string& header, - const std::string& body); - - static void Warning_Plain(const char* filename, int32_t line, const char* function, - WarningType warnType, const std::string& header, - const std::string& body); - static void Warning_Process(const char* filename, int32_t line, const char* function, - WarningType warnType, const std::string& header, - const std::string& body); - static void Warning_Resource(const char* filename, int32_t line, const char* function, - WarningType warnType, const ZFile* parent, const ZResource* res, - const uint32_t offset, const std::string& header, - const std::string& body); - - static void PrintHelp(); - static void PrintWarningsDebugInfo(); -}; diff --git a/tools/ZAPD/ZAPD/ZAPD.vcxproj b/tools/ZAPD/ZAPD/ZAPD.vcxproj deleted file mode 100644 index 26a0b70363..0000000000 --- a/tools/ZAPD/ZAPD/ZAPD.vcxproj +++ /dev/null @@ -1,383 +0,0 @@ - - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {B53F9E5B-0A58-4BAE-9AFE-856C8CBB8D36} - ZAPD - 10.0 - ZAPD - - - - Application - true - v142 - MultiByte - - - Application - false - v142 - true - MultiByte - - - Application - true - v142 - MultiByte - false - - - Application - false - v142 - true - MultiByte - false - - - - - - - - - - - - - - - - - - - - - $(OutDir);$(ProjectDir)..\lib\libgfxd;$(ProjectDir)..\packages\libpng-v142.1.6.37.2\build\native\lib\x64\v142\Debug\;$(LibraryPath) - $(ProjectDir)..\ZAPDUtils;$(ProjectDir)..\lib\tinyxml2;$(ProjectDir)..\lib\libgfxd;$(ProjectDir)..\lib\elfio;$(ProjectDir)..\lib\stb;$(ProjectDir);$(IncludePath) - - - $(IncludePath) - - - $(SolutionDir)ZAPD\lib\tinyxml2;$(SolutionDir)ZAPD\lib\libgfxd;$(SolutionDir)ZAPD\lib\elfio;$(SolutionDir)ZAPD\lib\stb;$(ProjectDir);$(IncludePath) - $(SolutionDir)ZAPD\lib\libgfxd;$(SolutionDir)x64\Debug;$(SolutionDir)packages\libpng.1.6.28.1\build\native\lib\x64\v140\dynamic\Debug;$(LibraryPath) - - - - Level3 - Disabled - true - true - stdcpp17 - stdc11 - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - - - true - Console - - - cd .. -mkdir build\ZAPD - python ZAPD/genbuildinfo.py - - - - - Level3 - Disabled - true - true - stdcpp17 - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - EnableFastChecks - stdc11 - MultiThreadedDebug - true - - - true - ZAPDUtils.lib;/WHOLEARCHIVE:ExporterExample.lib;%(AdditionalDependencies) - false - Console - - - cd .. -mkdir build\ZAPD - python ZAPD/genbuildinfo.py - - - - - Level3 - MaxSpeed - true - true - true - true - true - - - true - true - - - cd .. -mkdir build\ZAPD - python ZAPD/genbuildinfo.py - - - - - Level3 - MaxSpeed - true - true - true - true - stdcpplatest - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - - - true - true - - - cd .. -mkdir build\ZAPD - python ZAPD/genbuildinfo.py - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - \ No newline at end of file diff --git a/tools/ZAPD/ZAPD/ZAPD.vcxproj.filters b/tools/ZAPD/ZAPD/ZAPD.vcxproj.filters deleted file mode 100644 index 51723306b4..0000000000 --- a/tools/ZAPD/ZAPD/ZAPD.vcxproj.filters +++ /dev/null @@ -1,605 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - {02148456-5068-4613-8478-f10addc58e70} - - - {bcab3136-95ba-4839-833c-43d78ad6e335} - - - {dc06ed84-f6fe-4277-80f3-d62bd5cdbb98} - - - {6049c045-bc38-4221-b29e-ca6d4d8af4aa} - - - {490e3a08-047b-48d3-ab53-3a860a3b92aa} - - - {26c06845-8e8e-4b79-ad18-07c4f9c0f801} - - - {d45c420d-2378-47ac-92c5-80db9475c195} - - - {03cc56a2-e0e8-4167-80a0-98fb900a959a} - - - {73db0879-6df8-4f6a-8cc2-a1f836e9e796} - - - {be9a5be0-ec6a-4200-8e39-bb58c7da7aa8} - - - {7ee79d97-c6a8-4e82-93ef-37981f4d7838} - - - {85600275-99fe-491d-8189-bcc3dc1a8903} - - - {ba9990b0-1082-48bb-874c-6108534b5455} - - - {ce9d91b0-ba20-4296-bc2d-8630965bb392} - - - {730beb67-6d59-4849-9d9b-702c4a565fc0} - - - - - Source Files - - - Source Files\Z64\ZRoom - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64\ZRoom - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64\ZRoom\Commands - - - Source Files - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64 - - - Source Files\Z64 - - - Source Files\Z64 - - - Source Files\Z64 - - - Source Files\Z64 - - - Source Files\Z64 - - - Source Files\Z64 - - - Source Files\Z64 - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64 - - - Source Files\Z64 - - - Source Files\Z64 - - - Source Files\Z64 - - - Source Files\Z64 - - - Source Files\Z64 - - - Source Files - - - Source Files\Z64 - - - Source Files\Libraries\libgfxd - - - Source Files\Libraries\libgfxd - - - Source Files\Libraries\libgfxd - - - Source Files\Libraries\libgfxd - - - Source Files\Libraries\libgfxd - - - Source Files\Libraries\libgfxd - - - Source Files\Libraries\libgfxd - - - Source Files\Z64 - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64 - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64 - - - Source Files - - - Source Files - - - Source Files\Z64 - - - Source Files - - - Source Files\Z64 - - - Source Files\Z64 - - - Source Files - - - Source Files\Z64 - - - Source Files - - - Source Files\Z64 - - - Source Files\Z64 - - - Source Files - - - Source Files\Z64 - - - Source Files\Z64 - - - Source Files\Z64 - - - Source Files\Z64 - - - Source Files\Z64 - - - Source Files\Z64\ZRoom\Commands - - - Source Files\Z64 - - - Source Files\Z64 - - - - - Header Files\Z64\ZRoom - - - Header Files\Z64\ZRoom - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Libraries\elfio - - - Header Files\Libraries\elfio - - - Header Files\Libraries\elfio - - - Header Files\Libraries\elfio - - - Header Files\Libraries\elfio - - - Header Files\Libraries\elfio - - - Header Files\Libraries\elfio - - - Header Files\Libraries\elfio - - - Header Files\Libraries\elfio - - - Header Files\Libraries\elfio - - - Header Files\Libraries\elfio - - - Header Files\Libraries\elfio - - - Header Files - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Libraries - - - Header Files\Libraries - - - Header Files\Z64 - - - Header Files\Z64 - - - Header Files\Z64 - - - Header Files\Z64 - - - Header Files\Z64 - - - Header Files\Z64 - - - Header Files\Z64 - - - Header Files\Z64 - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64 - - - Header Files\Z64 - - - Header Files\Z64 - - - Header Files - - - Header Files\Z64 - - - Header Files\Z64 - - - Header Files - - - Header Files\Z64 - - - Header Files - - - Header Files\Z64 - - - Header Files\Libraries\libgfxd - - - Header Files\Libraries\libgfxd - - - Header Files\Libraries\libgfxd - - - Header Files\Z64 - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64 - - - Header Files\Z64\ZRoom\Commands - - - Header Files - - - Header Files\Z64 - - - Header Files - - - Header Files\Z64 - - - Header Files - - - Header Files\Z64 - - - Header Files\Z64 - - - Header Files\Z64 - - - Header Files - - - Header Files\Z64 - - - Header Files\Z64 - - - Header Files - - - Header Files\Z64 - - - Header Files - - - Header Files - - - Header Files - - - Header Files\Z64 - - - Header Files\Z64 - - - Header Files\Z64\ZRoom\Commands - - - Header Files\Z64 - - - Header Files\Z64 - - - - - Resource Files - - - any\any - - - NuGet - - - - - - \ No newline at end of file diff --git a/tools/ZAPD/ZAPD/ZActorList.cpp b/tools/ZAPD/ZAPD/ZActorList.cpp deleted file mode 100644 index ee5cb4d445..0000000000 --- a/tools/ZAPD/ZAPD/ZActorList.cpp +++ /dev/null @@ -1,194 +0,0 @@ -#include "ZActorList.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "WarningHandler.h" -#include "ZFile.h" -#include "ZRoom/ZNames.h" - -REGISTER_ZFILENODE(ActorList, ZActorList); - -ZActorList::ZActorList(ZFile* nParent) : ZResource(nParent) -{ - RegisterRequiredAttribute("Count"); -} - -void ZActorList::ExtractFromBinary(uint32_t nRawDataIndex, uint8_t nNumActors) -{ - rawDataIndex = nRawDataIndex; - numActors = nNumActors; - - // Don't parse raw data of external files - if (parent->GetMode() == ZFileMode::ExternalFile) - return; - - ParseRawData(); -} - -void ZActorList::ParseXML(tinyxml2::XMLElement* reader) -{ - ZResource::ParseXML(reader); - - numActors = StringHelper::StrToL(registeredAttributes.at("Count").value); - - if (numActors < 1) - { - HANDLE_ERROR_RESOURCE( - WarningType::InvalidAttributeValue, parent, this, rawDataIndex, - StringHelper::Sprintf("invalid value '%d' found for 'NumPaths' attribute", numActors), - "Should be at least '1'"); - } -} - -void ZActorList::ParseRawData() -{ - ZResource::ParseRawData(); - - offset_t currentPtr = rawDataIndex; - size_t largestlength = 0; - - for (size_t i = 0; i < numActors; i++) - { - ActorSpawnEntry entry(parent->GetRawData(), currentPtr); - - currentPtr += entry.GetRawDataSize(); - actors.push_back(entry); - - size_t actorNameLength = ZNames::GetActorName(entry.GetActorId()).size(); - if (actorNameLength > largestlength) - largestlength = actorNameLength; - } - - for (auto& entry : actors) - { - entry.SetLargestActorName(largestlength); - } -} - -Declaration* ZActorList::DeclareVar(const std::string& prefix, const std::string& bodyStr) -{ - std::string auxName = name; - - if (name == "") - auxName = GetDefaultName(prefix); - - Declaration* decl = - parent->AddDeclarationArray(rawDataIndex, GetDeclarationAlignment(), GetRawDataSize(), - GetSourceTypeName(), name, GetActorListArraySize(), bodyStr); - decl->staticConf = staticConf; - - return decl; -} - -std::string ZActorList::GetBodySourceCode() const -{ - std::string declaration; - - size_t index = 0; - for (auto& entry : actors) - { - declaration += StringHelper::Sprintf("\t{ %s },", entry.GetBodySourceCode().c_str()); - - if (index < actors.size() - 1) - declaration += "\n"; - - index++; - } - - return declaration; -} - -std::string ZActorList::GetSourceTypeName() const -{ - return actors.front().GetSourceTypeName(); -} - -ZResourceType ZActorList::GetResourceType() const -{ - return ZResourceType::ActorList; -} - -size_t ZActorList::GetRawDataSize() const -{ - return actors.size() * actors.front().GetRawDataSize(); -} - -size_t ZActorList::GetActorListArraySize() const -{ - size_t actorCount = 0; - - // Doing an else-if here so we only do the loop when the game is SW97. - // Actor 0x22 is removed from SW97, so we need to ensure that we don't increment the actor count - // for it. - if (Globals::Instance->game == ZGame::OOT_SW97) - { - actorCount = 0; - - for (const auto& entry : actors) - if (entry.GetActorId() != 0x22) - actorCount++; - } - else - { - actorCount = actors.size(); - } - - return actorCount; -} - -/* ActorSpawnEntry */ - -ActorSpawnEntry::ActorSpawnEntry(const std::vector& rawData, uint32_t rawDataIndex) -{ - actorNum = BitConverter::ToInt16BE(rawData, rawDataIndex + 0); - posX = BitConverter::ToInt16BE(rawData, rawDataIndex + 2); - posY = BitConverter::ToInt16BE(rawData, rawDataIndex + 4); - posZ = BitConverter::ToInt16BE(rawData, rawDataIndex + 6); - rotX = BitConverter::ToUInt16BE(rawData, rawDataIndex + 8); - rotY = BitConverter::ToUInt16BE(rawData, rawDataIndex + 10); - rotZ = BitConverter::ToUInt16BE(rawData, rawDataIndex + 12); - params = BitConverter::ToInt16BE(rawData, rawDataIndex + 14); -} - -std::string ActorSpawnEntry::GetBodySourceCode() const -{ - std::string body; - - std::string actorNameFmt = StringHelper::Sprintf("%%-%zus ", largestActorName + 1); - body = - StringHelper::Sprintf(actorNameFmt.c_str(), (ZNames::GetActorName(actorNum) + ",").c_str()); - - body += StringHelper::Sprintf("{ %6i, %6i, %6i }, ", posX, posY, posZ); - if (Globals::Instance->game == ZGame::MM_RETAIL) - body += StringHelper::Sprintf("{ SPAWN_ROT_FLAGS(%#5hX, 0x%04X)" - ", SPAWN_ROT_FLAGS(%#5hX, 0x%04X)" - ", SPAWN_ROT_FLAGS(%#5hX, 0x%04X) }, ", - (rotX >> 7) & 0b111111111, rotX & 0b1111111, - (rotY >> 7) & 0b111111111, rotY & 0b1111111, - (rotZ >> 7) & 0b111111111, rotZ & 0b1111111); - else - body += StringHelper::Sprintf("{ %#6hX, %#6hX, %#6hX }, ", rotX, rotY, rotZ); - body += StringHelper::Sprintf("0x%04X", params); - - return body; -} - -std::string ActorSpawnEntry::GetSourceTypeName() const -{ - return "ActorEntry"; -} - -size_t ActorSpawnEntry::GetRawDataSize() const -{ - return 16; -} - -uint16_t ActorSpawnEntry::GetActorId() const -{ - return actorNum; -} - -void ActorSpawnEntry::SetLargestActorName(size_t nameSize) -{ - largestActorName = nameSize; -} diff --git a/tools/ZAPD/ZAPD/ZActorList.h b/tools/ZAPD/ZAPD/ZActorList.h deleted file mode 100644 index 7cc63da2fe..0000000000 --- a/tools/ZAPD/ZAPD/ZActorList.h +++ /dev/null @@ -1,52 +0,0 @@ -#pragma once - -#include "ZResource.h" - -class ActorSpawnEntry -{ -public: - uint16_t actorNum; - int16_t posX; - int16_t posY; - int16_t posZ; - uint16_t rotX; - uint16_t rotY; - uint16_t rotZ; - uint16_t params; - size_t largestActorName = 16; - - ActorSpawnEntry(const std::vector& rawData, uint32_t rawDataIndex); - - std::string GetBodySourceCode() const; - - std::string GetSourceTypeName() const; - size_t GetRawDataSize() const; - - uint16_t GetActorId() const; - void SetLargestActorName(size_t nameSize); -}; - -class ZActorList : public ZResource -{ -public: - std::vector actors; - uint32_t numActors = 0; - - ZActorList(ZFile* nParent); - - void ExtractFromBinary(offset_t nRawDataIndex, uint8_t nNumActors); - - void ParseXML(tinyxml2::XMLElement* reader) override; - void ParseRawData() override; - - Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override; - std::string GetBodySourceCode() const override; - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - size_t GetRawDataSize() const override; - -protected: - size_t GetActorListArraySize() const; -}; diff --git a/tools/ZAPD/ZAPD/ZAnimation.cpp b/tools/ZAPD/ZAPD/ZAnimation.cpp deleted file mode 100644 index 959fff8291..0000000000 --- a/tools/ZAPD/ZAPD/ZAnimation.cpp +++ /dev/null @@ -1,556 +0,0 @@ -#include "ZAnimation.h" - -#include - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/File.h" -#include "Utils/StringHelper.h" -#include "WarningHandler.h" -#include "ZFile.h" - -REGISTER_ZFILENODE(Animation, ZNormalAnimation); -REGISTER_ZFILENODE(PlayerAnimation, ZLinkAnimation); -REGISTER_ZFILENODE(CurveAnimation, ZCurveAnimation); -REGISTER_ZFILENODE(LegacyAnimation, ZLegacyAnimation); - -ZAnimation::ZAnimation(ZFile* nParent) : ZResource(nParent) -{ - frameCount = 0; -} - -void ZAnimation::ParseRawData() -{ - ZResource::ParseRawData(); - - frameCount = BitConverter::ToInt16BE(parent->GetRawData(), rawDataIndex + 0); -} - -ZResourceType ZAnimation::GetResourceType() const -{ - return ZResourceType::Animation; -} - -/* ZNormalAnimation */ - -ZNormalAnimation::ZNormalAnimation(ZFile* nParent) : ZAnimation(nParent) -{ -} - -size_t ZNormalAnimation::GetRawDataSize() const -{ - return 16; -} - -std::string ZNormalAnimation::GetSourceTypeName() const -{ - return "AnimationHeader"; -} - -void ZNormalAnimation::ParseRawData() -{ - ZAnimation::ParseRawData(); - - auto& data = parent->GetRawData(); - - rotationValuesSeg = BitConverter::ToInt32BE(data, rawDataIndex + 4); - rotationIndicesSeg = BitConverter::ToInt32BE(data, rawDataIndex + 8); - limit = BitConverter::ToInt16BE(data, rawDataIndex + 12); - - rotationValuesOffset = Seg2Filespace(rotationValuesSeg, parent->baseAddress); - rotationIndicesOffset = Seg2Filespace(rotationIndicesSeg, parent->baseAddress); - - uint32_t currentPtr = rotationValuesOffset; - - // Read the Rotation Values - for (uint32_t i = 0; i < ((rotationIndicesOffset - rotationValuesOffset) / 2); i++) - { - rotationValues.push_back(BitConverter::ToInt16BE(data, currentPtr)); - currentPtr += 2; - } - - currentPtr = rotationIndicesOffset; - - // Read the Rotation Indices - for (uint32_t i = 0; i < ((rawDataIndex - rotationIndicesOffset) / 6); i++) - { - rotationIndices.push_back(RotationIndex(BitConverter::ToInt16BE(data, currentPtr), - BitConverter::ToInt16BE(data, currentPtr + 2), - BitConverter::ToInt16BE(data, currentPtr + 4))); - currentPtr += 6; - } -} - -void ZNormalAnimation::DeclareReferences(const std::string& prefix) -{ - std::string defaultPrefix = prefix.c_str(); - if (name != "") - defaultPrefix = name; - - // replace g prefix with s for local variables - if (defaultPrefix.at(0) == 'g') - defaultPrefix.replace(0, 1, "s"); - - std::string indicesStr = ""; - std::string valuesStr = " "; - const uint8_t lineLength = 14; - const uint8_t offset = 0; - - for (size_t i = 0; i < rotationValues.size(); i++) - { - valuesStr += StringHelper::Sprintf("0x%04X, ", rotationValues[i]); - - if ((i - offset + 1) % lineLength == 0) - valuesStr += "\n "; - } - - parent->AddDeclarationArray(rotationValuesOffset, DeclarationAlignment::Align4, - rotationValues.size() * 2, "s16", - StringHelper::Sprintf("%sFrameData", defaultPrefix.c_str()), - rotationValues.size(), valuesStr); - - for (size_t i = 0; i < rotationIndices.size(); i++) - { - indicesStr += StringHelper::Sprintf(" { 0x%04X, 0x%04X, 0x%04X },", rotationIndices[i].x, - rotationIndices[i].y, rotationIndices[i].z); - - if (i != (rotationIndices.size() - 1)) - indicesStr += "\n"; - } - - parent->AddDeclarationArray(rotationIndicesOffset, DeclarationAlignment::Align4, - rotationIndices.size() * 6, "JointIndex", - StringHelper::Sprintf("%sJointIndices", defaultPrefix.c_str()), - rotationIndices.size(), indicesStr); -} - -std::string ZNormalAnimation::GetBodySourceCode() const -{ - std::string frameDataName; - Globals::Instance->GetSegmentedPtrName(rotationValuesSeg, parent, "s16", frameDataName); - std::string jointIndicesName; - Globals::Instance->GetSegmentedPtrName(rotationIndicesSeg, parent, "JointIndex", - jointIndicesName); - - std::string headerStr = - StringHelper::Sprintf("\n\t{ %i }, %s,\n", frameCount, frameDataName.c_str()); - headerStr += StringHelper::Sprintf("\t%s, %i\n", jointIndicesName.c_str(), limit); - - return headerStr; -} - -/* ZLinkAnimation */ - -ZLinkAnimation::ZLinkAnimation(ZFile* nParent) : ZAnimation(nParent) -{ - segmentAddress = 0; -} - -size_t ZLinkAnimation::GetRawDataSize() const -{ - return 8; -} - -std::string ZLinkAnimation::GetSourceTypeName() const -{ - if (Globals::Instance->game == ZGame::MM_RETAIL) - return "PlayerAnimationHeader"; - else - return "LinkAnimationHeader"; -} - -void ZLinkAnimation::ParseRawData() -{ - ZAnimation::ParseRawData(); - - const auto& rawData = parent->GetRawData(); - segmentAddress = BitConverter::ToInt32BE(rawData, rawDataIndex + 4); -} - -std::string ZLinkAnimation::GetBodySourceCode() const -{ - std::string segSymbol; - Globals::Instance->GetSegmentedPtrName(segmentAddress, parent, "", segSymbol); - - return StringHelper::Sprintf("\n\t{ %i }, %s\n", frameCount, segSymbol.c_str()); -} - -/* ZCurveAnimation */ - -CurveInterpKnot::CurveInterpKnot(ZFile* parent, const std::vector& rawData, - uint32_t fileOffset) - : parent(parent) -{ - unk_00 = BitConverter::ToUInt16BE(rawData, fileOffset + 0); - unk_02 = BitConverter::ToUInt16BE(rawData, fileOffset + 2); - unk_04 = BitConverter::ToInt16BE(rawData, fileOffset + 4); - unk_06 = BitConverter::ToInt16BE(rawData, fileOffset + 6); - unk_08 = BitConverter::ToFloatBE(rawData, fileOffset + 8); -} - -CurveInterpKnot::CurveInterpKnot(ZFile* parent, const std::vector& rawData, - uint32_t fileOffset, size_t index) - : CurveInterpKnot(parent, rawData, fileOffset + index * GetRawDataSize()) -{ -} - -std::string CurveInterpKnot::GetBody([[maybe_unused]] const std::string& prefix) const -{ - return StringHelper::Sprintf("0x%04X, 0x%04X, %i, %i, %ff", unk_00, unk_02, unk_04, unk_06, - unk_08); -} - -size_t CurveInterpKnot::GetRawDataSize() const -{ - return 0x0C; -} - -std::string CurveInterpKnot::GetSourceTypeName() -{ - return "CurveInterpKnot"; -} - -ZCurveAnimation::ZCurveAnimation(ZFile* nParent) : ZAnimation(nParent) -{ - RegisterOptionalAttribute("SkelOffset"); -} - -void ZCurveAnimation::ParseXML(tinyxml2::XMLElement* reader) -{ - ZAnimation::ParseXML(reader); - - std::string skelOffsetXml = registeredAttributes.at("SkelOffset").value; - if (skelOffsetXml == "") - { - HANDLE_ERROR_RESOURCE(WarningType::MissingAttribute, parent, this, rawDataIndex, - "missing 'SkelOffset' attribute in ", - "You need to provide the offset of the curve skeleton."); - } - skelOffset = StringHelper::StrToL(skelOffsetXml, 0); -} - -void ZCurveAnimation::ParseRawData() -{ - ZAnimation::ParseRawData(); - - const auto& rawData = parent->GetRawData(); - refIndex = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0); - transformData = BitConverter::ToUInt32BE(rawData, rawDataIndex + 4); - copyValues = BitConverter::ToUInt32BE(rawData, rawDataIndex + 8); - unk_0C = BitConverter::ToInt16BE(rawData, rawDataIndex + 12); - unk_10 = BitConverter::ToInt16BE(rawData, rawDataIndex + 14); - - uint32_t limbCountAddress = Seg2Filespace(skelOffset, parent->baseAddress) + 4; - limbCount = BitConverter::ToUInt8BE(rawData, limbCountAddress); - - size_t transformDataSize = 0; - size_t copyValuesSize = 0; - if (refIndex != 0) - { - uint32_t refIndexOffset = Seg2Filespace(refIndex, parent->baseAddress); - for (size_t i = 0; i < 3 * 3 * limbCount; i++) - { - uint8_t ref = BitConverter::ToUInt8BE(rawData, refIndexOffset + i); - if (ref == 0) - copyValuesSize++; - else - transformDataSize += ref; - - refIndexArr.emplace_back(ref); - } - } - - if (transformData != 0) - { - uint32_t transformDataOffset = Seg2Filespace(transformData, parent->baseAddress); - - for (size_t i = 0; i < transformDataSize; i++) - transformDataArr.emplace_back(parent, rawData, transformDataOffset, i); - } - - if (copyValues != 0) - { - uint32_t copyValuesOffset = Seg2Filespace(copyValues, parent->baseAddress); - - for (size_t i = 0; i < copyValuesSize; i++) - copyValuesArr.emplace_back(BitConverter::ToInt16BE(rawData, copyValuesOffset + i * 2)); - } -} - -void ZCurveAnimation::DeclareReferences(const std::string& prefix) -{ - if (refIndex != 0) - { - uint32_t refIndexOffset = Seg2Filespace(refIndex, parent->baseAddress); - std::string refIndexStr = - StringHelper::Sprintf("%sCurveAnime_%s_%06X", prefix.c_str(), "Ref", refIndexOffset); - - std::string entryStr = " "; - uint16_t arrayItemCnt = refIndexArr.size(); - - size_t i = 0; - for (auto& child : refIndexArr) - { - entryStr += StringHelper::Sprintf("0x%02X, %s", child, (i++ % 8 == 7) ? "\n " : ""); - } - - Declaration* decl = parent->GetDeclaration(refIndexOffset); - if (decl == nullptr) - { - parent->AddDeclarationArray(refIndexOffset, DeclarationAlignment::Align4, - arrayItemCnt * 1, "u8", refIndexStr, arrayItemCnt, - entryStr); - } - else - { - decl->declBody = entryStr; - } - } - - if (transformData != 0) - { - uint32_t transformDataOffset = Seg2Filespace(transformData, parent->baseAddress); - std::string transformDataStr = StringHelper::Sprintf( - "%sCurveAnime_%s_%06X", prefix.c_str(), - transformDataArr.at(0).GetSourceTypeName().c_str(), transformDataOffset); - - std::string entryStr; - uint16_t arrayItemCnt = transformDataArr.size(); - - size_t i = 0; - for (auto& child : transformDataArr) - { - entryStr += StringHelper::Sprintf(" { %s },%s", child.GetBody(prefix).c_str(), - (++i < arrayItemCnt) ? "\n" : ""); - } - - Declaration* decl = parent->GetDeclaration(transformDataOffset); - if (decl == nullptr) - { - parent->AddDeclarationArray(transformDataOffset, DeclarationAlignment::Align4, - arrayItemCnt * transformDataArr.at(0).GetRawDataSize(), - transformDataArr.at(0).GetSourceTypeName(), - transformDataStr, arrayItemCnt, entryStr); - } - else - { - decl->declBody = entryStr; - } - } - - if (copyValues != 0) - { - uint32_t copyValuesOffset = Seg2Filespace(copyValues, parent->baseAddress); - std::string copyValuesStr = - StringHelper::Sprintf("%sCurveAnime_%s_%06X", prefix.c_str(), "Copy", copyValuesOffset); - - std::string entryStr = " "; - uint16_t arrayItemCnt = copyValuesArr.size(); - - size_t i = 0; - for (auto& child : copyValuesArr) - { - entryStr += StringHelper::Sprintf("% 6i, %s", child, (i++ % 8 == 7) ? "\n " : ""); - } - - Declaration* decl = parent->GetDeclaration(copyValuesOffset); - if (decl == nullptr) - { - parent->AddDeclarationArray(copyValuesOffset, DeclarationAlignment::Align4, - arrayItemCnt * 2, "s16", copyValuesStr, arrayItemCnt, - entryStr); - } - else - { - decl->declBody = entryStr; - } - } -} - -std::string ZCurveAnimation::GetBodySourceCode() const -{ - std::string refIndexStr; - Globals::Instance->GetSegmentedPtrName(refIndex, parent, "u8", refIndexStr); - std::string transformDataStr; - Globals::Instance->GetSegmentedPtrName(transformData, parent, "CurveInterpKnot", - transformDataStr); - std::string copyValuesStr; - Globals::Instance->GetSegmentedPtrName(copyValues, parent, "s16", copyValuesStr); - - return StringHelper::Sprintf("\n\t%s,\n\t%s,\n\t%s,\n\t%i, %i\n", refIndexStr.c_str(), - transformDataStr.c_str(), copyValuesStr.c_str(), unk_0C, unk_10); -} - -size_t ZCurveAnimation::GetRawDataSize() const -{ - return 0x10; -} - -DeclarationAlignment ZCurveAnimation::GetDeclarationAlignment() const -{ - return DeclarationAlignment::Align4; -} - -std::string ZCurveAnimation::GetSourceTypeName() const -{ - return "CurveAnimationHeader"; -} - -/* ZLegacyAnimation */ - -ZLegacyAnimation::ZLegacyAnimation(ZFile* nParent) : ZAnimation(nParent) -{ -} - -void ZLegacyAnimation::ParseRawData() -{ - ZAnimation::ParseRawData(); - - const auto& rawData = parent->GetRawData(); - limbCount = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x02); - frameData = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x04); - jointKey = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x08); - - if (GETSEGNUM(frameData) == parent->segment && GETSEGNUM(jointKey) == parent->segment) - { - uint32_t frameDataOffset = Seg2Filespace(frameData, parent->baseAddress); - uint32_t jointKeyOffset = Seg2Filespace(jointKey, parent->baseAddress); - - uint32_t ptr = frameDataOffset; - for (size_t i = 0; i < (jointKeyOffset - frameDataOffset) / 2; i++) - { - frameDataArray.push_back(BitConverter::ToUInt16BE(rawData, ptr)); - ptr += 2; - } - - ptr = jointKeyOffset; - for (int32_t i = 0; i < limbCount + 1; i++) - { - LegacyJointKey key(parent); - key.ExtractFromFile(ptr); - - jointKeyArray.push_back(key); - ptr += key.GetRawDataSize(); - } - } -} - -void ZLegacyAnimation::DeclareReferences(const std::string& prefix) -{ - std::string varPrefix = prefix; - if (name != "") - varPrefix = name; - - ZAnimation::DeclareReferences(varPrefix); - - if (!frameDataArray.empty()) - { - uint32_t frameDataOffset = Seg2Filespace(frameData, parent->baseAddress); - if (GETSEGNUM(frameData) == parent->segment && !parent->HasDeclaration(frameDataOffset)) - { - std::string frameDataBody = "\t"; - - for (size_t i = 0; i < frameDataArray.size(); i++) - { - frameDataBody += StringHelper::Sprintf("0x%04X, ", frameDataArray[i]); - - if (i % 8 == 7 && i + 1 < frameDataArray.size()) - frameDataBody += "\n\t"; - } - - std::string frameDataName = StringHelper::Sprintf("%sFrameData", varPrefix.c_str()); - parent->AddDeclarationArray(frameDataOffset, DeclarationAlignment::Align4, - frameDataArray.size() * 2, "s16", frameDataName, - frameDataArray.size(), frameDataBody); - } - } - - if (!jointKeyArray.empty()) - { - uint32_t jointKeyOffset = Seg2Filespace(jointKey, parent->baseAddress); - if (GETSEGNUM(jointKey) == parent->segment && !parent->HasDeclaration(jointKeyOffset)) - { - const auto res = jointKeyArray.at(0); - std::string jointKeyBody; - - for (size_t i = 0; i < jointKeyArray.size(); i++) - { - jointKeyBody += StringHelper::Sprintf("\t{ %s },", - jointKeyArray[i].GetBodySourceCode().c_str()); - - if (i + 1 < jointKeyArray.size()) - jointKeyBody += "\n"; - } - - std::string jointKeyName = StringHelper::Sprintf("%sJointKey", varPrefix.c_str()); - parent->AddDeclarationArray(jointKeyOffset, DeclarationAlignment::Align4, - jointKeyArray.size() * res.GetRawDataSize(), - res.GetSourceTypeName(), jointKeyName, jointKeyArray.size(), - jointKeyBody); - } - } -} - -std::string ZLegacyAnimation::GetBodySourceCode() const -{ - std::string body = "\n"; - - std::string frameDataName; - std::string jointKeyName; - Globals::Instance->GetSegmentedPtrName(frameData, parent, "s16", frameDataName); - Globals::Instance->GetSegmentedPtrName(jointKey, parent, "LegacyJointKey", jointKeyName); - - body += StringHelper::Sprintf("\t%i, %i,\n", frameCount, limbCount); - body += StringHelper::Sprintf("\t%s,\n", frameDataName.c_str()); - body += StringHelper::Sprintf("\t%s\n", jointKeyName.c_str()); - - return body; -} - -std::string ZLegacyAnimation::GetSourceTypeName() const -{ - return "LegacyAnimationHeader"; -} - -size_t ZLegacyAnimation::GetRawDataSize() const -{ - return 0x0C; -} - -LegacyJointKey::LegacyJointKey(ZFile* nParent) : ZResource(nParent) -{ -} - -void LegacyJointKey::ParseRawData() -{ - ZResource::ParseRawData(); - - const auto& rawData = parent->GetRawData(); - xMax = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x00); - x = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x02); - yMax = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x04); - y = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x06); - zMax = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x08); - z = BitConverter::ToInt16BE(rawData, rawDataIndex + 0x0A); -} - -std::string LegacyJointKey::GetBodySourceCode() const -{ - return StringHelper::Sprintf("%6i, %6i, %6i, %6i, %6i, %6i", xMax, x, yMax, y, zMax, z); -} - -std::string LegacyJointKey::GetSourceTypeName() const -{ - return "LegacyJointKey"; -} - -ZResourceType LegacyJointKey::GetResourceType() const -{ - // TODO - return ZResourceType::Error; -} - -size_t LegacyJointKey::GetRawDataSize() const -{ - return 0x0C; -} diff --git a/tools/ZAPD/ZAPD/ZAnimation.h b/tools/ZAPD/ZAPD/ZAnimation.h deleted file mode 100644 index 643842b891..0000000000 --- a/tools/ZAPD/ZAPD/ZAnimation.h +++ /dev/null @@ -1,179 +0,0 @@ -#pragma once - -#include -#include -#include -#include "Vec3s.h" -#include "ZResource.h" -#include "ZSkeleton.h" -#include "tinyxml2.h" - -struct RotationIndex -{ - // uint16_t transX, transY, transZ; - uint16_t x, y, z; - - RotationIndex(uint16_t nX, uint16_t nY, uint16_t nZ) : x(nX), y(nY), z(nZ) {} -}; - -class ZAnimation : public ZResource -{ -public: - int16_t frameCount; - - ZAnimation(ZFile* nParent); - - ZResourceType GetResourceType() const override; - -protected: - void ParseRawData() override; -}; - -class ZNormalAnimation : public ZAnimation -{ -public: - std::vector rotationValues; - std::vector rotationIndices; - segptr_t rotationValuesSeg = 0; - segptr_t rotationIndicesSeg = 0; - offset_t rotationValuesOffset = 0; - offset_t rotationIndicesOffset = 0; - int16_t limit = 0; - - ZNormalAnimation(ZFile* nParent); - - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - size_t GetRawDataSize() const override; - std::string GetSourceTypeName() const override; - - void ParseRawData() override; -}; - -class ZLinkAnimation : public ZAnimation -{ -public: - segptr_t segmentAddress; - - ZLinkAnimation(ZFile* nParent); - - std::string GetBodySourceCode() const override; - - size_t GetRawDataSize() const override; - std::string GetSourceTypeName() const override; - - void ParseRawData() override; -}; - -class CurveInterpKnot -{ -protected: - ZFile* parent; - - ///* 0x0000 */ u16 unk_00; // appears to be flags - uint16_t unk_00; - ///* 0x0002 */ s16 unk_02; - int16_t unk_02; - ///* 0x0004 */ s16 unk_04; - int16_t unk_04; - ///* 0x0006 */ s16 unk_06; - int16_t unk_06; - ///* 0x0008 */ f32 unk_08; - float unk_08; - -public: - CurveInterpKnot() = default; - CurveInterpKnot(ZFile* parent, const std::vector& rawData, uint32_t fileOffset); - CurveInterpKnot(ZFile* parent, const std::vector& rawData, uint32_t fileOffset, - size_t index); - - [[nodiscard]] std::string GetBody(const std::string& prefix) const; - - size_t GetRawDataSize() const; - std::string GetSourceTypeName(); -}; - -class ZCurveAnimation : public ZAnimation -{ -protected: - segptr_t skelOffset = 0; - - ///* 0x0000 */ u8* refIndex; - segptr_t refIndex = 0; - ///* 0x0004 */ CurveInterpKnot* transformData; - segptr_t transformData = 0; - ///* 0x0008 */ s16* copyValues; - segptr_t copyValues = 0; - ///* 0x000C */ s16 unk_0C; - int16_t unk_0C; - ///* 0x000E */ s16 unk_10; - int16_t unk_10; - - uint8_t limbCount = 0; - - std::vector refIndexArr; - std::vector transformDataArr; - std::vector copyValuesArr; - -public: - ZCurveAnimation(ZFile* nParent); - - void ParseXML(tinyxml2::XMLElement* reader) override; - void ParseRawData() override; - - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - size_t GetRawDataSize() const override; - DeclarationAlignment GetDeclarationAlignment() const override; - - std::string GetSourceTypeName() const override; -}; -// CurveAnimationHeader - -/* ZLegacyAnimation */ - -class LegacyJointKey : public ZResource -{ -public: - LegacyJointKey(ZFile* nParent); - - void ParseRawData() override; - std::string GetBodySourceCode() const override; - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - size_t GetRawDataSize() const override; - -protected: - int16_t xMax, x; - int16_t yMax, y; - int16_t zMax, z; -}; - -class ZLegacyAnimation : public ZAnimation -{ -public: - ZLegacyAnimation(ZFile* nParent); - - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - std::string GetSourceTypeName() const override; - - size_t GetRawDataSize() const override; - -protected: - int16_t limbCount; - segptr_t frameData; // s16* - segptr_t jointKey; // LegacyJointKey* - - std::vector frameDataArray; - std::vector jointKeyArray; -}; diff --git a/tools/ZAPD/ZAPD/ZArray.cpp b/tools/ZAPD/ZAPD/ZArray.cpp deleted file mode 100644 index 62720bc610..0000000000 --- a/tools/ZAPD/ZAPD/ZArray.cpp +++ /dev/null @@ -1,153 +0,0 @@ -#include "ZArray.h" - -#include - -#include "Globals.h" -#include "Utils/StringHelper.h" -#include "WarningHandler.h" -#include "ZFile.h" - -REGISTER_ZFILENODE(Array, ZArray); - -ZArray::ZArray(ZFile* nParent) : ZResource(nParent) -{ - canHaveInner = true; - RegisterRequiredAttribute("Count"); -} - -ZArray::~ZArray() -{ - for (auto res : resList) - delete res; -} - -void ZArray::ParseXML(tinyxml2::XMLElement* reader) -{ - ZResource::ParseXML(reader); - - arrayCnt = reader->IntAttribute("Count", 0); - if (arrayCnt <= 0) - { - HANDLE_ERROR_RESOURCE(WarningType::InvalidAttributeValue, parent, this, rawDataIndex, - "invalid value found for 'Count' attribute", ""); - } - - tinyxml2::XMLElement* child = reader->FirstChildElement(); - if (child == nullptr) - { - HANDLE_ERROR_RESOURCE(WarningType::InvalidXML, parent, this, rawDataIndex, - " needs one sub-element", ""); - } - - childName = child->Name(); - - auto nodeMap = ZFile::GetNodeMap(); - size_t childIndex = rawDataIndex; - resList.reserve(arrayCnt); - for (size_t i = 0; i < arrayCnt; i++) - { - ZResource* res = nodeMap->at(childName)(parent); - if (!res->DoesSupportArray()) - { - std::string errorHeader = StringHelper::Sprintf( - "resource <%s> does not support being wrapped in an ", childName.c_str()); - HANDLE_ERROR_RESOURCE(WarningType::InvalidXML, parent, this, rawDataIndex, errorHeader, - ""); - } - res->parent = parent; - res->SetInnerNode(true); - res->ExtractWithXML(child, childIndex); - - childIndex += res->GetRawDataSize(); - resList.push_back(res); - } -} - -Declaration* ZArray::DeclareVar(const std::string& prefix, const std::string& bodyStr) -{ - std::string auxName = name; - - if (name == "") - auxName = GetDefaultName(prefix); - - ZResource* res = resList.at(0); - Declaration* decl; - if (res->IsExternalResource()) - { - auto filepath = Globals::Instance->outputPath / name; - std::string includePath = StringHelper::Sprintf("%s.%s.inc", filepath.string().c_str(), - res->GetExternalExtension().c_str()); - decl = parent->AddDeclarationIncludeArray(rawDataIndex, includePath, GetRawDataSize(), - GetSourceTypeName(), name, arrayCnt); - decl->declBody = bodyStr; - decl->isExternal = true; - } - else - { - decl = - parent->AddDeclarationArray(rawDataIndex, GetDeclarationAlignment(), GetRawDataSize(), - GetSourceTypeName(), name, arrayCnt, bodyStr); - } - - decl->staticConf = staticConf; - return decl; -} - -std::string ZArray::GetBodySourceCode() const -{ - std::string output; - - for (size_t i = 0; i < arrayCnt; i++) - { - const auto& res = resList[i]; - output += "\t"; - - switch (res->GetResourceType()) - { - case ZResourceType::Pointer: - case ZResourceType::Scalar: - case ZResourceType::Vertex: - case ZResourceType::CollisionPoly: - case ZResourceType::SurfaceType: - case ZResourceType::Waterbox: - output += resList.at(i)->GetBodySourceCode(); - break; - - default: - output += StringHelper::Sprintf("{ %s }", resList.at(i)->GetBodySourceCode().c_str()); - break; - } - - if (i < arrayCnt - 1 || res->IsExternalResource()) - output += ",\n"; - } - - return output; -} - -size_t ZArray::GetRawDataSize() const -{ - size_t size = 0; - for (const auto res : resList) - size += res->GetRawDataSize(); - return size; -} - -std::string ZArray::GetSourceTypeName() const -{ - return resList.at(0)->GetSourceTypeName(); -} - -ZResourceType ZArray::GetResourceType() const -{ - return ZResourceType::Array; -} - -DeclarationAlignment ZArray::GetDeclarationAlignment() const -{ - if (resList.size() == 0) - { - return DeclarationAlignment::Align4; - } - return resList.at(0)->GetDeclarationAlignment(); -} diff --git a/tools/ZAPD/ZAPD/ZArray.h b/tools/ZAPD/ZAPD/ZArray.h deleted file mode 100644 index b78a8edfd8..0000000000 --- a/tools/ZAPD/ZAPD/ZArray.h +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -#include -#include -#include -#include "ZResource.h" -#include "tinyxml2.h" - -class ZArray : public ZResource -{ -public: - ZArray(ZFile* nParent); - ~ZArray(); - - void ParseXML(tinyxml2::XMLElement* reader) override; - - Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override; - std::string GetBodySourceCode() const override; - - size_t GetRawDataSize() const override; - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - DeclarationAlignment GetDeclarationAlignment() const override; - -protected: - size_t arrayCnt; - std::string childName; - std::vector resList; -}; diff --git a/tools/ZAPD/ZAPD/ZBackground.cpp b/tools/ZAPD/ZAPD/ZBackground.cpp deleted file mode 100644 index fc725637e7..0000000000 --- a/tools/ZAPD/ZAPD/ZBackground.cpp +++ /dev/null @@ -1,197 +0,0 @@ -#include "ZBackground.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/File.h" -#include "Utils/Path.h" -#include "Utils/StringHelper.h" -#include "WarningHandler.h" -#include "ZFile.h" - -REGISTER_ZFILENODE(Background, ZBackground); - -#define JPEG_MARKER 0xFFD8FFE0 -#define MARKER_DQT 0xFFDB -#define MARKER_EOI 0xFFD9 - -ZBackground::ZBackground(ZFile* nParent) : ZResource(nParent) -{ -} - -void ZBackground::ParseRawData() -{ - ZResource::ParseRawData(); - - const auto& rawData = parent->GetRawData(); - size_t i = 0; - while (true) - { - uint8_t val = rawData.at(rawDataIndex + i); - data.push_back(val); - - if (BitConverter::ToUInt16BE(rawData, rawDataIndex + i) == MARKER_EOI) - { - data.push_back(rawData.at(rawDataIndex + i + 1)); - break; - } - - i++; - } -} - -void ZBackground::ParseBinaryFile(const std::string& inFolder, bool appendOutName) -{ - fs::path filepath(inFolder); - - if (appendOutName) - filepath = filepath / (outName + "." + GetExternalExtension()); - - data = File::ReadAllBytes(filepath.string()); - - // Add padding. - data.insert(data.end(), GetRawDataSize() - data.size(), 0x00); - CheckValidJpeg(filepath.generic_string()); -} - -void ZBackground::CheckValidJpeg(const std::string& filepath) -{ - std::string filename = outName; - if (filepath != "") - { - filename = filepath; - } - - uint32_t jpegMarker = BitConverter::ToUInt32BE(data, 0); - if (jpegMarker != JPEG_MARKER) - { - HANDLE_WARNING_PROCESS( - WarningType::InvalidJPEG, - StringHelper::Sprintf("missing jpeg marker at beginning of file: '%s'", - filename.c_str()), - "The game will skip this jpeg."); - } - if (data.at(6) != 'J' || data.at(7) != 'F' || data.at(8) != 'I' || data.at(9) != 'F' || - data.at(10) != '\0') - { - std::string jfifIdentifier(data.begin() + 6, data.begin() + 6 + 5); - HANDLE_WARNING_PROCESS( - WarningType::InvalidJPEG, "missing 'JFIF' identifier", - StringHelper::Sprintf( - "This image may be corrupted, or not a jpeg. The identifier found was: '%s'", - jfifIdentifier.c_str())); - } - uint8_t majorVersion = data.at(11); - uint8_t minorVersion = data.at(12); - if (majorVersion != 0x01 || minorVersion != 0x01) - { - HANDLE_WARNING_PROCESS( - WarningType::InvalidJPEG, - StringHelper::Sprintf("wrong JFIF version '%i.%02i'", majorVersion, minorVersion), - "The expected version is '1.01'. The game may be unable to decode this image " - "correctly."); - } - if (BitConverter::ToUInt16BE(data, 20) != MARKER_DQT) - { - // This may happen when creating a custom image with Exif, XMP, thumbnail, progressive, etc. - // enabled. - HANDLE_WARNING_PROCESS(WarningType::InvalidJPEG, - "there seems to be extra data before the image data in this file", - "The game may not be able to decode this image correctly."); - } - if (data.size() > GetRawDataSize()) - { - HANDLE_WARNING_PROCESS( - WarningType::InvalidJPEG, "the image is bigger than the screen buffer", - StringHelper::Sprintf("Image size: %zu bytes\nScreen buffer size: %zu bytes", - data.size(), GetRawDataSize())); - } -} - -size_t ZBackground::GetRawDataSize() const -{ - // Jpgs use the whole sceen buffer, which is a u16 matrix. - return Globals::Instance->cfg.bgScreenHeight * Globals::Instance->cfg.bgScreenWidth * 2; -} - -Declaration* ZBackground::DeclareVar(const std::string& prefix, - [[maybe_unused]] const std::string& bodyStr) -{ - std::string auxName = name; - std::string auxOutName = outName; - - if (auxName == "") - auxName = GetDefaultName(prefix); - - if (auxOutName == "") - auxOutName = GetDefaultName(prefix); - - auto filepath = Globals::Instance->outputPath / fs::path(auxOutName).stem(); - - std::string incStr = - StringHelper::Sprintf("%s.%s.inc.c", filepath.c_str(), GetExternalExtension().c_str()); - - Declaration* decl = parent->AddDeclarationIncludeArray(rawDataIndex, incStr, GetRawDataSize(), - GetSourceTypeName(), auxName, 0); - - if (Globals::Instance->cfg.useScreenWidthHeightConstants) - { - decl->arrayItemCntStr = "SCREEN_WIDTH * SCREEN_HEIGHT / 4"; - decl->forceArrayCnt = true; - } - - decl->staticConf = staticConf; - return decl; -} - -bool ZBackground::IsExternalResource() const -{ - return true; -} - -std::string ZBackground::GetExternalExtension() const -{ - return "jpg"; -} - -void ZBackground::Save(const fs::path& outFolder) -{ - fs::path filepath = outFolder / (outName + "." + GetExternalExtension()); - File::WriteAllBytes(filepath.string(), data); -} - -std::string ZBackground::GetBodySourceCode() const -{ - std::string bodyStr = " "; - - for (size_t i = 0; i < data.size() / 8; ++i) - { - bodyStr += StringHelper::Sprintf("0x%016llX, ", BitConverter::ToUInt64BE(data, i * 8)); - - if (i % 8 == 7) - bodyStr += "\n "; - } - - bodyStr += "\n"; - - return bodyStr; -} - -std::string ZBackground::GetDefaultName(const std::string& prefix) const -{ - return StringHelper::Sprintf("%sBackground_%06X", prefix.c_str(), rawDataIndex); -} - -std::string ZBackground::GetSourceTypeName() const -{ - return "u64"; -} - -ZResourceType ZBackground::GetResourceType() const -{ - return ZResourceType::Background; -} - -DeclarationAlignment ZBackground::GetDeclarationAlignment() const -{ - return DeclarationAlignment::Align8; -} diff --git a/tools/ZAPD/ZAPD/ZBackground.h b/tools/ZAPD/ZAPD/ZBackground.h deleted file mode 100644 index e3728bd984..0000000000 --- a/tools/ZAPD/ZAPD/ZBackground.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include -#include -#include "ZResource.h" - -class ZBackground : public ZResource -{ -protected: - std::vector data; - -public: - ZBackground(ZFile* nParent); - - void ParseBinaryFile(const std::string& inFolder, bool appendOutName); - - void ParseRawData() override; - - Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override; - std::string GetBodySourceCode() const override; - std::string GetDefaultName(const std::string& prefix) const override; - - void Save(const fs::path& outFolder) override; - - bool IsExternalResource() const override; - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - std::string GetExternalExtension() const override; - - size_t GetRawDataSize() const override; - DeclarationAlignment GetDeclarationAlignment() const override; - - void CheckValidJpeg(const std::string& filepath); -}; diff --git a/tools/ZAPD/ZAPD/ZBlob.cpp b/tools/ZAPD/ZAPD/ZBlob.cpp deleted file mode 100644 index 6812bfaee9..0000000000 --- a/tools/ZAPD/ZAPD/ZBlob.cpp +++ /dev/null @@ -1,114 +0,0 @@ -#include "ZBlob.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/File.h" -#include "Utils/Path.h" -#include "Utils/StringHelper.h" -#include "ZFile.h" - -REGISTER_ZFILENODE(Blob, ZBlob); - -ZBlob::ZBlob(ZFile* nParent) : ZResource(nParent) -{ - RegisterRequiredAttribute("Size"); -} - -ZBlob* ZBlob::FromFile(const std::string& filePath) -{ - ZBlob* blob = new ZBlob(nullptr); - blob->name = StringHelper::Split(Path::GetFileNameWithoutExtension(filePath), ".")[0]; - blob->blobData = File::ReadAllBytes(filePath); - - return blob; -} - -void ZBlob::ParseXML(tinyxml2::XMLElement* reader) -{ - ZResource::ParseXML(reader); - - blobSize = StringHelper::StrToL(registeredAttributes.at("Size").value, 16); -} - -void ZBlob::ParseRawData() -{ - blobData.assign(parent->GetRawData().begin() + rawDataIndex, - parent->GetRawData().begin() + rawDataIndex + blobSize); -} - -Declaration* ZBlob::DeclareVar(const std::string& prefix, - [[maybe_unused]] const std::string& bodyStr) -{ - std::string auxName = name; - std::string auxOutName = outName; - - if (auxName == "") - auxName = GetDefaultName(prefix); - - if (auxOutName == "") - auxOutName = GetDefaultName(prefix); - - std::string path = Path::GetFileNameWithoutExtension(auxOutName); - - std::string assetOutDir = - (Globals::Instance->outputPath / Path::GetFileNameWithoutExtension(GetOutName())).string(); - - std::string incStr = - StringHelper::Sprintf("%s.%s.inc.c", assetOutDir.c_str(), GetExternalExtension().c_str()); - - return parent->AddDeclarationIncludeArray(rawDataIndex, incStr, GetRawDataSize(), - GetSourceTypeName(), auxName, blobData.size()); -} - -std::string ZBlob::GetBodySourceCode() const -{ - std::string sourceOutput; - - for (size_t i = 0; i < blobData.size(); i += 1) - { - if (i % 16 == 0) - sourceOutput += "\t"; - - sourceOutput += StringHelper::Sprintf("0x%02X, ", blobData[i]); - - if (i % 16 == 15) - sourceOutput += "\n"; - } - - // Ensure there's always a trailing line feed to prevent dumb warnings. - // Please don't remove this line, unless you somehow made a way to prevent - // that warning when building the OoT repo. - sourceOutput += "\n"; - - return sourceOutput; -} - -void ZBlob::Save(const fs::path& outFolder) -{ - File::WriteAllBytes((outFolder / (name + ".bin")).string(), blobData); -} - -bool ZBlob::IsExternalResource() const -{ - return true; -} - -std::string ZBlob::GetExternalExtension() const -{ - return "bin"; -} - -std::string ZBlob::GetSourceTypeName() const -{ - return "u8"; -} - -ZResourceType ZBlob::GetResourceType() const -{ - return ZResourceType::Blob; -} - -size_t ZBlob::GetRawDataSize() const -{ - return blobSize; -} diff --git a/tools/ZAPD/ZAPD/ZBlob.h b/tools/ZAPD/ZAPD/ZBlob.h deleted file mode 100644 index d7a7feff12..0000000000 --- a/tools/ZAPD/ZAPD/ZBlob.h +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -#include "ZResource.h" -#include "tinyxml2.h" - -class ZBlob : public ZResource -{ -public: - ZBlob(ZFile* nParent); - - static ZBlob* FromFile(const std::string& filePath); - - void ParseXML(tinyxml2::XMLElement* reader) override; - void ParseRawData() override; - - Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override; - std::string GetBodySourceCode() const override; - - void Save(const fs::path& outFolder) override; - - bool IsExternalResource() const override; - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - std::string GetExternalExtension() const override; - - size_t GetRawDataSize() const override; - -protected: - std::vector blobData; - size_t blobSize = 0; -}; diff --git a/tools/ZAPD/ZAPD/ZCKeyFrame.cpp b/tools/ZAPD/ZAPD/ZCKeyFrame.cpp deleted file mode 100644 index 3893394f5c..0000000000 --- a/tools/ZAPD/ZAPD/ZCKeyFrame.cpp +++ /dev/null @@ -1,312 +0,0 @@ -#include "ZCKeyFrame.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "WarningHandler.h" - -REGISTER_ZFILENODE(KeyFrameSkel, ZKeyFrameSkel); -REGISTER_ZFILENODE(KeyFrameLimbList, ZKeyFrameLimbList); - -ZKeyFrameSkel::ZKeyFrameSkel(ZFile* nParent) : ZResource(nParent) -{ - RegisterRequiredAttribute("LimbType"); -} - -ZKeyFrameSkel::~ZKeyFrameSkel() -{ -} - -ZKeyFrameLimb::ZKeyFrameLimb(ZFile* nParent) : ZResource(nParent) -{ -} - -ZKeyFrameStandardLimb::ZKeyFrameStandardLimb(ZFile* nParent) : ZKeyFrameLimb(nParent) -{ -} - -ZKeyFrameFlexLimb::ZKeyFrameFlexLimb(ZFile* nParent) : ZKeyFrameLimb(nParent) -{ -} - -ZKeyFrameLimbList::ZKeyFrameLimbList(ZFile* nParent) : ZResource(nParent) -{ - RegisterRequiredAttribute("LimbType"); - RegisterRequiredAttribute("LimbCount"); -} - -ZKeyFrameLimbList::ZKeyFrameLimbList(ZFile* nParent, uint32_t limbCount, ZKeyframeSkelType type) - : ZResource(nParent) -{ - numLimbs = limbCount; - limbType = type; -} - -ZKeyFrameLimbList::~ZKeyFrameLimbList() -{ - for (const auto l : limbs) - delete l; -} - -void ZKeyFrameSkel::ParseXML(tinyxml2::XMLElement* reader) -{ - ZResource::ParseXML(reader); - - std::string limbTypeStr = registeredAttributes.at("LimbType").value; - - limbType = ZKeyFrameLimbList::ParseLimbTypeStr(limbTypeStr); - if (limbType == ZKeyframeSkelType::Error) - HANDLE_ERROR_RESOURCE( - WarningType::InvalidXML, parent, this, rawDataIndex, "Invalid limb type", - StringHelper::Sprintf("Invalid limb type. Was expecting 'Flex' or 'Normal'. Got %s.", - limbTypeStr.c_str())); -} -void ZKeyFrameLimbList::ParseXML(tinyxml2::XMLElement* reader) -{ - ZResource::ParseXML(reader); - - std::string limbTypeStr = registeredAttributes.at("LimbType").value; - std::string numLimbStr = registeredAttributes.at("LimbCount").value; - - limbType = ParseLimbTypeStr(limbTypeStr); - - if (limbType == ZKeyframeSkelType::Error) - HANDLE_ERROR_RESOURCE( - WarningType::InvalidXML, parent, this, rawDataIndex, "Invalid limb type", - StringHelper::Sprintf("Invalid limb type. Was expecting 'Flex' or 'Normal'. Got %s.", - limbTypeStr.c_str())); - - numLimbs = (uint8_t)StringHelper::StrToL(numLimbStr); -} - -void ZKeyFrameSkel::ParseRawData() -{ - ZResource::ParseRawData(); - - const auto& rawData = parent->GetRawData(); - limbCount = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0); - dListCount = BitConverter::ToUInt8BE(rawData, rawDataIndex + 1); - limbsPtr = BitConverter::ToUInt32BE(rawData, rawDataIndex + 4); - - limbList = std::make_unique(parent, limbCount, limbType); - limbList->SetRawDataIndex(GETSEGOFFSET(limbsPtr)); - limbList->ParseRawData(); -} - -void ZKeyFrameSkel::DeclareReferences(const std::string& prefix) -{ - std::string defaultPrefix = name; - std::string declaration; - - if (defaultPrefix == "") - defaultPrefix = prefix; - - ZResource::DeclareReferences(defaultPrefix); - declaration += limbList->GetBodySourceCode(); - parent->AddDeclarationArray( - GETSEGOFFSET(limbsPtr), DeclarationAlignment::Align4, limbList->GetRawDataSize(), - limbList->GetSourceTypeName(), - StringHelper::Sprintf("%s_KeyFrameLimbs_%06X", prefix.c_str(), rawDataIndex), - limbList->limbs.size(), declaration); -} - -std::string ZKeyFrameSkel::GetBodySourceCode() const -{ - std::string limbStr; - - if (limbType == ZKeyframeSkelType::Normal) - Globals::Instance->GetSegmentedPtrName(limbsPtr, parent, "KeyFrameStandardLimb", limbStr); - else - Globals::Instance->GetSegmentedPtrName(limbsPtr, parent, "KeyFrameFlexLimb", limbStr); - - return StringHelper::Sprintf("\n\t0x%02X, 0x%02X, %s\n", limbCount, dListCount, - limbStr.c_str()); -} - -size_t ZKeyFrameSkel::GetRawDataSize() const -{ - return 0x8; -} - -std::string ZKeyFrameSkel::GetSourceTypeName() const -{ - switch (limbType) - { - case ZKeyframeSkelType::Normal: - return "KeyFrameSkeleton"; - - case ZKeyframeSkelType::Flex: - return "KeyFrameFlexSkeleton"; - - default: - return "KeyFrameSkeleton"; - } -} - -ZResourceType ZKeyFrameSkel::GetResourceType() const -{ - return ZResourceType::KeyFrameSkel; -} - -size_t ZKeyFrameStandardLimb::GetRawDataSize() const -{ - return 0xC; -} - -size_t ZKeyFrameFlexLimb::GetRawDataSize() const -{ - return 0x8; -} - -size_t ZKeyFrameLimbList::GetRawDataSize() const -{ - size_t limbSize; - if (limbType == ZKeyframeSkelType::Flex) - limbSize = 0x8; - else - limbSize = 0xC; - - return limbSize * numLimbs; -} - -ZKeyframeSkelType ZKeyFrameLimbList::ParseLimbTypeStr(const std::string& typeStr) -{ - if (typeStr == "Flex") - return ZKeyframeSkelType::Flex; - else if (typeStr == "Normal") - return ZKeyframeSkelType::Normal; - else - return ZKeyframeSkelType::Error; -} - -void ZKeyFrameLimb::ParseRawData() -{ - const auto& rawData = parent->GetRawData(); - - dlist = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x0); - numChildren = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x4); - flags = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x5); -} - -void ZKeyFrameStandardLimb::ParseRawData() -{ - const auto& rawData = parent->GetRawData(); - - ZKeyFrameLimb::ParseRawData(); - translation.x = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x6); - translation.y = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x8); - translation.z = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0xA); -} - -void ZKeyFrameFlexLimb::ParseRawData() -{ - const auto& rawData = parent->GetRawData(); - - ZKeyFrameLimb::ParseRawData(); - callbackIndex = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x6); -} - -void ZKeyFrameLimbList::ParseRawData() -{ - limbs.reserve(numLimbs); - rawDataIndex = GetRawDataIndex(); - - for (uint32_t i = 0; i < numLimbs; i++) - { - ZKeyFrameLimb* limb; - if (limbType == ZKeyframeSkelType::Flex) - limb = new ZKeyFrameFlexLimb(parent); - else - limb = new ZKeyFrameStandardLimb(parent); - - limb->SetRawDataIndex(rawDataIndex + (offset_t)(i * limb->GetRawDataSize())); - limb->ParseRawData(); - limbs.push_back(limb); - } -} - -std::string ZKeyFrameLimbList::GetBodySourceCode() const -{ - std::string declaration; - - for (const auto l : limbs) - declaration += StringHelper::Sprintf("\t{ %s },\n", l->GetBodySourceCode().c_str()); - // Remove last newline - return declaration.substr(0, declaration.length() - 1); -} - -std::string ZKeyFrameStandardLimb::GetBodySourceCode() const -{ - std::string declaration; - std::string dlString; - - Globals::Instance->GetSegmentedArrayIndexedName(dlist, 8, parent, "Gfx", dlString); - - declaration += - StringHelper::Sprintf("%s, 0x%02X, 0x%02X, { 0x%04X, 0x%04X, 0x%04X},", dlString.c_str(), - numChildren, flags, translation.x, translation.y, translation.z); - return declaration; -} - -std::string ZKeyFrameFlexLimb::GetBodySourceCode() const -{ - std::string declaration; - - std::string dlString; - - Globals::Instance->GetSegmentedArrayIndexedName(dlist, 8, parent, "Gfx", dlString); - - declaration += StringHelper::Sprintf("%s, 0x%02X, 0x%02X, 0x%02X", dlString.c_str(), - numChildren, flags, callbackIndex); - return declaration; -} - -std::string ZKeyFrameStandardLimb::GetSourceTypeName() const -{ - return "KeyFrameStandardLimb"; -} - -std::string ZKeyFrameFlexLimb::GetSourceTypeName() const -{ - return "KeyFrameFlexLimb"; -} - -std::string ZKeyFrameLimbList::GetSourceTypeName() const -{ - switch (limbType) - { - case ZKeyframeSkelType::Flex: - return "KeyFrameFlexLimb"; - case ZKeyframeSkelType::Normal: - return "KeyFrameStandardLimb"; - default: - HANDLE_ERROR_RESOURCE(WarningType::InvalidXML, parent, this, rawDataIndex, - "Invalid limb type", ""); - break; - } -} - -ZResourceType ZKeyFrameStandardLimb::GetResourceType() const -{ - return ZResourceType::KeyFrameStandardLimb; -} - -ZResourceType ZKeyFrameFlexLimb::GetResourceType() const -{ - return ZResourceType::KeyFrameFlexLimb; -} - -ZResourceType ZKeyFrameLimbList::GetResourceType() const -{ - switch (limbType) - { - case ZKeyframeSkelType::Flex: - return ZResourceType::KeyFrameFlexLimb; - case ZKeyframeSkelType::Normal: - return ZResourceType::KeyFrameStandardLimb; - default: - HANDLE_ERROR_RESOURCE(WarningType::InvalidXML, parent, this, rawDataIndex, - "Invalid limb type", ""); - break; - } -} diff --git a/tools/ZAPD/ZAPD/ZCKeyFrame.h b/tools/ZAPD/ZAPD/ZCKeyFrame.h deleted file mode 100644 index 417d7cc686..0000000000 --- a/tools/ZAPD/ZAPD/ZCKeyFrame.h +++ /dev/null @@ -1,121 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include "ZFile.h" - -class ZKeyFrameLimb; - -struct Vec3s -{ - int16_t x; - int16_t y; - int16_t z; -}; - -enum class ZKeyframeSkelType -{ - Normal, - Flex, - Error, -}; - -class ZKeyFrameLimbList : public ZResource -{ -public: - ZKeyFrameLimbList(); - ZKeyFrameLimbList(ZFile* nParent); - ZKeyFrameLimbList(ZFile* nParent, uint32_t limbCount, ZKeyframeSkelType type); - - ~ZKeyFrameLimbList(); - - void ParseRawData() override; - - std::string GetBodySourceCode() const override; - void ParseXML(tinyxml2::XMLElement* reader) override; - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - size_t GetRawDataSize() const override; - - static ZKeyframeSkelType ParseLimbTypeStr(const std::string& typeStr); - - std::vector limbs; - ZKeyframeSkelType limbType; - uint8_t numLimbs; -}; - -class ZKeyFrameLimb : public ZResource -{ -public: - segptr_t dlist; - uint8_t numChildren; - uint8_t flags; - - ZKeyFrameLimb(ZFile* nParent); - void ParseRawData() override; -}; - -class ZKeyFrameStandardLimb : public ZKeyFrameLimb -{ -public: - Vec3s translation; - - ZKeyFrameStandardLimb(ZFile* nParent); - void ParseRawData() override; - - std::string GetBodySourceCode() const override; - - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - size_t GetRawDataSize() const override; -}; - -class ZKeyFrameFlexLimb : public ZKeyFrameLimb -{ -public: - uint8_t callbackIndex; - - ZKeyFrameFlexLimb(ZFile* nParent); - // void ParseXML(tinyxml2::XMLElement* reader) override; - void ParseRawData() override; - - std::string GetBodySourceCode() const override; - - // std::string GetSourceOutputHeader(const std::string& prefix) override; - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - size_t GetRawDataSize() const override; -}; - -class ZKeyFrameSkel : public ZResource -{ -public: - std::unique_ptr limbList; - segptr_t limbsPtr; - ZKeyframeSkelType limbType; - uint8_t limbCount; - uint8_t dListCount; - - ZKeyFrameSkel(ZFile* nParent); - ~ZKeyFrameSkel(); - - void ParseXML(tinyxml2::XMLElement* reader) override; - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - size_t GetRawDataSize() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZCKeyFrameAnim.cpp b/tools/ZAPD/ZAPD/ZCKeyFrameAnim.cpp deleted file mode 100644 index 0b07471333..0000000000 --- a/tools/ZAPD/ZAPD/ZCKeyFrameAnim.cpp +++ /dev/null @@ -1,219 +0,0 @@ -#include "ZCkeyFrameAnim.h" -#include "ZCKeyFrame.h" -#include "Globals.h" - -#include "Utils/BitConverter.h" - -REGISTER_ZFILENODE(KeyFrameAnimation, ZKeyFrameAnim); - -ZKeyFrameAnim::ZKeyFrameAnim(ZFile* nParent) : ZResource(nParent) -{ - RegisterRequiredAttribute("Skel"); -} - -ZKeyFrameAnim::~ZKeyFrameAnim() -{ -} - -void ZKeyFrameAnim::ParseXML(tinyxml2::XMLElement* reader) -{ - ZResource::ParseXML(reader); - - std::string skelAddrStr = registeredAttributes.at("Skel").value; - skelOffset = (offset_t)StringHelper::StrToL(skelAddrStr, 16); -} - -void ZKeyFrameAnim::DeclareReferencesLate(const std::string& prefix) -{ - std::string defaultPrefix = name; - std::string declaration; - - if (defaultPrefix == "") - defaultPrefix = prefix; - - ZResource::DeclareReferences(defaultPrefix); - - declaration += "\t"; - - if (skel->limbType == ZKeyframeSkelType::Normal) - { - for (const auto b : bitFlags) - { - declaration += StringHelper::Sprintf("0x%02X, ", b); - parent->AddDeclarationArray( - GETSEGOFFSET(bitFlagsAddr), DeclarationAlignment::Align4, bitFlags.size(), "u8", - StringHelper::Sprintf("%s_bitFlags_%06X", prefix.c_str(), rawDataIndex), - bitFlags.size(), declaration); - } - } - else - { - for (const auto b : bitFlagsFlex) - { - declaration += StringHelper::Sprintf("0x%04X, ", b); - parent->AddDeclarationArray( - GETSEGOFFSET(bitFlagsAddr), DeclarationAlignment::Align4, bitFlagsFlex.size() * 2, - "u16", StringHelper::Sprintf("%s_flexBitFlags_%06X", prefix.c_str(), rawDataIndex), - bitFlagsFlex.size(), declaration); - } - } - declaration.clear(); - - for (const auto kf : keyFrames) - { - declaration += - StringHelper::Sprintf(" \t { %i, %i, %i, },\n", kf.frame, kf.value, kf.velocity); - } - // Remove last new line to prevent an extra line after the last element - declaration = declaration.substr(0, declaration.length() - 1); - parent->AddDeclarationArray( - GETSEGOFFSET(keyFramesAddr), DeclarationAlignment::Align4, keyFrames.size() * 6, "KeyFrame", - StringHelper::Sprintf("%s_KeyFrame_%06X", prefix.c_str(), rawDataIndex), keyFrames.size(), - declaration); - - declaration.clear(); - - declaration += "\t"; - - for (const auto kfNum : kfNums) - { - declaration += StringHelper::Sprintf("0x%04X, ", kfNum); - } - - parent->AddDeclarationArray( - GETSEGOFFSET(kfNumsAddr), DeclarationAlignment::Align4, kfNums.size() * 2, "s16", - StringHelper::Sprintf("%s_kfNums_%06X", prefix.c_str(), rawDataIndex), kfNums.size(), - declaration); - declaration += "\n"; - - declaration.clear(); - - declaration += "\t"; - - for (const auto pv : presetValues) - { - declaration += StringHelper::Sprintf("0x%04X, ", pv); - } - declaration += "\n"; - parent->AddDeclarationArray( - GETSEGOFFSET(presentValuesAddr), DeclarationAlignment::Align4, presetValues.size() * 2, - "s16", StringHelper::Sprintf("%s_presetValues_%06X", prefix.c_str(), rawDataIndex), - presetValues.size(), declaration); - -} - -// ParseRawDataLate is used because we need to make sure the flex skel has been processed first. -void ZKeyFrameAnim::ParseRawDataLate() -{ - const auto& rawData = parent->GetRawData(); - - skel = static_cast(parent->FindResource(skelOffset)); - size_t numLimbs = skel->limbCount; - - bitFlagsAddr = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x0); - keyFramesAddr = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x4); - kfNumsAddr = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x8); - presentValuesAddr = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0xC); - - uint32_t kfNumsSize = 0; - uint32_t presetValuesSize = 0; - uint32_t keyFramesCount = 0; - if (skel->limbType == ZKeyframeSkelType::Normal) - { - bitFlags.reserve(numLimbs); - for (size_t i = 0; i < numLimbs; i++) - { - uint8_t e = BitConverter::ToUInt8BE(rawData, GETSEGOFFSET(bitFlagsAddr) + i); - bitFlags.push_back(e); - kfNumsSize += GetSetBits((uint8_t)(e & 0b111111)); - presetValuesSize += GetSetBits((uint8_t)((e ^ 0xFF) & 0b111111)); - } - } - else - { - bitFlagsFlex.reserve(numLimbs); - for (size_t i = 0; i < numLimbs; i++) - { - uint16_t e = BitConverter::ToUInt16BE(rawData, GETSEGOFFSET(bitFlagsAddr) + (i * 2)); - bitFlagsFlex.push_back(e); - kfNumsSize += GetSetBits((uint16_t)(e & 0b111111111)); - presetValuesSize += GetSetBits((uint16_t)((e ^ 0xFFFF) & 0b111111111)); - } - } - - kfNums.reserve(kfNumsSize); - for (uint32_t i = 0; i < kfNumsSize; i++) - { - int16_t kfNum = BitConverter::ToUInt16BE(rawData, GETSEGOFFSET(kfNumsAddr) + (i * 2)); - keyFramesCount += kfNum; - kfNums.push_back(kfNum); - } - - keyFrames.reserve(keyFramesCount); - for (uint32_t i = 0; i < keyFramesCount; i++) - { - KeyFrame kf; - kf.frame = BitConverter::ToInt16BE(rawData, (GETSEGOFFSET(keyFramesAddr) + 0) + (i * 6)); - kf.value = BitConverter::ToInt16BE(rawData, (GETSEGOFFSET(keyFramesAddr) + 2) + (i * 6)); - kf.velocity = BitConverter::ToInt16BE(rawData, (GETSEGOFFSET(keyFramesAddr) + 4) + (i * 6)); - keyFrames.push_back(kf); - } - - presetValues.reserve(presetValuesSize); - for (uint32_t i = 0; i < presetValuesSize; i++) - { - presetValues.push_back( - BitConverter::ToInt16BE(rawData, GETSEGOFFSET(presentValuesAddr) + (i * 2))); - } - - unk_10 = BitConverter::ToInt16BE(rawData, GETSEGOFFSET(rawDataIndex) + 0x10); - duration = BitConverter::ToInt16BE(rawData, GETSEGOFFSET(rawDataIndex) + 0x12); -} - -std::string ZKeyFrameAnim::GetBodySourceCode() const -{ - std::string declaration; - - std::string bitFlagsStr; - std::string keyFrameStr; - std::string kfNumsStr; - std::string presetValuesStr; - - Globals::Instance->GetSegmentedPtrName(bitFlagsAddr, parent, "", bitFlagsStr); - Globals::Instance->GetSegmentedPtrName(keyFramesAddr, parent, "", keyFrameStr); - Globals::Instance->GetSegmentedPtrName(kfNumsAddr, parent, "", kfNumsStr); - Globals::Instance->GetSegmentedPtrName(presentValuesAddr, parent, "", presetValuesStr); - - return StringHelper::Sprintf("\n\t%s, %s, %s, %s, 0x%04X, 0x%04X\n", bitFlagsStr.c_str(), - keyFrameStr.c_str(), kfNumsStr.c_str(), presetValuesStr.c_str(), - unk_10, duration); -} - -std::string ZKeyFrameAnim::GetSourceTypeName() const -{ - return "KeyFrameAnimation"; -} - -ZResourceType ZKeyFrameAnim::GetResourceType() const -{ - return ZResourceType::KeyFrameAnimation; -} - -size_t ZKeyFrameAnim::GetRawDataSize() const -{ - return 0x14; -} - -template -uint32_t ZKeyFrameAnim::GetSetBits(T data) const -{ - uint32_t num = 0; - - for (size_t i = 0; i < sizeof(T) * 8; i++) - { - if ((data >> i) & 1) - num++; - } - - return num; -} \ No newline at end of file diff --git a/tools/ZAPD/ZAPD/ZCkeyFrameAnim.h b/tools/ZAPD/ZAPD/ZCkeyFrameAnim.h deleted file mode 100644 index 64f95b13ae..0000000000 --- a/tools/ZAPD/ZAPD/ZCkeyFrameAnim.h +++ /dev/null @@ -1,52 +0,0 @@ -#pragma once -#include -#include -#include -#include - -#include "ZFile.h" - -class ZKeyFrameSkel; - -typedef struct -{ - int16_t frame; - int16_t value; - int16_t velocity; -} KeyFrame; - -class ZKeyFrameAnim : public ZResource -{ -public: - ZKeyFrameSkel* skel; - std::vector bitFlags; // Standard only - std::vector bitFlagsFlex; // Flex only - - std::vector keyFrames; - std::vector kfNums; - std::vector presetValues; - - uint16_t unk_10; - int16_t duration; - - ZKeyFrameAnim(ZFile* nParent); - ~ZKeyFrameAnim(); - void ParseXML(tinyxml2::XMLElement* reader) override; - void DeclareReferencesLate(const std::string& prefix) override; - void ParseRawDataLate() override; - std::string GetBodySourceCode() const override; - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - size_t GetRawDataSize() const override; - -private: - offset_t skelOffset; - segptr_t bitFlagsAddr; - segptr_t keyFramesAddr; - segptr_t kfNumsAddr; - segptr_t presentValuesAddr; - template - uint32_t GetSetBits(T data) const; -}; diff --git a/tools/ZAPD/ZAPD/ZCollision.cpp b/tools/ZAPD/ZAPD/ZCollision.cpp deleted file mode 100644 index d177e036cb..0000000000 --- a/tools/ZAPD/ZAPD/ZCollision.cpp +++ /dev/null @@ -1,413 +0,0 @@ -#include "ZCollision.h" -#include "ZWaterbox.h" - -#include -#include -#include - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" - -REGISTER_ZFILENODE(Collision, ZCollisionHeader); - -ZCollisionHeader::ZCollisionHeader(ZFile* nParent) : ZResource(nParent) -{ -} - -ZCollisionHeader::~ZCollisionHeader() -{ - delete camData; -} - -void ZCollisionHeader::ParseRawData() -{ - const auto& rawData = parent->GetRawData(); - - absMinX = BitConverter::ToInt16BE(rawData, rawDataIndex + 0); - absMinY = BitConverter::ToInt16BE(rawData, rawDataIndex + 2); - absMinZ = BitConverter::ToInt16BE(rawData, rawDataIndex + 4); - - absMaxX = BitConverter::ToInt16BE(rawData, rawDataIndex + 6); - absMaxY = BitConverter::ToInt16BE(rawData, rawDataIndex + 8); - absMaxZ = BitConverter::ToInt16BE(rawData, rawDataIndex + 10); - - numVerts = BitConverter::ToUInt16BE(rawData, rawDataIndex + 12); - vtxAddress = BitConverter::ToInt32BE(rawData, rawDataIndex + 16); - - numPolygons = BitConverter::ToUInt16BE(rawData, rawDataIndex + 20); - polyAddress = BitConverter::ToInt32BE(rawData, rawDataIndex + 24); - polyTypeDefAddress = BitConverter::ToInt32BE(rawData, rawDataIndex + 28); - camDataAddress = BitConverter::ToInt32BE(rawData, rawDataIndex + 32); - - numWaterBoxes = BitConverter::ToUInt16BE(rawData, rawDataIndex + 36); - waterBoxAddress = BitConverter::ToInt32BE(rawData, rawDataIndex + 40); - - vtxSegmentOffset = Seg2Filespace(vtxAddress, parent->baseAddress); - polySegmentOffset = Seg2Filespace(polyAddress, parent->baseAddress); - polyTypeDefSegmentOffset = Seg2Filespace(polyTypeDefAddress, parent->baseAddress); - camDataSegmentOffset = Seg2Filespace(camDataAddress, parent->baseAddress); - waterBoxSegmentOffset = Seg2Filespace(waterBoxAddress, parent->baseAddress); - - vertices.reserve(numVerts); - polygons.reserve(numPolygons); - waterBoxes.reserve(numWaterBoxes); - - offset_t currentPtr = vtxSegmentOffset; - - for (uint16_t i = 0; i < numVerts; i++) - { - ZVector vec(parent); - vec.ExtractFromBinary(currentPtr, ZScalarType::ZSCALAR_S16, 3); - - currentPtr += vec.GetRawDataSize(); - vertices.push_back(vec); - } - - for (uint16_t i = 0; i < numPolygons; i++) - { - ZCollisionPoly poly(parent); - poly.SetRawDataIndex(polySegmentOffset + (i * 16)); - poly.ParseRawData(); - polygons.push_back(poly); - } - - uint16_t highestPolyType = 0; - - for (const ZCollisionPoly& poly : polygons) - { - if (poly.type > highestPolyType) - highestPolyType = poly.type; - } - - for (uint16_t i = 0; i < highestPolyType + 1; i++) - { - ZSurfaceType surfaceType(parent); - surfaceType.SetRawDataIndex(polyTypeDefSegmentOffset + (i * 8)); - surfaceType.ParseRawData(); - polygonTypes.push_back(surfaceType); - } - // polygonTypes.push_back( - // BitConverter::ToUInt64BE(rawData, polyTypeDefSegmentOffset + (i * 8))); - - if (camDataAddress != SEGMENTED_NULL) - { - // Try to guess how many elements the CamDataList array has. - // The "guessing algorithm" is basically a "best effort" one and it - // is error-prone. - // This is based mostly on observation of how CollisionHeader data is - // usually ordered. If for some reason the data was in some other funny - // order, this would probably break. - // The most common ordering is: - // - *BgCamInfo* - // - SurfaceType - // - CollisionPoly - // - Vertices - // - WaterBoxes - // - CollisionHeader - offset_t upperCameraBoundary = polyTypeDefSegmentOffset; - if (upperCameraBoundary == SEGMENTED_NULL) - { - upperCameraBoundary = polySegmentOffset; - } - if (upperCameraBoundary == SEGMENTED_NULL) - { - upperCameraBoundary = vtxSegmentOffset; - } - if (upperCameraBoundary == SEGMENTED_NULL) - { - upperCameraBoundary = waterBoxSegmentOffset; - } - if (upperCameraBoundary == SEGMENTED_NULL) - { - upperCameraBoundary = rawDataIndex; - } - - // Sharp Ocarina places the CamDataEntries above the list so we need to calculate the number - // of cameras differently. - if (upperCameraBoundary < camDataSegmentOffset) - { - offset_t offset = camDataSegmentOffset; - while (rawData[offset] == 0x00 && rawData[offset + 0x4] == 0x02) - { - offset += 0x08; - } - upperCameraBoundary = offset; - } - - camData = - new CameraDataList(parent, name, rawData, camDataSegmentOffset, upperCameraBoundary); - } - - for (int32_t i = 0; i < numWaterBoxes; i++) - { - ZWaterbox waterbox(parent); - - waterbox.SetRawDataIndex(waterBoxSegmentOffset + - (i * (Globals::Instance->game == ZGame::OOT_SW97 ? 12 : 16))); - waterbox.ParseRawData(); - waterBoxes.emplace_back(waterbox); - } -} - -void ZCollisionHeader::DeclareReferences(const std::string& prefix) -{ - std::string declaration = ""; - std::string auxName = name; - - if (name == "") - auxName = GetDefaultName(prefix); - - if (waterBoxes.size() > 0) - { - for (size_t i = 0; i < waterBoxes.size(); i++) - { - declaration += - StringHelper::Sprintf("\t{ %s },", waterBoxes[i].GetBodySourceCode().c_str()); - if (i + 1 < waterBoxes.size()) - declaration += "\n"; - } - - parent->AddDeclarationArray(waterBoxSegmentOffset, DeclarationAlignment::Align4, - waterBoxes[0].GetRawDataSize() * waterBoxes.size(), - waterBoxes[0].GetSourceTypeName().c_str(), - StringHelper::Sprintf("%sWaterBoxes", auxName.c_str()), - waterBoxes.size(), declaration); - } - - if (polygons.size() > 0) - { - declaration.clear(); - - for (size_t i = 0; i < polygons.size(); i++) - { - declaration += StringHelper::Sprintf("\t%s,", polygons[i].GetBodySourceCode().c_str()); - if (i + 1 < polygons.size()) - declaration += "\n"; - } - - parent->AddDeclarationArray(polySegmentOffset, DeclarationAlignment::Align4, - polygons.size() * 16, polygons[0].GetSourceTypeName().c_str(), - StringHelper::Sprintf("%sPolygons", auxName.c_str()), - polygons.size(), declaration); - } - - declaration.clear(); - for (const auto& polyType : polygonTypes) - { - declaration += StringHelper::Sprintf("\t%s,", polyType.GetBodySourceCode().c_str()); - } - - if (polyTypeDefAddress != SEGMENTED_NULL) - parent->AddDeclarationArray(polyTypeDefSegmentOffset, DeclarationAlignment::Align4, - polygonTypes.size() * 8, - polygonTypes[0].GetSourceTypeName().c_str(), - StringHelper::Sprintf("%sSurfaceType", auxName.c_str()), - polygonTypes.size(), declaration); - - declaration.clear(); - - if (vertices.size() > 0) - { - declaration.clear(); - - for (size_t i = 0; i < vertices.size(); i++) - { - declaration += - StringHelper::Sprintf("\t{ %s },", vertices[i].GetBodySourceCode().c_str()); - - if (i < vertices.size() - 1) - declaration += "\n"; - } - - const auto& first = vertices.front(); - if (vtxAddress != 0) - parent->AddDeclarationArray( - vtxSegmentOffset, first.GetDeclarationAlignment(), - vertices.size() * first.GetRawDataSize(), first.GetSourceTypeName(), - StringHelper::Sprintf("%sVertices", auxName.c_str()), vertices.size(), declaration); - } -} - -std::string ZCollisionHeader::GetBodySourceCode() const -{ - std::string declaration = ""; - - declaration += "\n"; - - declaration += StringHelper::Sprintf("\t{ %i, %i, %i },\n", absMinX, absMinY, absMinZ); - declaration += StringHelper::Sprintf("\t{ %i, %i, %i },\n", absMaxX, absMaxY, absMaxZ); - - std::string vtxName; - Globals::Instance->GetSegmentedPtrName(vtxAddress, parent, "Vec3s", vtxName); - - if (numVerts > 0) - declaration += - StringHelper::Sprintf("\tARRAY_COUNT(%s), %s,\n", vtxName.c_str(), vtxName.c_str()); - else - declaration += StringHelper::Sprintf("\t%i, %s,\n", numVerts, vtxName.c_str()); - - std::string polyName; - Globals::Instance->GetSegmentedPtrName(polyAddress, parent, "CollisionPoly", polyName); - - if (numPolygons > 0) - declaration += - StringHelper::Sprintf("\tARRAY_COUNT(%s), %s,\n", polyName.c_str(), polyName.c_str()); - else - declaration += StringHelper::Sprintf("\t%i, %s,\n", numPolygons, polyName.c_str()); - - std::string surfaceName; - Globals::Instance->GetSegmentedPtrName(polyTypeDefAddress, parent, "SurfaceType", surfaceName); - declaration += StringHelper::Sprintf("\t%s,\n", surfaceName.c_str()); - - std::string camName; - Globals::Instance->GetSegmentedPtrName(camDataAddress, parent, "BgCamInfo", camName); - declaration += StringHelper::Sprintf("\t%s,\n", camName.c_str()); - - std::string waterBoxName; - Globals::Instance->GetSegmentedPtrName(waterBoxAddress, parent, "WaterBox", waterBoxName); - - if (numWaterBoxes > 0) - declaration += StringHelper::Sprintf("\tARRAY_COUNT(%s), %s\n", waterBoxName.c_str(), - waterBoxName.c_str()); - else - declaration += StringHelper::Sprintf("\t%i, %s\n", numWaterBoxes, waterBoxName.c_str()); - - return declaration; -} - -std::string ZCollisionHeader::GetDefaultName(const std::string& prefix) const -{ - return StringHelper::Sprintf("%sCol_%06X", prefix.c_str(), rawDataIndex); -} - -std::string ZCollisionHeader::GetSourceTypeName() const -{ - return "CollisionHeader"; -} - -ZResourceType ZCollisionHeader::GetResourceType() const -{ - return ZResourceType::CollisionHeader; -} - -size_t ZCollisionHeader::GetRawDataSize() const -{ - return 44; -} - -CameraDataList::CameraDataList(ZFile* parent, const std::string& prefix, - const std::vector& rawData, offset_t rawDataIndex, - offset_t upperCameraBoundary) -{ - std::string declaration; - - // Parse CameraDataEntries - size_t numElements = (upperCameraBoundary - rawDataIndex) / 8; - assert(numElements < 10000); - - offset_t cameraPosDataSeg = rawDataIndex; - uint32_t numDataTotal; - uint32_t cameraPosDataSegEnd = rawDataIndex; - bool isSharpOcarina = false; - - for (size_t i = 0; i < numElements; i++) - { - CameraDataEntry entry; - - entry.cameraSType = - BitConverter::ToInt16BE(rawData, rawDataIndex + (entries.size() * 8) + 0); - entry.numData = BitConverter::ToInt16BE(rawData, rawDataIndex + (entries.size() * 8) + 2); - entry.cameraPosDataSeg = - BitConverter::ToInt32BE(rawData, rawDataIndex + (entries.size() * 8) + 4); - - if (entry.cameraPosDataSeg != 0 && GETSEGNUM(entry.cameraPosDataSeg) != SEGMENT_SCENE) - { - cameraPosDataSeg = rawDataIndex + (entries.size() * 8); - break; - } - - if (rawDataIndex > GETSEGOFFSET(entry.cameraPosDataSeg)) - { - if (entry.cameraPosDataSeg != 0 && - cameraPosDataSeg > GETSEGOFFSET(entry.cameraPosDataSeg)) - cameraPosDataSeg = GETSEGOFFSET(entry.cameraPosDataSeg); - } - else - { - // Sharp Ocarina will place the cam data after the list as opposed to the original maps - // which have it before. - isSharpOcarina = true; - cameraPosDataSeg = rawDataIndex + (numElements * 0x8); - if (cameraPosDataSegEnd < GETSEGOFFSET(entry.cameraPosDataSeg)) - cameraPosDataSegEnd = GETSEGOFFSET(entry.cameraPosDataSeg); - } - - entries.emplace_back(entry); - } - - // Setting cameraPosDataAddr to rawDataIndex give a pos list length of 0 - uint32_t cameraPosDataOffset = GETSEGOFFSET(cameraPosDataSeg); - for (size_t i = 0; i < entries.size(); i++) - { - char camSegLine[2048]; - - if (entries[i].cameraPosDataSeg != 0) - { - uint32_t index = - (GETSEGOFFSET(entries[i].cameraPosDataSeg) - cameraPosDataOffset) / 0x6; - snprintf(camSegLine, 2048, "&%sCamPosData[%i]", prefix.c_str(), index); - } - else - snprintf(camSegLine, 2048, "NULL"); - - declaration += - StringHelper::Sprintf(" { 0x%04X, %i, %s },", entries[i].cameraSType, - entries[i].numData, camSegLine, rawDataIndex + (i * 8)); - - if (i < entries.size() - 1) - declaration += "\n"; - } - - parent->AddDeclarationArray( - rawDataIndex, DeclarationAlignment::Align4, entries.size() * 8, "BgCamInfo", - StringHelper::Sprintf("%sCamDataList", prefix.c_str(), rawDataIndex), entries.size(), - declaration); - - if (!isSharpOcarina) - numDataTotal = (rawDataIndex - cameraPosDataOffset) / 0x6; - else - numDataTotal = ((cameraPosDataSegEnd - cameraPosDataSeg) + 18) / 0x6; - - if (numDataTotal > 0) - { - declaration.clear(); - cameraPositionData.reserve(numDataTotal); - for (uint32_t i = 0; i < numDataTotal; i++) - { - CameraPositionData data = CameraPositionData(rawData, cameraPosDataOffset + (i * 6)); - - declaration += StringHelper::Sprintf("\t{ %6i, %6i, %6i },", data.x, data.y, data.z); - cameraPositionData.emplace_back(data); - if (i + 1 < numDataTotal) - declaration += "\n"; - } - - uint32_t cameraPosDataIndex = GETSEGOFFSET(cameraPosDataSeg); - uint32_t entrySize = numDataTotal * 0x6; - parent->AddDeclarationArray(cameraPosDataIndex, DeclarationAlignment::Align4, entrySize, - "Vec3s", StringHelper::Sprintf("%sCamPosData", prefix.c_str()), - numDataTotal, declaration); - } -} - -CameraDataList::~CameraDataList() -{ -} - -CameraPositionData::CameraPositionData(const std::vector& rawData, uint32_t rawDataIndex) -{ - x = BitConverter::ToInt16BE(rawData, rawDataIndex + 0); - y = BitConverter::ToInt16BE(rawData, rawDataIndex + 2); - z = BitConverter::ToInt16BE(rawData, rawDataIndex + 4); -} diff --git a/tools/ZAPD/ZAPD/ZCollision.h b/tools/ZAPD/ZAPD/ZCollision.h deleted file mode 100644 index 8c73d2eaa1..0000000000 --- a/tools/ZAPD/ZAPD/ZCollision.h +++ /dev/null @@ -1,75 +0,0 @@ -#pragma once - -#include "ZCollisionPoly.h" -#include "ZFile.h" -#include "ZResource.h" -#include "ZRoom/ZRoom.h" -#include "ZSurfaceType.h" -#include "ZVector.h" -#include "ZWaterbox.h" - -class CameraPositionData -{ -public: - int16_t x, y, z; - - CameraPositionData(const std::vector& rawData, uint32_t rawDataIndex); -}; - -class CameraDataEntry -{ -public: - int16_t cameraSType; - int16_t numData; - offset_t cameraPosDataSeg; -}; - -class CameraDataList -{ -public: - std::vector entries; - std::vector cameraPositionData; - - CameraDataList(ZFile* parent, const std::string& prefix, const std::vector& rawData, - offset_t rawDataIndex, offset_t upperCameraBoundary); - ~CameraDataList(); -}; - -class ZCollisionHeader : public ZResource -{ -public: - int16_t absMinX, absMinY, absMinZ; - int16_t absMaxX, absMaxY, absMaxZ; - uint16_t numVerts; - segptr_t vtxAddress; - uint16_t numPolygons; - segptr_t polyAddress; - segptr_t polyTypeDefAddress; - segptr_t camDataAddress; - - int32_t numWaterBoxes; - segptr_t waterBoxAddress; - - uint32_t vtxSegmentOffset, polySegmentOffset, polyTypeDefSegmentOffset, camDataSegmentOffset, - waterBoxSegmentOffset; - - std::vector vertices; - std::vector polygons; - std::vector polygonTypes; - std::vector waterBoxes; - CameraDataList* camData = nullptr; - - ZCollisionHeader(ZFile* nParent); - ~ZCollisionHeader(); - - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - std::string GetDefaultName(const std::string& prefix) const override; - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - size_t GetRawDataSize() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZCollisionPoly.cpp b/tools/ZAPD/ZAPD/ZCollisionPoly.cpp deleted file mode 100644 index c4eb2d461d..0000000000 --- a/tools/ZAPD/ZAPD/ZCollisionPoly.cpp +++ /dev/null @@ -1,78 +0,0 @@ -#include "ZCollisionPoly.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" - -REGISTER_ZFILENODE(CollisionPoly, ZCollisionPoly); - -ZCollisionPoly::ZCollisionPoly(ZFile* nParent) : ZResource(nParent) -{ -} - -ZCollisionPoly::~ZCollisionPoly() -{ -} - -void ZCollisionPoly::ParseRawData() -{ - const auto& rawData = parent->GetRawData(); - type = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0); - - vtxA = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2); - vtxB = BitConverter::ToUInt16BE(rawData, rawDataIndex + 4); - vtxC = BitConverter::ToUInt16BE(rawData, rawDataIndex + 6); - - normX = BitConverter::ToUInt16BE(rawData, rawDataIndex + 8); - normY = BitConverter::ToUInt16BE(rawData, rawDataIndex + 10); - normZ = BitConverter::ToUInt16BE(rawData, rawDataIndex + 12); - - dist = BitConverter::ToUInt16BE(rawData, rawDataIndex + 14); -} - -void ZCollisionPoly::DeclareReferences(const std::string& prefix) -{ - std::string declaration; - std::string auxName = name; - - if (name == "") - auxName = GetDefaultName(prefix); - - parent->AddDeclaration(rawDataIndex, DeclarationAlignment::Align4, GetRawDataSize(), - GetSourceTypeName(), name.c_str(), GetBodySourceCode()); -} - -std::string ZCollisionPoly::GetBodySourceCode() const -{ - std::string declaration; - - declaration += - StringHelper::Sprintf("{0x%04X, 0x%04X, 0x%04X, 0x%04X, 0x%04X, 0x%04X, 0x%04X, 0x%04X}", - type, vtxA, vtxB, vtxC, normX, normY, normZ, dist); - return declaration; -} - -std::string ZCollisionPoly::GetDefaultName(const std::string& prefix) const -{ - return StringHelper::Sprintf("%sCollisionPoly_%06X", prefix.c_str(), rawDataIndex); -} - -ZResourceType ZCollisionPoly::GetResourceType() const -{ - return ZResourceType::CollisionPoly; -} - -size_t ZCollisionPoly::GetRawDataSize() const -{ - return 16; -} - -std::string ZCollisionPoly::GetSourceTypeName() const -{ - return "CollisionPoly"; -} - -bool ZCollisionPoly::DoesSupportArray() const -{ - return true; -} \ No newline at end of file diff --git a/tools/ZAPD/ZAPD/ZCollisionPoly.h b/tools/ZAPD/ZAPD/ZCollisionPoly.h deleted file mode 100644 index 64b98ba1d9..0000000000 --- a/tools/ZAPD/ZAPD/ZCollisionPoly.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#include "ZFile.h" -#include "ZResource.h" - -class ZCollisionPoly : public ZResource -{ -public: - uint16_t type; - uint16_t vtxA, vtxB, vtxC; - uint16_t normX, normY, normZ; - uint16_t dist; - - ZCollisionPoly(ZFile* nParent); - ~ZCollisionPoly(); - - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - std::string GetDefaultName(const std::string& prefix) const override; - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - bool DoesSupportArray() const override; - - size_t GetRawDataSize() const override; -}; \ No newline at end of file diff --git a/tools/ZAPD/ZAPD/ZCutscene.cpp b/tools/ZAPD/ZAPD/ZCutscene.cpp deleted file mode 100644 index 636a7d4c73..0000000000 --- a/tools/ZAPD/ZAPD/ZCutscene.cpp +++ /dev/null @@ -1,396 +0,0 @@ -#include "ZCutscene.h" - -#include - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "WarningHandler.h" -#include "ZResource.h" - -REGISTER_ZFILENODE(Cutscene, ZCutscene); - -ZCutscene::ZCutscene(ZFile* nParent) : ZResource(nParent) -{ -} - -ZCutscene::~ZCutscene() -{ - for (CutsceneCommand* cmd : commands) - delete cmd; -} - -std::string ZCutscene::GetBodySourceCode() const -{ - std::string output = ""; - - output += StringHelper::Sprintf(" CS_HEADER(%i, %i),\n", numCommands, endFrame); - - for (size_t i = 0; i < commands.size(); i++) - { - CutsceneCommand* cmd = commands[i]; - output += " " + cmd->GenerateSourceCode(); - } - - output += StringHelper::Sprintf(" CS_END_OF_SCRIPT(),"); - - return output; -} - -size_t ZCutscene::GetRawDataSize() const -{ - size_t size = 0; - - // Beginning - size += 8; - - for (size_t i = 0; i < commands.size(); i++) - { - CutsceneCommand* cmd = commands[i]; - - size += cmd->GetCommandSize(); - } - - // End - if (Globals::Instance->game == ZGame::MM_RETAIL) - { - size += 4; - } - else - { - size += 8; - } - - return size; -} - -void ZCutscene::ParseRawData() -{ - ZResource::ParseRawData(); - - const auto& rawData = parent->GetRawData(); - - numCommands = BitConverter::ToInt32BE(rawData, rawDataIndex + 0); - commands = std::vector(); - - endFrame = BitConverter::ToInt32BE(rawData, rawDataIndex + 4); - offset_t currentPtr = rawDataIndex + 8; - commands.reserve(numCommands); - for (int32_t i = 0; i < numCommands; i++) - { - uint32_t id = BitConverter::ToUInt32BE(rawData, currentPtr); - - if (id == 0xFFFFFFFF) - break; - - if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_DEBUG) - { - printf("Cutscene Command: 0x%X (%i)\n", id, id); - } - - currentPtr += 4; - - CutsceneCommand* cmd = nullptr; - - if (Globals::Instance->game == ZGame::MM_RETAIL) - { - cmd = GetCommandMM(id, currentPtr); - } - else - { - cmd = GetCommandOoT(id, currentPtr); - } - - if (cmd == nullptr) - { - HANDLE_WARNING_RESOURCE( - WarningType::NotImplemented, parent, this, rawDataIndex, - StringHelper::Sprintf("Cutscene command not implemented"), - StringHelper::Sprintf("Command ID: 0x%X\nIndex: %d\ncurrentPtr-rawDataIndex: 0x%X", - id, i, currentPtr - rawDataIndex)); - cmd = new CutsceneMMCommand_NonImplemented(rawData, currentPtr); - } - - assert(cmd != nullptr); - - cmd->commandIndex = i; - cmd->SetCommandID(id); - size_t commmandSize = cmd->GetCommandSize(); - if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_DEBUG) - { - printf("\t Command size: 0x%zX (%zu)\n", commmandSize, commmandSize); - } - currentPtr += commmandSize - 4; - - commands.push_back(cmd); - } -} - -CutsceneCommand* ZCutscene::GetCommandOoT(uint32_t id, offset_t currentPtr) const -{ - CutsceneOoT_CommandType cmdID = static_cast(id); - - const auto& rawData = parent->GetRawData(); - - switch (cmdID) - { - case CutsceneOoT_CommandType::CS_CMD_PLAYER_CUE: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_0: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_0: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_1: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_1: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_2: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_3: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_2: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_0: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_0: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_4_0: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_6_0: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_4: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_3: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_1: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_1: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_4_1: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_5: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_4: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_2: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_2: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_4_2: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_5_0: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_6: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_4_3: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_5: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_7_0: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_3: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_3: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_6_1: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_4: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_4_4: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_5_1: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_6_2: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_6_3: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_7_1: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_8_0: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_5: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_6: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_6: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_7: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_4: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_7: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_5: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_8: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_6: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_7: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_8: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_7: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_5_2: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_9: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_4_5: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_10: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_8: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_9: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_4_6: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_5_3: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_8: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_6_4: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_7_2: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_5_4: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_9: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_11: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_10: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_9: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_11: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_10: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_12: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_7_3: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_7_4: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_6_5: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_12: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_10: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_13: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_13: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_14: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_11: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_14: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_15: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_12: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_11: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_4_7: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_5_5: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_6_6: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_16: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_2_13: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_3_12: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_7_5: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_4_8: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_5_6: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_6_7: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_15: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_16: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_1_17: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_7_6: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_9_0: - case CutsceneOoT_CommandType::CS_CMD_ACTOR_CUE_0_17: - return new CutsceneOoTCommand_ActorCue(rawData, currentPtr); - - case CutsceneOoT_CommandType::CS_CMD_MISC: - case CutsceneOoT_CommandType::CS_CMD_LIGHT_SETTING: - case CutsceneOoT_CommandType::CS_CMD_START_SEQ: - case CutsceneOoT_CommandType::CS_CMD_STOP_SEQ: - case CutsceneOoT_CommandType::CS_CMD_FADE_OUT_SEQ: - return new CutsceneOoTCommand_GenericCmd(rawData, currentPtr, cmdID); - - case CutsceneOoT_CommandType::CS_CMD_CAM_EYE_SPLINE: - case CutsceneOoT_CommandType::CS_CMD_CAM_AT_SPLINE: - case CutsceneOoT_CommandType::CS_CMD_CAM_EYE_SPLINE_REL_TO_PLAYER: - case CutsceneOoT_CommandType::CS_CMD_CAM_AT_SPLINE_REL_TO_PLAYER: - return new CutsceneOoTCommand_GenericCameraCmd(rawData, currentPtr); - - case CutsceneOoT_CommandType::CS_CMD_RUMBLE_CONTROLLER: - return new CutsceneOoTCommand_Rumble(rawData, currentPtr); - - case CutsceneOoT_CommandType::CS_CMD_TEXT: - return new CutsceneOoTCommand_Text(rawData, currentPtr); - - case CutsceneOoT_CommandType::CS_CMD_TRANSITION: - return new CutsceneOoTCommand_Transition(rawData, currentPtr); - - case CutsceneOoT_CommandType::CS_CMD_TIME: - return new CutsceneCommand_Time(rawData, currentPtr); - - case CutsceneOoT_CommandType::CS_CMD_DESTINATION: - return new CutsceneOoTCommand_Destination(rawData, currentPtr); - - case CutsceneOoT_CommandType::CS_CMD_CAM_EYE: - case CutsceneOoT_CommandType::CS_CMD_CAM_AT: - break; - - default: - std::string errorHeader = - StringHelper::Sprintf("Warning: Invalid cutscene command ID: '0x%04X'", cmdID); - return new CutsceneOoTCommand_GenericCmd(rawData, currentPtr, cmdID); - } - - return nullptr; -} - -CutsceneCommand* ZCutscene::GetCommandMM(uint32_t id, offset_t currentPtr) const -{ - CutsceneMM_CommandType cmdID = static_cast(id); - - const auto& rawData = parent->GetRawData(); - - if (((id >= (uint32_t)CutsceneMM_CommandType::CS_CMD_ACTOR_CUE_100) && - (id <= (uint32_t)CutsceneMM_CommandType::CS_CMD_ACTOR_CUE_149)) || - (id == (uint32_t)CutsceneMM_CommandType::CS_CMD_ACTOR_CUE_201) || - ((id >= (uint32_t)CutsceneMM_CommandType::CS_CMD_ACTOR_CUE_450) && - (id <= (uint32_t)CutsceneMM_CommandType::CS_CMD_ACTOR_CUE_599))) - { - return new CutsceneMMCommand_ActorCue(rawData, currentPtr); - } - - switch (cmdID) - { - case CutsceneMM_CommandType::CS_CMD_MISC: - case CutsceneMM_CommandType::CS_CMD_LIGHT_SETTING: - case CutsceneMM_CommandType::CS_CMD_TRANSITION: - case CutsceneMM_CommandType::CS_CMD_MOTION_BLUR: - case CutsceneMM_CommandType::CS_CMD_GIVE_TATL: - case CutsceneMM_CommandType::CS_CMD_START_SEQ: - case CutsceneMM_CommandType::CS_CMD_SFX_REVERB_INDEX_2: - case CutsceneMM_CommandType::CS_CMD_SFX_REVERB_INDEX_1: - case CutsceneMM_CommandType::CS_CMD_MODIFY_SEQ: - case CutsceneMM_CommandType::CS_CMD_STOP_SEQ: - case CutsceneMM_CommandType::CS_CMD_START_AMBIENCE: - case CutsceneMM_CommandType::CS_CMD_FADE_OUT_AMBIENCE: - case CutsceneMM_CommandType::CS_CMD_DESTINATION: - case CutsceneMM_CommandType::CS_CMD_CHOOSE_CREDITS_SCENES: - - case CutsceneMM_CommandType::CS_CMD_UNK_DATA_FA: - case CutsceneMM_CommandType::CS_CMD_UNK_DATA_FE: - case CutsceneMM_CommandType::CS_CMD_UNK_DATA_FF: - case CutsceneMM_CommandType::CS_CMD_UNK_DATA_100: - case CutsceneMM_CommandType::CS_CMD_UNK_DATA_101: - case CutsceneMM_CommandType::CS_CMD_UNK_DATA_102: - case CutsceneMM_CommandType::CS_CMD_UNK_DATA_103: - case CutsceneMM_CommandType::CS_CMD_UNK_DATA_104: - case CutsceneMM_CommandType::CS_CMD_UNK_DATA_105: - case CutsceneMM_CommandType::CS_CMD_UNK_DATA_108: - case CutsceneMM_CommandType::CS_CMD_UNK_DATA_109: - return new CutsceneMMCommand_GenericCmd(rawData, currentPtr, cmdID); - - case CutsceneMM_CommandType::CS_CMD_TEXT: - return new CutsceneMMCommand_Text(rawData, currentPtr); - - case CutsceneMM_CommandType::CS_CMD_CAMERA_SPLINE: - return new CutsceneMMCommand_Spline(rawData, currentPtr); - - case CutsceneMM_CommandType::CS_CMD_TRANSITION_GENERAL: - return new CutsceneMMCommand_TransitionGeneral(rawData, currentPtr); - - case CutsceneMM_CommandType::CS_CMD_FADE_OUT_SEQ: - return new CutsceneMMCommand_FadeOutSeq(rawData, currentPtr); - - case CutsceneMM_CommandType::CS_CMD_TIME: - return new CutsceneCommand_Time(rawData, currentPtr); - - case CutsceneMM_CommandType::CS_CMD_PLAYER_CUE: - return new CutsceneMMCommand_ActorCue(rawData, currentPtr); - - case CutsceneMM_CommandType::CS_CMD_RUMBLE: - return new CutsceneMMCommand_Rumble(rawData, currentPtr); - - default: - std::string errorHeader = - StringHelper::Sprintf("Warning: Invalid cutscene command ID: '0x%04X'", cmdID); - return new CutsceneMMCommand_GenericCmd(rawData, currentPtr, cmdID); - } - - return nullptr; -} - -Declaration* ZCutscene::DeclareVar(const std::string& prefix, const std::string& bodyStr) -{ - std::string auxName = name; - - if (auxName == "") - auxName = GetDefaultName(prefix); - - Declaration* decl = - parent->AddDeclarationArray(rawDataIndex, GetDeclarationAlignment(), GetRawDataSize(), - GetSourceTypeName(), auxName, 0, bodyStr); - decl->staticConf = staticConf; - return decl; -} - -std::string ZCutscene::GetSourceTypeName() const -{ - return "CutsceneData"; -} - -ZResourceType ZCutscene::GetResourceType() const -{ - return ZResourceType::Cutscene; -} - -std::string ZCutscene::GetCsEncodedFloat(float f, CsFloatType type, bool useSciNotation) -{ - uint32_t i; - std::memcpy(&i, &f, sizeof(i)); - - switch (type) - { - default: - // This default case will NEVER be reached, but GCC still gives a warning. - case CsFloatType::HexOnly: - return StringHelper::Sprintf("0x%08X", i); - case CsFloatType::FloatOnly: - return StringHelper::Sprintf(useSciNotation ? "%.8ef" : "%ff", f); - case CsFloatType::HexAndFloat: - return StringHelper::Sprintf(useSciNotation ? "CS_FLOAT(0x%08X, %.8ef)" : "CS_FLOAT(0x%08X, %ff)", i, f); - case CsFloatType::HexAndCommentedFloatLeft: - return StringHelper::Sprintf(useSciNotation ? "/* %.8ef */ 0x%08X" : "/* %ff */ 0x%08X", f, i); - case CsFloatType::HexAndCommentedFloatRight: - return StringHelper::Sprintf(useSciNotation ? "0x%08X /* %.8ef */" : "0x%08X /* %ff */", i, f); - } -} diff --git a/tools/ZAPD/ZAPD/ZCutscene.h b/tools/ZAPD/ZAPD/ZCutscene.h deleted file mode 100644 index 5dbf475c33..0000000000 --- a/tools/ZAPD/ZAPD/ZCutscene.h +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - -#include -#include -#include -#include "tinyxml2.h" - -#include "OtherStructs/CutsceneOoT_Commands.h" -#include "OtherStructs/CutsceneMM_Commands.h" -#include "ZFile.h" -#include "ZResource.h" - -enum class CsFloatType; - -class ZCutscene : public ZResource -{ -public: - ZCutscene(ZFile* nParent); - ~ZCutscene(); - - void ParseRawData() override; - - Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override; - - std::string GetBodySourceCode() const override; - - size_t GetRawDataSize() const override; - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - static std::string GetCsEncodedFloat(float f, CsFloatType type, bool useSciNotation); - - int32_t numCommands; - int32_t endFrame; - std::vector commands; - -protected: - CutsceneCommand* GetCommandOoT(uint32_t id, offset_t currentPtr) const; - CutsceneCommand* GetCommandMM(uint32_t id, offset_t currentPtr) const; -}; diff --git a/tools/ZAPD/ZAPD/ZDisplayList.cpp b/tools/ZAPD/ZAPD/ZDisplayList.cpp deleted file mode 100644 index 98c4d0e4a4..0000000000 --- a/tools/ZAPD/ZAPD/ZDisplayList.cpp +++ /dev/null @@ -1,2178 +0,0 @@ -#include "ZDisplayList.h" - -#include -#include -#include -#include -#include - -#include "Globals.h" -#include "OutputFormatter.h" -#include "Utils/BitConverter.h" -#include "Utils/File.h" -#include "Utils/Path.h" -#include "Utils/StringHelper.h" -#include "WarningHandler.h" -#include "gfxd.h" - -REGISTER_ZFILENODE(DList, ZDisplayList); - -ZDisplayList::ZDisplayList(ZFile* nParent) : ZResource(nParent) -{ - lastTexWidth = 0; - lastTexHeight = 0; - lastTexAddr = 0; - lastTexFmt = F3DZEXTexFormats::G_IM_FMT_RGBA; - lastTexSiz = F3DZEXTexSizes::G_IM_SIZ_16b; - lastTexSizTest = F3DZEXTexSizes::G_IM_SIZ_16b; - lastTexLoaded = false; - lastTexIsPalette = false; - dListType = Globals::Instance->game == ZGame::OOT_SW97 ? DListType::F3DEX : DListType::F3DZEX; - RegisterOptionalAttribute("Ucode"); -} - -ZDisplayList::~ZDisplayList() -{ - for (auto o : otherDLists) - { - delete o; - } -} - -// EXTRACT MODE -void ZDisplayList::ExtractWithXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex) -{ - rawDataIndex = nRawDataIndex; - ParseXML(reader); - // TODO add error handling here - bool ucodeSet = registeredAttributes.at("Ucode").wasSet; - std::string ucodeValue = registeredAttributes.at("Ucode").value; - if ((Globals::Instance->game == ZGame::OOT_SW97) || (ucodeValue == "f3dex")) - { - dListType = DListType::F3DEX; - } - else if (!ucodeSet || ucodeValue == "f3dex2") - { - dListType = DListType::F3DZEX; - } - else - { - HANDLE_ERROR_RESOURCE( - WarningType::InvalidAttributeValue, parent, this, rawDataIndex, - StringHelper::Sprintf("Invalid ucode type in node: %s\n", reader->Name()), ""); - } - - // Don't parse raw data of external files - if (parent->GetMode() != ZFileMode::ExternalFile) - { - int32_t rawDataSize = - ZDisplayList::GetDListLength(parent->GetRawData(), rawDataIndex, dListType); - numInstructions = rawDataSize / 8; - ParseRawData(); - } - - Declaration* decl = DeclareVar("", ""); - decl->declaredInXml = true; -} - -void ZDisplayList::ExtractFromBinary(uint32_t nRawDataIndex, int32_t rawDataSize) -{ - rawDataIndex = nRawDataIndex; - name = GetDefaultName(parent->GetName()); - numInstructions = rawDataSize / 8; - - // Don't parse raw data of external files - if (parent->GetMode() == ZFileMode::ExternalFile) - return; - - ParseRawData(); -} - -void ZDisplayList::ParseRawData() -{ - const auto& rawData = parent->GetRawData(); - instructions.reserve(numInstructions); - uint32_t ptr = rawDataIndex; - - instructions.reserve(numInstructions); - for (size_t i = 0; i < numInstructions; i++) - { - instructions.push_back(BitConverter::ToUInt64BE(rawData, ptr)); - ptr += 8; - } -} - -Declaration* ZDisplayList::DeclareVar([[maybe_unused]] const std::string& prefix, - const std::string& bodyStr) -{ - Declaration* decl = - parent->AddDeclarationArray(rawDataIndex, GetDeclarationAlignment(), GetRawDataSize(), - GetSourceTypeName(), name, numInstructions, bodyStr); - decl->isExternal = true; - decl->staticConf = staticConf; - return decl; -} - -std::string ZDisplayList::GetDefaultName(const std::string& prefix) const -{ - return StringHelper::Sprintf("%sDL_%06X", prefix.c_str(), rawDataIndex); -} - -void ZDisplayList::ParseF3DZEX(F3DZEXOpcode opcode, uint64_t data, int32_t i, - const std::string& prefix, char* line) -{ - switch (opcode) - { - case F3DZEXOpcode::G_NOOP: - sprintf(line, "gsDPNoOpTag(0x%08" PRIX64 "),", data & 0xFFFFFFFF); - break; - case F3DZEXOpcode::G_DL: - Opcode_G_DL(data, prefix, line); - break; - case F3DZEXOpcode::G_MODIFYVTX: - Opcode_G_MODIFYVTX(data, line); - break; - case F3DZEXOpcode::G_CULLDL: - Opcode_G_CULLDL(data, line); - break; - case F3DZEXOpcode::G_TRI1: - Opcode_G_TRI1(data, line); - break; - case F3DZEXOpcode::G_TRI2: - Opcode_G_TRI2(data, line); - break; - case F3DZEXOpcode::G_QUAD: - { - int32_t aa = ((data & 0x00FF000000000000ULL) >> 48) / 2; - int32_t bb = ((data & 0x0000FF0000000000ULL) >> 40) / 2; - int32_t cc = ((data & 0x000000FF00000000ULL) >> 32) / 2; - int32_t dd = ((data & 0x000000000000FFULL)) / 2; - sprintf(line, "gsSP1Quadrangle(%i, %i, %i, %i, 0),", aa, bb, cc, dd); - } - break; - case F3DZEXOpcode::G_VTX: - Opcode_G_VTX(data, line); - break; - case F3DZEXOpcode::G_SETTIMG: // HOTSPOT - Opcode_G_SETTIMG(data, prefix, line); - break; - case F3DZEXOpcode::G_GEOMETRYMODE: - { - int32_t cccccc = (data & 0x00FFFFFF00000000) >> 32; - int32_t ssssssss = (data & 0xFFFFFFFF); - std::string geoModeStr = "G_TEXTURE_ENABLE"; - - int32_t geoModeParam = ~cccccc; - - if (ssssssss != 0) - geoModeParam = ssssssss; - - if (geoModeParam & 0x00000001) - geoModeStr += " | G_ZBUFFER"; - - if (geoModeParam & 0x00000004) - geoModeStr += " | G_SHADE"; - - if (geoModeParam & 0x00000200) - geoModeStr += " | G_CULL_FRONT"; - - if (geoModeParam & 0x00000400) - geoModeStr += " | G_CULL_BACK"; - - if (geoModeParam & 0x00010000) - geoModeStr += " | G_FOG"; - - if (geoModeParam & 0x00020000) - geoModeStr += " | G_LIGHTING"; - - if (geoModeParam & 0x00040000) - geoModeStr += " | G_TEXTURE_GEN"; - - if (geoModeParam & 0x00080000) - geoModeStr += " | G_TEXTURE_GEN_LINEAR"; - - if (geoModeParam & 0x00200000) - geoModeStr += " | G_SHADING_SMOOTH"; - - if (geoModeParam & 0x00800000) - geoModeStr += " | G_CLIPPING"; - - if (ssssssss != 0) - { - if ((~cccccc & 0xFF000000) != 0) - sprintf(line, "gsSPSetGeometryMode(%s),", geoModeStr.c_str()); - else - sprintf(line, "gsSPLoadGeometryMode(%s),", geoModeStr.c_str()); - } - else - sprintf(line, "gsSPClearGeometryMode(%s),", geoModeStr.c_str()); - } - break; - case F3DZEXOpcode::G_SETPRIMCOLOR: - Opcode_G_SETPRIMCOLOR(data, line); - break; - case F3DZEXOpcode::G_SETOTHERMODE_L: - Opcode_G_SETOTHERMODE_L(data, line); - break; - case F3DZEXOpcode::G_SETOTHERMODE_H: - Opcode_G_SETOTHERMODE_H(data, line); - break; - case F3DZEXOpcode::G_SETTILE: - Opcode_G_SETTILE(data, line); - break; - case F3DZEXOpcode::G_SETTILESIZE: - Opcode_G_SETTILESIZE(data, prefix, line); - break; - case F3DZEXOpcode::G_LOADBLOCK: - Opcode_G_LOADBLOCK(data, line); - break; - case F3DZEXOpcode::G_TEXTURE: - Opcode_G_TEXTURE(data, line); - break; - case F3DZEXOpcode::G_RDPSETOTHERMODE: - { - int32_t hhhhhh = (data & 0x00FFFFFF00000000) >> 32; - int32_t llllllll = (data & 0x00000000FFFFFFFF); - - sprintf(line, "gsDPSetOtherMode(%i, %i),", hhhhhh, llllllll); - } - break; - case F3DZEXOpcode::G_POPMTX: - { - sprintf(line, "gsSPPopMatrix(%" PRIi64 "),", data); - } - break; - case F3DZEXOpcode::G_LOADTLUT: - Opcode_G_LOADTLUT(data, prefix, line); - break; - case F3DZEXOpcode::G_SETENVCOLOR: - { - uint8_t r = (uint8_t)((data & 0xFF000000) >> 24); - uint8_t g = (uint8_t)((data & 0x00FF0000) >> 16); - uint8_t b = (uint8_t)((data & 0xFF00FF00) >> 8); - uint8_t a = (uint8_t)((data & 0x000000FF) >> 0); - - sprintf(line, "gsDPSetEnvColor(%i, %i, %i, %i),", r, g, b, a); - } - break; - case F3DZEXOpcode::G_SETCOMBINE: - { - Opcode_G_SETCOMBINE(data, line); - } - break; - case F3DZEXOpcode::G_RDPLOADSYNC: - sprintf(line, "gsDPLoadSync(),"); - break; - case F3DZEXOpcode::G_RDPPIPESYNC: - sprintf(line, "gsDPPipeSync(),"); - break; - case F3DZEXOpcode::G_RDPTILESYNC: - sprintf(line, "gsDPTileSync(),"); - break; - case F3DZEXOpcode::G_RDPFULLSYNC: - sprintf(line, "gsDPFullSync(),"); - break; - case F3DZEXOpcode::G_ENDDL: - Opcode_G_ENDDL(prefix, line); - break; - case F3DZEXOpcode::G_RDPHALF_1: - { - uint64_t data2 = instructions[i + 1]; - uint32_t h = (data & 0xFFFFFFFF); - F3DZEXOpcode opcode2 = (F3DZEXOpcode)(instructions[i + 1] >> 56); - - if (opcode2 == F3DZEXOpcode::G_BRANCH_Z) - { - uint32_t a = (data2 & 0x00FFF00000000000) >> 44; - uint32_t b = (data2 & 0x00000FFF00000000) >> 32; - uint32_t z = (data2 & 0x00000000FFFFFFFF) >> 0; - - // sprintf(line, "gsDPWord(%i, 0),", h); - sprintf(line, "gsSPBranchLessZraw(%sDlist0x%06X, 0x%02X, 0x%02X),", prefix.c_str(), - h & 0x00FFFFFF, (a / 5) | (b / 2), z); - - ZDisplayList* nList = new ZDisplayList(parent); - nList->ExtractFromBinary( - h & 0x00FFFFFF, GetDListLength(parent->GetRawData(), h & 0x00FFFFFF, dListType)); - nList->SetName(nList->GetDefaultName(prefix)); - otherDLists.push_back(nList); - - i++; - } - } - break; - case F3DZEXOpcode::G_MTX: - Opcode_G_MTX(data, line); - break; - default: - sprintf(line, "// Opcode 0x%02X unimplemented!", (uint32_t)opcode); - break; - } -} - -void ZDisplayList::ParseF3DEX(F3DEXOpcode opcode, uint64_t data, const std::string& prefix, - char* line) -{ - switch (opcode) - { - case F3DEXOpcode::G_NOOP: - sprintf(line, "gsDPNoOpTag(0x%08" PRIX64 "),", data & 0xFFFFFFFF); - break; - case F3DEXOpcode::G_VTX: - Opcode_G_VTX(data, line); - break; - case F3DEXOpcode::G_DL: - Opcode_G_DL(data, prefix, line); - break; - case F3DEXOpcode::G_CULLDL: - Opcode_G_CULLDL(data, line); - break; - case F3DEXOpcode::G_MODIFYVTX: - Opcode_G_MODIFYVTX(data, line); - break; - case F3DEXOpcode::G_MTX: - Opcode_G_MTX(data, line); - break; - case F3DEXOpcode::G_TRI1: - Opcode_G_TRI1(data, line); - break; - case F3DEXOpcode::G_TRI2: - Opcode_G_TRI2(data, line); - break; - case F3DEXOpcode::G_ENDDL: - Opcode_G_ENDDL(prefix, line); - break; - case F3DEXOpcode::G_RDPLOADSYNC: - sprintf(line, "gsDPLoadSync(),"); - break; - case F3DEXOpcode::G_RDPPIPESYNC: - sprintf(line, "gsDPPipeSync(),"); - break; - case F3DEXOpcode::G_RDPTILESYNC: - sprintf(line, "gsDPTileSync(),"); - break; - case F3DEXOpcode::G_RDPFULLSYNC: - sprintf(line, "gsDPFullSync(),"); - break; - case F3DEXOpcode::G_TEXTURE: - Opcode_G_TEXTURE(data, line); - break; - case F3DEXOpcode::G_SETTIMG: - Opcode_G_SETTIMG(data, prefix, line); - break; - case F3DEXOpcode::G_SETTILE: - Opcode_G_SETTILE(data, line); - break; - case F3DEXOpcode::G_SETTILESIZE: - Opcode_G_SETTILESIZE(data, prefix, line); - break; - case F3DEXOpcode::G_LOADBLOCK: - Opcode_G_LOADBLOCK(data, line); - break; - case F3DEXOpcode::G_SETCOMBINE: - Opcode_G_SETCOMBINE(data, line); - break; - case F3DEXOpcode::G_SETPRIMCOLOR: - Opcode_G_SETPRIMCOLOR(data, line); - break; - case F3DEXOpcode::G_SETOTHERMODE_L: - Opcode_G_SETOTHERMODE_L(data, line); - break; - case F3DEXOpcode::G_SETOTHERMODE_H: - Opcode_G_SETOTHERMODE_H(data, line); - break; - case F3DEXOpcode::G_LOADTLUT: - Opcode_G_LOADTLUT(data, prefix, line); - break; - case F3DEXOpcode::G_CLEARGEOMETRYMODE: - case F3DEXOpcode::G_SETGEOMETRYMODE: - { - int32_t cccccc = (data & 0x00FFFFFF00000000) >> 32; - int32_t ssssssss = (data & 0xFFFFFFFF); - std::string geoModeStr = "G_TEXTURE_ENABLE"; - - int32_t geoModeParam = ~cccccc; - - if (ssssssss != 0) - geoModeParam = ssssssss; - - if (geoModeParam & 0x00000002) - geoModeStr += " | G_TEXTURE_ENABLE"; - - if (geoModeParam & 0x00000200) - geoModeStr += " | G_SHADING_SMOOTH"; - - if (geoModeParam & 0x00001000) - geoModeStr += " | G_CULL_FRONT"; - - if (geoModeParam & 0x00002000) - geoModeStr += " | G_CULL_BACK"; - - if (geoModeParam & 0x00000001) - geoModeStr += " | G_ZBUFFER"; - - if (geoModeParam & 0x00000004) - geoModeStr += " | G_SHADE"; - - if (geoModeParam & 0x00010000) - geoModeStr += " | G_FOG"; - - if (geoModeParam & 0x00020000) - geoModeStr += " | G_LIGHTING"; - - if (geoModeParam & 0x00040000) - geoModeStr += " | G_TEXTURE_GEN"; - - if (geoModeParam & 0x00080000) - geoModeStr += " | G_TEXTURE_GEN_LINEAR"; - - if (geoModeParam & 0x00800000) - geoModeStr += " | G_CLIPPING"; - - if (opcode == F3DEXOpcode::G_SETGEOMETRYMODE) - sprintf(line, "gsSPSetGeometryMode(%s),", geoModeStr.c_str()); - else - sprintf(line, "gsSPClearGeometryMode(%s),", geoModeStr.c_str()); - } - break; - default: - sprintf(line, "// Opcode 0x%02X unimplemented!", (uint32_t)opcode); - break; - } -} - -int32_t ZDisplayList::GetDListLength(const std::vector& rawData, uint32_t rawDataIndex, - DListType dListType) -{ - uint8_t endDLOpcode; - uint8_t branchListOpcode; - - if (dListType == DListType::F3DZEX) - { - endDLOpcode = static_cast(F3DZEXOpcode::G_ENDDL); - branchListOpcode = static_cast(F3DZEXOpcode::G_DL); - } - else - { - endDLOpcode = static_cast(F3DEXOpcode::G_ENDDL); - branchListOpcode = static_cast(F3DEXOpcode::G_DL); - } - - uint32_t ptr = rawDataIndex; - size_t rawDataSize = rawData.size(); - while (true) - { - if (ptr >= rawDataSize) - { - std::string errorHeader = - StringHelper::Sprintf("reached end of file when trying to find the end of the " - "DisplayList starting at offset 0x%X", - rawDataIndex); - std::string errorBody = StringHelper::Sprintf("Raw data size: 0x%zX.", rawDataSize); - HANDLE_ERROR_PROCESS(WarningType::Always, errorHeader, errorBody); - } - - uint8_t opcode = rawData.at(ptr); - bool dlNoPush = rawData.at(ptr + 1) == 1; - ptr += 8; - - if (opcode == endDLOpcode || (opcode == branchListOpcode && dlNoPush)) - { - return ptr - rawDataIndex; - } - } -} - -bool ZDisplayList::SequenceCheck(std::vector sequence, int32_t startIndex) -{ - bool success = true; - - for (size_t j = 0; j < sequence.size(); j++) - { - F3DZEXOpcode opcode = (F3DZEXOpcode)(instructions[startIndex + j] >> 56); - - if (sequence[j] != opcode) - { - success = false; - break; - } - } - - if (success) - return true; - - return false; -} - -int32_t ZDisplayList::OptimizationChecks(int32_t startIndex, std::string& output, - const std::string& prefix) -{ - int32_t result = -1; - - result = OptimizationCheck_LoadTextureBlock(startIndex, output, prefix); - - if (result != -1) - return result; - - return -1; -} - -int32_t ZDisplayList::OptimizationCheck_LoadTextureBlock(int32_t startIndex, std::string& output, - [[maybe_unused]] const std::string& prefix) -{ - std::vector sequence = {F3DZEXOpcode::G_SETTIMG, F3DZEXOpcode::G_SETTILE, - F3DZEXOpcode::G_RDPLOADSYNC, F3DZEXOpcode::G_LOADBLOCK, - F3DZEXOpcode::G_RDPPIPESYNC, F3DZEXOpcode::G_SETTILE, - F3DZEXOpcode::G_SETTILESIZE}; - - bool seqRes = SequenceCheck(sequence, startIndex); - - if (seqRes) - { - // gsDPLoadTextureBlock(texAddr, fmt, siz, width, height, pal, cms, cmt, masks, maskt, - // shifts, shiftt) gsDPLoadMultiBlock(texAddr, tmem, rtile, fmt, siz, width, height, pal, - // cms, cmt, masks, maskt, shifts, shiftt) gsDPLoadTextureBlock_4b(texAddr, fmt, width, - // height, pal, cms, cmt, masks, maskt, shifts, shiftt) gsDPLoadMultiBlock_4b(texAddr, tmem, - // rtile, fmt, width, height, pal, cms, cmt, masks, maskt, shifts, shiftt) - - uint32_t texAddr, tmem, rtile, fmt, siz, sizB, width, height, width2, height2, pal, cms, - cmt, masks, maskt, shifts, shiftt; - std::string texStr; - - // gsDPSetTextureImage - { - uint64_t data = instructions[startIndex + 0]; - - int32_t __ = (data & 0x00FF000000000000) >> 48; - // int32_t www = (data & 0x00000FFF00000000) >> 32; - - fmt = (__ & 0xE0) >> 5; - siz = (__ & 0x18) >> 3; - texAddr = Seg2Filespace(data, parent->baseAddress); - uint32_t segmentNumber = GETSEGNUM(data); - - lastTexSeg = segmentNumber; - - Globals::Instance->GetSegmentedPtrName(data & 0xFFFFFFFF, parent, "", texStr); - } - - // gsDPSetTile - { - uint64_t data = instructions[startIndex + 1]; - - tmem = - (data & 0b0000000000000000111111111111111100000000000000000000000000000000) >> 32; - - cmt = (data & 0b0000000000000000000000000000000000000000000011000000000000000000) >> 18; - maskt = - (data & 0b0000000000000000000000000000000000000000000000111100000000000000) >> 14; - shiftt = - (data & 0b0000000000000000000000000000000000000000000000000011110000000000) >> 10; - cms = (data & 0b0000000000000000000000000000000000000000000000000000001100000000) >> 8; - masks = - (data & 0b0000000000000000000000000000000000000000000000000000000011110000) >> 4; - shifts = (data & 0b0000000000000000000000000000000000000000000000000000000000001111); - - // sprintf(line, "gsDPSetTile(%s, %s, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i),", - // fmtTbl[fff].c_str(), sizTbl[ii].c_str(), nnnnnnnnn, mmmmmmmmm, ttt, pppp, cc, aaaa, - // ssss, dd, bbbb, uuuu); - } - - // gsDPLoadSync - - // gsDPLoadBlock - - // gsDPPipeSync - - // gsDPSetTile - { - uint64_t data = instructions[startIndex + 5]; - int32_t __ = (data & 0x00FF000000000000) >> 48; - pal = (data & 0b0000000000000000000000000000000000000000111100000000000000000000) >> 20; - // siz = (__ & 0x18) >> 3; - rtile = - (data & 0b0000000000000000000000000000000011111111000000000000000000000000) >> 24; - sizB = (__ & 0x18) >> 3; - } - - // gsDPSetTileSize - { - uint64_t data = instructions[startIndex + 6]; - int32_t uuu = (data & 0x0000000000FFF000) >> 12; - int32_t vvv = (data & 0x0000000000000FFF); - - int32_t shiftAmtW = 2; - int32_t shiftAmtH = 2; - - if (sizB == (int32_t)F3DZEXTexSizes::G_IM_SIZ_8b && - fmt == (int32_t)F3DZEXTexFormats::G_IM_FMT_IA) - shiftAmtW = 3; - - if (sizB == (int32_t)F3DZEXTexSizes::G_IM_SIZ_4b) - shiftAmtW = 3; - - if (sizB == (int32_t)F3DZEXTexSizes::G_IM_SIZ_4b && - fmt == (int32_t)F3DZEXTexFormats::G_IM_FMT_IA) - shiftAmtH = 3; - - width = (uuu >> shiftAmtW) + 1; - height = (vvv >> shiftAmtH) + 1; - - width2 = (uuu >> 2) + 1; - height2 = (vvv >> 2) + 1; - } - - const char* fmtTbl[] = {"G_IM_FMT_RGBA", "G_IM_FMT_YUV", "G_IM_FMT_CI", "G_IM_FMT_IA", - "G_IM_FMT_I"}; - const char* sizTbl[] = {"G_IM_SIZ_4b", "G_IM_SIZ_8b", "G_IM_SIZ_16b", "G_IM_SIZ_32b"}; - - // output += StringHelper::Sprintf("gsDPLoadTextureBlock(%s, %s, %s, %i, %i, %i, %i, %i, %i, - // %i, %i, %i),", texStr.c_str(), fmtTbl[fmt], sizTbl[siz].c_str(), width, height, - // pal, cms, cmt, masks, maskt, shifts, shiftt); - - if (siz == 2 && sizB == 0) - { - if (tmem != 0) - output += StringHelper::Sprintf( - "gsDPLoadMultiBlock_4b(%s, %i, %i, %s, %i, %i, %i, %i, %i, %i, %i, %i, %i),", - texStr.c_str(), tmem, rtile, fmtTbl[fmt], width2, height2, pal, cms, cmt, masks, - maskt, shifts, shiftt); - else - output += StringHelper::Sprintf( - "gsDPLoadTextureBlock_4b(%s, %s, %i, %i, %i, %i, %i, %i, %i, %i, %i),", - texStr.c_str(), fmtTbl[fmt], width2, height2, pal, cms, cmt, masks, maskt, - shifts, shiftt); - } - else if (siz == 2 && sizB != 0) - { - if (tmem != 0) - output += StringHelper::Sprintf( - "gsDPLoadMultiBlock(%s, %i, %i, %s, %s, %i, %i, %i, %i, %i, %i, %i, %i, %i),", - texStr.c_str(), tmem, rtile, fmtTbl[fmt], sizTbl[sizB], width2, height2, pal, - cms, cmt, masks, maskt, shifts, shiftt); - else - output += StringHelper::Sprintf( - "gsDPLoadTextureBlock(%s, %s, %s, %i, %i, %i, %i, %i, %i, %i, %i, %i),", - texStr.c_str(), fmtTbl[fmt], sizTbl[sizB], width2, height2, pal, cms, cmt, - masks, maskt, shifts, shiftt); - } - else - { - if (siz != sizB) - { - lastTexAddr = texAddr; - lastTexFmt = (F3DZEXTexFormats)fmt; - lastTexWidth = width; - lastTexHeight = height; - lastTexSiz = (F3DZEXTexSizes)siz; - lastTexLoaded = true; - - TextureGenCheck(); - - return -1; - } - - output += StringHelper::Sprintf( - "gsDPLoadMultiBlock(%s, %i, %i, %s, %s, %i, %i, %i, %i, %i, %i, %i, %i, %i),", - texStr.c_str(), tmem, rtile, fmtTbl[fmt], sizTbl[siz], width, height, pal, cms, cmt, - masks, maskt, shifts, shiftt); - } - - lastTexAddr = texAddr; - lastTexFmt = (F3DZEXTexFormats)fmt; - lastTexWidth = width; - lastTexHeight = height; - lastTexSiz = (F3DZEXTexSizes)siz; - lastTexLoaded = true; - - TextureGenCheck(); - - return (int32_t)sequence.size(); - } - - return -1; -} - -void ZDisplayList::Opcode_G_DL(uint64_t data, const std::string& prefix, char* line) -{ - int32_t pp = (data & 0x00FF000000000000) >> 56; - int32_t segNum = GETSEGNUM(data); - - Declaration* dListDecl = nullptr; - - if (parent != nullptr) - dListDecl = parent->GetDeclaration(GETSEGOFFSET(data)); - - if (pp != 0) - { - if (!Globals::Instance->HasSegment(segNum)) - sprintf(line, "gsSPBranchList(0x%08" PRIX64 "),", data & 0xFFFFFFFF); - else if (dListDecl != nullptr) - sprintf(line, "gsSPBranchList(%s),", dListDecl->declName.c_str()); - else - sprintf(line, "gsSPBranchList(%sDlist0x%06" PRIX64 "),", prefix.c_str(), - GETSEGOFFSET(data)); - } - else - { - if (!Globals::Instance->HasSegment(segNum)) - sprintf(line, "gsSPDisplayList(0x%08" PRIX64 "),", data & 0xFFFFFFFF); - else if (dListDecl != nullptr) - sprintf(line, "gsSPDisplayList(%s),", dListDecl->declName.c_str()); - else - sprintf(line, "gsSPDisplayList(%sDlist0x%06" PRIX64 "),", prefix.c_str(), - GETSEGOFFSET(data)); - } - - // if (segNum == 8 || segNum == 9 || segNum == 10 || segNum == 11 || segNum == 12 || segNum == - // 13) // Used for runtime-generated display lists - if (!Globals::Instance->HasSegment(segNum)) - { - if (pp != 0) - sprintf(line, "gsSPBranchList(0x%08" PRIX64 "),", data & 0xFFFFFFFF); - else - sprintf(line, "gsSPDisplayList(0x%08" PRIX64 "),", data & 0xFFFFFFFF); - } - else - { - ZDisplayList* nList = new ZDisplayList(parent); - nList->ExtractFromBinary(GETSEGOFFSET(data), GetDListLength(parent->GetRawData(), - GETSEGOFFSET(data), dListType)); - nList->SetName(nList->GetDefaultName(prefix)); - - otherDLists.push_back(nList); - } -} - -void ZDisplayList::Opcode_G_MODIFYVTX(uint64_t data, char* line) -{ - int32_t ww = (data & 0x00FF000000000000ULL) >> 48; - int32_t nnnn = (data & 0x0000FFFF00000000ULL) >> 32; - int32_t vvvvvvvv = (data & 0x00000000FFFFFFFFULL); - - sprintf(line, "gsSPModifyVertex(%i, %i, %i),", nnnn / 2, ww, vvvvvvvv); -} - -void ZDisplayList::Opcode_G_CULLDL(uint64_t data, char* line) -{ - int32_t vvvv = (data & 0xFFFF00000000) >> 32; - int32_t wwww = (data & 0x0000FFFF); - - sprintf(line, "gsSPCullDisplayList(%i, %i),", vvvv / 2, wwww / 2); -} - -void ZDisplayList::Opcode_G_TRI1(uint64_t data, char* line) -{ - if (dListType == DListType::F3DZEX) - { - int32_t aa = ((data & 0x00FF000000000000ULL) >> 48) / 2; - int32_t bb = ((data & 0x0000FF0000000000ULL) >> 40) / 2; - int32_t cc = ((data & 0x000000FF00000000ULL) >> 32) / 2; - sprintf(line, "gsSP1Triangle(%i, %i, %i, 0),", aa, bb, cc); - } - else - { - int32_t aa = ((data & 0x0000000000FF0000ULL) >> 16) / 2; - int32_t bb = ((data & 0x000000000000FF00ULL) >> 8) / 2; - int32_t cc = ((data & 0x00000000000000FFULL) >> 0) / 2; - sprintf(line, "gsSP1Triangle(%i, %i, %i, 0),", aa, bb, cc); - } -} - -void ZDisplayList::Opcode_G_TRI2(uint64_t data, char* line) -{ - int32_t aa = ((data & 0x00FF000000000000ULL) >> 48) / 2; - int32_t bb = ((data & 0x0000FF0000000000ULL) >> 40) / 2; - int32_t cc = ((data & 0x000000FF00000000ULL) >> 32) / 2; - int32_t dd = ((data & 0x00000000FF0000ULL) >> 16) / 2; - int32_t ee = ((data & 0x0000000000FF00ULL) >> 8) / 2; - int32_t ff = ((data & 0x000000000000FFULL) >> 0) / 2; - sprintf(line, "gsSP2Triangles(%i, %i, %i, 0, %i, %i, %i, 0),", aa, bb, cc, dd, ee, ff); -} - -void ZDisplayList::Opcode_G_MTX(uint64_t data, char* line) -{ - uint32_t pp = 0; - uint32_t mm = (data & 0x00000000FFFFFFFF); - bool push = false; - bool load = false; - bool projection = false; - - if (dListType == DListType::F3DEX) - pp = (data & 0x00FF000000000000) >> 48; - else - pp = (data & 0x000000FF00000000) >> 32; - - std::string matrixRef; - - if (Globals::Instance->cfg.symbolMap.find(mm) != Globals::Instance->cfg.symbolMap.end()) - matrixRef = StringHelper::Sprintf("&%s", Globals::Instance->cfg.symbolMap[mm].c_str()); - else - matrixRef = StringHelper::Sprintf("0x%08X", mm); - - pp ^= 0x01; - - if (pp & 0x01) - push = true; - - if (pp & 0x02) - load = true; - - if (pp & 0x04) - projection = true; - - sprintf(line, "gsSPMatrix(%s, %s | %s | %s),", matrixRef.c_str(), - projection ? "G_MTX_PROJECTION" : "G_MTX_MODELVIEW", - push ? "G_MTX_PUSH" : "G_MTX_NOPUSH", load ? "G_MTX_LOAD" : "G_MTX_MUL"); -} - -void ZDisplayList::Opcode_G_VTX(uint64_t data, char* line) -{ - int32_t nn = (data & 0x000FF00000000000ULL) >> 44; - int32_t aa = (data & 0x000000FF00000000ULL) >> 32; - - uint32_t vtxAddr = Seg2Filespace(data, parent->baseAddress); - - if (dListType == DListType::F3DZEX) - sprintf(line, "gsSPVertex(@r, %i, %i),", nn, ((aa >> 1) - nn)); - else - { - uint32_t hi = data >> 32; - -#define _SHIFTR(v, s, w) (((uint32_t)v >> s) & ((0x01 << w) - 1)) - - nn = _SHIFTR(hi, 10, 6); - - sprintf(line, "gsSPVertex(@r, %i, %i),", nn, _SHIFTR(hi, 17, 7)); - } - - // Hack: Don't extract vertices from a unknown segment. - if (!Globals::Instance->HasSegment(GETSEGNUM(data))) - { - segptr_t segmented = data & 0xFFFFFFFF; - references.push_back(segmented); - parent->AddDeclaration(segmented, DeclarationAlignment::Align8, 16, "Vtx", - StringHelper::Sprintf("0x%08X", segmented), ""); - return; - } - references.push_back(data); - - { - uint32_t currentPtr = Seg2Filespace(data, parent->baseAddress); - Declaration* decl; - - // Check for vertex intersections from other display lists - // TODO: These two could probably be condenced to one... - decl = parent->GetDeclarationRanged(vtxAddr + (nn * 16)); - if (decl != nullptr) - { - int32_t diff = decl->address - vtxAddr; - if (diff > 0) - nn = diff / 16; - else - nn = 0; - } - - decl = parent->GetDeclarationRanged(vtxAddr); - if (decl != nullptr) - { - int32_t diff = decl->address - vtxAddr; - if (diff > 0) - nn = diff / 16; - else - nn = 0; - } - - if (nn > 0) - { - std::vector vtxList; - vtxList.reserve(nn); - - for (int32_t i = 0; i < nn; i++) - { - ZVtx vtx(parent); - vtx.ExtractFromFile(currentPtr); - vtxList.push_back(vtx); - - currentPtr += 16; - } - - vertices[vtxAddr] = vtxList; - } - } -} - -void ZDisplayList::Opcode_G_TEXTURE(uint64_t data, char* line) -{ - int32_t ____ = (data & 0x0000FFFF00000000) >> 32; - int32_t ssss = (data & 0x00000000FFFF0000) >> 16; - int32_t tttt = (data & 0x000000000000FFFF); - int32_t lll = (____ & 0x3800) >> 11; - int32_t ddd = (____ & 0x700) >> 8; - int32_t nnnnnnn = 0; - - if (dListType == DListType::F3DEX) - nnnnnnn = (____ & 0xFF); - else - nnnnnnn = (____ & 0xFE) >> 1; - - sprintf(line, "gsSPTexture(%i, %i, %i, %i, %s),", ssss, tttt, lll, ddd, - nnnnnnn == 1 ? "G_ON" : "G_OFF"); -} - -void ZDisplayList::Opcode_G_SETTIMG(uint64_t data, const std::string& prefix, char* line) -{ - int32_t __ = (data & 0x00FF000000000000) >> 48; - int32_t www = (data & 0x00000FFF00000000) >> 32; - const char* fmtTbl[] = {"G_IM_FMT_RGBA", "G_IM_FMT_YUV", "G_IM_FMT_CI", "G_IM_FMT_IA", - "G_IM_FMT_I"}; - const char* sizTbl[] = {"G_IM_SIZ_4b", "G_IM_SIZ_8b", "G_IM_SIZ_16b", "G_IM_SIZ_32b"}; - - uint32_t fmt = (__ & 0xE0) >> 5; - uint32_t siz = (__ & 0x18) >> 3; - - if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_DEBUG) - printf("TextureGenCheck G_SETTIMG\n"); - - TextureGenCheck(); // HOTSPOT - - lastTexFmt = (F3DZEXTexFormats)fmt; - lastTexSiz = (F3DZEXTexSizes)siz; - lastTexSeg = data; - lastTexAddr = Seg2Filespace(data, parent->baseAddress); - - int32_t segmentNumber = GETSEGNUM(data); - - if (segmentNumber != 2) - { - char texStr[2048]; - int32_t texAddress = Seg2Filespace(data, parent->baseAddress); - Declaration* texDecl = nullptr; - - if (parent != nullptr) - { - if (Globals::Instance->HasSegment(segmentNumber)) - texDecl = parent->GetDeclaration(texAddress); - else - texDecl = parent->GetDeclaration(data); - } - - if (texDecl != nullptr) - sprintf(texStr, "%s", texDecl->declName.c_str()); - else if (data != 0 && Globals::Instance->HasSegment(segmentNumber)) - sprintf(texStr, "%sTex_%06X", prefix.c_str(), texAddress); - else - { - sprintf(texStr, "0x%08" PRIX64, data & 0xFFFFFFFF); - } - - sprintf(line, "gsDPSetTextureImage(%s, %s, %i, %s),", fmtTbl[fmt], sizTbl[siz], www + 1, - texStr); - } - else - { - std::string texName; - Globals::Instance->GetSegmentedPtrName(data, parent, "", texName); - sprintf(line, "gsDPSetTextureImage(%s, %s, %i, %s),", fmtTbl[fmt], sizTbl[siz], www + 1, - texName.c_str()); - } -} - -void ZDisplayList::Opcode_G_SETTILE(uint64_t data, char* line) -{ - int32_t fff = (data & 0b0000000011100000000000000000000000000000000000000000000000000000) >> 53; - int32_t ii = (data & 0b0000000000011000000000000000000000000000000000000000000000000000) >> 51; - int32_t nnnnnnnnn = - (data & 0b0000000000000011111111100000000000000000000000000000000000000000) >> 41; - int32_t mmmmmmmmm = - (data & 0b0000000000000000000000011111111100000000000000000000000000000000) >> 32; - int32_t ttt = (data & 0b0000000000000000000000000000000000000111000000000000000000000000) >> 24; - int32_t pppp = - (data & 0b0000000000000000000000000000000000000000111100000000000000000000) >> 20; - int32_t cc = (data & 0b0000000000000000000000000000000000000000000011000000000000000000) >> 18; - int32_t aaaa = - (data & 0b0000000000000000000000000000000000000000000000111100000000000000) >> 14; - int32_t ssss = - (data & 0b0000000000000000000000000000000000000000000000000011110000000000) >> 10; - int32_t dd = (data & 0b0000000000000000000000000000000000000000000000000000001100000000) >> 8; - int32_t bbbb = (data & 0b0000000000000000000000000000000000000000000000000000000011110000) >> 4; - int32_t uuuu = (data & 0b0000000000000000000000000000000000000000000000000000000000001111); - - const char* fmtTbl[] = {"G_IM_FMT_RGBA", "G_IM_FMT_YUV", "G_IM_FMT_CI", "G_IM_FMT_IA", - "G_IM_FMT_I"}; - const char* sizTbl[] = {"G_IM_SIZ_4b", "G_IM_SIZ_8b", "G_IM_SIZ_16b", "G_IM_SIZ_32b"}; - - if (fff == (int32_t)F3DZEXTexFormats::G_IM_FMT_CI) - lastCISiz = (F3DZEXTexSizes)ii; - - lastTexSizTest = (F3DZEXTexSizes)ii; - - sprintf(line, "gsDPSetTile(%s, %s, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i),", fmtTbl[fff], - sizTbl[ii], nnnnnnnnn, mmmmmmmmm, ttt, pppp, cc, aaaa, ssss, dd, bbbb, uuuu); -} - -void ZDisplayList::Opcode_G_SETTILESIZE(uint64_t data, [[maybe_unused]] const std::string& prefix, - char* line) -{ - int32_t sss = (data & 0x00FFF00000000000) >> 44; - int32_t ttt = (data & 0x00000FFF00000000) >> 32; - int32_t uuu = (data & 0x0000000000FFF000) >> 12; - int32_t vvv = (data & 0x0000000000000FFF); - int32_t i = (data & 0x000000000F000000) >> 24; - - int32_t shiftAmtW = 2; - int32_t shiftAmtH = 2; - - if (lastTexSizTest == F3DZEXTexSizes::G_IM_SIZ_8b && - lastTexFmt == F3DZEXTexFormats::G_IM_FMT_IA) - shiftAmtW = 3; - - // if (lastTexFmt == F3DZEXTexFormats::G_IM_FMT_I || lastTexFmt == - // F3DZEXTexFormats::G_IM_FMT_CI) - if (lastTexSizTest == F3DZEXTexSizes::G_IM_SIZ_4b) - shiftAmtW = 3; - - if (lastTexSizTest == F3DZEXTexSizes::G_IM_SIZ_4b && - lastTexFmt == F3DZEXTexFormats::G_IM_FMT_IA) - shiftAmtH = 3; - - lastTexWidth = (uuu >> shiftAmtW) + 1; - lastTexHeight = (vvv >> shiftAmtH) + 1; - - if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_DEBUG) - printf("lastTexWidth: %i lastTexHeight: %i, lastTexSizTest: 0x%x, lastTexFmt: 0x%x\n", - lastTexWidth, lastTexHeight, (uint32_t)lastTexSizTest, (uint32_t)lastTexFmt); - - if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_DEBUG) - printf("TextureGenCheck G_SETTILESIZE\n"); - - TextureGenCheck(); - - sprintf(line, "gsDPSetTileSize(%i, %i, %i, %i, %i),", i, sss, ttt, uuu, vvv); -} - -void ZDisplayList::Opcode_G_LOADBLOCK(uint64_t data, char* line) -{ - int32_t sss = (data & 0x00FFF00000000000) >> 48; - int32_t ttt = (data & 0x00000FFF00000000) >> 36; - int32_t i = (data & 0x000000000F000000) >> 24; - int32_t xxx = (data & 0x0000000000FFF000) >> 12; - int32_t ddd = (data & 0x0000000000000FFF); - - lastTexLoaded = true; - - sprintf(line, "gsDPLoadBlock(%i, %i, %i, %i, %i),", i, sss, ttt, xxx, ddd); -} - -void ZDisplayList::Opcode_G_SETCOMBINE(uint64_t data, char* line) -{ - int32_t a0 = (data & 0b000000011110000000000000000000000000000000000000000000000000000) >> 52; - int32_t c0 = (data & 0b000000000001111100000000000000000000000000000000000000000000000) >> 47; - int32_t aa0 = (data & 0b00000000000000011100000000000000000000000000000000000000000000) >> 44; - int32_t ac0 = (data & 0b00000000000000000011100000000000000000000000000000000000000000) >> 41; - int32_t a1 = (data & 0b000000000000000000000011110000000000000000000000000000000000000) >> 37; - int32_t c1 = (data & 0b000000000000000000000000001111100000000000000000000000000000000) >> 32; - int32_t b0 = (data & 0b000000000000000000000000000000011110000000000000000000000000000) >> 28; - int32_t b1 = (data & 0b000000000000000000000000000000000001111000000000000000000000000) >> 24; - int32_t aa1 = (data & 0b00000000000000000000000000000000000000111000000000000000000000) >> 21; - int32_t ac1 = (data & 0b00000000000000000000000000000000000000000111000000000000000000) >> 18; - int32_t d0 = (data & 0b000000000000000000000000000000000000000000000111000000000000000) >> 15; - int32_t ab0 = (data & 0b00000000000000000000000000000000000000000000000111000000000000) >> 12; - int32_t ad0 = (data & 0b00000000000000000000000000000000000000000000000000111000000000) >> 9; - int32_t d1 = (data & 0b000000000000000000000000000000000000000000000000000000111000000) >> 6; - int32_t ab1 = (data & 0b00000000000000000000000000000000000000000000000000000000111000) >> 3; - int32_t ad1 = (data & 0b00000000000000000000000000000000000000000000000000000000000111) >> 0; - - const char* modesA[] = {"COMBINED", "TEXEL0", "TEXEL1", "PRIMITIVE", "SHADE", "ENVIRONMENT", - "1", "NOISE", "0", "9", "10", "11", - "12", "13", "14", "0"}; - const char* modesB[] = {"COMBINED", "TEXEL0", "TEXEL1", "PRIMITIVE", "SHADE", "ENVIRONMENT", - "CENTER", "K4", "8", "9", "10", "11", - "12", "13", "14", "0"}; - const char* modesC[] = {"COMBINED", - "TEXEL0", - "TEXEL1", - "PRIMITIVE", - "SHADE", - "ENVIRONMENT", - "1", - "COMBINED_ALPHA", - "TEXEL0_ALPHA", - "TEXEL1_ALPHA", - "PRIMITIVE_ALPHA", - "SHADE_ALPHA", - "ENV_ALPHA", - "LOD_FRACTION", - "PRIM_LOD_FRAC", - "K5", - "16", - "17", - "18", - "19", - "20", - "21", - "22", - "23", - "24", - "25", - "26", - "27", - "28", - "29", - "30", - "0"}; - const char* modesD[] = {"COMBINED", "TEXEL0", "TEXEL1", "PRIMITIVE", - "SHADE", "ENVIRONMENT", "1", "0"}; - - const char* modes2[] = {"COMBINED", "TEXEL0", "TEXEL1", "PRIMITIVE", - "SHADE", "ENVIRONMENT", "1", "0"}; - const char* modes2C[] = {"LOD_FRACTION", "TEXEL0", "TEXEL1", "PRIMITIVE", - "SHADE", "ENVIRONMENT", "PRIM_LOD_FRAC", "0"}; - - sprintf(line, - "gsDPSetCombineLERP(%s, %s, %s, %s, %s, %s, %s, %s,\n %s, %s, " - "%s, %s, %s, %s, %s, %s),", - modesA[a0], modesB[b0], modesC[c0], modesD[d0], modes2[aa0], modes2[ab0], modes2C[ac0], - modes2[ad0], modesA[a1], modesB[b1], modesC[c1], modesD[d1], modes2[aa1], modes2[ab1], - modes2C[ac1], modes2[ad1]); -} - -void ZDisplayList::Opcode_G_SETPRIMCOLOR(uint64_t data, char* line) -{ - int32_t mm = (data & 0x0000FF0000000000) >> 40; - int32_t ff = (data & 0x000000FF00000000) >> 32; - int32_t rr = (data & 0x00000000FF000000) >> 24; - int32_t gg = (data & 0x0000000000FF0000) >> 16; - int32_t bb = (data & 0x000000000000FF00) >> 8; - int32_t aa = (data & 0x00000000000000FF) >> 0; - sprintf(line, "gsDPSetPrimColor(%i, %i, %i, %i, %i, %i),", mm, ff, rr, gg, bb, aa); -} - -void ZDisplayList::Opcode_F3DEX_G_SETOTHERMODE_L(uint64_t data, char* line) -{ - int32_t sft = (data & 0x0000FF0000000000) >> 40; - int32_t len = (data & 0x000000FF00000000) >> 32; - int32_t dat = (data & 0xFFFFFFFF); - - // TODO: Output the correct render modes in data - - sprintf(line, "gsSPSetOtherMode(0xE2, %i, %i, 0x%08X),", sft, len, dat); -} - -void ZDisplayList::Opcode_G_SETOTHERMODE_L(uint64_t data, char* line) -{ - int32_t dd = (data & 0xFFFFFFFF); - int32_t sft = 0; - int32_t len = 0; - - if (dListType == DListType::F3DEX) - { - sft = (data & 0x0000FF0000000000) >> 40; - len = (data & 0x000000FF00000000) >> 32; - } - else - { - int32_t ss = (data & 0x0000FF0000000000) >> 40; - len = ((data & 0x000000FF00000000) >> 32) + 1; - sft = 32 - (len)-ss; - } - - if (sft == G_MDSFT_RENDERMODE) - { - uint32_t mode1 = (dd & 0xCCCC0000) >> 0; - uint32_t mode2 = (dd & 0x3333FFFF); - - // TODO: Jesus Christ This is Messy - - uint32_t tblA[] = {G_RM_FOG_SHADE_A, - G_RM_FOG_PRIM_A, - G_RM_PASS, - G_RM_AA_ZB_OPA_SURF, - G_RM_AA_ZB_XLU_SURF, - G_RM_AA_ZB_OPA_DECAL, - G_RM_AA_ZB_XLU_DECAL, - G_RM_AA_ZB_OPA_INTER, - G_RM_AA_ZB_XLU_INTER, - G_RM_AA_ZB_XLU_LINE, - G_RM_AA_ZB_DEC_LINE, - G_RM_AA_ZB_TEX_EDGE, - G_RM_AA_ZB_TEX_INTER, - G_RM_AA_ZB_SUB_SURF, - G_RM_AA_ZB_PCL_SURF, - G_RM_AA_ZB_OPA_TERR, - G_RM_AA_ZB_TEX_TERR, - G_RM_AA_ZB_SUB_TERR, - G_RM_RA_ZB_OPA_SURF, - G_RM_RA_ZB_OPA_DECAL, - G_RM_RA_ZB_OPA_INTER, - G_RM_AA_OPA_SURF, - G_RM_AA_XLU_SURF, - G_RM_AA_XLU_LINE, - G_RM_AA_DEC_LINE, - G_RM_AA_TEX_EDGE, - G_RM_AA_SUB_SURF, - G_RM_AA_PCL_SURF, - G_RM_AA_OPA_TERR, - G_RM_AA_TEX_TERR, - G_RM_AA_SUB_TERR, - G_RM_RA_OPA_SURF, - G_RM_ZB_OPA_SURF, - G_RM_ZB_XLU_SURF, - G_RM_ZB_OPA_DECAL, - G_RM_ZB_XLU_DECAL, - G_RM_ZB_CLD_SURF, - G_RM_ZB_OVL_SURF, - G_RM_ZB_PCL_SURF, - G_RM_OPA_SURF, - G_RM_XLU_SURF, - G_RM_CLD_SURF, - G_RM_TEX_EDGE, - G_RM_PCL_SURF, - G_RM_ADD, - G_RM_NOOP, - G_RM_VISCVG, - G_RM_OPA_CI}; - - uint32_t tblB[] = {G_RM_AA_ZB_OPA_SURF2, - G_RM_AA_ZB_XLU_SURF2, - G_RM_AA_ZB_OPA_DECAL2, - G_RM_AA_ZB_XLU_DECAL2, - G_RM_AA_ZB_OPA_INTER2, - G_RM_AA_ZB_XLU_INTER2, - G_RM_AA_ZB_XLU_LINE2, - G_RM_AA_ZB_DEC_LINE2, - G_RM_AA_ZB_TEX_EDGE2, - G_RM_AA_ZB_TEX_INTER2, - G_RM_AA_ZB_SUB_SURF2, - G_RM_AA_ZB_PCL_SURF2, - G_RM_AA_ZB_OPA_TERR2, - G_RM_AA_ZB_TEX_TERR2, - G_RM_AA_ZB_SUB_TERR2, - G_RM_RA_ZB_OPA_SURF2, - G_RM_RA_ZB_OPA_DECAL2, - G_RM_RA_ZB_OPA_INTER2, - G_RM_AA_OPA_SURF2, - G_RM_AA_XLU_SURF2, - G_RM_AA_XLU_LINE2, - G_RM_AA_DEC_LINE2, - G_RM_AA_TEX_EDGE2, - G_RM_AA_SUB_SURF2, - G_RM_AA_PCL_SURF2, - G_RM_AA_OPA_TERR2, - G_RM_AA_TEX_TERR2, - G_RM_AA_SUB_TERR2, - G_RM_RA_OPA_SURF2, - G_RM_ZB_OPA_SURF2, - G_RM_ZB_XLU_SURF2, - G_RM_ZB_OPA_DECAL2, - G_RM_ZB_XLU_DECAL2, - G_RM_ZB_CLD_SURF2, - G_RM_ZB_OVL_SURF2, - G_RM_ZB_PCL_SURF2, - G_RM_OPA_SURF2, - G_RM_XLU_SURF2, - G_RM_CLD_SURF2, - G_RM_TEX_EDGE2, - G_RM_PCL_SURF2, - G_RM_ADD2, - G_RM_NOOP2, - G_RM_VISCVG2, - G_RM_OPA_CI2}; - - std::map str = { - {G_RM_FOG_SHADE_A, "G_RM_FOG_SHADE_A"}, - {G_RM_FOG_PRIM_A, "G_RM_FOG_PRIM_A"}, - {G_RM_PASS, "G_RM_PASS"}, - {G_RM_AA_ZB_OPA_SURF, "G_RM_AA_ZB_OPA_SURF"}, - {G_RM_AA_ZB_OPA_SURF2, "G_RM_AA_ZB_OPA_SURF2"}, - {G_RM_AA_ZB_XLU_SURF, "G_RM_AA_ZB_XLU_SURF"}, - {G_RM_AA_ZB_XLU_SURF2, "G_RM_AA_ZB_XLU_SURF2"}, - {G_RM_AA_ZB_OPA_DECAL, "G_RM_AA_ZB_OPA_DECAL"}, - {G_RM_AA_ZB_OPA_DECAL2, "G_RM_AA_ZB_OPA_DECAL2"}, - {G_RM_AA_ZB_XLU_DECAL, "G_RM_AA_ZB_XLU_DECAL"}, - {G_RM_AA_ZB_XLU_DECAL2, "G_RM_AA_ZB_XLU_DECAL2"}, - {G_RM_AA_ZB_OPA_INTER, "G_RM_AA_ZB_OPA_INTER"}, - {G_RM_AA_ZB_OPA_INTER2, "G_RM_AA_ZB_OPA_INTER2"}, - {G_RM_AA_ZB_XLU_INTER, "G_RM_AA_ZB_XLU_INTER"}, - {G_RM_AA_ZB_XLU_INTER2, "G_RM_AA_ZB_XLU_INTER2"}, - {G_RM_AA_ZB_XLU_LINE, "G_RM_AA_ZB_XLU_LINE"}, - {G_RM_AA_ZB_XLU_LINE2, "G_RM_AA_ZB_XLU_LINE2"}, - {G_RM_AA_ZB_DEC_LINE, "G_RM_AA_ZB_DEC_LINE"}, - {G_RM_AA_ZB_DEC_LINE2, "G_RM_AA_ZB_DEC_LINE2"}, - {G_RM_AA_ZB_TEX_EDGE, "G_RM_AA_ZB_TEX_EDGE"}, - {G_RM_AA_ZB_TEX_EDGE2, "G_RM_AA_ZB_TEX_EDGE2"}, - {G_RM_AA_ZB_TEX_INTER, "G_RM_AA_ZB_TEX_INTER"}, - {G_RM_AA_ZB_TEX_INTER2, "G_RM_AA_ZB_TEX_INTER2"}, - {G_RM_AA_ZB_SUB_SURF, "G_RM_AA_ZB_SUB_SURF"}, - {G_RM_AA_ZB_SUB_SURF2, "G_RM_AA_ZB_SUB_SURF2"}, - {G_RM_AA_ZB_PCL_SURF, "G_RM_AA_ZB_PCL_SURF"}, - {G_RM_AA_ZB_PCL_SURF2, "G_RM_AA_ZB_PCL_SURF2"}, - {G_RM_AA_ZB_OPA_TERR, "G_RM_AA_ZB_OPA_TERR"}, - {G_RM_AA_ZB_OPA_TERR2, "G_RM_AA_ZB_OPA_TERR2"}, - {G_RM_AA_ZB_TEX_TERR, "G_RM_AA_ZB_TEX_TERR"}, - {G_RM_AA_ZB_TEX_TERR2, "G_RM_AA_ZB_TEX_TERR2"}, - {G_RM_AA_ZB_SUB_TERR, "G_RM_AA_ZB_SUB_TERR"}, - {G_RM_AA_ZB_SUB_TERR2, "G_RM_AA_ZB_SUB_TERR2"}, - {G_RM_RA_ZB_OPA_SURF, "G_RM_RA_ZB_OPA_SURF"}, - {G_RM_RA_ZB_OPA_SURF2, "G_RM_RA_ZB_OPA_SURF2"}, - {G_RM_RA_ZB_OPA_DECAL, "G_RM_RA_ZB_OPA_DECAL"}, - {G_RM_RA_ZB_OPA_DECAL2, "G_RM_RA_ZB_OPA_DECAL2"}, - {G_RM_RA_ZB_OPA_INTER, "G_RM_RA_ZB_OPA_INTER"}, - {G_RM_RA_ZB_OPA_INTER2, "G_RM_RA_ZB_OPA_INTER2"}, - {G_RM_AA_OPA_SURF, "G_RM_AA_OPA_SURF"}, - {G_RM_AA_OPA_SURF2, "G_RM_AA_OPA_SURF2"}, - {G_RM_AA_XLU_SURF, "G_RM_AA_XLU_SURF"}, - {G_RM_AA_XLU_SURF2, "G_RM_AA_XLU_SURF2"}, - {G_RM_AA_XLU_LINE, "G_RM_AA_XLU_LINE"}, - {G_RM_AA_XLU_LINE2, "G_RM_AA_XLU_LINE2"}, - {G_RM_AA_DEC_LINE, "G_RM_AA_DEC_LINE"}, - {G_RM_AA_DEC_LINE2, "G_RM_AA_DEC_LINE2"}, - {G_RM_AA_TEX_EDGE, "G_RM_AA_TEX_EDGE"}, - {G_RM_AA_TEX_EDGE2, "G_RM_AA_TEX_EDGE2"}, - {G_RM_AA_SUB_SURF, "G_RM_AA_SUB_SURF"}, - {G_RM_AA_SUB_SURF2, "G_RM_AA_SUB_SURF2"}, - {G_RM_AA_PCL_SURF, "G_RM_AA_PCL_SURF"}, - {G_RM_AA_PCL_SURF2, "G_RM_AA_PCL_SURF2"}, - {G_RM_AA_OPA_TERR, "G_RM_AA_OPA_TERR"}, - {G_RM_AA_OPA_TERR2, "G_RM_AA_OPA_TERR2"}, - {G_RM_AA_TEX_TERR, "G_RM_AA_TEX_TERR"}, - {G_RM_AA_TEX_TERR2, "G_RM_AA_TEX_TERR2"}, - {G_RM_AA_TEX_TERR, "G_RM_AA_TEX_TERR"}, - {G_RM_AA_TEX_TERR2, "G_RM_AA_TEX_TERR2"}, - {G_RM_AA_SUB_TERR, "G_RM_AA_SUB_TERR"}, - {G_RM_AA_SUB_TERR2, "G_RM_AA_SUB_TERR2"}, - {G_RM_RA_OPA_SURF, "G_RM_RA_OPA_SURF"}, - {G_RM_RA_OPA_SURF2, "G_RM_RA_OPA_SURF2"}, - {G_RM_ZB_OPA_SURF, "G_RM_ZB_OPA_SURF"}, - {G_RM_ZB_OPA_SURF2, "G_RM_ZB_OPA_SURF2"}, - {G_RM_ZB_XLU_SURF, "G_RM_ZB_XLU_SURF"}, - {G_RM_ZB_XLU_SURF2, "G_RM_ZB_XLU_SURF2"}, - {G_RM_ZB_OPA_DECAL, "G_RM_ZB_OPA_DECAL"}, - {G_RM_ZB_OPA_DECAL2, "G_RM_ZB_OPA_DECAL2"}, - {G_RM_ZB_XLU_DECAL, "G_RM_ZB_XLU_DECAL"}, - {G_RM_ZB_XLU_DECAL2, "G_RM_ZB_XLU_DECAL2"}, - {G_RM_ZB_CLD_SURF, "G_RM_ZB_CLD_SURF"}, - {G_RM_ZB_CLD_SURF2, "G_RM_ZB_CLD_SURF2"}, - {G_RM_ZB_OVL_SURF, "G_RM_ZB_OVL_SURF"}, - {G_RM_ZB_OVL_SURF2, "G_RM_ZB_OVL_SURF2"}, - {G_RM_ZB_PCL_SURF, "G_RM_ZB_PCL_SURF"}, - {G_RM_ZB_PCL_SURF2, "G_RM_ZB_PCL_SURF2"}, - {G_RM_OPA_SURF, "G_RM_OPA_SURF"}, - {G_RM_OPA_SURF2, "G_RM_OPA_SURF2"}, - {G_RM_XLU_SURF, "G_RM_XLU_SURF"}, - {G_RM_XLU_SURF2, "G_RM_XLU_SURF2"}, - {G_RM_CLD_SURF, "G_RM_CLD_SURF"}, - {G_RM_CLD_SURF2, "G_RM_CLD_SURF2"}, - {G_RM_TEX_EDGE, "G_RM_TEX_EDGE"}, - {G_RM_TEX_EDGE2, "G_RM_TEX_EDGE2"}, - {G_RM_PCL_SURF, "G_RM_PCL_SURF"}, - {G_RM_PCL_SURF2, "G_RM_PCL_SURF2"}, - {G_RM_ADD, "G_RM_ADD"}, - {G_RM_ADD2, "G_RM_ADD2"}, - {G_RM_NOOP, "G_RM_NOOP"}, - {G_RM_NOOP2, "G_RM_NOOP2"}, - {G_RM_VISCVG, "G_RM_VISCVG"}, - {G_RM_VISCVG2, "G_RM_VISCVG2"}, - {G_RM_OPA_CI, "G_RM_OPA_CI"}, - {G_RM_OPA_CI2, "G_RM_OPA_CI2"}, - }; - - for (uint32_t k = 0; k < sizeof(tblA) / 4; k++) - { - if ((dd & tblA[k]) == tblA[k]) - { - if (tblA[k] > mode1) - mode1 = tblA[k]; - } - } - - for (uint32_t k = 0; k < sizeof(tblB) / 4; k++) - { - if ((dd & tblB[k]) == tblB[k]) - { - if (tblB[k] > mode2) - mode2 = tblB[k]; - } - } - - std::string mode1Str = str[mode1]; - std::string mode2Str = str[mode2]; - - if (mode1Str == "") - { - mode1Str = StringHelper::Sprintf("0x%08X", mode1); - } - - if (mode2Str == "") - { - if (mode2 & AA_EN) - { - mode2Str += "AA_EN | "; - } - - if (mode2 & Z_CMP) - { - mode2Str += "Z_CMP | "; - } - - if (mode2 & Z_UPD) - { - mode2Str += "Z_UPD | "; - } - - if (mode2 & IM_RD) - { - mode2Str += "IM_RD | "; - } - - if (mode2 & CLR_ON_CVG) - { - mode2Str += "CLR_ON_CVG | "; - } - - if (mode2 & CVG_DST_CLAMP) - { - mode2Str += "CVG_DST_CLAMP | "; - } - - if (mode2 & CVG_DST_WRAP) - { - mode2Str += "CVG_DST_WRAP | "; - } - - if (mode2 & CVG_DST_FULL) - { - mode2Str += "CVG_DST_FULL | "; - } - - if (mode2 & CVG_DST_SAVE) - { - mode2Str += "CVG_DST_SAVE | "; - } - - int32_t zMode = mode2 & 0xC00; - - if (zMode == ZMODE_INTER) - { - mode2Str += "ZMODE_INTER | "; - } - else if (zMode == ZMODE_XLU) - { - mode2Str += "ZMODE_XLU | "; - } - else if (zMode == ZMODE_DEC) - { - mode2Str += "ZMODE_DEC | "; - } - - if (mode2 & CVG_X_ALPHA) - { - mode2Str += "CVG_X_ALPHA | "; - } - - if (mode2 & ALPHA_CVG_SEL) - { - mode2Str += "ALPHA_CVG_SEL | "; - } - - if (mode2 & FORCE_BL) - { - mode2Str += "FORCE_BL | "; - } - - int32_t bp = (mode2 >> 28) & 0b11; - int32_t ba = (mode2 >> 24) & 0b11; - int32_t bm = (mode2 >> 20) & 0b11; - int32_t bb = (mode2 >> 16) & 0b11; - - mode2Str += StringHelper::Sprintf("GBL_c2(%i, %i, %i, %i)", bp, ba, bm, bb); - // mode2Str = StringHelper::Sprintf("0x%08X", mode2); - } - - sprintf(line, "gsDPSetRenderMode(%s, %s),", mode1Str.c_str(), mode2Str.c_str()); - } - else - { - sprintf(line, "gsSPSetOtherMode(0xE2, %i, %i, 0x%08X),", sft, len, dd); - } -} - -void ZDisplayList::Opcode_G_SETOTHERMODE_H(uint64_t data, char* line) -{ - int32_t ss = (data & 0x0000FF0000000000) >> 40; - int32_t nn = (data & 0x000000FF00000000) >> 32; - int32_t dd = (data & 0xFFFFFFFF); - - int32_t sft = 32 - (nn + 1) - ss; - - if (sft == 14) // G_MDSFT_TEXTLUT - { - const char* types[] = {"G_TT_NONE", "G_TT_NONE", "G_TT_RGBA16", "G_TT_IA16"}; - sprintf(line, "gsDPSetTextureLUT(%s),", types[dd >> 14]); - } - else - sprintf(line, "gsSPSetOtherMode(0xE3, %i, %i, 0x%08X),", sft, nn + 1, dd); -} - -void ZDisplayList::Opcode_G_LOADTLUT(uint64_t data, [[maybe_unused]] const std::string& prefix, - char* line) -{ - int32_t t = (data & 0x0000000007000000) >> 24; - int32_t ccc = (data & 0x00000000003FF000) >> 14; - - lastTexWidth = sqrt(ccc + 1); - lastTexHeight = sqrt(ccc + 1); - - lastTexLoaded = true; - lastTexIsPalette = true; - - if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_DEBUG) - printf("TextureGenCheck G_LOADTLUT (lastCISiz: %i)\n", (uint32_t)lastCISiz); - - TextureGenCheck(); - - sprintf(line, "gsDPLoadTLUTCmd(%i, %i),", t, ccc); -} - -void ZDisplayList::Opcode_G_ENDDL([[maybe_unused]] const std::string& prefix, char* line) -{ - sprintf(line, "gsSPEndDisplayList(),"); - - if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_DEBUG) - printf("TextureGenCheck G_ENDDL\n"); - - TextureGenCheck(); -} - -static int32_t GfxdCallback_FormatSingleEntry() -{ - ZDisplayList* self = static_cast(gfxd_udata_get()); - gfxd_puts("\t"); - gfxd_macro_dflt(); - gfxd_puts(","); - - auto macroId = gfxd_macro_id(); - - switch (macroId) - { - case gfxd_SP1Triangle: - case gfxd_SP2Triangles: - if (self->lastTexture != nullptr && self->lastTexture->IsColorIndexed() && - !self->lastTexture->HasTlut()) - { - auto tex = self->lastTexture; - auto tlut = self->lastTlut; - - if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_DEBUG) - { - if (tlut != nullptr) - printf("CI texture '%s' (0x%X), TLUT: '%s' (0x%X)\n", tex->GetName().c_str(), - tex->GetRawDataIndex(), tlut->GetName().c_str(), - tlut->GetRawDataIndex()); - else - printf("CI texture '%s' (0x%X), TLUT: null\n", tex->GetName().c_str(), - tex->GetRawDataIndex()); - } - - if (tlut != nullptr && !tex->HasTlut()) - tex->SetTlut(tlut); - } - break; - } - - // dont print a new line after the last command - switch (macroId) - { - case gfxd_SPEndDisplayList: - case gfxd_SPBranchList: - break; - - default: - gfxd_puts("\n"); - break; - } - - return 0; -} - -static int32_t GfxdCallback_Vtx(uint32_t seg, int32_t count) -{ - ZDisplayList* self = static_cast(gfxd_udata_get()); - uint32_t vtxOffset = Seg2Filespace(seg, self->parent->baseAddress); - - if (GETSEGNUM(seg) == self->parent->segment) - { - Declaration* decl; - - // Check for vertex intersections from other display lists - // TODO: These two could probably be condenced to one... - decl = self->parent->GetDeclarationRanged(vtxOffset + (count * 16)); - if (decl != nullptr) - { - int32_t diff = decl->address - vtxOffset; - - if (diff > 0) - count = diff / 16; - else - count = 0; - } - - decl = self->parent->GetDeclarationRanged(vtxOffset); - if (decl != nullptr) - { - int32_t diff = decl->address - vtxOffset; - - if (diff > 0) - count = diff / 16; - else - count = 0; - } - - if (count > 0) - { - std::vector vtxList; - vtxList.reserve(count); - - uint32_t currentPtr = vtxOffset; - for (int32_t i = 0; i < count; i++) - { - ZVtx vtx(self->parent); - vtx.ExtractFromFile(currentPtr); - - vtxList.push_back(vtx); - currentPtr += 16; - } - - bool keyAlreadyOccupied = self->vertices.find(vtxOffset) != self->vertices.end(); - - // In some cases a vtxList already exists at vtxOffset. Only override the existing list - // if the new one is bigger. - if (!keyAlreadyOccupied || - (keyAlreadyOccupied && vtxList.size() > self->vertices[vtxOffset].size())) - self->vertices[vtxOffset] = vtxList; - } - } - - self->references.push_back(seg); - gfxd_puts("@r"); - - return 1; -} - -static int32_t GfxdCallback_Texture(segptr_t seg, int32_t fmt, int32_t siz, int32_t width, - int32_t height, [[maybe_unused]] int32_t pal) -{ - ZDisplayList* self = static_cast(gfxd_udata_get()); - uint32_t texOffset = Seg2Filespace(seg, self->parent->baseAddress); - - self->lastTexWidth = width; - self->lastTexHeight = height; - self->lastTexAddr = texOffset; - self->lastTexSeg = seg; - self->lastTexFmt = static_cast(fmt); - self->lastTexSiz = static_cast(siz); - self->lastTexLoaded = true; - self->lastTexIsPalette = false; - - self->TextureGenCheck(); - - std::string texName; - Globals::Instance->GetSegmentedPtrName(seg, self->parent, "", texName); - - gfxd_puts(texName.c_str()); - - return 1; -} - -static int32_t GfxdCallback_Palette(uint32_t seg, [[maybe_unused]] int32_t idx, int32_t count) -{ - ZDisplayList* self = static_cast(gfxd_udata_get()); - uint32_t palOffset = Seg2Filespace(seg, self->parent->baseAddress); - - self->lastTexWidth = sqrt(count); - self->lastTexHeight = sqrt(count); - self->lastTexAddr = palOffset; - self->lastTexSeg = seg; - self->lastTexSiz = F3DZEXTexSizes::G_IM_SIZ_16b; - self->lastTexFmt = F3DZEXTexFormats::G_IM_FMT_RGBA; - self->lastTexLoaded = true; - self->lastTexIsPalette = true; - - self->TextureGenCheck(); - - std::string palName; - Globals::Instance->GetSegmentedPtrName(seg, self->parent, "", palName); - - gfxd_puts(palName.c_str()); - - return 1; -} - -static int32_t GfxdCallback_DisplayList(uint32_t seg) -{ - ZDisplayList* self = static_cast(gfxd_udata_get()); - uint32_t dListOffset = GETSEGOFFSET(seg); - uint32_t dListSegNum = GETSEGNUM(seg); - - std::string dListName = ""; - bool addressFound = - Globals::Instance->GetSegmentedPtrName(seg, self->parent, "Gfx", dListName, false); - - if (!addressFound) - { - if (self->parent->segment == dListSegNum) - { - ZDisplayList* newDList = new ZDisplayList(self->parent); - newDList->ExtractFromBinary( - dListOffset, - self->GetDListLength(self->parent->GetRawData(), dListOffset, self->dListType)); - newDList->SetName(newDList->GetDefaultName(self->parent->GetName())); - self->otherDLists.push_back(newDList); - dListName = newDList->GetName(); - } - else - { - Globals::Instance->WarnHardcodedPointer(seg, self->parent, self, - self->GetRawDataIndex()); - } - } - - gfxd_puts(dListName.c_str()); - - return 1; -} - -static int32_t GfxdCallback_Matrix(uint32_t seg) -{ - std::string mtxName; - ZDisplayList* self = static_cast(gfxd_udata_get()); - - bool addressFound = - Globals::Instance->GetSegmentedPtrName(seg, self->parent, "Mtx", mtxName, false); - - if (!addressFound) - { - if (GETSEGNUM(seg) == self->parent->segment) - { - Declaration* decl = - self->parent->GetDeclaration(Seg2Filespace(seg, self->parent->baseAddress)); - if (decl == nullptr) - { - ZMtx mtx(self->parent); - mtx.SetName(mtx.GetDefaultName(self->GetName())); - mtx.ExtractFromFile(Seg2Filespace(seg, self->parent->baseAddress)); - mtx.DeclareVar(self->GetName(), ""); - - mtx.GetSourceOutputCode(self->GetName()); - self->mtxList.push_back(mtx); - mtxName = "&" + mtx.GetName(); - } - } - else - { - Globals::Instance->WarnHardcodedPointer(seg, self->parent, self, - self->GetRawDataIndex()); - } - } - - gfxd_puts(mtxName.c_str()); - - return 1; -} - -void ZDisplayList::DeclareReferences(const std::string& prefix) -{ - std::string sourceOutput; - - if (Globals::Instance->useLegacyZDList) - sourceOutput += ProcessLegacy(prefix); - else - sourceOutput += ProcessGfxDis(prefix); - - // Iterate through our vertex lists, connect intersecting lists. - if (vertices.size() > 0) - { - std::vector>> verticesSorted(vertices.begin(), - vertices.end()); - - for (size_t i = 0; i < verticesSorted.size() - 1; i++) - { - size_t vtxSize = vertices[verticesSorted[i].first].size() * 16; - - if ((verticesSorted[i].first + vtxSize) > verticesSorted[i + 1].first) - { - int32_t intersectAmt = - (verticesSorted[i].first + vtxSize) - verticesSorted[i + 1].first; - int32_t intersectIndex = intersectAmt / 16; - - for (size_t j = intersectIndex; j < verticesSorted[i + 1].second.size(); j++) - vertices[verticesSorted[i].first].push_back(verticesSorted[i + 1].second[j]); - - vertices.erase(verticesSorted[i + 1].first); - verticesSorted.erase(verticesSorted.begin() + i + 1); - - i--; - } - } - - // Generate Vertex Declarations - for (auto& item : vertices) - { - std::string declaration = ""; - - offset_t curAddr = item.first; - auto& firstVtx = item.second.at(0); - - for (auto vtx : item.second) - declaration += StringHelper::Sprintf("\t%s,\n", vtx.GetBodySourceCode().c_str()); - - Declaration* decl = parent->AddDeclarationArray( - curAddr, firstVtx.GetDeclarationAlignment(), - item.second.size() * firstVtx.GetRawDataSize(), firstVtx.GetSourceTypeName(), - firstVtx.GetDefaultName(name), item.second.size(), declaration); - decl->isExternal = true; - } - } - - Declaration* decl = DeclareVar("", sourceOutput); - decl->references = references; - - // Iterate through our vertex lists, connect intersecting lists. - if (vertices.size() > 0) - { - std::vector>> verticesSorted(vertices.begin(), - vertices.end()); - - for (size_t i = 0; i < verticesSorted.size() - 1; i++) - { - // int32_t vtxSize = verticesSorted[i].second.size() * 16; - size_t vtxSize = vertices[verticesSorted[i].first].size() * 16; - - if ((verticesSorted[i].first + vtxSize) > verticesSorted[i + 1].first) - { - int32_t intersectAmt = - (verticesSorted[i].first + vtxSize) - verticesSorted[i + 1].first; - int32_t intersectIndex = intersectAmt / 16; - - for (size_t j = intersectIndex; j < verticesSorted[i + 1].second.size(); j++) - vertices[verticesSorted[i].first].push_back(verticesSorted[i + 1].second[j]); - - vertices.erase(verticesSorted[i + 1].first); - verticesSorted.erase(verticesSorted.begin() + i + 1); - - i--; - } - } - - // Generate Vertex Declarations - std::vector vtxKeys; - vtxKeys.reserve(vertices.size()); - for (auto& item : vertices) - vtxKeys.push_back(item.first); - - // for (pair> item : vertices) - for (size_t i = 0; i < vtxKeys.size(); i++) - { - auto& item = vertices[vtxKeys[i]]; - - std::string declaration; - - for (auto& vtx : item) - declaration += StringHelper::Sprintf("\t%s,\n", vtx.GetBodySourceCode().c_str()); - - // Ensure there's always a trailing line feed to prevent dumb warnings. - // Please don't remove this line, unless you somehow made a way to prevent - // that warning when building the OoT repo. - declaration += "\n"; - - if (parent != nullptr) - { - std::string vtxName; - ZResource* vtxRes = parent->FindResource(vtxKeys[i]); - - if (vtxRes != nullptr) - vtxName = vtxRes->GetName(); - else - vtxName = StringHelper::Sprintf("%sVtx_%06X", prefix.c_str(), vtxKeys[i]); - - auto filepath = Globals::Instance->outputPath / vtxName; - std::string incStr = - StringHelper::Sprintf("%s.%s.inc", filepath.string().c_str(), "vtx"); - - Declaration* vtxDecl = parent->AddDeclarationIncludeArray( - vtxKeys[i], incStr, item.size() * 16, "Vtx", vtxName, item.size()); - vtxDecl->isExternal = true; - } - } - } -} - -std::string ZDisplayList::ProcessLegacy(const std::string& prefix) -{ - char line[4096]; - std::string sourceOutput; - - for (size_t i = 0; i < instructions.size(); i++) - { - uint8_t opcode = (uint8_t)(instructions[i] >> 56); - uint64_t data = instructions[i]; - sourceOutput += " "; - - auto start = std::chrono::steady_clock::now(); - - int32_t optimizationResult = OptimizationChecks(i, sourceOutput, prefix); - - if (optimizationResult != -1) - { - i += optimizationResult - 1; - line[0] = '\0'; - } - else - { - if (dListType == DListType::F3DZEX) - ParseF3DZEX((F3DZEXOpcode)opcode, data, i, prefix, line); - else - ParseF3DEX((F3DEXOpcode)opcode, data, prefix, line); - } - - auto end = std::chrono::steady_clock::now(); - int64_t diff = std::chrono::duration_cast(end - start).count(); - - if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_DEBUG && diff > 5) - printf("F3DOP: 0x%02X, TIME: %" PRIi64 "ms\n", opcode, diff); - - sourceOutput += line; - - if (i < instructions.size() - 1) - sourceOutput += "\n"; - } - - return sourceOutput; -} - -std::string ZDisplayList::ProcessGfxDis([[maybe_unused]] const std::string& prefix) -{ - std::string sourceOutput; - - OutputFormatter outputformatter; - int32_t dListSize = instructions.size() * sizeof(instructions[0]); - - gfxd_input_buffer(instructions.data(), dListSize); - gfxd_endian(gfxd_endian_little, sizeof(uint64_t)); // tell gfxdis what format the data is - - gfxd_macro_fn(GfxdCallback_FormatSingleEntry); // format for each command entry - gfxd_vtx_callback(GfxdCallback_Vtx); // handle vertices - gfxd_timg_callback(GfxdCallback_Texture); // handle textures - gfxd_tlut_callback(GfxdCallback_Palette); // handle palettes - gfxd_dl_callback(GfxdCallback_DisplayList); // handle child display lists - gfxd_mtx_callback(GfxdCallback_Matrix); // handle matrices - gfxd_output_callback( - outputformatter.StaticWriter()); // convert tabs to 4 spaces and enforce 120 line limit - - gfxd_enable(gfxd_emit_dec_color); // use decimal for colors - - // set microcode. see gfxd.h for more options. - if (dListType == DListType::F3DZEX) - gfxd_target(gfxd_f3dex2); - else - gfxd_target(gfxd_f3dex); - - gfxd_udata_set(this); - gfxd_execute(); // generate display list - sourceOutput += outputformatter.GetOutput(); // write formatted display list - - MergeConnectingVertexLists(); - - return sourceOutput; -} - -void ZDisplayList::MergeConnectingVertexLists() -{ - if (vertices.size() > 0) - { - std::vector>> vertexKeys(vertices.begin(), - vertices.end()); - std::pair> lastItem = vertexKeys.at(0); - - for (size_t i = 1; i < vertexKeys.size(); i++) - { - std::pair> curItem = vertexKeys[i]; - - size_t lastItemEnd = lastItem.first + (lastItem.second.size() * 16); - bool lastItemIntersects = lastItemEnd >= curItem.first; - - if (lastItemIntersects) - { - int intersectedVtxStart = (lastItemEnd - curItem.first) / 16; - - for (size_t j = intersectedVtxStart; j < curItem.second.size(); j++) - vertices[lastItem.first].push_back(curItem.second[j]); - - vertices.erase(curItem.first); - vertexKeys.erase(vertexKeys.begin() + i); - - lastItem.second = vertices[lastItem.first]; - - i--; - } - else - lastItem = curItem; - } - } -} - -void ZDisplayList::TextureGenCheck() -{ - if (TextureGenCheck(lastTexWidth, lastTexHeight, lastTexAddr, lastTexSeg, lastTexFmt, - lastTexSiz, lastTexLoaded, lastTexIsPalette, this)) - { - lastTexAddr = 0; - lastTexLoaded = false; - lastTexIsPalette = false; - } -} - -bool ZDisplayList::TextureGenCheck(int32_t texWidth, int32_t texHeight, uint32_t texAddr, - uint32_t texSeg, F3DZEXTexFormats texFmt, F3DZEXTexSizes texSiz, - bool texLoaded, bool texIsPalette, ZDisplayList* self) -{ - uint32_t segmentNumber = GETSEGNUM(texSeg); - - if (!texIsPalette) - self->lastTexture = nullptr; - else - self->lastTlut = nullptr; - - if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_DEBUG) - printf("TextureGenCheck seg=%i width=%i height=%i ispal=%i addr=0x%06X\n", segmentNumber, - texWidth, texHeight, texIsPalette, texAddr); - - if ((texSeg != 0 || texAddr != 0) && texWidth > 0 && texHeight > 0 && texLoaded && - Globals::Instance->HasSegment(segmentNumber)) - { - ZFile* auxParent = nullptr; - if (segmentNumber == self->parent->segment) - { - auxParent = self->parent; - } - else - { - // Try to find a non-external file (i.e., one we are actually extracting) - // which has the same segment number we are looking for. - for (auto& otherFile : Globals::Instance->cfg.segmentRefFiles[segmentNumber]) - { - if (!otherFile->isExternalFile) - { - auxParent = otherFile; - } - } - } - - if (auxParent == nullptr) - { - // We can't declare the texture in any of the files we are extracting. - return false; - } - - if (auxParent->IsOffsetInFileRange(texAddr)) - { - ZTexture* tex = auxParent->GetTextureResource(texAddr); - if (tex != nullptr) - tex->isPalette = texIsPalette; - else - { - tex = new ZTexture(auxParent); - tex->ExtractFromBinary(texAddr, texWidth, texHeight, - TexFormatToTexType(texFmt, texSiz), texIsPalette); - auxParent->AddTextureResource(texAddr, tex); - } - - if (!texIsPalette) - self->lastTexture = tex; - else - self->lastTlut = tex; - - if (auxParent->GetDeclaration(texAddr) == nullptr) - { - tex->DeclareVar(self->GetName(), ""); - } - - return true; - } - } - - return false; -} - -TextureType ZDisplayList::TexFormatToTexType(F3DZEXTexFormats fmt, F3DZEXTexSizes siz) -{ - if (fmt == F3DZEXTexFormats::G_IM_FMT_RGBA) - { - if (siz == F3DZEXTexSizes::G_IM_SIZ_16b) - return TextureType::RGBA16bpp; - else if (siz == F3DZEXTexSizes::G_IM_SIZ_32b) - return TextureType::RGBA32bpp; - } - else if (fmt == F3DZEXTexFormats::G_IM_FMT_CI) - { - if (Globals::Instance->useLegacyZDList) - return TextureType::Palette8bpp; - else - { - if (siz == F3DZEXTexSizes::G_IM_SIZ_4b) - return TextureType::Palette4bpp; - else if (siz == F3DZEXTexSizes::G_IM_SIZ_8b) - return TextureType::Palette8bpp; - } - } - else if (fmt == F3DZEXTexFormats::G_IM_FMT_IA) - { - if (siz == F3DZEXTexSizes::G_IM_SIZ_4b) - return TextureType::GrayscaleAlpha4bpp; - else if (siz == F3DZEXTexSizes::G_IM_SIZ_8b) - return TextureType::GrayscaleAlpha8bpp; - else if (siz == F3DZEXTexSizes::G_IM_SIZ_16b) - return TextureType::GrayscaleAlpha16bpp; - } - else if (fmt == F3DZEXTexFormats::G_IM_FMT_I) - { - if (siz == F3DZEXTexSizes::G_IM_SIZ_4b) - return TextureType::Grayscale4bpp; - else if (siz == F3DZEXTexSizes::G_IM_SIZ_8b) - return TextureType::Grayscale8bpp; - else if (siz == F3DZEXTexSizes::G_IM_SIZ_16b) - return TextureType::Grayscale8bpp; - } - - return TextureType::RGBA16bpp; -} - -bool ZDisplayList::IsExternalResource() const -{ - return false; -} - -std::string ZDisplayList::GetExternalExtension() const -{ - return "dlist"; -} - -std::string ZDisplayList::GetSourceTypeName() const -{ - return "Gfx"; -} - -ZResourceType ZDisplayList::GetResourceType() const -{ - return ZResourceType::DisplayList; -} - -size_t ZDisplayList::GetRawDataSize() const -{ - return instructions.size() * 8; -} - -DeclarationAlignment ZDisplayList::GetDeclarationAlignment() const -{ - return DeclarationAlignment::Align8; -} diff --git a/tools/ZAPD/ZAPD/ZDisplayList.h b/tools/ZAPD/ZAPD/ZDisplayList.h deleted file mode 100644 index 356e89a2be..0000000000 --- a/tools/ZAPD/ZAPD/ZDisplayList.h +++ /dev/null @@ -1,381 +0,0 @@ -#pragma once - -#include "ZMtx.h" -#include "ZResource.h" -#include "ZRoom/ZRoom.h" -#include "ZTexture.h" -#include "ZVtx.h" -#include "tinyxml2.h" - -#include -#include -#include - -enum class F3DEXOpcode -{ - G_SPNOOP = 0x00, - G_MTX = 0x01, - G_MOVEMEM = 0x03, - G_VTX = 0x04, - G_DL = 0x06, - G_LOAD_UCODE = 0xAF, - G_BRANCH_Z = 0xB0, - G_TRI2 = 0xB1, - G_MODIFYVTX = 0xB2, - G_RDPHALF_2 = 0xB3, - G_RDPHALF_1 = 0xB4, - G_QUAD = 0xB5, - G_CLEARGEOMETRYMODE = 0xB6, - G_SETGEOMETRYMODE = 0xB7, - G_ENDDL = 0xB8, - G_SETOTHERMODE_L = 0xB9, - G_SETOTHERMODE_H = 0xBA, - G_TEXTURE = 0xBB, - G_MOVEWORD = 0xBC, - G_POPMTX = 0xBD, - G_CULLDL = 0xBE, - G_TRI1 = 0xBF, - G_NOOP = 0xC0, - G_TEXRECT = 0xE4, - G_TEXRECTFLIP = 0xE5, - G_RDPLOADSYNC = 0xE6, - G_RDPPIPESYNC = 0xE7, - G_RDPTILESYNC = 0xE8, - G_RDPFULLSYNC = 0xE9, - G_SETKEYGB = 0xEA, - G_SETKEYR = 0xEB, - G_SETCONVERT = 0xEC, - G_SETSCISSOR = 0xED, - G_SETPRIMDEPTH = 0xEE, - G_RDPSETOTHERMODE = 0xEF, - G_LOADTLUT = 0xF0, - G_SETTILESIZE = 0xF2, - G_LOADBLOCK = 0xF3, - G_LOADTILE = 0xF4, - G_SETTILE = 0xF5, - G_FILLRECT = 0xF6, - G_SETFILLCOLOR = 0xF7, - G_SETFOGCOLOR = 0xF8, - G_SETBLENDCOLOR = 0xF9, - G_SETPRIMCOLOR = 0xFA, - G_SETENVCOLOR = 0xFB, - G_SETCOMBINE = 0xFC, - G_SETTIMG = 0xFD, - G_SETZIMG = 0xFE, - G_SETCIMG = 0xFF -}; - -enum class F3DZEXOpcode -{ - G_NOOP = 0x00, - G_VTX = 0x01, - G_MODIFYVTX = 0x02, - G_CULLDL = 0x03, - G_BRANCH_Z = 0x04, - G_TRI1 = 0x05, - G_TRI2 = 0x06, - G_QUAD = 0x07, - G_SPECIAL_3 = 0xD3, - G_SPECIAL_2 = 0xD4, - G_SPECIAL_1 = 0xD5, - G_DMA_IO = 0xD6, - G_TEXTURE = 0xD7, - G_POPMTX = 0xD8, - G_GEOMETRYMODE = 0xD9, - G_MTX = 0xDA, - G_MOVEWORD = 0xDB, - G_MOVEMEM = 0xDC, - G_LOAD_UCODE = 0xDD, - G_DL = 0xDE, - G_ENDDL = 0xDF, - G_SPNOOP = 0xE0, - G_RDPHALF_1 = 0xE1, - G_SETOTHERMODE_L = 0xE2, - G_SETOTHERMODE_H = 0xE3, - G_TEXRECT = 0xE4, - G_TEXRECTFLIP = 0xE5, - G_RDPLOADSYNC = 0xE6, - G_RDPPIPESYNC = 0xE7, - G_RDPTILESYNC = 0xE8, - G_RDPFULLSYNC = 0xE9, - G_SETKEYGB = 0xEA, - G_SETKEYR = 0xEB, - G_SETCONVERT = 0xEC, - G_SETSCISSOR = 0xED, - G_SETPRIMDEPTH = 0xEE, - G_RDPSETOTHERMODE = 0xEF, - G_LOADTLUT = 0xF0, - G_RDPHALF_2 = 0xF1, - G_SETTILESIZE = 0xF2, - G_LOADBLOCK = 0xF3, - G_LOADTILE = 0xF4, - G_SETTILE = 0xF5, - G_FILLRECT = 0xF6, - G_SETFILLCOLOR = 0xF7, - G_SETFOGCOLOR = 0xF8, - G_SETBLENDCOLOR = 0xF9, - G_SETPRIMCOLOR = 0xFA, - G_SETENVCOLOR = 0xFB, - G_SETCOMBINE = 0xFC, - G_SETTIMG = 0xFD, - G_SETZIMG = 0xFE, - G_SETCIMG = 0xFF, -}; - -enum class F3DZEXTexFormats -{ - G_IM_FMT_RGBA, - G_IM_FMT_YUV, - G_IM_FMT_CI, - G_IM_FMT_IA, - G_IM_FMT_I -}; - -enum class F3DZEXTexSizes -{ - G_IM_SIZ_4b, - G_IM_SIZ_8b, - G_IM_SIZ_16b, - G_IM_SIZ_32b -}; - -enum class DListType -{ - F3DZEX, - F3DEX, -}; - -enum class OoTSegments -{ - DirectReference = 0, - TitleStatic = 1, - Scene = 2, - Room = 3, - GameplayKeep = 4, - FieldDungeonKeep = 5, - Object = 6, - LinkAnimation = 7, - IconItemStatic = 8, - IconItem24Static = 9, - Unknown10 = 10, - Unknown11 = 11, - Unknown12 = 12, - IconFieldDungeonStatic = 13, - IconItemLanguageStatic = 14, - ZBuffer = 15, - FrameBuffer = 16, -}; - -#define G_MDSFT_ALPHACOMPARE 0 -#define G_MDSFT_ZSRCSEL 2 -#define G_MDSFT_RENDERMODE 3 -#define G_MDSFT_BLENDER 16 - -#define G_RM_FOG_SHADE_A 0xC8000000 -#define G_RM_FOG_PRIM_A 0xC4000000 -#define G_RM_PASS 0x0C080000 -#define G_RM_AA_ZB_OPA_SURF 0x442078 -#define G_RM_AA_ZB_OPA_SURF2 0x112078 -#define G_RM_AA_ZB_XLU_SURF 0x4049D8 -#define G_RM_AA_ZB_XLU_SURF2 0x1049D8 -#define G_RM_AA_ZB_OPA_DECAL 0x442D58 -#define G_RM_AA_ZB_OPA_DECAL2 0x112D58 -#define G_RM_AA_ZB_XLU_DECAL 0x404DD8 -#define G_RM_AA_ZB_XLU_DECAL2 0x104DD8 -#define G_RM_AA_ZB_OPA_INTER 0x442478 -#define G_RM_AA_ZB_OPA_INTER2 0x112478 -#define G_RM_AA_ZB_XLU_INTER 0x4045D8 -#define G_RM_AA_ZB_XLU_INTER2 0x1045D8 -#define G_RM_AA_ZB_XLU_LINE 0x407858 -#define G_RM_AA_ZB_XLU_LINE2 0x107858 -#define G_RM_AA_ZB_DEC_LINE 0x407F58 -#define G_RM_AA_ZB_DEC_LINE2 0x107F58 -#define G_RM_AA_ZB_TEX_EDGE 0x443078 -#define G_RM_AA_ZB_TEX_EDGE2 0x113078 -#define G_RM_AA_ZB_TEX_INTER 0x443478 -#define G_RM_AA_ZB_TEX_INTER2 0x113478 -#define G_RM_AA_ZB_SUB_SURF 0x442878 -#define G_RM_AA_ZB_SUB_SURF2 0x112278 -#define G_RM_AA_ZB_PCL_SURF 0x40007B -#define G_RM_AA_ZB_PCL_SURF2 0x10007B -#define G_RM_AA_ZB_OPA_TERR 0x402078 -#define G_RM_AA_ZB_OPA_TERR2 0x102078 -#define G_RM_AA_ZB_TEX_TERR 0x403078 -#define G_RM_AA_ZB_TEX_TERR2 0x103078 -#define G_RM_AA_ZB_SUB_TERR 0x402278 -#define G_RM_AA_ZB_SUB_TERR2 0x102278 -#define G_RM_RA_ZB_OPA_SURF 0x442038 -#define G_RM_RA_ZB_OPA_SURF2 0x112038 -#define G_RM_RA_ZB_OPA_DECAL 0x442D18 -#define G_RM_RA_ZB_OPA_DECAL2 0x112D18 -#define G_RM_RA_ZB_OPA_INTER 0x442438 -#define G_RM_RA_ZB_OPA_INTER2 0x112438 -#define G_RM_AA_OPA_SURF 0x442048 -#define G_RM_AA_OPA_SURF2 0x112048 -#define G_RM_AA_XLU_SURF 0x4041C8 -#define G_RM_AA_XLU_SURF2 0x1041C8 -#define G_RM_AA_XLU_LINE 0x407048 -#define G_RM_AA_XLU_LINE2 0x107048 -#define G_RM_AA_DEC_LINE 0x407248 -#define G_RM_AA_DEC_LINE2 0x107248 -#define G_RM_AA_TEX_EDGE 0x443048 -#define G_RM_AA_TEX_EDGE2 0x113048 -#define G_RM_AA_SUB_SURF 0x442248 -#define G_RM_AA_SUB_SURF2 0x112248 -#define G_RM_AA_PCL_SURF 0x40004B -#define G_RM_AA_PCL_SURF2 0x10004B -#define G_RM_AA_OPA_TERR 0x402048 -#define G_RM_AA_OPA_TERR2 0x102048 -#define G_RM_AA_TEX_TERR 0x403048 -#define G_RM_AA_TEX_TERR2 0x103048 -#define G_RM_AA_SUB_TERR 0x402248 -#define G_RM_AA_SUB_TERR2 0x102248 -#define G_RM_RA_OPA_SURF 0x442008 -#define G_RM_RA_OPA_SURF2 0x112008 -#define G_RM_ZB_OPA_SURF 0x442230 -#define G_RM_ZB_OPA_SURF2 0x112230 -#define G_RM_ZB_XLU_SURF 0x404A50 -#define G_RM_ZB_XLU_SURF2 0x104A50 -#define G_RM_ZB_OPA_DECAL 0x442E10 -#define G_RM_ZB_OPA_DECAL2 0x112E10 -#define G_RM_ZB_XLU_DECAL 0x404E50 -#define G_RM_ZB_XLU_DECAL2 0x104E50 -#define G_RM_ZB_CLD_SURF 0x404B50 -#define G_RM_ZB_CLD_SURF2 0x104B50 -#define G_RM_ZB_OVL_SURF 0x404F50 -#define G_RM_ZB_OVL_SURF2 0x104F50 -#define G_RM_ZB_PCL_SURF 0x0C080233 -#define G_RM_ZB_PCL_SURF2 0x03020233 -#define G_RM_OPA_SURF 0x0C084000 -#define G_RM_OPA_SURF2 0x03024000 -#define G_RM_XLU_SURF 0x00404200 -#define G_RM_XLU_SURF2 0x00104240 -#define G_RM_CLD_SURF 0x00404340 -#define G_RM_CLD_SURF2 0x00104340 -#define G_RM_TEX_EDGE 0x0C087008 -#define G_RM_TEX_EDGE2 0x03027008 -#define G_RM_PCL_SURF 0x0C084203 -#define G_RM_PCL_SURF2 0x03024203 -#define G_RM_ADD 0x04484340 -#define G_RM_ADD2 0x01124340 -#define G_RM_NOOP 0x00000000 -#define G_RM_NOOP2 0x00000000 -#define G_RM_VISCVG 0x0C844040 -#define G_RM_VISCVG2 0x03214040 -#define G_RM_OPA_CI 0x0C080000 -#define G_RM_OPA_CI2 0x03020000 - -#define AA_EN 0x8 -#define Z_CMP 0x10 -#define Z_UPD 0x20 -#define IM_RD 0x40 -#define CLR_ON_CVG 0x80 -#define CVG_DST_CLAMP 0 -#define CVG_DST_WRAP 0x100 -#define CVG_DST_FULL 0x200 -#define CVG_DST_SAVE 0x300 -#define ZMODE_OPA 0 -#define ZMODE_INTER 0x400 -#define ZMODE_XLU 0x800 -#define ZMODE_DEC 0xc00 -#define CVG_X_ALPHA 0x1000 -#define ALPHA_CVG_SEL 0x2000 -#define FORCE_BL 0x4000 -#define TEX_EDGE 0x0000 - -class ZDisplayList : public ZResource -{ -protected: - static TextureType TexFormatToTexType(F3DZEXTexFormats fmt, F3DZEXTexSizes siz); - - void ParseF3DZEX(F3DZEXOpcode opcode, uint64_t data, int32_t i, const std::string& prefix, - char* line); - void ParseF3DEX(F3DEXOpcode opcode, uint64_t data, const std::string& prefix, char* line); - - // Various Instruction Optimizations - bool SequenceCheck(std::vector sequence, int32_t startIndex); - int32_t OptimizationChecks(int32_t startIndex, std::string& output, const std::string& prefix); - int32_t OptimizationCheck_LoadTextureBlock(int32_t startIndex, std::string& output, - const std::string& prefix); - // int32_t OptimizationCheck_LoadMultiBlock(int32_t startIndex, std::string& output, std::string - // prefix); - - // F3DEX Specific Opcode Values - void Opcode_F3DEX_G_SETOTHERMODE_L(uint64_t data, char* line); - - // Shared Opcodes between F3DZEX and F3DEX - void Opcode_G_DL(uint64_t data, const std::string& prefix, char* line); - void Opcode_G_MODIFYVTX(uint64_t data, char* line); - void Opcode_G_CULLDL(uint64_t data, char* line); - void Opcode_G_TRI1(uint64_t data, char* line); - void Opcode_G_TRI2(uint64_t data, char* line); - void Opcode_G_MTX(uint64_t data, char* line); - void Opcode_G_VTX(uint64_t data, char* line); - void Opcode_G_TEXTURE(uint64_t data, char* line); - void Opcode_G_SETTIMG(uint64_t data, const std::string& prefix, char* line); - void Opcode_G_SETTILE(uint64_t data, char* line); - void Opcode_G_SETTILESIZE(uint64_t data, const std::string& prefix, char* line); - void Opcode_G_LOADBLOCK(uint64_t data, char* line); - void Opcode_G_SETCOMBINE(uint64_t data, char* line); - void Opcode_G_SETPRIMCOLOR(uint64_t data, char* line); - void Opcode_G_SETOTHERMODE_L(uint64_t data, char* line); - void Opcode_G_SETOTHERMODE_H(uint64_t data, char* line); - void Opcode_G_LOADTLUT(uint64_t data, const std::string& prefix, char* line); - void Opcode_G_ENDDL(const std::string& prefix, char* line); - -public: - std::vector instructions; - - int32_t lastTexWidth, lastTexHeight, lastTexAddr, lastTexSeg; - F3DZEXTexFormats lastTexFmt; - F3DZEXTexSizes lastTexSiz, lastTexSizTest, lastCISiz; - bool lastTexLoaded; - bool lastTexIsPalette; - - DListType dListType; - - std::map> vertices; - std::vector otherDLists; - - ZTexture* lastTexture = nullptr; - ZTexture* lastTlut = nullptr; - - std::vector references; - std::vector mtxList; - - ZDisplayList(ZFile* nParent); - ~ZDisplayList(); - - void ExtractWithXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex) override; - void ExtractFromBinary(uint32_t nRawDataIndex, int32_t rawDataSize); - - void ParseRawData() override; - - Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override; - std::string GetDefaultName(const std::string& prefix) const override; - - void TextureGenCheck(); - static bool TextureGenCheck(int32_t texWidth, int32_t texHeight, uint32_t texAddr, - uint32_t texSeg, F3DZEXTexFormats texFmt, F3DZEXTexSizes texSiz, - bool texLoaded, bool texIsPalette, ZDisplayList* self); - static int32_t GetDListLength(const std::vector& rawData, uint32_t rawDataIndex, - DListType dListType); - - size_t GetRawDataSize() const override; - DeclarationAlignment GetDeclarationAlignment() const override; - void DeclareReferences(const std::string& prefix) override; - std::string ProcessLegacy(const std::string& prefix); - std::string ProcessGfxDis(const std::string& prefix); - - // Combines vertex lists from the vertices map which touch or intersect - void MergeConnectingVertexLists(); - - bool IsExternalResource() const override; - std::string GetExternalExtension() const override; - std::string GetSourceTypeName() const override; - - ZResourceType GetResourceType() const override; - -protected: - size_t numInstructions; -}; diff --git a/tools/ZAPD/ZAPD/ZFile.cpp b/tools/ZAPD/ZAPD/ZFile.cpp deleted file mode 100644 index db2d251a5c..0000000000 --- a/tools/ZAPD/ZAPD/ZFile.cpp +++ /dev/null @@ -1,1434 +0,0 @@ -#include "ZFile.h" - -#include -#include -#include -#include - -#include "Globals.h" -#include "OutputFormatter.h" -#include "Utils/BinaryWriter.h" -#include "Utils/BitConverter.h" -#include "Utils/Directory.h" -#include "Utils/File.h" -#include "Utils/MemoryStream.h" -#include "Utils/Path.h" -#include "Utils/StringHelper.h" -#include "WarningHandler.h" -#include "ZAnimation.h" -#include "ZArray.h" -#include "ZBackground.h" -#include "ZBlob.h" -#include "ZCollision.h" -#include "ZCutscene.h" -#include "ZDisplayList.h" -#include "ZLimb.h" -#include "ZMtx.h" -#include "ZRoom/ZRoom.h" -#include "ZScalar.h" -#include "ZSkeleton.h" -#include "ZSymbol.h" -#include "ZTexture.h" -#include "ZVector.h" -#include "ZVtx.h" - -ZFile::ZFile() -{ - resources = std::vector(); - basePath = ""; - declarations = std::map(); - defines = ""; - baseAddress = 0; - rangeStart = 0x000000000; - rangeEnd = 0xFFFFFFFF; -} - -ZFile::ZFile(const fs::path& nOutPath, const std::string& nName) : ZFile() -{ - name = nName; - outName = nName; - outputPath = nOutPath; -} - -ZFile::ZFile(ZFileMode nMode, tinyxml2::XMLElement* reader, const fs::path& nBasePath, - const fs::path& nOutPath, const std::string& filename, const fs::path& nXmlFilePath) - : ZFile() -{ - xmlFilePath = nXmlFilePath; - if (nBasePath == "") - basePath = Directory::GetCurrentDirectory(); - else - basePath = nBasePath; - - if (nOutPath == "") - outputPath = Directory::GetCurrentDirectory(); - else - outputPath = nOutPath; - - mode = nMode; - - ParseXML(reader, filename); - if (mode != ZFileMode::ExternalFile) - DeclareResourceSubReferences(); -} - -ZFile::~ZFile() -{ - for (ZResource* res : resources) - delete res; - - for (auto d : declarations) - delete d.second; - - for (auto sym : symbolResources) - delete sym.second; -} - -void ZFile::ParseXML(tinyxml2::XMLElement* reader, const std::string& filename) -{ - assert(mode != ZFileMode::Invalid); - - if (filename == "") - name = reader->Attribute("Name"); - else - name = filename; - - outName = name; - const char* outNameXml = reader->Attribute("OutName"); - if (outNameXml != nullptr) - outName = outNameXml; - - // TODO: This should be a variable on the ZFile, but it is a large change in order to force all - // ZResource types to have a parent ZFile. - const char* gameStr = reader->Attribute("Game"); - if (reader->Attribute("Game") != nullptr) - { - if (std::string_view(gameStr) == "MM") - Globals::Instance->game = ZGame::MM_RETAIL; - else if (std::string_view(gameStr) == "SW97" || std::string_view(gameStr) == "OOTSW97") - Globals::Instance->game = ZGame::OOT_SW97; - else if (std::string_view(gameStr) == "OOT") - Globals::Instance->game = ZGame::OOT_RETAIL; - else - { - std::string errorHeader = - StringHelper::Sprintf("'Game' type '%s' is not supported.", gameStr); - HANDLE_ERROR_PROCESS(WarningType::InvalidAttributeValue, errorHeader, ""); - } - } - - if (reader->Attribute("BaseAddress") != nullptr) - baseAddress = StringHelper::StrToL(reader->Attribute("BaseAddress"), 16); - - if (mode == ZFileMode::Extract && Globals::Instance->baseAddress != -1) - baseAddress = Globals::Instance->baseAddress; - - if (reader->Attribute("RangeStart") != nullptr) - rangeStart = StringHelper::StrToL(reader->Attribute("RangeStart"), 16); - - if (reader->Attribute("RangeEnd") != nullptr) - rangeEnd = StringHelper::StrToL(reader->Attribute("RangeEnd"), 16); - - if (rangeStart > rangeEnd) - HANDLE_ERROR_PROCESS( - WarningType::Always, - StringHelper::Sprintf("'RangeStart' 0x%06X must be before 'RangeEnd' 0x%06X", - rangeStart, rangeEnd), - ""); - - const char* segmentXml = reader->Attribute("Segment"); - if (segmentXml != nullptr) - { - if (!StringHelper::HasOnlyDigits(segmentXml)) - { - HANDLE_ERROR_PROCESS(WarningType::Always, - StringHelper::Sprintf("error: Invalid segment value '%s': must be " - "a decimal between 0 and 15 inclusive", - segmentXml), - ""); - } - - segment = StringHelper::StrToL(segmentXml, 10); - if (segment > 15) - { - if (segment == 128) - { -#ifdef DEPRECATION_ON - HANDLE_WARNING_PROCESS( - WarningType::Always, "warning: segment 128 is deprecated.", - "Remove 'Segment=\"128\"' from the xml to use virtual addresses\n"); -#endif - } - else - { - HANDLE_ERROR_PROCESS( - WarningType::Always, - StringHelper::Sprintf("error: invalid segment value '%s': must be a decimal " - "number between 0 and 15 inclusive", - segmentXml), - ""); - } - } - } - Globals::Instance->AddSegment(segment, this); - - if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_INFO) - { - if (segment == 0x80) - { - printf("File '%s' using virtual addresses.\n", GetName().c_str()); - } - else - { - printf("File '%s' using segment %X.\n", GetName().c_str(), segment); - } - } - - const char* segmentDefines = reader->Attribute("Defines"); - if (segmentDefines != NULL) - { - makeDefines = true; - } - - if (mode == ZFileMode::Extract || mode == ZFileMode::ExternalFile) - { - if (!File::Exists((basePath / name).string())) - { - std::string errorHeader = StringHelper::Sprintf("binary file '%s' does not exist.", - (basePath / name).c_str()); - HANDLE_ERROR_PROCESS(WarningType::Always, errorHeader, ""); - } - - rawData = File::ReadAllBytes((basePath / name).string()); - if (mode == ZFileMode::Extract && Globals::Instance->startOffset != -1 && Globals::Instance->endOffset != -1) - rawData = std::vector(rawData.begin() + Globals::Instance->startOffset, - rawData.begin() + Globals::Instance->endOffset); - - if (reader->Attribute("RangeEnd") == nullptr) - rangeEnd = rawData.size(); - } - - std::unordered_set nameSet; - std::unordered_set outNameSet; - std::unordered_set offsetSet; - - auto nodeMap = *GetNodeMap(); - uint32_t rawDataIndex = 0; - - for (tinyxml2::XMLElement* child = reader->FirstChildElement(); child != nullptr; - child = child->NextSiblingElement()) - { - const char* nameXml = child->Attribute("Name"); - const char* outNameXml = child->Attribute("OutName"); - const char* offsetXml = child->Attribute("Offset"); - - // Check for repeated attributes. - if (offsetXml != nullptr) - { - if (!StringHelper::IsValidOffset(std::string_view(offsetXml))) - { - HANDLE_ERROR(WarningType::InvalidXML, - StringHelper::Sprintf("Invalid offset %s entered", offsetXml), ""); - } - rawDataIndex = strtol(offsetXml, NULL, 16); - - if (offsetSet.find(offsetXml) != offsetSet.end()) - { - std::string errorHeader = - StringHelper::Sprintf("repeated 'Offset' attribute: %s", offsetXml); - HANDLE_ERROR_PROCESS(WarningType::InvalidXML, errorHeader, ""); - } - offsetSet.insert(offsetXml); - } - else - { - HANDLE_WARNING_RESOURCE(WarningType::MissingOffsets, this, nullptr, rawDataIndex, - StringHelper::Sprintf("no offset specified for %s.", nameXml), - ""); - } - - if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_INFO) - printf("%s: 0x%06X\n", nameXml, rawDataIndex); - - if (outNameXml != nullptr) - { - if (outNameSet.find(outNameXml) != outNameSet.end()) - { - std::string errorHeader = - StringHelper::Sprintf("repeated 'OutName' attribute: %s", outNameXml); - HANDLE_ERROR_PROCESS(WarningType::InvalidXML, errorHeader, ""); - } - outNameSet.insert(outNameXml); - } - if (nameXml != nullptr) - { - if (nameSet.find(nameXml) != nameSet.end()) - { - std::string errorHeader = - StringHelper::Sprintf("repeated 'Name' attribute: %s", nameXml); - HANDLE_ERROR_PROCESS(WarningType::InvalidXML, errorHeader, ""); - } - nameSet.insert(nameXml); - } - - std::string nodeName = std::string(child->Name()); - - if (nodeMap.find(nodeName) != nodeMap.end()) - { - ZResource* nRes = nodeMap[nodeName](this); - - if (mode == ZFileMode::Extract || mode == ZFileMode::ExternalFile) - nRes->ExtractWithXML(child, rawDataIndex); - - switch (nRes->GetResourceType()) - { - case ZResourceType::Texture: - AddTextureResource(rawDataIndex, static_cast(nRes)); - break; - - case ZResourceType::Symbol: - AddSymbolResource(rawDataIndex, static_cast(nRes)); - break; - - default: - AddResource(nRes); - break; - } - - rawDataIndex += nRes->GetRawDataSize(); - } - else if (std::string_view(child->Name()) == "File") - { - std::string errorHeader = "Can't declare a inside a "; - HANDLE_ERROR_PROCESS(WarningType::InvalidXML, errorHeader, ""); - } - else - { - std::string errorHeader = StringHelper::Sprintf( - "Unknown element found inside a element: %s", nodeName.c_str()); - HANDLE_ERROR_PROCESS(WarningType::InvalidXML, errorHeader, ""); - } - } -} - -void ZFile::DeclareResourceSubReferences() -{ - for (size_t i = 0; i < resources.size(); i++) - { - resources.at(i)->DeclareReferences(name); - } -} - -void ZFile::BuildSourceFile() -{ - if (mode == ZFileMode::ExternalFile) - return; - - if (!Directory::Exists(outputPath)) - Directory::CreateDirectory(outputPath.string()); - - GenerateSourceFiles(); -} - -std::string ZFile::GetName() const -{ - return name; -} - -std::string ZFile::GetOutName() const -{ - return outName.string(); -} - -ZFileMode ZFile::GetMode() const -{ - return mode; -} - -const fs::path& ZFile::GetXmlFilePath() const -{ - return xmlFilePath; -} - -const std::vector& ZFile::GetRawData() const -{ - return rawData; -} - -void ZFile::ExtractResources() -{ - if (mode == ZFileMode::ExternalFile) - return; - - if (!Directory::Exists(outputPath)) - Directory::CreateDirectory(outputPath.string()); - - if (!Directory::Exists(GetSourceOutputFolderPath())) - Directory::CreateDirectory(GetSourceOutputFolderPath().string()); - - for (size_t i = 0; i < resources.size(); i++) - resources[i]->ParseRawDataLate(); - for (size_t i = 0; i < resources.size(); i++) - resources[i]->DeclareReferencesLate(name); - - if (Globals::Instance->genSourceFile) - GenerateSourceFiles(); - - auto memStreamFile = std::shared_ptr(new MemoryStream()); - BinaryWriter writerFile = BinaryWriter(memStreamFile); - - ExporterSet* exporterSet = Globals::Instance->GetExporterSet(); - - if (exporterSet != nullptr && exporterSet->beginFileFunc != nullptr) - exporterSet->beginFileFunc(this); - - for (ZResource* res : resources) - { - auto memStreamRes = std::shared_ptr(new MemoryStream()); - BinaryWriter writerRes = BinaryWriter(memStreamRes); - - if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_INFO) - printf("Saving resource %s\n", res->GetName().c_str()); - - res->Save(outputPath); - - // Check if we have an exporter "registered" for this resource type - ZResourceExporter* exporter = Globals::Instance->GetExporter(res->GetResourceType()); - if (exporter != nullptr) - { - // exporter->Save(res, Globals::Instance->outputPath.string(), &writerFile); - exporter->Save(res, Globals::Instance->outputPath.string(), &writerRes); - } - - if (exporterSet != nullptr && exporterSet->resSaveFunc != nullptr) - exporterSet->resSaveFunc(res, writerRes); - } - - if (memStreamFile->GetLength() > 0) - { - File::WriteAllBytes(StringHelper::Sprintf("%s%s.bin", - Globals::Instance->outputPath.string().c_str(), - GetName().c_str()), - memStreamFile->ToVector()); - } - - writerFile.Close(); - - if (exporterSet != nullptr && exporterSet->endFileFunc != nullptr) - exporterSet->endFileFunc(this); -} - -void ZFile::AddResource(ZResource* res) -{ - resources.push_back(res); -} - -ZResource* ZFile::FindResource(offset_t rawDataIndex) -{ - for (ZResource* res : resources) - { - if (res->GetRawDataIndex() == rawDataIndex) - return res; - } - - return nullptr; -} - -std::vector ZFile::GetResourcesOfType(ZResourceType resType) -{ - std::vector resList; - resList.reserve(resources.size()); - - for (ZResource* res : resources) - { - if (res->GetResourceType() == resType) - resList.push_back(res); - } - - return resList; -} - -Declaration* ZFile::AddDeclaration(offset_t address, DeclarationAlignment alignment, size_t size, - const std::string& varType, const std::string& varName, - const std::string& body) -{ - bool validOffset = DeclarationSanityChecks(address, varName); - if (!validOffset) - return nullptr; - - Declaration* decl = GetDeclaration(address); - if (decl == nullptr) - { - decl = Declaration::Create(address, alignment, size, varType, varName, body); - declarations[address] = decl; - } - else - { - decl->alignment = alignment; - decl->size = size; - decl->declType = varType; - decl->declName = varName; - decl->declBody = body; - } - - return decl; -} - -Declaration* ZFile::AddDeclarationArray(offset_t address, DeclarationAlignment alignment, - size_t size, const std::string& varType, - const std::string& varName, size_t arrayItemCnt, - const std::string& body) -{ - bool validOffset = DeclarationSanityChecks(address, varName); - if (!validOffset) - return nullptr; - - Declaration* decl = GetDeclaration(address); - if (decl == nullptr) - { - decl = Declaration::CreateArray(address, alignment, size, varType, varName, body, - arrayItemCnt); - - declarations[address] = decl; - } - else - { - if (decl->isPlaceholder) - decl->declName = varName; - - decl->alignment = alignment; - decl->size = size; - decl->declType = varType; - decl->isArray = true; - decl->arrayItemCnt = arrayItemCnt; - decl->declBody = body; - } - - return decl; -} - -Declaration* ZFile::AddDeclarationArray(offset_t address, DeclarationAlignment alignment, - size_t size, const std::string& varType, - const std::string& varName, - const std::string& arrayItemCntStr, const std::string& body) -{ - bool validOffset = DeclarationSanityChecks(address, varName); - if (!validOffset) - return nullptr; - - Declaration* decl = GetDeclaration(address); - if (decl == nullptr) - { - decl = Declaration::CreateArray(address, alignment, size, varType, varName, body, - arrayItemCntStr); - - declarations[address] = decl; - } - else - { - decl->alignment = alignment; - decl->size = size; - decl->declType = varType; - decl->declName = varName; - decl->isArray = true; - decl->arrayItemCntStr = arrayItemCntStr; - decl->declBody = body; - } - return decl; -} - -Declaration* ZFile::AddDeclarationPlaceholder(offset_t address, const std::string& varName) -{ - bool validOffset = DeclarationSanityChecks(address, varName); - if (!validOffset) - return nullptr; - - Declaration* decl; - if (declarations.find(address) == declarations.end()) - { - decl = Declaration::CreatePlaceholder(address, varName); - declarations[address] = decl; - } - else - decl = declarations[address]; - - return decl; -} - -Declaration* ZFile::AddDeclarationInclude(offset_t address, const std::string& includePath, - size_t size, const std::string& varType, - const std::string& varName) -{ - bool validOffset = DeclarationSanityChecks(address, varName); - if (!validOffset) - return nullptr; - - Declaration* decl = GetDeclaration(address); - if (decl == nullptr) - { - decl = Declaration::CreateInclude(address, includePath, size, varType, varName); - declarations[address] = decl; - } - else - { - decl->includePath = includePath; - decl->size = size; - decl->declType = varType; - decl->declName = varName; - } - return decl; -} - -Declaration* ZFile::AddDeclarationIncludeArray(offset_t address, std::string& includePath, - size_t size, const std::string& varType, - const std::string& varName, size_t arrayItemCnt) -{ - bool validOffset = DeclarationSanityChecks(address, varName); - if (!validOffset) - return nullptr; - - if (StringHelper::StartsWith(includePath, "assets/extracted/")) - includePath = "assets/" + StringHelper::Split(includePath, "assets/extracted/")[1]; - if (StringHelper::StartsWith(includePath, "assets/custom/")) - includePath = "assets/" + StringHelper::Split(includePath, "assets/custom/")[1]; - // Hack for OOT: don't prefix include paths with extracted/VERSION/ - if (StringHelper::StartsWith(includePath, "extracted/")) { - std::vector parts = StringHelper::Split(includePath, "/"); - parts.erase(parts.begin(), parts.begin() + 2); - includePath = StringHelper::Join(parts, "/"); - } - - Declaration* decl = GetDeclaration(address); - if (decl == nullptr) - { - decl = Declaration::CreateInclude(address, includePath, size, varType, varName); - - decl->isArray = true; - decl->arrayItemCnt = arrayItemCnt; - - declarations[address] = decl; - } - else - { - decl->includePath = includePath; - decl->declType = varType; - decl->declName = varName; - decl->size = size; - decl->isArray = true; - decl->arrayItemCnt = arrayItemCnt; - } - return decl; -} - -Declaration* ZFile::AddDeclarationIncludeArray(offset_t address, std::string& includePath, - size_t size, const std::string& varType, - const std::string& varName, - const std::string& defines, size_t arrayItemCnt) -{ - bool validOffset = DeclarationSanityChecks(address, varName); - if (!validOffset) - return nullptr; - - if (StringHelper::StartsWith(includePath, "assets/extracted/")) - includePath = "assets/" + StringHelper::Split(includePath, "assets/extracted/")[1]; - if (StringHelper::StartsWith(includePath, "assets/custom/")) - includePath = "assets/" + StringHelper::Split(includePath, "assets/custom/")[1]; - // Hack for OOT: don't prefix include paths with extracted/VERSION/ - if (StringHelper::StartsWith(includePath, "extracted/")) { - std::vector parts = StringHelper::Split(includePath, "/"); - parts.erase(parts.begin(), parts.begin() + 2); - includePath = StringHelper::Join(parts, "/"); - } - - Declaration* decl = GetDeclaration(address); - if (decl == nullptr) - { - decl = Declaration::CreateInclude(address, includePath, size, varType, varName, defines); - - decl->isArray = true; - decl->arrayItemCnt = arrayItemCnt; - - declarations[address] = decl; - } - else - { - decl->includePath = includePath; - decl->declType = varType; - decl->declName = varName; - decl->defines = defines; - decl->size = size; - decl->isArray = true; - decl->arrayItemCnt = arrayItemCnt; - } - return decl; -} - -bool ZFile::DeclarationSanityChecks(uint32_t address, const std::string& varName) -{ - assert(GETSEGNUM(address) == 0); - assert(varName != ""); -#ifdef DEVELOPMENT - if (address == 0x0000) - { - [[maybe_unused]] int32_t bp = 0; - } -#endif - - if (!IsOffsetInFileRange(address)) - { - fprintf(stderr, - "%s: Warning in %s\n" - "\t Tried to declare a variable outside of this file's range. Ignoring...\n" - "\t\t Variable's name: %s\n" - "\t\t Variable's offset: 0x%06X\n", - __PRETTY_FUNCTION__, name.c_str(), varName.c_str(), address); - return false; - } - - return true; -} - -bool ZFile::GetDeclarationPtrName(segptr_t segAddress, const std::string& expectedType, - std::string& declName) const -{ - if (segAddress == 0) - { - declName = "NULL"; - return true; - } - - uint32_t offset = Seg2Filespace(segAddress, baseAddress); - Declaration* decl = GetDeclaration(offset); - if (GETSEGNUM(segAddress) != segment || decl == nullptr) - { - declName = StringHelper::Sprintf("0x%08X", segAddress); - return false; - } - - if (expectedType != "" && expectedType != "void*") - { - if (expectedType != decl->declType && "static " + expectedType != decl->declType) - { - declName = StringHelper::Sprintf("0x%08X", segAddress); - return false; - } - } - - if (!decl->isArray) - declName = "&" + decl->declName; - else - declName = decl->declName; - return true; -} - -bool ZFile::GetDeclarationArrayIndexedName(segptr_t segAddress, size_t elementSize, - const std::string& expectedType, - std::string& declName) const -{ - if (segAddress == 0) - { - declName = "NULL"; - return true; - } - - uint32_t address = Seg2Filespace(segAddress, baseAddress); - Declaration* decl = GetDeclarationRanged(address); - if (GETSEGNUM(segAddress) != segment || decl == nullptr || !decl->isArray) - { - declName = StringHelper::Sprintf("0x%08X", segAddress); - return false; - } - - if (expectedType != "" && expectedType != "void*") - { - if (expectedType != decl->declType && "static " + expectedType != decl->declType) - { - declName = StringHelper::Sprintf("0x%08X", segAddress); - return false; - } - } - - if (decl->address == address) - { - declName = decl->declName; - return true; - } - - if ((address - decl->address) % elementSize != 0 || !(address < decl->address + decl->size)) - { - declName = StringHelper::Sprintf("0x%08X", segAddress); - return false; - } - - uint32_t index = (address - decl->address) / elementSize; - declName = StringHelper::Sprintf("&%s[%u]", decl->declName.c_str(), index); - return true; -} - -Declaration* ZFile::GetDeclaration(offset_t address) const -{ - if (declarations.find(address) != declarations.end()) - return declarations.at(address); - - return nullptr; -} - -Declaration* ZFile::GetDeclarationRanged(offset_t address) const -{ - for (const auto decl : declarations) - { - if (address >= decl.first && address < decl.first + decl.second->size) - return decl.second; - } - - return nullptr; -} - -bool ZFile::HasDeclaration(offset_t address) -{ - assert(GETSEGNUM(address) == 0); - return declarations.find(address) != declarations.end(); -} - -size_t ZFile::GetDeclarationSizeFromNeighbor(uint32_t declarationAddress) -{ - auto currentDecl = declarations.find(declarationAddress); - if (currentDecl == declarations.end()) - return 0; - - auto nextDecl = currentDecl; - std::advance(nextDecl, 1); - if (nextDecl == declarations.end()) - return GetRawData().size() - currentDecl->first; - - return nextDecl->first - currentDecl->first; -} - -void ZFile::GenerateSourceFiles() -{ - std::string sourceOutput; - - sourceOutput += "#include \"ultra64.h\"\n"; - sourceOutput += "#include \"z64.h\"\n"; - sourceOutput += "#include \"macros.h\"\n"; - sourceOutput += GetHeaderInclude(); - - bool hasZRoom = false; - for (const auto& res : resources) - { - ZResourceType resType = res->GetResourceType(); - if (resType == ZResourceType::Room || resType == ZResourceType::Scene || - resType == ZResourceType::AltHeader) - { - hasZRoom = true; - break; - } - } - - if (hasZRoom) - { - sourceOutput += GetZRoomHeaderInclude(); - } - - sourceOutput += GetExternalFileHeaderInclude(); - - GeneratePlaceholderDeclarations(); - - // Generate Code - for (size_t i = 0; i < resources.size(); i++) - { - ZResource* res = resources.at(i); - res->GetSourceOutputCode(name); - } - - sourceOutput += ProcessDeclarations(); - - fs::path outPath = GetSourceOutputFolderPath() / outName.stem().concat(".c"); - - if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_INFO) - printf("Writing C file: %s\n", outPath.c_str()); - - OutputFormatter formatter; - formatter.Write(sourceOutput); - - File::WriteAllText(outPath, formatter.GetOutput()); - - GenerateSourceHeaderFiles(); -} - -void ZFile::GenerateSourceHeaderFiles() -{ - OutputFormatter formatter; - - std::string guard = StringHelper::ToUpper(outName.stem().string()); - - formatter.Write( - StringHelper::Sprintf("#ifndef %s_H\n#define %s_H 1\n\n", guard.c_str(), guard.c_str())); - - for (ZResource* res : resources) - { - std::string resSrc = res->GetSourceOutputHeader(""); - formatter.Write(resSrc); - - if (resSrc != "") - formatter.Write("\n"); - } - - for (auto& sym : symbolResources) - { - formatter.Write(sym.second->GetSourceOutputHeader("")); - } - - formatter.Write(ProcessExterns()); - - formatter.Write("#endif\n"); - - fs::path headerFilename = GetSourceOutputFolderPath() / outName.stem().concat(".h"); - - if (Globals::Instance->verbosity >= VerbosityLevel::VERBOSITY_INFO) - printf("Writing H file: %s\n", headerFilename.c_str()); - - File::WriteAllText(headerFilename, formatter.GetOutput()); -} - -std::string ZFile::GetHeaderInclude() const -{ - std::string headers = StringHelper::Sprintf( - "#include \"%s.h\"\n", (outName.parent_path() / outName.stem()).string().c_str()); - - return headers; -} - -std::string ZFile::GetZRoomHeaderInclude() const -{ - std::string headers; - headers += "#include \"segment_symbols.h\"\n"; - headers += "#include \"command_macros_base.h\"\n"; - headers += "#include \"z64cutscene_commands.h\"\n"; - headers += "#include \"variables.h\"\n"; - return headers; -} - -std::string ZFile::GetExternalFileHeaderInclude() const -{ - std::string externalFilesIncludes = ""; - - for (ZFile* externalFile : Globals::Instance->files) - { - if (externalFile != this) - { - fs::path outputFolderPath = externalFile->GetSourceOutputFolderPath(); - if (outputFolderPath == this->GetSourceOutputFolderPath()) - outputFolderPath = externalFile->outName.stem(); - else - outputFolderPath /= externalFile->outName.stem(); - - externalFilesIncludes += - StringHelper::Sprintf("#include \"%s.h\"\n", outputFolderPath.string().c_str()); - } - } - - return externalFilesIncludes; -} - -void ZFile::GeneratePlaceholderDeclarations() -{ - // Generate placeholder declarations - for (ZResource* res : resources) - { - if (GetDeclaration(res->GetRawDataIndex()) != nullptr) - { - continue; - } - - Declaration* decl = res->DeclareVar(GetName(), ""); - decl->staticConf = res->GetStaticConf(); - if (res->GetResourceType() == ZResourceType::Symbol) - { - decl->staticConf = StaticConfig::Off; - } - } -} - -void ZFile::AddTextureResource(uint32_t offset, ZTexture* tex) -{ - for (auto res : resources) - assert(res->GetRawDataIndex() != offset); - - resources.push_back(tex); - texturesResources[offset] = tex; -} - -ZTexture* ZFile::GetTextureResource(uint32_t offset) const -{ - auto tex = texturesResources.find(offset); - if (tex != texturesResources.end()) - return tex->second; - - return nullptr; -} - -void ZFile::AddSymbolResource(uint32_t offset, ZSymbol* sym) -{ - symbolResources[offset] = sym; -} - -ZSymbol* ZFile::GetSymbolResource(uint32_t offset) const -{ - auto sym = symbolResources.find(offset); - if (sym != symbolResources.end()) - return sym->second; - - return nullptr; -} - -ZSymbol* ZFile::GetSymbolResourceRanged(uint32_t offset) const -{ - for (const auto decl : symbolResources) - { - if (offset >= decl.first && offset < decl.first + decl.second->GetRawDataSize()) - return decl.second; - } - - return nullptr; -} - -fs::path ZFile::GetSourceOutputFolderPath() const -{ - return outputPath / outName.parent_path(); -} - -bool ZFile::IsOffsetInFileRange(uint32_t offset) const -{ - if (!(offset < rawData.size())) - return false; - - return rangeStart <= offset && offset < rangeEnd; -} -bool ZFile::IsSegmentedInFilespaceRange(segptr_t segAddress) const -{ - uint8_t segnum = GETSEGNUM(segAddress); - uint32_t offset = Seg2Filespace(segAddress, baseAddress); - - if (segment != segnum) - return false; - - return IsOffsetInFileRange(offset); -} - -std::map* ZFile::GetNodeMap() -{ - static std::map nodeMap; - return &nodeMap; -} - -void ZFile::RegisterNode(std::string nodeName, ZResourceFactoryFunc* nodeFunc) -{ - std::map* nodeMap = GetNodeMap(); - (*nodeMap)[nodeName] = nodeFunc; -} - -std::string ZFile::ProcessDeclarations() -{ - std::string output; - - if (declarations.size() == 0) - return output; - - defines += ProcessTextureIntersections(name); - - // printf("RANGE START: 0x%06X - RANGE END: 0x%06X\n", rangeStart, rangeEnd); - - MergeNeighboringDeclarations(); - - for (std::pair item : declarations) - ProcessDeclarationText(item.second); - - for (std::pair item : declarations) - { - while (item.second->size % 4 != 0) - item.second->size++; - } - - HandleUnaccountedData(); - - // Go through include declarations - // First, handle the prototypes (static only for now) - for (std::pair item : declarations) - { - output += item.second->GetStaticForwardDeclarationStr(); - } - - output += "\n"; - - // Next, output the actual declarations - for (const auto& item : declarations) - { - if (!IsOffsetInFileRange(item.first)) - continue; - - if (item.second->includePath != "") - { - if (item.second->isExternal) - { - // HACK - std::string extType; - - if (item.second->declType == "Gfx") - extType = "dlist"; - else if (item.second->declType == "Vtx") - extType = "vtx"; - - auto filepath = outputPath / item.second->declName; - File::WriteAllText( - StringHelper::Sprintf("%s.%s.inc", filepath.string().c_str(), extType.c_str()), - item.second->declBody); - } - - output += item.second->GetExternalDeclarationStr(); - } - else if (item.second->declType != "") - { - output += item.second->GetNormalDeclarationStr(); - } - } - - return output; -} - -void ZFile::MergeNeighboringDeclarations() -{ - // Optimization: See if there are any arrays side by side that can be merged... - std::vector> declarationKeys(declarations.begin(), - declarations.end()); - - std::pair lastItem = declarationKeys.at(0); - - for (size_t i = 1; i < declarationKeys.size(); i++) - { - std::pair curItem = declarationKeys[i]; - - if (curItem.second->isArray && lastItem.second->isArray) - { - if (curItem.second->declType == lastItem.second->declType) - { - if (!curItem.second->declaredInXml && !lastItem.second->declaredInXml) - { - // TEST: For now just do Vtx declarations... - if (lastItem.second->declType == "Vtx") - { - int32_t sizeDiff = curItem.first - (lastItem.first + lastItem.second->size); - - // Make sure there isn't an unaccounted inbetween these two - if (sizeDiff == 0) - { - lastItem.second->size += curItem.second->size; - lastItem.second->arrayItemCnt += curItem.second->arrayItemCnt; - lastItem.second->declBody += "\n" + curItem.second->declBody; - declarations.erase(curItem.first); - declarationKeys.erase(declarationKeys.begin() + i); - delete curItem.second; - i--; - continue; - } - } - } - } - } - - lastItem = curItem; - } -} - -void ZFile::ProcessDeclarationText(Declaration* decl) -{ - size_t refIndex = 0; - - if (!(decl->references.size() > 0)) - return; - - for (size_t i = 0; i < decl->declBody.size() - 1; i++) - { - char c = decl->declBody[i]; - char c2 = decl->declBody[i + 1]; - - if (c == '@' && c2 == 'r') - { - std::string vtxName; - Globals::Instance->GetSegmentedArrayIndexedName(decl->references[refIndex], 0x10, this, - "Vtx", vtxName); - decl->declBody.replace(i, 2, vtxName); - - refIndex++; - - if (refIndex >= decl->references.size()) - break; - } - } -} - -std::string ZFile::ProcessExterns() -{ - std::string output = ""; - bool hadDefines = true; // Previous declaration included defines. - - for (const auto& item : declarations) - { - if (!IsOffsetInFileRange(item.first)) - { - continue; - } - - std::string itemDefines = item.second->GetDefinesStr(); - // Add a newline above if previous has no defines and this one does. - if (!hadDefines && (itemDefines.length() > 0)) - { - output.push_back('\n'); - } - output += item.second->GetExternStr(); - output += itemDefines; - - // Newline below if this one has defines. - if ((hadDefines = (itemDefines.length() > 0))) - { - output.push_back('\n'); - } - } - - output += defines; - - return output; -} - -std::string ZFile::ProcessTextureIntersections([[maybe_unused]] const std::string& prefix) -{ - if (texturesResources.empty()) - return ""; - - std::string defines; - std::vector> texturesSorted(texturesResources.begin(), - texturesResources.end()); - - for (size_t i = 0; i < texturesSorted.size() - 1; i++) - { - uint32_t currentOffset = texturesSorted[i].first; - uint32_t nextOffset = texturesSorted[i + 1].first; - auto& currentTex = texturesResources.at(currentOffset); - int texSize = currentTex->GetRawDataSize(); - - if (currentTex->WasDeclaredInXml()) - { - // We believe the user is right. - continue; - } - - if ((currentOffset + texSize) > nextOffset) - { - uint32_t offsetDiff = nextOffset - currentOffset; - if (currentTex->isPalette) - { - // Shrink palette so it doesn't overlap - currentTex->SetDimensions(offsetDiff / currentTex->GetPixelMultiplyer(), 1); - declarations.at(currentOffset)->size = currentTex->GetRawDataSize(); - currentTex->DeclareVar(GetName(), ""); - } - else - { - std::string texName; - std::string texNextName; - GetDeclarationPtrName(currentOffset, "", texName); - - Declaration* nextDecl = GetDeclaration(nextOffset); - if (nextDecl == nullptr) - texNextName = texturesResources.at(nextOffset)->GetName(); - else - texNextName = nextDecl->declName; - - defines += StringHelper::Sprintf("#define %s ((u32)%s + 0x%06X)\n", - texNextName.c_str(), texName.c_str(), offsetDiff); - - delete declarations[nextOffset]; - declarations.erase(nextOffset); - texturesResources.erase(nextOffset); - texturesSorted.erase(texturesSorted.begin() + i + 1); - - i--; - } - } - } - - return defines; -} - -void ZFile::HandleUnaccountedData() -{ - uint32_t lastAddr = 0; - uint32_t lastSize = 0; - std::vector declsAddresses; - - declsAddresses.reserve(declarations.size()); - for (const auto& item : declarations) - { - declsAddresses.push_back(item.first); - } - - bool breakLoop = false; - for (offset_t currentAddress : declsAddresses) - { - if (currentAddress >= rangeEnd) - { - breakLoop = true; - break; - } - - if (currentAddress < rangeStart) - { - lastAddr = currentAddress; - continue; - } - - breakLoop = HandleUnaccountedAddress(currentAddress, lastAddr, lastSize); - if (breakLoop) - break; - - lastAddr = currentAddress; - } - - if (!breakLoop) - { - // TODO: change rawData.size() to rangeEnd - // HandleUnaccountedAddress(rangeEnd, lastAddr, lastSize); - HandleUnaccountedAddress(rawData.size(), lastAddr, lastSize); - } -} - -bool ZFile::HandleUnaccountedAddress(offset_t currentAddress, offset_t lastAddr, uint32_t& lastSize) -{ - if (currentAddress != lastAddr && declarations.find(lastAddr) != declarations.end()) - { - Declaration* lastDecl = declarations.at(lastAddr); - lastSize = lastDecl->size; - - if (lastAddr + lastSize > currentAddress) - { - Declaration* currentDecl = declarations.at(currentAddress); - - std::string intersectionInfo = StringHelper::Sprintf( - "Resource from 0x%06X:0x%06X (%s) conflicts with 0x%06X (%s).", lastAddr, - lastAddr + lastSize, lastDecl->declName.c_str(), currentAddress, - currentDecl->declName.c_str()); - HANDLE_WARNING_RESOURCE(WarningType::Intersection, this, nullptr, currentAddress, - "intersection detected", intersectionInfo); - } - } - - uint32_t unaccountedAddress = lastAddr + lastSize; - - if (unaccountedAddress != currentAddress && lastAddr >= rangeStart && - unaccountedAddress < rangeEnd) - { - int diff = currentAddress - unaccountedAddress; - bool nonZeroUnaccounted = false; - - std::string src = " "; - - if (currentAddress > rawData.size()) - { - throw std::runtime_error(StringHelper::Sprintf( - "ZFile::ProcessDeclarations(): Fatal error while processing XML '%s'.\n" - "\t Offset '0x%X' is outside of the limits of file '%s', which has a size of " - "'0x%X'.\n" - "\t Aborting...", - xmlFilePath.c_str(), currentAddress, name.c_str(), rawData.size())); - } - - // Handle Align8 - if (currentAddress % 8 == 0 && diff % 8 != 0) - { - Declaration* currentDecl = GetDeclaration(currentAddress); - - if (currentDecl != nullptr) - { - if (currentDecl->alignment == DeclarationAlignment::Align8) - { - // Check removed bytes are zeroes - if (BitConverter::ToUInt32BE(rawData, unaccountedAddress + diff - 4) == 0) - { - diff -= 4; - } - } - - if (diff == 0) - { - return false; - } - } - } - - for (int i = 0; i < diff; i++) - { - uint8_t val = rawData.at(unaccountedAddress + i); - src += StringHelper::Sprintf("0x%02X, ", val); - if (val != 0x00) - { - nonZeroUnaccounted = true; - } - - if (Globals::Instance->verboseUnaccounted) - { - if ((i % 4 == 3)) - { - src += StringHelper::Sprintf(" // 0x%06X", unaccountedAddress + i - 3); - if (i != (diff - 1)) - { - src += "\n\t"; - } - } - } - else - { - if ((i % 16 == 15) && (i != (diff - 1))) - src += "\n "; - } - } - - if (declarations.find(unaccountedAddress) == declarations.end() && diff > 0) - { - std::string unaccountedPrefix = "unaccounted"; - - if (diff < 16 && !nonZeroUnaccounted) - { - unaccountedPrefix = "possiblePadding"; - - // Strip unnecessary padding at the end of the file. - if (unaccountedAddress + diff >= rawData.size()) - return true; - } - - Declaration* decl = AddDeclarationArray( - unaccountedAddress, DeclarationAlignment::Align4, diff, "u8", - StringHelper::Sprintf("%s_%s_%06X", name.c_str(), unaccountedPrefix.c_str(), - unaccountedAddress), - diff, src); - - decl->isUnaccounted = true; - if (Globals::Instance->forceUnaccountedStatic) - decl->staticConf = StaticConfig::On; - - if (nonZeroUnaccounted) - { - HANDLE_WARNING_RESOURCE(WarningType::Unaccounted, this, nullptr, unaccountedAddress, - "a non-zero unaccounted block was found", - StringHelper::Sprintf("Block size: '0x%X'", diff)); - } - else if (diff >= 16) - { - HANDLE_WARNING_RESOURCE(WarningType::Unaccounted, this, nullptr, unaccountedAddress, - "a big (size>=0x10) zero-only unaccounted block was found", - StringHelper::Sprintf("Block size: '0x%X'", diff)); - } - } - } - - return false; -} diff --git a/tools/ZAPD/ZAPD/ZFile.h b/tools/ZAPD/ZAPD/ZFile.h deleted file mode 100644 index 65b1cc4aa3..0000000000 --- a/tools/ZAPD/ZAPD/ZFile.h +++ /dev/null @@ -1,144 +0,0 @@ -#pragma once - -#include -#include - -#include "ZSymbol.h" -#include "ZTexture.h" -#include "tinyxml2.h" - -enum class ZFileMode -{ - BuildTexture, - BuildOverlay, - BuildBlob, - BuildSourceFile, - BuildBackground, - Extract, - ExternalFile, - Invalid, - Custom = 1000, // Used for exporter file modes -}; - -enum class ZGame -{ - OOT_RETAIL, - OOT_SW97, - MM_RETAIL -}; - -class ZFile -{ -public: - std::map declarations; - std::vector resources; - std::string defines; - - // Default to using virtual addresses - uint32_t segment = 0x80; - uint32_t baseAddress, rangeStart, rangeEnd; - bool isExternalFile = false; - // Whether to make defines for texture dimensions, and possibly more in future - bool makeDefines = false; - - ZFile(const fs::path& nOutPath, const std::string& nName); - ZFile(ZFileMode nMode, tinyxml2::XMLElement* reader, const fs::path& nBasePath, - const fs::path& nOutPath, const std::string& filename, const fs::path& nXmlFilePath); - ~ZFile(); - - std::string GetName() const; - std::string GetOutName() const; - ZFileMode GetMode() const; - const fs::path& GetXmlFilePath() const; - const std::vector& GetRawData() const; - void ExtractResources(); - void BuildSourceFile(); - void AddResource(ZResource* res); - ZResource* FindResource(offset_t rawDataIndex); - std::vector GetResourcesOfType(ZResourceType resType); - - Declaration* AddDeclaration(offset_t address, DeclarationAlignment alignment, size_t size, - const std::string& varType, const std::string& varName, - const std::string& body); - - Declaration* AddDeclarationArray(offset_t address, DeclarationAlignment alignment, size_t size, - const std::string& varType, const std::string& varName, - size_t arrayItemCnt, const std::string& body); - Declaration* AddDeclarationArray(offset_t address, DeclarationAlignment alignment, size_t size, - const std::string& varType, const std::string& varName, - const std::string& arrayItemCntStr, const std::string& body); - - Declaration* AddDeclarationPlaceholder(offset_t address, const std::string& varName); - - Declaration* AddDeclarationInclude(offset_t address, const std::string& includePath, - size_t size, const std::string& varType, - const std::string& varName); - Declaration* AddDeclarationIncludeArray(offset_t address, std::string& includePath, size_t size, - const std::string& varType, const std::string& varName, - size_t arrayItemCnt); - Declaration* AddDeclarationIncludeArray(offset_t address, std::string& includePath, size_t size, - const std::string& varType, const std::string& varName, - const std::string& defines, size_t arrayItemCnt); - - bool GetDeclarationPtrName(segptr_t segAddress, const std::string& expectedType, - std::string& declName) const; - bool GetDeclarationArrayIndexedName(segptr_t segAddress, size_t elementSize, - const std::string& expectedType, - std::string& declName) const; - - Declaration* GetDeclaration(offset_t address) const; - Declaration* GetDeclarationRanged(offset_t address) const; - bool HasDeclaration(offset_t address); - size_t GetDeclarationSizeFromNeighbor(uint32_t declarationAddress); - - std::string GetHeaderInclude() const; - std::string GetZRoomHeaderInclude() const; - std::string GetExternalFileHeaderInclude() const; - - void GeneratePlaceholderDeclarations(); - - void AddTextureResource(uint32_t offset, ZTexture* tex); - ZTexture* GetTextureResource(uint32_t offset) const; - - void AddSymbolResource(uint32_t offset, ZSymbol* sym); - ZSymbol* GetSymbolResource(uint32_t offset) const; - ZSymbol* GetSymbolResourceRanged(uint32_t offset) const; - - fs::path GetSourceOutputFolderPath() const; - - bool IsOffsetInFileRange(uint32_t offset) const; - bool IsSegmentedInFilespaceRange(segptr_t segAddress) const; - - static std::map* GetNodeMap(); - static void RegisterNode(std::string nodeName, ZResourceFactoryFunc* nodeFunc); - -protected: - std::vector rawData; - std::string name; - fs::path outName = ""; - fs::path basePath; - fs::path outputPath; - fs::path xmlFilePath; - - // Keep track of every texture of this ZFile. - // The pointers declared here are "borrowed" (somebody else is the owner), - // so ZFile shouldn't delete/free those textures. - std::map texturesResources; - std::map symbolResources; - ZFileMode mode = ZFileMode::Invalid; - - ZFile(); - void ParseXML(tinyxml2::XMLElement* reader, const std::string& filename); - void DeclareResourceSubReferences(); - void GenerateSourceFiles(); - void GenerateSourceHeaderFiles(); - bool DeclarationSanityChecks(uint32_t address, const std::string& varName); - std::string ProcessDeclarations(); - void MergeNeighboringDeclarations(); - void ProcessDeclarationText(Declaration* decl); - std::string ProcessExterns(); - - std::string ProcessTextureIntersections(const std::string& prefix); - void HandleUnaccountedData(); - bool HandleUnaccountedAddress(offset_t currentAddress, offset_t lastAddr, uint32_t& lastSize); -}; diff --git a/tools/ZAPD/ZAPD/ZLimb.cpp b/tools/ZAPD/ZAPD/ZLimb.cpp deleted file mode 100644 index b3acb940c1..0000000000 --- a/tools/ZAPD/ZAPD/ZLimb.cpp +++ /dev/null @@ -1,412 +0,0 @@ -#include "ZLimb.h" - -#include - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "WarningHandler.h" -#include "ZSkeleton.h" - -REGISTER_ZFILENODE(Limb, ZLimb); - -ZLimb::ZLimb(ZFile* nParent) : ZResource(nParent), segmentStruct(nParent) -{ - RegisterOptionalAttribute("EnumName"); - RegisterOptionalAttribute("LimbType"); - RegisterOptionalAttribute("Type"); -} - -void ZLimb::ExtractFromBinary(uint32_t nRawDataIndex, ZLimbType nType) -{ - rawDataIndex = nRawDataIndex; - type = nType; - - // Don't parse raw data of external files - if (parent->GetMode() == ZFileMode::ExternalFile) - return; - - ParseRawData(); -} - -void ZLimb::ParseXML(tinyxml2::XMLElement* reader) -{ - ZResource::ParseXML(reader); - - auto& enumNameXml = registeredAttributes.at("EnumName").value; - if (enumNameXml != "") - { - enumName = enumNameXml; - } - - // Reading from a - std::string limbType = registeredAttributes.at("LimbType").value; - if (limbType == "") // Reading from a - limbType = registeredAttributes.at("Type").value; - - if (limbType == "") - { - HANDLE_ERROR_RESOURCE(WarningType::MissingAttribute, parent, this, rawDataIndex, - "missing 'LimbType' attribute in ", ""); - } - - type = GetTypeByAttributeName(limbType); - if (type == ZLimbType::Invalid) - { - HANDLE_ERROR_RESOURCE(WarningType::InvalidAttributeValue, parent, this, rawDataIndex, - "invalid value found for 'LimbType' attribute", ""); - } -} - -void ZLimb::ParseRawData() -{ - ZResource::ParseRawData(); - const auto& rawData = parent->GetRawData(); - - if (type == ZLimbType::Curve) - { - childIndex = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0); - siblingIndex = BitConverter::ToUInt8BE(rawData, rawDataIndex + 1); - - dListPtr = BitConverter::ToUInt32BE(rawData, rawDataIndex + 4); - dList2Ptr = BitConverter::ToUInt32BE(rawData, rawDataIndex + 8); - return; - } - if (type == ZLimbType::Legacy) - { - dListPtr = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x00); - legTransX = BitConverter::ToFloatBE(rawData, rawDataIndex + 0x04); - legTransY = BitConverter::ToFloatBE(rawData, rawDataIndex + 0x08); - legTransZ = BitConverter::ToFloatBE(rawData, rawDataIndex + 0x0C); - rotX = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x10); - rotY = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x12); - rotZ = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x14); - childPtr = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x18); - siblingPtr = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x1C); - return; - } - - transX = BitConverter::ToInt16BE(rawData, rawDataIndex + 0); - transY = BitConverter::ToInt16BE(rawData, rawDataIndex + 2); - transZ = BitConverter::ToInt16BE(rawData, rawDataIndex + 4); - - childIndex = rawData.at(rawDataIndex + 6); - siblingIndex = rawData.at(rawDataIndex + 7); - - switch (type) - { - case ZLimbType::LOD: - dList2Ptr = BitConverter::ToUInt32BE(rawData, rawDataIndex + 12); - [[fallthrough]]; - case ZLimbType::Standard: - dListPtr = BitConverter::ToUInt32BE(rawData, rawDataIndex + 8); - break; - - case ZLimbType::Skin: - skinSegmentType = - static_cast(BitConverter::ToInt32BE(rawData, rawDataIndex + 8)); - skinSegment = BitConverter::ToUInt32BE(rawData, rawDataIndex + 12); - if (skinSegmentType == ZLimbSkinType::SkinType_Animated) - { - if (skinSegment != 0 && GETSEGNUM(skinSegment) == parent->segment) - { - uint32_t skinSegmentOffset = Seg2Filespace(skinSegment, parent->baseAddress); - segmentStruct.ExtractFromFile(skinSegmentOffset); - } - } - break; - - case ZLimbType::Curve: - case ZLimbType::Legacy: - break; - - case ZLimbType::Invalid: - assert(!"whoops"); - break; - } -} - -void ZLimb::DeclareReferences(const std::string& prefix) -{ - std::string varPrefix = name; - if (varPrefix == "") - varPrefix = prefix; - - ZResource::DeclareReferences(varPrefix); - - std::string suffix; - switch (type) - { - case ZLimbType::Legacy: - if (childPtr != 0 && GETSEGNUM(childPtr) == parent->segment) - { - uint32_t childOffset = Seg2Filespace(childPtr, parent->baseAddress); - if (!parent->HasDeclaration(childOffset)) - { - ZLimb* child = new ZLimb(parent); - child->ExtractFromBinary(childOffset, ZLimbType::Legacy); - child->DeclareVar(varPrefix, ""); - child->DeclareReferences(varPrefix); - parent->AddResource(child); - } - } - if (siblingPtr != 0 && GETSEGNUM(siblingPtr) == parent->segment) - { - uint32_t siblingdOffset = Seg2Filespace(siblingPtr, parent->baseAddress); - if (!parent->HasDeclaration(siblingdOffset)) - { - ZLimb* sibling = new ZLimb(parent); - sibling->ExtractFromBinary(siblingdOffset, ZLimbType::Legacy); - sibling->DeclareVar(varPrefix, ""); - sibling->DeclareReferences(varPrefix); - parent->AddResource(sibling); - } - } - break; - - case ZLimbType::Curve: - case ZLimbType::LOD: - suffix = "Far"; - if (type == ZLimbType::Curve) - suffix = "Curve2"; - DeclareDList(dList2Ptr, varPrefix, suffix); - [[fallthrough]]; - case ZLimbType::Standard: - suffix = ""; - if (type == ZLimbType::Curve) - suffix = "Curve"; - DeclareDList(dListPtr, varPrefix, suffix); - break; - - case ZLimbType::Skin: - switch (skinSegmentType) - { - case ZLimbSkinType::SkinType_Animated: - if (skinSegment != 0 && GETSEGNUM(skinSegment) == parent->segment) - { - segmentStruct.DeclareReferences(varPrefix); - segmentStruct.GetSourceOutputCode(varPrefix); - } - break; - - case ZLimbSkinType::SkinType_Normal: - DeclareDList(skinSegment, varPrefix, ""); - break; - - default: - break; - } - break; - - case ZLimbType::Invalid: - break; - } -} - -size_t ZLimb::GetRawDataSize() const -{ - switch (type) - { - case ZLimbType::Standard: - case ZLimbType::Curve: - return 0x0C; - - case ZLimbType::LOD: - case ZLimbType::Skin: - return 0x10; - - case ZLimbType::Legacy: - return 0x20; - - case ZLimbType::Invalid: - break; - } - - return 0x0C; -} - -std::string ZLimb::GetBodySourceCode() const -{ - std::string dListStr; - std::string dListStr2; - Globals::Instance->GetSegmentedArrayIndexedName(dListPtr, 8, parent, "Gfx", dListStr); - Globals::Instance->GetSegmentedArrayIndexedName(dList2Ptr, 8, parent, "Gfx", dListStr2); - - std::string entryStr = "\n\t"; - if (type == ZLimbType::Legacy) - { - std::string childName; - std::string siblingName; - Globals::Instance->GetSegmentedPtrName(childPtr, parent, "LegacyLimb", childName); - Globals::Instance->GetSegmentedPtrName(siblingPtr, parent, "LegacyLimb", siblingName); - - entryStr += StringHelper::Sprintf("%s,\n", dListStr.c_str()); - entryStr += - StringHelper::Sprintf("\t{ %ff, %ff, %ff },\n", legTransX, legTransY, legTransZ); - entryStr += StringHelper::Sprintf("\t{ 0x%04X, 0x%04X, 0x%04X },\n", rotX, rotY, rotZ); - entryStr += StringHelper::Sprintf("\t%s,\n", childName.c_str()); - entryStr += StringHelper::Sprintf("\t%s\n", siblingName.c_str()); - } - else - { - std::string childStr; - std::string siblingStr; - if (limbsTable != nullptr) - { - childStr = limbsTable->GetLimbEnumName(childIndex); - siblingStr = limbsTable->GetLimbEnumName(siblingIndex); - } - else - { - childStr = StringHelper::Sprintf("0x%02X", childIndex); - siblingStr = StringHelper::Sprintf("0x%02X", siblingIndex); - } - - if (type != ZLimbType::Curve) - { - entryStr += StringHelper::Sprintf("{ %i, %i, %i }, ", transX, transY, transZ); - } - entryStr += StringHelper::Sprintf("%s, %s,\n", childStr.c_str(), siblingStr.c_str()); - - switch (type) - { - case ZLimbType::Standard: - entryStr += StringHelper::Sprintf("\t%s\n", dListStr.c_str()); - break; - - case ZLimbType::LOD: - case ZLimbType::Curve: - entryStr += - StringHelper::Sprintf("\t{ %s, %s }\n", dListStr.c_str(), dListStr2.c_str()); - break; - - case ZLimbType::Skin: - { - std::string skinSegmentStr; - Globals::Instance->GetSegmentedPtrName(skinSegment, parent, "", skinSegmentStr); - entryStr += - StringHelper::Sprintf("\t0x%02X, %s\n", skinSegmentType, skinSegmentStr.c_str()); - } - break; - - case ZLimbType::Legacy: - break; - - case ZLimbType::Invalid: - break; - } - } - - return entryStr; -} - -std::string ZLimb::GetDefaultName(const std::string& prefix) const -{ - return StringHelper::Sprintf("%sLimb_%06X", prefix.c_str(), rawDataIndex); -} - -std::string ZLimb::GetSourceTypeName() const -{ - return GetSourceTypeName(type); -} - -ZResourceType ZLimb::GetResourceType() const -{ - return ZResourceType::Limb; -} - -ZLimbType ZLimb::GetLimbType() -{ - return type; -} - -void ZLimb::SetLimbType(ZLimbType value) -{ - type = value; -} - -const char* ZLimb::GetSourceTypeName(ZLimbType limbType) -{ - switch (limbType) - { - case ZLimbType::Standard: - return "StandardLimb"; - - case ZLimbType::LOD: - return "LodLimb"; - - case ZLimbType::Skin: - return "SkinLimb"; - - case ZLimbType::Curve: - return "SkelCurveLimb"; - - case ZLimbType::Legacy: - return "LegacyLimb"; - - default: - return "StandardLimb"; - } -} - -ZLimbType ZLimb::GetTypeByAttributeName(const std::string& attrName) -{ - if (attrName == "Standard") - { - return ZLimbType::Standard; - } - if (attrName == "LOD") - { - return ZLimbType::LOD; - } - if (attrName == "Skin") - { - return ZLimbType::Skin; - } - if (attrName == "Curve") - { - return ZLimbType::Curve; - } - if (attrName == "Legacy") - { - return ZLimbType::Legacy; - } - return ZLimbType::Invalid; -} - -void ZLimb::SetLimbIndex(uint8_t nLimbIndex) -{ - limbIndex = nLimbIndex; -} - -void ZLimb::DeclareDList(segptr_t dListSegmentedPtr, const std::string& prefix, - const std::string& limbSuffix) -{ - if (dListSegmentedPtr == 0 || GETSEGNUM(dListSegmentedPtr) != parent->segment) - return; - - uint32_t dlistOffset = Seg2Filespace(dListSegmentedPtr, parent->baseAddress); - if (parent->HasDeclaration(dlistOffset)) - return; - - if (!parent->IsOffsetInFileRange(dlistOffset) || dlistOffset >= parent->GetRawData().size()) - return; - - std::string dlistName; - bool declFound = Globals::Instance->GetSegmentedArrayIndexedName(dListSegmentedPtr, 8, parent, - "Gfx", dlistName, false); - if (declFound) - return; - - int32_t dlistLength = ZDisplayList::GetDListLength( - parent->GetRawData(), dlistOffset, - Globals::Instance->game == ZGame::OOT_SW97 ? DListType::F3DEX : DListType::F3DZEX); - ZDisplayList* dlist = new ZDisplayList(parent); - dlist->ExtractFromBinary(dlistOffset, dlistLength); - - std::string dListStr = - StringHelper::Sprintf("%s%sDL_%06X", prefix.c_str(), limbSuffix.c_str(), dlistOffset); - dlist->SetName(dListStr); - dlist->DeclareVar(prefix, ""); - parent->AddResource(dlist); -} diff --git a/tools/ZAPD/ZAPD/ZLimb.h b/tools/ZAPD/ZAPD/ZLimb.h deleted file mode 100644 index 52919bed92..0000000000 --- a/tools/ZAPD/ZAPD/ZLimb.h +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once - -#include -#include -#include - -#include "OtherStructs/SkinLimbStructs.h" -#include "ZDisplayList.h" -#include "ZFile.h" - -enum class ZLimbType -{ - Invalid, - Standard, - LOD, - Skin, - Curve, - Legacy, -}; - -class ZLimbTable; - -class ZLimb : public ZResource -{ -public: - std::string enumName; - ZLimbTable* limbsTable = nullptr; // borrowed pointer, do not delete! - - ZLimbType type = ZLimbType::Standard; - - ZLimbSkinType skinSegmentType = ZLimbSkinType::SkinType_Null; // Skin only - segptr_t skinSegment = 0; // Skin only - SkinAnimatedLimbData segmentStruct; // Skin only - - // Legacy only - float legTransX, legTransY, legTransZ; // Vec3f - uint16_t rotX, rotY, rotZ; // Vec3s - segptr_t childPtr; // LegacyLimb* - segptr_t siblingPtr; // LegacyLimb* - - segptr_t dListPtr = 0; - segptr_t dList2Ptr = 0; // LOD and Curve Only - - int16_t transX, transY, transZ; - uint8_t childIndex, siblingIndex; - - uint8_t limbIndex = 0; - - ZLimb(ZFile* nParent); - - void ExtractFromBinary(uint32_t nRawDataIndex, ZLimbType nType); - - void ParseXML(tinyxml2::XMLElement* reader) override; - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - std::string GetDefaultName(const std::string& prefix) const override; - - size_t GetRawDataSize() const override; - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - ZLimbType GetLimbType(); - void SetLimbType(ZLimbType value); - static const char* GetSourceTypeName(ZLimbType limbType); - static ZLimbType GetTypeByAttributeName(const std::string& attrName); - - void SetLimbIndex(uint8_t nLimbIndex); - -protected: - void DeclareDList(segptr_t dListSegmentedPtr, const std::string& prefix, - const std::string& limbSuffix); -}; diff --git a/tools/ZAPD/ZAPD/ZMtx.cpp b/tools/ZAPD/ZAPD/ZMtx.cpp deleted file mode 100644 index b9ca3f22d2..0000000000 --- a/tools/ZAPD/ZAPD/ZMtx.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include "ZMtx.h" - -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "ZFile.h" - -REGISTER_ZFILENODE(Mtx, ZMtx); - -ZMtx::ZMtx(ZFile* nParent) : ZResource(nParent) -{ -} - -void ZMtx::ParseRawData() -{ - ZResource::ParseRawData(); - - const auto& rawData = parent->GetRawData(); - for (size_t i = 0; i < 4; ++i) - for (size_t j = 0; j < 4; ++j) - mtx[i][j] = BitConverter::ToInt32BE(rawData, rawDataIndex + (i * 4 + j) * 4); -} - -size_t ZMtx::GetRawDataSize() const -{ - return 64; -} - -std::string ZMtx::GetBodySourceCode() const -{ - std::string bodyStr = "\n"; - - for (const auto& row : mtx) - { - bodyStr += " "; - - for (int32_t val : row) - bodyStr += StringHelper::Sprintf("%-11i, ", val); - - bodyStr += "\n"; - } - - return bodyStr; -} - -std::string ZMtx::GetSourceTypeName() const -{ - return "Mtx"; -} - -ZResourceType ZMtx::GetResourceType() const -{ - return ZResourceType::Mtx; -} - -DeclarationAlignment ZMtx::GetDeclarationAlignment() const -{ - return DeclarationAlignment::Align8; -} diff --git a/tools/ZAPD/ZAPD/ZMtx.h b/tools/ZAPD/ZAPD/ZMtx.h deleted file mode 100644 index eed502374b..0000000000 --- a/tools/ZAPD/ZAPD/ZMtx.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include -#include -#include "ZResource.h" - -class ZMtx : public ZResource -{ -public: - ZMtx(ZFile* nParent); - - void ParseRawData() override; - - std::string GetBodySourceCode() const override; - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - size_t GetRawDataSize() const override; - DeclarationAlignment GetDeclarationAlignment() const override; - -protected: - std::array, 4> mtx; -}; diff --git a/tools/ZAPD/ZAPD/ZPath.cpp b/tools/ZAPD/ZAPD/ZPath.cpp deleted file mode 100644 index cb8295679f..0000000000 --- a/tools/ZAPD/ZAPD/ZPath.cpp +++ /dev/null @@ -1,218 +0,0 @@ -#include "ZPath.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "WarningHandler.h" -#include "ZFile.h" - -REGISTER_ZFILENODE(Path, ZPath); // Old name that is being kept for backwards compatability -REGISTER_ZFILENODE(PathList, ZPath); // New name that may be used in future XMLs - -ZPath::ZPath(ZFile* nParent) : ZResource(nParent) -{ - numPaths = 1; - RegisterOptionalAttribute("NumPaths", "1"); -} - -void ZPath::ParseXML(tinyxml2::XMLElement* reader) -{ - ZResource::ParseXML(reader); - - numPaths = StringHelper::StrToL(registeredAttributes.at("NumPaths").value); - - if (numPaths < 1) - { - HANDLE_ERROR_RESOURCE( - WarningType::InvalidAttributeValue, parent, this, rawDataIndex, - StringHelper::Sprintf("invalid value '%d' found for 'NumPaths' attribute", numPaths), - "Should be at least '1'"); - } -} - -void ZPath::ParseRawData() -{ - ZResource::ParseRawData(); - - uint32_t currentPtr = rawDataIndex; - - pathways.reserve(numPaths); - for (size_t pathIndex = 0; pathIndex < numPaths; pathIndex++) - { - PathwayEntry path(parent); - path.ExtractFromFile(currentPtr); - - if (path.GetListAddress() == 0) - break; - - currentPtr += path.GetRawDataSize(); - pathways.push_back(path); - } -} - -void ZPath::DeclareReferences(const std::string& prefix) -{ - ZResource::DeclareReferences(prefix); - - for (auto& entry : pathways) - entry.DeclareReferences(prefix); -} - -Declaration* ZPath::DeclareVar(const std::string& prefix, const std::string& bodyStr) -{ - std::string auxName = name; - - if (name == "") - auxName = GetDefaultName(prefix); - - Declaration* decl = - parent->AddDeclarationArray(rawDataIndex, GetDeclarationAlignment(), GetRawDataSize(), - GetSourceTypeName(), name, pathways.size(), bodyStr); - decl->staticConf = staticConf; - return decl; -} - -std::string ZPath::GetBodySourceCode() const -{ - std::string declaration; - - size_t index = 0; - for (const auto& entry : pathways) - { - declaration += StringHelper::Sprintf("\t{ %s },", entry.GetBodySourceCode().c_str()); - - if (index < pathways.size() - 1) - declaration += "\n"; - - index++; - } - - return declaration; -} - -std::string ZPath::GetSourceTypeName() const -{ - return "Path"; -} - -ZResourceType ZPath::GetResourceType() const -{ - return ZResourceType::Path; -} - -size_t ZPath::GetRawDataSize() const -{ - return pathways.size() * pathways.at(0).GetRawDataSize(); -} - -void ZPath::SetNumPaths(uint32_t nNumPaths) -{ - numPaths = nNumPaths; -} - -/* PathwayEntry */ - -PathwayEntry::PathwayEntry(ZFile* nParent) : ZResource(nParent) -{ -} - -void PathwayEntry::ParseRawData() -{ - ZResource::ParseRawData(); - auto parentRawData = parent->GetRawData(); - numPoints = parentRawData.at(rawDataIndex + 0); - unk1 = parentRawData.at(rawDataIndex + 1); - unk2 = BitConverter::ToInt16BE(parentRawData, rawDataIndex + 2); - listSegmentAddress = BitConverter::ToInt32BE(parentRawData, rawDataIndex + 4); - - uint32_t currentPtr = GETSEGOFFSET(listSegmentAddress); - - points.reserve(numPoints); - for (int32_t i = 0; i < numPoints; i++) - { - ZVector vec(parent); - vec.ExtractFromBinary(currentPtr, ZScalarType::ZSCALAR_S16, 3); - - currentPtr += vec.GetRawDataSize(); - points.push_back(vec); - } -} - -void PathwayEntry::DeclareReferences(const std::string& prefix) -{ - ZResource::DeclareReferences(prefix); - if (points.empty()) - return; - - std::string pointsName; - bool addressFound = Globals::Instance->GetSegmentedPtrName(listSegmentAddress, parent, "Vec3s", - pointsName, false); - if (addressFound) - return; - - std::string declaration = ""; - - size_t index = 0; - for (const auto& point : points) - { - declaration += StringHelper::Sprintf("\t{ %s },", point.GetBodySourceCode().c_str()); - - if (index < points.size() - 1) - declaration += "\n"; - - index++; - } - - uint32_t pointsOffset = Seg2Filespace(listSegmentAddress, parent->baseAddress); - Declaration* decl = parent->GetDeclaration(pointsOffset); - if (decl == nullptr) - { - pointsName = StringHelper::Sprintf("%sPathwayList_%06X", prefix.c_str(), pointsOffset); - parent->AddDeclarationArray(pointsOffset, points.at(0).GetDeclarationAlignment(), - points.size() * 6, points.at(0).GetSourceTypeName(), pointsName, - points.size(), declaration); - } - else - decl->declBody = declaration; -} - -std::string PathwayEntry::GetBodySourceCode() const -{ - std::string declaration; - std::string listName; - Globals::Instance->GetSegmentedPtrName(listSegmentAddress, parent, "Vec3s", listName); - - if (Globals::Instance->game == ZGame::MM_RETAIL) - declaration += - StringHelper::Sprintf("%i, %i, %i, %s", numPoints, unk1, unk2, listName.c_str()); - else - { - if (numPoints > 0) - declaration += - StringHelper::Sprintf("ARRAY_COUNT(%s), %s", listName.c_str(), listName.c_str()); - else - declaration += StringHelper::Sprintf("%i, %s", numPoints, listName.c_str()); - } - - return declaration; -} - -std::string PathwayEntry::GetSourceTypeName() const -{ - return "Path"; -} - -ZResourceType PathwayEntry::GetResourceType() const -{ - return ZResourceType::Path; -} - -size_t PathwayEntry::GetRawDataSize() const -{ - return 0x08; -} - -segptr_t PathwayEntry::GetListAddress() const -{ - return listSegmentAddress; -} diff --git a/tools/ZAPD/ZAPD/ZPath.h b/tools/ZAPD/ZAPD/ZPath.h deleted file mode 100644 index e519decff4..0000000000 --- a/tools/ZAPD/ZAPD/ZPath.h +++ /dev/null @@ -1,51 +0,0 @@ -#pragma once - -#include "ZResource.h" -#include "ZVector.h" - -class PathwayEntry : public ZResource -{ -public: - PathwayEntry(ZFile* nParent); - - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - size_t GetRawDataSize() const override; - segptr_t GetListAddress() const; - -protected: - int32_t numPoints; - int8_t unk1; // (MM Only) - int16_t unk2; // (MM Only) - segptr_t listSegmentAddress; - std::vector points; -}; - -class ZPath : public ZResource -{ -public: - ZPath(ZFile* nParent); - - void ParseXML(tinyxml2::XMLElement* reader) override; - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override; - std::string GetBodySourceCode() const override; - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - size_t GetRawDataSize() const override; - void SetNumPaths(uint32_t nNumPaths); - -protected: - uint32_t numPaths; - std::vector pathways; -}; diff --git a/tools/ZAPD/ZAPD/ZPlayerAnimationData.cpp b/tools/ZAPD/ZAPD/ZPlayerAnimationData.cpp deleted file mode 100644 index ce5425d7e1..0000000000 --- a/tools/ZAPD/ZAPD/ZPlayerAnimationData.cpp +++ /dev/null @@ -1,104 +0,0 @@ -#include "ZPlayerAnimationData.h" - -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "ZFile.h" - -REGISTER_ZFILENODE(PlayerAnimationData, ZPlayerAnimationData); - -ZPlayerAnimationData::ZPlayerAnimationData(ZFile* nParent) : ZResource(nParent) -{ - RegisterRequiredAttribute("FrameCount"); -} - -void ZPlayerAnimationData::ParseXML(tinyxml2::XMLElement* reader) -{ - ZResource::ParseXML(reader); - - std::string& frameCountXml = registeredAttributes.at("FrameCount").value; - - frameCount = StringHelper::StrToL(frameCountXml); -} - -void ZPlayerAnimationData::ParseRawData() -{ - ZResource::ParseRawData(); - - const auto& rawData = parent->GetRawData(); - - size_t totalSize = GetRawDataSize(); - // Divided by 2 because each value is an s16 - limbRotData.reserve(totalSize * frameCount / 2); - - for (size_t i = 0; i < totalSize; i += 2) - { - limbRotData.push_back(BitConverter::ToInt16BE(rawData, rawDataIndex + i)); - } -} - -Declaration* ZPlayerAnimationData::DeclareVar(const std::string& prefix, const std::string& bodyStr) -{ - std::string auxName = name; - - if (auxName == "") - auxName = GetDefaultName(prefix); - - Declaration* decl = - parent->AddDeclarationArray(rawDataIndex, GetDeclarationAlignment(), GetRawDataSize(), - GetSourceTypeName(), name, limbRotData.size(), bodyStr); - decl->staticConf = staticConf; - return decl; -} - -std::string ZPlayerAnimationData::GetBodySourceCode() const -{ - std::string declaration = ""; - - size_t index = 0; - for (const auto entry : limbRotData) - { - if (index % 8 == 0) - { - declaration += "\t"; - } - - if (entry < 0) - { - declaration += StringHelper::Sprintf("-0x%04X, ", -entry); - } - else - { - declaration += StringHelper::Sprintf("0x%04X, ", entry); - } - - if ((index + 1) % 8 == 0) - { - declaration += "\n"; - } - - index++; - } - - return declaration; -} - -std::string ZPlayerAnimationData::GetDefaultName(const std::string& prefix) const -{ - return StringHelper::Sprintf("%sPlayerAnimationData_%06X", prefix.c_str(), rawDataIndex); -} - -std::string ZPlayerAnimationData::GetSourceTypeName() const -{ - return "s16"; -} - -ZResourceType ZPlayerAnimationData::GetResourceType() const -{ - return ZResourceType::PlayerAnimationData; -} - -size_t ZPlayerAnimationData::GetRawDataSize() const -{ - // (sizeof(Vec3s) * limbCount + 2) * frameCount - return (6 * 22 + 2) * frameCount; -} diff --git a/tools/ZAPD/ZAPD/ZPlayerAnimationData.h b/tools/ZAPD/ZAPD/ZPlayerAnimationData.h deleted file mode 100644 index 2923117efc..0000000000 --- a/tools/ZAPD/ZAPD/ZPlayerAnimationData.h +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once - -#include -#include - -#include "ZResource.h" - -class ZPlayerAnimationData : public ZResource -{ -public: - int16_t frameCount = 0; - std::vector limbRotData; - - ZPlayerAnimationData(ZFile* nParent); - - void ParseXML(tinyxml2::XMLElement* reader) override; - void ParseRawData() override; - - Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override; - - std::string GetBodySourceCode() const override; - std::string GetDefaultName(const std::string& prefix) const override; - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - size_t GetRawDataSize() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZPointer.cpp b/tools/ZAPD/ZAPD/ZPointer.cpp deleted file mode 100644 index 6e6945cada..0000000000 --- a/tools/ZAPD/ZAPD/ZPointer.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include "ZPointer.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "WarningHandler.h" -#include "ZFile.h" - -REGISTER_ZFILENODE(Pointer, ZPointer); - -ZPointer::ZPointer(ZFile* nParent) : ZResource(nParent) -{ - RegisterRequiredAttribute("Type"); -} - -void ZPointer::ParseXML(tinyxml2::XMLElement* reader) -{ - ZResource::ParseXML(reader); - - type = registeredAttributes.at("Type").value; -} - -void ZPointer::ParseRawData() -{ - auto& rawData = parent->GetRawData(); - - ptr = BitConverter::ToUInt32BE(rawData, rawDataIndex); -} - -std::string ZPointer::GetBodySourceCode() const -{ - std::string ptrName; - - Globals::Instance->GetSegmentedPtrName(ptr, parent, "", ptrName); - - return ptrName; -} - -bool ZPointer::DoesSupportArray() const -{ - return true; -} - -std::string ZPointer::GetSourceTypeName() const -{ - return type + "*"; -} - -ZResourceType ZPointer::GetResourceType() const -{ - return ZResourceType::Pointer; -} - -size_t ZPointer::GetRawDataSize() const -{ - return 0x04; -} diff --git a/tools/ZAPD/ZAPD/ZPointer.h b/tools/ZAPD/ZAPD/ZPointer.h deleted file mode 100644 index 8fb5889339..0000000000 --- a/tools/ZAPD/ZAPD/ZPointer.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include "ZResource.h" - -class ZPointer : public ZResource -{ -public: - segptr_t ptr = SEGMENTED_NULL; - std::string type; - - ZPointer(ZFile* nParent); - - void ParseXML(tinyxml2::XMLElement* reader) override; - void ParseRawData() override; - std::string GetBodySourceCode() const override; - - bool DoesSupportArray() const override; - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - size_t GetRawDataSize() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZResource.cpp b/tools/ZAPD/ZAPD/ZResource.cpp deleted file mode 100644 index d991c46539..0000000000 --- a/tools/ZAPD/ZAPD/ZResource.cpp +++ /dev/null @@ -1,339 +0,0 @@ -#include "ZResource.h" - -#include -#include - -#include "Utils/StringHelper.h" -#include "WarningHandler.h" -#include "ZFile.h" - -ZResource::ZResource(ZFile* nParent) -{ - // assert(nParent != nullptr); - parent = nParent; - name = ""; - outName = ""; - sourceOutput = ""; - rawDataIndex = 0; - outputDeclaration = true; - - RegisterRequiredAttribute("Name"); - RegisterOptionalAttribute("OutName"); - RegisterOptionalAttribute("Offset"); - RegisterOptionalAttribute("Custom"); - RegisterOptionalAttribute("Static", "Global"); -} - -void ZResource::ExtractWithXML(tinyxml2::XMLElement* reader, offset_t nRawDataIndex) -{ - rawDataIndex = nRawDataIndex; - declaredInXml = true; - - if (reader != nullptr) - ParseXML(reader); - - // Don't parse raw data of external files - if (parent->GetMode() != ZFileMode::ExternalFile) - { - ParseRawData(); - CalcHash(); - } - - if (!isInner) - { - Declaration* decl = DeclareVar(parent->GetName(), ""); - if (decl != nullptr) - { - decl->declaredInXml = true; - decl->staticConf = staticConf; - } - } -} - -void ZResource::ExtractFromFile(offset_t nRawDataIndex) -{ - rawDataIndex = nRawDataIndex; - - // Don't parse raw data of external files - if (parent->GetMode() == ZFileMode::ExternalFile) - return; - - ParseRawData(); - CalcHash(); -} - -void ZResource::ParseXML(tinyxml2::XMLElement* reader) -{ - if (reader != nullptr) - { - // If it is an inner node, then 'Name' isn't required - if (isInner) - { - registeredAttributes.at("Name").isRequired = false; - } - - auto attrs = reader->FirstAttribute(); - while (attrs != nullptr) - { - std::string attrName = attrs->Name(); - bool attrDeclared = false; - - if (registeredAttributes.find(attrName) != registeredAttributes.end()) - { - registeredAttributes[attrName].value = attrs->Value(); - registeredAttributes[attrName].wasSet = true; - attrDeclared = true; - } - - if (!attrDeclared) - { - HANDLE_WARNING_RESOURCE( - WarningType::UnknownAttribute, parent, this, rawDataIndex, - StringHelper::Sprintf("unexpected '%s' attribute in resource <%s>", - attrName.c_str(), reader->Name()), - ""); - } - attrs = attrs->Next(); - } - - if (!canHaveInner && !reader->NoChildren()) - { - std::string errorHeader = StringHelper::Sprintf( - "resource '%s' with inner element/child detected", reader->Name()); - HANDLE_ERROR_PROCESS(WarningType::InvalidXML, errorHeader, ""); - } - - for (const auto& attr : registeredAttributes) - { - if (attr.second.isRequired && attr.second.value == "") - { - std::string headerMsg = - StringHelper::Sprintf("missing required attribute '%s' in resource <%s>", - attr.first.c_str(), reader->Name()); - HANDLE_ERROR_RESOURCE(WarningType::MissingAttribute, parent, this, rawDataIndex, - headerMsg, ""); - } - } - - name = registeredAttributes.at("Name").value; - - static std::regex r("[a-zA-Z_]+[a-zA-Z0-9_]*", std::regex::icase | std::regex::optimize); - - if (!isInner || (isInner && name != "")) - { - if (!std::regex_match(name, r)) - { - HANDLE_ERROR_RESOURCE(WarningType::InvalidAttributeValue, parent, this, - rawDataIndex, "invalid value found for 'Name' attribute", ""); - } - } - - outName = registeredAttributes.at("OutName").value; - if (outName == "") - outName = name; - - isCustomAsset = registeredAttributes["Custom"].wasSet; - - std::string& staticXml = registeredAttributes["Static"].value; - if (staticXml == "Global") - { - staticConf = StaticConfig::Global; - } - else if (staticXml == "On") - { - staticConf = StaticConfig::On; - } - else if (staticXml == "Off") - { - staticConf = StaticConfig::Off; - } - else - { - HANDLE_ERROR_RESOURCE( - WarningType::InvalidAttributeValue, parent, this, rawDataIndex, - StringHelper::Sprintf("invalid value '%s' for 'Static' attribute", staticConf), ""); - } - - declaredInXml = true; - } -} - -void ZResource::ParseRawData() -{ -} - -void ZResource::DeclareReferences([[maybe_unused]] const std::string& prefix) -{ -} - -void ZResource::ParseRawDataLate() -{ -} - -void ZResource::DeclareReferencesLate([[maybe_unused]] const std::string& prefix) -{ -} - -Declaration* ZResource::DeclareVar(const std::string& prefix, const std::string& bodyStr) -{ - std::string auxName = name; - - if (name == "") - auxName = GetDefaultName(prefix); - - Declaration* decl = - parent->AddDeclaration(rawDataIndex, GetDeclarationAlignment(), GetRawDataSize(), - GetSourceTypeName(), auxName, bodyStr); - decl->staticConf = staticConf; - return decl; -} - -void ZResource::Save([[maybe_unused]] const fs::path& outFolder) -{ -} - -const std::string& ZResource::GetName() const -{ - return name; -} - -const std::string& ZResource::GetOutName() const -{ - return outName; -} - -void ZResource::SetOutName(const std::string& nName) -{ - outName = nName; -} - -void ZResource::SetName(const std::string& nName) -{ - name = nName; -} - -bool ZResource::IsExternalResource() const -{ - return false; -} - -bool ZResource::DoesSupportArray() const -{ - return false; -} - -std::string ZResource::GetExternalExtension() const -{ - return ""; -} - -DeclarationAlignment ZResource::GetDeclarationAlignment() const -{ - return DeclarationAlignment::Align4; -} - -bool ZResource::WasDeclaredInXml() const -{ - return declaredInXml; -} - -StaticConfig ZResource::GetStaticConf() const -{ - return staticConf; -} - -offset_t ZResource::GetRawDataIndex() const -{ - return rawDataIndex; -} - -void ZResource::SetRawDataIndex(offset_t nRawDataIndex) -{ - rawDataIndex = nRawDataIndex; -} - -std::string ZResource::GetBodySourceCode() const -{ - return "ERROR"; -} - -std::string ZResource::GetDefaultName(const std::string& prefix) const -{ - return StringHelper::Sprintf("%s%s_%06X", prefix.c_str(), GetSourceTypeName().c_str(), - rawDataIndex); -} - -void ZResource::GetSourceOutputCode([[maybe_unused]] const std::string& prefix) -{ - std::string bodyStr = GetBodySourceCode(); - - if (bodyStr != "ERROR") - { - Declaration* decl = parent->GetDeclaration(rawDataIndex); - - if (decl == nullptr || decl->isPlaceholder) - decl = DeclareVar(prefix, bodyStr); - else - decl->declBody = bodyStr; - - decl->staticConf = staticConf; - } -} - -std::string ZResource::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix) -{ - return ""; -} - -ZResourceType ZResource::GetResourceType() const -{ - return ZResourceType::Error; -} - -void ZResource::CalcHash() -{ - hash = 0; -} - -void ZResource::SetInnerNode(bool inner) -{ - isInner = inner; -} - -void ZResource::RegisterRequiredAttribute(const std::string& attr) -{ - ResourceAttribute resAtrr; - resAtrr.key = attr; - resAtrr.isRequired = true; - registeredAttributes[attr] = resAtrr; -} - -void ZResource::RegisterOptionalAttribute(const std::string& attr, const std::string& defaultValue) -{ - ResourceAttribute resAtrr; - resAtrr.key = attr; - resAtrr.value = defaultValue; - registeredAttributes[attr] = resAtrr; -} - -offset_t Seg2Filespace(segptr_t segmentedAddress, uint32_t parentBaseAddress) -{ - offset_t currentPtr = GETSEGOFFSET(segmentedAddress); - - if (GETSEGNUM(segmentedAddress) == 0x80) // Is defined in code? - { - uint32_t parentBaseOffset = GETSEGOFFSET(parentBaseAddress); - if (parentBaseOffset > currentPtr) - { - HANDLE_ERROR(WarningType::Always, - StringHelper::Sprintf( - "resource address 0x%08X is smaller than 'BaseAddress' 0x%08X", - segmentedAddress, parentBaseAddress), - "Maybe your 'BaseAddress' is wrong?"); - } - - currentPtr -= parentBaseOffset; - } - - return currentPtr; -} diff --git a/tools/ZAPD/ZAPD/ZResource.h b/tools/ZAPD/ZAPD/ZResource.h deleted file mode 100644 index 768b785441..0000000000 --- a/tools/ZAPD/ZAPD/ZResource.h +++ /dev/null @@ -1,263 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include "Declaration.h" -#include "Utils/BinaryWriter.h" -#include "Utils/Directory.h" -#include "tinyxml2.h" - -#define SEGMENT_SCENE 2 -#define SEGMENT_ROOM 3 -#define SEGMENT_KEEP 4 -#define SEGMENT_FIELDDANGEON_KEEP 5 -#define SEGMENT_OBJECT 6 -#define SEGMENT_LINKANIMETION 7 - -#define GETSEGOFFSET(x) (x & 0x00FFFFFF) -#define GETSEGNUM(x) ((x >> 24) & 0xFF) - -class ZFile; - -enum class ZResourceType -{ - Error, - ActorList, - Animation, - Array, - AltHeader, - Background, - Blob, - CollisionHeader, - CollisionPoly, - Cutscene, - DisplayList, - Limb, - LimbTable, - Mtx, - Path, - PlayerAnimationData, - Pointer, - Room, - RoomCommand, - Scalar, - Scene, - Skeleton, - String, - SurfaceType, - Symbol, - Texture, - TextureAnimation, - TextureAnimationParams, - Vector, - Vertex, - Waterbox, - KeyFrameFlexLimb, - KeyFrameStandardLimb, - KeyFrameSkel, - KeyFrameAnimation, -}; - -class ResourceAttribute -{ -public: - std::string key; - std::string value; - bool isRequired = false; - bool wasSet = false; -}; - -class ZResource -{ -public: - ZFile* parent; - bool outputDeclaration = true; - uint32_t hash = 0; - - /** - * Constructor. - * Child classes should not declare any other constructor besides this one - */ - ZResource(ZFile* nParent); - virtual ~ZResource() = default; - - /// - /// Extracts/Parsees data from binary file using an XML to provide the needed metadata. - /// - /// XML Node we wish to parse from. - /// The offset within the binary file we are going to parse from as - /// indicated by the "Offset" parameter in the XML. - virtual void ExtractWithXML(tinyxml2::XMLElement* reader, offset_t nRawDataIndex); - - /// - /// Extracts/Parses the needed data straight from a binary without the use of an XML. - /// - /// The offset within the binary file we wish to parse from. - virtual void ExtractFromFile(offset_t nRawDataIndex); - - // Misc - /** - * Parses additional attributes of the XML node. - * Extra attritbutes have to be registered using `RegisterRequiredAttribute` or - * `RegisterOptionalAttribute` in the constructor of the ZResource - */ - virtual void ParseXML(tinyxml2::XMLElement* reader); - /** - * Extracts data from the binary file - */ - virtual void ParseRawData(); - /** - * Declares any data pointed by this resource that has not been declared already. - * For example, a Vtx referenced by a Dlist should be declared here if it wasn't - * declared previously by something else - */ - virtual void DeclareReferences(const std::string& prefix); - virtual void ParseRawDataLate(); - virtual void DeclareReferencesLate(const std::string& prefix); - - /** - * Adds this resource as a Declaration of its parent ZFile - */ - virtual Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr); - /** - * Returns the body of the variable of the extracted resource, without any side-effect - */ - [[nodiscard]] virtual std::string GetBodySourceCode() const; - /** - * Creates an automatically generated variable name for the current resource - */ - [[nodiscard]] virtual std::string GetDefaultName(const std::string& prefix) const; - - virtual void GetSourceOutputCode(const std::string& prefix); - virtual std::string GetSourceOutputHeader(const std::string& prefix); - virtual void CalcHash(); - /** - * Exports the resource to binary format - */ - virtual void Save(const fs::path& outFolder); - - // Properties - /** - * Returns true if the resource will be externalized, and included back to the C file using - * `#include`s - */ - virtual bool IsExternalResource() const; - /** - * Can this type be wrapped in an node? - */ - virtual bool DoesSupportArray() const; - /** - * The type of the resource as a C struct - */ - [[nodiscard]] virtual std::string GetSourceTypeName() const = 0; - /** - * The type in the ZResource enum - */ - [[nodiscard]] virtual ZResourceType GetResourceType() const = 0; - /** - * The filename extension for assets extracted as standalone files - */ - [[nodiscard]] virtual std::string GetExternalExtension() const; - - // Getters/Setters - [[nodiscard]] const std::string& GetName() const; - void SetName(const std::string& nName); - [[nodiscard]] const std::string& GetOutName() const; - void SetOutName(const std::string& nName); - [[nodiscard]] offset_t GetRawDataIndex() const; - void SetRawDataIndex(offset_t nRawDataIndex); - - /** - * The size of the current struct being extracted, not counting data referenced by it - */ - [[nodiscard]] virtual size_t GetRawDataSize() const = 0; - /** - * The alignment of the extracted struct - */ - [[nodiscard]] virtual DeclarationAlignment GetDeclarationAlignment() const; - void SetInnerNode(bool inner); - /** - * Returns `true` if this ZResource was declared using an XML node, - * `false` otherwise (for example, a Vtx extracted indirectly by a DList) - */ - [[nodiscard]] bool WasDeclaredInXml() const; - [[nodiscard]] StaticConfig GetStaticConf() const; - -protected: - std::string name; - std::string outName; - offset_t rawDataIndex; - std::string sourceOutput; - - // Inner is used mostly for nodes - /** - * Is this resource an inner node of another resource? - * (namely inside an ) - */ - bool isInner = false; - /** - * Can this type have an inner node? - */ - bool canHaveInner = false; - - /** - * If set to true, create a reference for the asset in the file, but don't - * actually try to extract it from the file - */ - bool isCustomAsset; - bool declaredInXml = false; - StaticConfig staticConf = StaticConfig::Global; - - // Reading from this XMLs attributes should be performed in the overrided `ParseXML` method. - std::map registeredAttributes; - - // XML attributes registers. - // Registering XML attributes should be done in constructors. - - // The resource needs this attribute. If it is not provided, then the program will throw an - // exception. - void RegisterRequiredAttribute(const std::string& attr); - // Optional attribute. The resource has to do manual checks and manual warnings. It may or may - // not have a value. - void RegisterOptionalAttribute(const std::string& attr, const std::string& defaultValue = ""); -}; - -class ZResourceExporter -{ -public: - ZResourceExporter() = default; - virtual ~ZResourceExporter() = default; - - virtual void Save(ZResource* res, fs::path outPath, BinaryWriter* writer) = 0; -}; - -offset_t Seg2Filespace(segptr_t segmentedAddress, uint32_t parentBaseAddress); - -typedef ZResource*(ZResourceFactoryFunc)(ZFile* nParent); - -#define REGISTER_ZFILENODE(nodeName, zResClass) \ - static ZResource* ZResourceFactory_##zResClass_##nodeName(ZFile* nParent) \ - { \ - return static_cast(new zResClass(nParent)); \ - } \ - \ - class ZRes_##nodeName \ - { \ - public: \ - ZRes_##nodeName() \ - { \ - ZFile::RegisterNode(#nodeName, &ZResourceFactory_##zResClass_##nodeName); \ - } \ - }; \ - static ZRes_##nodeName inst_ZRes_##nodeName - -#define REGISTER_EXPORTER(expFunc) \ - class ZResExp_##expFunc \ - { \ - public: \ - ZResExp_##expFunc() { expFunc(); } \ - }; \ - static ZResExp_##expFunc inst_ZResExp_##expFunc diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/EndMarker.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/EndMarker.cpp deleted file mode 100644 index 3f64af168f..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/EndMarker.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "EndMarker.h" - -EndMarker::EndMarker(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -std::string EndMarker::GetBodySourceCode() const -{ - return "SCENE_CMD_END()"; -} - -std::string EndMarker::GetCommandCName() const -{ - return "SCmdEndMarker"; -} - -RoomCommand EndMarker::GetRoomCommand() const -{ - return RoomCommand::EndMarker; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/EndMarker.h b/tools/ZAPD/ZAPD/ZRoom/Commands/EndMarker.h deleted file mode 100644 index daa477c945..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/EndMarker.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include "ZRoom/ZRoomCommand.h" - -class EndMarker : public ZRoomCommand -{ -public: - EndMarker(ZFile* nParent); - - std::string GetBodySourceCode() const override; - std::string GetCommandCName() const override; - RoomCommand GetRoomCommand() const override; -}; \ No newline at end of file diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetActorList.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetActorList.cpp deleted file mode 100644 index 4d16f9377e..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetActorList.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include "SetActorList.h" - -#include - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "ZRoom/ZRoom.h" - -SetActorList::SetActorList(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -void SetActorList::ParseRawData() -{ - ZRoomCommand::ParseRawData(); - numActors = cmdArg1; - - actorList = new ZActorList(parent); - actorList->ExtractFromBinary(segmentOffset, numActors); -} - -void SetActorList::DeclareReferences(const std::string& prefix) -{ - if (parent->HasDeclaration(segmentOffset)) - { - delete actorList; - actorList = static_cast(parent->FindResource(segmentOffset)); - assert(actorList != nullptr); - assert(actorList->GetResourceType() == ZResourceType::ActorList); - return; - } - - if (actorList->GetName() == "") - { - actorList->SetName(actorList->GetDefaultName(prefix)); - } - actorList->DeclareVar(prefix, ""); - parent->AddResource(actorList); -} - -std::string SetActorList::GetBodySourceCode() const -{ - std::string listName; - Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "ActorEntry", listName); - - return StringHelper::Sprintf("SCENE_CMD_ACTOR_LIST(%i, %s)", numActors, listName.c_str()); -} - -std::string SetActorList::GetCommandCName() const -{ - return "SCmdActorList"; -} - -RoomCommand SetActorList::GetRoomCommand() const -{ - return RoomCommand::SetActorList; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetActorList.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetActorList.h deleted file mode 100644 index 9122c15bb0..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetActorList.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include "ZActorList.h" -#include "ZRoom/ZRoomCommand.h" - -class SetActorList : public ZRoomCommand -{ -public: - uint32_t numActors; - ZActorList* actorList = nullptr; - - SetActorList(ZFile* nParent); - - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - RoomCommand GetRoomCommand() const override; - std::string GetCommandCName() const override; - -protected: - size_t GetActorListArraySize() const; -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetAlternateHeaders.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetAlternateHeaders.cpp deleted file mode 100644 index e64b855374..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetAlternateHeaders.cpp +++ /dev/null @@ -1,82 +0,0 @@ -#include "SetAlternateHeaders.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "ZFile.h" - -SetAlternateHeaders::SetAlternateHeaders(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -void SetAlternateHeaders::DeclareReferences([[maybe_unused]] const std::string& prefix) -{ - if (cmdArg2 != 0) - { - std::string varName = - StringHelper::Sprintf("%sAlternateHeaders0x%06X", prefix.c_str(), segmentOffset); - parent->AddDeclarationPlaceholder(segmentOffset, varName); - } -} - -void SetAlternateHeaders::ParseRawDataLate() -{ - size_t numHeaders = zRoom->parent->GetDeclarationSizeFromNeighbor(segmentOffset) / 4; - - headers.reserve(numHeaders); - for (uint32_t i = 0; i < numHeaders; i++) - { - int32_t address = BitConverter::ToInt32BE(parent->GetRawData(), segmentOffset + (i * 4)); - headers.push_back(address); - - if (address != 0 && parent->GetDeclaration(GETSEGOFFSET(address)) == nullptr) - { - ZRoom* altheader = new ZRoom(parent); - altheader->ExtractFromBinary(GETSEGOFFSET(address), zRoom->GetResourceType()); - altheader->DeclareReferences(parent->GetName()); - - parent->resources.push_back(altheader); - } - } -} - -void SetAlternateHeaders::DeclareReferencesLate(const std::string& prefix) -{ - if (!headers.empty()) - { - std::string declaration; - - for (size_t i = 0; i < headers.size(); i++) - { - std::string altHeaderName; - Globals::Instance->GetSegmentedPtrName(headers.at(i), parent, "", altHeaderName); - - declaration += StringHelper::Sprintf("\t%s,", altHeaderName.c_str()); - - if (i + 1 < headers.size()) - declaration += "\n"; - } - - std::string varName = - StringHelper::Sprintf("%sAlternateHeaders0x%06X", prefix.c_str(), segmentOffset); - parent->AddDeclarationArray(segmentOffset, GetDeclarationAlignment(), headers.size() * 4, - "SceneCmd*", varName, headers.size(), declaration); - } -} - -std::string SetAlternateHeaders::GetBodySourceCode() const -{ - std::string listName; - Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "SceneCmd*", listName); - return StringHelper::Sprintf("SCENE_CMD_ALTERNATE_HEADER_LIST(%s)", listName.c_str()); -} - -std::string SetAlternateHeaders::GetCommandCName() const -{ - return "SCmdAltHeaders"; -} - -RoomCommand SetAlternateHeaders::GetRoomCommand() const -{ - return RoomCommand::SetAlternateHeaders; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetAlternateHeaders.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetAlternateHeaders.h deleted file mode 100644 index e66df936d5..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetAlternateHeaders.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include "ZRoom/ZRoom.h" -#include "ZRoom/ZRoomCommand.h" - -class SetAlternateHeaders : public ZRoomCommand -{ -public: - std::vector headers; - - SetAlternateHeaders(ZFile* nParent); - - void DeclareReferences(const std::string& prefix) override; - void ParseRawDataLate() override; - void DeclareReferencesLate(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - RoomCommand GetRoomCommand() const override; - std::string GetCommandCName() const override; - -private: -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetAnimatedMaterialList.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetAnimatedMaterialList.cpp deleted file mode 100644 index 0b9a67e0ec..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetAnimatedMaterialList.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/** - * File: SetAnimatedMaterialList.cpp - * Description: Defines a class SetAnimatedMaterialList to enable ZRoom to declare - * ZTextureAnimations, using that ZResource to do the work. - */ -#include "SetAnimatedMaterialList.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "ZFile.h" -#include "ZRoom/ZRoom.h" -#include "ZTextureAnimation.h" - -SetAnimatedMaterialList::SetAnimatedMaterialList(ZFile* nParent) - : ZRoomCommand(nParent), textureAnimation(nParent) -{ -} - -void SetAnimatedMaterialList::ParseRawData() -{ - ZRoomCommand::ParseRawData(); - textureAnimation.ExtractFromFile(segmentOffset); -} - -void SetAnimatedMaterialList::DeclareReferences(const std::string& prefix) -{ - textureAnimation.SetName(textureAnimation.GetDefaultName(prefix.c_str())); - textureAnimation.DeclareReferences(prefix); - textureAnimation.GetSourceOutputCode(prefix); -} - -std::string SetAnimatedMaterialList::GetBodySourceCode() const -{ - std::string listName; - Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "AnimatedMaterial", listName); - return StringHelper::Sprintf("SCENE_CMD_ANIMATED_MATERIAL_LIST(%s)", listName.c_str()); -} - -std::string SetAnimatedMaterialList::GetCommandCName() const -{ - return "SCmdTextureAnimations"; -} - -RoomCommand SetAnimatedMaterialList::GetRoomCommand() const -{ - return RoomCommand::SetAnimatedMaterialList; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetAnimatedMaterialList.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetAnimatedMaterialList.h deleted file mode 100644 index 3dbbf9684a..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetAnimatedMaterialList.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include "ZRoom/ZRoomCommand.h" -#include "ZTextureAnimation.h" - -class SetAnimatedMaterialList : public ZRoomCommand -{ -public: - SetAnimatedMaterialList(ZFile* nParent); - - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - RoomCommand GetRoomCommand() const override; - std::string GetCommandCName() const override; - -private: - ZTextureAnimation textureAnimation; -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetCameraSettings.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetCameraSettings.cpp deleted file mode 100644 index e30e1b682d..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetCameraSettings.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "SetCameraSettings.h" - -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "Globals.h" - -SetCameraSettings::SetCameraSettings(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -void SetCameraSettings::ParseRawData() -{ - ZRoomCommand::ParseRawData(); - cameraMovement = cmdArg1; - mapHighlight = BitConverter::ToUInt32BE(parent->GetRawData(), rawDataIndex + 4); -} - -std::string SetCameraSettings::GetBodySourceCode() const -{ - if (Globals::Instance->game == ZGame::MM_RETAIL) - return StringHelper::Sprintf("SCENE_CMD_SET_REGION_VISITED(0x%02X, 0x%08X)", cameraMovement, - mapHighlight); - else - return StringHelper::Sprintf("SCENE_CMD_MISC_SETTINGS(0x%02X, 0x%08X)", cameraMovement, - mapHighlight); -} - -std::string SetCameraSettings::GetCommandCName() const -{ - return "SCmdMiscSettings"; -} - -RoomCommand SetCameraSettings::GetRoomCommand() const -{ - return RoomCommand::SetCameraSettings; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetCameraSettings.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetCameraSettings.h deleted file mode 100644 index a8fed44ec2..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetCameraSettings.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include "ZRoom/ZRoomCommand.h" - -class SetCameraSettings : public ZRoomCommand -{ -public: - uint8_t cameraMovement; - uint32_t mapHighlight; - - SetCameraSettings(ZFile* nParent); - - void ParseRawData() override; - - std::string GetBodySourceCode() const override; - - std::string GetCommandCName() const override; - RoomCommand GetRoomCommand() const override; - -private: -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetCollisionHeader.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetCollisionHeader.cpp deleted file mode 100644 index 03aaa4bbbc..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetCollisionHeader.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "SetCollisionHeader.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "ZFile.h" -#include "ZRoom/ZRoom.h" - -SetCollisionHeader::SetCollisionHeader(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -void SetCollisionHeader::ParseRawData() -{ - ZRoomCommand::ParseRawData(); - - collisionHeader = new ZCollisionHeader(parent); - collisionHeader->SetName( - StringHelper::Sprintf("%sCollisionHeader_%06X", parent->GetName().c_str(), segmentOffset)); - collisionHeader->ExtractFromFile(segmentOffset); - parent->AddResource(collisionHeader); -} - -void SetCollisionHeader::DeclareReferences(const std::string& prefix) -{ - collisionHeader->DeclareVar(prefix, ""); -} - -std::string SetCollisionHeader::GetBodySourceCode() const -{ - std::string listName; - Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "CollisionHeader", listName); - return StringHelper::Sprintf("SCENE_CMD_COL_HEADER(%s)", listName.c_str()); -} - -std::string SetCollisionHeader::GetCommandCName() const -{ - return "SCmdColHeader"; -} - -RoomCommand SetCollisionHeader::GetRoomCommand() const -{ - return RoomCommand::SetCollisionHeader; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetCollisionHeader.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetCollisionHeader.h deleted file mode 100644 index f7d5ecf358..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetCollisionHeader.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include "ZCollision.h" -#include "ZRoom/ZRoomCommand.h" - -class SetCollisionHeader : public ZRoomCommand -{ -public: - ZCollisionHeader* collisionHeader; - - SetCollisionHeader(ZFile* nParent); - - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - std::string GetCommandCName() const override; - RoomCommand GetRoomCommand() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetCsCamera.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetCsCamera.cpp deleted file mode 100644 index 302d638d4c..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetCsCamera.cpp +++ /dev/null @@ -1,154 +0,0 @@ -#include "SetCsCamera.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "ZFile.h" -#include "ZRoom/ZRoom.h" - -SetCsCamera::SetCsCamera(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -void SetCsCamera::ParseRawData() -{ - ZRoomCommand::ParseRawData(); - int numCameras = cmdArg1; - - uint32_t currentPtr = segmentOffset; - int32_t numPoints = 0; - - cameras.reserve(numCameras); - for (int32_t i = 0; i < numCameras; i++) - { - ActorCsCamInfo entry(parent->GetRawData(), currentPtr); - numPoints += entry.GetNumPoints(); - - currentPtr += entry.GetRawDataSize(); - cameras.push_back(entry); - } - - if (numPoints > 0) - { - uint32_t currentPtr = cameras.at(0).GetSegmentOffset(); - - points.reserve(numPoints); - for (int32_t i = 0; i < numPoints; i++) - { - ZVector vec(parent); - vec.ExtractFromBinary(currentPtr, ZScalarType::ZSCALAR_S16, 3); - - currentPtr += vec.GetRawDataSize(); - points.push_back(vec); - } - } -} - -void SetCsCamera::DeclareReferences(const std::string& prefix) -{ - if (points.size() > 0) - { - std::string declaration; - size_t index = 0; - for (auto& point : points) - { - declaration += StringHelper::Sprintf("\t{ %s },", point.GetBodySourceCode().c_str()); - - if (index < points.size() - 1) - declaration += "\n"; - - index++; - } - - uint32_t segOffset = cameras.at(0).GetSegmentOffset(); - - parent->AddDeclarationArray( - segOffset, DeclarationAlignment::Align4, points.size() * points.at(0).GetRawDataSize(), - points.at(0).GetSourceTypeName().c_str(), - StringHelper::Sprintf("%sCsCameraPoints_%06X", prefix.c_str(), segOffset), - points.size(), declaration); - } - - if (!cameras.empty()) - { - std::string camPointsName; - Globals::Instance->GetSegmentedPtrName(cameras.at(0).GetCamAddress(), parent, "Vec3s", - camPointsName); - std::string declaration; - - size_t index = 0; - size_t pointsIndex = 0; - for (const auto& entry : cameras) - { - declaration += - StringHelper::Sprintf("\t{ %i, %i, &%s[%i] },", entry.type, entry.numPoints, - camPointsName.c_str(), pointsIndex); - - if (index < cameras.size() - 1) - declaration += "\n"; - - index++; - pointsIndex += entry.GetNumPoints(); - } - - const auto& entry = cameras.front(); - std::string camTypename = entry.GetSourceTypeName(); - - parent->AddDeclarationArray( - segmentOffset, DeclarationAlignment::Align4, cameras.size() * entry.GetRawDataSize(), - camTypename, - StringHelper::Sprintf("%s%s_%06X", prefix.c_str(), camTypename.c_str(), segmentOffset), - cameras.size(), declaration); - } -} - -std::string SetCsCamera::GetBodySourceCode() const -{ - std::string listName; - Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "ActorCsCamInfo", listName); - return StringHelper::Sprintf("SCENE_CMD_ACTOR_CUTSCENE_CAM_LIST(%i, %s)", cameras.size(), - listName.c_str()); -} - -std::string SetCsCamera::GetCommandCName() const -{ - return "SCmdCsCameraList"; -} - -RoomCommand SetCsCamera::GetRoomCommand() const -{ - return RoomCommand::SetCsCamera; -} - -ActorCsCamInfo::ActorCsCamInfo(const std::vector& rawData, uint32_t rawDataIndex) - : baseOffset(rawDataIndex), type(BitConverter::ToInt16BE(rawData, rawDataIndex + 0)), - numPoints(BitConverter::ToInt16BE(rawData, rawDataIndex + 2)) -{ - camAddress = BitConverter::ToInt32BE(rawData, rawDataIndex + 4); - segmentOffset = GETSEGOFFSET(camAddress); -} - -std::string ActorCsCamInfo::GetSourceTypeName() const -{ - return "ActorCsCamInfo"; -} - -int32_t ActorCsCamInfo::GetRawDataSize() const -{ - return 8; -} - -int16_t ActorCsCamInfo::GetNumPoints() const -{ - return numPoints; -} - -segptr_t ActorCsCamInfo::GetCamAddress() const -{ - return camAddress; -} - -uint32_t ActorCsCamInfo::GetSegmentOffset() const -{ - return segmentOffset; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetCsCamera.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetCsCamera.h deleted file mode 100644 index 2ce64e4e05..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetCsCamera.h +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once - -#include "ZRoom/ZRoomCommand.h" -#include "ZVector.h" - -class ActorCsCamInfo -{ -public: - ActorCsCamInfo(const std::vector& rawData, uint32_t rawDataIndex); - - std::string GetSourceTypeName() const; - int32_t GetRawDataSize() const; - - int16_t GetNumPoints() const; - segptr_t GetCamAddress() const; - uint32_t GetSegmentOffset() const; - - int baseOffset; - int16_t type; - int16_t numPoints; - segptr_t camAddress; - uint32_t segmentOffset; -}; - -class SetCsCamera : public ZRoomCommand -{ -public: - std::vector cameras; - std::vector points; - - SetCsCamera(ZFile* nParent); - - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - RoomCommand GetRoomCommand() const override; - std::string GetCommandCName() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetCutsceneEntryList.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetCutsceneEntryList.cpp deleted file mode 100644 index 96c50c3be2..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetCutsceneEntryList.cpp +++ /dev/null @@ -1,103 +0,0 @@ -#include "SetCutsceneEntryList.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "ZFile.h" -#include "ZRoom/ZRoom.h" - -SetActorCutsceneList::SetActorCutsceneList(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -void SetActorCutsceneList::ParseRawData() -{ - ZRoomCommand::ParseRawData(); - int numCutscenes = cmdArg1; - offset_t currentPtr = segmentOffset; - - cutscenes.reserve(numCutscenes); - for (int32_t i = 0; i < numCutscenes; i++) - { - CutsceneEntry entry(parent->GetRawData(), currentPtr); - cutscenes.push_back(entry); - - currentPtr += 16; - } -} - -void SetActorCutsceneList::DeclareReferences(const std::string& prefix) -{ - if (cutscenes.size() > 0) - { - std::string declaration; - - for (size_t i = 0; i < cutscenes.size(); i++) - { - const auto& entry = cutscenes.at(i); - declaration += StringHelper::Sprintf(" { %s },", entry.GetBodySourceCode().c_str()); - - if (i + 1 < cutscenes.size()) - { - declaration += "\n"; - } - } - - std::string typeName = cutscenes.at(0).GetSourceTypeName(); - - parent->AddDeclarationArray( - segmentOffset, GetDeclarationAlignment(), cutscenes.size() * 16, typeName, - StringHelper::Sprintf("%s%sList_%06X", prefix.c_str(), typeName.c_str(), segmentOffset), - cutscenes.size(), declaration); - } -} - -std::string SetActorCutsceneList::GetBodySourceCode() const -{ - std::string listName; - Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "CutsceneEntry", listName); - return StringHelper::Sprintf("SCENE_CMD_ACTOR_CUTSCENE_LIST(%i, %s)", cutscenes.size(), - listName.c_str()); -} - -std::string SetActorCutsceneList::GetCommandCName() const -{ - return "SCmdCutsceneActorList"; -} - -RoomCommand SetActorCutsceneList::GetRoomCommand() const -{ - return RoomCommand::SetActorCutsceneList; -} - -CutsceneEntry::CutsceneEntry(const std::vector& rawData, uint32_t rawDataIndex) - : priority(BitConverter::ToInt16BE(rawData, rawDataIndex + 0)), - length(BitConverter::ToInt16BE(rawData, rawDataIndex + 2)), - csCamId(BitConverter::ToInt16BE(rawData, rawDataIndex + 4)), - scriptIndex(BitConverter::ToInt16BE(rawData, rawDataIndex + 6)), - additionalCsId(BitConverter::ToInt16BE(rawData, rawDataIndex + 8)), - endSfx(rawData[rawDataIndex + 0xA]), customValue(rawData[rawDataIndex + 0xB]), - hudVisibility(BitConverter::ToInt16BE(rawData, rawDataIndex + 0xC)), - endCam(rawData[rawDataIndex + 0xE]), letterboxSize(rawData[rawDataIndex + 0xF]) -{ -} - -std::string CutsceneEntry::GetBodySourceCode() const -{ - EnumData* enumData = &Globals::Instance->cfg.enumData; - - if (enumData->endSfx.find(endSfx) != enumData->endSfx.end()) - return StringHelper::Sprintf("%i, %i, %i, %i, %i, %s, %i, %i, %i, %i", priority, length, - csCamId, scriptIndex, additionalCsId, - enumData->endSfx[endSfx].c_str(), customValue, hudVisibility, - endCam, letterboxSize); - else - return StringHelper::Sprintf("%i, %i, %i, %i, %i, %i, %i, %i, %i, %i", priority, length, - csCamId, scriptIndex, additionalCsId, endSfx, customValue, - hudVisibility, endCam, letterboxSize); -} - -std::string CutsceneEntry::GetSourceTypeName() const -{ - return "CutsceneEntry"; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetCutsceneEntryList.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetCutsceneEntryList.h deleted file mode 100644 index 6ba6c23abc..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetCutsceneEntryList.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -#include "ZRoom/ZRoomCommand.h" - -class CutsceneEntry -{ -protected: - int16_t priority; - int16_t length; - int16_t csCamId; - int16_t scriptIndex; - int16_t additionalCsId; - uint8_t endSfx; - uint8_t customValue; - int16_t hudVisibility; - uint8_t endCam; - uint8_t letterboxSize; - -public: - CutsceneEntry(const std::vector& rawData, uint32_t rawDataIndex); - - std::string GetBodySourceCode() const; - std::string GetSourceTypeName() const; -}; - -class SetActorCutsceneList : public ZRoomCommand -{ -public: - std::vector cutscenes; - - SetActorCutsceneList(ZFile* nParent); - - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - std::string GetCommandCName() const override; - RoomCommand GetRoomCommand() const override; - -private: -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetCutscenes.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetCutscenes.cpp deleted file mode 100644 index d2a1c19561..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetCutscenes.cpp +++ /dev/null @@ -1,134 +0,0 @@ -#include "SetCutscenes.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "ZFile.h" -#include "ZRoom/ZRoom.h" - -SetCutscenes::SetCutscenes(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -void SetCutscenes::ParseRawData() -{ - ZRoomCommand::ParseRawData(); - - numCutscenes = cmdArg1; - - if (Globals::Instance->game == ZGame::MM_RETAIL) - { - int32_t currentPtr = segmentOffset; - - cutsceneEntries.reserve(numCutscenes); - for (uint8_t i = 0; i < numCutscenes; i++) - { - CutsceneScriptEntry entry(parent->GetRawData(), currentPtr); - cutsceneEntries.push_back(entry); - currentPtr += 8; - } - } -} - -void SetCutscenes::DeclareReferences(const std::string& prefix) -{ - EnumData* enumData = &Globals::Instance->cfg.enumData; - std::string varPrefix = name; - if (varPrefix == "") - varPrefix = prefix; - - if (Globals::Instance->game == ZGame::MM_RETAIL) - { - std::string declaration; - size_t i = 0; - - for (const auto& entry : cutsceneEntries) - { - if (entry.segmentPtr != SEGMENTED_NULL && - GETSEGNUM(entry.segmentPtr) == parent->segment) - { - offset_t csOffset = Seg2Filespace(entry.segmentPtr, parent->baseAddress); - if (!parent->HasDeclaration(csOffset)) - { - auto* cutscene = new ZCutscene(parent); - cutscene->ExtractFromFile(csOffset); - cutscene->SetName(cutscene->GetDefaultName(varPrefix)); - cutscene->DeclareVar(varPrefix, ""); - cutscene->DeclareReferences(varPrefix); - parent->AddResource(cutscene); - } - } - - std::string csName; - Globals::Instance->GetSegmentedPtrName(entry.segmentPtr, parent, "CutsceneData", - csName); - - if (enumData->spawnFlag.find(entry.flag) != enumData->spawnFlag.end()) - declaration += StringHelper::Sprintf(" { %s, 0x%04X, 0x%02X, %s },", - csName.c_str(), entry.exit, entry.entrance, - enumData->spawnFlag[entry.flag].c_str()); - else - declaration += - StringHelper::Sprintf(" { %s, 0x%04X, 0x%02X, 0x%02X },", csName.c_str(), - entry.exit, entry.entrance, entry.flag); - if (i + 1 < numCutscenes) - declaration += "\n"; - - i++; - } - - parent->AddDeclarationArray(segmentOffset, DeclarationAlignment::Align4, - cutsceneEntries.size() * 8, "CutsceneScriptEntry", - StringHelper::Sprintf("%sCutsceneScriptEntryList_%06X", - zRoom->GetName().c_str(), segmentOffset), - cutsceneEntries.size(), declaration); - } - else - { - if (cmdArg2 != SEGMENTED_NULL && GETSEGNUM(cmdArg2) == parent->segment) - { - offset_t csOffset = Seg2Filespace(cmdArg2, parent->baseAddress); - if (!parent->HasDeclaration(csOffset)) - { - auto* cutscene = new ZCutscene(parent); - cutscene->ExtractFromFile(csOffset); - cutscene->SetName(cutscene->GetDefaultName(varPrefix)); - cutscene->DeclareVar(varPrefix, ""); - cutscene->DeclareReferences(varPrefix); - parent->AddResource(cutscene); - } - } - } -} - -std::string SetCutscenes::GetBodySourceCode() const -{ - std::string listName; - - if (Globals::Instance->game == ZGame::MM_RETAIL) - { - Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "CutsceneScriptEntry", listName); - return StringHelper::Sprintf("SCENE_CMD_CUTSCENE_SCRIPT_LIST(%i, %s)", numCutscenes, - listName.c_str()); - } - - Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "CutsceneData", listName); - return StringHelper::Sprintf("SCENE_CMD_CUTSCENE_DATA(%s)", listName.c_str()); -} - -std::string SetCutscenes::GetCommandCName() const -{ - return "SCmdCutsceneData"; -} - -RoomCommand SetCutscenes::GetRoomCommand() const -{ - return RoomCommand::SetCutscenes; -} - -CutsceneScriptEntry::CutsceneScriptEntry(const std::vector& rawData, uint32_t rawDataIndex) - : segmentPtr(BitConverter::ToInt32BE(rawData, rawDataIndex + 0)), - exit(BitConverter::ToInt16BE(rawData, rawDataIndex + 4)), entrance(rawData[rawDataIndex + 6]), - flag(rawData[rawDataIndex + 7]) -{ -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetCutscenes.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetCutscenes.h deleted file mode 100644 index e6d979d0f6..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetCutscenes.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#include "ZCutscene.h" -#include "ZRoom/ZRoomCommand.h" - -class CutsceneScriptEntry -{ -public: - CutsceneScriptEntry(const std::vector& rawData, uint32_t rawDataIndex); - - segptr_t segmentPtr; - uint16_t exit; - uint8_t entrance; - uint8_t flag; -}; - -class SetCutscenes : public ZRoomCommand -{ -public: - std::vector cutsceneEntries; // (MM Only) - uint8_t numCutscenes; // (MM Only) - - SetCutscenes(ZFile* nParent); - - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - RoomCommand GetRoomCommand() const override; - std::string GetCommandCName() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetEchoSettings.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetEchoSettings.cpp deleted file mode 100644 index 79a278bc69..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetEchoSettings.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "SetEchoSettings.h" -#include "Utils/StringHelper.h" - -SetEchoSettings::SetEchoSettings(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -void SetEchoSettings::ParseRawData() -{ - ZRoomCommand::ParseRawData(); - echo = parent->GetRawData().at(rawDataIndex + 0x07); -} - -std::string SetEchoSettings::GetBodySourceCode() const -{ - return StringHelper::Sprintf("SCENE_CMD_ECHO_SETTINGS(%i)", echo); -} - -std::string SetEchoSettings::GetCommandCName() const -{ - return "SCmdEchoSettings"; -} - -RoomCommand SetEchoSettings::GetRoomCommand() const -{ - return RoomCommand::SetEchoSettings; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetEchoSettings.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetEchoSettings.h deleted file mode 100644 index 82b8c27dbc..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetEchoSettings.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include "ZRoom/ZRoomCommand.h" - -class SetEchoSettings : public ZRoomCommand -{ -public: - uint8_t echo; - - SetEchoSettings(ZFile* nParent); - - void ParseRawData() override; - - std::string GetBodySourceCode() const override; - - std::string GetCommandCName() const override; - RoomCommand GetRoomCommand() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetEntranceList.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetEntranceList.cpp deleted file mode 100644 index 3ffba0ff12..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetEntranceList.cpp +++ /dev/null @@ -1,99 +0,0 @@ -#include "SetEntranceList.h" - -#include "Globals.h" -#include "SetStartPositionList.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "ZFile.h" -#include "ZRoom/ZRoom.h" - -SetEntranceList::SetEntranceList(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -void SetEntranceList::DeclareReferences([[maybe_unused]] const std::string& prefix) -{ - if (segmentOffset != 0) - { - std::string varName = - StringHelper::Sprintf("%sEntranceList0x%06X", prefix.c_str(), segmentOffset); - parent->AddDeclarationPlaceholder(segmentOffset, varName); - } -} - -void SetEntranceList::ParseRawDataLate() -{ - // Parse Entrances and Generate Declaration - uint32_t numEntrances = zRoom->parent->GetDeclarationSizeFromNeighbor(segmentOffset) / 2; - uint32_t currentPtr = segmentOffset; - - entrances.reserve(numEntrances); - for (uint32_t i = 0; i < numEntrances; i++) - { - Spawn entry(parent->GetRawData(), currentPtr); - entrances.push_back(entry); - - currentPtr += 2; - } -} - -void SetEntranceList::DeclareReferencesLate([[maybe_unused]] const std::string& prefix) -{ - if (!entrances.empty()) - { - std::string declaration; - - size_t index = 0; - for (const auto& entry : entrances) - { - declaration += StringHelper::Sprintf(" { %s },", entry.GetBodySourceCode().c_str()); - if (index + 1 < entrances.size()) - declaration += "\n"; - - index++; - } - - std::string varName = - StringHelper::Sprintf("%sEntranceList0x%06X", prefix.c_str(), segmentOffset); - - if (Globals::Instance->game != ZGame::MM_RETAIL) - parent->AddDeclarationArray(segmentOffset, DeclarationAlignment::Align4, - entrances.size() * 2, "Spawn", varName, entrances.size(), - declaration); - else - parent->AddDeclarationArray(segmentOffset, DeclarationAlignment::Align4, - entrances.size() * 2, "EntranceEntry", varName, - entrances.size(), declaration); - } -} - -std::string SetEntranceList::GetBodySourceCode() const -{ - std::string listName; - if (Globals::Instance->game != ZGame::MM_RETAIL) - Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "Spawn", listName); - else - Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "EntranceEntry", listName); - return StringHelper::Sprintf("SCENE_CMD_ENTRANCE_LIST(%s)", listName.c_str()); -} - -std::string SetEntranceList::GetCommandCName() const -{ - return "SCmdEntranceList"; -} - -RoomCommand SetEntranceList::GetRoomCommand() const -{ - return RoomCommand::SetEntranceList; -} - -Spawn::Spawn(const std::vector& rawData, uint32_t rawDataIndex) -{ - startPositionIndex = rawData.at(rawDataIndex + 0); - roomToLoad = rawData.at(rawDataIndex + 1); -} - -std::string Spawn::GetBodySourceCode() const -{ - return StringHelper::Sprintf("0x%02X, 0x%02X", startPositionIndex, roomToLoad); -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetEntranceList.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetEntranceList.h deleted file mode 100644 index 832232e06b..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetEntranceList.h +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -#include "ZRoom/ZRoomCommand.h" - -class Spawn -{ -public: - uint8_t startPositionIndex; - uint8_t roomToLoad; - - Spawn(const std::vector& rawData, uint32_t rawDataIndex); - - std::string GetBodySourceCode() const; -}; - -class SetEntranceList : public ZRoomCommand -{ -public: - std::vector entrances; - - SetEntranceList(ZFile* nParent); - - void DeclareReferences(const std::string& prefix) override; - void ParseRawDataLate() override; - void DeclareReferencesLate(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - RoomCommand GetRoomCommand() const override; - std::string GetCommandCName() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetExitList.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetExitList.cpp deleted file mode 100644 index 78bbaa87ed..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetExitList.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include "SetExitList.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "ZFile.h" -#include "ZRoom/ZNames.h" -#include "ZRoom/ZRoom.h" - -SetExitList::SetExitList(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -void SetExitList::DeclareReferences([[maybe_unused]] const std::string& prefix) -{ - if (segmentOffset != 0) - { - std::string varName = - StringHelper::Sprintf("%sExitList_%06X", prefix.c_str(), segmentOffset); - parent->AddDeclarationPlaceholder(segmentOffset, varName); - } -} - -void SetExitList::ParseRawDataLate() -{ - // Parse Entrances and Generate Declaration - uint32_t numEntrances = zRoom->parent->GetDeclarationSizeFromNeighbor(segmentOffset) / 2; - uint32_t currentPtr = segmentOffset; - - exits.reserve(numEntrances); - for (uint32_t i = 0; i < numEntrances; i++) - { - uint16_t exit = BitConverter::ToUInt16BE(parent->GetRawData(), currentPtr); - exits.push_back(exit); - - currentPtr += 2; - } -} - -void SetExitList::DeclareReferencesLate([[maybe_unused]] const std::string& prefix) -{ - if (!exits.empty()) - { - std::string declaration; - - for (size_t i = 0; i < exits.size(); i++) - { - declaration += - StringHelper::Sprintf(" %s,", ZNames::GetEntranceName(exits[i]).c_str()); - if (i + 1 < exits.size()) - declaration += "\n"; - } - - std::string varName = - StringHelper::Sprintf("%sExitList_%06X", prefix.c_str(), segmentOffset); - parent->AddDeclarationArray(segmentOffset, DeclarationAlignment::Align4, exits.size() * 2, - "u16", varName, exits.size(), declaration); - } -} - -std::string SetExitList::GetBodySourceCode() const -{ - std::string listName; - Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "u16", listName); - return StringHelper::Sprintf("SCENE_CMD_EXIT_LIST(%s)", listName.c_str()); -} - -std::string SetExitList::GetCommandCName() const -{ - return "SCmdExitList"; -} - -RoomCommand SetExitList::GetRoomCommand() const -{ - return RoomCommand::SetExitList; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetExitList.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetExitList.h deleted file mode 100644 index 9d2791a83d..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetExitList.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include "ZRoom/ZRoomCommand.h" - -class SetExitList : public ZRoomCommand -{ -public: - std::vector exits; - - SetExitList(ZFile* nParent); - - void DeclareReferences(const std::string& prefix) override; - void ParseRawDataLate() override; - void DeclareReferencesLate(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - RoomCommand GetRoomCommand() const override; - std::string GetCommandCName() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetLightList.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetLightList.cpp deleted file mode 100644 index 0d0f0ff79a..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetLightList.cpp +++ /dev/null @@ -1,99 +0,0 @@ -#include "SetLightList.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" - -SetLightList::SetLightList(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -void SetLightList::ParseRawData() -{ - ZRoomCommand::ParseRawData(); - std::string declarations; - - numLights = cmdArg1; - int32_t currentPtr = segmentOffset; - - lights.reserve(this->numLights); - for (int i = 0; i < this->numLights; i++) - { - LightInfo light(parent->GetRawData(), currentPtr); - - currentPtr += light.GetRawDataSize(); - lights.push_back(light); - } -} - -void SetLightList::DeclareReferences(const std::string& prefix) -{ - if (!lights.empty()) - { - std::string declarations; - - for (size_t i = 0; i < lights.size(); i++) - { - declarations += - StringHelper::Sprintf("\t{ %s },", lights.at(i).GetBodySourceCode().c_str()); - - if (i < lights.size() - 1) - declarations += "\n"; - } - - const auto& light = lights.front(); - - parent->AddDeclarationArray( - segmentOffset, DeclarationAlignment::Align4, lights.size() * light.GetRawDataSize(), - light.GetSourceTypeName(), - StringHelper::Sprintf("%sLightInfo0x%06X", prefix.c_str(), segmentOffset), - lights.size(), declarations); - } -} - -std::string SetLightList::GetBodySourceCode() const -{ - std::string listName; - Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "LightInfo", listName); - return StringHelper::Sprintf("SCENE_CMD_LIGHT_LIST(%i, %s)", numLights, listName.c_str()); -} - -std::string SetLightList::GetCommandCName() const -{ - return "SCmdLightList"; -} - -RoomCommand SetLightList::GetRoomCommand() const -{ - return RoomCommand::SetLightList; -} - -LightInfo::LightInfo(const std::vector& rawData, uint32_t rawDataIndex) -{ - type = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0); - x = BitConverter::ToInt16BE(rawData, rawDataIndex + 2); - y = BitConverter::ToInt16BE(rawData, rawDataIndex + 4); - z = BitConverter::ToInt16BE(rawData, rawDataIndex + 6); - r = BitConverter::ToUInt8BE(rawData, rawDataIndex + 8); - g = BitConverter::ToUInt8BE(rawData, rawDataIndex + 9); - b = BitConverter::ToUInt8BE(rawData, rawDataIndex + 10); - drawGlow = BitConverter::ToUInt8BE(rawData, rawDataIndex + 11); - radius = BitConverter::ToInt16BE(rawData, rawDataIndex + 12); -} - -std::string LightInfo::GetBodySourceCode() const -{ - return StringHelper::Sprintf( - "0x%02X, { %i, %i, %i, { 0x%02X, 0x%02X, 0x%02X }, 0x%02X, 0x%04X }", type, x, y, z, r, g, - b, drawGlow, radius); -} - -std::string LightInfo::GetSourceTypeName() const -{ - return "LightInfo"; -} - -size_t LightInfo::GetRawDataSize() const -{ - return 0x0E; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetLightList.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetLightList.h deleted file mode 100644 index c089d82a54..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetLightList.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -#include - -#include "ZFile.h" -#include "ZRoom/ZRoom.h" -#include "ZRoom/ZRoomCommand.h" - -class LightInfo -{ -public: - LightInfo(const std::vector& rawData, uint32_t rawDataIndex); - - std::string GetBodySourceCode() const; - - std::string GetSourceTypeName() const; - size_t GetRawDataSize() const; - -protected: - uint8_t type; - int16_t x, y, z; - uint8_t r, g, b; - uint8_t drawGlow; - int16_t radius; -}; - -class SetLightList : public ZRoomCommand -{ -public: - uint8_t numLights; - std::vector lights; - - SetLightList(ZFile* nParent); - - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - RoomCommand GetRoomCommand() const override; - std::string GetCommandCName() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetLightingSettings.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetLightingSettings.cpp deleted file mode 100644 index eaf01cd4c4..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetLightingSettings.cpp +++ /dev/null @@ -1,116 +0,0 @@ -#include "SetLightingSettings.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "ZFile.h" -#include "ZRoom/ZRoom.h" - -SetLightingSettings::SetLightingSettings(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -void SetLightingSettings::ParseRawData() -{ - ZRoomCommand::ParseRawData(); - uint8_t numLights = cmdArg1; - - settings.reserve(numLights); - for (int i = 0; i < numLights; i++) - settings.push_back(LightingSettings(parent->GetRawData(), segmentOffset + (i * 22))); -} - -void SetLightingSettings::DeclareReferences(const std::string& prefix) -{ - if (settings.size() > 0) - { - std::string declaration; - - for (size_t i = 0; i < settings.size(); i++) - { - declaration += - StringHelper::Sprintf("\t{ %s },", settings.at(i).GetBodySourceCode().c_str()); - if (i + 1 < settings.size()) - declaration += "\n"; - } - - if (Globals::Instance->game != ZGame::MM_RETAIL) - parent->AddDeclarationArray( - segmentOffset, DeclarationAlignment::Align4, - settings.size() * settings.front().GetRawDataSize(), "EnvLightSettings", - StringHelper::Sprintf("%sLightSettings0x%06X", prefix.c_str(), segmentOffset), - settings.size(), declaration); - else - parent->AddDeclarationArray( - segmentOffset, DeclarationAlignment::Align4, - settings.size() * settings.front().GetRawDataSize(), "LightSettings", - StringHelper::Sprintf("%sLightSettings0x%06X", prefix.c_str(), segmentOffset), - settings.size(), declaration); - } -} - -std::string SetLightingSettings::GetBodySourceCode() const -{ - std::string listName; - if (Globals::Instance->game != ZGame::MM_RETAIL) - Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "EnvLightSettings", listName); - else - Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "LightSettings", listName); - return StringHelper::Sprintf("SCENE_CMD_ENV_LIGHT_SETTINGS(%i, %s)", settings.size(), - listName.c_str()); -} - -std::string SetLightingSettings::GetCommandCName() const -{ - return "SCmdLightSettingList"; -} - -RoomCommand SetLightingSettings::GetRoomCommand() const -{ - return RoomCommand::SetLightingSettings; -} - -LightingSettings::LightingSettings(const std::vector& rawData, uint32_t rawDataIndex) -{ - ambientClrR = rawData.at(rawDataIndex + 0); - ambientClrG = rawData.at(rawDataIndex + 1); - ambientClrB = rawData.at(rawDataIndex + 2); - - diffuseClrA_R = rawData.at(rawDataIndex + 3); - diffuseClrA_G = rawData.at(rawDataIndex + 4); - diffuseClrA_B = rawData.at(rawDataIndex + 5); - - diffuseDirA_X = rawData.at(rawDataIndex + 6); - diffuseDirA_Y = rawData.at(rawDataIndex + 7); - diffuseDirA_Z = rawData.at(rawDataIndex + 8); - - diffuseClrB_R = rawData.at(rawDataIndex + 9); - diffuseClrB_G = rawData.at(rawDataIndex + 10); - diffuseClrB_B = rawData.at(rawDataIndex + 11); - - diffuseDirB_X = rawData.at(rawDataIndex + 12); - diffuseDirB_Y = rawData.at(rawDataIndex + 13); - diffuseDirB_Z = rawData.at(rawDataIndex + 14); - - fogClrR = rawData.at(rawDataIndex + 15); - fogClrG = rawData.at(rawDataIndex + 16); - fogClrB = rawData.at(rawDataIndex + 17); - - unk = BitConverter::ToInt16BE(rawData, rawDataIndex + 18); - drawDistance = BitConverter::ToInt16BE(rawData, rawDataIndex + 20); -} - -std::string LightingSettings::GetBodySourceCode() const -{ - return StringHelper::Sprintf( - "0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, " - "0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%02X, 0x%04X, 0x%04X", - ambientClrR, ambientClrG, ambientClrB, diffuseClrA_R, diffuseClrA_G, diffuseClrA_B, - diffuseDirA_X, diffuseDirA_Y, diffuseDirA_Z, diffuseClrB_R, diffuseClrB_G, diffuseClrB_B, - diffuseDirB_X, diffuseDirB_Y, diffuseDirB_Z, fogClrR, fogClrG, fogClrB, unk, drawDistance); -} - -size_t LightingSettings::GetRawDataSize() const -{ - return 0x16; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetLightingSettings.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetLightingSettings.h deleted file mode 100644 index 29caf4aa6a..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetLightingSettings.h +++ /dev/null @@ -1,38 +0,0 @@ -#pragma once - -#include "ZRoom/ZRoomCommand.h" - -class LightingSettings -{ -public: - uint8_t ambientClrR, ambientClrG, ambientClrB; - uint8_t diffuseClrA_R, diffuseClrA_G, diffuseClrA_B; - uint8_t diffuseDirA_X, diffuseDirA_Y, diffuseDirA_Z; - uint8_t diffuseClrB_R, diffuseClrB_G, diffuseClrB_B; - uint8_t diffuseDirB_X, diffuseDirB_Y, diffuseDirB_Z; - uint8_t fogClrR, fogClrG, fogClrB; - uint16_t unk; - uint16_t drawDistance; - - LightingSettings(const std::vector& rawData, uint32_t rawDataIndex); - - std::string GetBodySourceCode() const; - - size_t GetRawDataSize() const; -}; - -class SetLightingSettings : public ZRoomCommand -{ -public: - std::vector settings; - - SetLightingSettings(ZFile* nParent); - - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - RoomCommand GetRoomCommand() const override; - std::string GetCommandCName() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetMesh.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetMesh.cpp deleted file mode 100644 index 9a4d30d516..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetMesh.cpp +++ /dev/null @@ -1,617 +0,0 @@ -#include "SetMesh.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/Path.h" -#include "Utils/StringHelper.h" -#include "WarningHandler.h" -#include "ZBackground.h" -#include "ZFile.h" -#include "ZRoom/ZRoom.h" - -void GenDListDeclarations(ZRoom* zRoom, ZFile* parent, ZDisplayList* dList); - -SetMesh::SetMesh(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -void SetMesh::ParseRawData() -{ - ZRoomCommand::ParseRawData(); - auto& parentRawData = parent->GetRawData(); - meshHeaderType = parentRawData.at(segmentOffset); - - switch (meshHeaderType) - { - case 0: - polyType = std::make_shared(parent, segmentOffset, zRoom); - break; - - case 1: - polyType = std::make_shared(parent, segmentOffset, zRoom); - break; - - case 2: - polyType = std::make_shared(parent, segmentOffset, zRoom); - break; - - default: - HANDLE_ERROR(WarningType::InvalidExtractedData, - StringHelper::Sprintf("unknown meshHeaderType: %i", meshHeaderType), ""); - } - - polyType->ParseRawData(); -} - -void SetMesh::DeclareReferences(const std::string& prefix) -{ - polyType->SetName(polyType->GetDefaultName(prefix)); - polyType->DeclareReferences(prefix); - polyType->DeclareAndGenerateOutputCode(prefix); -} - -// TODO: is this really needed? -void GenDListDeclarations(ZRoom* zRoom, ZFile* parent, ZDisplayList* dList) -{ - if (dList == nullptr) - return; - - dList->DeclareReferences(zRoom->GetName()); - - for (ZDisplayList* otherDList : dList->otherDLists) - GenDListDeclarations(zRoom, parent, otherDList); -} - -std::string SetMesh::GenDListExterns(ZDisplayList* dList) -{ - std::string sourceOutput; - - sourceOutput += StringHelper::Sprintf("extern Gfx %sDL_%06X[];\n", zRoom->GetName().c_str(), - dList->GetRawDataIndex()); - - for (ZDisplayList* otherDList : dList->otherDLists) - sourceOutput += GenDListExterns(otherDList); - - return sourceOutput; -} - -std::string SetMesh::GetBodySourceCode() const -{ - std::string list; - Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "", list); - return StringHelper::Sprintf("SCENE_CMD_ROOM_SHAPE(%s)", list.c_str()); -} - -std::string SetMesh::GetCommandCName() const -{ - return "SCmdMesh"; -} - -RoomCommand SetMesh::GetRoomCommand() const -{ - return RoomCommand::SetMesh; -} - -RoomShapeDListsEntry::RoomShapeDListsEntry(ZFile* nParent) : ZResource(nParent) -{ -} - -void RoomShapeDListsEntry::ParseRawData() -{ - const auto& rawData = parent->GetRawData(); - switch (polyType) - { - case 2: - x = BitConverter::ToInt16BE(rawData, rawDataIndex + 0); - y = BitConverter::ToInt16BE(rawData, rawDataIndex + 2); - z = BitConverter::ToInt16BE(rawData, rawDataIndex + 4); - unk_06 = BitConverter::ToInt16BE(rawData, rawDataIndex + 6); - - opa = BitConverter::ToUInt32BE(rawData, rawDataIndex + 8); - xlu = BitConverter::ToUInt32BE(rawData, rawDataIndex + 12); - break; - - default: - opa = BitConverter::ToUInt32BE(rawData, rawDataIndex); - xlu = BitConverter::ToUInt32BE(rawData, rawDataIndex + 4); - break; - } -} - -void RoomShapeDListsEntry::DeclareReferences(const std::string& prefix) -{ - opaDList = MakeDlist(opa, prefix); - xluDList = MakeDlist(xlu, prefix); -} - -std::string RoomShapeDListsEntry::GetBodySourceCode() const -{ - std::string bodyStr; - std::string opaStr; - std::string xluStr; - Globals::Instance->GetSegmentedPtrName(opa, parent, "Gfx", opaStr); - Globals::Instance->GetSegmentedPtrName(xlu, parent, "Gfx", xluStr); - - if (polyType == 2) - { - bodyStr += StringHelper::Sprintf("{ %6i, %6i, %6i }, %6i, ", x, y, z, unk_06); - } - - bodyStr += StringHelper::Sprintf("%s, %s", opaStr.c_str(), xluStr.c_str()); - - return bodyStr; -} - -void RoomShapeDListsEntry::GetSourceOutputCode(const std::string& prefix) -{ - std::string bodyStr = StringHelper::Sprintf("\n\t%s\n", GetBodySourceCode().c_str()); - - Declaration* decl = parent->GetDeclaration(rawDataIndex); - - if (decl == nullptr) - DeclareVar(prefix, bodyStr); - else - decl->declBody = bodyStr; -} - -std::string RoomShapeDListsEntry::GetSourceTypeName() const -{ - switch (polyType) - { - case 2: - return "RoomShapeCullableEntry"; - - default: - return "RoomShapeDListsEntry"; - } -} - -ZResourceType RoomShapeDListsEntry::GetResourceType() const -{ - // TODO - return ZResourceType::Error; -} - -size_t RoomShapeDListsEntry::GetRawDataSize() const -{ - switch (polyType) - { - case 2: - return 0x10; - - default: - return 0x08; - } -} - -void RoomShapeDListsEntry::SetPolyType(uint8_t nPolyType) -{ - polyType = nPolyType; -} - -ZDisplayList* RoomShapeDListsEntry::MakeDlist(segptr_t ptr, - [[maybe_unused]] const std::string& prefix) -{ - if (ptr == 0) - { - return nullptr; - } - - uint32_t dlistAddress = Seg2Filespace(ptr, parent->baseAddress); - - int32_t dlistLength = ZDisplayList::GetDListLength( - parent->GetRawData(), dlistAddress, - Globals::Instance->game == ZGame::OOT_SW97 ? DListType::F3DEX : DListType::F3DZEX); - ZDisplayList* dlist = new ZDisplayList(parent); - parent->AddResource(dlist); - dlist->ExtractFromBinary(dlistAddress, dlistLength); - dlist->SetName(dlist->GetDefaultName(prefix)); - GenDListDeclarations(zRoom, parent, dlist); - - return dlist; -} - -/* RoomShapeImageMultiBgEntry */ - -RoomShapeImageMultiBgEntry::RoomShapeImageMultiBgEntry(ZFile* nParent) : ZResource(nParent) -{ -} - -RoomShapeImageMultiBgEntry::RoomShapeImageMultiBgEntry(bool nIsSubStruct, const std::string& prefix, - uint32_t nRawDataIndex, ZFile* nParent) - : RoomShapeImageMultiBgEntry(nParent) -{ - rawDataIndex = nRawDataIndex; - parent = nParent; - isSubStruct = nIsSubStruct; - - name = GetDefaultName(prefix); - - ParseRawData(); - sourceBackground = MakeBackground(source, prefix); -} - -void RoomShapeImageMultiBgEntry::ParseRawData() -{ - size_t pad = 0x00; - const auto& rawData = parent->GetRawData(); - if (!isSubStruct) - { - pad = 0x04; - - unk_00 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x00); - id = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x02); - } - source = BitConverter::ToUInt32BE(rawData, rawDataIndex + pad + 0x00); - unk_0C = BitConverter::ToUInt32BE(rawData, rawDataIndex + pad + 0x04); - tlut = BitConverter::ToUInt32BE(rawData, rawDataIndex + pad + 0x08); - width = BitConverter::ToUInt16BE(rawData, rawDataIndex + pad + 0x0C); - height = BitConverter::ToUInt16BE(rawData, rawDataIndex + pad + 0x0E); - fmt = BitConverter::ToUInt8BE(rawData, rawDataIndex + pad + 0x10); - siz = BitConverter::ToUInt8BE(rawData, rawDataIndex + pad + 0x11); - mode0 = BitConverter::ToUInt16BE(rawData, rawDataIndex + pad + 0x12); - tlutCount = BitConverter::ToUInt16BE(rawData, rawDataIndex + pad + 0x14); -} - -ZBackground* RoomShapeImageMultiBgEntry::MakeBackground(segptr_t ptr, const std::string& prefix) -{ - if (ptr == 0) - return nullptr; - - uint32_t backAddress = Seg2Filespace(ptr, parent->baseAddress); - - ZBackground* background = new ZBackground(parent); - background->ExtractFromFile(backAddress); - - std::string defaultName = background->GetDefaultName(prefix); - background->SetName(defaultName); - background->SetOutName(defaultName); - - background->DeclareVar(prefix, ""); - parent->resources.push_back(background); - - return background; -} - -size_t RoomShapeImageMultiBgEntry::GetRawDataSize() const -{ - return 0x1C; -} - -std::string RoomShapeImageMultiBgEntry::GetBodySourceCode() const -{ - std::string bodyStr = " "; - if (!isSubStruct) - { - bodyStr += "{ \n "; - } - - if (!isSubStruct) - { - bodyStr += StringHelper::Sprintf("0x%04X, ", unk_00); - bodyStr += StringHelper::Sprintf("%i, ", id); - bodyStr += "\n "; - bodyStr += " "; - } - - std::string backgroundName; - Globals::Instance->GetSegmentedPtrName(source, parent, "", backgroundName); - bodyStr += StringHelper::Sprintf("%s, ", backgroundName.c_str()); - bodyStr += "\n "; - if (!isSubStruct) - { - bodyStr += " "; - } - - bodyStr += StringHelper::Sprintf("0x%08X, ", unk_0C); - bodyStr += StringHelper::Sprintf("0x%08X, ", tlut); - bodyStr += "\n "; - if (!isSubStruct) - { - bodyStr += " "; - } - - bodyStr += StringHelper::Sprintf("%i, ", width); - bodyStr += StringHelper::Sprintf("%i, ", height); - bodyStr += "\n "; - if (!isSubStruct) - { - bodyStr += " "; - } - - bodyStr += StringHelper::Sprintf("%i, ", fmt); - bodyStr += StringHelper::Sprintf("%i, ", siz); - bodyStr += "\n "; - if (!isSubStruct) - { - bodyStr += " "; - } - - bodyStr += StringHelper::Sprintf("0x%04X, ", mode0); - bodyStr += StringHelper::Sprintf("0x%04X, ", tlutCount); - if (!isSubStruct) - { - bodyStr += " \n }, "; - } - else - { - bodyStr += "\n"; - } - - return bodyStr; -} - -std::string RoomShapeImageMultiBgEntry::GetSourceTypeName() const -{ - return "RoomShapeImageMultiBgEntry"; -} - -ZResourceType RoomShapeImageMultiBgEntry::GetResourceType() const -{ - // TODO - return ZResourceType::Error; -} - -/* PolygonType section */ - -PolygonTypeBase::PolygonTypeBase(ZFile* nParent, uint32_t nRawDataIndex, ZRoom* nRoom) - : ZResource(nParent), zRoom{nRoom} -{ - rawDataIndex = nRawDataIndex; - type = BitConverter::ToUInt8BE(parent->GetRawData(), rawDataIndex); -} - -void PolygonTypeBase::DeclareAndGenerateOutputCode(const std::string& prefix) -{ - std::string bodyStr = GetBodySourceCode(); - - Declaration* decl = parent->GetDeclaration(rawDataIndex); - if (decl == nullptr) - { - DeclareVar(prefix, bodyStr); - } - else - { - decl->declBody = bodyStr; - } -} - -std::string PolygonTypeBase::GetSourceTypeName() const -{ - switch (type) - { - case 2: - return "RoomShapeCullable"; - - case 1: - return "PolygonType1"; - - default: - return "RoomShapeNormal"; - } -} - -ZResourceType PolygonTypeBase::GetResourceType() const -{ - // TODO - return ZResourceType::Error; -} - -PolygonType1::PolygonType1(ZFile* nParent, uint32_t nRawDataIndex, ZRoom* nRoom) - : PolygonTypeBase(nParent, nRawDataIndex, nRoom), single(nParent) -{ -} - -void PolygonType1::ParseRawData() -{ - const auto& rawData = parent->GetRawData(); - - format = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x01); - dlist = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x04); - - if (format == 2) - { - count = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x08); - list = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x0C); - } - - if (dlist != 0) - { - RoomShapeDListsEntry polyGfxList(parent); - polyGfxList.zRoom = zRoom; - polyGfxList.SetPolyType(type); - polyGfxList.ExtractFromFile(Seg2Filespace(dlist, parent->baseAddress)); - polyGfxList.DeclareReferences(zRoom->GetName()); - polyDLists.push_back(polyGfxList); - } -} - -void PolygonType1::DeclareReferences(const std::string& prefix) -{ - polyDLists.at(0).GetSourceOutputCode(prefix); - - uint32_t listAddress; - std::string bgImageArrayBody; - switch (format) - { - case 1: - single = RoomShapeImageMultiBgEntry(true, prefix, rawDataIndex + 0x08, parent); - break; - - case 2: - if (list != 0) - { - listAddress = Seg2Filespace(list, parent->baseAddress); - uint32_t auxPtr = listAddress; - - multiList.reserve(count); - for (size_t i = 0; i < count; ++i) - { - RoomShapeImageMultiBgEntry bg(false, prefix, auxPtr, parent); - multiList.push_back(bg); - auxPtr += bg.GetRawDataSize(); - bgImageArrayBody += bg.GetBodySourceCode(); - if (i + 1 < count) - { - bgImageArrayBody += "\n"; - } - } - - Declaration* decl = parent->GetDeclaration(listAddress); - if (decl == nullptr) - { - parent->AddDeclarationArray( - listAddress, DeclarationAlignment::Align4, - count * multiList.at(0).GetRawDataSize(), multiList.at(0).GetSourceTypeName(), - multiList.at(0).GetName().c_str(), count, bgImageArrayBody); - } - } - break; - - default: - HANDLE_ERROR(WarningType::InvalidExtractedData, - StringHelper::Sprintf("unknown format: %i", format), ""); - break; - } -} - -size_t PolygonType1::GetRawDataSize() const -{ - switch (format) - { - case 1: - return 0x20; - - case 2: - return 0x10; - } - return 0x20; -} - -std::string PolygonType1::GetBodySourceCode() const -{ - std::string bodyStr = "\n "; - - bodyStr += "{ "; - bodyStr += StringHelper::Sprintf("%i, %i, ", type, format); - - std::string dlistStr; - Globals::Instance->GetSegmentedPtrName(dlist, parent, "", dlistStr); - - bodyStr += StringHelper::Sprintf("%s, ", dlistStr.c_str()); - bodyStr += "}, \n"; - - std::string listStr = "NULL"; - switch (format) - { - case 1: - bodyStr += single.GetBodySourceCode(); - break; - case 2: - Globals::Instance->GetSegmentedPtrName(list, parent, "RoomShapeImageMultiBgEntry", listStr); - bodyStr += StringHelper::Sprintf(" %i, %s, \n", count, listStr.c_str()); - break; - - default: - break; - } - - return bodyStr; -} - -std::string PolygonType1::GetSourceTypeName() const -{ - switch (format) - { - case 1: - return "RoomShapeImageSingle"; - - case 2: - return "RoomShapeImageMulti"; - } - return "ERROR"; - // return "PolygonType1"; -} - -RoomShapeCullable::RoomShapeCullable(ZFile* nParent, uint32_t nRawDataIndex, ZRoom* nRoom) - : PolygonTypeBase(nParent, nRawDataIndex, nRoom) -{ -} - -void RoomShapeCullable::ParseRawData() -{ - const auto& rawData = parent->GetRawData(); - - num = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x01); - - start = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x04); - end = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x08); - - uint32_t currentPtr = GETSEGOFFSET(start); - - polyDLists.reserve(num); - for (size_t i = 0; i < num; i++) - { - RoomShapeDListsEntry entry(parent); - entry.zRoom = zRoom; - entry.SetPolyType(type); - entry.ExtractFromFile(currentPtr); - entry.DeclareReferences(zRoom->GetName()); - polyDLists.push_back(entry); - currentPtr += entry.GetRawDataSize(); - } -} - -void RoomShapeCullable::DeclareReferences(const std::string& prefix) -{ - if (num > 0) - { - std::string declaration; - - for (size_t i = 0; i < polyDLists.size(); i++) - { - declaration += - StringHelper::Sprintf("\t{ %s },", polyDLists.at(i).GetBodySourceCode().c_str()); - if (i + 1 < polyDLists.size()) - declaration += "\n"; - } - - std::string polyDlistType = polyDLists.at(0).GetSourceTypeName(); - std::string polyDListName; - polyDListName = StringHelper::Sprintf("%s%s_%06X", prefix.c_str(), polyDlistType.c_str(), - GETSEGOFFSET(start)); - - Declaration* decl = parent->AddDeclarationArray( - GETSEGOFFSET(start), DeclarationAlignment::Align4, - polyDLists.size() * polyDLists.at(0).GetRawDataSize(), polyDlistType, polyDListName, - polyDLists.size(), declaration); - decl->forceArrayCnt = true; - } - - parent->AddDeclaration(GETSEGOFFSET(end), DeclarationAlignment::Align4, 4, "s32", - StringHelper::Sprintf("%s_terminatorMaybe_%06X", - parent->GetName().c_str(), GETSEGOFFSET(end)), - "0x01000000"); -} - -std::string RoomShapeCullable::GetBodySourceCode() const -{ - std::string listName; - Globals::Instance->GetSegmentedPtrName(start, parent, "", listName); - - std::string body = StringHelper::Sprintf("\n %i, %i,\n", type, polyDLists.size()); - body += StringHelper::Sprintf(" %s,\n", listName.c_str()); - body += - StringHelper::Sprintf(" %s + ARRAY_COUNTU(%s)\n", listName.c_str(), listName.c_str()); - return body; -} - -size_t RoomShapeCullable::GetRawDataSize() const -{ - return 0x0C; -} - -DeclarationAlignment RoomShapeCullable::GetDeclarationAlignment() const -{ - return DeclarationAlignment::Align4; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetMesh.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetMesh.h deleted file mode 100644 index c0f15da9d3..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetMesh.h +++ /dev/null @@ -1,160 +0,0 @@ -#pragma once - -#include -#include "ZBackground.h" -#include "ZDisplayList.h" -#include "ZRoom/ZRoomCommand.h" - -class RoomShapeDListsEntry : public ZResource -{ -public: - ZRoom* zRoom; - - uint8_t polyType; - - int16_t x, y, z; // polyType == 2 - int16_t unk_06; // polyType == 2 - - segptr_t opa = 0; // Gfx* - segptr_t xlu = 0; // Gfx* - - ZDisplayList* opaDList = nullptr; // Gfx* - ZDisplayList* xluDList = nullptr; // Gfx* - - RoomShapeDListsEntry(ZFile* nParent); - - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - void GetSourceOutputCode(const std::string& prefix) override; - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - size_t GetRawDataSize() const override; - - void SetPolyType(uint8_t nPolyType); - -protected: - ZDisplayList* MakeDlist(segptr_t ptr, const std::string& prefix); -}; - -class RoomShapeImageMultiBgEntry : public ZResource -{ -public: - uint16_t unk_00; - uint8_t id; - segptr_t source; - uint32_t unk_0C; - uint32_t tlut; - uint16_t width; - uint16_t height; - uint8_t fmt; - uint8_t siz; - uint16_t mode0; - uint16_t tlutCount; - - ZBackground* sourceBackground; - - bool isSubStruct; - - RoomShapeImageMultiBgEntry(ZFile* nParent); - RoomShapeImageMultiBgEntry(bool nIsSubStruct, const std::string& prefix, uint32_t nRawDataIndex, - ZFile* nParent); - - void ParseRawData() override; - - std::string GetBodySourceCode() const override; - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - size_t GetRawDataSize() const override; - -protected: - ZBackground* MakeBackground(segptr_t ptr, const std::string& prefix); -}; - -class PolygonTypeBase : public ZResource -{ -public: - uint8_t type; - std::vector polyDLists; - - PolygonTypeBase(ZFile* nParent, uint32_t nRawDataIndex, ZRoom* nRoom); - - void DeclareAndGenerateOutputCode(const std::string& prefix); - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - -protected: - ZRoom* zRoom; -}; - -class PolygonType1 : public PolygonTypeBase -{ -public: - uint8_t format; - segptr_t dlist; - - // single - RoomShapeImageMultiBgEntry single; - - // multi - uint8_t count; - segptr_t list; // RoomShapeImageMultiBgEntry* - std::vector multiList; - - PolygonType1(ZFile* nParent, uint32_t nRawDataIndex, ZRoom* nRoom); - - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - std::string GetSourceTypeName() const override; - - size_t GetRawDataSize() const override; -}; - -class RoomShapeCullable : public PolygonTypeBase -{ -public: - uint8_t num; - segptr_t start; - segptr_t end; - - RoomShapeCullable(ZFile* nParent, uint32_t nRawDataIndex, ZRoom* nRoom); - - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - size_t GetRawDataSize() const override; - DeclarationAlignment GetDeclarationAlignment() const override; -}; - -class SetMesh : public ZRoomCommand -{ -public: - uint8_t data; - uint8_t meshHeaderType; - std::shared_ptr polyType; - - SetMesh(ZFile* nParent); - - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - RoomCommand GetRoomCommand() const override; - std::string GetCommandCName() const override; - -private: - std::string GenDListExterns(ZDisplayList* dList); -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetMinimapChests.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetMinimapChests.cpp deleted file mode 100644 index b1985f8904..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetMinimapChests.cpp +++ /dev/null @@ -1,82 +0,0 @@ -#include "SetMinimapChests.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "ZFile.h" -#include "ZRoom/ZRoom.h" - -SetMinimapChests::SetMinimapChests(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -void SetMinimapChests::ParseRawData() -{ - ZRoomCommand::ParseRawData(); - int numChests = cmdArg1; - - offset_t currentPtr = segmentOffset; - - chests.reserve(numChests); - for (int32_t i = 0; i < numChests; i++) - { - MinimapChest chest(parent->GetRawData(), currentPtr); - chests.push_back(chest); - - currentPtr += 10; - } -} - -void SetMinimapChests::DeclareReferences(const std::string& prefix) -{ - std::string declaration; - - size_t index = 0; - for (const auto& chest : chests) - { - declaration += StringHelper::Sprintf(" { %s },", chest.GetBodySourceCode().c_str()); - - if (index < chests.size() - 1) - declaration += "\n"; - - index++; - } - - parent->AddDeclarationArray( - segmentOffset, DeclarationAlignment::Align4, chests.size() * 10, "MinimapChest", - StringHelper::Sprintf("%sMinimapChests0x%06X", prefix.c_str(), segmentOffset), - chests.size(), declaration); -} - -std::string SetMinimapChests::GetBodySourceCode() const -{ - std::string listName; - Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "MinimapChest", listName); - return StringHelper::Sprintf("SCENE_CMD_MINIMAP_COMPASS_ICON_INFO(0x%02X, %s)", chests.size(), - listName.c_str()); -} - -std::string SetMinimapChests::GetCommandCName() const -{ - return "SCmdMinimapChests"; -} - -RoomCommand SetMinimapChests::GetRoomCommand() const -{ - return RoomCommand::SetMinimapChests; -} - -MinimapChest::MinimapChest(const std::vector& rawData, uint32_t rawDataIndex) - : unk0(BitConverter::ToUInt16BE(rawData, rawDataIndex + 0)), - unk2(BitConverter::ToUInt16BE(rawData, rawDataIndex + 2)), - unk4(BitConverter::ToUInt16BE(rawData, rawDataIndex + 4)), - unk6(BitConverter::ToUInt16BE(rawData, rawDataIndex + 6)), - unk8(BitConverter::ToUInt16BE(rawData, rawDataIndex + 8)) -{ -} - -std::string MinimapChest::GetBodySourceCode() const -{ - return StringHelper::Sprintf("0x%04X, 0x%04X, 0x%04X, 0x%04X, 0x%04X", unk0, unk2, unk4, unk6, - unk8); -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetMinimapChests.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetMinimapChests.h deleted file mode 100644 index 0db09a8a25..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetMinimapChests.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include "ZRoom/ZRoomCommand.h" - -class MinimapChest -{ -public: - MinimapChest(const std::vector& rawData, uint32_t rawDataIndex); - - std::string GetBodySourceCode() const; - -protected: - uint16_t unk0; - uint16_t unk2; - uint16_t unk4; - uint16_t unk6; - uint16_t unk8; -}; - -class SetMinimapChests : public ZRoomCommand -{ -public: - std::vector chests; - - SetMinimapChests(ZFile* nParent); - - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - RoomCommand GetRoomCommand() const override; - std::string GetCommandCName() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetMinimapList.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetMinimapList.cpp deleted file mode 100644 index a5aac2a543..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetMinimapList.cpp +++ /dev/null @@ -1,96 +0,0 @@ -#include "SetMinimapList.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "ZFile.h" -#include "ZRoom/ZRoom.h" - -SetMinimapList::SetMinimapList(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -void SetMinimapList::ParseRawData() -{ - ZRoomCommand::ParseRawData(); - listSegmentAddr = BitConverter::ToInt32BE(parent->GetRawData(), segmentOffset); - listSegmentOffset = GETSEGOFFSET(listSegmentAddr); - scale = BitConverter::ToInt16BE(parent->GetRawData(), segmentOffset + 4); - - uint32_t currentPtr = listSegmentOffset; - - minimaps.reserve(zRoom->roomCount); - for (int32_t i = 0; i < zRoom->roomCount; i++) - { - MinimapEntry entry(parent->GetRawData(), currentPtr); - minimaps.push_back(entry); - - currentPtr += 10; - } -} - -void SetMinimapList::DeclareReferences(const std::string& prefix) -{ - { - std::string declaration; - - size_t index = 0; - for (const auto& entry : minimaps) - { - declaration += StringHelper::Sprintf(" { %s },", entry.GetBodySourceCode().c_str()); - - if (index < minimaps.size() - 1) - declaration += "\n"; - - index++; - } - - parent->AddDeclarationArray( - listSegmentOffset, DeclarationAlignment::Align4, minimaps.size() * 10, "MinimapEntry", - StringHelper::Sprintf("%sMinimapEntryList0x%06X", prefix.c_str(), listSegmentOffset), - minimaps.size(), declaration); - } - - { - std::string listName; - Globals::Instance->GetSegmentedPtrName(listSegmentAddr, parent, "MinimapEntry", listName); - std::string declaration = StringHelper::Sprintf("\n\t%s, %d\n", listName.c_str(), scale); - - parent->AddDeclaration( - segmentOffset, DeclarationAlignment::Align4, 8, "MinimapList", - StringHelper::Sprintf("%sMinimapList0x%06X", prefix.c_str(), segmentOffset), - declaration); - } -} - -std::string SetMinimapList::GetBodySourceCode() const -{ - std::string listName; - Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "MinimapList", listName); - return StringHelper::Sprintf("SCENE_CMD_MINIMAP_INFO(%s)", listName.c_str()); -} - -std::string SetMinimapList::GetCommandCName() const -{ - return "SCmdMinimapSettings"; -} - -RoomCommand SetMinimapList::GetRoomCommand() const -{ - return RoomCommand::SetMinimapList; -} - -MinimapEntry::MinimapEntry(const std::vector& rawData, uint32_t rawDataIndex) - : unk0(BitConverter::ToUInt16BE(rawData, rawDataIndex + 0)), - unk2(BitConverter::ToUInt16BE(rawData, rawDataIndex + 2)), - unk4(BitConverter::ToUInt16BE(rawData, rawDataIndex + 4)), - unk6(BitConverter::ToUInt16BE(rawData, rawDataIndex + 6)), - unk8(BitConverter::ToUInt16BE(rawData, rawDataIndex + 8)) -{ -} - -std::string MinimapEntry::GetBodySourceCode() const -{ - return StringHelper::Sprintf("0x%04X, 0x%04X, 0x%04X, 0x%04X, 0x%04X", unk0, unk2, unk4, unk6, - unk8); -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetMinimapList.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetMinimapList.h deleted file mode 100644 index fcf7ad7a6f..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetMinimapList.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#include "ZRoom/ZRoomCommand.h" - -class MinimapEntry -{ -public: - MinimapEntry(const std::vector& rawData, uint32_t rawDataIndex); - - std::string GetBodySourceCode() const; - -protected: - uint16_t unk0; - uint16_t unk2; - uint16_t unk4; - uint16_t unk6; - uint16_t unk8; -}; - -class SetMinimapList : public ZRoomCommand -{ -public: - std::vector minimaps; - - SetMinimapList(ZFile* nParent); - - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - RoomCommand GetRoomCommand() const override; - std::string GetCommandCName() const override; - -private: - segptr_t listSegmentAddr; - uint32_t listSegmentOffset; - int16_t scale; -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetObjectList.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetObjectList.cpp deleted file mode 100644 index 3048aa2d49..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetObjectList.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include "SetObjectList.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "ZFile.h" -#include "ZRoom/ZNames.h" -#include "ZRoom/ZRoom.h" - -SetObjectList::SetObjectList(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -void SetObjectList::ParseRawData() -{ - ZRoomCommand::ParseRawData(); - uint8_t objectCnt = parent->GetRawData().at(rawDataIndex + 1); - uint32_t currentPtr = segmentOffset; - - objects.reserve(objectCnt); - for (uint8_t i = 0; i < objectCnt; i++) - { - uint16_t objectIndex = BitConverter::ToInt16BE(parent->GetRawData(), currentPtr); - objects.push_back(objectIndex); - currentPtr += 2; - } -} - -void SetObjectList::DeclareReferences(const std::string& prefix) -{ - if (!objects.empty()) - { - std::string declaration; - - for (size_t i = 0; i < objects.size(); i++) - { - uint16_t objectIndex = objects[i]; - declaration += - StringHelper::Sprintf(" %s,", ZNames::GetObjectName(objectIndex).c_str()); - - if (i < objects.size() - 1) - declaration += "\n"; - } - - parent->AddDeclarationArray( - segmentOffset, DeclarationAlignment::Align4, objects.size() * 2, "s16", - StringHelper::Sprintf("%sObjectList_%06X", prefix.c_str(), segmentOffset), - objects.size(), declaration); - } -} - -std::string SetObjectList::GetBodySourceCode() const -{ - std::string listName; - Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "s16", listName); - return StringHelper::Sprintf("SCENE_CMD_OBJECT_LIST(%i, %s)", objects.size(), listName.c_str()); -} - -std::string SetObjectList::GetCommandCName() const -{ - return "SCmdObjectList"; -} - -RoomCommand SetObjectList::GetRoomCommand() const -{ - return RoomCommand::SetObjectList; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetObjectList.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetObjectList.h deleted file mode 100644 index 03c159483c..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetObjectList.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include "ZRoom/ZRoomCommand.h" - -class SetObjectList : public ZRoomCommand -{ -public: - std::vector objects; - - SetObjectList(ZFile* nParent); - - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - std::string GetCommandCName() const override; - RoomCommand GetRoomCommand() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetPathways.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetPathways.cpp deleted file mode 100644 index 967d10b8d5..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetPathways.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include "SetPathways.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "ZFile.h" -#include "ZRoom/ZRoom.h" - -SetPathways::SetPathways(ZFile* nParent) : ZRoomCommand(nParent), pathwayList(nParent) -{ -} - -void SetPathways::DeclareReferences([[maybe_unused]] const std::string& prefix) -{ - if (segmentOffset != 0) - { - std::string varName = - StringHelper::Sprintf("%sPathway_%06X", prefix.c_str(), segmentOffset); - parent->AddDeclarationPlaceholder(segmentOffset, varName); - } -} - -void SetPathways::ParseRawDataLate() -{ - if (Globals::Instance->game == ZGame::MM_RETAIL) - { - auto numPaths = zRoom->parent->GetDeclarationSizeFromNeighbor(segmentOffset) / 8; - pathwayList.SetNumPaths(numPaths); - } - - pathwayList.ExtractFromFile(segmentOffset); -} - -void SetPathways::DeclareReferencesLate(const std::string& prefix) -{ - std::string varName = StringHelper::Sprintf("%sPathway_%06X", prefix.c_str(), segmentOffset); - pathwayList.SetName(varName); - pathwayList.DeclareReferences(prefix); - pathwayList.GetSourceOutputCode(prefix); -} - -std::string SetPathways::GetBodySourceCode() const -{ - std::string listName; - Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "Path", listName); - return StringHelper::Sprintf("SCENE_CMD_PATH_LIST(%s)", listName.c_str()); -} - -std::string SetPathways::GetCommandCName() const -{ - return "SCmdPathList"; -} - -RoomCommand SetPathways::GetRoomCommand() const -{ - return RoomCommand::SetPathways; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetPathways.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetPathways.h deleted file mode 100644 index 9abc93d32e..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetPathways.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include "Vec3s.h" -#include "ZPath.h" -#include "ZResource.h" -#include "ZRoom/ZRoomCommand.h" - -class SetPathways : public ZRoomCommand -{ -public: - ZPath pathwayList; - - SetPathways(ZFile* nParent); - - void DeclareReferences(const std::string& prefix) override; - - void ParseRawDataLate() override; - void DeclareReferencesLate(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - RoomCommand GetRoomCommand() const override; - std::string GetCommandCName() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetRoomBehavior.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetRoomBehavior.cpp deleted file mode 100644 index 8c6f4bf514..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetRoomBehavior.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include "SetRoomBehavior.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" - -SetRoomBehavior::SetRoomBehavior(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -void SetRoomBehavior::ParseRawData() -{ - ZRoomCommand::ParseRawData(); - gameplayFlags = cmdArg1; - gameplayFlags2 = BitConverter::ToInt32BE(parent->GetRawData(), rawDataIndex + 0x04); - - currRoomUnk2 = gameplayFlags2 & 0xFF; - - currRoomUnk5 = showInvisActors = (gameplayFlags2 >> 8) & 1; - - msgCtxUnk = (gameplayFlags2 >> 10) & 1; - - enablePosLights = (gameplayFlags2 >> 11) & 1; - kankyoContextUnkE2 = (gameplayFlags2 >> 12) & 1; -} - -std::string SetRoomBehavior::GetBodySourceCode() const -{ - if (Globals::Instance->game == ZGame::MM_RETAIL) - { - std::string enableLights = StringHelper::BoolStr(enablePosLights); - return StringHelper::Sprintf("SCENE_CMD_ROOM_BEHAVIOR(0x%02X, 0x%02X, %i, %i, %s, %i)", - gameplayFlags, currRoomUnk2, currRoomUnk5, msgCtxUnk, - enableLights.c_str(), kankyoContextUnkE2); - } - std::string showInvisible = StringHelper::BoolStr(showInvisActors); - std::string disableWarps = StringHelper::BoolStr(msgCtxUnk); - return StringHelper::Sprintf("SCENE_CMD_ROOM_BEHAVIOR(0x%02X, 0x%02X, %s, %s)", gameplayFlags, - currRoomUnk2, showInvisible.c_str(), disableWarps.c_str()); -} - -std::string SetRoomBehavior::GetCommandCName() const -{ - return "SCmdRoomBehavior"; -} - -RoomCommand SetRoomBehavior::GetRoomCommand() const -{ - return RoomCommand::SetRoomBehavior; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetRoomBehavior.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetRoomBehavior.h deleted file mode 100644 index 47b772d77f..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetRoomBehavior.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#include "ZRoom/ZRoomCommand.h" - -class SetRoomBehavior : public ZRoomCommand -{ -public: - uint8_t gameplayFlags; - uint32_t gameplayFlags2; - - uint8_t currRoomUnk2; - - uint8_t showInvisActors; - uint8_t currRoomUnk5; - - uint8_t msgCtxUnk; - - uint8_t enablePosLights; - uint8_t kankyoContextUnkE2; - - SetRoomBehavior(ZFile* nParent); - - void ParseRawData() override; - - std::string GetBodySourceCode() const override; - - RoomCommand GetRoomCommand() const override; - std::string GetCommandCName() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetRoomList.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetRoomList.cpp deleted file mode 100644 index 24969a14d8..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetRoomList.cpp +++ /dev/null @@ -1,155 +0,0 @@ -#include "SetRoomList.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "ZFile.h" -#include "ZRoom/ZRoom.h" - -SetRoomList::SetRoomList(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -void SetRoomList::ParseRawData() -{ - ZRoomCommand::ParseRawData(); - int numRooms = cmdArg1; - - romfile = new RomFile(parent); - romfile->numRooms = numRooms; - romfile->ExtractFromFile(segmentOffset); - - parent->resources.push_back(romfile); - - zRoom->roomCount = numRooms; -} - -void SetRoomList::DeclareReferences(const std::string& prefix) -{ - ZRoomCommand::DeclareReferences(prefix); - - romfile->DeclareVar(prefix, ""); -} - -std::string SetRoomList::GetBodySourceCode() const -{ - std::string listName; - Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "RomFile", listName); - return StringHelper::Sprintf("SCENE_CMD_ROOM_LIST(%i, %s)", romfile->rooms.size(), - listName.c_str()); -} - -std::string SetRoomList::GetCommandCName() const -{ - return "SCmdRoomList"; -} - -RoomCommand SetRoomList::GetRoomCommand() const -{ - return RoomCommand::SetRoomList; -} - -RomFile::RomFile(ZFile* nParent) : ZResource(nParent) -{ -} - -void RomFile::ParseXML(tinyxml2::XMLElement* reader) -{ - ZResource::ParseXML(reader); - - if (reader->Attribute("NumRooms") != nullptr) - { - numRooms = StringHelper::StrToL(std::string(reader->Attribute("NumRooms"))); - } -} - -void RomFile::ParseRawData() -{ - ZResource::ParseRawData(); - - uint32_t currentPtr = rawDataIndex; - - rooms.reserve(numRooms); - for (int32_t i = 0; i < numRooms; i++) - { - RoomEntry entry(parent->GetRawData(), currentPtr); - rooms.push_back(entry); - - currentPtr += 8; - } -} - -Declaration* RomFile::DeclareVar(const std::string& prefix, const std::string& body) -{ - std::string auxName = name; - if (name == "") - auxName = StringHelper::Sprintf("%sRoomList0x%06X", prefix.c_str(), rawDataIndex); - - return parent->AddDeclarationArray(rawDataIndex, DeclarationAlignment::Align4, - rooms.size() * rooms.at(0).GetRawDataSize(), - GetSourceTypeName(), auxName, rooms.size(), body); -} - -std::string RomFile::GetBodySourceCode() const -{ - std::string declaration; - bool isFirst = true; - - for (ZFile* file : Globals::Instance->files) - { - for (ZResource* res : file->resources) - { - if (res->GetResourceType() == ZResourceType::Room) - { - std::string roomName = res->GetName(); - if (!isFirst) - declaration += "\n"; - - declaration += StringHelper::Sprintf( - "\t{ (uintptr_t)_%sSegmentRomStart, (uintptr_t)_%sSegmentRomEnd },", - roomName.c_str(), roomName.c_str()); - isFirst = false; - } - } - } - - return declaration; -} - -void RomFile::GetSourceOutputCode(const std::string& prefix) -{ - DeclareVar(prefix, GetBodySourceCode()); -} - -std::string RomFile::GetSourceTypeName() const -{ - return "RomFile"; -} - -ZResourceType RomFile::GetResourceType() const -{ - // TODO - return ZResourceType::Error; -} - -size_t RomFile::GetRawDataSize() const -{ - return 8 * rooms.size(); -} - -RoomEntry::RoomEntry(uint32_t nVAS, uint32_t nVAE) -{ - virtualAddressStart = nVAS; - virtualAddressEnd = nVAE; -} - -RoomEntry::RoomEntry(const std::vector& rawData, uint32_t rawDataIndex) - : RoomEntry(BitConverter::ToInt32BE(rawData, rawDataIndex + 0), - BitConverter::ToInt32BE(rawData, rawDataIndex + 4)) -{ -} - -size_t RoomEntry::GetRawDataSize() const -{ - return 0x08; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetRoomList.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetRoomList.h deleted file mode 100644 index 2ae48b68df..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetRoomList.h +++ /dev/null @@ -1,53 +0,0 @@ -#pragma once - -#include "ZRoom/ZRoomCommand.h" - -class RoomEntry -{ -public: - int32_t virtualAddressStart; - int32_t virtualAddressEnd; - - RoomEntry(uint32_t nVAS, uint32_t nVAE); - RoomEntry(const std::vector& rawData, uint32_t rawDataIndex); - - size_t GetRawDataSize() const; -}; - -class RomFile : public ZResource -{ -public: - RomFile(ZFile* nParent); - - void ParseXML(tinyxml2::XMLElement* reader) override; - void ParseRawData() override; - - Declaration* DeclareVar(const std::string& prefix, const std::string& body) override; - std::string GetBodySourceCode() const override; - void GetSourceOutputCode(const std::string& prefix) override; - - std::string GetSourceTypeName() const override; - virtual ZResourceType GetResourceType() const override; - - virtual size_t GetRawDataSize() const override; - - uint8_t numRooms = 0; - std::vector rooms; -}; - -class SetRoomList : public ZRoomCommand -{ -public: - // Borrowed reference. Don't delete. - RomFile* romfile = nullptr; - - SetRoomList(ZFile* nParent); - - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - RoomCommand GetRoomCommand() const override; - std::string GetCommandCName() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetSkyboxModifier.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetSkyboxModifier.cpp deleted file mode 100644 index b16f1355b2..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetSkyboxModifier.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "SetSkyboxModifier.h" - -#include "Utils/StringHelper.h" - -SetSkyboxModifier::SetSkyboxModifier(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -void SetSkyboxModifier::ParseRawData() -{ - ZRoomCommand::ParseRawData(); - disableSky = parent->GetRawData().at(rawDataIndex + 0x04); - disableSunMoon = parent->GetRawData().at(rawDataIndex + 0x05); -} - -std::string SetSkyboxModifier::GetBodySourceCode() const -{ - std::string sky = StringHelper::BoolStr(disableSky); - std::string soonMoon = StringHelper::BoolStr(disableSunMoon); - return StringHelper::Sprintf("SCENE_CMD_SKYBOX_DISABLES(%s, %s)", sky.c_str(), - soonMoon.c_str()); -} - -std::string SetSkyboxModifier::GetCommandCName() const -{ - return "SCmdSkyboxDisables"; -} - -RoomCommand SetSkyboxModifier::GetRoomCommand() const -{ - return RoomCommand::SetSkyboxModifier; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetSkyboxModifier.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetSkyboxModifier.h deleted file mode 100644 index 65935bf928..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetSkyboxModifier.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include "ZRoom/ZRoomCommand.h" - -class SetSkyboxModifier : public ZRoomCommand -{ -public: - uint8_t disableSky; - uint8_t disableSunMoon; - - SetSkyboxModifier(ZFile* nParent); - - void ParseRawData() override; - - std::string GetBodySourceCode() const override; - - std::string GetCommandCName() const override; - RoomCommand GetRoomCommand() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetSkyboxSettings.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetSkyboxSettings.cpp deleted file mode 100644 index d5ae7ef761..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetSkyboxSettings.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "SetSkyboxSettings.h" -#include "Globals.h" -#include "Utils/StringHelper.h" - -SetSkyboxSettings::SetSkyboxSettings(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -void SetSkyboxSettings::ParseRawData() -{ - ZRoomCommand::ParseRawData(); - unk1 = cmdArg1; - skyboxNumber = parent->GetRawData().at(rawDataIndex + 0x04); - cloudsType = parent->GetRawData().at(rawDataIndex + 0x05); - isIndoors = parent->GetRawData().at(rawDataIndex + 0x06); -} - -std::string SetSkyboxSettings::GetBodySourceCode() const -{ - std::string indoors = StringHelper::BoolStr(isIndoors); - if (Globals::Instance->game == ZGame::MM_RETAIL) - return StringHelper::Sprintf("SCENE_CMD_SKYBOX_SETTINGS(0x%02X, %i, %i, %s)", unk1, - skyboxNumber, cloudsType, indoors.c_str()); - return StringHelper::Sprintf("SCENE_CMD_SKYBOX_SETTINGS(%i, %i, %s)", skyboxNumber, cloudsType, - indoors.c_str()); -} - -std::string SetSkyboxSettings::GetCommandCName() const -{ - return "SCmdSkyboxSettings"; -} - -RoomCommand SetSkyboxSettings::GetRoomCommand() const -{ - return RoomCommand::SetSkyboxSettings; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetSkyboxSettings.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetSkyboxSettings.h deleted file mode 100644 index 1c7e01ad40..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetSkyboxSettings.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include "ZRoom/ZRoomCommand.h" - -class SetSkyboxSettings : public ZRoomCommand -{ -public: - uint8_t unk1; // (MM Only) - uint8_t skyboxNumber; - uint8_t cloudsType; - uint8_t isIndoors; - - SetSkyboxSettings(ZFile* nParent); - - void ParseRawData() override; - - std::string GetBodySourceCode() const override; - - std::string GetCommandCName() const override; - RoomCommand GetRoomCommand() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetSoundSettings.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetSoundSettings.cpp deleted file mode 100644 index 54b91328fb..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetSoundSettings.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include "SetSoundSettings.h" -#include "Utils/StringHelper.h" - -SetSoundSettings::SetSoundSettings(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -void SetSoundSettings::ParseRawData() -{ - ZRoomCommand::ParseRawData(); - reverb = cmdArg1; - nightTimeSFX = parent->GetRawData().at(rawDataIndex + 0x06); - musicSequence = parent->GetRawData().at(rawDataIndex + 0x07); -} - -std::string SetSoundSettings::GetBodySourceCode() const -{ - return StringHelper::Sprintf("SCENE_CMD_SOUND_SETTINGS(%i, %i, %i)", reverb, nightTimeSFX, - musicSequence); -} - -std::string SetSoundSettings::GetCommandCName() const -{ - return "SCmdSoundSettings"; -} - -RoomCommand SetSoundSettings::GetRoomCommand() const -{ - return RoomCommand::SetSoundSettings; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetSoundSettings.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetSoundSettings.h deleted file mode 100644 index f378e5e4ed..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetSoundSettings.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include "ZRoom/ZRoomCommand.h" - -class SetSoundSettings : public ZRoomCommand -{ -public: - uint8_t reverb; - uint8_t nightTimeSFX; - uint8_t musicSequence; - - SetSoundSettings(ZFile* nParent); - - void ParseRawData() override; - - std::string GetBodySourceCode() const override; - - RoomCommand GetRoomCommand() const override; - std::string GetCommandCName() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetSpecialObjects.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetSpecialObjects.cpp deleted file mode 100644 index 34edf5ae63..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetSpecialObjects.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include "SetSpecialObjects.h" - -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "ZRoom/ZNames.h" - -SetSpecialObjects::SetSpecialObjects(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -void SetSpecialObjects::ParseRawData() -{ - ZRoomCommand::ParseRawData(); - elfMessage = cmdArg1; - globalObject = BitConverter::ToUInt16BE(parent->GetRawData(), rawDataIndex + 0x06); -} - -std::string SetSpecialObjects::GetBodySourceCode() const -{ - EnumData* enumData = &Globals::Instance->cfg.enumData; - std::string objectName = ZNames::GetObjectName(globalObject); - - if (enumData->naviQuestHintType.find(elfMessage) != enumData->naviQuestHintType.end()) - return StringHelper::Sprintf("SCENE_CMD_SPECIAL_FILES(%s, %s)", - enumData->naviQuestHintType[elfMessage].c_str(), - objectName.c_str()); - - return StringHelper::Sprintf("SCENE_CMD_SPECIAL_FILES(0x%02X, %s)", elfMessage, - objectName.c_str()); -} - -std::string SetSpecialObjects::GetCommandCName() const -{ - return "SCmdSpecialFiles"; -} - -RoomCommand SetSpecialObjects::GetRoomCommand() const -{ - return RoomCommand::SetSpecialObjects; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetSpecialObjects.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetSpecialObjects.h deleted file mode 100644 index 3327d44c38..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetSpecialObjects.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include "ZRoom/ZRoomCommand.h" - -class SetSpecialObjects : public ZRoomCommand -{ -public: - uint8_t elfMessage; - uint16_t globalObject; - - SetSpecialObjects(ZFile* nParent); - - void ParseRawData() override; - - std::string GetBodySourceCode() const override; - - RoomCommand GetRoomCommand() const override; - std::string GetCommandCName() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetStartPositionList.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetStartPositionList.cpp deleted file mode 100644 index 14ca16a962..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetStartPositionList.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include "SetStartPositionList.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "ZFile.h" -#include "ZRoom/ZNames.h" -#include "ZRoom/ZRoom.h" - -SetStartPositionList::SetStartPositionList(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -void SetStartPositionList::ParseRawData() -{ - ZRoomCommand::ParseRawData(); - uint8_t numActors = cmdArg1; - - offset_t currentPtr = segmentOffset; - - actors.reserve(numActors); - for (uint32_t i = 0; i < numActors; i++) - { - actors.push_back(ActorSpawnEntry(parent->GetRawData(), currentPtr)); - currentPtr += 16; - } -} - -void SetStartPositionList::DeclareReferences(const std::string& prefix) -{ - if (!actors.empty()) - { - std::string declaration; - - size_t index = 0; - for (const auto& entry : actors) - { - declaration += StringHelper::Sprintf(" { %s },", entry.GetBodySourceCode().c_str()); - if (index + 1 < actors.size()) - declaration += "\n"; - - index++; - } - - parent->AddDeclarationArray( - segmentOffset, DeclarationAlignment::Align4, actors.size() * 16, "ActorEntry", - StringHelper::Sprintf("%sStartPositionList0x%06X", prefix.c_str(), segmentOffset), - actors.size(), declaration); - } -} - -std::string SetStartPositionList::GetBodySourceCode() const -{ - std::string listName; - Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "ActorEntry", listName); - return StringHelper::Sprintf("SCENE_CMD_SPAWN_LIST(%i, %s)", actors.size(), listName.c_str()); -} - -std::string SetStartPositionList::GetCommandCName() const -{ - return "SCmdSpawnList"; -} - -RoomCommand SetStartPositionList::GetRoomCommand() const -{ - return RoomCommand::SetStartPositionList; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetStartPositionList.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetStartPositionList.h deleted file mode 100644 index 10075adf3c..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetStartPositionList.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include "SetActorList.h" -#include "ZRoom/ZRoomCommand.h" - -class SetStartPositionList : public ZRoomCommand -{ -public: - std::vector actors; - - SetStartPositionList(ZFile* nParent); - - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - RoomCommand GetRoomCommand() const override; - std::string GetCommandCName() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetTimeSettings.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetTimeSettings.cpp deleted file mode 100644 index 9d4d356df7..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetTimeSettings.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include "SetTimeSettings.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" - -SetTimeSettings::SetTimeSettings(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -void SetTimeSettings::ParseRawData() -{ - ZRoomCommand::ParseRawData(); - hour = parent->GetRawData().at(rawDataIndex + 4); - min = parent->GetRawData().at(rawDataIndex + 5); - unk = parent->GetRawData().at(rawDataIndex + 6); -} - -std::string SetTimeSettings::GetBodySourceCode() const -{ - return StringHelper::Sprintf("SCENE_CMD_TIME_SETTINGS(%i, %i, %i)", hour, min, unk); -} - -std::string SetTimeSettings::GetCommandCName() const -{ - return "SCmdTimeSettings"; -} - -RoomCommand SetTimeSettings::GetRoomCommand() const -{ - return RoomCommand::SetTimeSettings; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetTimeSettings.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetTimeSettings.h deleted file mode 100644 index 7ff2711d4e..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetTimeSettings.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include "ZRoom/ZRoomCommand.h" - -class SetTimeSettings : public ZRoomCommand -{ -public: - uint8_t hour; - uint8_t min; - uint8_t unk; - - SetTimeSettings(ZFile* nParent); - - void ParseRawData() override; - - std::string GetBodySourceCode() const override; - - std::string GetCommandCName() const override; - RoomCommand GetRoomCommand() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetTransitionActorList.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetTransitionActorList.cpp deleted file mode 100644 index 67e3e4e184..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetTransitionActorList.cpp +++ /dev/null @@ -1,92 +0,0 @@ -#include "SetTransitionActorList.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "ZFile.h" -#include "ZRoom/ZNames.h" -#include "ZRoom/ZRoom.h" - -SetTransitionActorList::SetTransitionActorList(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -void SetTransitionActorList::ParseRawData() -{ - ZRoomCommand::ParseRawData(); - int numActors = cmdArg1; - uint32_t currentPtr = segmentOffset; - - transitionActors.reserve(numActors); - for (int32_t i = 0; i < numActors; i++) - { - TransitionActorEntry entry(parent->GetRawData(), currentPtr); - transitionActors.push_back(entry); - - currentPtr += 16; - } -} - -void SetTransitionActorList::DeclareReferences(const std::string& prefix) -{ - std::string declaration; - - size_t index = 0; - for (const auto& entry : transitionActors) - { - declaration += StringHelper::Sprintf(" { %s },", entry.GetBodySourceCode().c_str()); - if (index + 1 < transitionActors.size()) - { - declaration += "\n"; - } - - index++; - } - - parent->AddDeclarationArray( - segmentOffset, DeclarationAlignment::Align4, transitionActors.size() * 16, - "TransitionActorEntry", - StringHelper::Sprintf("%sTransitionActorList_%06X", prefix.c_str(), segmentOffset), - transitionActors.size(), declaration); -} - -std::string SetTransitionActorList::GetBodySourceCode() const -{ - std::string listName; - Globals::Instance->GetSegmentedPtrName(cmdArg2, parent, "TransitionActorEntry", listName); - return StringHelper::Sprintf("SCENE_CMD_TRANSITION_ACTOR_LIST(%i, %s)", transitionActors.size(), - listName.c_str()); -} - -std::string SetTransitionActorList::GetCommandCName() const -{ - return "SCmdTransiActorList"; -} - -RoomCommand SetTransitionActorList::GetRoomCommand() const -{ - return RoomCommand::SetTransitionActorList; -} - -TransitionActorEntry::TransitionActorEntry(const std::vector& rawData, int rawDataIndex) -{ - frontObjectRoom = rawData[rawDataIndex + 0]; - frontTransitionReaction = rawData[rawDataIndex + 1]; - backObjectRoom = rawData[rawDataIndex + 2]; - backTransitionReaction = rawData[rawDataIndex + 3]; - actorNum = BitConverter::ToInt16BE(rawData, rawDataIndex + 4); - posX = BitConverter::ToInt16BE(rawData, rawDataIndex + 6); - posY = BitConverter::ToInt16BE(rawData, rawDataIndex + 8); - posZ = BitConverter::ToInt16BE(rawData, rawDataIndex + 10); - rotY = BitConverter::ToInt16BE(rawData, rawDataIndex + 12); - initVar = BitConverter::ToInt16BE(rawData, rawDataIndex + 14); -} - -std::string TransitionActorEntry::GetBodySourceCode() const -{ - std::string actorStr = ZNames::GetActorName(actorNum); - - return StringHelper::Sprintf("%i, %i, %i, %i, %s, %i, %i, %i, %i, 0x%04X", frontObjectRoom, - frontTransitionReaction, backObjectRoom, backTransitionReaction, - actorStr.c_str(), posX, posY, posZ, rotY, initVar); -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetTransitionActorList.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetTransitionActorList.h deleted file mode 100644 index a5ce2e66fd..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetTransitionActorList.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#include "ZRoom/ZRoomCommand.h" - -class TransitionActorEntry -{ -public: - uint8_t frontObjectRoom; - uint8_t frontTransitionReaction; - uint8_t backObjectRoom; - uint8_t backTransitionReaction; - uint16_t actorNum; - int16_t posX, posY, posZ; - int16_t rotY; - uint16_t initVar; - - TransitionActorEntry(const std::vector& rawData, int rawDataIndex); - - std::string GetBodySourceCode() const; -}; - -class SetTransitionActorList : public ZRoomCommand -{ -public: - std::vector transitionActors; - - SetTransitionActorList(ZFile* nParent); - - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - RoomCommand GetRoomCommand() const override; - std::string GetCommandCName() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetWind.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetWind.cpp deleted file mode 100644 index 1893b56018..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetWind.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "SetWind.h" -#include "Utils/StringHelper.h" - -SetWind::SetWind(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -void SetWind::ParseRawData() -{ - ZRoomCommand::ParseRawData(); - auto& parentRawData = parent->GetRawData(); - windWest = parentRawData.at(rawDataIndex + 0x04); - windVertical = parentRawData.at(rawDataIndex + 0x05); - windSouth = parentRawData.at(rawDataIndex + 0x06); - clothFlappingStrength = parentRawData.at(rawDataIndex + 0x07); -} - -std::string SetWind::GetBodySourceCode() const -{ - return StringHelper::Sprintf("SCENE_CMD_WIND_SETTINGS(%i, %i, %i, %i)", windWest, windVertical, - windSouth, clothFlappingStrength); -} - -std::string SetWind::GetCommandCName() const -{ - return "SCmdWindSettings"; -} - -RoomCommand SetWind::GetRoomCommand() const -{ - return RoomCommand::SetWind; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetWind.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetWind.h deleted file mode 100644 index 05eaafeda8..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetWind.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include "ZRoom/ZRoomCommand.h" - -class SetWind : public ZRoomCommand -{ -public: - uint8_t windWest; - uint8_t windVertical; - uint8_t windSouth; - uint8_t clothFlappingStrength; - - SetWind(ZFile* nParent); - - void ParseRawData() override; - - std::string GetBodySourceCode() const override; - - std::string GetCommandCName() const override; - RoomCommand GetRoomCommand() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetWorldMapVisited.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetWorldMapVisited.cpp deleted file mode 100644 index fa28547e62..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetWorldMapVisited.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "SetWorldMapVisited.h" - -#include "Utils/StringHelper.h" -#include "Globals.h" - -SetWorldMapVisited::SetWorldMapVisited(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -std::string SetWorldMapVisited::GetBodySourceCode() const -{ - if (Globals::Instance->game == ZGame::MM_RETAIL) - return "SCENE_CMD_SET_REGION_VISITED()"; - else - return "SCENE_CMD_MISC_SETTINGS()"; -} - -std::string SetWorldMapVisited::GetCommandCName() const -{ - return "SCmdWorldMapVisited"; -} - -RoomCommand SetWorldMapVisited::GetRoomCommand() const -{ - return RoomCommand::SetWorldMapVisited; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetWorldMapVisited.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetWorldMapVisited.h deleted file mode 100644 index a7ad93154d..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetWorldMapVisited.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include "ZRoom/ZRoomCommand.h" - -class SetWorldMapVisited : public ZRoomCommand -{ -public: - SetWorldMapVisited(ZFile* nParent); - - std::string GetBodySourceCode() const override; - - RoomCommand GetRoomCommand() const override; - std::string GetCommandCName() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/Unused09.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/Unused09.cpp deleted file mode 100644 index 9dfcaa5c23..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/Unused09.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "Unused09.h" -#include "Utils/StringHelper.h" - -Unused09::Unused09(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -std::string Unused09::GetBodySourceCode() const -{ - return "SCENE_CMD_UNK_09()"; -} - -std::string Unused09::GetCommandCName() const -{ - return "SceneCmd"; -} - -RoomCommand Unused09::GetRoomCommand() const -{ - return RoomCommand::Unused09; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/Unused09.h b/tools/ZAPD/ZAPD/ZRoom/Commands/Unused09.h deleted file mode 100644 index a38985eeaa..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/Unused09.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include "ZRoom/ZRoomCommand.h" - -class Unused09 : public ZRoomCommand -{ -public: - Unused09(ZFile* nParent); - - std::string GetBodySourceCode() const override; - - RoomCommand GetRoomCommand() const override; - std::string GetCommandCName() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/Unused1D.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/Unused1D.cpp deleted file mode 100644 index b8ea13652f..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/Unused1D.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "Unused1D.h" -#include "Utils/StringHelper.h" - -Unused1D::Unused1D(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -std::string Unused1D::GetBodySourceCode() const -{ - return StringHelper::Sprintf("{ %s, 0x00, 0x00 }", GetCommandHex().c_str()); -} - -std::string Unused1D::GetCommandCName() const -{ - return "SceneCmd"; -} - -RoomCommand Unused1D::GetRoomCommand() const -{ - return RoomCommand::Unused1D; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/Unused1D.h b/tools/ZAPD/ZAPD/ZRoom/Commands/Unused1D.h deleted file mode 100644 index dea0f98ee5..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/Unused1D.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include "ZRoom/ZRoomCommand.h" - -class Unused1D : public ZRoomCommand -{ -public: - Unused1D(ZFile* nParent); - - std::string GetBodySourceCode() const override; - - RoomCommand GetRoomCommand() const override; - std::string GetCommandCName() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/ZRoomCommandUnk.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/ZRoomCommandUnk.cpp deleted file mode 100644 index a892086c2a..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/ZRoomCommandUnk.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "ZRoomCommandUnk.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "ZRoom/ZRoom.h" - -ZRoomCommandUnk::ZRoomCommandUnk(ZFile* nParent) : ZRoomCommand(nParent) -{ -} - -std::string ZRoomCommandUnk::GetBodySourceCode() const -{ - return StringHelper::Sprintf("{ %s, 0x%02X, 0x%06X } /* WARNING: " - "UNIMPLEMENTED ROOM COMMAND */", - GetCommandHex().c_str(), cmdArg1, cmdArg2); -} - -RoomCommand ZRoomCommandUnk::GetRoomCommand() const -{ - return RoomCommand::Error; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/ZRoomCommandUnk.h b/tools/ZAPD/ZAPD/ZRoom/Commands/ZRoomCommandUnk.h deleted file mode 100644 index e381fe5a52..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/ZRoomCommandUnk.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once -#include "ZRoom/ZRoomCommand.h" - -class ZRoomCommandUnk : public ZRoomCommand -{ -public: - ZRoomCommandUnk(ZFile* nParent); - - std::string GetBodySourceCode() const override; - - RoomCommand GetRoomCommand() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/ZNames.h b/tools/ZAPD/ZAPD/ZRoom/ZNames.h deleted file mode 100644 index 83c217e999..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/ZNames.h +++ /dev/null @@ -1,68 +0,0 @@ -#pragma once - -#include - -#include "Globals.h" -#include "Utils/StringHelper.h" - -class ZNames -{ -public: - static std::string GetObjectName(size_t id) - { - if (id >= Globals::Instance->cfg.objectList.size()) - return StringHelper::Sprintf("0x%04X", id); - return Globals::Instance->cfg.objectList[id]; - } - - static std::string GetActorName(uint16_t id) - { - switch (Globals::Instance->game) - { - case ZGame::OOT_RETAIL: - case ZGame::OOT_SW97: - if (id < ZNames::GetNumActors()) - return Globals::Instance->cfg.actorList[id]; - else - return StringHelper::Sprintf("0x%04X", id); - case ZGame::MM_RETAIL: - { - int32_t flags = id & 0xF000; - id &= 0xFFF; - std::string name; - if (id < ZNames::GetNumActors()) - name = Globals::Instance->cfg.actorList[id]; - else - name = StringHelper::Sprintf("0x%04X", id); - - if (flags == 0) - return name; - else - return StringHelper::Sprintf("%s | 0x%04X", name.c_str(), flags); - } - } - - return ""; - } - - static std::string GetEntranceName(uint16_t id) - { - if (ZNames::GetNumEntrances() == 0 || ZNames::GetNumSpecialEntrances() == 0) - return StringHelper::Sprintf("0x%04X", id); - - if (id < ZNames::GetNumEntrances()) - return Globals::Instance->cfg.entranceList[id]; - else if ((id >= 0x7FF9 && id <= 0x7FFF) && - !((id - 0x7FF9U) > GetNumSpecialEntrances())) // Special entrances - return Globals::Instance->cfg.specialEntranceList[id - 0x7FF9]; - else - return StringHelper::Sprintf("0x%04X", id); - } - - static size_t GetNumActors() { return Globals::Instance->cfg.actorList.size(); } - static size_t GetNumEntrances() { return Globals::Instance->cfg.entranceList.size(); } - static size_t GetNumSpecialEntrances() - { - return Globals::Instance->cfg.specialEntranceList.size(); - } -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/ZRoom.cpp b/tools/ZAPD/ZAPD/ZRoom/ZRoom.cpp deleted file mode 100644 index a291c36feb..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/ZRoom.cpp +++ /dev/null @@ -1,409 +0,0 @@ -#include "ZRoom.h" -#include -#include -#include -#include -#include - -#include "Commands/EndMarker.h" -#include "Commands/SetCutsceneEntryList.h" -#include "Commands/SetActorList.h" -#include "Commands/SetAlternateHeaders.h" -#include "Commands/SetAnimatedMaterialList.h" -#include "Commands/SetCameraSettings.h" -#include "Commands/SetCollisionHeader.h" -#include "Commands/SetCsCamera.h" -#include "Commands/SetCutscenes.h" -#include "Commands/SetEchoSettings.h" -#include "Commands/SetEntranceList.h" -#include "Commands/SetExitList.h" -#include "Commands/SetLightList.h" -#include "Commands/SetLightingSettings.h" -#include "Commands/SetMesh.h" -#include "Commands/SetMinimapChests.h" -#include "Commands/SetMinimapList.h" -#include "Commands/SetObjectList.h" -#include "Commands/SetPathways.h" -#include "Commands/SetRoomBehavior.h" -#include "Commands/SetRoomList.h" -#include "Commands/SetSkyboxModifier.h" -#include "Commands/SetSkyboxSettings.h" -#include "Commands/SetSoundSettings.h" -#include "Commands/SetSpecialObjects.h" -#include "Commands/SetStartPositionList.h" -#include "Commands/SetTimeSettings.h" -#include "Commands/SetTransitionActorList.h" -#include "Commands/SetWind.h" -#include "Commands/SetWorldMapVisited.h" -#include "Commands/Unused09.h" -#include "Commands/Unused1D.h" -#include "Commands/ZRoomCommandUnk.h" -#include "Globals.h" -#include "Utils/File.h" -#include "Utils/Path.h" -#include "Utils/StringHelper.h" -#include "WarningHandler.h" -#include "ZBlob.h" -#include "ZCutscene.h" -#include "ZFile.h" - -REGISTER_ZFILENODE(Room, ZRoom); -REGISTER_ZFILENODE(Scene, ZRoom); -REGISTER_ZFILENODE(AltHeader, ZRoom); - -ZRoom::ZRoom(ZFile* nParent) : ZResource(nParent) -{ - roomCount = -1; - canHaveInner = true; - RegisterOptionalAttribute("HackMode"); -} - -ZRoom::~ZRoom() -{ - for (ZRoomCommand* cmd : commands) - delete cmd; -} - -void ZRoom::ExtractWithXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex) -{ - ZResource::ExtractWithXML(reader, nRawDataIndex); - - if (hackMode == "syotes_room") - SyotesRoomFix(); - else - DeclareVar(name, ""); -} - -void ZRoom::ExtractFromBinary(uint32_t nRawDataIndex, ZResourceType parentType) -{ - rawDataIndex = nRawDataIndex; - name = GetDefaultName(parent->GetName()); - - zroomType = ZResourceType::AltHeader; - switch (parentType) - { - case ZResourceType::Scene: - case ZResourceType::Room: - case ZResourceType::AltHeader: - parentZroomType = parentType; - break; - - default: - // TODO: error message or something - assert(false); - break; - } - - ParseRawData(); - DeclareVar(name, ""); -} - -void ZRoom::ParseXML(tinyxml2::XMLElement* reader) -{ - ZResource::ParseXML(reader); - - // TODO: HACK: remove this specific check when the repo uses the correct HackMode="syotes_room" - if (name == "syotes_room_0") - { - hackMode = "syotes_room"; - } - - std::string nodeName = std::string(reader->Name()); - if (nodeName == "Scene") - { - zroomType = ZResourceType::Scene; - } - else if (nodeName == "Room") - zroomType = ZResourceType::Room; - else if (nodeName == "AltHeader") - zroomType = ZResourceType::AltHeader; - - if (reader->Attribute("HackMode") != nullptr) - { - hackMode = std::string(reader->Attribute("HackMode")); - if (hackMode != "syotes_room") - { - std::string headerError = StringHelper::Sprintf( - "invalid value found for 'HackMode' attribute: '%s'", hackMode.c_str()); - HANDLE_ERROR_RESOURCE(WarningType::InvalidAttributeValue, parent, this, rawDataIndex, - headerError, ""); - } - } -} - -void ZRoom::ParseRawData() -{ - if (hackMode == "syotes_room") - return; - - bool shouldContinue = true; - uint32_t currentIndex = 0; - uint32_t currentPtr = rawDataIndex; - - const auto& rawData = parent->GetRawData(); - while (shouldContinue) - { - RoomCommand opcode = static_cast(rawData.at(currentPtr)); - - ZRoomCommand* cmd = nullptr; - - auto start = std::chrono::steady_clock::now(); - - switch (opcode) - { - case RoomCommand::SetStartPositionList: - cmd = new SetStartPositionList(parent); - break; // 0x00 - case RoomCommand::SetActorList: - cmd = new SetActorList(parent); - break; // 0x01 - case RoomCommand::SetCsCamera: - cmd = new SetCsCamera(parent); - break; // 0x02 (MM-ONLY) - case RoomCommand::SetCollisionHeader: - cmd = new SetCollisionHeader(parent); - break; // 0x03 - case RoomCommand::SetRoomList: - cmd = new SetRoomList(parent); - break; // 0x04 - case RoomCommand::SetWind: - cmd = new SetWind(parent); - break; // 0x05 - case RoomCommand::SetEntranceList: - cmd = new SetEntranceList(parent); - break; // 0x06 - case RoomCommand::SetSpecialObjects: - cmd = new SetSpecialObjects(parent); - break; // 0x07 - case RoomCommand::SetRoomBehavior: - cmd = new SetRoomBehavior(parent); - break; // 0x08 - case RoomCommand::Unused09: - cmd = new Unused09(parent); - break; // 0x09 - case RoomCommand::SetMesh: - cmd = new SetMesh(parent); - break; // 0x0A - case RoomCommand::SetObjectList: - cmd = new SetObjectList(parent); - break; // 0x0B - case RoomCommand::SetLightList: - cmd = new SetLightList(parent); - break; // 0x0C (MM-ONLY) - case RoomCommand::SetPathways: - cmd = new SetPathways(parent); - break; // 0x0D - case RoomCommand::SetTransitionActorList: - cmd = new SetTransitionActorList(parent); - break; // 0x0E - case RoomCommand::SetLightingSettings: - cmd = new SetLightingSettings(parent); - break; // 0x0F - case RoomCommand::SetTimeSettings: - cmd = new SetTimeSettings(parent); - break; // 0x10 - case RoomCommand::SetSkyboxSettings: - cmd = new SetSkyboxSettings(parent); - break; // 0x11 - case RoomCommand::SetSkyboxModifier: - cmd = new SetSkyboxModifier(parent); - break; // 0x12 - case RoomCommand::SetExitList: - cmd = new SetExitList(parent); - break; // 0x13 - case RoomCommand::EndMarker: - cmd = new EndMarker(parent); - break; // 0x14 - case RoomCommand::SetSoundSettings: - cmd = new SetSoundSettings(parent); - break; // 0x15 - case RoomCommand::SetEchoSettings: - cmd = new SetEchoSettings(parent); - break; // 0x16 - case RoomCommand::SetCutscenes: - cmd = new SetCutscenes(parent); - break; // 0x17 - case RoomCommand::SetAlternateHeaders: - cmd = new SetAlternateHeaders(parent); - break; // 0x18 - case RoomCommand::SetCameraSettings: - if (Globals::Instance->game == ZGame::MM_RETAIL) - cmd = new SetWorldMapVisited(parent); - else - cmd = new SetCameraSettings(parent); - break; // 0x19 - case RoomCommand::SetAnimatedMaterialList: - cmd = new SetAnimatedMaterialList(parent); - break; // 0x1A (MM-ONLY) - case RoomCommand::SetActorCutsceneList: - cmd = new SetActorCutsceneList(parent); - break; // 0x1B (MM-ONLY) - case RoomCommand::SetMinimapList: - cmd = new SetMinimapList(parent); - break; // 0x1C (MM-ONLY) - case RoomCommand::Unused1D: - cmd = new Unused1D(parent); - break; // 0x1D - case RoomCommand::SetMinimapChests: - cmd = new SetMinimapChests(parent); - break; // 0x1E (MM-ONLY) - default: - cmd = new ZRoomCommandUnk(parent); - } - - cmd->commandSet = rawDataIndex; - cmd->ExtractCommandFromRoom(this, currentPtr); - - if (Globals::Instance->profile) - { - auto end = std::chrono::steady_clock::now(); - int64_t diff = - std::chrono::duration_cast(end - start).count(); - if (diff > 50) - printf("OP: %s, TIME: %" PRIi64 "ms\n", cmd->GetCommandCName().c_str(), diff); - } - - cmd->cmdIndex = currentIndex; - - commands.push_back(cmd); - - if (opcode == RoomCommand::EndMarker) - shouldContinue = false; - - currentPtr += 8; - currentIndex++; - } -} - -void ZRoom::DeclareReferences(const std::string& prefix) -{ - for (auto& cmd : commands) - cmd->DeclareReferences(prefix); -} - -void ZRoom::ParseRawDataLate() -{ - for (auto& cmd : commands) - cmd->ParseRawDataLate(); -} - -void ZRoom::DeclareReferencesLate(const std::string& prefix) -{ - for (auto& cmd : commands) - cmd->DeclareReferencesLate(prefix); -} - -Declaration* ZRoom::DeclareVar(const std::string& prefix, const std::string& body) -{ - std::string auxName = name; - if (auxName == "") - auxName = GetDefaultName(prefix); - if (zroomType == ZResourceType::Scene || zroomType == ZResourceType::Room) - auxName = StringHelper::Sprintf("%sCommands", name.c_str()); - - Declaration* decl = - parent->AddDeclarationArray(rawDataIndex, GetDeclarationAlignment(), GetRawDataSize(), - GetSourceTypeName(), auxName, commands.size(), body); - decl->staticConf = staticConf; - return decl; -} - -std::string ZRoom::GetBodySourceCode() const -{ - std::string declaration; - - for (size_t i = 0; i < commands.size(); i++) - { - ZRoomCommand* cmd = commands[i]; - declaration += StringHelper::Sprintf("\t%s,", cmd->GetBodySourceCode().c_str()); - - if (i + 1 < commands.size()) - declaration += "\n"; - } - - return declaration; -} - -std::string ZRoom::GetDefaultName(const std::string& prefix) const -{ - return StringHelper::Sprintf("%sSet_%06X", prefix.c_str(), rawDataIndex); -} - -/* - * There is one room in Ocarina of Time that lacks a header. Room 120, "Syotes", dates - * back to very early in the game's development. Since this room is a special case, - * declare automatically the data its contains whitout the need of a header. - */ -void ZRoom::SyotesRoomFix() -{ - RoomShapeCullable poly(parent, 0, this); - - poly.ParseRawData(); - poly.DeclareReferences(GetName()); - parent->AddDeclaration(0, poly.GetDeclarationAlignment(), poly.GetRawDataSize(), - poly.GetSourceTypeName(), poly.GetDefaultName(GetName()), - poly.GetBodySourceCode()); -} - -ZRoomCommand* ZRoom::FindCommandOfType(RoomCommand cmdType) -{ - for (size_t i = 0; i < commands.size(); i++) - { - if (commands[i]->GetRoomCommand() == cmdType) - return commands[i]; - } - - return nullptr; -} - -size_t ZRoom::GetCommandSizeFromNeighbor(ZRoomCommand* cmd) -{ - int32_t cmdIndex = -1; - - for (size_t i = 0; i < commands.size(); i++) - { - if (commands[i] == cmd) - { - cmdIndex = i; - break; - } - } - - if (cmdIndex != -1) - { - if (cmdIndex + 1 < (int32_t)commands.size()) - return commands[cmdIndex + 1]->cmdAddress - commands[cmdIndex]->cmdAddress; - else - return parent->GetRawData().size() - commands[cmdIndex]->cmdAddress; - } - - return 0; -} - -void ZRoom::GetSourceOutputCode([[maybe_unused]] const std::string& prefix) -{ - if (hackMode != "syotes_room") - DeclareVar(prefix, GetBodySourceCode()); -} - -size_t ZRoom::GetRawDataSize() const -{ - size_t size = 0; - - for (ZRoomCommand* cmd : commands) - size += cmd->GetRawDataSize(); - - return size; -} - -std::string ZRoom::GetSourceTypeName() const -{ - return "SceneCmd"; -} - -ZResourceType ZRoom::GetResourceType() const -{ - assert(zroomType == ZResourceType::Scene || zroomType == ZResourceType::Room || - zroomType == ZResourceType::AltHeader); - return zroomType; -} diff --git a/tools/ZAPD/ZAPD/ZRoom/ZRoom.h b/tools/ZAPD/ZAPD/ZRoom/ZRoom.h deleted file mode 100644 index 950dbbb182..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/ZRoom.h +++ /dev/null @@ -1,49 +0,0 @@ -#pragma once - -#include -#include -#include - -#include "ZResource.h" -#include "ZRoomCommand.h" -#include "tinyxml2.h" - -class ZRoom : public ZResource -{ -public: - std::vector commands; - int32_t roomCount; // Only valid for scenes - - std::string hackMode; - - ZResourceType zroomType = ZResourceType::Error; - ZResourceType parentZroomType = ZResourceType::Error; - - ZRoom(ZFile* nParent); - virtual ~ZRoom(); - - void ExtractWithXML(tinyxml2::XMLElement* reader, uint32_t nRawDataIndex) override; - void ExtractFromBinary(uint32_t nRawDataIndex, ZResourceType parentType); - - void ParseXML(tinyxml2::XMLElement* reader) override; - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - void ParseRawDataLate() override; - void DeclareReferencesLate(const std::string& prefix) override; - - Declaration* DeclareVar(const std::string& prefix, const std::string& body) override; - std::string GetBodySourceCode() const override; - - void GetSourceOutputCode(const std::string& prefix) override; - - std::string GetDefaultName(const std::string& prefix) const override; - size_t GetCommandSizeFromNeighbor(ZRoomCommand* cmd); - ZRoomCommand* FindCommandOfType(RoomCommand cmdType); - - size_t GetRawDataSize() const override; - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - -protected: - void SyotesRoomFix(); -}; diff --git a/tools/ZAPD/ZAPD/ZRoom/ZRoomCommand.cpp b/tools/ZAPD/ZAPD/ZRoom/ZRoomCommand.cpp deleted file mode 100644 index 711c86a409..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/ZRoomCommand.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include "ZRoomCommand.h" - -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "ZRoom.h" - -ZRoomCommand::ZRoomCommand(ZFile* nParent) : ZResource(nParent) -{ -} - -void ZRoomCommand::ExtractCommandFromRoom(ZRoom* nZRoom, uint32_t nRawDataIndex) -{ - zRoom = nZRoom; - rawDataIndex = nRawDataIndex; - - ParseRawData(); -} - -void ZRoomCommand::ParseRawData() -{ - auto& parentRawData = parent->GetRawData(); - cmdID = static_cast(parentRawData.at(rawDataIndex)); - cmdAddress = rawDataIndex; - - cmdArg1 = parentRawData.at(rawDataIndex + 1); - cmdArg2 = BitConverter::ToUInt32BE(parentRawData, rawDataIndex + 4); - segmentOffset = Seg2Filespace(cmdArg2, parent->baseAddress); -} - -RoomCommand ZRoomCommand::GetRoomCommand() const -{ - return RoomCommand::Error; -} - -size_t ZRoomCommand::GetRawDataSize() const -{ - return 0x08; -} - -std::string ZRoomCommand::GetSourceTypeName() const -{ - return GetCommandCName(); -} - -ZResourceType ZRoomCommand::GetResourceType() const -{ - return ZResourceType::RoomCommand; -} - -std::string ZRoomCommand::GetCommandCName() const -{ - return "SceneCmd"; -} - -std::string ZRoomCommand::GetCommandHex() const -{ - return StringHelper::Sprintf("0x%02X", static_cast(cmdID)); -} diff --git a/tools/ZAPD/ZAPD/ZRoom/ZRoomCommand.h b/tools/ZAPD/ZAPD/ZRoom/ZRoomCommand.h deleted file mode 100644 index e4029984c9..0000000000 --- a/tools/ZAPD/ZAPD/ZRoom/ZRoomCommand.h +++ /dev/null @@ -1,84 +0,0 @@ -#pragma once - -#include "tinyxml2.h" - -#include -#include - -#include "ZFile.h" -#include "ZResource.h" - -class ZRoom; - -enum class RoomCommand : uint8_t -{ - SetStartPositionList = 0x00, - SetActorList = 0x01, - SetCsCamera = 0x02, - SetCollisionHeader = 0x03, - SetRoomList = 0x04, - SetWind = 0x05, - SetEntranceList = 0x06, - SetSpecialObjects = 0x07, - SetRoomBehavior = 0x08, - Unused09 = 0x09, - SetMesh = 0x0A, - SetObjectList = 0x0B, - SetLightList = 0x0C, - SetPathways = 0x0D, - SetTransitionActorList = 0x0E, - SetLightingSettings = 0x0F, - SetTimeSettings = 0x10, - SetSkyboxSettings = 0x11, - SetSkyboxModifier = 0x12, - SetExitList = 0x13, - EndMarker = 0x14, - SetSoundSettings = 0x15, - SetEchoSettings = 0x16, - SetCutscenes = 0x17, - SetAlternateHeaders = 0x18, - SetCameraSettings = 0x19, - - // MM Commands - SetWorldMapVisited = 0x19, - SetAnimatedMaterialList = 0x1A, - SetActorCutsceneList = 0x1B, - SetMinimapList = 0x1C, - Unused1D = 0x1D, - SetMinimapChests = 0x1E, - - Error = 0xFF -}; - -class ZRoomCommand : public ZResource -{ -public: - int32_t cmdAddress; - uint32_t cmdIndex; - uint32_t commandSet; - RoomCommand cmdID; - offset_t segmentOffset; - - ZRoomCommand(ZFile* nParent); - virtual ~ZRoomCommand() = default; - - virtual void ExtractCommandFromRoom(ZRoom* nZRoom, uint32_t nRawDataIndex); - - void ParseRawData() override; - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - // Getters/Setters - virtual RoomCommand GetRoomCommand() const = 0; - size_t GetRawDataSize() const final override; - virtual std::string GetCommandCName() const; - - virtual std::string GetCommandHex() const; - -protected: - ZRoom* zRoom; - - uint8_t cmdArg1; - segptr_t cmdArg2; -}; diff --git a/tools/ZAPD/ZAPD/ZScalar.cpp b/tools/ZAPD/ZAPD/ZScalar.cpp deleted file mode 100644 index 7e4be4d57f..0000000000 --- a/tools/ZAPD/ZAPD/ZScalar.cpp +++ /dev/null @@ -1,280 +0,0 @@ -#include "ZScalar.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/File.h" -#include "Utils/StringHelper.h" -#include "WarningHandler.h" -#include "ZFile.h" - -REGISTER_ZFILENODE(Scalar, ZScalar); - -ZScalar::ZScalar(ZFile* nParent) : ZResource(nParent) -{ - memset(&scalarData, 0, sizeof(ZScalarData)); - scalarType = ZScalarType::ZSCALAR_NONE; - RegisterRequiredAttribute("Type"); -} - -void ZScalar::ExtractFromBinary(uint32_t nRawDataIndex, ZScalarType nScalarType) -{ - rawDataIndex = nRawDataIndex; - scalarType = nScalarType; - - // Don't parse raw data of external files - if (parent->GetMode() == ZFileMode::ExternalFile) - return; - - ParseRawData(); -} - -void ZScalar::ParseXML(tinyxml2::XMLElement* reader) -{ - ZResource::ParseXML(reader); - - scalarType = ZScalar::MapOutputTypeToScalarType(registeredAttributes.at("Type").value); -} - -ZScalarType ZScalar::MapOutputTypeToScalarType(const std::string& type) -{ - if (type == "s8") - { - return ZScalarType::ZSCALAR_S8; - } - else if (type == "u8") - { - return ZScalarType::ZSCALAR_U8; - } - else if (type == "x8") - { - return ZScalarType::ZSCALAR_X8; - } - else if (type == "s16") - { - return ZScalarType::ZSCALAR_S16; - } - else if (type == "u16") - { - return ZScalarType::ZSCALAR_U16; - } - else if (type == "x16") - { - return ZScalarType::ZSCALAR_X16; - } - else if (type == "s32") - { - return ZScalarType::ZSCALAR_S32; - } - else if (type == "u32") - { - return ZScalarType::ZSCALAR_U32; - } - else if (type == "x32") - { - return ZScalarType::ZSCALAR_X32; - } - else if (type == "s64") - { - return ZScalarType::ZSCALAR_S64; - } - else if (type == "u64") - { - return ZScalarType::ZSCALAR_U64; - } - else if (type == "x64") - { - return ZScalarType::ZSCALAR_X64; - } - else if (type == "f32") - { - return ZScalarType::ZSCALAR_F32; - } - else if (type == "f64") - { - return ZScalarType::ZSCALAR_F64; - } - - return ZScalarType::ZSCALAR_NONE; -} - -std::string ZScalar::MapScalarTypeToOutputType(const ZScalarType scalarType) -{ - switch (scalarType) - { - case ZScalarType::ZSCALAR_S8: - return "s8"; - case ZScalarType::ZSCALAR_U8: - case ZScalarType::ZSCALAR_X8: - return "u8"; - case ZScalarType::ZSCALAR_S16: - return "s16"; - case ZScalarType::ZSCALAR_U16: - case ZScalarType::ZSCALAR_X16: - return "u16"; - case ZScalarType::ZSCALAR_S32: - return "s32"; - case ZScalarType::ZSCALAR_U32: - case ZScalarType::ZSCALAR_X32: - return "u32"; - case ZScalarType::ZSCALAR_S64: - return "s64"; - case ZScalarType::ZSCALAR_U64: - case ZScalarType::ZSCALAR_X64: - return "u64"; - case ZScalarType::ZSCALAR_F32: - return "f32"; - case ZScalarType::ZSCALAR_F64: - return "f64"; - default: - return ""; - } -} - -size_t ZScalar::MapTypeToSize(const ZScalarType scalarType) -{ - switch (scalarType) - { - case ZScalarType::ZSCALAR_S8: - return sizeof(scalarData.s8); - case ZScalarType::ZSCALAR_U8: - case ZScalarType::ZSCALAR_X8: - return sizeof(scalarData.u8); - case ZScalarType::ZSCALAR_S16: - return sizeof(scalarData.s16); - case ZScalarType::ZSCALAR_U16: - case ZScalarType::ZSCALAR_X16: - return sizeof(scalarData.u16); - case ZScalarType::ZSCALAR_S32: - return sizeof(scalarData.s32); - case ZScalarType::ZSCALAR_U32: - case ZScalarType::ZSCALAR_X32: - return sizeof(scalarData.u32); - case ZScalarType::ZSCALAR_S64: - return sizeof(scalarData.s64); - case ZScalarType::ZSCALAR_U64: - case ZScalarType::ZSCALAR_X64: - return sizeof(scalarData.u64); - case ZScalarType::ZSCALAR_F32: - return sizeof(scalarData.f32); - case ZScalarType::ZSCALAR_F64: - return sizeof(scalarData.f64); - default: - return 0; - } -} - -size_t ZScalar::GetRawDataSize() const -{ - return ZScalar::MapTypeToSize(scalarType); -} - -void ZScalar::ParseRawData() -{ - const auto& rawData = parent->GetRawData(); - switch (scalarType) - { - case ZScalarType::ZSCALAR_S8: - scalarData.s8 = BitConverter::ToInt8BE(rawData, rawDataIndex); - break; - case ZScalarType::ZSCALAR_U8: - case ZScalarType::ZSCALAR_X8: - scalarData.u8 = BitConverter::ToUInt8BE(rawData, rawDataIndex); - break; - case ZScalarType::ZSCALAR_S16: - scalarData.s16 = BitConverter::ToInt16BE(rawData, rawDataIndex); - break; - case ZScalarType::ZSCALAR_U16: - case ZScalarType::ZSCALAR_X16: - scalarData.u16 = BitConverter::ToUInt16BE(rawData, rawDataIndex); - break; - case ZScalarType::ZSCALAR_S32: - scalarData.s32 = BitConverter::ToInt32BE(rawData, rawDataIndex); - break; - case ZScalarType::ZSCALAR_U32: - case ZScalarType::ZSCALAR_X32: - scalarData.u32 = BitConverter::ToUInt32BE(rawData, rawDataIndex); - break; - case ZScalarType::ZSCALAR_S64: - scalarData.s64 = BitConverter::ToInt64BE(rawData, rawDataIndex); - break; - case ZScalarType::ZSCALAR_U64: - case ZScalarType::ZSCALAR_X64: - scalarData.u64 = BitConverter::ToUInt64BE(rawData, rawDataIndex); - break; - case ZScalarType::ZSCALAR_F32: - scalarData.f32 = BitConverter::ToFloatBE(rawData, rawDataIndex); - break; - case ZScalarType::ZSCALAR_F64: - scalarData.f64 = BitConverter::ToDoubleBE(rawData, rawDataIndex); - break; - case ZScalarType::ZSCALAR_NONE: - HANDLE_ERROR_RESOURCE(WarningType::InvalidAttributeValue, parent, this, rawDataIndex, - "invalid value found for 'Type' attribute", "Defaulting to ''"); - break; - } -} - -std::string ZScalar::GetSourceTypeName() const -{ - return ZScalar::MapScalarTypeToOutputType(scalarType); -} - -std::string ZScalar::GetBodySourceCode() const -{ - switch (scalarType) - { - case ZScalarType::ZSCALAR_S8: - return StringHelper::Sprintf("%hhd", scalarData.s8); - case ZScalarType::ZSCALAR_U8: - return StringHelper::Sprintf("%hhu", scalarData.u8); - case ZScalarType::ZSCALAR_X8: - return StringHelper::Sprintf("0x%02X", scalarData.u8); - case ZScalarType::ZSCALAR_S16: - return StringHelper::Sprintf("%hd", scalarData.s16); - case ZScalarType::ZSCALAR_U16: - return StringHelper::Sprintf("%hu", scalarData.u16); - case ZScalarType::ZSCALAR_X16: - return StringHelper::Sprintf("0x%04X", scalarData.u16); - case ZScalarType::ZSCALAR_S32: - return StringHelper::Sprintf("%d", scalarData.s32); - case ZScalarType::ZSCALAR_U32: - return StringHelper::Sprintf("%u", scalarData.u32); - case ZScalarType::ZSCALAR_X32: - return StringHelper::Sprintf("0x%08X", scalarData.u32); - case ZScalarType::ZSCALAR_S64: - return StringHelper::Sprintf("%lld", scalarData.s64); - case ZScalarType::ZSCALAR_U64: - return StringHelper::Sprintf("%llu", scalarData.u64); - case ZScalarType::ZSCALAR_X64: - return StringHelper::Sprintf("0x%016X", scalarData.u64); - case ZScalarType::ZSCALAR_F32: - return StringHelper::Sprintf("%f", scalarData.f32); - case ZScalarType::ZSCALAR_F64: - return StringHelper::Sprintf("%lf", scalarData.f64); - default: - return "SCALAR_ERROR"; - } -} - -ZResourceType ZScalar::GetResourceType() const -{ - return ZResourceType::Scalar; -} - -bool ZScalar::DoesSupportArray() const -{ - return true; -} - -DeclarationAlignment ZScalar::GetDeclarationAlignment() const -{ - switch (scalarType) - { - case ZScalarType::ZSCALAR_S64: - case ZScalarType::ZSCALAR_U64: - case ZScalarType::ZSCALAR_F64: - return DeclarationAlignment::Align8; - default: - return DeclarationAlignment::Align4; - } -} diff --git a/tools/ZAPD/ZAPD/ZScalar.h b/tools/ZAPD/ZAPD/ZScalar.h deleted file mode 100644 index 8f98f261d7..0000000000 --- a/tools/ZAPD/ZAPD/ZScalar.h +++ /dev/null @@ -1,68 +0,0 @@ -#pragma once - -#include -#include -#include -#include "ZResource.h" -#include "tinyxml2.h" - -enum class ZScalarType -{ - ZSCALAR_NONE, - ZSCALAR_S8, - ZSCALAR_U8, - ZSCALAR_X8, - ZSCALAR_S16, - ZSCALAR_U16, - ZSCALAR_X16, - ZSCALAR_S32, - ZSCALAR_U32, - ZSCALAR_X32, - ZSCALAR_S64, - ZSCALAR_U64, - ZSCALAR_X64, - ZSCALAR_F32, - ZSCALAR_F64 -}; - -typedef union ZScalarData -{ - uint8_t u8; - int8_t s8; - uint16_t u16; - int16_t s16; - uint32_t u32; - int32_t s32; - uint64_t u64; - int64_t s64; - float f32; - double f64; -} ZScalarData; - -class ZScalar : public ZResource -{ - friend class ZVector; - -public: - ZScalarData scalarData; - ZScalarType scalarType; - - ZScalar(ZFile* nParent); - - void ExtractFromBinary(uint32_t nRawDataIndex, ZScalarType nScalarType); - - void ParseRawData() override; - void ParseXML(tinyxml2::XMLElement* reader) override; - std::string GetBodySourceCode() const override; - - bool DoesSupportArray() const override; - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - size_t GetRawDataSize() const override; - DeclarationAlignment GetDeclarationAlignment() const override; - - static size_t MapTypeToSize(const ZScalarType scalarType); - static ZScalarType MapOutputTypeToScalarType(const std::string& type); - static std::string MapScalarTypeToOutputType(const ZScalarType scalarType); -}; diff --git a/tools/ZAPD/ZAPD/ZSkeleton.cpp b/tools/ZAPD/ZAPD/ZSkeleton.cpp deleted file mode 100644 index 86b578639f..0000000000 --- a/tools/ZAPD/ZAPD/ZSkeleton.cpp +++ /dev/null @@ -1,472 +0,0 @@ -#include "ZSkeleton.h" - -#include - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "WarningHandler.h" - -REGISTER_ZFILENODE(Skeleton, ZSkeleton); -REGISTER_ZFILENODE(LimbTable, ZLimbTable); - -ZSkeleton::ZSkeleton(ZFile* nParent) : ZResource(nParent) -{ - RegisterRequiredAttribute("Type"); - RegisterRequiredAttribute("LimbType"); - RegisterOptionalAttribute("EnumName"); - RegisterOptionalAttribute("LimbNone"); - RegisterOptionalAttribute("LimbMax"); -} - -void ZSkeleton::ParseXML(tinyxml2::XMLElement* reader) -{ - ZResource::ParseXML(reader); - - std::string skelTypeXml = registeredAttributes.at("Type").value; - - if (skelTypeXml == "Flex") - type = ZSkeletonType::Flex; - else if (skelTypeXml == "Curve") - type = ZSkeletonType::Curve; - else if (skelTypeXml != "Normal") - { - HANDLE_ERROR_RESOURCE(WarningType::InvalidAttributeValue, parent, this, rawDataIndex, - "invalid value found for 'Type' attribute", ""); - } - - std::string limbTypeXml = registeredAttributes.at("LimbType").value; - limbType = ZLimb::GetTypeByAttributeName(limbTypeXml); - if (limbType == ZLimbType::Invalid) - { - HANDLE_ERROR_RESOURCE( - WarningType::InvalidAttributeValue, parent, this, rawDataIndex, - StringHelper::Sprintf("invalid value '%s' found for 'LimbType' attribute", - limbTypeXml.c_str()), - "Defaulting to 'Standard'."); - } - - enumName = registeredAttributes.at("EnumName").value; - limbNoneName = registeredAttributes.at("LimbNone").value; - limbMaxName = registeredAttributes.at("LimbMax").value; - - if (enumName != "") - { - if (limbNoneName == "" || limbMaxName == "") - { - HANDLE_ERROR_RESOURCE(WarningType::MissingAttribute, parent, this, rawDataIndex, - "'EnumName' attribute was used but either 'LimbNone' or " - "'LimbMax' attribute is missing", - ""); - } - } - - if (limbNoneName != "") - { - if (limbMaxName == "") - { - HANDLE_ERROR_RESOURCE( - WarningType::MissingAttribute, parent, this, rawDataIndex, - "'LimbNone' attribute was used but 'LimbMax' attribute is missing", ""); - } - } - - if (limbMaxName != "") - { - if (limbNoneName == "") - { - HANDLE_ERROR_RESOURCE( - WarningType::MissingAttribute, parent, this, rawDataIndex, - "'LimbMax' attribute was used but 'LimbNone' attribute is missing", ""); - } - } -} - -void ZSkeleton::ParseRawData() -{ - ZResource::ParseRawData(); - - const auto& rawData = parent->GetRawData(); - limbsArrayAddress = BitConverter::ToUInt32BE(rawData, rawDataIndex); - limbCount = BitConverter::ToUInt8BE(rawData, rawDataIndex + 4); - - if (type == ZSkeletonType::Flex) - { - dListCount = BitConverter::ToUInt8BE(rawData, rawDataIndex + 8); - } -} - -void ZSkeleton::DeclareReferences(const std::string& prefix) -{ - std::string defaultPrefix = name; - if (defaultPrefix == "") - defaultPrefix = prefix; - - ZResource::DeclareReferences(defaultPrefix); - - if (limbsArrayAddress != SEGMENTED_NULL && GETSEGNUM(limbsArrayAddress) == parent->segment) - { - offset_t ptr = Seg2Filespace(limbsArrayAddress, parent->baseAddress); - - if (!parent->HasDeclaration(ptr)) - { - limbsTable = new ZLimbTable(parent); - limbsTable->ExtractFromBinary(ptr, limbType, limbCount); - limbsTable->SetName(StringHelper::Sprintf("%sLimbs", defaultPrefix.c_str())); - parent->AddResource(limbsTable); - } - else - { - limbsTable = static_cast(parent->FindResource(ptr)); - } - - if (limbsTable->enumName == "") - { - limbsTable->enumName = enumName; - } - if (limbsTable->limbNoneName == "") - { - limbsTable->limbNoneName = limbNoneName; - } - if (limbsTable->limbMaxName == "") - { - limbsTable->limbMaxName = limbMaxName; - } - } -} - -std::string ZSkeleton::GetBodySourceCode() const -{ - std::string limbArrayName; - Globals::Instance->GetSegmentedPtrName(limbsArrayAddress, parent, "", limbArrayName); - - std::string countStr; - assert(limbsTable != nullptr); - // There are some Skeletons with the wrong limb count on them, so this check is necessary. - if (limbsTable->count == limbCount) - { - countStr = StringHelper::Sprintf("ARRAY_COUNT(%s)", limbArrayName.c_str()); - } - else - { - countStr = StringHelper::Sprintf("%i", limbCount); - } - - switch (type) - { - case ZSkeletonType::Normal: - case ZSkeletonType::Curve: - return StringHelper::Sprintf("\n\t%s, %s\n", limbArrayName.c_str(), countStr.c_str()); - - case ZSkeletonType::Flex: - return StringHelper::Sprintf("\n\t{ %s, %s }, %i\n", limbArrayName.c_str(), - countStr.c_str(), dListCount); - } - - // TODO: Throw exception? - return "ERROR"; -} - -size_t ZSkeleton::GetRawDataSize() const -{ - switch (type) - { - case ZSkeletonType::Flex: - return 0xC; - case ZSkeletonType::Normal: - case ZSkeletonType::Curve: - default: - return 0x8; - } -} - -std::string ZSkeleton::GetSourceTypeName() const -{ - switch (type) - { - case ZSkeletonType::Normal: - return "SkeletonHeader"; - case ZSkeletonType::Flex: - return "FlexSkeletonHeader"; - case ZSkeletonType::Curve: - return "CurveSkeletonHeader"; - } - - return "SkeletonHeader"; -} - -ZResourceType ZSkeleton::GetResourceType() const -{ - return ZResourceType::Skeleton; -} - -DeclarationAlignment ZSkeleton::GetDeclarationAlignment() const -{ - return DeclarationAlignment::Align4; -} - -uint8_t ZSkeleton::GetLimbCount() -{ - return limbCount; -} - -/* ZLimbTable */ - -ZLimbTable::ZLimbTable(ZFile* nParent) : ZResource(nParent) -{ - RegisterRequiredAttribute("LimbType"); - RegisterRequiredAttribute("Count"); - RegisterOptionalAttribute("EnumName"); - RegisterOptionalAttribute("LimbNone"); - RegisterOptionalAttribute("LimbMax"); -} - -void ZLimbTable::ExtractFromBinary(uint32_t nRawDataIndex, ZLimbType nLimbType, size_t nCount) -{ - rawDataIndex = nRawDataIndex; - limbType = nLimbType; - count = nCount; - - ParseRawData(); -} - -void ZLimbTable::ParseXML(tinyxml2::XMLElement* reader) -{ - ZResource::ParseXML(reader); - - std::string limbTypeXml = registeredAttributes.at("LimbType").value; - limbType = ZLimb::GetTypeByAttributeName(limbTypeXml); - if (limbType == ZLimbType::Invalid) - { - HANDLE_WARNING_RESOURCE(WarningType::InvalidAttributeValue, parent, this, rawDataIndex, - "invalid value found for 'LimbType' attribute.", - "Defaulting to 'Standard'."); - limbType = ZLimbType::Standard; - } - - count = StringHelper::StrToL(registeredAttributes.at("Count").value); - - enumName = registeredAttributes.at("EnumName").value; - limbNoneName = registeredAttributes.at("LimbNone").value; - limbMaxName = registeredAttributes.at("LimbMax").value; - - if (enumName != "") - { - if (limbNoneName == "" || limbMaxName == "") - { - HANDLE_ERROR_RESOURCE( - WarningType::MissingAttribute, parent, this, rawDataIndex, - "'EnumName' attribute was used but 'LimbNone'/'LimbMax' attributes is missing", ""); - } - } - - if (limbNoneName != "") - { - if (limbMaxName == "") - { - HANDLE_ERROR_RESOURCE( - WarningType::MissingAttribute, parent, this, rawDataIndex, - "'LimbNone' attribute was used but 'LimbMax' attribute is missing", ""); - } - } - - if (limbMaxName != "") - { - if (limbNoneName == "") - { - HANDLE_ERROR_RESOURCE( - WarningType::MissingAttribute, parent, this, rawDataIndex, - "'LimbMax' attribute was used but 'LimbNone' attribute is missing", ""); - } - } -} - -void ZLimbTable::ParseRawData() -{ - ZResource::ParseRawData(); - - const auto& rawData = parent->GetRawData(); - uint32_t ptr = rawDataIndex; - - limbsAddresses.reserve(count); - for (size_t i = 0; i < count; i++) - { - limbsAddresses.push_back(BitConverter::ToUInt32BE(rawData, ptr)); - ptr += 4; - } -} - -void ZLimbTable::DeclareReferences(const std::string& prefix) -{ - std::string varPrefix = name; - if (varPrefix == "") - varPrefix = prefix; - - ZResource::DeclareReferences(varPrefix); - limbsReferences.reserve(count); - for (size_t i = 0; i < count; i++) - { - segptr_t limbAddress = limbsAddresses[i]; - - if (limbAddress != 0 && GETSEGNUM(limbAddress) == parent->segment) - { - uint32_t limbOffset = Seg2Filespace(limbAddress, parent->baseAddress); - ZLimb* limb; - - if (!parent->HasDeclaration(limbOffset)) - { - limb = new ZLimb(parent); - limb->ExtractFromBinary(limbOffset, limbType); - limb->SetName(limb->GetDefaultName(varPrefix)); - limb->DeclareVar(varPrefix, ""); - limb->DeclareReferences(varPrefix); - parent->AddResource(limb); - } - else - { - limb = static_cast(parent->FindResource(limbOffset)); - assert(limb != nullptr); - assert(limb->GetResourceType() == ZResourceType::Limb); - } - - limb->limbsTable = this; - limb->SetLimbIndex(i + 1); - - limbsReferences.push_back(limb); - } - } -} - -Declaration* ZLimbTable::DeclareVar(const std::string& prefix, const std::string& bodyStr) -{ - std::string auxName = name; - - if (name == "") - auxName = GetDefaultName(prefix); - - Declaration* decl = - parent->AddDeclarationArray(rawDataIndex, GetDeclarationAlignment(), GetRawDataSize(), - GetSourceTypeName(), auxName, limbsAddresses.size(), bodyStr); - decl->staticConf = staticConf; - return decl; -} - -std::string ZLimbTable::GetBodySourceCode() const -{ - std::string body; - - for (size_t i = 0; i < count; i++) - { - std::string limbName; - Globals::Instance->GetSegmentedPtrName(limbsAddresses[i], parent, "", limbName); - body += StringHelper::Sprintf("\t%s,", limbName.c_str()); - - auto& limb = limbsReferences.at(i); - std::string limbEnumName = limb->enumName; - if (limbEnumName != "") - { - body += StringHelper::Sprintf(" /* %s */", limbEnumName.c_str()); - } - - if (i + 1 < count) - body += "\n"; - } - - return body; -} - -std::string ZLimbTable::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix) -{ - if (limbNoneName == "" || limbMaxName == "" || enumName == "") - { - // Don't produce a enum of any of those attributes is missing - return ""; - } - - std::string limbEnum = StringHelper::Sprintf("typedef enum %s {\n", enumName.c_str()); - - // This assumes there isn't any skeleton with more than 0x100 limbs - - limbEnum += StringHelper::Sprintf(" /* 0x00 */ %s,\n", limbNoneName.c_str()); - - size_t i = 0; - for (; i < count; i++) - { - auto& limb = limbsReferences.at(i); - std::string limbEnumName = limb->enumName; - - if (limbEnumName == "") - { - HANDLE_ERROR_RESOURCE( - WarningType::MissingAttribute, parent, this, rawDataIndex, - "Skeleton's enum attributes were used but at least one limb is missing its " - "'LimbName' attribute", - StringHelper::Sprintf("When processing limb %02i, named '%s' at offset '0x%X'", - i + 1, limb->GetName().c_str(), limb->GetRawDataIndex())); - } - - limbEnum += StringHelper::Sprintf(" /* 0x%02X */ %s,\n", i + 1, limbEnumName.c_str()); - } - - limbEnum += StringHelper::Sprintf(" /* 0x%02X */ %s\n", i + 1, limbMaxName.c_str()); - - limbEnum += StringHelper::Sprintf("} %s;\n", enumName.c_str()); - - return limbEnum; -} - -std::string ZLimbTable::GetSourceTypeName() const -{ - switch (limbType) - { - case ZLimbType::Standard: - case ZLimbType::LOD: - case ZLimbType::Skin: - return "void*"; - - case ZLimbType::Curve: - case ZLimbType::Legacy: - return StringHelper::Sprintf("%s*", ZLimb::GetSourceTypeName(limbType)); - - case ZLimbType::Invalid: - // TODO: Proper error message or something. - assert("Invalid limb type.\n"); - } - - return "ERROR"; -} - -ZResourceType ZLimbTable::GetResourceType() const -{ - return ZResourceType::LimbTable; -} - -size_t ZLimbTable::GetRawDataSize() const -{ - return 4 * limbsAddresses.size(); -} - -std::string ZLimbTable::GetLimbEnumName(uint8_t limbIndex) const -{ - if (limbIndex == 0xFF) - { - return "LIMB_DONE"; - } - - if (limbIndex < count) - { - std::string limbEnumName = limbsReferences.at(limbIndex)->enumName; - if (limbEnumName != "") - { - return StringHelper::Sprintf("%s - 1", limbEnumName.c_str()); - } - } - else - { - HANDLE_WARNING_RESOURCE(WarningType::InvalidExtractedData, parent, this, rawDataIndex, - StringHelper::Sprintf("Limb index '%02i' out of range", limbIndex), - ""); - } - - return StringHelper::Sprintf("0x%02X", limbIndex); -} diff --git a/tools/ZAPD/ZAPD/ZSkeleton.h b/tools/ZAPD/ZAPD/ZSkeleton.h deleted file mode 100644 index c437a8484c..0000000000 --- a/tools/ZAPD/ZAPD/ZSkeleton.h +++ /dev/null @@ -1,85 +0,0 @@ -#pragma once - -#include -#include -#include - -#include "ZDisplayList.h" -#include "ZFile.h" -#include "ZLimb.h" - -enum class ZSkeletonType -{ - Normal, - Flex, - Curve, -}; - -class ZLimbTable : public ZResource -{ -public: - ZLimbType limbType = ZLimbType::Standard; - size_t count = 0; - - std::vector limbsAddresses; - std::vector limbsReferences; // borrowed pointers, do not delete! - - // XML attributes - std::string enumName; - std::string limbNoneName; - std::string limbMaxName; - - ZLimbTable(ZFile* nParent); - - void ExtractFromBinary(uint32_t nRawDataIndex, ZLimbType nLimbType, size_t nCount); - - void ParseXML(tinyxml2::XMLElement* reader) override; - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override; - - std::string GetBodySourceCode() const override; - - std::string GetSourceOutputHeader(const std::string& prefix) override; - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - size_t GetRawDataSize() const override; - - std::string GetLimbEnumName(uint8_t limbIndex) const; -}; - -class ZSkeleton : public ZResource -{ -public: - ZSkeletonType type = ZSkeletonType::Normal; - ZLimbType limbType = ZLimbType::Standard; - std::string enumName; - std::string limbNoneName; - std::string limbMaxName; - - segptr_t limbsArrayAddress; - uint8_t limbCount = 0; - uint8_t dListCount = 0; // FLEX SKELETON ONLY - - ZSkeleton(ZFile* nParent); - - void ParseXML(tinyxml2::XMLElement* reader) override; - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - size_t GetRawDataSize() const override; - DeclarationAlignment GetDeclarationAlignment() const override; - - uint8_t GetLimbCount(); - -protected: - ZLimbTable* limbsTable = nullptr; // borrowed pointer, do not delete! -}; diff --git a/tools/ZAPD/ZAPD/ZString.cpp b/tools/ZAPD/ZAPD/ZString.cpp deleted file mode 100644 index 965d4d6360..0000000000 --- a/tools/ZAPD/ZAPD/ZString.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#include "ZString.h" - -#include "Utils/File.h" -#include "Utils/StringHelper.h" -#include "ZFile.h" - -REGISTER_ZFILENODE(String, ZString); - -ZString::ZString(ZFile* nParent) : ZResource(nParent) -{ -} - -void ZString::ParseRawData() -{ - size_t size = 0; - const auto& rawData = parent->GetRawData(); - const auto& rawDataArr = rawData.data(); - size_t rawDataSize = rawData.size(); - for (size_t i = rawDataIndex; i < rawDataSize; ++i) - { - ++size; - if (rawDataArr[i] == '\0') - { - break; - } - } - - auto dataStart = rawData.begin() + rawDataIndex; - strData.assign(dataStart, dataStart + size); -} - -Declaration* ZString::DeclareVar(const std::string& prefix, const std::string& bodyStr) -{ - std::string auxName = name; - - if (name == "") - auxName = GetDefaultName(prefix); - - Declaration* decl = - parent->AddDeclarationArray(rawDataIndex, GetDeclarationAlignment(), GetRawDataSize(), - GetSourceTypeName(), auxName, 0, bodyStr); - decl->staticConf = staticConf; - return decl; -} - -std::string ZString::GetBodySourceCode() const -{ - return StringHelper::Sprintf("\t\"%s\"", strData.data()); -} - -std::string ZString::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix) -{ - return StringHelper::Sprintf("#define %s_macro \"%s\"", name.c_str(), strData.data()); -} - -std::string ZString::GetSourceTypeName() const -{ - return "char"; -} - -ZResourceType ZString::GetResourceType() const -{ - return ZResourceType::String; -} - -size_t ZString::GetRawDataSize() const -{ - return strData.size(); -} diff --git a/tools/ZAPD/ZAPD/ZString.h b/tools/ZAPD/ZAPD/ZString.h deleted file mode 100644 index 6c58ebdcb5..0000000000 --- a/tools/ZAPD/ZAPD/ZString.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include "ZResource.h" -#include "tinyxml2.h" - -class ZString : public ZResource -{ -public: - ZString(ZFile* nParent); - - void ParseRawData() override; - - Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override; - std::string GetBodySourceCode() const override; - - std::string GetSourceOutputHeader(const std::string& prefix) override; - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - size_t GetRawDataSize() const override; - -protected: - std::vector strData; -}; diff --git a/tools/ZAPD/ZAPD/ZSurfaceType.cpp b/tools/ZAPD/ZAPD/ZSurfaceType.cpp deleted file mode 100644 index 27e73accc2..0000000000 --- a/tools/ZAPD/ZAPD/ZSurfaceType.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "ZSurfaceType.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" - -REGISTER_ZFILENODE(SurfaceType, ZSurfaceType); - -ZSurfaceType::ZSurfaceType(ZFile* nParent) : ZResource(nParent) -{ -} - -ZSurfaceType::~ZSurfaceType() -{ -} - -void ZSurfaceType::ParseRawData() -{ - const auto& rawData = parent->GetRawData(); - - data[0] = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0); - data[1] = BitConverter::ToUInt32BE(rawData, rawDataIndex + 4); -} - -void ZSurfaceType::DeclareReferences(const std::string& prefix) -{ - std::string declaration; - std::string auxName = name; - - if (name == "") - auxName = GetDefaultName(prefix); - - parent->AddDeclaration(rawDataIndex, DeclarationAlignment::Align4, GetRawDataSize(), - GetSourceTypeName(), name.c_str(), GetBodySourceCode()); -} - -std::string ZSurfaceType::GetBodySourceCode() const -{ - return StringHelper::Sprintf("{0x%08X, 0x%08X}", data[0], data[1]); -} - -std::string ZSurfaceType::GetDefaultName(const std::string& prefix) const -{ - return StringHelper::Sprintf("%sSurfaceType_%06X", prefix.c_str(), rawDataIndex); -} - -ZResourceType ZSurfaceType::GetResourceType() const -{ - return ZResourceType::SurfaceType; -} - -size_t ZSurfaceType::GetRawDataSize() const -{ - return 8; -} - -std::string ZSurfaceType::GetSourceTypeName() const -{ - return "SurfaceType"; -} - -bool ZSurfaceType::DoesSupportArray() const -{ - return true; -} diff --git a/tools/ZAPD/ZAPD/ZSurfaceType.h b/tools/ZAPD/ZAPD/ZSurfaceType.h deleted file mode 100644 index 3bbddee8ce..0000000000 --- a/tools/ZAPD/ZAPD/ZSurfaceType.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -#include -#include "ZFile.h" -#include "ZResource.h" - -class ZSurfaceType : public ZResource -{ -public: - std::array data; - - ZSurfaceType(ZFile* nParent); - ~ZSurfaceType(); - - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - std::string GetDefaultName(const std::string& prefix) const override; - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - bool DoesSupportArray() const override; - - size_t GetRawDataSize() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZSymbol.cpp b/tools/ZAPD/ZAPD/ZSymbol.cpp deleted file mode 100644 index eabfc2faae..0000000000 --- a/tools/ZAPD/ZAPD/ZSymbol.cpp +++ /dev/null @@ -1,98 +0,0 @@ -#include "ZSymbol.h" - -#include "Utils/StringHelper.h" -#include "WarningHandler.h" -#include "ZFile.h" - -REGISTER_ZFILENODE(Symbol, ZSymbol); - -ZSymbol::ZSymbol(ZFile* nParent) : ZResource(nParent) -{ - RegisterOptionalAttribute("Type"); - RegisterOptionalAttribute("TypeSize"); - RegisterOptionalAttribute("Count"); -} - -void ZSymbol::ParseXML(tinyxml2::XMLElement* reader) -{ - ZResource::ParseXML(reader); - - std::string typeXml = registeredAttributes.at("Type").value; - - if (typeXml == "") - { - HANDLE_WARNING_RESOURCE(WarningType::MissingAttribute, parent, this, rawDataIndex, - "missing 'Type' attribute in ", "Defaulting to 'void*'."); - type = "void*"; - } - else - { - type = typeXml; - } - - std::string typeSizeXml = registeredAttributes.at("TypeSize").value; - if (typeSizeXml == "") - { - HANDLE_WARNING_RESOURCE(WarningType::MissingAttribute, parent, this, rawDataIndex, - "missing 'TypeSize' attribute in ", "Defaulting to '4'."); - typeSize = 4; // Size of a word. - } - else - { - typeSize = StringHelper::StrToL(typeSizeXml, 0); - } - - if (registeredAttributes.at("Count").wasSet) - { - isArray = true; - - std::string countXml = registeredAttributes.at("Count").value; - if (countXml != "") - count = StringHelper::StrToL(countXml, 0); - } - - if (registeredAttributes.at("Static").value == "On") - { - HANDLE_WARNING_RESOURCE(WarningType::InvalidAttributeValue, parent, this, rawDataIndex, - "a cannot be marked as static", - "Disabling static for this resource."); - } - staticConf = StaticConfig::Off; -} - -Declaration* ZSymbol::DeclareVar([[maybe_unused]] const std::string& prefix, - [[maybe_unused]] const std::string& bodyStr) -{ - return nullptr; -} - -size_t ZSymbol::GetRawDataSize() const -{ - if (isArray) - return count * typeSize; - - return typeSize; -} - -std::string ZSymbol::GetSourceOutputHeader([[maybe_unused]] const std::string& prefix) -{ - if (isArray) - { - if (count == 0) - return StringHelper::Sprintf("extern %s %s[];\n", type.c_str(), name.c_str()); - else - return StringHelper::Sprintf("extern %s %s[%i];\n", type.c_str(), name.c_str(), count); - } - - return StringHelper::Sprintf("extern %s %s;\n", type.c_str(), name.c_str()); -} - -std::string ZSymbol::GetSourceTypeName() const -{ - return type; -} - -ZResourceType ZSymbol::GetResourceType() const -{ - return ZResourceType::Symbol; -} diff --git a/tools/ZAPD/ZAPD/ZSymbol.h b/tools/ZAPD/ZAPD/ZSymbol.h deleted file mode 100644 index 7cb14aa9b4..0000000000 --- a/tools/ZAPD/ZAPD/ZSymbol.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -#include "ZResource.h" -#include "tinyxml2.h" - -class ZSymbol : public ZResource -{ -protected: - std::string type; - size_t typeSize; - bool isArray = false; - uint32_t count = 0; - -public: - ZSymbol(ZFile* nParent); - - void ParseXML(tinyxml2::XMLElement* reader) override; - - Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override; - - std::string GetSourceOutputHeader(const std::string& prefix) override; - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - size_t GetRawDataSize() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZTexture.cpp b/tools/ZAPD/ZAPD/ZTexture.cpp deleted file mode 100644 index 0d66ba7da3..0000000000 --- a/tools/ZAPD/ZAPD/ZTexture.cpp +++ /dev/null @@ -1,978 +0,0 @@ -#include "ZTexture.h" - -#include - -#include "CRC32.h" -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/Directory.h" -#include "Utils/File.h" -#include "Utils/Path.h" -#include "WarningHandler.h" - -REGISTER_ZFILENODE(Texture, ZTexture); - -ZTexture::ZTexture(ZFile* nParent) : ZResource(nParent) -{ - width = 0; - height = 0; - dWordAligned = true; - splitTlut = false; - - RegisterRequiredAttribute("Width"); - RegisterRequiredAttribute("Height"); - RegisterRequiredAttribute("Format"); - RegisterOptionalAttribute("TlutOffset"); - RegisterOptionalAttribute("ExternalTlut"); - RegisterOptionalAttribute("ExternalTlutOffset"); - RegisterOptionalAttribute("SplitTlut"); -} - -void ZTexture::ExtractFromBinary(uint32_t nRawDataIndex, int32_t nWidth, int32_t nHeight, - TextureType nType, bool nIsPalette) -{ - width = nWidth; - height = nHeight; - format = nType; - rawDataIndex = nRawDataIndex; - isPalette = nIsPalette; - name = GetDefaultName(parent->GetName()); - outName = name; - - // Don't parse raw data of external files - if (parent->GetMode() == ZFileMode::ExternalFile) - return; - - ParseRawData(); - CalcHash(); -} - -void ZTexture::FromPNG(const fs::path& pngFilePath, TextureType texType) -{ - format = texType; - name = StringHelper::Split(Path::GetFileNameWithoutExtension(pngFilePath.string()), ".")[0]; - PrepareRawDataFromFile(pngFilePath); -} - -void ZTexture::ParseXML(tinyxml2::XMLElement* reader) -{ - ZResource::ParseXML(reader); - - std::string widthXml = registeredAttributes.at("Width").value; - std::string heightXml = registeredAttributes.at("Height").value; - std::string SplitTlutXml = registeredAttributes.at("SplitTlut").value; - - if (!StringHelper::HasOnlyDigits(widthXml)) - { - std::string errorHeader = StringHelper::Sprintf( - "value of 'Width' attribute has non-decimal digits: '%s'", widthXml.c_str()); - HANDLE_ERROR_RESOURCE(WarningType::InvalidAttributeValue, parent, this, rawDataIndex, - errorHeader, ""); - } - if (!StringHelper::HasOnlyDigits(heightXml)) - { - std::string errorHeader = StringHelper::Sprintf( - "value of 'Height' attribute has non-decimal digits: '%s'", heightXml.c_str()); - HANDLE_ERROR_RESOURCE(WarningType::InvalidAttributeValue, parent, this, rawDataIndex, - errorHeader, ""); - } - - if (!registeredAttributes.at("ExternalTlut").wasSet && - registeredAttributes.at("SplitTlut").wasSet) - { - std::string errorHeader = - StringHelper::Sprintf("SplitTlut set without using an external tlut"); - HANDLE_WARNING_RESOURCE(WarningType::InvalidAttributeValue, parent, this, rawDataIndex, - errorHeader, ""); - } - - if (!SplitTlutXml.empty()) - { - if (!tinyxml2::XMLUtil::ToBool(SplitTlutXml.c_str(), &splitTlut)) - { - std::string errorHeader = StringHelper::Sprintf( - "Invalid value passed to SplitTlut: '%s'. Valid values are true, false, 1, 0", - SplitTlutXml.c_str()); - HANDLE_ERROR_RESOURCE(WarningType::InvalidAttributeValue, parent, this, rawDataIndex, - errorHeader, ""); - } - } - - width = StringHelper::StrToL(widthXml); - height = StringHelper::StrToL(heightXml); - - std::string formatStr = registeredAttributes.at("Format").value; - format = GetTextureTypeFromString(formatStr); - - if (format == TextureType::Error) - { - HANDLE_ERROR_RESOURCE(WarningType::InvalidAttributeValue, parent, this, rawDataIndex, - "invalid value found for 'Format' attribute", ""); - } - - const auto& tlutOffsetAttr = registeredAttributes.at("TlutOffset"); - if (tlutOffsetAttr.wasSet) - { - switch (format) - { - case TextureType::Palette4bpp: - case TextureType::Palette8bpp: - tlutOffset = StringHelper::StrToL(tlutOffsetAttr.value, 16); - break; - - default: - HANDLE_ERROR_RESOURCE(WarningType::InvalidXML, parent, this, rawDataIndex, - "'TlutOffset' declared in non color-indexed (ci4 or ci8) texture", - ""); - break; - } - } -} - -void ZTexture::ParseRawData() -{ - if ((parent->baseAddress + rawDataIndex) % 8 != 0) - dWordAligned = false; - - switch (format) - { - case TextureType::RGBA16bpp: - ConvertN64ToBitmap_RGBA16(); - break; - case TextureType::RGBA32bpp: - ConvertN64ToBitmap_RGBA32(); - break; - case TextureType::Grayscale4bpp: - ConvertN64ToBitmap_Grayscale4(); - break; - case TextureType::Grayscale8bpp: - ConvertN64ToBitmap_Grayscale8(); - break; - case TextureType::GrayscaleAlpha4bpp: - ConvertN64ToBitmap_GrayscaleAlpha4(); - break; - case TextureType::GrayscaleAlpha8bpp: - ConvertN64ToBitmap_GrayscaleAlpha8(); - break; - case TextureType::GrayscaleAlpha16bpp: - ConvertN64ToBitmap_GrayscaleAlpha16(); - break; - case TextureType::Palette4bpp: - ConvertN64ToBitmap_Palette4(); - break; - case TextureType::Palette8bpp: - ConvertN64ToBitmap_Palette8(); - break; - case TextureType::Error: - HANDLE_ERROR_RESOURCE(WarningType::InvalidAttributeValue, parent, this, rawDataIndex, - StringHelper::Sprintf("Invalid texture format", format), ""); - assert(!"TODO"); - break; - } -} - -void ZTexture::ParseRawDataLate() -{ - if (registeredAttributes["ExternalTlut"].wasSet) - { - const std::string externPalette = registeredAttributes["ExternalTlut"].value; - for (const auto& file : Globals::Instance->files) - { - if (file->GetName() == externPalette) - { - offset_t palOffset = 0; - if (registeredAttributes["ExternalTlutOffset"].wasSet) - { - palOffset = - StringHelper::StrToL(registeredAttributes["ExternalTlutOffset"].value, 16); - } - else - { - HANDLE_WARNING_RESOURCE( - WarningType::MissingOffsets, parent, this, rawDataIndex, - StringHelper::Sprintf( - "No ExternalTlutOffset Given. Assuming offset of 0x0"), - ""); - } - for (const auto& res : file->resources) - { - if (res->GetRawDataIndex() == palOffset) - { - ZTexture* palette = (ZTexture*)res; - ZTexture tlutTemp(file); - - tlut = &tlutTemp; - tlut->ExtractFromBinary(palOffset, palette->width, palette->height, - TextureType::RGBA16bpp, true); - SetTlut(tlut); - } - } - } - } - } -} - -void ZTexture::ConvertN64ToBitmap_RGBA16() -{ - textureData.InitEmptyRGBImage(width, height, true); - const auto& parentRawData = parent->GetRawData(); - for (size_t y = 0; y < height; y++) - { - for (size_t x = 0; x < width; x++) - { - int32_t pos = rawDataIndex + ((y * width) + x) * 2; - uint16_t data = parentRawData.at(pos + 1) | (parentRawData.at(pos) << 8); - uint8_t r = (data & 0xF800) >> 11; - uint8_t g = (data & 0x07C0) >> 6; - uint8_t b = (data & 0x003E) >> 1; - uint8_t alpha = data & 0x01; - - textureData.SetRGBPixel(y, x, (r << 3) | (r >> 2), (g << 3) | (g >> 2), - (b << 3) | (b >> 2), alpha * 255); - } - } -} - -void ZTexture::ConvertN64ToBitmap_RGBA32() -{ - textureData.InitEmptyRGBImage(width, height, true); - const auto& parentRawData = parent->GetRawData(); - for (size_t y = 0; y < height; y++) - { - for (size_t x = 0; x < width; x++) - { - size_t pos = rawDataIndex + ((y * width) + x) * 4; - uint8_t r = parentRawData.at(pos + 0); - uint8_t g = parentRawData.at(pos + 1); - uint8_t b = parentRawData.at(pos + 2); - uint8_t alpha = parentRawData.at(pos + 3); - - textureData.SetRGBPixel(y, x, r, g, b, alpha); - } - } -} - -void ZTexture::ConvertN64ToBitmap_Grayscale4() -{ - textureData.InitEmptyRGBImage(width, height, false); - const auto& parentRawData = parent->GetRawData(); - for (size_t y = 0; y < height; y++) - { - for (size_t x = 0; x < width; x += 2) - { - for (uint8_t i = 0; i < 2; i++) - { - size_t pos = rawDataIndex + ((y * width) + x) / 2; - uint8_t grayscale = 0; - - if (i == 0) - grayscale = parentRawData.at(pos) & 0xF0; - else - grayscale = (parentRawData.at(pos) & 0x0F) << 4; - - textureData.SetGrayscalePixel(y, x + i, (grayscale << 4) | grayscale); - } - } - } -} - -void ZTexture::ConvertN64ToBitmap_Grayscale8() -{ - textureData.InitEmptyRGBImage(width, height, false); - const auto& parentRawData = parent->GetRawData(); - for (size_t y = 0; y < height; y++) - { - for (size_t x = 0; x < width; x++) - { - size_t pos = rawDataIndex + ((y * width) + x) * 1; - - textureData.SetGrayscalePixel(y, x, parentRawData.at(pos)); - } - } -} - -void ZTexture::ConvertN64ToBitmap_GrayscaleAlpha4() -{ - textureData.InitEmptyRGBImage(width, height, true); - const auto& parentRawData = parent->GetRawData(); - for (size_t y = 0; y < height; y++) - { - for (size_t x = 0; x < width; x += 2) - { - for (uint16_t i = 0; i < 2; i++) - { - size_t pos = rawDataIndex + ((y * width) + x) / 2; - uint8_t data = 0; - - if (i == 0) - data = (parentRawData.at(pos) & 0xF0) >> 4; - else - data = parentRawData.at(pos) & 0x0F; - - uint8_t grayscale = data & 0b1110; - grayscale = (grayscale << 4) | (grayscale << 1) | (grayscale >> 2); - uint8_t alpha = (data & 0x01) ? 255 : 0; - - textureData.SetGrayscalePixel(y, x + i, grayscale, alpha); - } - } - } -} - -void ZTexture::ConvertN64ToBitmap_GrayscaleAlpha8() -{ - textureData.InitEmptyRGBImage(width, height, true); - const auto& parentRawData = parent->GetRawData(); - for (size_t y = 0; y < height; y++) - { - for (size_t x = 0; x < width; x++) - { - size_t pos = rawDataIndex + ((y * width) + x) * 1; - uint8_t pixel = parentRawData.at(pos); - uint8_t data = (pixel >> 4) & 0xF; - - data = (data << 4) | data; - uint8_t grayscale = data; - uint8_t alpha = (pixel & 0xF); - alpha = (alpha << 4) | alpha; - - textureData.SetGrayscalePixel(y, x, grayscale, alpha); - } - } -} - -void ZTexture::ConvertN64ToBitmap_GrayscaleAlpha16() -{ - textureData.InitEmptyRGBImage(width, height, true); - const auto& parentRawData = parent->GetRawData(); - for (size_t y = 0; y < height; y++) - { - for (size_t x = 0; x < width; x++) - { - size_t pos = rawDataIndex + ((y * width) + x) * 2; - uint8_t grayscale = parentRawData.at(pos + 0); - uint8_t alpha = parentRawData.at(pos + 1); - - textureData.SetGrayscalePixel(y, x, grayscale, alpha); - } - } -} - -void ZTexture::ConvertN64ToBitmap_Palette4() -{ - textureData.InitEmptyPaletteImage(width, height); - const auto& parentRawData = parent->GetRawData(); - for (size_t y = 0; y < height; y++) - { - for (size_t x = 0; x < width; x += 2) - { - for (uint16_t i = 0; i < 2; i++) - { - size_t pos = rawDataIndex + ((y * width) + x) / 2; - uint8_t paletteIndex = 0; - - if (i == 0) - paletteIndex = (parentRawData.at(pos) & 0xF0) >> 4; - else - paletteIndex = (parentRawData.at(pos) & 0x0F); - - textureData.SetIndexedPixel(y, x + i, paletteIndex, paletteIndex * 16); - } - } - } -} - -void ZTexture::ConvertN64ToBitmap_Palette8() -{ - textureData.InitEmptyPaletteImage(width, height); - const auto& parentRawData = parent->GetRawData(); - for (size_t y = 0; y < height; y++) - { - for (size_t x = 0; x < width; x++) - { - size_t pos = rawDataIndex + ((y * width) + x) * 1; - uint8_t grayscale = parentRawData.at(pos); - - textureData.SetIndexedPixel(y, x, grayscale, grayscale); - } - } -} - -void ZTexture::DeclareReferences([[maybe_unused]] const std::string& prefix) -{ - if (tlutOffset != static_cast(-1)) - { - tlut = parent->GetTextureResource(tlutOffset); - if (tlut == nullptr) - { - int32_t tlutDim = 16; - if (format == TextureType::Palette4bpp) - tlutDim = 4; - - tlut = new ZTexture(parent); - tlut->ExtractFromBinary(tlutOffset, tlutDim, tlutDim, TextureType::RGBA16bpp, true); - parent->AddTextureResource(tlutOffset, tlut); - tlut->DeclareVar(prefix, ""); - } - else - { - tlut->isPalette = true; - } - SetTlut(tlut); - } -} - -void ZTexture::PrepareRawDataFromFile(const fs::path& pngFilePath) -{ - textureData.ReadPng(pngFilePath); - - width = textureData.GetWidth(); - height = textureData.GetHeight(); - - textureDataRaw.clear(); - textureDataRaw.resize(ALIGN8(GetRawDataSize())); - - switch (format) - { - case TextureType::RGBA16bpp: - ConvertBitmapToN64_RGBA16(); - break; - case TextureType::RGBA32bpp: - ConvertBitmapToN64_RGBA32(); - break; - case TextureType::Grayscale4bpp: - ConvertBitmapToN64_Grayscale4(); - break; - case TextureType::Grayscale8bpp: - ConvertBitmapToN64_Grayscale8(); - break; - case TextureType::GrayscaleAlpha4bpp: - ConvertBitmapToN64_GrayscaleAlpha4(); - break; - case TextureType::GrayscaleAlpha8bpp: - ConvertBitmapToN64_GrayscaleAlpha8(); - break; - case TextureType::GrayscaleAlpha16bpp: - ConvertBitmapToN64_GrayscaleAlpha16(); - break; - case TextureType::Palette4bpp: - ConvertBitmapToN64_Palette4(); - break; - case TextureType::Palette8bpp: - ConvertBitmapToN64_Palette8(); - break; - case TextureType::Error: - HANDLE_ERROR_PROCESS(WarningType::InvalidPNG, "Input PNG file has invalid format type", ""); - break; - } -} - -void ZTexture::ConvertBitmapToN64_RGBA16() -{ - for (uint16_t y = 0; y < height; y++) - { - for (uint16_t x = 0; x < width; x++) - { - size_t pos = ((y * width) + x) * 2; - RGBAPixel pixel = textureData.GetPixel(y, x); - - uint8_t r = pixel.r >> 3; - uint8_t g = pixel.g >> 3; - uint8_t b = pixel.b >> 3; - - uint8_t alphaBit = pixel.a != 0; - - uint16_t data = (r << 11) | (g << 6) | (b << 1) | alphaBit; - - textureDataRaw[pos + 0] = (data & 0xFF00) >> 8; - textureDataRaw[pos + 1] = (data & 0x00FF); - } - } -} - -void ZTexture::ConvertBitmapToN64_RGBA32() -{ - for (uint16_t y = 0; y < height; y++) - { - for (uint16_t x = 0; x < width; x++) - { - size_t pos = ((y * width) + x) * 4; - RGBAPixel pixel = textureData.GetPixel(y, x); - - textureDataRaw[pos + 0] = pixel.r; - textureDataRaw[pos + 1] = pixel.g; - textureDataRaw[pos + 2] = pixel.b; - textureDataRaw[pos + 3] = pixel.a; - } - } -} - -void ZTexture::ConvertBitmapToN64_Grayscale4() -{ - for (uint16_t y = 0; y < height; y++) - { - for (uint16_t x = 0; x < width; x += 2) - { - size_t pos = ((y * width) + x) / 2; - uint8_t r1 = textureData.GetPixel(y, x).r; - uint8_t r2 = textureData.GetPixel(y, x + 1).r; - - textureDataRaw[pos] = (uint8_t)(((r1 / 16) << 4) + (r2 / 16)); - } - } -} - -void ZTexture::ConvertBitmapToN64_Grayscale8() -{ - for (uint16_t y = 0; y < height; y++) - { - for (uint16_t x = 0; x < width; x++) - { - size_t pos = (y * width) + x; - RGBAPixel pixel = textureData.GetPixel(y, x); - textureDataRaw[pos] = pixel.r; - } - } -} - -void ZTexture::ConvertBitmapToN64_GrayscaleAlpha4() -{ - for (uint16_t y = 0; y < height; y++) - { - for (uint16_t x = 0; x < width; x += 2) - { - size_t pos = ((y * width) + x) / 2; - uint8_t data = 0; - - for (uint16_t i = 0; i < 2; i++) - { - RGBAPixel pixel = textureData.GetPixel(y, x + i); - uint8_t cR = pixel.r; - uint8_t alphaBit = pixel.a != 0; - - if (i == 0) - data = (((cR >> 5) << 1) | alphaBit) << 4; - else - data |= ((cR >> 5) << 1) | alphaBit; - } - - textureDataRaw[pos] = data; - } - } -} - -void ZTexture::ConvertBitmapToN64_GrayscaleAlpha8() -{ - for (uint16_t y = 0; y < height; y++) - { - for (uint16_t x = 0; x < width; x++) - { - size_t pos = ((y * width) + x) * 1; - RGBAPixel pixel = textureData.GetPixel(y, x); - - uint8_t r = (pixel.r >> 4) & 0xF; - uint8_t a = (pixel.a >> 4) & 0xF; - - textureDataRaw[pos] = (r << 4) | a; - } - } -} - -void ZTexture::ConvertBitmapToN64_GrayscaleAlpha16() -{ - for (uint16_t y = 0; y < height; y++) - { - for (uint16_t x = 0; x < width; x++) - { - size_t pos = ((y * width) + x) * 2; - RGBAPixel pixel = textureData.GetPixel(y, x); - - uint8_t cR = pixel.r; - uint8_t aR = pixel.a; - - textureDataRaw[pos + 0] = cR; - textureDataRaw[pos + 1] = aR; - } - } -} - -void ZTexture::ConvertBitmapToN64_Palette4() -{ - for (uint16_t y = 0; y < height; y++) - { - for (uint16_t x = 0; x < width; x += 2) - { - size_t pos = ((y * width) + x) / 2; - - uint8_t cR1 = textureData.GetIndexedPixel(y, x); - uint8_t cR2 = textureData.GetIndexedPixel(y, x + 1); - - textureDataRaw[pos] = (cR1 << 4) | (cR2); - } - } -} - -void ZTexture::ConvertBitmapToN64_Palette8() -{ - for (uint16_t y = 0; y < height; y++) - { - for (uint16_t x = 0; x < width; x++) - { - size_t pos = ((y * width) + x); - uint8_t cR = textureData.GetIndexedPixel(y, x); - - textureDataRaw[pos] = cR; - } - } -} - -float ZTexture::GetPixelMultiplyer() const -{ - switch (format) - { - case TextureType::Grayscale4bpp: - case TextureType::GrayscaleAlpha4bpp: - case TextureType::Palette4bpp: - return 0.5f; - case TextureType::Grayscale8bpp: - case TextureType::GrayscaleAlpha8bpp: - case TextureType::Palette8bpp: - return 1; - case TextureType::GrayscaleAlpha16bpp: - case TextureType::RGBA16bpp: - return 2; - case TextureType::RGBA32bpp: - return 4; - default: - return -1; - } -} - -size_t ZTexture::GetRawDataSize() const -{ - return (width * height * GetPixelMultiplyer()); -} - -std::string ZTexture::GetIMFmtFromType() -{ - switch (format) - { - case TextureType::RGBA32bpp: - case TextureType::RGBA16bpp: - return "G_IM_FMT_RGBA"; - case TextureType::Grayscale4bpp: - case TextureType::Grayscale8bpp: - return "G_IM_FMT_I"; - case TextureType::Palette4bpp: - case TextureType::Palette8bpp: - return "G_IM_FMT_CI"; - case TextureType::GrayscaleAlpha4bpp: - case TextureType::GrayscaleAlpha8bpp: - case TextureType::GrayscaleAlpha16bpp: - return "G_IM_FMT_IA"; - default: - return "ERROR"; - } -} - -std::string ZTexture::GetIMSizFromType() -{ - switch (format) - { - case TextureType::Grayscale4bpp: - case TextureType::Palette4bpp: - case TextureType::GrayscaleAlpha4bpp: - return "G_IM_SIZ_4b"; - case TextureType::Palette8bpp: - case TextureType::Grayscale8bpp: - return "G_IM_SIZ_8b"; - case TextureType::GrayscaleAlpha16bpp: - case TextureType::RGBA16bpp: - return "G_IM_SIZ_16b"; - case TextureType::RGBA32bpp: - return "G_IM_SIZ_32b"; - default: - return "ERROR"; - } -} - -std::string ZTexture::GetDefaultName(const std::string& prefix) const -{ - const char* suffix = "Tex"; - if (isPalette) - suffix = "TLUT"; - return StringHelper::Sprintf("%s%s_%06X", prefix.c_str(), suffix, rawDataIndex); -} - -uint32_t ZTexture::GetWidth() const -{ - return width; -} - -uint32_t ZTexture::GetHeight() const -{ - return height; -} - -void ZTexture::SetDimensions(uint32_t nWidth, uint32_t nHeight) -{ - width = nWidth; - height = nHeight; - ParseRawData(); -} - -TextureType ZTexture::GetTextureType() const -{ - return format; -} - -void ZTexture::Save(const fs::path& outFolder) -{ - // Optionally generate text file containing CRC information. This is going to be a one time - // process for generating the Texture Pool XML. - if (Globals::Instance->outputCrc) - { - File::WriteAllText((Globals::Instance->outputPath / (outName + ".txt")).string(), - StringHelper::Sprintf("%08lX", hash)); - } - - auto outPath = GetPoolOutPath(outFolder); - - if (!Directory::Exists(outPath.string())) - Directory::CreateDirectory(outPath.string()); - - fs::path outFileName; - - if (!dWordAligned) - outFileName = outPath / (outName + ".u32" + "." + GetExternalExtension() + ".png"); - else - outFileName = outPath / (outName + +"." + GetExternalExtension() + ".png"); - -#ifdef TEXTURE_DEBUG - printf("Saving PNG: %s\n", outFileName.c_str()); - printf("\t Var name: %s\n", name.c_str()); - if (tlut != nullptr) - printf("\t TLUT name: %s\n", tlut->name.c_str()); -#endif - - textureData.WritePng(outFileName); - -#ifdef TEXTURE_DEBUG - printf("\n"); -#endif -} - -Declaration* ZTexture::DeclareVar(const std::string& prefix, - [[maybe_unused]] const std::string& bodyStr) -{ - std::string auxName = name; - std::string auxOutName = outName; - std::string incStr; - if (auxName == "") - auxName = GetDefaultName(prefix); - - if (auxOutName == "") - auxOutName = GetDefaultName(prefix); - - auto filepath = Globals::Instance->outputPath / fs::path(auxOutName).stem(); - - if (dWordAligned) - incStr = StringHelper::Sprintf("%s.%s.inc.c", filepath.string().c_str(), - GetExternalExtension().c_str()); - else - incStr = StringHelper::Sprintf("%s.u32.%s.inc.c", filepath.string().c_str(), - GetExternalExtension().c_str()); - - if (!Globals::Instance->cfg.texturePool.empty()) - { - CalcHash(); - - // TEXTURE POOL CHECK - const auto& poolEntry = Globals::Instance->cfg.texturePool.find(hash); - if (poolEntry != Globals::Instance->cfg.texturePool.end()) - { - if (dWordAligned) - incStr = - StringHelper::Sprintf("%s.%s.inc.c", poolEntry->second.path.string().c_str(), - GetExternalExtension().c_str()); - else - incStr = StringHelper::Sprintf("%s.u32.%s.inc.c", - poolEntry->second.path.string().c_str(), - GetExternalExtension().c_str()); - } - } - size_t texSizeDivisor = (dWordAligned) ? 8 : 4; - - Declaration* decl; - - if (parent->makeDefines) - { - decl = parent->AddDeclarationIncludeArray(rawDataIndex, incStr, GetRawDataSize(), - GetSourceTypeName(), auxName, GetHeaderDefines(), - GetRawDataSize() / texSizeDivisor); - } - else - { - decl = parent->AddDeclarationIncludeArray(rawDataIndex, incStr, GetRawDataSize(), - GetSourceTypeName(), auxName, - GetRawDataSize() / texSizeDivisor); - } - decl->staticConf = staticConf; - return decl; -} - -std::string ZTexture::GetBodySourceCode() const -{ - std::string sourceOutput; - size_t texSizeInc = (dWordAligned) ? 8 : 4; - for (size_t i = 0; i < textureDataRaw.size(); i += texSizeInc) - { - if (i % 32 == 0) - sourceOutput += " "; - if (dWordAligned) - sourceOutput += - StringHelper::Sprintf("0x%016llX, ", BitConverter::ToUInt64BE(textureDataRaw, i)); - else - sourceOutput += - StringHelper::Sprintf("0x%08llX, ", BitConverter::ToUInt32BE(textureDataRaw, i)); - if (i % 32 == 24) - sourceOutput += StringHelper::Sprintf(" // 0x%06X \n", rawDataIndex + ((i / 32) * 32)); - } - - // Ensure there's always a trailing line feed to prevent dumb warnings. - // Please don't remove this line, unless you somehow made a way to prevent - // that warning when building the OoT repo. - sourceOutput += "\n"; - - return sourceOutput; -} - -std::string ZTexture::GetHeaderDefines() const -{ - std::string definePrefix = StringHelper::camelCaseTo_SCREAMING_SNAKE_CASE(name.c_str(), true); - std::string ret = StringHelper::Sprintf("#define %s_WIDTH %d\n", definePrefix.c_str(), width); - - ret += StringHelper::Sprintf("#define %s_HEIGHT %d\n", definePrefix.c_str(), height); - ret += StringHelper::Sprintf("#define %s_SIZE 0x%zX\n", definePrefix.c_str(), GetRawDataSize()); - - return ret; -} - -bool ZTexture::IsExternalResource() const -{ - return true; -} - -ZResourceType ZTexture::GetResourceType() const -{ - return ZResourceType::Texture; -} - -std::string ZTexture::GetSourceTypeName() const -{ - return dWordAligned ? "u64" : "u32"; -} - -void ZTexture::CalcHash() -{ - const auto& parentRawData = parent->GetRawData(); - hash = CRC32B(parentRawData.data() + rawDataIndex, GetRawDataSize()); -} - -std::string ZTexture::GetExternalExtension() const -{ - switch (format) - { - case TextureType::RGBA32bpp: - return "rgba32"; - case TextureType::RGBA16bpp: - return "rgba16"; - case TextureType::Grayscale4bpp: - return "i4"; - case TextureType::Grayscale8bpp: - return "i8"; - case TextureType::GrayscaleAlpha4bpp: - return "ia4"; - case TextureType::GrayscaleAlpha8bpp: - return "ia8"; - case TextureType::GrayscaleAlpha16bpp: - return "ia16"; - case TextureType::Palette4bpp: - return "ci4"; - case TextureType::Palette8bpp: - return "ci8"; - default: - return "ERROR"; - } -} - -fs::path ZTexture::GetPoolOutPath(const fs::path& defaultValue) -{ - if (Globals::Instance->cfg.texturePool.find(hash) != Globals::Instance->cfg.texturePool.end()) - return Path::GetDirectoryName(Globals::Instance->cfg.texturePool[hash].path.string()); - - return defaultValue; -} - -TextureType ZTexture::GetTextureTypeFromString(const std::string& str) -{ - TextureType texType = TextureType::Error; - - if (str == "rgba32") - texType = TextureType::RGBA32bpp; - else if (str == "rgba16") - texType = TextureType::RGBA16bpp; - else if (str == "rgb5a1") - { - texType = TextureType::RGBA16bpp; - HANDLE_WARNING(WarningType::Deprecated, - "the texture format 'rgb5a1' is currently deprecated", - "It will be removed in a future version. Use the format 'rgba16' instead."); - } - else if (str == "i4") - texType = TextureType::Grayscale4bpp; - else if (str == "i8") - texType = TextureType::Grayscale8bpp; - else if (str == "ia4") - texType = TextureType::GrayscaleAlpha4bpp; - else if (str == "ia8") - texType = TextureType::GrayscaleAlpha8bpp; - else if (str == "ia16") - texType = TextureType::GrayscaleAlpha16bpp; - else if (str == "ci4") - texType = TextureType::Palette4bpp; - else if (str == "ci8") - texType = TextureType::Palette8bpp; - else - // TODO: handle this case in a more coherent way - HANDLE_WARNING(WarningType::InvalidAttributeValue, - "invalid value found for 'Type' attribute", "Defaulting to ''."); - return texType; -} - -bool ZTexture::IsColorIndexed() const -{ - switch (format) - { - case TextureType::Palette4bpp: - case TextureType::Palette8bpp: - return true; - - default: - return false; - } -} - -void ZTexture::SetTlut(ZTexture* nTlut) -{ - assert(IsColorIndexed()); - assert(nTlut->isPalette); - tlut = nTlut; - - textureData.SetPalette(tlut->textureData, splitTlut ? 128 : 0); -} - -bool ZTexture::HasTlut() const -{ - return tlut != nullptr; -} diff --git a/tools/ZAPD/ZAPD/ZTexture.h b/tools/ZAPD/ZAPD/ZTexture.h deleted file mode 100644 index 1461ff95a6..0000000000 --- a/tools/ZAPD/ZAPD/ZTexture.h +++ /dev/null @@ -1,119 +0,0 @@ -#pragma once - -#include "ImageBackend.h" -#include "ZResource.h" -#include "tinyxml2.h" - -enum class TextureType -{ - Error, - RGBA32bpp, - RGBA16bpp, - Palette4bpp, - Palette8bpp, - Grayscale4bpp, - Grayscale8bpp, - GrayscaleAlpha4bpp, - GrayscaleAlpha8bpp, - GrayscaleAlpha16bpp, -}; - -class ZTexture : public ZResource -{ -protected: - TextureType format = TextureType::Error; - uint32_t width, height; - - ImageBackend textureData; - std::vector textureDataRaw; // When reading from a PNG file. - uint32_t tlutOffset = static_cast(-1); - ZTexture* tlut = nullptr; - bool splitTlut; - - // The following functions convert from N64 binary data to a bitmap to be saved to a PNG. - void ConvertN64ToBitmap_RGBA16(); - void ConvertN64ToBitmap_RGBA32(); - void ConvertN64ToBitmap_Grayscale8(); - void ConvertN64ToBitmap_GrayscaleAlpha8(); - void ConvertN64ToBitmap_Grayscale4(); - void ConvertN64ToBitmap_GrayscaleAlpha4(); - void ConvertN64ToBitmap_GrayscaleAlpha16(); - void ConvertN64ToBitmap_Palette4(); - void ConvertN64ToBitmap_Palette8(); - - // The following functions convert from a bitmap to N64 binary data. - void PrepareRawDataFromFile(const fs::path& inFolder); - void ConvertBitmapToN64_RGBA16(); - void ConvertBitmapToN64_RGBA32(); - void ConvertBitmapToN64_Grayscale4(); - void ConvertBitmapToN64_Grayscale8(); - void ConvertBitmapToN64_GrayscaleAlpha4(); - void ConvertBitmapToN64_GrayscaleAlpha8(); - void ConvertBitmapToN64_GrayscaleAlpha16(); - void ConvertBitmapToN64_Palette4(); - void ConvertBitmapToN64_Palette8(); - -public: - ZTexture(ZFile* nParent); - - bool isPalette = false; - bool dWordAligned = true; - - void ExtractFromBinary(uint32_t nRawDataIndex, int32_t nWidth, int32_t nHeight, - TextureType nType, bool nIsPalette); - void FromPNG(const fs::path& pngFilePath, TextureType texType); - static TextureType GetTextureTypeFromString(const std::string& str); - - void ParseXML(tinyxml2::XMLElement* reader) override; - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override; - std::string GetBodySourceCode() const override; - - /// - /// Calculates the hash of this texture, for use with the texture pool. - /// - void CalcHash() override; - - void Save(const fs::path& outFolder) override; - - std::string GetHeaderDefines() const; - bool IsExternalResource() const override; - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - std::string GetExternalExtension() const override; - - size_t GetRawDataSize() const override; - std::string GetIMFmtFromType(); - std::string GetIMSizFromType(); - std::string GetDefaultName(const std::string& prefix) const override; - uint32_t GetWidth() const; - uint32_t GetHeight() const; - void SetDimensions(uint32_t nWidth, uint32_t nHeight); - - /// - /// Returns how many bytes each pixel takes up. - /// - /// - float GetPixelMultiplyer() const; - - TextureType GetTextureType() const; - - /// - /// Returns the path to the texture pool, taken from the config file. - /// - /// - /// - fs::path GetPoolOutPath(const fs::path& defaultValue); - - /// - /// Returns if this texture uses a palette. - /// - /// - bool IsColorIndexed() const; - - void SetTlut(ZTexture* nTlut); - bool HasTlut() const; - void ParseRawDataLate() override; -}; diff --git a/tools/ZAPD/ZAPD/ZTextureAnimation.cpp b/tools/ZAPD/ZAPD/ZTextureAnimation.cpp deleted file mode 100644 index 0c55b26097..0000000000 --- a/tools/ZAPD/ZAPD/ZTextureAnimation.cpp +++ /dev/null @@ -1,666 +0,0 @@ -/** - * File: ZTextureAnimation.cpp - * ZResources defined: ZTextureAnimation, ZTextureAnimationParams (XML declaration not supported for - * the latter) - * Purpose: extracting texture animating structures from asset files - * Note: data type is exclusive to Majora's Mask - * - * Structure of data: - * A texture animation consists of a main array of data of the form - * `SS 00 00 0T PPPPPPPP`, - * where `S` is the segment that the functionality is sent to (and read by DLists), `T` is the - * "type" (see below), and `P` is a pointer to the type's subsidiary information, which is - * invariably just above this main array. Details of this subsidiary data are given below. - * - * Segment - * === - * The segment starts at 1 and is incremented in each entry; the final one is negated, which is used - * as the indication to stop reading. The actual segment the game will use to draw is S + 7. - * - * Types - * === - * There are 7 values that `T` can take: - * `0`: A single texture scroll (Implemented by Gfx_TexScroll): subsidiary params are given as - * an array with one entry, a struct `XX YY WW HH` containing xStep, yStep, width, height - * (all u8). - * - * `1`: A dual texture scroll (Implementated by Gfx_TwoTexScroll): same as type `0`, but with - * two entries in the params array. - * - * `2`: Color changing: Changes the primColor (with a LOD factor) and envColor - * `KKKK LLLL PPPPPPPP QQQQQQQQ RRRRRRRR` - * - `K` (u16) is the total length of the animation (and in this case, the total number of - * colors) - * - `L` (u16) is seemingly always 0 for this type, and not used in the code - * - `P` segmented pointer to array of augmented primColors - * - `Q` segmented pointer to array of envColors, and can be NULL - * - `R` segmented pointer to array of frameData (u8), which is also seemingly always NULL - * for this type. - * - * envColors take the form `RR GG BB AA` as usual, while primColors have an extra LODFrac - * element: RR GG BB AA LL - * - * `3`: Color changing (LERP): similar to type `2`, but uses linear interpolation. The structure - * is similar to `2`, but - * - `K` is now just the animation length, while - * - `L` is the total number of colors, and - * - the frameData is used to determine which colors to interpolate. - * - * `4`: Color changing (Lagrange interpolation): For extraction purposes identical to type 3. - * Uses a nonlinear interpolation formula to change the colours more smoothly. - * - * `5`: Texture cycle: functions like a gif. Subsidiary params: - * `FFFF 0000 PPPPPPPP QQQQQQQQ` - * where - * - `F` (u16) time between changes in frames - * - `P` pointer to array of segmented pointers to textures to cycle through - * - `Q` array of indices, indicating which texture to use next when a change frame is - * reached. The maximum indicates the number of textures in the texture array. - * - * `6`: This is used to indicate an empty/unimplemented params set. It is ignored by the game's - * function provided that the segment is 0. A generic empty one takes the form - * `00 00 00 06 00000000`, - * and has no extra data. - * - * Implementation - * === - * - ZTextureAnimation requires a declaration in the XML to extract anything. It handles the main - * array. It uses a POD struct for each entry, and declares references to the params structs. - * - * - ZTextureAnimationParams is not (currently) declarable in an XML. It is a parent class for the - * three classes that handle the various cases: - * - TextureScrollingParams for types `0` and `1` - * - TextureColorChangingParams for types `2`,`3`,`4` - * - TextureCyclingParams for type `5` - * Each of these will declare all its subsidiary arrays, using POD structs. - */ -#include "ZTextureAnimation.h" - -#include -#include -#include - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "WarningHandler.h" -#include "ZFile.h" -#include "ZResource.h" -#include "tinyxml2.h" - -REGISTER_ZFILENODE(TextureAnimation, ZTextureAnimation); - -/* Constructors */ -ZTextureAnimationParams::ZTextureAnimationParams(ZFile* parent) : ZResource::ZResource(parent) -{ -} -TextureScrollingParams::TextureScrollingParams(ZFile* parent) - : ZTextureAnimationParams::ZTextureAnimationParams(parent) -{ -} -TextureColorChangingParams::TextureColorChangingParams(ZFile* parent) - : ZTextureAnimationParams::ZTextureAnimationParams(parent) -{ -} -TextureCyclingParams::TextureCyclingParams(ZFile* parent) - : ZTextureAnimationParams::ZTextureAnimationParams(parent) -{ -} - -/* TextureAnimationParams */ -/* This class only implements the functions common to all or most its inheritors */ - -void ZTextureAnimationParams::ExtractFromBinary(uint32_t nRawDataIndex) -{ - rawDataIndex = nRawDataIndex; - - ParseRawData(); -} - -// Implemented by TextureScrollingParams only -void ZTextureAnimationParams::ExtractFromBinary([[maybe_unused]] uint32_t nRawDataIndex, - [[maybe_unused]] int count) -{ -} - -std::string -ZTextureAnimationParams::GetDefaultName([[maybe_unused]] const std::string& prefix) const -{ - return "ShouldNotBeVIsible"; -} - -ZResourceType ZTextureAnimationParams::GetResourceType() const -{ - return ZResourceType::TextureAnimationParams; -} - -/* TextureScrollingParams */ - -void TextureScrollingParams::ParseRawData() -{ - const auto& rawData = parent->GetRawData(); - - for (int i = 0; i < count; i++) - { - rows[i].xStep = BitConverter::ToUInt8BE(rawData, rawDataIndex + 4 * i); - rows[i].yStep = BitConverter::ToUInt8BE(rawData, rawDataIndex + 4 * i + 1); - rows[i].width = BitConverter::ToUInt8BE(rawData, rawDataIndex + 4 * i + 2); - rows[i].height = BitConverter::ToUInt8BE(rawData, rawDataIndex + 4 * i + 3); - } -} - -void TextureScrollingParams::ExtractFromBinary(uint32_t nRawDataIndex, int nCount) -{ - rawDataIndex = nRawDataIndex; - count = nCount; - - ParseRawData(); -} - -std::string TextureScrollingParams::GetSourceTypeName() const -{ - return "AnimatedMatTexScrollParams"; // TODO: Better name -} - -std::string TextureScrollingParams::GetDefaultName(const std::string& prefix) const -{ - return StringHelper::Sprintf("%sTexScrollParams_%06X", prefix.c_str(), rawDataIndex); -} - -size_t TextureScrollingParams::GetRawDataSize() const -{ - return 4 * count; -} - -/** - * Overrides the parent version to declare an array of the params rather than just one entry. - */ -Declaration* TextureScrollingParams::DeclareVar(const std::string& prefix, - const std::string& bodyStr) -{ - std::string auxName = name; - - if (name == "") - auxName = GetDefaultName(prefix); - - return parent->AddDeclarationArray(rawDataIndex, GetDeclarationAlignment(), GetRawDataSize(), - GetSourceTypeName(), auxName, count, bodyStr); -} - -std::string TextureScrollingParams::GetBodySourceCode() const -{ - std::string bodyStr; - - for (int i = 0; i < count; i++) - { - bodyStr += StringHelper::Sprintf("\t{ %d, %d, 0x%02X, 0x%02X },\n", rows[i].xStep, - rows[i].yStep, rows[i].width, rows[i].height); - } - - bodyStr.pop_back(); - - return bodyStr; -} - -/* TextureColorChangingParams */ - -/** - * Also parses the color and frameData arrays - */ -void TextureColorChangingParams::ParseRawData() -{ - const auto& rawData = parent->GetRawData(); - - animLength = BitConverter::ToUInt16BE(rawData, rawDataIndex); - colorListCount = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2); - - // Handle type 2 separately - uint16_t listLength = - ((type == TextureAnimationParamsType::ColorChange) ? animLength : colorListCount); - - if (listLength == 0) - HANDLE_ERROR_RESOURCE(WarningType::Always, parent, this, rawDataIndex, - "color list length cannot be 0", ""); - - primColorListAddress = BitConverter::ToUInt32BE(rawData, rawDataIndex + 4); - envColorListAddress = BitConverter::ToUInt32BE(rawData, rawDataIndex + 8); - frameDataListAddress = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0xC); - - uint32_t primColorListOffset = Seg2Filespace(primColorListAddress, parent->baseAddress); - uint32_t envColorListOffset = Seg2Filespace(envColorListAddress, parent->baseAddress); - uint32_t frameDataListOffset = Seg2Filespace(frameDataListAddress, parent->baseAddress); - - uint32_t currentPtr; - - F3DPrimColor currentPrimColor; - - for (currentPtr = primColorListOffset; currentPtr < primColorListOffset + 5 * listLength; - currentPtr += 5) - { - currentPrimColor = {BitConverter::ToUInt8BE(rawData, currentPtr), - BitConverter::ToUInt8BE(rawData, currentPtr + 1), - BitConverter::ToUInt8BE(rawData, currentPtr + 2), - BitConverter::ToUInt8BE(rawData, currentPtr + 3), - BitConverter::ToUInt8BE(rawData, currentPtr + 4)}; - primColorList.push_back(currentPrimColor); - } - - F3DEnvColor currentEnvColor; - - for (currentPtr = envColorListOffset; currentPtr < envColorListOffset + 4 * listLength; - currentPtr += 4) - { - currentEnvColor = {BitConverter::ToUInt8BE(rawData, currentPtr), - BitConverter::ToUInt8BE(rawData, currentPtr + 1), - BitConverter::ToUInt8BE(rawData, currentPtr + 2), - BitConverter::ToUInt8BE(rawData, currentPtr + 3)}; - envColorList.push_back(currentEnvColor); - } - - uint16_t currentFrameData; - - for (currentPtr = frameDataListOffset; currentPtr < frameDataListOffset + 2 * listLength; - currentPtr += 2) - { - currentFrameData = BitConverter::ToUInt16BE(rawData, currentPtr); - frameDataList.push_back(currentFrameData); - } -} - -std::string TextureColorChangingParams::GetSourceTypeName() const -{ - return "AnimatedMatColorParams"; // TODO: Better name -} - -std::string TextureColorChangingParams::GetDefaultName(const std::string& prefix) const -{ - return StringHelper::Sprintf("%sColorParams_%06X", prefix.c_str(), rawDataIndex); -} - -size_t TextureColorChangingParams::GetRawDataSize() const -{ - return 0x10; -} - -void TextureColorChangingParams::DeclareReferences([[maybe_unused]] const std::string& prefix) -{ - if (primColorListAddress != 0) // NULL - { - std::string primColorBodyStr; - - for (const auto& color : primColorList) - { - primColorBodyStr += StringHelper::Sprintf("\t{ %d, %d, %d, %d, %d },\n", color.r, - color.g, color.b, color.a, color.lodFrac); - } - - primColorBodyStr.pop_back(); - - parent->AddDeclarationArray( - Seg2Filespace(primColorListAddress, parent->baseAddress), DeclarationAlignment::Align4, - primColorList.size() * 5, "F3DPrimColor", - StringHelper::Sprintf("%sTexColorChangingPrimColors_%06X", parent->GetName().c_str(), - Seg2Filespace(primColorListAddress, parent->baseAddress)), - primColorList.size(), primColorBodyStr); - } - - if (envColorListAddress != 0) // NULL - { - std::string envColorBodyStr; - - for (const auto& color : envColorList) - { - envColorBodyStr += StringHelper::Sprintf("\t{ %d, %d, %d, %d },\n", color.r, color.g, - color.b, color.a); - } - - envColorBodyStr.pop_back(); - - parent->AddDeclarationArray( - Seg2Filespace(envColorListAddress, parent->baseAddress), DeclarationAlignment::Align4, - envColorList.size() * 4, "F3DEnvColor", - StringHelper::Sprintf("%sTexColorChangingEnvColors_%06X", parent->GetName().c_str(), - Seg2Filespace(envColorListAddress, parent->baseAddress)), - envColorList.size(), envColorBodyStr); - } - - if (frameDataListAddress != 0) // NULL - { - std::string frameDataBodyStr = "\t"; - - for (const auto& frame : frameDataList) - { - frameDataBodyStr += StringHelper::Sprintf("%d, ", frame); - } - - frameDataBodyStr.pop_back(); - - parent->AddDeclarationArray( - Seg2Filespace(frameDataListAddress, parent->baseAddress), DeclarationAlignment::Align4, - frameDataList.size() * 2, "u16", - StringHelper::Sprintf("%sTexColorChangingFrameData_%06X", parent->GetName().c_str(), - Seg2Filespace(frameDataListAddress, parent->baseAddress)), - frameDataList.size(), frameDataBodyStr); - } -} - -std::string TextureColorChangingParams::GetBodySourceCode() const -{ - std::string primColorListName; - std::string envColorListName; - std::string frameDataListName; - - Globals::Instance->GetSegmentedPtrName(primColorListAddress, parent, "", primColorListName); - Globals::Instance->GetSegmentedPtrName(envColorListAddress, parent, "", envColorListName); - Globals::Instance->GetSegmentedPtrName(frameDataListAddress, parent, "", frameDataListName); - - std::string bodyStr = StringHelper::Sprintf( - "\n %d, %d, %s, %s, %s,\n", animLength, colorListCount, primColorListName.c_str(), - envColorListName.c_str(), frameDataListName.c_str()); - - return bodyStr; -} - -/* TextureCyclingParams */ - -void TextureCyclingParams::ParseRawData() -{ - const auto& rawData = parent->GetRawData(); - - cycleLength = BitConverter::ToUInt16BE(rawData, rawDataIndex); - if (cycleLength == 0) - HANDLE_ERROR_RESOURCE(WarningType::Always, parent, this, rawDataIndex, - "cycle length cannot be 0", ""); - - textureListAddress = BitConverter::ToUInt32BE(rawData, rawDataIndex + 4); - textureIndexListAddress = BitConverter::ToUInt32BE(rawData, rawDataIndex + 8); - - uint32_t textureListOffset = Seg2Filespace(textureListAddress, parent->baseAddress); - uint32_t textureIndexListOffset = Seg2Filespace(textureIndexListAddress, parent->baseAddress); - - uint32_t currentPtr; - - uint8_t currentIndex; - uint8_t maxIndex = 0; // To find the length of the texture list - - for (currentPtr = textureIndexListOffset; currentPtr < textureIndexListOffset + cycleLength; - currentPtr++) - { - currentIndex = BitConverter::ToUInt8BE(rawData, currentPtr); - textureIndexList.push_back(currentIndex); - if (currentIndex > maxIndex) - maxIndex = currentIndex; - } - - for (currentPtr = textureListOffset; currentPtr <= textureListOffset + 4 * maxIndex; - currentPtr += 4) - { - textureList.push_back(BitConverter::ToUInt32BE(rawData, currentPtr)); - } -} - -std::string TextureCyclingParams::GetSourceTypeName() const -{ - return "AnimatedMatTexCycleParams"; // TODO: Better name -} - -std::string TextureCyclingParams::GetDefaultName(const std::string& prefix) const -{ - return StringHelper::Sprintf("%sTexCycleParams_%06X", prefix.c_str(), rawDataIndex); -} - -size_t TextureCyclingParams::GetRawDataSize() const -{ - return 0xC; -} - -void TextureCyclingParams::DeclareReferences([[maybe_unused]] const std::string& prefix) -{ - if (textureListAddress != 0) // NULL - { - std::string texturesBodyStr; - std::string texName; - std::string comment; - - for (const auto& tex : textureList) - { - bool texFound = Globals::Instance->GetSegmentedPtrName(tex, parent, "", texName); - - // texName is a raw segmented pointer. This occurs if the texture is not declared - // separately since we cannot read the format. In theory we could scan DLists for the - // format on the appropriate segments. - if (!texFound) - { - comment = " // Raw pointer, declare texture in XML to use proper symbol"; - - auto msgHeader = StringHelper::Sprintf( - "TexCycle texture array declared here points to unknown texture at address %s", - texName.c_str()); - HANDLE_WARNING_RESOURCE( - WarningType::HardcodedPointer, parent, this, rawDataIndex, msgHeader, - "Please declare the texture in the XML to use the proper symbol."); - } - texturesBodyStr += StringHelper::Sprintf("\t%s,%s\n", texName.c_str(), comment.c_str()); - } - - texturesBodyStr.pop_back(); - - parent->AddDeclarationArray( - Seg2Filespace(textureListAddress, parent->baseAddress), DeclarationAlignment::Align4, - textureList.size() * 4, "TexturePtr", - StringHelper::Sprintf("%sTexCycleTexPtrs_%06X", parent->GetName().c_str(), - Seg2Filespace(textureListAddress, parent->baseAddress)), - textureList.size(), texturesBodyStr); - } - - if (textureIndexListAddress != 0) // NULL - { - std::string indicesBodyStr = "\t"; - - for (uint8_t index : textureIndexList) - { - indicesBodyStr += StringHelper::Sprintf("%d, ", index); - } - - indicesBodyStr.pop_back(); - - parent->AddDeclarationArray( - Seg2Filespace(textureIndexListAddress, parent->baseAddress), - DeclarationAlignment::Align4, textureIndexList.size(), "u8", - StringHelper::Sprintf("%sTexCycleTexIndices_%06X", parent->GetName().c_str(), - Seg2Filespace(textureIndexListAddress, parent->baseAddress)), - textureIndexList.size(), indicesBodyStr); - } -} - -std::string TextureCyclingParams::GetBodySourceCode() const -{ - std::string textureListName; - std::string textureIndexListName; - - Globals::Instance->GetSegmentedPtrName(textureListAddress, parent, "", textureListName); - Globals::Instance->GetSegmentedPtrName(textureIndexListAddress, parent, "", - textureIndexListName); - - std::string bodyStr = StringHelper::Sprintf( - "\n %d, %s, %s,\n", cycleLength, textureListName.c_str(), textureIndexListName.c_str()); - - return bodyStr; -} - -/* ZTextureAnimation */ - -ZTextureAnimation::ZTextureAnimation(ZFile* nParent) : ZResource(nParent) -{ -} - -/** - * Builds the array of params - */ -void ZTextureAnimation::ParseRawData() -{ - ZResource::ParseRawData(); - - TextureAnimationEntry currentEntry; - auto rawData = parent->GetRawData(); - int16_t type; - - for (uint32_t currentPtr = rawDataIndex;; currentPtr += 8) - { - type = BitConverter::ToInt16BE(rawData, currentPtr + 2); - - currentEntry.segment = BitConverter::ToInt8BE(rawData, currentPtr); - currentEntry.type = (TextureAnimationParamsType)type; - currentEntry.paramsPtr = BitConverter::ToUInt32BE(rawData, currentPtr + 4); - entries.push_back(currentEntry); - - if ((type < 0) || (type > 6)) - { - HANDLE_ERROR_RESOURCE( - WarningType::Always, parent, this, rawDataIndex, - StringHelper::Sprintf( - "unknown TextureAnimationParams type 0x%02X in TextureAnimation", type), - StringHelper::Sprintf( - "Entry reads { 0x%02X, 0x%02X, 0x%08X } , but type should be " - "between 0x00 and 0x06 inclusive.", - currentEntry.segment, type, currentEntry.paramsPtr)); - } - - if (currentEntry.segment <= 0) - break; - } -} - -#include -/** - * For each params entry, - */ -void ZTextureAnimation::DeclareReferences(const std::string& prefix) -{ - std::string varPrefix = name; - if (varPrefix == "") - varPrefix = prefix; - - ZResource::DeclareReferences(varPrefix); - - for (const auto& entry : entries) - { - if (entry.paramsPtr != 0 && GETSEGNUM(entry.paramsPtr) == parent->segment) - { - uint32_t paramsOffset = Seg2Filespace(entry.paramsPtr, parent->baseAddress); - if (!parent->HasDeclaration(paramsOffset)) - { - ZTextureAnimationParams* params; - int count; - switch (entry.type) - { - case TextureAnimationParamsType::SingleScroll: - if (true) - { - count = 1; - // The else now allows SingleScroll to fall through to params = ... without - // touching the code in the else block - } - else - { - // The contents of this block can only be run by jumping into it with the - // case label - [[fallthrough]]; - case TextureAnimationParamsType::DualScroll: - count = 2; - } - params = new TextureScrollingParams(parent); - params->type = entry.type; - params->ExtractFromBinary(paramsOffset, count); - break; - - case TextureAnimationParamsType::ColorChange: - case TextureAnimationParamsType::ColorChangeLERP: - case TextureAnimationParamsType::ColorChangeLagrange: - params = new TextureColorChangingParams(parent); - params->type = entry.type; - params->ExtractFromBinary(paramsOffset); - break; - - case TextureAnimationParamsType::TextureCycle: - params = new TextureCyclingParams(parent); - params->type = entry.type; - params->ExtractFromBinary(paramsOffset); - break; - - case TextureAnimationParamsType::Empty: - HANDLE_WARNING_RESOURCE( - WarningType::InvalidExtractedData, parent, this, rawDataIndex, - "TextureAnimationParams entry has empty type (6), but params pointer is " - "not NULL", - StringHelper::Sprintf("Params read { 0x%02X, 0x%02X, 0x%08X } .", - entry.segment, (int)entry.type, entry.paramsPtr)); - return; - default: - // Because GCC is worried this could happen - assert(entry.type < TextureAnimationParamsType::SingleScroll || - entry.type > TextureAnimationParamsType::Empty); - return; - } - - params->SetName(params->GetDefaultName(varPrefix)); - params->DeclareVar(varPrefix, ""); - parent->AddResource(params); - } - } - } -} - -std::string ZTextureAnimation::GetSourceTypeName() const -{ - return "AnimatedMaterial"; // TODO: Better name -} - -ZResourceType ZTextureAnimation::GetResourceType() const -{ - return ZResourceType::TextureAnimation; -} - -/** - * The size of the main array - */ -size_t ZTextureAnimation::GetRawDataSize() const -{ - return entries.size() * 8; -} - -std::string ZTextureAnimation::GetDefaultName(const std::string& prefix) const -{ - return StringHelper::Sprintf("%sTexAnim_%06X", prefix.c_str(), rawDataIndex); -} - -Declaration* ZTextureAnimation::DeclareVar(const std::string& prefix, const std::string& bodyStr) -{ - std::string auxName = name; - - if (name == "") - auxName = GetDefaultName(prefix); - - Declaration* decl = - parent->AddDeclarationArray(rawDataIndex, GetDeclarationAlignment(), GetRawDataSize(), - GetSourceTypeName(), auxName, entries.size(), bodyStr); - decl->staticConf = staticConf; - return decl; -} - -std::string ZTextureAnimation::GetBodySourceCode() const -{ - std::string bodyStr; - - for (const auto& entry : entries) - { - std::string paramName; - Globals::Instance->GetSegmentedPtrName(entry.paramsPtr, parent, "", paramName); - - bodyStr += StringHelper::Sprintf("\t{ %d, %d, %s },\n", entry.segment, entry.type, - paramName.c_str()); - } - - bodyStr.pop_back(); - - return bodyStr; -} diff --git a/tools/ZAPD/ZAPD/ZTextureAnimation.h b/tools/ZAPD/ZAPD/ZTextureAnimation.h deleted file mode 100644 index 6b03eb7cf4..0000000000 --- a/tools/ZAPD/ZAPD/ZTextureAnimation.h +++ /dev/null @@ -1,151 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include "ZResource.h" - -enum class TextureAnimationParamsType -{ - /* 0 */ SingleScroll, - /* 1 */ DualScroll, - /* 2 */ ColorChange, - /* 3 */ ColorChangeLERP, - /* 4 */ ColorChangeLagrange, - /* 5 */ TextureCycle, - /* 6 */ Empty // An empty TextureAnimation has the form 00 00 00 06 00000000 -}; - -class ZTextureAnimationParams : public ZResource -{ -public: - ZTextureAnimationParams(ZFile* parent); - - void ExtractFromBinary(uint32_t nRawDataIndex); - virtual void ExtractFromBinary(uint32_t nRawDataIndex, int count); - - virtual std::string GetDefaultName(const std::string& prefix) const; - ZResourceType GetResourceType() const; - - TextureAnimationParamsType type; -}; - -struct TextureScrollingParamsEntry -{ - int8_t xStep; - int8_t yStep; - uint8_t width; - uint8_t height; -}; - -class TextureScrollingParams : public ZTextureAnimationParams -{ -public: - TextureScrollingParams(ZFile* parent); - - void ParseRawData() override; - void ExtractFromBinary(uint32_t nRawDataIndex, int count) override; - - std::string GetSourceTypeName() const override; - std::string GetDefaultName(const std::string& prefix) const override; - size_t GetRawDataSize() const override; - - Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override; - std::string GetBodySourceCode() const override; - - int count; // 1 for Single, 2 for Dual - TextureScrollingParamsEntry rows[2]; // Too small to make a vector worth it -}; - -struct F3DPrimColor -{ - uint8_t r; - uint8_t g; - uint8_t b; - uint8_t a; - uint8_t lodFrac; -}; - -struct F3DEnvColor -{ - uint8_t r; - uint8_t g; - uint8_t b; - uint8_t a; -}; - -class TextureColorChangingParams : public ZTextureAnimationParams -{ -public: - TextureColorChangingParams(ZFile* parent); - - void ParseRawData() override; - - std::string GetSourceTypeName() const override; - std::string GetDefaultName(const std::string& prefix) const override; - size_t GetRawDataSize() const override; - - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - uint16_t animLength; // size of list for type 2 - uint16_t colorListCount; - segptr_t primColorListAddress; - segptr_t envColorListAddress; - segptr_t frameDataListAddress; - std::vector primColorList; - std::vector envColorList; - std::vector frameDataList; -}; - -class TextureCyclingParams : public ZTextureAnimationParams -{ -public: - TextureCyclingParams(ZFile* parent); - - void ParseRawData() override; - - std::string GetSourceTypeName() const override; - std::string GetDefaultName(const std::string& prefix) const override; - size_t GetRawDataSize() const override; - - void DeclareReferences(const std::string& prefix) override; - - std::string GetBodySourceCode() const override; - - uint16_t cycleLength; - segptr_t textureListAddress; - segptr_t textureIndexListAddress; - std::vector textureList; - std::vector textureIndexList; -}; - -struct TextureAnimationEntry -{ - int8_t segment; - TextureAnimationParamsType type; - segptr_t paramsPtr; -}; - -class ZTextureAnimation : public ZResource -{ -public: - ZTextureAnimation(ZFile* nParent); - - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - size_t GetRawDataSize() const override; - std::string GetDefaultName(const std::string& prefix) const override; - - Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override; - std::string GetBodySourceCode() const override; - -private: - std::vector entries; -}; diff --git a/tools/ZAPD/ZAPD/ZVector.cpp b/tools/ZAPD/ZAPD/ZVector.cpp deleted file mode 100644 index 607aac86d3..0000000000 --- a/tools/ZAPD/ZAPD/ZVector.cpp +++ /dev/null @@ -1,126 +0,0 @@ -#include "ZVector.h" - -#include - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/File.h" -#include "Utils/StringHelper.h" -#include "WarningHandler.h" -#include "ZFile.h" - -REGISTER_ZFILENODE(Vector, ZVector); - -ZVector::ZVector(ZFile* nParent) : ZResource(nParent) -{ - scalarType = ZScalarType::ZSCALAR_NONE; - dimensions = 0; - - RegisterRequiredAttribute("Type"); - RegisterRequiredAttribute("Dimensions"); -} - -void ZVector::ExtractFromBinary(uint32_t nRawDataIndex, ZScalarType nScalarType, - uint32_t nDimensions) -{ - rawDataIndex = nRawDataIndex; - scalarType = nScalarType; - dimensions = nDimensions; - - // Don't parse raw data of external files - if (parent->GetMode() == ZFileMode::ExternalFile) - return; - - ParseRawData(); -} - -void ZVector::ParseXML(tinyxml2::XMLElement* reader) -{ - ZResource::ParseXML(reader); - - this->scalarType = ZScalar::MapOutputTypeToScalarType(registeredAttributes.at("Type").value); - - this->dimensions = StringHelper::StrToL(registeredAttributes.at("Dimensions").value, 16); -} - -void ZVector::ParseRawData() -{ - int32_t currentRawDataIndex = rawDataIndex; - // TODO: this shouldn't be necessary. - scalars.clear(); - scalars.reserve(dimensions); - for (uint32_t i = 0; i < dimensions; i++) - { - ZScalar scalar(parent); - scalar.ExtractFromBinary(currentRawDataIndex, scalarType); - currentRawDataIndex += scalar.GetRawDataSize(); - - scalars.push_back(scalar); - } - - // Ensure the scalars vector has the same number of elements as the vector dimension. - assert(scalars.size() == dimensions); -} - -size_t ZVector::GetRawDataSize() const -{ - size_t size = 0; - - for (size_t i = 0; i < this->scalars.size(); i++) - size += this->scalars[i].GetRawDataSize(); - - return size; -} - -bool ZVector::DoesSupportArray() const -{ - return true; -} - -std::string ZVector::GetSourceTypeName() const -{ - if (dimensions == 3 && scalarType == ZScalarType::ZSCALAR_F32) - return "Vec3f"; - else if (dimensions == 3 && scalarType == ZScalarType::ZSCALAR_S16) - return "Vec3s"; - else if (dimensions == 3 && scalarType == ZScalarType::ZSCALAR_S32) - return "Vec3i"; - else - { - std::string msgHeader = StringHelper::Sprintf( - "encountered unsupported vector type: %d dimensions, %s type", dimensions, - ZScalar::MapScalarTypeToOutputType(scalarType).c_str()); - - HANDLE_ERROR_RESOURCE(WarningType::NotImplemented, parent, this, rawDataIndex, msgHeader, - ""); - } -} - -std::string ZVector::GetBodySourceCode() const -{ - std::string body = ""; - - for (size_t i = 0; i < scalars.size(); i++) - { - body += StringHelper::Sprintf("%6s", scalars[i].GetBodySourceCode().c_str()); - - if (i + 1 < scalars.size()) - body += ", "; - } - - return body; -} - -ZResourceType ZVector::GetResourceType() const -{ - return ZResourceType::Vector; -} - -DeclarationAlignment ZVector::GetDeclarationAlignment() const -{ - if (scalars.size() == 0) - { - return DeclarationAlignment::Align4; - } - return scalars.at(0).GetDeclarationAlignment(); -} diff --git a/tools/ZAPD/ZAPD/ZVector.h b/tools/ZAPD/ZAPD/ZVector.h deleted file mode 100644 index a50d3e8083..0000000000 --- a/tools/ZAPD/ZAPD/ZVector.h +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -#include -#include -#include -#include "ZResource.h" -#include "ZScalar.h" -#include "tinyxml2.h" - -class ZVector : public ZResource -{ -public: - std::vector scalars; - ZScalarType scalarType; - uint32_t dimensions; - - ZVector(ZFile* nParent); - - void ExtractFromBinary(uint32_t nRawDataIndex, ZScalarType nScalarType, uint32_t nDimensions); - - void ParseXML(tinyxml2::XMLElement* reader) override; - void ParseRawData() override; - - std::string GetBodySourceCode() const override; - - bool DoesSupportArray() const override; - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - size_t GetRawDataSize() const override; - DeclarationAlignment GetDeclarationAlignment() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZVtx.cpp b/tools/ZAPD/ZAPD/ZVtx.cpp deleted file mode 100644 index e4b3d97968..0000000000 --- a/tools/ZAPD/ZAPD/ZVtx.cpp +++ /dev/null @@ -1,86 +0,0 @@ -#include "ZVtx.h" - -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" -#include "ZFile.h" - -REGISTER_ZFILENODE(Vtx, ZVtx); - -ZVtx::ZVtx(ZFile* nParent) : ZResource(nParent) -{ - x = 0; - y = 0; - z = 0; - flag = 0; - s = 0; - t = 0; - r = 0; - g = 0; - b = 0; - a = 0; -} - -void ZVtx::ParseRawData() -{ - ZResource::ParseRawData(); - - const auto& rawData = parent->GetRawData(); - x = BitConverter::ToInt16BE(rawData, rawDataIndex + 0); - y = BitConverter::ToInt16BE(rawData, rawDataIndex + 2); - z = BitConverter::ToInt16BE(rawData, rawDataIndex + 4); - flag = BitConverter::ToInt16BE(rawData, rawDataIndex + 6); - s = BitConverter::ToInt16BE(rawData, rawDataIndex + 8); - t = BitConverter::ToInt16BE(rawData, rawDataIndex + 10); - r = rawData[rawDataIndex + 12]; - g = rawData[rawDataIndex + 13]; - b = rawData[rawDataIndex + 14]; - a = rawData[rawDataIndex + 15]; -} - -Declaration* ZVtx::DeclareVar(const std::string& prefix, const std::string& bodyStr) -{ - Declaration* decl = ZResource::DeclareVar(prefix, bodyStr); - decl->isExternal = true; - return decl; -} - -std::string ZVtx::GetBodySourceCode() const -{ - return StringHelper::Sprintf("VTX(%i, %i, %i, %i, %i, %i, %i, %i, %i)", x, y, z, s, t, r, g, b, - a); -} - -size_t ZVtx::GetRawDataSize() const -{ - return 16; -} - -bool ZVtx::DoesSupportArray() const -{ - return true; -} - -ZResourceType ZVtx::GetResourceType() const -{ - return ZResourceType::Vertex; -} - -bool ZVtx::IsExternalResource() const -{ - return true; -} - -std::string ZVtx::GetSourceTypeName() const -{ - return "Vtx"; -} - -std::string ZVtx::GetExternalExtension() const -{ - return "vtx"; -} - -DeclarationAlignment ZVtx::GetDeclarationAlignment() const -{ - return DeclarationAlignment::Align8; -} diff --git a/tools/ZAPD/ZAPD/ZVtx.h b/tools/ZAPD/ZAPD/ZVtx.h deleted file mode 100644 index 511048791d..0000000000 --- a/tools/ZAPD/ZAPD/ZVtx.h +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once - -#include -#include -#include -#include "ZResource.h" -#include "ZScalar.h" -#include "tinyxml2.h" - -class ZVtx : public ZResource -{ -public: - int16_t x, y, z; - uint16_t flag; - int16_t s, t; - uint8_t r, g, b, a; - - ZVtx(ZFile* nParent); - - void ParseRawData() override; - - Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override; - std::string GetBodySourceCode() const override; - - bool IsExternalResource() const override; - bool DoesSupportArray() const override; - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - std::string GetExternalExtension() const override; - - size_t GetRawDataSize() const override; - DeclarationAlignment GetDeclarationAlignment() const override; -}; diff --git a/tools/ZAPD/ZAPD/ZWaterbox.cpp b/tools/ZAPD/ZAPD/ZWaterbox.cpp deleted file mode 100644 index 9a289db523..0000000000 --- a/tools/ZAPD/ZAPD/ZWaterbox.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include "ZWaterbox.h" - -#include "Globals.h" -#include "Utils/BitConverter.h" -#include "Utils/StringHelper.h" - -REGISTER_ZFILENODE(Waterbox, ZWaterbox); - -ZWaterbox::ZWaterbox(ZFile* nParent) : ZResource(nParent) -{ -} - -ZWaterbox::~ZWaterbox() -{ -} - -void ZWaterbox::ParseRawData() -{ - const auto& rawData = parent->GetRawData(); - - xMin = BitConverter::ToInt16BE(rawData, rawDataIndex + 0); - ySurface = BitConverter::ToInt16BE(rawData, rawDataIndex + 2); - zMin = BitConverter::ToInt16BE(rawData, rawDataIndex + 4); - xLength = BitConverter::ToInt16BE(rawData, rawDataIndex + 6); - zLength = BitConverter::ToInt16BE(rawData, rawDataIndex + 8); - - if (Globals::Instance->game == ZGame::OOT_SW97) - properties = BitConverter::ToInt16BE(rawData, rawDataIndex + 10); - else - properties = BitConverter::ToInt32BE(rawData, rawDataIndex + 12); -} - -void ZWaterbox::DeclareReferences(const std::string& prefix) -{ - std::string declaration; - std::string auxName = name; - - if (name == "") - auxName = GetDefaultName(prefix); - - parent->AddDeclaration(rawDataIndex, DeclarationAlignment::Align4, GetRawDataSize(), - GetSourceTypeName(), name.c_str(), GetBodySourceCode()); -} - -std::string ZWaterbox::GetBodySourceCode() const -{ - return StringHelper::Sprintf("%i, %i, %i, %i, %i, 0x%08X", xMin, ySurface, zMin, xLength, - zLength, properties); -} - -std::string ZWaterbox::GetDefaultName(const std::string& prefix) const -{ - return StringHelper::Sprintf("%sWaterBoxes_%06X", prefix.c_str(), rawDataIndex); -} - -ZResourceType ZWaterbox::GetResourceType() const -{ - return ZResourceType::Waterbox; -} - -size_t ZWaterbox::GetRawDataSize() const -{ - return 16; -} - -std::string ZWaterbox::GetSourceTypeName() const -{ - return "WaterBox"; -} - -bool ZWaterbox::DoesSupportArray() const -{ - return true; -} diff --git a/tools/ZAPD/ZAPD/ZWaterbox.h b/tools/ZAPD/ZAPD/ZWaterbox.h deleted file mode 100644 index e190b26a08..0000000000 --- a/tools/ZAPD/ZAPD/ZWaterbox.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once - -#include "ZFile.h" -#include "ZResource.h" - -class ZWaterbox : public ZResource -{ -public: - int16_t xMin; - int16_t ySurface; - int16_t zMin; - int16_t xLength; - int16_t zLength; - int32_t properties; - - ZWaterbox(ZFile* nParent); - ~ZWaterbox(); - - void ParseRawData() override; - void DeclareReferences(const std::string& prefix) override; - std::string GetBodySourceCode() const override; - std::string GetDefaultName(const std::string& prefix) const override; - - std::string GetSourceTypeName() const override; - ZResourceType GetResourceType() const override; - - bool DoesSupportArray() const override; - - size_t GetRawDataSize() const override; -}; diff --git a/tools/ZAPD/ZAPD/any/any/zlib.static.txt b/tools/ZAPD/ZAPD/any/any/zlib.static.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tools/ZAPD/ZAPD/genbuildinfo.py b/tools/ZAPD/ZAPD/genbuildinfo.py deleted file mode 100644 index 3317c42762..0000000000 --- a/tools/ZAPD/ZAPD/genbuildinfo.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/python3 - -import argparse -from datetime import datetime -import getpass -import subprocess - -parser = argparse.ArgumentParser() -parser.add_argument("--devel", action="store_true") -args = parser.parse_args() - -with open("build/ZAPD/BuildInfo.cpp", "w+") as buildFile: - # Get commit hash from git - # If git fails due to a missing .git directory, a default label will be used instead. - try: - label = subprocess.check_output(["git", "describe", "--always"]).strip().decode("utf-8") - except: - label = "GIT_NOT_FOUND" - - now = datetime.now() - if args.devel: - label += " ~ Development version" - buildFile.write("extern const char gBuildHash[] = \"" + label + "\";\n") - #buildFile.write("extern const char gBuildDate[] = \"" + now.strftime("%Y-%m-%d %H:%M:%S") + "\";\n") diff --git a/tools/ZAPD/ZAPD/packages.config b/tools/ZAPD/ZAPD/packages.config deleted file mode 100644 index c387aaed70..0000000000 --- a/tools/ZAPD/ZAPD/packages.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/tools/ZAPD/ZAPDUtils/Color3b.h b/tools/ZAPD/ZAPDUtils/Color3b.h deleted file mode 100644 index 507c099f52..0000000000 --- a/tools/ZAPD/ZAPDUtils/Color3b.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include - -struct Color3b -{ - uint8_t r, g, b; - - Color3b() - { - r = 0; - g = 0; - b = 0; - }; - Color3b(uint8_t nR, uint8_t nG, uint8_t nB) - { - r = nR; - g = nG; - b = nB; - }; -}; \ No newline at end of file diff --git a/tools/ZAPD/ZAPDUtils/Makefile b/tools/ZAPD/ZAPDUtils/Makefile deleted file mode 100644 index c0f818bdff..0000000000 --- a/tools/ZAPD/ZAPDUtils/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -# Only used for standalone compilation, usually inherits these from the main makefile -CXXFLAGS ?= -Wall -Wextra -O2 -g -std=c++17 - -SRC_DIRS := $(shell find . -type d -not -path "*build*") -CPP_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.cpp)) -H_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.h)) - -O_FILES := $(foreach f,$(CPP_FILES:.cpp=.o),build/$f) -LIB := ZAPDUtils.a - -# create build directories -$(shell mkdir -p $(foreach dir,$(SRC_DIRS),build/$(dir))) - -all: $(LIB) - -clean: - rm -rf build $(LIB) - -format: - clang-format-14 -i $(CPP_FILES) $(H_FILES) - -.PHONY: all clean format - -build/%.o: %.cpp - $(CXX) $(CXXFLAGS) $(OPTFLAGS) -c $(OUTPUT_OPTION) $< - -$(LIB): $(O_FILES) - $(AR) rcs $@ $^ diff --git a/tools/ZAPD/ZAPDUtils/StrHash.h b/tools/ZAPD/ZAPDUtils/StrHash.h deleted file mode 100644 index c611bdddad..0000000000 --- a/tools/ZAPD/ZAPDUtils/StrHash.h +++ /dev/null @@ -1,51 +0,0 @@ -#pragma once - -#include -#include -#include - -typedef uint32_t strhash; - -[[maybe_unused]] static strhash CRC32B(unsigned char* message, int32_t size) -{ - int32_t byte = 0, crc = 0; - int32_t mask = 0; - - crc = 0xFFFFFFFF; - - for (int32_t i = 0; i < size; i++) - { - byte = message[i]; - crc = crc ^ byte; - - for (int32_t j = 7; j >= 0; j--) - { - mask = -(crc & 1); - crc = (crc >> 1) ^ (0xEDB88320 & mask); - } - } - - return ~(uint32_t)(crc); -} - -[[maybe_unused]] constexpr static strhash CRC32BCT(const char* message, int32_t size) -{ - int32_t byte = 0, crc = 0; - int32_t mask = 0; - - crc = 0xFFFFFFFF; - - for (int32_t i = 0; i < size; i++) - { - byte = message[i]; - crc = crc ^ byte; - - for (int32_t j = 7; j >= 0; j--) - { - mask = -(crc & 1); - crc = (crc >> 1) ^ (0xEDB88320 & mask); - } - } - - return ~(uint32_t)(crc); -} \ No newline at end of file diff --git a/tools/ZAPD/ZAPDUtils/Utils/BinaryReader.cpp b/tools/ZAPD/ZAPDUtils/Utils/BinaryReader.cpp deleted file mode 100644 index 35412781cc..0000000000 --- a/tools/ZAPD/ZAPDUtils/Utils/BinaryReader.cpp +++ /dev/null @@ -1,148 +0,0 @@ -#include "BinaryReader.h" -#include -#include -#include "Stream.h" - -BinaryReader::BinaryReader(Stream* nStream) -{ - stream.reset(nStream); -} - -void BinaryReader::Close() -{ - stream->Close(); -} - -void BinaryReader::Seek(uint32_t offset, SeekOffsetType seekType) -{ - stream->Seek(offset, seekType); -} - -uint32_t BinaryReader::GetBaseAddress() -{ - return stream->GetBaseAddress(); -} - -void BinaryReader::Read([[maybe_unused]] char* buffer, int32_t length) -{ - stream->Read(length); -} - -char BinaryReader::ReadChar() -{ - return (char)stream->ReadByte(); -} - -int8_t BinaryReader::ReadByte() -{ - return stream->ReadByte(); -} - -uint8_t BinaryReader::ReadUByte() -{ - return (uint8_t)stream->ReadByte(); -} - -int16_t BinaryReader::ReadInt16() -{ - int16_t result = 0; - - stream->Read((char*)&result, sizeof(int16_t)); - return result; -} - -int32_t BinaryReader::ReadInt32() -{ - int32_t result = 0; - - stream->Read((char*)&result, sizeof(int32_t)); - return result; -} - -uint16_t BinaryReader::ReadUInt16() -{ - uint16_t result = 0; - - stream->Read((char*)&result, sizeof(uint16_t)); - return result; -} - -uint32_t BinaryReader::ReadUInt32() -{ - uint32_t result = 0; - - stream->Read((char*)&result, sizeof(uint32_t)); - return result; -} - -uint64_t BinaryReader::ReadUInt64() -{ - uint64_t result = 0; - - stream->Read((char*)&result, sizeof(uint64_t)); - return result; -} - -float BinaryReader::ReadSingle() -{ - float result = NAN; - - stream->Read((char*)&result, sizeof(float)); - - if (std::isnan(result)) - throw std::runtime_error("BinaryReader::ReadSingle(): Error reading stream"); - - return result; -} - -double BinaryReader::ReadDouble() -{ - double result = NAN; - - stream->Read((char*)&result, sizeof(double)); - if (std::isnan(result)) - throw std::runtime_error("BinaryReader::ReadDouble(): Error reading stream"); - - return result; -} - -Vec3f BinaryReader::ReadVec3f() -{ - return Vec3f(); -} - -Vec3s BinaryReader::ReadVec3s() -{ - return Vec3s(0, 0, 0); -} - -Vec3s BinaryReader::ReadVec3b() -{ - return Vec3s(0, 0, 0); -} - -Vec2f BinaryReader::ReadVec2f() -{ - return Vec2f(); -} - -Color3b BinaryReader::ReadColor3b() -{ - return Color3b(); -} - -std::string BinaryReader::ReadString() -{ - std::string res; - char c; - - do - { - c = ReadChar(); - - if (c != 0) - res += c; - } while (c != 0); - - return res; -} \ No newline at end of file diff --git a/tools/ZAPD/ZAPDUtils/Utils/BinaryReader.h b/tools/ZAPD/ZAPDUtils/Utils/BinaryReader.h deleted file mode 100644 index cf0eeb42c9..0000000000 --- a/tools/ZAPD/ZAPDUtils/Utils/BinaryReader.h +++ /dev/null @@ -1,43 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include "../Color3b.h" -#include "../Vec2f.h" -#include "../Vec3f.h" -#include "../Vec3s.h" -#include "Stream.h" - -class BinaryReader -{ -public: - BinaryReader(Stream* nStream); - - void Close(); - - void Seek(uint32_t offset, SeekOffsetType seekType); - uint32_t GetBaseAddress(); - - void Read(char* buffer, int32_t length); - char ReadChar(); - int8_t ReadByte(); - int16_t ReadInt16(); - int32_t ReadInt32(); - uint8_t ReadUByte(); - uint16_t ReadUInt16(); - uint32_t ReadUInt32(); - uint64_t ReadUInt64(); - float ReadSingle(); - double ReadDouble(); - Vec3f ReadVec3f(); - Vec3s ReadVec3s(); - Vec3s ReadVec3b(); - Vec2f ReadVec2f(); - Color3b ReadColor3b(); - std::string ReadString(); - -protected: - std::shared_ptr stream; -}; \ No newline at end of file diff --git a/tools/ZAPD/ZAPDUtils/Utils/BinaryWriter.cpp b/tools/ZAPD/ZAPDUtils/Utils/BinaryWriter.cpp deleted file mode 100644 index 87bc0ac684..0000000000 --- a/tools/ZAPD/ZAPDUtils/Utils/BinaryWriter.cpp +++ /dev/null @@ -1,95 +0,0 @@ -#include "BinaryWriter.h" - -BinaryWriter::BinaryWriter(Stream* nStream) -{ - stream.reset(nStream); -} - -BinaryWriter::BinaryWriter(std::shared_ptr nStream) -{ - stream = nStream; -} - -void BinaryWriter::Close() -{ - stream->Close(); -} - -std::shared_ptr BinaryWriter::GetStream() -{ - return stream; -} - -uint64_t BinaryWriter::GetBaseAddress() -{ - return stream->GetBaseAddress(); -} - -uint64_t BinaryWriter::GetLength() -{ - return stream->GetLength(); -} - -void BinaryWriter::Seek(int32_t offset, SeekOffsetType seekType) -{ - stream->Seek(offset, seekType); -} - -void BinaryWriter::Write(int8_t value) -{ - stream->Write((char*)&value, sizeof(int8_t)); -} - -void BinaryWriter::Write(uint8_t value) -{ - stream->Write((char*)&value, sizeof(uint8_t)); -} - -void BinaryWriter::Write(int16_t value) -{ - stream->Write((char*)&value, sizeof(int16_t)); -} - -void BinaryWriter::Write(uint16_t value) -{ - stream->Write((char*)&value, sizeof(uint16_t)); -} - -void BinaryWriter::Write(int32_t value) -{ - stream->Write((char*)&value, sizeof(int32_t)); -} - -void BinaryWriter::Write(uint32_t value) -{ - stream->Write((char*)&value, sizeof(uint32_t)); -} - -void BinaryWriter::Write(int64_t value) -{ - stream->Write((char*)&value, sizeof(int64_t)); -} - -void BinaryWriter::Write(uint64_t value) -{ - stream->Write((char*)&value, sizeof(uint64_t)); -} - -void BinaryWriter::Write(float value) -{ - stream->Write((char*)&value, sizeof(float)); -} - -void BinaryWriter::Write(double value) -{ - stream->Write((char*)&value, sizeof(double)); -} - -void BinaryWriter::Write(const std::string& str) -{ - int strLen = str.size(); - stream->Write((char*)&strLen, sizeof(int)); - - for (char c : str) - stream->WriteByte(c); -} diff --git a/tools/ZAPD/ZAPDUtils/Utils/BinaryWriter.h b/tools/ZAPD/ZAPDUtils/Utils/BinaryWriter.h deleted file mode 100644 index e224d182e3..0000000000 --- a/tools/ZAPD/ZAPDUtils/Utils/BinaryWriter.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include "Stream.h" - -class BinaryWriter -{ -public: - BinaryWriter(Stream* nStream); - BinaryWriter(std::shared_ptr nStream); - - std::shared_ptr GetStream(); - uint64_t GetBaseAddress(); - uint64_t GetLength(); - void Seek(int32_t offset, SeekOffsetType seekType); - void Close(); - - void Write(int8_t value); - void Write(uint8_t value); - void Write(int16_t value); - void Write(uint16_t value); - void Write(int32_t value); - void Write(uint32_t value); - void Write(int64_t value); - void Write(uint64_t value); - void Write(float value); - void Write(double value); - void Write(const std::string& str); - -protected: - std::shared_ptr stream; -}; \ No newline at end of file diff --git a/tools/ZAPD/ZAPDUtils/Utils/BitConverter.h b/tools/ZAPD/ZAPDUtils/Utils/BitConverter.h deleted file mode 100644 index aa41b5b217..0000000000 --- a/tools/ZAPD/ZAPDUtils/Utils/BitConverter.h +++ /dev/null @@ -1,166 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - -#define ALIGN8(val) (((val) + 7) & ~7) -#define ALIGN16(val) (((val) + 0xF) & ~0xF) -#define ALIGN64(val) (((val) + 0x3F) & ~0x3F) - -#ifdef _MSC_VER -#define __PRETTY_FUNCTION__ __FUNCSIG__ -#endif - -class BitConverter -{ -public: - static inline int8_t ToInt8BE(const std::vector& data, size_t offset) - { - if (offset + 0 > data.size()) - { - fprintf(stderr, "%s\n", __PRETTY_FUNCTION__); - fprintf(stderr, "Error: Trying a out-of-bounds reading from a data buffer\n"); - fprintf(stderr, "\t Buffer size: 0x%zX\n", data.size()); - fprintf(stderr, "\t Trying to read at offset: 0x%zX\n", offset); - } - return (int8_t)data.at(offset + 0); - } - - static inline uint8_t ToUInt8BE(const std::vector& data, size_t offset) - { - if (offset + 0 > data.size()) - { - fprintf(stderr, "%s\n", __PRETTY_FUNCTION__); - fprintf(stderr, "Error: Trying an out-of-bounds reading from a data buffer\n"); - fprintf(stderr, "\t Buffer size: 0x%zX\n", data.size()); - fprintf(stderr, "\t Trying to read at offset: 0x%zX\n", offset); - } - return (uint8_t)data.at(offset + 0); - } - - static inline int16_t ToInt16BE(const std::vector& data, size_t offset) - { - if (offset + 1 > data.size()) - { - fprintf(stderr, "%s\n", __PRETTY_FUNCTION__); - fprintf(stderr, "Error: Trying a out-of-bounds reading from a data buffer\n"); - fprintf(stderr, "\t Buffer size: 0x%zX\n", data.size()); - fprintf(stderr, "\t Trying to read at offset: 0x%zX\n", offset); - } - return ((uint16_t)data.at(offset + 0) << 8) + (uint16_t)data.at(offset + 1); - } - - static inline uint16_t ToUInt16BE(const std::vector& data, size_t offset) - { - if (offset + 1 > data.size()) - { - fprintf(stderr, "%s\n", __PRETTY_FUNCTION__); - fprintf(stderr, "Error: Trying a out-of-bounds reading from a data buffer\n"); - fprintf(stderr, "\t Buffer size: 0x%zX\n", data.size()); - fprintf(stderr, "\t Trying to read at offset: 0x%zX\n", offset); - } - return ((uint16_t)data.at(offset + 0) << 8) + (uint16_t)data.at(offset + 1); - } - - static inline int32_t ToInt32BE(const std::vector& data, size_t offset) - { - if (offset + 3 > data.size()) - { - fprintf(stderr, "%s\n", __PRETTY_FUNCTION__); - fprintf(stderr, "Error: Trying a out-of-bounds reading from a data buffer\n"); - fprintf(stderr, "\t Buffer size: 0x%zX\n", data.size()); - fprintf(stderr, "\t Trying to read at offset: 0x%zX\n", offset); - } - return ((uint32_t)data.at(offset + 0) << 24) + ((uint32_t)data.at(offset + 1) << 16) + - ((uint32_t)data.at(offset + 2) << 8) + (uint32_t)data.at(offset + 3); - } - - static inline uint32_t ToUInt32BE(const std::vector& data, size_t offset) - { - if (offset + 3 > data.size()) - { - fprintf(stderr, "%s\n", __PRETTY_FUNCTION__); - fprintf(stderr, "Error: Trying a out-of-bounds reading from a data buffer\n"); - fprintf(stderr, "\t Buffer size: 0x%zX\n", data.size()); - fprintf(stderr, "\t Trying to read at offset: 0x%zX\n", offset); - } - return ((uint32_t)data.at(offset + 0) << 24) + ((uint32_t)data.at(offset + 1) << 16) + - ((uint32_t)data.at(offset + 2) << 8) + (uint32_t)data.at(offset + 3); - } - - static inline int64_t ToInt64BE(const std::vector& data, size_t offset) - { - if (offset + 7 > data.size()) - { - fprintf(stderr, "%s\n", __PRETTY_FUNCTION__); - fprintf(stderr, "Error: Trying a out-of-bounds reading from a data buffer\n"); - fprintf(stderr, "\t Buffer size: 0x%zX\n", data.size()); - fprintf(stderr, "\t Trying to read at offset: 0x%zX\n", offset); - } - return ((uint64_t)data.at(offset + 0) << 56) + ((uint64_t)data.at(offset + 1) << 48) + - ((uint64_t)data.at(offset + 2) << 40) + ((uint64_t)data.at(offset + 3) << 32) + - ((uint64_t)data.at(offset + 4) << 24) + ((uint64_t)data.at(offset + 5) << 16) + - ((uint64_t)data.at(offset + 6) << 8) + ((uint64_t)data.at(offset + 7)); - } - - static inline uint64_t ToUInt64BE(const std::vector& data, size_t offset) - { - if (offset + 7 > data.size()) - { - fprintf(stderr, "%s\n", __PRETTY_FUNCTION__); - fprintf(stderr, "Error: Trying a out-of-bounds reading from a data buffer\n"); - fprintf(stderr, "\t Buffer size: 0x%zX\n", data.size()); - fprintf(stderr, "\t Trying to read at offset: 0x%zX\n", offset); - } - return ((uint64_t)data.at(offset + 0) << 56) + ((uint64_t)data.at(offset + 1) << 48) + - ((uint64_t)data.at(offset + 2) << 40) + ((uint64_t)data.at(offset + 3) << 32) + - ((uint64_t)data.at(offset + 4) << 24) + ((uint64_t)data.at(offset + 5) << 16) + - ((uint64_t)data.at(offset + 6) << 8) + ((uint64_t)data.at(offset + 7)); - } - - static inline float ToFloatBE(const std::vector& data, size_t offset) - { - if (offset + 3 > data.size()) - { - fprintf(stderr, "%s\n", __PRETTY_FUNCTION__); - fprintf(stderr, "Error: Trying a out-of-bounds reading from a data buffer\n"); - fprintf(stderr, "\t Buffer size: 0x%zX\n", data.size()); - fprintf(stderr, "\t Trying to read at offset: 0x%zX\n", offset); - } - float value; - uint32_t floatData = ((uint32_t)data.at(offset + 0) << 24) + - ((uint32_t)data.at(offset + 1) << 16) + - ((uint32_t)data.at(offset + 2) << 8) + (uint32_t)data.at(offset + 3); - static_assert(sizeof(uint32_t) == sizeof(float), "expected 32-bit float"); - std::memcpy(&value, &floatData, sizeof(value)); - return value; - } - - static inline double ToDoubleBE(const std::vector& data, size_t offset) - { - if (offset + 7 > data.size()) - { - fprintf(stderr, "%s\n", __PRETTY_FUNCTION__); - fprintf(stderr, "Error: Trying a out-of-bounds reading from a data buffer\n"); - fprintf(stderr, "\t Buffer size: 0x%zX\n", data.size()); - fprintf(stderr, "\t Trying to read at offset: 0x%zX\n", offset); - } - double value; - uint64_t floatData = - ((uint64_t)data.at(offset + 0) << 56) + ((uint64_t)data.at(offset + 1) << 48) + - ((uint64_t)data.at(offset + 2) << 40) + ((uint64_t)data.at(offset + 3) << 32) + - ((uint64_t)data.at(offset + 4) << 24) + ((uint64_t)data.at(offset + 5) << 16) + - ((uint64_t)data.at(offset + 6) << 8) + ((uint64_t)data.at(offset + 7)); - static_assert(sizeof(uint64_t) == sizeof(double), "expected 64-bit double"); - // Checks if the float format on the platform the ZAPD binary is running on supports the - // same float format as the object file. - static_assert(std::numeric_limits::is_iec559, - "expected IEC559 doubles on host machine"); - std::memcpy(&value, &floatData, sizeof(value)); - return value; - } -}; diff --git a/tools/ZAPD/ZAPDUtils/Utils/Directory.h b/tools/ZAPD/ZAPDUtils/Utils/Directory.h deleted file mode 100644 index d150f17727..0000000000 --- a/tools/ZAPD/ZAPDUtils/Utils/Directory.h +++ /dev/null @@ -1,55 +0,0 @@ -#pragma once - -#include -#include -#include - -#ifdef USE_BOOST_FS -#include -namespace fs = boost::filesystem; -#elif __has_include() -#include -namespace fs = std::filesystem; -#else -#include -namespace fs = std::experimental::filesystem; -#endif - -#include "StringHelper.h" - -class Directory -{ -public: -#ifdef USE_BOOST_FS - static std::string GetCurrentDirectory() - { - return fs::current_path().string(); - } -#else - static std::string GetCurrentDirectory() - { - return fs::current_path().u8string(); - } -#endif - - static bool Exists(const fs::path& path) - { - return fs::exists(path); - } - - static void CreateDirectory(const std::string& path) - { - std::string curPath; - std::vector split = StringHelper::Split(path, "/"); - - for (std::string s : split) - { - curPath += s + "/"; - - if (!Exists(curPath)) - fs::create_directory(curPath); - } - - // fs::create_directory(path); - } -}; diff --git a/tools/ZAPD/ZAPDUtils/Utils/File.h b/tools/ZAPD/ZAPDUtils/Utils/File.h deleted file mode 100644 index 707b1600fc..0000000000 --- a/tools/ZAPD/ZAPDUtils/Utils/File.h +++ /dev/null @@ -1,97 +0,0 @@ -#pragma once - -#ifdef USE_BOOST_FS -#include -#else -#include -#endif - -#include -#include -#include "Directory.h" -#include "Utils/StringHelper.h" - -class File -{ -#ifdef USE_BOOST_FS - typedef fs::ifstream ifstream; - typedef fs::ofstream ofstream; -#else - typedef std::ifstream ifstream; - typedef std::ofstream ofstream; -#endif - -public: - static bool Exists(const fs::path& filePath) - { - ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate); - return file.good(); - } - - static std::vector ReadAllBytes(const fs::path& filePath) - { - ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate); - int32_t fileSize = (int32_t)file.tellg(); - file.seekg(0); - char* data = new char[fileSize]; - file.read(data, fileSize); - std::vector result = std::vector(data, data + fileSize); - delete[] data; - file.close(); - - return result; - }; - - static std::string ReadAllText(const fs::path& filePath) - { - ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate); - if (!file.is_open()) - return ""; - int32_t fileSize = (int32_t)file.tellg(); - file.seekg(0); - char* data = new char[fileSize + 1]; - memset(data, 0, fileSize + 1); - file.read(data, fileSize); - std::string str = std::string((const char*)data); - delete[] data; - file.close(); - - return str; - }; - - static std::vector ReadAllLines(const fs::path& filePath) - { - std::string text = ReadAllText(filePath); - std::vector lines = StringHelper::Split(text, "\n"); - - return lines; - }; - - static void WriteAllBytes(const fs::path& filePath, const std::vector& data) - { - ofstream file(filePath, std::ios::binary); - file.write((char*)data.data(), data.size()); - file.close(); - }; - - static void WriteAllBytes(const std::string& filePath, const std::vector& data) - { - ofstream file(filePath, std::ios::binary); - file.write((char*)data.data(), data.size()); - file.close(); - }; - - static void WriteAllBytes(const std::string& filePath, const char* data, int dataSize) - { - ofstream file(filePath, std::ios::binary); - file.write((char*)data, dataSize); - file.close(); - }; - - static void WriteAllText(const fs::path& filePath, const std::string& text) - { - ofstream file(filePath, std::ios::out); - file.write(text.c_str(), text.size()); - file.close(); - } -}; diff --git a/tools/ZAPD/ZAPDUtils/Utils/MemoryStream.cpp b/tools/ZAPD/ZAPDUtils/Utils/MemoryStream.cpp deleted file mode 100644 index 6e85c59a04..0000000000 --- a/tools/ZAPD/ZAPDUtils/Utils/MemoryStream.cpp +++ /dev/null @@ -1,96 +0,0 @@ -#include "MemoryStream.h" -#include - -#ifndef _MSC_VER -#define memcpy_s(dest, destSize, source, sourceSize) memcpy(dest, source, destSize) -#endif - -MemoryStream::MemoryStream() -{ - buffer = std::vector(); - bufferSize = 0; - baseAddress = 0; -} - -MemoryStream::MemoryStream(char* nBuffer, size_t nBufferSize) : MemoryStream() -{ - buffer = std::vector(nBuffer, nBuffer + nBufferSize); - bufferSize = nBufferSize; - baseAddress = 0; -} - -MemoryStream::~MemoryStream() -{ -} - -uint64_t MemoryStream::GetLength() -{ - return buffer.size(); -} - -void MemoryStream::Seek(int32_t offset, SeekOffsetType seekType) -{ - if (seekType == SeekOffsetType::Start) - baseAddress = offset; - else if (seekType == SeekOffsetType::Current) - baseAddress += offset; - else if (seekType == SeekOffsetType::End) - baseAddress = bufferSize - 1 - offset; -} - -std::unique_ptr MemoryStream::Read(size_t length) -{ - std::unique_ptr result = std::make_unique(length); - - memcpy_s(result.get(), length, &buffer[baseAddress], length); - baseAddress += length; - - return result; -} - -void MemoryStream::Read(const char* dest, size_t length) -{ - memcpy_s((void*)dest, length, &buffer[baseAddress], length); - baseAddress += length; -} - -int8_t MemoryStream::ReadByte() -{ - return buffer[baseAddress++]; -} - -void MemoryStream::Write(char* srcBuffer, size_t length) -{ - if (baseAddress + length >= buffer.size()) - { - buffer.resize(baseAddress + length); - bufferSize += length; - } - - memcpy_s(&buffer[baseAddress], length, srcBuffer, length); - baseAddress += length; -} - -void MemoryStream::WriteByte(int8_t value) -{ - if (baseAddress >= buffer.size()) - { - buffer.resize(baseAddress + 1); - bufferSize = baseAddress; - } - - buffer[baseAddress++] = value; -} - -std::vector MemoryStream::ToVector() -{ - return buffer; -} - -void MemoryStream::Flush() -{ -} - -void MemoryStream::Close() -{ -} \ No newline at end of file diff --git a/tools/ZAPD/ZAPDUtils/Utils/MemoryStream.h b/tools/ZAPD/ZAPDUtils/Utils/MemoryStream.h deleted file mode 100644 index 5a17bb0c36..0000000000 --- a/tools/ZAPD/ZAPDUtils/Utils/MemoryStream.h +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once - -#include -#include -#include "Stream.h" - -class MemoryStream : public Stream -{ -public: - MemoryStream(); - MemoryStream(char* nBuffer, size_t nBufferSize); - ~MemoryStream(); - - uint64_t GetLength() override; - - void Seek(int32_t offset, SeekOffsetType seekType) override; - - std::unique_ptr Read(size_t length) override; - void Read(const char* dest, size_t length) override; - int8_t ReadByte() override; - - void Write(char* srcBuffer, size_t length) override; - void WriteByte(int8_t value) override; - - std::vector ToVector(); - - void Flush() override; - void Close() override; - -protected: - std::vector buffer; - std::size_t bufferSize; -}; \ No newline at end of file diff --git a/tools/ZAPD/ZAPDUtils/Utils/Path.h b/tools/ZAPD/ZAPDUtils/Utils/Path.h deleted file mode 100644 index 90f55380b4..0000000000 --- a/tools/ZAPD/ZAPDUtils/Utils/Path.h +++ /dev/null @@ -1,53 +0,0 @@ -#pragma once - -#include -#include -#include "Utils/StringHelper.h" - -#ifdef USE_BOOST_FS -#include -namespace fs = boost::filesystem; -#elif __has_include() -#include -namespace fs = std::filesystem; -#else -#include -namespace fs = std::experimental::filesystem; -#endif - -class Path -{ -public: - static std::string GetFileName(const fs::path& input) - { - // https://en.cppreference.com/w/cpp/filesystem/path/filename - return input.filename().string(); - }; - - static std::string GetFileNameWithoutExtension(const fs::path& input) - { - // https://en.cppreference.com/w/cpp/filesystem/path/stem - return input.stem().string(); - }; - - static std::string GetFileNameExtension(const std::string& input) - { - return input.substr(input.find_last_of("."), input.length()); - }; - - static fs::path GetPath(const std::string& input) - { - std::vector split = StringHelper::Split(input, "/"); - fs::path output; - - for (std::string str : split) - { - if (str.find_last_of(".") == std::string::npos) - output /= str; - } - - return output; - }; - - static fs::path GetDirectoryName(const fs::path& path) { return path.parent_path(); }; -}; diff --git a/tools/ZAPD/ZAPDUtils/Utils/Stream.h b/tools/ZAPD/ZAPDUtils/Utils/Stream.h deleted file mode 100644 index e73a9a70d0..0000000000 --- a/tools/ZAPD/ZAPDUtils/Utils/Stream.h +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - -#include -#include - -enum class SeekOffsetType -{ - Start, - Current, - End -}; - -// TODO: Eventually account for endianess in binaryreader and binarywriter -enum class Endianess -{ - Little = 0, - Big = 1, -}; - -class Stream -{ -public: - virtual ~Stream() = default; - virtual uint64_t GetLength() = 0; - uint64_t GetBaseAddress() { return baseAddress; } - - virtual void Seek(int32_t offset, SeekOffsetType seekType) = 0; - - virtual std::unique_ptr Read(size_t length) = 0; - virtual void Read(const char* dest, size_t length) = 0; - virtual int8_t ReadByte() = 0; - - virtual void Write(char* destBuffer, size_t length) = 0; - virtual void WriteByte(int8_t value) = 0; - - virtual void Flush() = 0; - virtual void Close() = 0; - -protected: - uint64_t baseAddress; -}; \ No newline at end of file diff --git a/tools/ZAPD/ZAPDUtils/Utils/StringHelper.h b/tools/ZAPD/ZAPDUtils/Utils/StringHelper.h deleted file mode 100644 index 942d0bcc9e..0000000000 --- a/tools/ZAPD/ZAPDUtils/Utils/StringHelper.h +++ /dev/null @@ -1,229 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - -class StringHelper -{ -public: - static std::vector Split(std::string s, const std::string& delimiter) - { - std::vector result; - - size_t pos = 0; - std::string token; - - while ((pos = s.find(delimiter)) != std::string::npos) - { - token = s.substr(0, pos); - result.push_back(token); - s.erase(0, pos + delimiter.length()); - } - - if (s.length() != 0) - result.push_back(s); - - return result; - } - - static std::string Join(const std::vector parts, const std::string& delimiter) - { - std::string result; - - for (size_t i = 0; i < parts.size(); i++) - { - result += parts[i]; - - if (i != parts.size() - 1) - result += delimiter; - } - - return result; - } - - static std::string Strip(std::string s, const std::string& delimiter) - { - size_t pos = 0; - std::string token; - - while ((pos = s.find(delimiter)) != std::string::npos) - { - token = s.substr(0, pos); - s.erase(pos, pos + delimiter.length()); - } - - return s; - } - - static std::string Replace(std::string str, const std::string& from, const std::string& to) - { - size_t start_pos = str.find(from); - - if (start_pos == std::string::npos) - return str; - - str.replace(start_pos, from.length(), to); - return str; - } - - static bool StartsWith(const std::string& s, const std::string& input) - { - return s.rfind(input, 0) == 0; - } - - static bool Contains(const std::string& s, const std::string& input) - { - return s.find(input) != std::string::npos; - } - - static bool EndsWith(const std::string& s, const std::string& input) - { - size_t inputLen = strlen(input.c_str()); - return s.rfind(input) == (s.size() - inputLen); - } - - static std::string Sprintf(const char* format, ...) - { - char buffer[32768]; - // char buffer[2048]; - std::string output; - va_list va; - - va_start(va, format); - vsprintf(buffer, format, va); - va_end(va); - - output = buffer; - return output; - } - - static std::string Implode(std::vector& elements, const char* const separator) - { - return std::accumulate(std::begin(elements), std::end(elements), std::string(), - [separator](std::string& ss, std::string& s) { - return ss.empty() ? s : ss + separator + s; - }); - } - - static int64_t StrToL(const std::string& str, int32_t base = 10) - { - return std::strtoull(str.c_str(), nullptr, base); - } - - static std::string BoolStr(bool b) { return b ? "true" : "false"; } - - static bool HasOnlyDigits(const std::string& str) - { - return std::all_of(str.begin(), str.end(), ::isdigit); - } - - static bool IsValidHex(std::string_view str) - { - if (str.length() < 3) - { - return false; - } - - if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X')) - { - return std::all_of(str.begin() + 2, str.end(), ::isxdigit); - } - - return false; - } - - static bool IsValidOffset(std::string_view str) - { - if (str.length() == 1) - { - // 0 is a valid offset - return isdigit(str[0]); - } - - return IsValidHex(str); - } - - static bool IsValidHex(const std::string& str) - { - return IsValidHex(std::string_view(str.c_str())); - } - - static std::string ToUpper(const std::string& str) - { - std::string buff = str; - std::transform(buff.begin(), buff.end(), buff.begin(), ::toupper); - return buff; - } - - static bool IEquals(const std::string& a, const std::string& b) - { - return std::equal(a.begin(), a.end(), b.begin(), b.end(), - [](char a, char b) { return tolower(a) == tolower(b); }); - } - - /** - * Converts a std::string formatted in camelCase into one in SCREAMING_SNAKE_CASE. Since this - * will mostly be used on symbols that start with either 'g' or 's', an option is included to - * skip these. - */ - static std::string camelCaseTo_SCREAMING_SNAKE_CASE(const std::string& in, bool skipSP) - { - std::string out = ""; - const char* ptr = in.c_str(); - char ch = *ptr; - - // Switch checks for 'g'/'s'/'\0', looks at next character if skipSP enabled and string is - // nonempty. - switch (ch) - { - case 'g': - case 's': - if (skipSP) - { - // Print it anyway if the next character is lowercase, e.g. "gameplay_keep_...". - if (!isupper(ptr[1])) - { - out.push_back(toupper(ch)); - } - if ((ch = *++ptr) == '\0') - { - case '\0': - // This is reached either by the if or the case label, avoiding duplication. - return out; - } - } - [[fallthrough]]; - default: - if (islower(ch)) - { - out.push_back(toupper(ch)); - } - else - { - out.push_back(ch); - } - break; - } - - while ((ch = *++ptr) != '\0') - { - if (islower(ch)) - { - out.push_back(toupper(ch)); - } - else - { - if (isupper(ch) && !(isupper(ptr[1]) && isupper(ptr[-1]))) - { - out.push_back('_'); - } - out.push_back(ch); - } - } - return out; - } -}; diff --git a/tools/ZAPD/ZAPDUtils/Utils/vt.h b/tools/ZAPD/ZAPDUtils/Utils/vt.h deleted file mode 100644 index 23f424442b..0000000000 --- a/tools/ZAPD/ZAPDUtils/Utils/vt.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef VT_H -#define VT_H - -// clang-format off -#define VT_COLOR_BLACK 0 -#define VT_COLOR_RED 1 -#define VT_COLOR_GREEN 2 -#define VT_COLOR_YELLOW 3 -#define VT_COLOR_BLUE 4 -#define VT_COLOR_PURPLE 5 -#define VT_COLOR_CYAN 6 -#define VT_COLOR_WHITE 7 -#define VT_COLOR_LIGHTGRAY 8 -#define VT_COLOR_DARKGRAY 9 - -#define VT_COLOR_FOREGROUND 3 -#define VT_COLOR_BACKGROUND 4 -// clang-format on - -#define VT_COLOR_EXPAND0(type, color) #type #color -#define VT_COLOR_EXPAND1(type, color) VT_COLOR_EXPAND0(type, color) -#define VT_COLOR(type, color) VT_COLOR_EXPAND1(VT_COLOR_##type, VT_COLOR_##color) - -#define VT_ESC "\x1b" -#define VT_CSI "[" -#define VT_CUP(x, y) VT_ESC VT_CSI y ";" x "H" -#define VT_ED(n) VT_ESC VT_CSI #n "J" -#define VT_SGR(n) VT_ESC VT_CSI n "m" - -// Add more macros if necessary -#define VT_COL(back, fore) VT_SGR(VT_COLOR(BACKGROUND, back) ";" VT_COLOR(FOREGROUND, fore)) -#define VT_FGCOL(color) VT_SGR(VT_COLOR(FOREGROUND, color)) -#define VT_BGCOL(color) VT_SGR(VT_COLOR(BACKGROUND, color)) - -// Bold -#define VT_BOLD "1" - -// Bold color support -#define VT_BOLD_FGCOL(color) VT_SGR(VT_BOLD ";" VT_COLOR(FOREGROUND, color)) -#define VT_BOLD_BGCOL(color) VT_SGR(VT_BOLD ";" VT_COLOR(BACKGROUND, color)) - -#define VT_RST VT_SGR("") -#define VT_CLS VT_ED(2) - -#endif diff --git a/tools/ZAPD/ZAPDUtils/Vec2f.h b/tools/ZAPD/ZAPDUtils/Vec2f.h deleted file mode 100644 index 73e9259a89..0000000000 --- a/tools/ZAPD/ZAPDUtils/Vec2f.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include - -struct Vec2f -{ - float x, y; - - Vec2f() - { - x = 0; - y = 0; - }; - Vec2f(float nX, float nY) - { - x = nX; - y = nY; - }; -}; \ No newline at end of file diff --git a/tools/ZAPD/ZAPDUtils/Vec3f.h b/tools/ZAPD/ZAPDUtils/Vec3f.h deleted file mode 100644 index d6e9c5568f..0000000000 --- a/tools/ZAPD/ZAPDUtils/Vec3f.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include - -struct Vec3f -{ - float x, y, z; - - Vec3f() - { - x = 0; - y = 0; - z = 0; - }; - Vec3f(float nX, float nY, float nZ) - { - x = nX; - y = nY; - z = nZ; - }; -}; \ No newline at end of file diff --git a/tools/ZAPD/ZAPDUtils/Vec3s.h b/tools/ZAPD/ZAPDUtils/Vec3s.h deleted file mode 100644 index 05816eddb5..0000000000 --- a/tools/ZAPD/ZAPDUtils/Vec3s.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include - -struct Vec3s -{ - int16_t x, y, z; - - Vec3s() - { - x = 0; - y = 0; - z = 0; - }; - Vec3s(int16_t nX, int16_t nY, int16_t nZ) - { - x = nX; - y = nY; - z = nZ; - }; -}; \ No newline at end of file diff --git a/tools/ZAPD/ZAPDUtils/ZAPDUtils.vcxproj b/tools/ZAPD/ZAPDUtils/ZAPDUtils.vcxproj deleted file mode 100644 index 2abbdc9664..0000000000 --- a/tools/ZAPD/ZAPDUtils/ZAPDUtils.vcxproj +++ /dev/null @@ -1,169 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 16.0 - Win32Proj - {a2e01c3e-d647-45d1-9788-043debc1a908} - ZAPDUtils - 10.0 - - - - Application - true - v142 - Unicode - - - Application - false - v143 - true - Unicode - - - StaticLibrary - true - v142 - MultiByte - - - Application - false - v143 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - - - false - - - true - - - false - - - - Level3 - true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - - - - - Level3 - true - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - Level3 - true - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - MultiThreadedDebug - Default - stdcpp17 - - - Console - true - - - - - Level3 - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tools/ZAPD/ZAPDUtils/ZAPDUtils.vcxproj.filters b/tools/ZAPD/ZAPDUtils/ZAPDUtils.vcxproj.filters deleted file mode 100644 index 4765ad5d45..0000000000 --- a/tools/ZAPD/ZAPDUtils/ZAPDUtils.vcxproj.filters +++ /dev/null @@ -1,84 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - {d8c2c1e7-b065-4b0f-86a2-46ab46eedc0b} - - - {e047919d-7186-49ca-b115-e48fbb5c8743} - - - {3de9dd46-0dfd-4d48-9f20-9f24e5b80fe0} - - - - - Header Files\Utils - - - Header Files\Utils - - - Header Files\Utils - - - Header Files\Utils - - - Header Files\Utils - - - Header Files\Utils - - - Header Files\Utils - - - Header Files\Utils - - - Header Files - - - Header Files\Utils - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files\Utils - - - Source Files\Utils - - - Source Files\Utils - - - Source Files\Libraries - - - \ No newline at end of file diff --git a/tools/ZAPD/copycheck.py b/tools/ZAPD/copycheck.py deleted file mode 100755 index 36288f6853..0000000000 --- a/tools/ZAPD/copycheck.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python3 - -import os -from shutil import copyfile - -if (os.environ.get('ZAPD_COPYDIR') != None): - print("Copying ZAPD.out to repo...") - #print(os.environ.get('ZAPD_COPYDIR')) - copyfile("ZAPD.out", os.environ.get('ZAPD_COPYDIR') + "/ZAPD.out") diff --git a/tools/ZAPD/docs/zapd_extraction_xml_reference.md b/tools/ZAPD/docs/zapd_extraction_xml_reference.md deleted file mode 100644 index edbdf857f1..0000000000 --- a/tools/ZAPD/docs/zapd_extraction_xml_reference.md +++ /dev/null @@ -1,680 +0,0 @@ -# ZAPD extraction XML reference - -This document aims to be a small reference of how to create a compatible xml file for ZAPD. - -## Table of contents - -- [ZAPD extraction XML reference](#zapd-extraction-xml-reference) - - [Table of contents](#table-of-contents) - - [Basic XML](#basic-xml) - - [Resources types](#resources-types) - - [File](#file) - - [ExternalFile](#externalfile) - - [Texture](#texture) - - [Background](#background) - - [Blob](#blob) - - [DList](#dlist) - - [TextureAnimation](#textureanimation) - - [Scene and Room](#scene-and-room) - - [AltHeader](#altheader) - - [Animation](#animation) - - [PlayerAnimation](#playeranimation) - - [CurveAnimation](#curveanimation) - - [LegacyAnimation](#legacyanimation) - - [Skeleton](#skeleton) - - [LimbTable](#limbtable) - - [Limb](#limb) - - [Symbol](#symbol) - - [Collision](#collision) - - [Scalar](#scalar) - - [Vector](#vector) - - [Vtx](#vtx) - - [Mtx](#mtx) - - [Cutscene](#cutscene) - - [Array](#array) - - [Path](#path) - - [PlayerAnimationData](#playeranimationdata) - - [Pointer](#pointer) - -## Basic XML - -An example of an object xml: - -```xml - - - - - - - - - - - - - - - - - - - -``` - -Every xml must have a `` tag. It must have at least one `` child. - -## Resources types - -The following is a list of the resources/tags supported by ZAPD, and the attributes needed by each one. - -For most resources inside a `` tag **you should also set an `Offset` attribute**. This is the offset (within the file) of the resource you are exporting. The `Offset` attribute is expected to be in hexadecimal, for example `Offset="0x41F0"`. - -It's worth noting that every tag expects a `Name="gNameOfTheAsset"`. This is will be the name of the extracted variable in the output C code. Every asset must be prefixed with `g` and the suffix should represent the type of the variable. - -Every tag can accept a `Static` attribute to specify if the asset should be marked as `static` or not. -There are 3 valid values (defaults to `Global`): - -- `Global`: Mark static if the flag `--static` was used. -- `On`: Override the global config and **always mark** as `static`. -- `Off`: Override the global config and **don't mark** as `static`. - -This table summarizes if the asset will be marked `static` (✅) or not (❌) -| `Static=""` attribute in XML | Without `--static` flag | With `--static` flag | -| ---------------------------- | ----------------------- | -------------------- | -| `On` | ✅ | ✅ | -| `Global` (default) | ❌ | ✅ | -| `Off` | ❌ | ❌ | - -------------------------- - -### File - -- Example of this tag: - -```xml - -``` - -- Attributes: - - - `Name`: Required. The name of the file in `baserom/` which will be extracted. - - `OutName`: Optional. The output name of the generated C source file. Defaults to the value passed to `Name`. - - `Segment`: Optional. This is the segment number of the current file. Expects a decimal number between 0 and 15 inclusive, usually 6 if it is an object. If not specified, the file will use VRAM instead of segmented addresses. - - `BaseAddress`: Optional. RAM address of the file. Expects a hex number (with `0x` prefix). Default value: `0`. - - `RangeStart`: Optional. File offset where the extraction will begin. Hex. Default value: `0x000000000`. - - `RangeEnd`: Optional. File offset where the extraction will end. Hex. Default value: `0xFFFFFFFF`. - - `Game`: Optional. Valid values: `OOT`, `MM`, `SW97` and `OOTSW97`. Default value: `OOT`. - -------------------------- - -### ExternalFile - -Allows ZAPD to map segmented addresses to variables declared in other files by using its XML. - -It is useful for objects that use variables from `gameplay_keep`, `gameplay_dangeon_keep`, `gameplay_field_keep`, etc. - -This tag can be used in the global `config.xml` file. - -- Example of this tag: - -```xml - -``` - -- Attributes: - - - `XmlPath`: Required. The path of the XML, relative to the value set by `ExternalXMLFolder` in the configuration file. - - `OutPath`: Required. The path were the header for the corresponding external file is. It is used to `#include` it in the generated `.c` file. - -------------------------- - -### Texture - -Textures are extracted as `.png` files. - -- Example: - -```xml - -``` - -Will be defined as: - -```c -u64 gCraterSmokeConeTex[] = { -#include "assets/objects/object_spot17_obj/crater_smoke_cone.ia8.inc.c" -}; -``` - -- Attributes: - - - `Name`: Required. Suffixed by `Tex`, unless it is a palette, in that case it is suffixed by `TLUT`. - - `OutName`: Required. The filename of the extracted `.png` file. - - `Format`: Required. The format of the image. Valid values: `rgba32`, `rgba16`, `i4`, `i8`, `ia4`, `ia8`, `ia16`, `ci4` and `ci8`. - - `Width`: Required. Width in pixels of the image. - - `Height`: Required. Height in pixels of the image. - - `TlutOffset`: Optional. Specifies the tlut's offset used by this texture. This attribute is only valid if `Format` is either `ci4` or `ci8`, otherwise an exception would be thrown. - - `ExternalTlut`: Optional. Specifies that the texture's tlut is in a different file. Takes the filename of the file that contains the tlut. - - `ExternalTlutOffset`: Optional. Specifies the offset in the `ExternalTlut` of the tlut for the given texture. - - `SplitTlut`: Optional. Specifies that the given texture should take from the upper half of the tlut. Takes a bool, i.e. one of `true`, `false`, `1`, `0`. - -The following is a list of the texture formats the Nintendo 64 supports, with their gfxdis names and ZAPD format names. - -| Format name | Typing in `gsDPLoadTextureBlock` | "Format" in xml | -| ----------------------------------------------- | -------------------------------- | --------------- | -| 4-bit intensity (I) | `G_IM_FMT_I, G_IM_SIZ_4b` | `i4` | -| 4-bit intensity with alpha (I/A) (3/1) | `G_IM_FMT_IA, G_IM_SIZ_4b` | `ia4` | -| 4-bit color index (CI) | `G_IM_FMT_CI, G_IM_SIZ_4b` | `ci4` | -| 8-bit I | `G_IM_FMT_I, G_IM_SIZ_8b` | `i8` | -| 8-bit IA (4/4) | `G_IM_FMT_IA, G_IM_SIZ_8b` | `ia8` | -| 8-bit CI | `G_IM_FMT_CI, G_IM_SIZ_8b` | `ci8` | -| 16-bit red, green, blue, alpha (RGBA) (5/5/5/1) | `G_IM_FMT_RGBA, G_IM_SIZ_16b` | `rgba16` | -| 16-bit IA (8/8) | `G_IM_FMT_IA, G_IM_SIZ_16b` | `ia16` | -| 16-bit YUV (Luminance, Blue-Y, Red-Y) | `G_IM_FMT_YUV, G_IM_SIZ_16b` | (not used) | -| 32-bit RGBA (8/8/8/8) | `G_IM_FMT_RGBA, G_IM_SIZ_32b` | `rgba32` | - -If you want to know more about this formats, you can check [`gsDPLoadTextureBlock`](http://n64devkit.square7.ch/n64man/gdp/gDPLoadTextureBlock.htm) for most formats, or [`gDPLoadTextureBlock_4b`](http://n64devkit.square7.ch/n64man/gdp/gDPLoadTextureBlock_4b.htm) for the 4-bit formats. - -------------------------- - -### Background - -- Example: - -```xml - -``` - -- Attributes: - - - `Name`: Required. Suffixed by `Background`. - - `OutName`: Required. The filename of the extracted `.jpg` file. - -※ Explicit use of this tag isn't often necesary because it would probably be extracted automatically by another extracted element. You can use this to name them if you don't like the autogenerated name. - -------------------------- - -### Blob - -Blob are binary data that will be extracted as `.bin` files. - -- Example: - -```xml - -``` - -Will be defined as: - -```c - -u8 gFireTempleBlob_00CCC0[] = { -#include "assets/objects/object_hidan_objects/gFireTempleBlob_00CCC0.bin.inc.c" -}; -``` - -- Attributes: - - - `Name`: Required. Suffixed by `Blob`. - - `Size`: Required. Amount of bytes to extract. Hex. - -※ We usually use blobs when we can't figure out the content's type of chunk of data. - -------------------------- - -### DList - -A.k.a. Display list, or Gfx. - -- Example: - -```xml - -``` - -- Attributes: - - - `Name`: Required. Suffixed by `DL`. - -------------------------- - -### TextureAnimation - -A data type exclusive to Majora's Mask, that has scrolling, color changing, and texture changing capabilities. Declaring the main array will generate everything else; textures for the TextureCycle type must be declared manually in the XML to use symbols. (If it does reference any undeclared textures, ZAPD will warn and give the their offsets.) - -```xml - -``` - -- Attributes: - - - `Name`: Required. Suffixed by `TexAnim`. - -------------------------- - -### Scene and Room - -`Scene`s and `Room`s are a bit special, because `Room`s usually needs assets declared in their respective `Scene` (which is in a different file), so they need to be extracted together. - -To accomplish this, the scene and each of their rooms must be declared in the same XML. - -- Example: - -```xml - - - - - - - - - - - - - - -``` - -- Attributes: - - - `HackMode`: Optional. This is a simple non-hardcoded way to handle some edge cases. Valid values: `syotes_room`. - -------------------------- - -### AltHeader - -Like `Scene`s and `Room`s, `AltHeader`s is special too. It should always be declared in the same `File` as a `Scene` or a `Room`. - -- Example: - -```xml - - - - - - - - - - - - - - -``` - -- Attributes: - - - `Name`: Required. Suffixed by `AltHeader`. - -------------------------- - -### Animation - -- Example: - -```xml - -``` - -- Attributes: - - - `Name`: Required. Suffixed by `Anim`. - -------------------------- - -### PlayerAnimation - -- Example: - -```xml - -``` - -- Attributes: - - - `Name`: Required. Suffixed by `Anim`. - -------------------------- - -### CurveAnimation - -- Example: - -```xml - -``` - -- Attributes: - - - `Name`: Required. Suffixed by `Anim`. - - `SkelOffset`: Required. Offset of the `CurveSkeleton` (I.e. a [`Skeleton`](#skeleton) resource with `Type="Curve"`) related to this animation. - -------------------------- - -### LegacyAnimation - -Useful only for the unused `object_human`'s animation data. - -- Example: - -```xml - -``` - -- Attributes: - - - `Name`: Required. Suffixed by `Anim`. - -------------------------- - -### Skeleton - -- Example: - -```xml - -``` - -- Attributes: - - - `Name`: Required. Suffixed by `Skel`. - - `Type`: Required. Valid values: `Normal`, `Flex` and `Curve`. - - `LimbType`: Required. Valid values: `Standard`, `LOD`, `Skin`, `Curve` and `Legacy`. - - `EnumName`: Optional. The name of `typedef`'d limb enum. - - `LimbNone`: Optional. The name of the limb with index zero in the limb enum. - - `LimbMax`: Optional. The name of the max limb index in the limb enum. - -ZAPD is able to generate a limb enum by itself only if all the required data is provided. Providing some but not all the required data would trigger an error and the execution will halt. - -The required data is providing the `EnumName`, `LimbNone` and `LimbMax` attributes in the `Skeleton` or `LimbTable` node and the `EnumName` attribute in every `Limb` of this skeleton. - -※ There are no restrictions in the `Type` and `LimbType` attributes besides the valid values, so any skeleton type can be combined with any limb type. - -------------------------- - -### LimbTable - -- Example: - -```xml - -``` - -- Attributes: - - - `Name`: Required. Suffixed by `Skel`. - - `LimbType`: Required. Valid values: `Standard`, `LOD`, `Skin`, `Curve` and `Legacy`. - - `Count`: Required. Amount of limbs. Integer. - - `EnumName`: Optional. The name of `typedef`'d limb enum. - - `LimbNone`: Optional. The name of the limb with index zero in the limb enum. - - `LimbMax`: Optional. The name of the max limb index in the limb enum. - -See [Skeleton](#skeleton) for info on the limb enum generation. - -------------------------- - -### Limb - -- Example: - -```xml - -``` - -- Attributes: - - - `Name`: Required. Suffixed by `Limb`. - - `LimbType`: Required. Valid values: `Standard`, `LOD`, `Skin`, `Curve` and `Legacy`. - - `EnumName`: Optional. The name used for this limb in the limbs enum. It must be either present in every limb or in none. - -See [Skeleton](#skeleton) for info on the limb enum generation. - -------------------------- - -### Symbol - -A special element that allows declaring a variable without actually extracting it from the current file. Useful when a resource references an element from another file. The symbol will be declared as `extern`. - -- Example: - -```xml - -``` - -Will be declared as: - -```c -extern u8 gJsjutanShadowTex[2048]; -``` - -- Attributes: - - - `Type`: The type of the declared variable. If missing, it will default to `void*`. - - `TypeSize`: The size in bytes of the type. If missing, it will default to `4` (the size of a word and a pointer). Integer or hex value. - - `Count`: Optional. If it is present, the variable will be declared as an array instead of a plain variable. The value of this attribute specifies the length of the array. If `Count` is present but it has no value (`Count=""`), then the length of the array will not be specified either in the declared variable. Integer or hex value. - - `Static`: This attribute can't be enabled on a Symbol node. A warning will be showed in this case. - -------------------------- - -### Collision - -- Example: - -```xml - -``` - -- Attributes: - - - `Name`: Required. Suffixed by `Col`. - -------------------------- - -### Scalar - -Allows the extraction of a single number. - -- Example: - -```xml - -``` - -Will be extracted as: - -```c -u64 pad34F8 = { 0 }; -``` - -- Attributes: - - - `Name`: Required. Suffixed by ~~`TBD`~~. - - `Type`: Required. Valid values: `s8`, `u8`, `x8`, `s16`, `u16`, `x16`, `s32`, `u32`, `x32`, `s64`, `u64`, `x64`, `f32` and `f64`. - -※ Can be wrapped in an [`Array`](#array) tag. - -------------------------- - -### Vector - -Extracts a vector. - -Current supported types are `Vec3s`, `Vec3i` or `Vec3f`. - -- Example: - -```xml - - - -``` - -Will be extracted as: - -```c -Vec3s D_04002040[24] = { - { -37, 2346, 93 }, - { 0, 11995, 0 }, - { -16385, -305, -16333 }, - { 0, 51, 12 }, - { 3761, 2263, -384 }, - { 0, 0, 3786 }, - { 1594, 1384, -18344 }, - { -2288, -2428, -1562 }, - { 0, 0, 3219 }, - { -2148, -5, -16840 }, - { 15365, -1708, 15611 }, - { 1761, 8365, 17711 }, - { 0, 0, 18859 }, - { 0, 0, 0 }, - { -9392, -9579, 28686 }, - { 0, 0, -7093 }, - { -2748, 685, -14092 }, - { 213, 6553, -32212 }, - { 0, 0, -1877 }, - { 3267, 3309, -16090 }, - { -18101, 25946, -2670 }, - { -104, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 } -}; -``` - -- Attributes: - - - `Name`: Required. Suffixed by ~~`TBD`~~. - - `Type`: Required. Specifies the vector's type (`Vec3s`, `Vec3i` and `Vec3f`). Valid values: `s16`, `s32` and `f32`. - - `Dimensions`: Required. The amount of dimensions of the vector. Valid values: `3`. - -※ Can be wrapped in an [`Array`](#array) tag. - -------------------------- - -### Vtx - -- Example: - -```xml - - - -``` - -- Attributes: - - - `Name`: Required. Suffixed by `Vtx`. - -※ Can be wrapped in an [`Array`](#array) tag. - -------------------------- - -### Mtx - -- Example: - -```xml - -``` - -- Attributes: - - - `Name`: Required. Suffixed by `Mtx`. - -※ Explicit use of this tag isn't often necesary because it would probably be extracted automatically by another extracted element. - -------------------------- - -### Cutscene - -- Example: - -```xml - -``` - -- Attributes: - - - `Name`: Required. Suffixed by `Cs`. - -※ Explicit use of this tag isn't often necesary because it would probably be extracted automatically by another extracted element. - -------------------------- - -### Array - -The `Array` element is special, because it needs an inner element to work. It will declare an array of its inner element. - -Currently, only [`Pointer`](#pointer), [`Scalar`](#scalar), [`Vector`](#vector) and [`Vtx`](#vtx) support being wrapped in an array. - -- Example: - -```xml - - - -``` - -- Attributes: - - - `Name`: Required. How the variable will be named. By our convention it should be prefixed by `g`. The sufix is mandated by the element contained. - - `Count`: Required. Amount of elements. Integer. - -------------------------- - -### Path - -- Example: - -```xml - -``` - -- Attributes: - - - `Name`: Required. Suffixed by `Path`. - - `NumPaths`: Optional. The amount of paths contained in the array. It must be a positive integer. - -------------------------- - -### PlayerAnimationData - -Allows the extraction of the specific data of the player animations which are found in the `link_animetion` file. - -- Example: - -```xml - -``` - -- Attributes: - - - `Name`: Required. Suffixed by `AnimData`. - - `FrameCount`: Required. The length of the animation in frames. It must be a positive integer. - -------------------------- - -### Pointer - -Allows the extraction of a variable that contains a pointer - -- Example: - -```xml - - - -``` - -- Attributes: - - - `Name`: Required. - - `Type`: Required. The type of the extracted pointer. - -※ Can be wrapped in an [`Array`](#array) tag. - -------------------------- diff --git a/tools/ZAPD/docs/zapd_warning_example.png b/tools/ZAPD/docs/zapd_warning_example.png deleted file mode 100644 index a001c64d6a..0000000000 Binary files a/tools/ZAPD/docs/zapd_warning_example.png and /dev/null differ diff --git a/tools/ZAPD/docs/zapd_xml_spec.md b/tools/ZAPD/docs/zapd_xml_spec.md deleted file mode 100644 index 9fcc0d4aab..0000000000 --- a/tools/ZAPD/docs/zapd_xml_spec.md +++ /dev/null @@ -1,55 +0,0 @@ -# ZAPD XML specification - -ZAPD XMLs use a restrictive subset of the XML standard: any ZAPD XML must be a valid XML (All elements starting with `` ending appropriately with ``, single "empty-element" tags with `/` at the end, etc.). - -Reminder that in - -```xml - - - - - - - - - -``` - -``, ``, `` are *children* of ``, but `` is not. `` is a *descendent* of `` and a child of ``. - -- Every XML's outermost element start/end tag is a single ``. -- The children of a `` must be ``s. -- A `` has *resources* as children. A resource is almost always single empty-element tag, and has one of the types - - `` - - `` - - `` - - `` - - `` - - `` - - `` - - `` - - `` - - `` - - `` - - `` - - `` - - `` - - `` - - `` - - `` - - `` - - `` - - `` - - `` - - `` - - `` - - `` - - `` - -- A `` cannot descend from a ``. -- All resources must be children of a ``. -- `` is the only paired resource tag enclosing an element; the element must be a single resource tag, one of - - `` - - `` - - `` diff --git a/tools/ZAPD/lib/libgfxd/.gitrepo b/tools/ZAPD/lib/libgfxd/.gitrepo deleted file mode 100644 index 4c8b7fe768..0000000000 --- a/tools/ZAPD/lib/libgfxd/.gitrepo +++ /dev/null @@ -1,12 +0,0 @@ -; DO NOT EDIT (unless you know what you are doing) -; -; This subdirectory is a git "subrepo", and this file is maintained by the -; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme -; -[subrepo] - remote = git@github.com:glankk/libgfxd.git - branch = master - commit = 008f73dca8ebc9151b205959b17773a19c5bd0da - parent = c92cfda733aa740a53129a21f69c8abb08a465c7 - method = merge - cmdver = 0.4.3 diff --git a/tools/ZAPD/lib/libgfxd/Makefile b/tools/ZAPD/lib/libgfxd/Makefile deleted file mode 100644 index b340ff5c0a..0000000000 --- a/tools/ZAPD/lib/libgfxd/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -CFLAGS = -Wall -O2 -g -UC_OBJ = uc_f3d.o uc_f3db.o uc_f3dex.o uc_f3dexb.o uc_f3dex2.o -OBJ = gfxd.o $(UC_OBJ) -LIB = libgfxd.a - -CPPFLAGS-$(MT) += -DCONFIG_MT -CPPFLAGS += $(CPPFLAGS-y) - -.PHONY: all -all: $(LIB) - -.PHONY: clean -clean: - rm -f $(OBJ) $(LIB) - -.INTERMEDIATE: $(OBJ) - -$(OBJ): gbi.h gfxd.h priv.h -$(UC_OBJ): uc.c uc_argfn.c uc_argtbl.c uc_macrofn.c uc_macrotbl.c - -$(LIB): $(OBJ) - $(AR) rcs $@ $^ - -%.o: %.c - $(COMPILE.c) $(OUTPUT_OPTION) $< diff --git a/tools/ZAPD/lib/libgfxd/README.md b/tools/ZAPD/lib/libgfxd/README.md deleted file mode 100644 index 2e82589439..0000000000 --- a/tools/ZAPD/lib/libgfxd/README.md +++ /dev/null @@ -1,478 +0,0 @@ -## Installing -Run `make` for a single-threaded build, or `make MT=y` for a multi-threaded -build. Copy `libgfxd.a` to your lib directory, and `gfxd.h` to your include -directory. - -## Example usage -Example source code: -``` -#include -#include - -static int macro_fn(void) -{ - /* Print a tab before each macro, and a comma and newline after each - macro */ - gfxd_puts("\t"); - gfxd_macro_dflt(); /* Execute the default macro handler */ - gfxd_puts(",\n"); - - return 0; -} - -int main() -{ - /* Read from stdin and write to stdout */ - gfxd_input_fd(fileno(stdin)); - gfxd_output_fd(fileno(stdout)); - - /* Override the default macro handler to make the output prettier */ - gfxd_macro_fn(macro_fn); - - /* Select F3DEX as the target microcode */ - gfxd_target(gfxd_f3dex); - - /* Set the input endianness to big endian, and the word size to 4 */ - gfxd_endian(gfxd_endian_big, 4); - - /* Print an opening brace */ - gfxd_puts("{\n"); - - /* Execute until the end of input, or until encountering an invalid - command */ - gfxd_execute(); - - /* Print a closing brace */ - gfxd_puts("}\n"); -} -``` - -Example input (binary): -``` -0xe7000000, 0x00000000, -0xfc127e03, 0xfffffdf8, -0xb900031d, 0xc8112078, -0xb6000000, 0x000e0000, -0xb7000000, 0x00012000, -0xfa000000, 0xffffffff, -0x040030bf, 0x000002e0, -0xb1000204, 0x00020604, -0xb1080a0c, 0x000a0e0c, -0xb10a1012, 0x000a120e, -0xb1140200, 0x00140016, -0xb8000000, 0x00000000, -``` - -Example output: -``` -{ - gsDPPipeSync(), - gsDPSetCombineLERP(TEXEL0, 0, SHADE, 0, 0, 0, 0, 1, COMBINED, 0, PRIMITIVE, 0, 0, 0, 0, COMBINED), - gsDPSetRenderMode(G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2), - gsSPClearGeometryMode(G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR), - gsSPSetGeometryMode(G_CULL_BACK | G_FOG), - gsDPSetPrimColor(0, 0, 0xFF, 0xFF, 0xFF, 0xFF), - gsSPVertex(0x000002E0, 12, 0), - gsSP2Triangles(0, 1, 2, 0, 1, 3, 2, 0), - gsSP2Triangles(4, 5, 6, 0, 5, 7, 6, 0), - gsSP1Quadrangle(5, 8, 9, 7, 0), - gsSP1Quadrangle(10, 1, 0, 11, 0), - gsSPEndDisplayList(), -} -``` - -## Input/output methods -The input consists of any number of `Gfx` packets, and the output is the -decompiled macros in plain-text. The endianness and microcode type of the input -can be set using `gfxd_endian` and `gfxd_target`. - -Several methods of doing I/O are available. No method is selected by default, -meaning there will be no input, and any output will be discarded. - ---- - -##### `void gfxd_input_buffer(const void *buf, int size)` -##### `void gfxd_output_buffer(char *buf, int size)` -Use the buffer pointed to by `buf`, of `size` bytes. - ---- - -##### `void gfxd_input_fd(int fd)` -##### `void gfxd_output_fd(int fd)` -Use `read()` / `write()` with the provided file descriptor, `fd`. - ---- - -##### `typedef int gfxd_input_fn_t(void *buf, int count)` -##### `typedef int gfxd_output_fn_t(const char *buf, int count)` -##### `void gfxd_input_callback(gfxd_input_fn_t *fn)` -##### `void gfxd_output_callback(gfxd_output_fn_t *fn)` -Use the provided callback function, `fn`. `fn` should copy at most `count` -bytes to/from `buf`, and return the number of bytes actually copied. The input -callback should return 0 to signal end of input. - -## Handlers -The macro handler function is responsible for writing the output of each -decompiled macro. The default macro handler is `gfxd_macro_dflt`, but this can -be changed with `gfxd_macro_fn`. The new handler can extend the default -function by calling `gfxd_macro_dflt` within it, or it can override it -completely. - ---- - -##### `int gfxd_macro_dflt()` -The default macro handler. Outputs the macro name, dynamic display list pointer -if one has been specified, and then each argument in order using the function -registered using `gfxd_arg_fn` (`gfxd_arg_dflt` by default), and returns zero. -Because it is designed to be extended, it only outputs the macro text, without -any whitespace or punctuation before or after. When this function is used as -the sole macro handler, it will output the entire display list on one line -without any separation between macros, which is probably not what you want. - ---- - -##### `void gfxd_macro_fn(gfxd_macro_fn_t *fn)` -Set `fn` to be the macro handler function. `fn` can be null, in which case the -handler is reset to the default. - ---- - -##### `void gfxd_arg_dflt(int arg_num)` -The default argument handler for `gfxd_macro_dflt`. For the argument with index -`arg_num`, calls `gfxd_arg_callbacks`, and prints the argument value if the -callback returns zero, or if there is no callback for the given argument. - ---- - -##### `void gfxd_arg_fn(gfxd_arg_fn_t *fn)` -Set `fn` to be the argument handler function, called by `gfxd_macro_dflt`, -for each argument in the current macro, not counting the dynamic display list -pointer if one has been specified. `fn` can be null, in which case the handler -is reset to the default. This only affects the output of `gfxd_macro_dflt`, and -has no observable effect if `gfxd_macro_dflt` is overridden (not extended). - -## Argument callbacks -Callbacks can be registered that will be executed when an argument of a certain -type is encountered. The default argument handler `gfxd_arg_dflt` will execute -callbacks as needed using `gfxd_arg_callbacks`. If a callback returns non-zero, -`gfxd_arg_dflt` will not output anything. This is to allow callbacks to -override the default argument output. Otherwise, `gfxd_arg_dflt` will output -the argument value after the callback function's output. - ---- - -##### `int gfxd_arg_callbacks(int arg_num)` -Examines the argument with index `arg_num` and executes the callback function -for that argument type, if such a callback is supported and has been -registered. This function returns the value that was returned by the callback -function. If no callback function has been registered for the argument type, -zero is returned. - -Most argument callbacks have some extra parameters containing information that -might be relevant to the argument that triggered the callback. The extra -information is extracted only from the current macro, as gfxd does not retain -any context information from previous or subsequent macros. If any of the extra -parameter values is not available in the current macro, the value for that -parameter is substituted with `-1` for signed parameters, and zero for unsigned -parameters. - ---- - -##### `typedef int gfxd_tlut_fn_t(uint32_t tlut, int32_t idx, int32_t count)` -##### `void gfxd_tlut_callback(gfxd_tlut_fn_t *fn)` -Set the callback function for palette arguments. The argument type is -`gfxd_Tlut`. The palette index is in `idx` and the number of colors in `count`. - ---- - -##### `typedef int gfxd_timg_fn_t(uint32_t timg, int32_t fmt, int32_t siz, int32_t width, int32_t height, int32_t pal)` -##### `void gfxd_timg_callback(gfxd_timg_fn_t *fn)` -Set the callback function for texture arguments. The argument type is -`gfxd_Timg`. The image format is in `fmt` and `siz`, the dimensions in `width` -and `height`, and the palette index in `pal`. - ---- - -##### `typedef int gfxd_cimg_fn_t(uint32_t cimg, int32_t fmt, int32_t siz, int32_t width)` -##### `void gfxd_cimg_callback(gfxd_cimg_fn_t *fn)` -Set the callback function for frame buffer arguments. The argument type is -`gfxd_Cimg`. The image format is in `fmt` and `siz`, and the horizontal -resolution in `width`. - ---- - -##### `typedef int gfxd_zimg_fn_t(uint32_t zimg)` -##### `void gfxd_zimg_callback(gfxd_zimg_fn_t *fn)` -Set the callback function for depth buffer arguments. The argument type is -`gfxd_Zimg`. - ---- - -##### `typedef int gfxd_dl_fn_t(uint32_t dl)` -##### `void gfxd_dl_callback(gfxd_dl_fn_t *fn)` -Set the callback function for display list arguments. The argument type is -`gfxd_Dl`. - ---- - -##### `typedef int gfxd_mtx_fn_t(uint32_t mtx)` -##### `void gfxd_mtx_callback(gfxd_mtx_fn_t *fn)` -Set the callback function for matrix arguments. The argument type is -`gfxd_Mtxptr`. - ---- - -##### `typedef int gfxd_lookat_fn_t(uint32_t lookat, int32_t count)` -##### `void gfxd_lookat_callback(gfxd_lookat_fn_t *fn)` -Set the callback function for lookat array arguments. The argument type is -`gfxd_Lookatptr`. The number of lookat structures (1 or 2) is in `count`. - ---- - -##### `typedef int gfxd_light_fn_t(uint32_t light, int32_t count)` -##### `void gfxd_light_callback(gfxd_light_fn_t *fn)` -Set the callback function for light array arguments. The argument type is -`gfxd_Lightptr`. The number of light structures is in `count`. - ---- - -##### `typedef int gfxd_seg_fn_t(uint32_t seg, int32_t num)` -##### `void gfxd_seg_callback(gfxd_seg_fn_t *fn)` -Set the callback function for segment base arguments. The argument type is -`gfxd_Segptr`. The segment number is in `num`. - ---- - -##### `typedef int gfxd_vtx_fn_t(uint32_t vtx, int32_t num)` -##### `void gfxd_vtx_callback(gfxd_vtx_fn_t *fn)` -Set the callback function for vertex array arguments. The argument type is -`gfxd_Vtxptr`. The number of vertex structures is in `num`. - ---- - -##### `typedef int gfxd_vp_fn_t(uint32_t vp)` -##### `void gfxd_vp_callback(gfxd_vp_fn_t *fn)` -Set the callback function for viewport arguments. The argument type is -`gfxd_Vp`. - ---- - -##### `typedef int gfxd_uctext_fn_t(uint32_t text, uint32_t size)` -##### `void gfxd_uctext_callback(gfxd_uctext_fn_t *fn)` -Set the callback function for microcode text arguments. The argument type is -`gfxd_Uctext`. The size of the text segment is in `size`. - ---- - -##### `typedef int gfxd_ucdata_fn_t(uint32_t data, uint32_t size)` -##### `void gfxd_ucdata_callback(gfxd_ucdata_fn_t *fn)` -Set the callback function for microcode data arguments. The argument type is -`gfxd_Ucdata`. The size of the data segment is in `size`. - ---- - -##### `typedef int gfxd_dram_fn_t(uint32_t dram, uint32_t size)` -##### `void gfxd_dram_callback(gfxd_dram_fn_t *fn)` -Set the callback function for generic pointer arguments. The argument type is -`gfxd_Dram`. The size of the data is in `size`. - -## General settings -These functions control general input and output settings. - ---- - -##### `void gfxd_target(gfxd_ucode_t ucode)` -Select `ucode` as the target microcode. `ucode` can be `gfxd_f3d`, `gfxd_f3db`, -`gfxd_f3dex`, `gfxd_f3dexb`, or `gfxd_f3dex2`. The microcode must be selected -before `gfxd_execute`, as no microcode is selected by default. - ---- - -##### `void gfxd_endian(int endian, int wordsize)` -Select `endian` as the endianness of the input, and `wordsize` as the size of -each word in number of bytes. `endian` can be `gfxd_endian_big`, -`gfxd_endian_little`, or `gfxd_endian_host` (the endianness of the host -machine). `wordsize` can be 1, 2, 4, or 8. Big endian is selected by default, -with a word size of 4. - ---- - -##### `void gfxd_dynamic(const char *arg)` -Enable or disable the use of dynamic `g` macros instead of static `gs` macros, -and select the dynamic display list pointer argument to be used. `arg` will be -used by `gfxd_macro_dflt` as the first argument to dynamic macros. If `arg` is -null, dynamic macros are disabled, and `gs` macros are used. Also affects the -result of `gfxd_macro_name`, as it will return either the dynamic or static -version of the macro name as selected by this setting. - ---- - -##### `void gfxd_enable(int cap)` -##### `void gfxd_disable(int cap)` -Enable or disable the feature specified by `cap`. Can be one of the following; -- `gfxd_stop_on_invalid`: Stop execution when encountering an invalid macro. -Enabled by default. -- `gfxd_stop_on_end`: Stop execution when encountering a `SPBranchList` or -`SPEndDisplayList`. Enabled by default. -- `gfxd_emit_dec_color`: Print color components as decimal instead of -hexadecimal. Disabled by default. -- `gfxd_emit_q_macro`: Print fixed-point conversion `q` macros for fixed-point -values. Disabled by default. -- `gfxd_emit_ext_macro`: Emit non-standard macros. Some commands are valid -(though possibly meaningless), but have no macros associated with them, such as -a standalone `G_RDPHALF_1`. When this feature is enabled, such a command will -produce a non-standard `gsDPHalf1` macro instead of a raw hexadecimal command. -Also enables some non-standard multi-packet texture loading macros. Disabled by -default. - ---- - -##### `void gfxd_udata_set(void *ptr)` -##### `void *gfxd_udata_get(void)` -Set or get a generic pointer that can be used to pass user-defined data in and -out of callback functions. - -## Execution -Decompilation is started using the `gfxd_execute` function. When gfxd is -executing (i.e. after `gfxd_execute` has been entered, and before it returns), -the general settings and the I/O settings should not be changed. - ---- - -##### `int gfxd_execute()` -Start executing gfxd with the current settings. For each macro, the macro -handler registered with `gfxd_macro_fn` is called. Execution ends when the -input ends, the macro handler returns non-zero, when an invalid macro is -encountered and `gfxd_stop_on_invalid` is enabled, or when `SPBranchList` or -`SPEndDisplayList` is encountered and `gfxd_stop_on_end` is enabled. If -execution ends due to an invalid macro, `-1` is returned. If execution ends -because the macro handler returns non-zero, the return value from the macro -handler is returned. Otherwise zero is returned. - -## Macro information -The following functions can be used to obtain information about the current -macro and its arguments. They should only be used in custom handlers and -callbacks from within `gfxd_execute`. If used elsewhere, their behavior is -undefined. - ---- - -##### `int gfxd_macro_offset()` -Returns the offset in the input data of the current macro. The offset starts -at zero when `gfxd_execute` is called. - ---- - -##### `int gfxd_macro_packets()` -Returns the number of `Gfx` packets within the current macro. - ---- - -##### `const void *gfxd_macro_data()` -Returns a pointer to the input data for the current macro. The data is not -byte-swapped. The data has a length of `sizeof(Gfx) * gfxd_macro_packets()`. - ---- - -##### `int gfxd_macro_id()` -Returns a number that uniquely identifies the current macro. The number will -be one of the constants in `gfxd.h`. - ---- - -##### `const char *gfxd_macro_name()` -Returns the name of the current macro. If the macro does not have a name (i.e. -it's invalid), null is returned. If a dynamic display list pointer has been -specified, the dynamic `g` version is returned. Otherwise the static `gs` -version is returned. The returned pointer is invalidated by a subsequent call -to `gfxd_macro_name`. - ---- - -##### `int gfxd_arg_count()` -Returns the number of arguments to the current macro, not including a dynamic -display list pointer if one has been specified. - ---- - -##### `int gfxd_arg_type(int arg_num)` -Returns a number that identifies the type of the argument with index `arg_num`. -The number will be one of the constants in `gfxd.h`. - ---- - -##### `const char *gfxd_arg_name(int arg_num)` -Returns the name of the argument with index `arg_num`. Argument names are not -canonical, nor are they needed for macro disassembly, but they can be useful -for informational and diagnostic purposes. - ---- - -##### `int gfxd_arg_fmt(int arg_num)` -Returns the data format of the argument with index `arg_num`. The return value -will be `gfxd_argfmt_i` for `int32_t`, `gfxd_argfmt_u` for `uint32_t`, or -`gfxd_argfmt_f` for `float`. When accessing the value of the argument with -`gfxd_arg_value`, the member with the corresponding type should be used. - ---- - -##### `const gfxd_value_t *gfxd_arg_value(int arg_num)` -Returns a pointer to the value of the argument with index `arg_num`. The value -is a union of type `gfxd_value_t` with the following layout; -``` -typedef union -{ - int32_t i; - uint32_t u; - float f; -} gfxd_value_t -``` - ---- - -##### `const gfxd_value_t *gfxd_value_by_type(int type, int idx)` -Returns a pointer to the value of the argument that is of `type`, and has order -`idx` in all arguments of that type. An `idx` of zero returns the first -argument that has the specified type. If there is no argument with the given -type and order, null is returned. - ---- - -##### `int gfxd_arg_valid(int arg_num)` -Returns non-zero if the argument with index `arg_num` is "valid", for some -definition of valid. An invalid argument generally means that the disassembler -found inconsistencies in the input data, or that the data can not be reproduced -by the current macro type. The argument still has a value that can be printed, -though the value is not guaranteed to make any sense. - -## Custom output -When the default handlers are overridden or extended, the custom handler -functions will want to do some output of their own. The following methods are -available for inserting custom text into the gfxd output. - ---- - -##### `int gfxd_write(const void *buf, int count)` -Insert `count` bytes from the buffer at `buf` into the output. The number of -characters written is returned. - ---- - -##### `int gfxd_puts(const char *str)` -Insert the null-terminated string at `str` into the output. The number of -characters written is returned. - ---- - -##### `int gfxd_printf(const char *fmt, ...)` -Insert the printf-formatted string described by `fmt` and additional arguments -into the output. Limited to 255 characters. The number of characters written is -returned. - ---- - -##### `int gfxd_print_value(int type, const gfxd_value_t *value)` -Insert the type-formatted value into the output. The type should be one of the -constants in `gfxd.h`. The number of characters written is returned. The -macro argument with index `n` can be printed with -`gfxd_print_value(gfxd_arg_type(n), gfxd_arg_value(n))`. diff --git a/tools/ZAPD/lib/libgfxd/gbi.h b/tools/ZAPD/lib/libgfxd/gbi.h deleted file mode 100644 index 69fa7f12e5..0000000000 --- a/tools/ZAPD/lib/libgfxd/gbi.h +++ /dev/null @@ -1,3838 +0,0 @@ -/** - * gbi.h version 0.3.6 - * n64 graphics microcode interface library - * compatible with fast3d, f3dex, f3dex2, s2dex, and s2dex2 - * - * select a microcode with one of these preprocessor definitions; - * #define F3D_GBI - * for fast3d (selected automatically by default), or - * #define F3DEX_GBI - * for f3dex/s2dex, or - * #define F3DEX_GBI_2 - * for f3dex2/s2dex2 - * - * for early versions of fast3d and f3dex, also define the following; - * #define F3D_BETA - * - * ido incompatibilities; - * - use of c99 variadic macros - * - use of c99 fixed-width integer types - * - use of c99 designated initializers - * - use of c99 compound literals - * - use of c11 _Alignas - * - use of gnu c compound expressions - * - use of gnu c __typeof__ - * - * libultra incompatibilities; - * - many private, undocumented, or obsolete macros not commonly used by - * programmers are missing - * - many different implementation details that will produce matching gbi, - * but not matching code -**/ - -#ifndef N64_GBI_H -#define N64_GBI_H - -#include - -/* use fast3d by default */ -#if !defined(F3D_GBI) && !defined(F3DEX_GBI) && !defined(F3DEX_GBI_2) -# define F3D_GBI -#endif - -/* commands for fast3d and f3dex */ -#if defined(F3D_GBI) || defined(F3DEX_GBI) -# define G_SPNOOP 0x00 -# define G_MTX 0x01 -# define G_MOVEMEM 0x03 -# define G_VTX 0x04 -# define G_DL 0x06 -# if defined(F3D_BETA) -# define G_RDPHALF_2 0xB2 -# define G_RDPHALF_1 0xB3 -# define G_PERSPNORM 0xB4 -# else -# define G_RDPHALF_2 0xB3 -# define G_RDPHALF_1 0xB4 -# endif -# define G_LINE3D 0xB5 -# define G_CLEARGEOMETRYMODE 0xB6 -# define G_SETGEOMETRYMODE 0xB7 -# define G_ENDDL 0xB8 -# define G_SETOTHERMODE_L 0xB9 -# define G_SETOTHERMODE_H 0xBA -# define G_TEXTURE 0xBB -# define G_MOVEWORD 0xBC -# define G_POPMTX 0xBD -# define G_CULLDL 0xBE -# define G_TRI1 0xBF -# define G_NOOP 0xC0 -#endif - -/* commands for f3dex */ -#if defined(F3DEX_GBI) -# define G_LOAD_UCODE 0xAF -# define G_BRANCH_Z 0xB0 -# define G_TRI2 0xB1 -# if !defined(F3D_BETA) -# define G_MODIFYVTX 0xB2 -# endif -#endif - -/* commands for f3dex2 */ -#if defined(F3DEX_GBI_2) -# define G_NOOP 0x00 -# define G_VTX 0x01 -# define G_MODIFYVTX 0x02 -# define G_CULLDL 0x03 -# define G_BRANCH_Z 0x04 -# define G_TRI1 0x05 -# define G_TRI2 0x06 -# define G_QUAD 0x07 -# define G_LINE3D 0x08 -# define G_SPECIAL_3 0xD3 -# define G_SPECIAL_2 0xD4 -# define G_SPECIAL_1 0xD5 -# define G_DMA_IO 0xD6 -# define G_TEXTURE 0xD7 -# define G_POPMTX 0xD8 -# define G_GEOMETRYMODE 0xD9 -# define G_MTX 0xDA -# define G_MOVEWORD 0xDB -# define G_MOVEMEM 0xDC -# define G_LOAD_UCODE 0xDD -# define G_DL 0xDE -# define G_ENDDL 0xDF -# define G_SPNOOP 0xE0 -# define G_RDPHALF_1 0xE1 -# define G_SETOTHERMODE_L 0xE2 -# define G_SETOTHERMODE_H 0xE3 -# define G_RDPHALF_2 0xF1 -#endif - -/* rdp commands */ -#define G_TEXRECT 0xE4 -#define G_TEXRECTFLIP 0xE5 -#define G_RDPLOADSYNC 0xE6 -#define G_RDPPIPESYNC 0xE7 -#define G_RDPTILESYNC 0xE8 -#define G_RDPFULLSYNC 0xE9 -#define G_SETKEYGB 0xEA -#define G_SETKEYR 0xEB -#define G_SETCONVERT 0xEC -#define G_SETSCISSOR 0xED -#define G_SETPRIMDEPTH 0xEE -#define G_RDPSETOTHERMODE 0xEF -#define G_LOADTLUT 0xF0 -#define G_SETTILESIZE 0xF2 -#define G_LOADBLOCK 0xF3 -#define G_LOADTILE 0xF4 -#define G_SETTILE 0xF5 -#define G_FILLRECT 0xF6 -#define G_SETFILLCOLOR 0xF7 -#define G_SETFOGCOLOR 0xF8 -#define G_SETBLENDCOLOR 0xF9 -#define G_SETPRIMCOLOR 0xFA -#define G_SETENVCOLOR 0xFB -#define G_SETCOMBINE 0xFC -#define G_SETTIMG 0xFD -#define G_SETZIMG 0xFE -#define G_SETCIMG 0xFF - -/* commands for s2dex */ -#if defined(F3DEX_GBI) -# define G_BG_1CYC 0x01 -# define G_BG_COPY 0x02 -# define G_OBJ_RECTANGLE 0x03 -# define G_OBJ_SPRITE 0x04 -# define G_OBJ_MOVEMEM 0x05 -# define G_SELECT_DL 0xB0 -# define G_OBJ_RENDERMODE 0xB1 -# define G_OBJ_RECTANGLE_R 0xB2 -# define G_OBJ_LOADTXTR 0xC1 -# define G_OBJ_LDTX_SPRITE 0xC2 -# define G_OBJ_LDTX_RECT 0xC3 -# define G_OBJ_LDTX_RECT_R 0xC4 -#endif - -/* commands for s2dex2 */ -#if defined(F3DEX_GBI_2) -# define G_OBJ_RECTANGLE 0x01 -# define G_OBJ_SPRITE 0x02 -# define G_SELECT_DL 0x04 -# define G_OBJ_LOADTXTR 0x05 -# define G_OBJ_LDTX_SPRITE 0x06 -# define G_OBJ_LDTX_RECT 0x07 -# define G_OBJ_LDTX_RECT_R 0x08 -# define G_BG_1CYC 0x09 -# define G_BG_COPY 0x0A -# define G_OBJ_RENDERMODE 0x0B -# define G_OBJ_RECTANGLE_R 0xDA -# define G_OBJ_MOVEMEM 0xDC -#endif - -/* commands for s2dex and s2dex2 */ -#if defined(F3DEX_GBI) || defined(F3DEX_GBI_2) -# define G_RDPHALF_0 0xE4 -#endif - -/* image formats */ -#define G_IM_FMT_RGBA 0 -#define G_IM_FMT_YUV 1 -#define G_IM_FMT_CI 2 -#define G_IM_FMT_IA 3 -#define G_IM_FMT_I 4 -#define G_IM_SIZ_4b 0 -#define G_IM_SIZ_8b 1 -#define G_IM_SIZ_16b 2 -#define G_IM_SIZ_32b 3 - -/* texture settings */ -#define G_TX_NOMIRROR (gI_(0b0) << 0) -#define G_TX_MIRROR (gI_(0b1) << 0) -#define G_TX_WRAP (gI_(0b0) << 1) -#define G_TX_CLAMP (gI_(0b1) << 1) -#define G_TX_NOMASK gI_(0) -#define G_TX_NOLOD gI_(0) -#define G_OFF gI_(0) -#define G_ON gI_(1) - -/* tile indices */ -#define G_TX_LOADTILE 7 -#define G_TX_RENDERTILE 0 - -/* loadblock constants */ -#define G_TX_DXT_FRAC 11 -#define G_TX_LDBLK_MAX_TXL 2047 - -/* geometry mode */ -#define G_ZBUFFER (gI_(0b1) << 0) -#define G_SHADE (gI_(0b1) << 2) -#define G_CULL_BOTH (G_CULL_FRONT | G_CULL_BACK) -#define G_FOG (gI_(0b1) << 16) -#define G_LIGHTING (gI_(0b1) << 17) -#define G_TEXTURE_GEN (gI_(0b1) << 18) -#define G_TEXTURE_GEN_LINEAR (gI_(0b1) << 19) -#define G_LOD (gI_(0b1) << 20) - -/* geometry mode for fast3d */ -#if defined(F3D_GBI) -# define G_CLIPPING (gI_(0b0) << 0) -#endif - -/* geometry mode for fast3d and f3dex */ -#if defined(F3D_GBI) || defined(F3DEX_GBI) -# define G_TEXTURE_ENABLE (gI_(0b1) << 1) -# define G_SHADING_SMOOTH (gI_(0b1) << 9) -# define G_CULL_FRONT (gI_(0b1) << 12) -# define G_CULL_BACK (gI_(0b1) << 13) -#endif - -/* geometry mode for f3dex and f3dex2 */ -#if defined(F3DEX_GBI) || defined(F3DEX_GBI_2) -# define G_CLIPPING (gI_(0b1) << 23) -#endif - -/* geometry mode for f3dex2 */ -#if defined(F3DEX_GBI_2) -# define G_TEXTURE_ENABLE (gI_(0b0) << 0) -# define G_CULL_FRONT (gI_(0b1) << 9) -# define G_CULL_BACK (gI_(0b1) << 10) -# define G_SHADING_SMOOTH (gI_(0b1) << 21) -#endif - -/* othermode lo */ -#define G_MDSFT_ALPHACOMPARE 0 -#define G_MDSFT_ZSRCSEL 2 -#define G_MDSFT_RENDERMODE 3 -#define G_MDSFT_BLENDER 16 -#define G_MDSIZ_ALPHACOMPARE 2 -#define G_MDSIZ_ZSRCSEL 1 -#define G_MDSIZ_RENDERMODE 29 -#define G_MDSIZ_BLENDER 13 - -#define G_AC_NONE (gI_(0b00) << G_MDSFT_ALPHACOMPARE) -#define G_AC_THRESHOLD (gI_(0b01) << G_MDSFT_ALPHACOMPARE) -#define G_AC_DITHER (gI_(0b11) << G_MDSFT_ALPHACOMPARE) -#define G_ZS_PIXEL (gI_(0b0) << G_MDSFT_ZSRCSEL) -#define G_ZS_PRIM (gI_(0b1) << G_MDSFT_ZSRCSEL) -#define AA_EN (gI_(0b1) << (G_MDSFT_RENDERMODE + 0)) -#define Z_CMP (gI_(0b1) << (G_MDSFT_RENDERMODE + 1)) -#define Z_UPD (gI_(0b1) << (G_MDSFT_RENDERMODE + 2)) -#define IM_RD (gI_(0b1) << (G_MDSFT_RENDERMODE + 3)) -#define CLR_ON_CVG (gI_(0b1) << (G_MDSFT_RENDERMODE + 4)) -#define CVG_DST_CLAMP (gI_(0b00) << (G_MDSFT_RENDERMODE + 5)) -#define CVG_DST_WRAP (gI_(0b01) << (G_MDSFT_RENDERMODE + 5)) -#define CVG_DST_FULL (gI_(0b10) << (G_MDSFT_RENDERMODE + 5)) -#define CVG_DST_SAVE (gI_(0b11) << (G_MDSFT_RENDERMODE + 5)) -#define ZMODE_OPA (gI_(0b00) << (G_MDSFT_RENDERMODE + 7)) -#define ZMODE_INTER (gI_(0b01) << (G_MDSFT_RENDERMODE + 7)) -#define ZMODE_XLU (gI_(0b10) << (G_MDSFT_RENDERMODE + 7)) -#define ZMODE_DEC (gI_(0b11) << (G_MDSFT_RENDERMODE + 7)) -#define CVG_X_ALPHA (gI_(0b1) << (G_MDSFT_RENDERMODE + 9)) -#define ALPHA_CVG_SEL (gI_(0b1) << (G_MDSFT_RENDERMODE + 10)) -#define FORCE_BL (gI_(0b1) << (G_MDSFT_RENDERMODE + 11)) - -#define G_BL_1MA gI_(0b00) -#define G_BL_1 gI_(0b10) -#define G_BL_0 gI_(0b11) -#define G_BL_CLR_IN gI_(0b00) -#define G_BL_CLR_MEM gI_(0b01) -#define G_BL_CLR_BL gI_(0b10) -#define G_BL_CLR_FOG gI_(0b11) -#define G_BL_A_IN gI_(0b00) -#define G_BL_A_FOG gI_(0b01) -#define G_BL_A_MEM gI_(0b01) -#define G_BL_A_SHADE gI_(0b10) - -#define GBL_c1(p, a, m, b) \ - ( \ - gF_(p, 2, 30) | \ - gF_(a, 2, 26) | \ - gF_(m, 2, 22) | \ - gF_(b, 2, 18) \ - ) -#define GBL_c2(p, a, m, b) \ - ( \ - gF_(p, 2, 28) | \ - gF_(a, 2, 24) | \ - gF_(m, 2, 20) | \ - gF_(b, 2, 16) \ - ) - -/* render modes */ -#define G_RM_OPA_SURF \ - ( \ - CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL | \ - GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1) \ - ) -#define G_RM_OPA_SURF2 \ - ( \ - CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL | \ - GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1) \ - ) -#define G_RM_AA_OPA_SURF \ - ( \ - AA_EN | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | ALPHA_CVG_SEL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) -#define G_RM_AA_OPA_SURF2 \ - ( \ - AA_EN | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | ALPHA_CVG_SEL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) -#define G_RM_RA_OPA_SURF \ - ( \ - AA_EN | CVG_DST_CLAMP | ZMODE_OPA | ALPHA_CVG_SEL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) -#define G_RM_RA_OPA_SURF2 \ - ( \ - AA_EN | CVG_DST_CLAMP | ZMODE_OPA | ALPHA_CVG_SEL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) -#define G_RM_ZB_OPA_SURF \ - ( \ - Z_CMP | Z_UPD | CVG_DST_FULL | ZMODE_OPA | ALPHA_CVG_SEL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) -#define G_RM_ZB_OPA_SURF2 \ - ( \ - Z_CMP | Z_UPD | CVG_DST_FULL | ZMODE_OPA | ALPHA_CVG_SEL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) -#define G_RM_AA_ZB_OPA_SURF \ - ( \ - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | \ - ALPHA_CVG_SEL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) -#define G_RM_AA_ZB_OPA_SURF2 \ - ( \ - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | \ - ALPHA_CVG_SEL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) -#define G_RM_RA_ZB_OPA_SURF \ - ( \ - AA_EN | Z_CMP | Z_UPD | CVG_DST_CLAMP | ZMODE_OPA | \ - ALPHA_CVG_SEL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) -#define G_RM_RA_ZB_OPA_SURF2 \ - ( \ - AA_EN | Z_CMP | Z_UPD | CVG_DST_CLAMP | ZMODE_OPA | \ - ALPHA_CVG_SEL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) - -#define G_RM_XLU_SURF \ - ( \ - IM_RD | CVG_DST_FULL | ZMODE_OPA | FORCE_BL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_XLU_SURF2 \ - ( \ - IM_RD | CVG_DST_FULL | ZMODE_OPA | FORCE_BL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_AA_XLU_SURF \ - ( \ - AA_EN | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_OPA | \ - FORCE_BL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_AA_XLU_SURF2 \ - ( \ - AA_EN | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_OPA | \ - FORCE_BL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_ZB_XLU_SURF \ - ( \ - Z_CMP | IM_RD | CVG_DST_FULL | ZMODE_XLU | FORCE_BL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_ZB_XLU_SURF2 \ - ( \ - Z_CMP | IM_RD | CVG_DST_FULL | ZMODE_XLU | FORCE_BL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_AA_ZB_XLU_SURF \ - ( \ - AA_EN | Z_CMP | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | \ - ZMODE_XLU | FORCE_BL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_AA_ZB_XLU_SURF2 \ - ( \ - AA_EN | Z_CMP | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | \ - ZMODE_XLU | FORCE_BL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) - -#define G_RM_ZB_OPA_DECAL \ - ( \ - Z_CMP | CVG_DST_FULL | ZMODE_DEC | ALPHA_CVG_SEL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) -#define G_RM_ZB_OPA_DECAL2 \ - ( \ - Z_CMP | CVG_DST_FULL | ZMODE_DEC | ALPHA_CVG_SEL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) -#define G_RM_AA_ZB_OPA_DECAL \ - ( \ - AA_EN | Z_CMP | IM_RD | CVG_DST_WRAP | ZMODE_DEC | \ - ALPHA_CVG_SEL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) -#define G_RM_AA_ZB_OPA_DECAL2 \ - ( \ - AA_EN | Z_CMP | IM_RD | CVG_DST_WRAP | ZMODE_DEC | \ - ALPHA_CVG_SEL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) -#define G_RM_RA_ZB_OPA_DECAL \ - ( \ - AA_EN | Z_CMP | CVG_DST_WRAP | ZMODE_DEC | ALPHA_CVG_SEL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) -#define G_RM_RA_ZB_OPA_DECAL2 \ - ( \ - AA_EN | Z_CMP | CVG_DST_WRAP | ZMODE_DEC | ALPHA_CVG_SEL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) - -#define G_RM_ZB_XLU_DECAL \ - ( \ - Z_CMP | IM_RD | CVG_DST_FULL | ZMODE_DEC | FORCE_BL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_ZB_XLU_DECAL2 \ - ( \ - Z_CMP | IM_RD | CVG_DST_FULL | ZMODE_DEC | FORCE_BL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_AA_ZB_XLU_DECAL \ - ( \ - AA_EN | Z_CMP | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | \ - ZMODE_DEC | FORCE_BL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_AA_ZB_XLU_DECAL2 \ - ( \ - AA_EN | Z_CMP | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | \ - ZMODE_DEC | FORCE_BL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) - -#define G_RM_AA_ZB_OPA_INTER \ - ( \ - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | ZMODE_INTER | \ - ALPHA_CVG_SEL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) -#define G_RM_AA_ZB_OPA_INTER2 \ - ( \ - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | ZMODE_INTER | \ - ALPHA_CVG_SEL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) -#define G_RM_RA_ZB_OPA_INTER \ - ( \ - AA_EN | Z_CMP | Z_UPD | CVG_DST_CLAMP | ZMODE_INTER | \ - ALPHA_CVG_SEL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) -#define G_RM_RA_ZB_OPA_INTER2 \ - ( \ - AA_EN | Z_CMP | Z_UPD | CVG_DST_CLAMP | ZMODE_INTER | \ - ALPHA_CVG_SEL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) - -#define G_RM_AA_ZB_XLU_INTER \ - ( \ - AA_EN | Z_CMP | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | \ - ZMODE_INTER | FORCE_BL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_AA_ZB_XLU_INTER2 \ - ( \ - AA_EN | Z_CMP | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | \ - ZMODE_INTER | FORCE_BL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) - -#define G_RM_AA_XLU_LINE \ - ( \ - AA_EN | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | CVG_X_ALPHA | \ - ALPHA_CVG_SEL | FORCE_BL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_AA_XLU_LINE2 \ - ( \ - AA_EN | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | CVG_X_ALPHA | \ - ALPHA_CVG_SEL | FORCE_BL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_AA_ZB_XLU_LINE \ - ( \ - AA_EN | Z_CMP | IM_RD | CVG_DST_CLAMP | ZMODE_XLU | \ - CVG_X_ALPHA | ALPHA_CVG_SEL | FORCE_BL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_AA_ZB_XLU_LINE2 \ - ( \ - AA_EN | Z_CMP | IM_RD | CVG_DST_CLAMP | ZMODE_XLU | \ - CVG_X_ALPHA | ALPHA_CVG_SEL | FORCE_BL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) - -#define G_RM_AA_DEC_LINE \ - ( \ - AA_EN | IM_RD | CVG_DST_FULL | ZMODE_OPA | CVG_X_ALPHA | \ - ALPHA_CVG_SEL | FORCE_BL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_AA_DEC_LINE2 \ - ( \ - AA_EN | IM_RD | CVG_DST_FULL | ZMODE_OPA | CVG_X_ALPHA | \ - ALPHA_CVG_SEL | FORCE_BL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_AA_ZB_DEC_LINE \ - ( \ - AA_EN | Z_CMP | IM_RD | CVG_DST_SAVE | ZMODE_DEC | \ - CVG_X_ALPHA | ALPHA_CVG_SEL | FORCE_BL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_AA_ZB_DEC_LINE2 \ - ( \ - AA_EN | Z_CMP | IM_RD | CVG_DST_SAVE | ZMODE_DEC | \ - CVG_X_ALPHA | ALPHA_CVG_SEL | FORCE_BL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) - - -#define G_RM_TEX_EDGE \ - ( \ - AA_EN | CVG_DST_CLAMP | ZMODE_OPA | CVG_X_ALPHA | \ - ALPHA_CVG_SEL | FORCE_BL | \ - GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1) \ - ) -#define G_RM_TEX_EDGE2 \ - ( \ - AA_EN | CVG_DST_CLAMP | ZMODE_OPA | CVG_X_ALPHA | \ - ALPHA_CVG_SEL | FORCE_BL | \ - GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1) \ - ) -#define G_RM_AA_TEX_EDGE \ - ( \ - AA_EN | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | CVG_X_ALPHA | \ - ALPHA_CVG_SEL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) -#define G_RM_AA_TEX_EDGE2 \ - ( \ - AA_EN | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | CVG_X_ALPHA | \ - ALPHA_CVG_SEL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) -#define G_RM_AA_ZB_TEX_EDGE \ - ( \ - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | \ - CVG_X_ALPHA | ALPHA_CVG_SEL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) -#define G_RM_AA_ZB_TEX_EDGE2 \ - ( \ - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | \ - CVG_X_ALPHA | ALPHA_CVG_SEL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) - -#define G_RM_AA_ZB_TEX_INTER \ - ( \ - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | ZMODE_INTER | \ - CVG_X_ALPHA | ALPHA_CVG_SEL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) -#define G_RM_AA_ZB_TEX_INTER2 \ - ( \ - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | ZMODE_INTER | \ - CVG_X_ALPHA | ALPHA_CVG_SEL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) - -#define G_RM_AA_SUB_SURF \ - ( \ - AA_EN | IM_RD | CVG_DST_FULL | ZMODE_OPA | ALPHA_CVG_SEL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) -#define G_RM_AA_SUB_SURF2 \ - ( \ - AA_EN | IM_RD | CVG_DST_FULL | ZMODE_OPA | ALPHA_CVG_SEL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) -#define G_RM_AA_ZB_SUB_SURF \ - ( \ - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_FULL | ZMODE_OPA | \ - ALPHA_CVG_SEL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) -#define G_RM_AA_ZB_SUB_SURF2 \ - ( \ - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_FULL | ZMODE_OPA | \ - ALPHA_CVG_SEL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) \ - ) - -#define G_RM_PCL_SURF \ - ( \ - G_AC_DITHER | CVG_DST_FULL | ZMODE_OPA | FORCE_BL | \ - GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1) \ - ) -#define G_RM_PCL_SURF2 \ - ( \ - G_AC_DITHER | CVG_DST_FULL | ZMODE_OPA | FORCE_BL | \ - GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1) \ - ) -#define G_RM_AA_PCL_SURF \ - ( \ - G_AC_DITHER | AA_EN | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_AA_PCL_SURF2 \ - ( \ - G_AC_DITHER | AA_EN | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_ZB_PCL_SURF \ - ( \ - G_AC_DITHER | Z_CMP | Z_UPD | CVG_DST_FULL | ZMODE_OPA | \ - GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1) \ - ) -#define G_RM_ZB_PCL_SURF2 \ - ( \ - G_AC_DITHER | Z_CMP | Z_UPD | CVG_DST_FULL | ZMODE_OPA | \ - GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1) \ - ) -#define G_RM_AA_ZB_PCL_SURF \ - ( \ - G_AC_DITHER | AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | \ - ZMODE_OPA | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_AA_ZB_PCL_SURF2 \ - ( \ - G_AC_DITHER | AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | \ - ZMODE_OPA | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) - -#define G_RM_AA_OPA_TERR \ - ( \ - AA_EN | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | ALPHA_CVG_SEL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_AA_OPA_TERR2 \ - ( \ - AA_EN | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | ALPHA_CVG_SEL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_AA_ZB_OPA_TERR \ - ( \ - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | \ - ALPHA_CVG_SEL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_AA_ZB_OPA_TERR2 \ - ( \ - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | \ - ALPHA_CVG_SEL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) - -#define G_RM_AA_TEX_TERR \ - ( \ - AA_EN | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | CVG_X_ALPHA | \ - ALPHA_CVG_SEL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_AA_TEX_TERR2 \ - ( \ - AA_EN | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | CVG_X_ALPHA | \ - ALPHA_CVG_SEL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_AA_ZB_TEX_TERR \ - ( \ - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | \ - CVG_X_ALPHA | ALPHA_CVG_SEL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_AA_ZB_TEX_TERR2 \ - ( \ - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | \ - CVG_X_ALPHA | ALPHA_CVG_SEL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) - -#define G_RM_AA_SUB_TERR \ - ( \ - AA_EN | IM_RD | CVG_DST_FULL | ZMODE_OPA | ALPHA_CVG_SEL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_AA_SUB_TERR2 \ - ( \ - AA_EN | IM_RD | CVG_DST_FULL | ZMODE_OPA | ALPHA_CVG_SEL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_AA_ZB_SUB_TERR \ - ( \ - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_FULL | ZMODE_OPA | \ - ALPHA_CVG_SEL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_AA_ZB_SUB_TERR2 \ - ( \ - AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_FULL | ZMODE_OPA | \ - ALPHA_CVG_SEL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) - -#define G_RM_CLD_SURF \ - ( \ - IM_RD | CVG_DST_SAVE | ZMODE_OPA | FORCE_BL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_CLD_SURF2 \ - ( \ - IM_RD | CVG_DST_SAVE | ZMODE_OPA | FORCE_BL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_ZB_CLD_SURF \ - ( \ - Z_CMP | IM_RD | CVG_DST_SAVE | ZMODE_XLU | FORCE_BL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_ZB_CLD_SURF2 \ - ( \ - Z_CMP | IM_RD | CVG_DST_SAVE | ZMODE_XLU | FORCE_BL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) - -#define G_RM_ZB_OVL_SURF \ - ( \ - Z_CMP | IM_RD | CVG_DST_SAVE | ZMODE_DEC | FORCE_BL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_ZB_OVL_SURF2 \ - ( \ - Z_CMP | IM_RD | CVG_DST_SAVE | ZMODE_DEC | FORCE_BL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) - -#define G_RM_ADD \ - ( \ - IM_RD | CVG_DST_SAVE | ZMODE_OPA | FORCE_BL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_FOG, G_BL_CLR_MEM, G_BL_1) \ - ) -#define G_RM_ADD2 \ - ( \ - IM_RD | CVG_DST_SAVE | ZMODE_OPA | FORCE_BL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_FOG, G_BL_CLR_MEM, G_BL_1) \ - ) - -#define G_RM_FOG_SHADE_A \ - GBL_c1(G_BL_CLR_FOG, G_BL_A_SHADE, G_BL_CLR_IN, G_BL_1MA) - -#define G_RM_FOG_PRIM_A \ - GBL_c1(G_BL_CLR_FOG, G_BL_A_FOG, G_BL_CLR_IN, G_BL_1MA) - -#define G_RM_PASS \ - GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1) - -#define G_RM_VISCVG \ - ( \ - IM_RD | FORCE_BL | \ - GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_BL, G_BL_A_MEM) \ - ) -#define G_RM_VISCVG2 \ - ( \ - IM_RD | FORCE_BL | \ - GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_BL, G_BL_A_MEM) \ - ) - -#define G_RM_OPA_CI \ - ( \ - CVG_DST_CLAMP | ZMODE_OPA | \ - GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1) \ - ) -#define G_RM_OPA_CI2 \ - ( \ - CVG_DST_CLAMP | ZMODE_OPA | \ - GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1) \ - ) - -#define G_RM_NOOP GBL_c1(0, 0, 0, 0) -#define G_RM_NOOP2 GBL_c2(0, 0, 0, 0) - -#define G_RM_SPRITE G_RM_OPA_SURF -#define G_RM_SPRITE2 G_RM_OPA_SURF2 -#define G_RM_RA_SPRITE \ - ( \ - AA_EN | CVG_DST_CLAMP | ZMODE_OPA | CVG_X_ALPHA | \ - ALPHA_CVG_SEL | \ - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_RA_SPRITE2 \ - ( \ - AA_EN | CVG_DST_CLAMP | ZMODE_OPA | CVG_X_ALPHA | \ - ALPHA_CVG_SEL | \ - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) \ - ) -#define G_RM_AA_SPRITE G_RM_AA_TEX_TERR -#define G_RM_AA_SPRITE2 G_RM_AA_TEX_TERR2 -#define G_RM_XLU_SPRITE G_RM_XLU_SURF -#define G_RM_XLU_SPRITE2 G_RM_XLU_SURF2 -#define G_RM_AA_XLU_SPRITE G_RM_AA_XLU_SURF -#define G_RM_AA_XLU_SPRITE2 G_RM_AA_XLU_SURF2 - -#define G_OBJRM_NOTXCLAMP (gI_(0b1) << 0) -#define G_OBJRM_XLU (gI_(0b1) << 1) -#define G_OBJRM_ANTIALIAS (gI_(0b1) << 2) -#define G_OBJRM_BILERP (gI_(0b1) << 3) -#define G_OBJRM_SHRINKSIZE_1 (gI_(0b1) << 4) -#define G_OBJRM_SHRINKSIZE_2 (gI_(0b1) << 5) -#define G_OBJRM_WIDEN (gI_(0b1) << 6) - -/* othermode hi */ -#define G_MDSFT_ALPHADITHER 4 -#define G_MDSFT_RGBDITHER 6 -#define G_MDSFT_COMBKEY 8 -#define G_MDSFT_TEXTCONV 9 -#define G_MDSFT_TEXTFILT 12 -#define G_MDSFT_TEXTLUT 14 -#define G_MDSFT_TEXTLOD 16 -#define G_MDSFT_TEXTDETAIL 17 -#define G_MDSFT_TEXTPERSP 19 -#define G_MDSFT_CYCLETYPE 20 -#define G_MDSFT_PIPELINE 23 -#define G_MDSIZ_ALPHADITHER 2 -#define G_MDSIZ_RGBDITHER 2 -#define G_MDSIZ_COMBKEY 1 -#define G_MDSIZ_TEXTCONV 3 -#define G_MDSIZ_TEXTFILT 2 -#define G_MDSIZ_TEXTLUT 2 -#define G_MDSIZ_TEXTLOD 1 -#define G_MDSIZ_TEXTDETAIL 2 -#define G_MDSIZ_TEXTPERSP 1 -#define G_MDSIZ_CYCLETYPE 2 -#define G_MDSIZ_PIPELINE 1 - -#define G_AD_PATTERN (gI_(0b00) << G_MDSFT_ALPHADITHER) -#define G_AD_NOTPATTERN (gI_(0b01) << G_MDSFT_ALPHADITHER) -#define G_AD_NOISE (gI_(0b10) << G_MDSFT_ALPHADITHER) -#define G_AD_DISABLE (gI_(0b11) << G_MDSFT_ALPHADITHER) -#define G_CD_MAGICSQ (gI_(0b00) << G_MDSFT_RGBDITHER) -#define G_CD_BAYER (gI_(0b01) << G_MDSFT_RGBDITHER) -#define G_CD_NOISE (gI_(0b10) << G_MDSFT_RGBDITHER) -#define G_CD_DISABLE (gI_(0b11) << G_MDSFT_RGBDITHER) -#define G_CD_ENABLE (gI_(0b10) << G_MDSFT_RGBDITHER) -#define G_CK_NONE (gI_(0b0) << G_MDSFT_COMBKEY) -#define G_CK_KEY (gI_(0b1) << G_MDSFT_COMBKEY) -#define G_TC_CONV (gI_(0b000) << G_MDSFT_TEXTCONV) -#define G_TC_FILTCONV (gI_(0b101) << G_MDSFT_TEXTCONV) -#define G_TC_FILT (gI_(0b110) << G_MDSFT_TEXTCONV) -#define G_TF_POINT (gI_(0b00) << G_MDSFT_TEXTFILT) -#define G_TF_BILERP (gI_(0b10) << G_MDSFT_TEXTFILT) -#define G_TF_AVERAGE (gI_(0b11) << G_MDSFT_TEXTFILT) -#define G_TT_NONE (gI_(0b00) << G_MDSFT_TEXTLUT) -#define G_TT_RGBA16 (gI_(0b10) << G_MDSFT_TEXTLUT) -#define G_TT_IA16 (gI_(0b11) << G_MDSFT_TEXTLUT) -#define G_TL_TILE (gI_(0b0) << G_MDSFT_TEXTLOD) -#define G_TL_LOD (gI_(0b1) << G_MDSFT_TEXTLOD) -#define G_TD_CLAMP (gI_(0b00) << G_MDSFT_TEXTDETAIL) -#define G_TD_SHARPEN (gI_(0b01) << G_MDSFT_TEXTDETAIL) -#define G_TD_DETAIL (gI_(0b10) << G_MDSFT_TEXTDETAIL) -#define G_TP_NONE (gI_(0b0) << G_MDSFT_TEXTPERSP) -#define G_TP_PERSP (gI_(0b1) << G_MDSFT_TEXTPERSP) -#define G_CYC_1CYCLE (gI_(0b00) << G_MDSFT_CYCLETYPE) -#define G_CYC_2CYCLE (gI_(0b01) << G_MDSFT_CYCLETYPE) -#define G_CYC_COPY (gI_(0b10) << G_MDSFT_CYCLETYPE) -#define G_CYC_FILL (gI_(0b11) << G_MDSFT_CYCLETYPE) -#define G_PM_NPRIMITIVE (gI_(0b0) << G_MDSFT_PIPELINE) -#define G_PM_1PRIMITIVE (gI_(0b1) << G_MDSFT_PIPELINE) - -/* color conversion constants */ -#define G_CV_K0 (175) -#define G_CV_K1 (-43) -#define G_CV_K2 (-89) -#define G_CV_K3 (222) -#define G_CV_K4 (114) -#define G_CV_K5 (42) - -/* color combiner */ -#define G_CCMUX_COMBINED 0 -#define G_CCMUX_TEXEL0 1 -#define G_CCMUX_TEXEL1 2 -#define G_CCMUX_PRIMITIVE 3 -#define G_CCMUX_SHADE 4 -#define G_CCMUX_ENVIRONMENT 5 -#define G_CCMUX_1 6 -#define G_CCMUX_NOISE 7 -#define G_CCMUX_0 31 -#define G_CCMUX_CENTER 6 -#define G_CCMUX_K4 7 -#define G_CCMUX_SCALE 6 -#define G_CCMUX_COMBINED_ALPHA 7 -#define G_CCMUX_TEXEL0_ALPHA 8 -#define G_CCMUX_TEXEL1_ALPHA 9 -#define G_CCMUX_PRIMITIVE_ALPHA 10 -#define G_CCMUX_SHADE_ALPHA 11 -#define G_CCMUX_ENV_ALPHA 12 -#define G_CCMUX_LOD_FRACTION 13 -#define G_CCMUX_PRIM_LOD_FRAC 14 -#define G_CCMUX_K5 15 -#define G_ACMUX_COMBINED 0 -#define G_ACMUX_TEXEL0 1 -#define G_ACMUX_TEXEL1 2 -#define G_ACMUX_PRIMITIVE 3 -#define G_ACMUX_SHADE 4 -#define G_ACMUX_ENVIRONMENT 5 -#define G_ACMUX_1 6 -#define G_ACMUX_0 7 -#define G_ACMUX_LOD_FRACTION 0 -#define G_ACMUX_PRIM_LOD_FRAC 6 - -/* - * combine modes - * ( A - B ) * C + D -*/ -#define G_CC_MODULATEI \ - TEXEL0, 0, SHADE, 0, \ - 0, 0, 0, SHADE -#define G_CC_MODULATEIA \ - TEXEL0, 0, SHADE, 0, \ - TEXEL0, 0, SHADE, 0 -#define G_CC_MODULATEIDECALA \ - TEXEL0, 0, SHADE, 0, \ - 0, 0, 0, TEXEL0 -#define G_CC_MODULATERGB \ - G_CC_MODULATEI -#define G_CC_MODULATERGBA \ - G_CC_MODULATEIA -#define G_CC_MODULATERGBDECALA \ - G_CC_MODULATEIDECALA -#define G_CC_MODULATEI_PRIM \ - TEXEL0, 0, PRIMITIVE, 0, \ - 0, 0, 0, PRIMITIVE -#define G_CC_MODULATEIA_PRIM \ - TEXEL0, 0, PRIMITIVE, 0, \ - TEXEL0, 0, PRIMITIVE, 0 -#define G_CC_MODULATEIDECALA_PRIM \ - TEXEL0, 0, PRIMITIVE, 0, \ - 0, 0, 0, TEXEL0 -#define G_CC_MODULATERGB_PRIM \ - G_CC_MODULATEI_PRIM -#define G_CC_MODULATERGBA_PRIM \ - G_CC_MODULATEIA_PRIM -#define G_CC_MODULATERGBDECALA_PRIM \ - G_CC_MODULATEIDECALA_PRIM -#define G_CC_DECALRGB \ - 0, 0, 0, TEXEL0, \ - 0, 0, 0, SHADE -#define G_CC_DECALRGBA \ - 0, 0, 0, TEXEL0, \ - 0, 0, 0, TEXEL0 -#define G_CC_BLENDI \ - ENVIRONMENT, SHADE, TEXEL0, SHADE, \ - 0, 0, 0, SHADE -#define G_CC_BLENDIA \ - ENVIRONMENT, SHADE, TEXEL0, SHADE, \ - TEXEL0, 0, SHADE, 0 -#define G_CC_BLENDIDECALA \ - ENVIRONMENT, SHADE, TEXEL0, SHADE, \ - 0, 0, 0, TEXEL0 -#define G_CC_BLENDRGBA \ - TEXEL0, SHADE, TEXEL0_ALPHA, SHADE, \ - 0, 0, 0, SHADE -#define G_CC_BLENDRGBDECALA \ - TEXEL0, SHADE, TEXEL0_ALPHA, SHADE, \ - 0, 0, 0, TEXEL0 -#define G_CC_REFLECTRGB \ - ENVIRONMENT, 0, TEXEL0, SHADE, \ - 0, 0, 0, SHADE -#define G_CC_REFLECTRGBDECALA \ - ENVIRONMENT, 0, TEXEL0, SHADE, \ - 0, 0, 0, TEXEL0 -#define G_CC_HILITERGB \ - PRIMITIVE, SHADE, TEXEL0, SHADE, \ - 0, 0, 0, SHADE -#define G_CC_HILITERGBA \ - PRIMITIVE, SHADE, TEXEL0, SHADE, \ - PRIMITIVE, SHADE, TEXEL0, SHADE -#define G_CC_HILITERGBDECALA \ - PRIMITIVE, SHADE, TEXEL0, SHADE, \ - 0, 0, 0, TEXEL0 -#define G_CC_1CYUV2RGB \ - TEXEL0, K4, K5, TEXEL0, \ - 0, 0, 0, SHADE -#define G_CC_PRIMITIVE \ - 0, 0, 0, PRIMITIVE, \ - 0, 0, 0, PRIMITIVE -#define G_CC_SHADE \ - 0, 0, 0, SHADE, \ - 0, 0, 0, SHADE -#define G_CC_ADDRGB \ - 1, 0, TEXEL0, SHADE, \ - 0, 0, 0, SHADE -#define G_CC_ADDRGBDECALA \ - 1, 0, TEXEL0, SHADE, \ - 0, 0, 0, TEXEL0 -#define G_CC_SHADEDECALA \ - 0, 0, 0, SHADE, \ - 0, 0, 0, TEXEL0 -#define G_CC_BLENDPE \ - PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, \ - TEXEL0, 0, SHADE, 0 -#define G_CC_BLENDPEDECALA \ - PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, \ - 0, 0, 0, TEXEL0 -#define G_CC_TRILERP \ - TEXEL1, TEXEL0, LOD_FRACTION, TEXEL0, \ - TEXEL1, TEXEL0, LOD_FRACTION, TEXEL0 -#define G_CC_TEMPLERP \ - TEXEL1, TEXEL0, PRIM_LOD_FRAC, TEXEL0, \ - TEXEL1, TEXEL0, PRIM_LOD_FRAC, TEXEL0 -#define G_CC_INTERFERENCE \ - TEXEL0, 0, TEXEL1, 0, \ - TEXEL0, 0, TEXEL1, 0 -#define _G_CC_BLENDPE \ - ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, \ - TEXEL0, 0, SHADE, 0 -#define _G_CC_BLENDPEDECALA \ - ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, \ - 0, 0, 0, TEXEL0 -#define _G_CC_SPARSEST \ - PRIMITIVE, TEXEL0, LOD_FRACTION, TEXEL0, \ - PRIMITIVE, TEXEL0, LOD_FRACTION, TEXEL0 -#define _G_CC_TWOCOLORTEX \ - PRIMITIVE, SHADE, TEXEL0, SHADE, \ - 0, 0, 0, SHADE -#define G_CC_MODULATEI2 \ - COMBINED, 0, SHADE, 0, \ - 0, 0, 0, SHADE -#define G_CC_MODULATEIA2 \ - COMBINED, 0, SHADE, 0, \ - COMBINED, 0, SHADE, 0 -#define G_CC_MODULATERGB2 \ - G_CC_MODULATEI2 -#define G_CC_MODULATERGBA2 \ - G_CC_MODULATEIA2 -#define G_CC_MODULATEI_PRIM2 \ - COMBINED, 0, PRIMITIVE, 0, \ - 0, 0, 0, PRIMITIVE -#define G_CC_MODULATEIA_PRIM2 \ - COMBINED, 0, PRIMITIVE, 0, \ - COMBINED, 0, PRIMITIVE, 0 -#define G_CC_MODULATERGB_PRIM2 \ - G_CC_MODULATEI_PRIM2 -#define G_CC_MODULATERGBA_PRIM2 \ - G_CC_MODULATEIA_PRIM2 -#define G_CC_DECALRGB2 \ - 0, 0, 0, COMBINED, \ - 0, 0, 0, SHADE -#define G_CC_BLENDI2 \ - ENVIRONMENT, SHADE, COMBINED, SHADE, \ - 0, 0, 0, SHADE -#define G_CC_BLENDIA2 \ - ENVIRONMENT, SHADE, COMBINED, SHADE, \ - COMBINED, 0, SHADE, 0 -#define G_CC_HILITERGB2 \ - ENVIRONMENT, COMBINED, TEXEL0, COMBINED, \ - 0, 0, 0, SHADE -#define G_CC_HILITERGBA2 \ - ENVIRONMENT, COMBINED, TEXEL0, COMBINED, \ - ENVIRONMENT, COMBINED, TEXEL0, COMBINED -#define G_CC_HILITERGBDECALA2 \ - ENVIRONMENT, COMBINED, TEXEL0, COMBINED, \ - 0, 0, 0, TEXEL0 -#define G_CC_HILITERGBPASSA2 \ - ENVIRONMENT, COMBINED, TEXEL0, COMBINED, \ - 0, 0, 0, COMBINED -#define G_CC_CHROMA_KEY2 \ - TEXEL0, CENTER, SCALE, 0, \ - 0, 0, 0, 0 -#define G_CC_YUV2RGB \ - TEXEL1, K4, K5, TEXEL1, \ - 0, 0, 0, 0 -#define G_CC_PASS2 \ - 0, 0, 0, COMBINED, \ - 0, 0, 0, COMBINED -#define G_CC_LERP(a0, b0, c0, d0, Aa0, Ab0, Ac0, Ad0, \ - a1, b1, c1, d1, Aa1, Ab1, Ac1, Ad1) \ - ( \ - gFL_(G_CCMUX_##a0, 4, 52) | \ - gFL_(G_CCMUX_##c0, 5, 47) | \ - gFL_(G_ACMUX_##Aa0, 3, 44) | \ - gFL_(G_ACMUX_##Ac0, 3, 41) | \ - gFL_(G_CCMUX_##a1, 4, 37) | \ - gFL_(G_CCMUX_##c1, 5, 32) | \ - gFL_(G_CCMUX_##b0, 4, 28) | \ - gFL_(G_CCMUX_##b1, 4, 24) | \ - gFL_(G_ACMUX_##Aa1, 3, 21) | \ - gFL_(G_ACMUX_##Ac1, 3, 18) | \ - gFL_(G_CCMUX_##d0, 3, 15) | \ - gFL_(G_ACMUX_##Ab0, 3, 12) | \ - gFL_(G_ACMUX_##Ad0, 3, 9) | \ - gFL_(G_CCMUX_##d1, 3, 6) | \ - gFL_(G_ACMUX_##Ab1, 3, 3) | \ - gFL_(G_ACMUX_##Ad1, 3, 0) \ - ) -#define G_CC_MODE(mode1, mode2) G_CC_LERP(mode1, mode2) - -/* scissor modes */ -#define G_SC_NON_INTERLACE gI_(0b00) -#define G_SC_EVEN_INTERLACE gI_(0b10) -#define G_SC_ODD_INTERLACE gI_(0b11) - -/* display list branch flags */ -#define G_DL_PUSH gI_(0b0) -#define G_DL_NOPUSH gI_(0b1) - -/* conditional branching flags (f3dex and f3dex2) */ -#if defined(F3DEX_GBI) || defined(F3DEX_GBI_2) -# define G_BZ_PERSP 0 -# define G_BZ_ORTHO 1 -#endif - -/* matrix params */ -#define G_MTX_MUL (gI_(0b0) << 1) -#define G_MTX_LOAD (gI_(0b1) << 1) - -/* matrix params for fast3d and f3dex */ -#if defined(F3D_GBI) || defined(F3DEX_GBI) -# define G_MTX_MODELVIEW (gI_(0b0) << 0) -# define G_MTX_PROJECTION (gI_(0b1) << 0) -# define G_MTX_NOPUSH (gI_(0b0) << 2) -# define G_MTX_PUSH (gI_(0b1) << 2) -#endif - -/* matrix params for f3dex2 */ -#if defined(F3DEX_GBI_2) -# define G_MTX_NOPUSH (gI_(0b0) << 0) -# define G_MTX_PUSH (gI_(0b1) << 0) -# define G_MTX_MODELVIEW (gI_(0b0) << 2) -# define G_MTX_PROJECTION (gI_(0b1) << 2) -#endif - -/* moveword indices */ -#define G_MW_MATRIX 0 -#define G_MW_NUMLIGHT 2 -#define G_MW_CLIP 4 -#define G_MW_SEGMENT 6 -#define G_MW_FOG 8 -#define G_MW_GENSTAT 8 -#define G_MW_LIGHTCOL 10 -#define G_MW_PERSPNORM 14 - -/* moveword indices for fast3d and f3dex */ -#if defined(F3D_GBI) || defined(F3DEX_GBI) -# define G_MW_POINTS 12 -#endif - -/* moveword indices for f3dex2 */ -#if defined(F3DEX_GBI_2) -# define G_MW_FORCEMTX 12 -#endif - -/* moveword offsets */ -#define G_MWO_NUMLIGHT gI_(0x00) -#define G_MWO_CLIP_RNX gI_(0x04) -#define G_MWO_CLIP_RNY gI_(0x0C) -#define G_MWO_CLIP_RPX gI_(0x14) -#define G_MWO_CLIP_RPY gI_(0x1C) -#define G_MWO_SEGMENT_0 gI_(0x00) -#define G_MWO_SEGMENT_1 gI_(0x04) -#define G_MWO_SEGMENT_2 gI_(0x08) -#define G_MWO_SEGMENT_3 gI_(0x0C) -#define G_MWO_SEGMENT_4 gI_(0x10) -#define G_MWO_SEGMENT_5 gI_(0x14) -#define G_MWO_SEGMENT_6 gI_(0x18) -#define G_MWO_SEGMENT_7 gI_(0x1C) -#define G_MWO_SEGMENT_8 gI_(0x20) -#define G_MWO_SEGMENT_9 gI_(0x24) -#define G_MWO_SEGMENT_A gI_(0x28) -#define G_MWO_SEGMENT_B gI_(0x2C) -#define G_MWO_SEGMENT_C gI_(0x30) -#define G_MWO_SEGMENT_D gI_(0x34) -#define G_MWO_SEGMENT_E gI_(0x38) -#define G_MWO_SEGMENT_F gI_(0x3C) -#define G_MWO_FOG gI_(0x00) -#define G_MWO_aLIGHT_1 gI_(0x00) -#define G_MWO_bLIGHT_1 gI_(0x04) -#define G_MWO_MATRIX_XX_XY_I gI_(0x00) -#define G_MWO_MATRIX_XZ_XW_I gI_(0x04) -#define G_MWO_MATRIX_YX_YY_I gI_(0x08) -#define G_MWO_MATRIX_YZ_YW_I gI_(0x0C) -#define G_MWO_MATRIX_ZX_ZY_I gI_(0x10) -#define G_MWO_MATRIX_ZZ_ZW_I gI_(0x14) -#define G_MWO_MATRIX_WX_WY_I gI_(0x18) -#define G_MWO_MATRIX_WZ_WW_I gI_(0x1C) -#define G_MWO_MATRIX_XX_XY_F gI_(0x20) -#define G_MWO_MATRIX_XZ_XW_F gI_(0x24) -#define G_MWO_MATRIX_YX_YY_F gI_(0x28) -#define G_MWO_MATRIX_YZ_YW_F gI_(0x2C) -#define G_MWO_MATRIX_ZX_ZY_F gI_(0x30) -#define G_MWO_MATRIX_ZZ_ZW_F gI_(0x34) -#define G_MWO_MATRIX_WX_WY_F gI_(0x38) -#define G_MWO_MATRIX_WZ_WW_F gI_(0x3C) -#define G_MWO_POINT_RGBA gI_(0x10) -#define G_MWO_POINT_ST gI_(0x14) -#define G_MWO_POINT_XYSCREEN gI_(0x18) -#define G_MWO_POINT_ZSCREEN gI_(0x1C) - -/* moveword offsets for fast3d and f3dex */ -#if defined(F3D_GBI) || defined(F3DEX_GBI) -# define G_MWO_aLIGHT_2 gI_(0x20) -# define G_MWO_bLIGHT_2 gI_(0x24) -# define G_MWO_aLIGHT_3 gI_(0x40) -# define G_MWO_bLIGHT_3 gI_(0x44) -# define G_MWO_aLIGHT_4 gI_(0x60) -# define G_MWO_bLIGHT_4 gI_(0x64) -# define G_MWO_aLIGHT_5 gI_(0x80) -# define G_MWO_bLIGHT_5 gI_(0x84) -# define G_MWO_aLIGHT_6 gI_(0xA0) -# define G_MWO_bLIGHT_6 gI_(0xA4) -# define G_MWO_aLIGHT_7 gI_(0xC0) -# define G_MWO_bLIGHT_7 gI_(0xC4) -# define G_MWO_aLIGHT_8 gI_(0xE0) -# define G_MWO_bLIGHT_8 gI_(0xE4) -#endif - -/* moveword offsets for f3dex2 */ -#if defined(F3DEX_GBI_2) -# define G_MWO_aLIGHT_2 gI_(0x18) -# define G_MWO_bLIGHT_2 gI_(0x1C) -# define G_MWO_aLIGHT_3 gI_(0x30) -# define G_MWO_bLIGHT_3 gI_(0x34) -# define G_MWO_aLIGHT_4 gI_(0x48) -# define G_MWO_bLIGHT_4 gI_(0x4C) -# define G_MWO_aLIGHT_5 gI_(0x60) -# define G_MWO_bLIGHT_5 gI_(0x64) -# define G_MWO_aLIGHT_6 gI_(0x78) -# define G_MWO_bLIGHT_6 gI_(0x7C) -# define G_MWO_aLIGHT_7 gI_(0x90) -# define G_MWO_bLIGHT_7 gI_(0x94) -# define G_MWO_aLIGHT_8 gI_(0xA8) -# define G_MWO_bLIGHT_8 gI_(0xAC) -#endif - -/* movemem params for fast3d and f3dex */ -#if defined(F3D_GBI) || defined(F3DEX_GBI) -# define G_MV_VIEWPORT 128 -# define G_MV_LOOKATY 130 -# define G_MV_LOOKATX 132 -# define G_MV_L0 134 -# define G_MV_L1 136 -# define G_MV_L2 138 -# define G_MV_L3 140 -# define G_MV_L4 142 -# define G_MV_L5 144 -# define G_MV_L6 146 -# define G_MV_L7 148 -# define G_MV_TXTATT 150 -# define G_MV_MATRIX_2 152 -# define G_MV_MATRIX_3 154 -# define G_MV_MATRIX_4 156 -# define G_MV_MATRIX_1 158 -#endif - -/* movemem params for f3dex2 */ -#if defined(F3DEX_GBI_2) -# define G_MV_MMTX 2 -# define G_MV_PMTX 6 -# define G_MV_VIEWPORT 8 -# define G_MV_LIGHT 10 -# define G_MV_POINT 12 -# define G_MV_MATRIX 14 -# define G_MVO_LOOKATX gI_(0 * 0x18) -# define G_MVO_LOOKATY gI_(1 * 0x18) -# define G_MVO_L0 gI_(2 * 0x18) -# define G_MVO_L1 gI_(3 * 0x18) -# define G_MVO_L2 gI_(4 * 0x18) -# define G_MVO_L3 gI_(5 * 0x18) -# define G_MVO_L4 gI_(6 * 0x18) -# define G_MVO_L5 gI_(7 * 0x18) -# define G_MVO_L6 gI_(8 * 0x18) -# define G_MVO_L7 gI_(9 * 0x18) -#endif - -/* frustum ratios */ -#define FRUSTRATIO_1 gI_(1) -#define FRUSTRATIO_2 gI_(2) -#define FRUSTRATIO_3 gI_(3) -#define FRUSTRATIO_4 gI_(4) -#define FRUSTRATIO_5 gI_(5) -#define FRUSTRATIO_6 gI_(6) - -/* light params */ -#define NUMLIGHTS_0 1 -#define NUMLIGHTS_1 1 -#define NUMLIGHTS_2 2 -#define NUMLIGHTS_3 3 -#define NUMLIGHTS_4 4 -#define NUMLIGHTS_5 5 -#define NUMLIGHTS_6 6 -#define NUMLIGHTS_7 7 -#define LIGHT_1 1 -#define LIGHT_2 2 -#define LIGHT_3 3 -#define LIGHT_4 4 -#define LIGHT_5 5 -#define LIGHT_6 6 -#define LIGHT_7 7 -#define LIGHT_8 8 - -/* light params for fast3d and f3dex */ -#if defined(F3D_GBI) || defined(F3DEX_GBI) -# define NUML(n) (((n) + 1) * 32 + 0x80000000) -#endif - -/* light params for f3dex2 */ -#if defined(F3DEX_GBI_2) -# define NUML(n) ((n) * 0x18) -#endif - -/* background load types */ -#define G_BGLT_LOADBLOCK gI_(0x0033) -#define G_BGLT_LOADTILE gI_(0xFFF4) - -/* background flags */ -#define G_BG_FLAG_FLIPS (gI_(0b1) << 0) -#define G_BG_FLAG_FLIPT (gI_(0b1) << 1) - -/* object load types */ -#define G_OBJLT_TXTRBLOCK gI_(0x00001033) -#define G_OBJLT_TXTRTILE gI_(0x00FC1034) -#define G_OBJLT_TLUT gI_(0x00000030) - -/* object flags */ -#define G_OBJ_FLAG_FLIPS (gI_(0b1) << 0) -#define G_OBJ_FLAG_FLIPT (gI_(0b1) << 4) - -/* color macros */ -#define G_MAXZ 0x03FF -#define G_MAXFBZ 0x3FFF -#define GPACK_RGBA5551(r, g, b, a) \ - ( \ - gF_(r, 5, 11) | \ - gF_(g, 5, 6) | \ - gF_(b, 5, 1) | \ - gF_(a, 1, 0) \ - ) -#define GPACK_RGBA8888(r, g, b, a) \ - ( \ - gF_(r, 8, 24) | \ - gF_(g, 8, 16) | \ - gF_(b, 8, 8) | \ - gF_(a, 8, 0) \ - ) -#define GPACK_RGB24A8(rgb, a) (gF_(rgb, 24, 8) | gF_(a, 8, 0)) -#define GPACK_ZDZ(z, dz) (gF_(z, 14, 2) | gF_(dz, 2, 0)) - -/* structure definition macros */ -#define gdSPDefMtx(xx, xy, xz, xw, \ - yx, yy, yz, yw, \ - zx, zy, zz, zw, \ - wx, wy, wz, ww) \ - ( \ - (Mtx) \ - { \ - .i = \ - { \ - (qs1616(xx) >> 16) & 0xFFFF, \ - (qs1616(xy) >> 16) & 0xFFFF, \ - (qs1616(xz) >> 16) & 0xFFFF, \ - (qs1616(xw) >> 16) & 0xFFFF, \ - (qs1616(yx) >> 16) & 0xFFFF, \ - (qs1616(yy) >> 16) & 0xFFFF, \ - (qs1616(yz) >> 16) & 0xFFFF, \ - (qs1616(yw) >> 16) & 0xFFFF, \ - (qs1616(zx) >> 16) & 0xFFFF, \ - (qs1616(zy) >> 16) & 0xFFFF, \ - (qs1616(zz) >> 16) & 0xFFFF, \ - (qs1616(zw) >> 16) & 0xFFFF, \ - (qs1616(wx) >> 16) & 0xFFFF, \ - (qs1616(wy) >> 16) & 0xFFFF, \ - (qs1616(wz) >> 16) & 0xFFFF, \ - (qs1616(ww) >> 16) & 0xFFFF, \ - }, \ - .f = \ - { \ - qs1616(xx) & 0xFFFF, \ - qs1616(xy) & 0xFFFF, \ - qs1616(xz) & 0xFFFF, \ - qs1616(xw) & 0xFFFF, \ - qs1616(yx) & 0xFFFF, \ - qs1616(yy) & 0xFFFF, \ - qs1616(yz) & 0xFFFF, \ - qs1616(yw) & 0xFFFF, \ - qs1616(zx) & 0xFFFF, \ - qs1616(zy) & 0xFFFF, \ - qs1616(zz) & 0xFFFF, \ - qs1616(zw) & 0xFFFF, \ - qs1616(wx) & 0xFFFF, \ - qs1616(wy) & 0xFFFF, \ - qs1616(wz) & 0xFFFF, \ - qs1616(ww) & 0xFFFF, \ - } \ - } \ - ) -#define gdSPDefLookAt(rx, ry, rz, ux, uy, uz) \ - ( \ - (LookAt) \ - { \ - .l[0].l = \ - { \ - .col = {0, 0, 0}, \ - .colc = {0, 0, 0}, \ - .dir = {rx, ry, rz}, \ - }, \ - .l[1].l = \ - { \ - .col = {0, 0x80, 0}, \ - .colc = {0, 0x80, 0}, \ - .dir = {ux, uy, uz}, \ - }, \ - } \ - ) -#define gdSPDefLights0(ar, ag, ab) \ - ( \ - (Lights0) \ - { \ - .a.l = \ - { \ - .col = {ar, ag, ab}, \ - .colc = {ar, ag, ab}, \ - }, \ - .l[0].l = \ - { \ - } \ - } \ - ) -#define gdSPDefLights1(ar, ag, ab, \ - r1, g1, b1, x1, y1, z1) \ - ( \ - (Lights1) \ - { \ - .a.l = \ - { \ - .col = {ar, ag, ab}, \ - .colc = {ar, ag, ab}, \ - }, \ - .l[0].l = \ - { \ - .col = {r1, g1, b1}, \ - .colc = {r1, g1, b1}, \ - .dir = {x1, y1, z1}, \ - } \ - } \ - ) -#define gdSPDefLights2(ar, ag, ab, \ - r1, g1, b1, x1, y1, z1, \ - r2, g2, b2, x2, y2, z2) \ - ( \ - (Lights2) \ - { \ - .a.l = \ - { \ - .col = {ar, ag, ab}, \ - .colc = {ar, ag, ab}, \ - }, \ - .l[0].l = \ - { \ - .col = {r1, g1, b1}, \ - .colc = {r1, g1, b1}, \ - .dir = {x1, y1, z1}, \ - } \ - .l[1].l = \ - { \ - .col = {r2, g2, b2}, \ - .colc = {r2, g2, b2}, \ - .dir = {x2, y2, z2}, \ - } \ - } \ - ) -#define gdSPDefLights3(ar, ag, ab, \ - r1, g1, b1, x1, y1, z1, \ - r2, g2, b2, x2, y2, z2, \ - r3, g3, b3, x3, y3, z3) \ - ( \ - (Lights3) \ - { \ - .a.l = \ - { \ - .col = {ar, ag, ab}, \ - .colc = {ar, ag, ab}, \ - }, \ - .l[0].l = \ - { \ - .col = {r1, g1, b1}, \ - .colc = {r1, g1, b1}, \ - .dir = {x1, y1, z1}, \ - } \ - .l[1].l = \ - { \ - .col = {r2, g2, b2}, \ - .colc = {r2, g2, b2}, \ - .dir = {x2, y2, z2}, \ - } \ - .l[2].l = \ - { \ - .col = {r3, g3, b3}, \ - .colc = {r3, g3, b3}, \ - .dir = {x3, y3, z3}, \ - } \ - } \ - ) -#define gdSPDefLights4(ar, ag, ab, \ - r1, g1, b1, x1, y1, z1, \ - r2, g2, b2, x2, y2, z2, \ - r3, g3, b3, x3, y3, z3, \ - r4, g4, b4, x4, y4, z4) \ - ( \ - (Lights4) \ - { \ - .a.l = \ - { \ - .col = {ar, ag, ab}, \ - .colc = {ar, ag, ab}, \ - }, \ - .l[0].l = \ - { \ - .col = {r1, g1, b1}, \ - .colc = {r1, g1, b1}, \ - .dir = {x1, y1, z1}, \ - } \ - .l[1].l = \ - { \ - .col = {r2, g2, b2}, \ - .colc = {r2, g2, b2}, \ - .dir = {x2, y2, z2}, \ - } \ - .l[2].l = \ - { \ - .col = {r3, g3, b3}, \ - .colc = {r3, g3, b3}, \ - .dir = {x3, y3, z3}, \ - } \ - .l[3].l = \ - { \ - .col = {r4, g4, b4}, \ - .colc = {r4, g4, b4}, \ - .dir = {x4, y4, z4}, \ - } \ - } \ - ) -#define gdSPDefLights5(ar, ag, ab, \ - r1, g1, b1, x1, y1, z1, \ - r2, g2, b2, x2, y2, z2, \ - r3, g3, b3, x3, y3, z3, \ - r4, g4, b4, x4, y4, z4, \ - r5, g5, b5, x5, y5, z5) \ - ( \ - (Lights5) \ - { \ - .a.l = \ - { \ - .col = {ar, ag, ab}, \ - .colc = {ar, ag, ab}, \ - }, \ - .l[0].l = \ - { \ - .col = {r1, g1, b1}, \ - .colc = {r1, g1, b1}, \ - .dir = {x1, y1, z1}, \ - } \ - .l[1].l = \ - { \ - .col = {r2, g2, b2}, \ - .colc = {r2, g2, b2}, \ - .dir = {x2, y2, z2}, \ - } \ - .l[2].l = \ - { \ - .col = {r3, g3, b3}, \ - .colc = {r3, g3, b3}, \ - .dir = {x3, y3, z3}, \ - } \ - .l[3].l = \ - { \ - .col = {r4, g4, b4}, \ - .colc = {r4, g4, b4}, \ - .dir = {x4, y4, z4}, \ - } \ - .l[4].l = \ - { \ - .col = {r5, g5, b5}, \ - .colc = {r5, g5, b5}, \ - .dir = {x5, y5, z5}, \ - } \ - } \ - ) -#define gdSPDefLights6(ar, ag, ab, \ - r1, g1, b1, x1, y1, z1, \ - r2, g2, b2, x2, y2, z2, \ - r3, g3, b3, x3, y3, z3, \ - r4, g4, b4, x4, y4, z4, \ - r5, g5, b5, x5, y5, z5, \ - r6, g6, b6, x6, y6, z6)\ - ( \ - (Lights6) \ - { \ - .a.l = \ - { \ - .col = {ar, ag, ab}, \ - .colc = {ar, ag, ab}, \ - }, \ - .l[0].l = \ - { \ - .col = {r1, g1, b1}, \ - .colc = {r1, g1, b1}, \ - .dir = {x1, y1, z1}, \ - } \ - .l[1].l = \ - { \ - .col = {r2, g2, b2}, \ - .colc = {r2, g2, b2}, \ - .dir = {x2, y2, z2}, \ - } \ - .l[2].l = \ - { \ - .col = {r3, g3, b3}, \ - .colc = {r3, g3, b3}, \ - .dir = {x3, y3, z3}, \ - } \ - .l[3].l = \ - { \ - .col = {r4, g4, b4}, \ - .colc = {r4, g4, b4}, \ - .dir = {x4, y4, z4}, \ - } \ - .l[4].l = \ - { \ - .col = {r5, g5, b5}, \ - .colc = {r5, g5, b5}, \ - .dir = {x5, y5, z5}, \ - } \ - .l[5].l = \ - { \ - .col = {r6, g6, b6}, \ - .colc = {r6, g6, b6}, \ - .dir = {x6, y6, z6}, \ - } \ - } \ - ) -#define gdSPDefLights7(ar, ag, ab, \ - r1, g1, b1, x1, y1, z1, \ - r2, g2, b2, x2, y2, z2, \ - r3, g3, b3, x3, y3, z3, \ - r4, g4, b4, x4, y4, z4, \ - r5, g5, b5, x5, y5, z5, \ - r6, g6, b6, x6, y6, z6, \ - r7, g7, b7, x7, y7, z7) \ - ( \ - (Lights7) \ - { \ - .a.l = \ - { \ - .col = {ar, ag, ab}, \ - .colc = {ar, ag, ab}, \ - }, \ - .l[0].l = \ - { \ - .col = {r1, g1, b1}, \ - .colc = {r1, g1, b1}, \ - .dir = {x1, y1, z1}, \ - } \ - .l[1].l = \ - { \ - .col = {r2, g2, b2}, \ - .colc = {r2, g2, b2}, \ - .dir = {x2, y2, z2}, \ - } \ - .l[2].l = \ - { \ - .col = {r3, g3, b3}, \ - .colc = {r3, g3, b3}, \ - .dir = {x3, y3, z3}, \ - } \ - .l[3].l = \ - { \ - .col = {r4, g4, b4}, \ - .colc = {r4, g4, b4}, \ - .dir = {x4, y4, z4}, \ - } \ - .l[4].l = \ - { \ - .col = {r5, g5, b5}, \ - .colc = {r5, g5, b5}, \ - .dir = {x5, y5, z5}, \ - } \ - .l[5].l = \ - { \ - .col = {r6, g6, b6}, \ - .colc = {r6, g6, b6}, \ - .dir = {x6, y6, z6}, \ - } \ - .l[6].l = \ - { \ - .col = {r7, g7, b7}, \ - .colc = {r7, g7, b7}, \ - .dir = {x7, y7, z7}, \ - } \ - } \ - ) -#define gdSPDefVtx(x, y, z, s, t) \ - ( \ - (Vtx) \ - { \ - .v = \ - { \ - .ob = {x, y, z}, \ - .tc = {qs105(s), qs105(t)}, \ - } \ - } \ - ) -#define gdSPDefVtxC(x, y, z, s, t, cr, cg, cb, ca) \ - ( \ - (Vtx) \ - { \ - .v = \ - { \ - .ob = {x, y, z}, \ - .tc = {qs105(s), qs105(t)}, \ - .cn = {cr, cg, cb, ca}, \ - } \ - } \ - ) -#define gdSPDefVtxN(x, y, z, s, t, nx, ny, nz, ca) \ - ( \ - (Vtx) \ - { \ - .n = \ - { \ - .ob = {x, y, z}, \ - .tc = {qs105(s), qs105(t)}, \ - .n = {nx, ny, nz}, \ - .a = ca \ - } \ - } \ - ) - -/* instruction macros */ - -#define gsDPFillRectangle(ulx, uly, lrx, lry) \ - gO_( \ - G_FILLRECT, \ - gF_(lrx, 10, 14) | \ - gF_(lry, 10, 2), \ - gF_(ulx, 10, 14) | \ - gF_(uly, 10, 2)) - -#define gsDPScisFillRectangle(ulx, uly, lrx, lry) \ - gsDPFillRectangle(gScC_(ulx), gScC_(uly), gScC_(lrx), gScC_(lry)) - -#define gsDPFullSync() \ - gO_(G_RDPFULLSYNC, 0, 0) - -#define gsDPLoadSync() \ - gO_(G_RDPLOADSYNC, 0, 0) - -#define gsDPTileSync() \ - gO_(G_RDPTILESYNC, 0, 0) - -#define gsDPPipeSync() \ - gO_(G_RDPPIPESYNC, 0, 0) - -#define gsDPLoadTLUT_pal16(pal, dram) \ - gsDPLoadTLUT(16, 256 + (gI_(pal) & 0xF) * 16, dram) - -#define gsDPLoadTLUT_pal256(dram) \ - gsDPLoadTLUT(256, 256, dram) - -#define gLTB_(timg, fmt, siz, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - dxt, tmem, rt, line) \ - gsDPSetTextureImage(fmt, G_SIZ_LDSIZ(siz), 1, timg), \ - gsDPSetTile( \ - fmt, G_SIZ_LDSIZ(siz), 0, tmem, G_TX_LOADTILE, 0, \ - cmt, maskt, shiftt, \ - cms, masks, shifts), \ - gsDPLoadSync(), \ - gsDPLoadBlock( \ - G_TX_LOADTILE, 0, 0, \ - G_LTB_LRS(width, height, siz), \ - dxt), \ - gsDPPipeSync(), \ - gsDPSetTile( \ - fmt, siz, line, tmem, rt, pal, \ - cmt, maskt, shiftt, \ - cms, masks, shifts), \ - gsDPSetTileSize(rt, 0, 0, qu102((width) - 1), qu102((height) - 1)) - -#define gsDPLoadTextureBlock(timg, fmt, siz, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ - gLTB_( \ - timg, fmt, siz, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - G_DXT(siz, width), 0x0, G_TX_RENDERTILE, \ - ((width) * G_SIZ_LDBITS(siz) + 63) / 64) - -#define gsDPLoadTextureBlockS(timg, fmt, siz, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ - gLTB_( \ - timg, fmt, siz, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - 0, 0x0, G_TX_RENDERTILE, \ - ((width) * G_SIZ_LDBITS(siz) + 63) / 64) - -#define gsDPLoadTextureBlock_4b(timg, fmt, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ - gLTB_( \ - timg, fmt, G_IM_SIZ_4b, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - G_DXT(G_IM_SIZ_4b, width), 0x0, G_TX_RENDERTILE, \ - ((width) * 4 + 63) / 64) - -#define gsDPLoadTextureBlock_4bS(timg, fmt, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ - gLTB_( \ - timg, fmt, G_IM_SIZ_4b, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - 0, 0x0, G_TX_RENDERTILE, \ - ((width) * 4 + 63) / 64) - -#define gsDPLoadTextureBlockYuv(timg, fmt, siz, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ - gLTB_( \ - timg, fmt, siz, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - G_DXT(siz, width), 0x0, G_TX_RENDERTILE, \ - ((width) + 7) / 8) - -#define gsDPLoadTextureBlockYuvS(timg, fmt, siz, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ - gLTB_( \ - timg, fmt, siz, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - 0, 0x0, G_TX_RENDERTILE, \ - ((width) + 7) / 8) - -#define _gsDPLoadTextureBlock(timg, tmem, fmt, siz, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ - gLTB_( \ - timg, fmt, siz, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - G_DXT(siz, width), tmem, G_TX_RENDERTILE, \ - ((width) * G_SIZ_LDBITS(siz) + 63) / 64) - -#define _gsDPLoadTextureBlockS(timg, tmem, fmt, siz, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ - gLTB_( \ - timg, fmt, siz, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - 0, tmem, G_TX_RENDERTILE, \ - ((width) * G_SIZ_LDBITS(siz) + 63) / 64) - -#define _gsDPLoadTextureBlock_4b(timg, tmem, fmt, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ - gLTB_( \ - timg, fmt, G_IM_SIZ_4b, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - G_DXT(G_IM_SIZ_4b, width), tmem, G_TX_RENDERTILE, \ - ((width) * 4 + 63) / 64) - -#define _gsDPLoadTextureBlock_4bS(timg, tmem, fmt, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ - gLTB_( \ - timg, fmt, G_IM_SIZ_4b, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - 0, tmem, G_TX_RENDERTILE, \ - ((width) * 4 + 63) / 64) - -#define _gsDPLoadTextureBlockYuv(timg, tmem, fmt, siz, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ - gLTB_( \ - timg, fmt, siz, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - G_DXT(siz, width), tmem, G_TX_RENDERTILE, \ - ((width) + 7) / 8) - -#define _gsDPLoadTextureBlockYuvS(timg, tmem, fmt, siz, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ - gLTB_( \ - timg, fmt, siz, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - 0, tmem, G_TX_RENDERTILE, \ - ((width) + 7) / 8) - -#define gsDPLoadMultiBlock(timg, tmem, rt, fmt, siz, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ - gLTB_( \ - timg, fmt, siz, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - G_DXT(siz, width), tmem, rt, \ - ((width) * G_SIZ_LDBITS(siz) + 63) / 64) - -#define gsDPLoadMultiBlockS(timg, tmem, rt, fmt, siz, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ - gLTB_( \ - timg, fmt, siz, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - 0, tmem, rt, \ - ((width) * G_SIZ_LDBITS(siz) + 63) / 64) - -#define gsDPLoadMultiBlock_4b(timg, tmem, rt, fmt, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ - gLTB_( \ - timg, fmt, G_IM_SIZ_4b, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - G_DXT(G_IM_SIZ_4b, width), tmem, rt, \ - ((width) * 4 + 63) / 64) - -#define gsDPLoadMultiBlock_4bS(timg, tmem, rt, fmt, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ - gLTB_( \ - timg, fmt, G_IM_SIZ_4b, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - 0, tmem, rt, \ - ((width) * 4 + 63) / 64) - -#define gsDPLoadMultiBlockYuv(timg, tmem, rt, fmt, siz, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ - gLTB_( \ - timg, fmt, siz, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - G_DXT(siz, width), tmem, rt, \ - ((width) + 7) / 8) - -#define gsDPLoadMultiBlockYuvS(timg, tmem, rt, fmt, siz, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ - gLTB_( \ - timg, fmt, siz, width, height, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - 0, tmem, rt, \ - ((width) + 7) / 8) - -#define gLTT_(timg, fmt, siz, width, height, uls, ult, lrs, lrt, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - tmem, rt, line) \ - gsDPSetTextureImage(fmt, siz, width, timg), \ - gsDPSetTile( \ - fmt, siz, line, tmem, \ - G_TX_LOADTILE, 0, \ - cmt, maskt, shiftt, \ - cms, masks, shifts), \ - gsDPLoadSync(), \ - gsDPLoadTile( \ - G_TX_LOADTILE, \ - qu102(uls), qu102(ult), \ - qu102(lrs), qu102(lrt)), \ - gsDPPipeSync(), \ - gsDPSetTile( \ - fmt, siz, line, \ - tmem, rt, pal, \ - cmt, maskt, shiftt, \ - cms, masks, shifts), \ - gsDPSetTileSize( \ - rt, \ - qu102(uls), qu102(ult), \ - qu102(lrs), qu102(lrt)) - -#define gLTT4_(timg, fmt, width, height, uls, ult, lrs, lrt, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - tmem, rt) \ - gsDPSetTextureImage(fmt, G_IM_SIZ_8b, (width) / 2, timg), \ - gsDPSetTile( \ - fmt, G_IM_SIZ_8b, \ - (((lrs) - (uls) + 1) / 2 + 7) / 8, \ - tmem, G_TX_LOADTILE, 0, \ - cmt, maskt, shiftt, \ - cms, masks, shifts), \ - gsDPLoadSync(), \ - gsDPLoadTile( \ - G_TX_LOADTILE, \ - qu102(uls) / 2, qu102(ult), \ - qu102(lrs) / 2, qu102(lrt)), \ - gsDPPipeSync(), \ - gsDPSetTile( \ - fmt, G_IM_SIZ_4b, \ - (((lrs) - (uls) + 1) / 2 + 7) / 8, \ - tmem, rt, pal, \ - cmt, maskt, shiftt, \ - cms, masks, shifts), \ - gsDPSetTileSize( \ - rt, \ - qu102(uls), qu102(ult), \ - qu102(lrs), qu102(lrt)) - -#define gsDPLoadTextureTile(timg, fmt, siz, width, height, \ - uls, ult, lrs, lrt, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ - gLTT_( \ - timg, fmt, siz, width, height, \ - uls, ult, lrs, lrt, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - 0x0, G_TX_RENDERTILE, \ - (((lrs) - (uls) + 1) * G_SIZ_LDBITS(siz) + 63) / 64) - -#define gsDPLoadTextureTile_4b(timg, fmt, width, height, \ - uls, ult, lrs, lrt, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ - gLTT4_( \ - timg, fmt, width, height, \ - uls, ult, lrs, lrt, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - 0x0, G_TX_RENDERTILE) - -#define gsDPLoadTextureTileYuv(timg, fmt, siz, width, height, \ - uls, ult, lrs, lrt, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ - gLTT_( \ - timg, fmt, siz, width, height, \ - uls, ult, lrs, lrt, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - 0x0, G_TX_RENDERTILE, \ - (((lrs) - (uls) + 1) + 7) / 8) - -#define _gsDPLoadTextureTile(timg, tmem, fmt, siz, width, height, \ - uls, ult, lrs, lrt, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ - gLTT_( \ - timg, fmt, siz, width, height, \ - uls, ult, lrs, lrt, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - tmem, G_TX_RENDERTILE, \ - (((lrs) - (uls) + 1) * G_SIZ_LDBITS(siz) + 63) / 64) - -#define _gsDPLoadTextureTile_4b(timg, tmem, fmt, width, height, \ - uls, ult, lrs, lrt, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ - gLTT4_( \ - timg, fmt, width, height, \ - uls, ult, lrs, lrt, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - tmem, G_TX_RENDERTILE) - -#define _gsDPLoadTextureTileYuv(timg, tmem, fmt, siz, width, height, \ - uls, ult, lrs, lrt, pal, cms, cmt, \ - masks, maskt, shifts, shiftt) \ - gLTT_( \ - timg, fmt, siz, width, height, \ - uls, ult, lrs, lrt, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - tmem, G_TX_RENDERTILE, \ - (((lrs) - (uls) + 1) + 7) / 8) - -#define gsDPLoadMultiTile(timg, tmem, rt, fmt, siz, width, height, \ - uls, ult, lrs, lrt, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ - gLTT_( \ - timg, fmt, siz, width, height, \ - uls, ult, lrs, lrt, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - tmem, rt, \ - (((lrs) - (uls) + 1) * G_SIZ_LDBITS(siz) + 63) / 64) - -#define gsDPLoadMultiTile_4b(timg, tmem, rt, fmt, width, height, \ - uls, ult, lrs, lrt, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ - gLTT4_( \ - timg, fmt, width, height, \ - uls, ult, lrs, lrt, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - tmem, rt) - -#define gsDPLoadMultiTileYuv(timg, tmem, rt, fmt, siz, width, height, \ - uls, ult, lrs, lrt, pal, \ - cms, cmt, masks, maskt, shifts, shiftt) \ - gLTT_( \ - timg, fmt, siz, width, height, \ - uls, ult, lrs, lrt, pal, \ - cms, cmt, masks, maskt, shifts, shiftt, \ - tmem, rt, \ - (((lrs) - (uls) + 1) + 7) / 8) - -#define gsDPLoadBlock(tile, uls, ult, lrs, dxt) \ - gO_( \ - G_LOADBLOCK, \ - gF_(uls, 12, 12) | \ - gF_(ult, 12, 0), \ - gF_(tile, 3, 24) | \ - gF_(G_LDBLK_TXL(lrs), 12, 12) | \ - gF_(dxt, 12, 0)) - -#define gsDPNoOp() \ - gsDPNoOpTag(0) - -#define gsDPNoOpTag(tag) \ - gO_(G_NOOP, 0, tag) - -#define gsDPPipelineMode(mode) \ - gsSPSetOtherModeHi(G_MDSFT_PIPELINE, G_MDSIZ_PIPELINE, mode) - -#define gsDPSetBlendColor(r, g, b, a) \ - gO_( \ - G_SETBLENDCOLOR, \ - 0, \ - gF_(r, 8, 24) | \ - gF_(g, 8, 16) | \ - gF_(b, 8, 8) | \ - gF_(a, 8, 0)) - -#define gsDPSetEnvColor(r, g, b, a) \ - gO_( \ - G_SETENVCOLOR, \ - 0, \ - gF_(r, 8, 24) | \ - gF_(g, 8, 16) | \ - gF_(b, 8, 8) | \ - gF_(a, 8, 0)) - -#define gsDPSetFillColor(c) \ - gO_(G_SETFILLCOLOR, 0, c) - -#define gsDPSetFogColor(r, g, b, a) \ - gO_( \ - G_SETFOGCOLOR, 0, \ - gF_(r, 8, 24) | \ - gF_(g, 8, 16) | \ - gF_(b, 8, 8) | \ - gF_(a, 8, 0)) - -#define gsDPSetPrimColor(m, l, r, g, b, a) \ - gO_( \ - G_SETPRIMCOLOR, \ - gF_(m, 8, 8) | \ - gF_(l, 8, 0), \ - gF_(r, 8, 24) | \ - gF_(g, 8, 16) | \ - gF_(b, 8, 8) | \ - gF_(a, 8, 0)) - -#define gsDPSetColorImage(fmt, siz, width, img) \ - gO_( \ - G_SETCIMG, \ - gF_(fmt, 3, 21) | \ - gF_(siz, 2, 19) | \ - gF_((width) - 1, 12, 0), \ - img) - -#define gsDPSetDepthImage(img) \ - gO_(G_SETZIMG, 0, img) - -#define gsDPSetTextureImage(fmt, siz, width, img) \ - gO_( \ - G_SETTIMG, \ - gF_(fmt, 3, 21) | \ - gF_(siz, 2, 19) | \ - gF_((width) - 1, 12, 0), \ - img) - -#define gsDPSetHilite1Tile(tile, hilite, width, height) \ - gsDPSetTileSize( \ - tile, \ - ((Hilite *)(hilite))->h.x1 & 0xFFF, \ - ((Hilite *)(hilite))->h.y1 & 0xFFF, \ - (((width) - 1) * 4 + ((Hilite *)(hilite))->h.x1) & 0xFFF, \ - (((height) - 1) * 4 + ((Hilite *)(hilite))->h.y1) & 0xFFF) - -#define gsDPSetHilite2Tile(tile, hilite, width, height) \ - gsDPSetTileSize( \ - tile, \ - ((Hilite *)(hilite))->h.x2 & 0xFFF, \ - ((Hilite *)(hilite))->h.y2 & 0xFFF, \ - (((width) - 1) * 4 + ((Hilite *)(hilite))->h.x2) & 0xFFF, \ - (((height) - 1) * 4 + ((Hilite *)(hilite))->h.y2) & 0xFFF) - -#define gsDPSetAlphaCompare(mode) \ - gsSPSetOtherModeLo(G_MDSFT_ALPHACOMPARE, G_MDSIZ_ALPHACOMPARE, mode) - -#define gsDPSetAlphaDither(type) \ - gsSPSetOtherModeHi(G_MDSFT_ALPHADITHER, G_MDSIZ_ALPHADITHER, type) - -#define gsDPSetColorDither(type) \ - gsSPSetOtherModeHi(G_MDSFT_RGBDITHER, G_MDSIZ_RGBDITHER, type) - -#define gsDPSetCombineMode(mode1, mode2) \ - gsDPSetCombineLERP(mode1, mode2) - -#define gsDPSetCombineLERP(a0, b0, c0, d0, Aa0, Ab0, Ac0, Ad0, \ - a1, b1, c1, d1, Aa1, Ab1, Ac1, Ad1) \ - gO_( \ - G_SETCOMBINE, \ - gF_(G_CCMUX_##a0, 4, 20) | \ - gF_(G_CCMUX_##c0, 5, 15) | \ - gF_(G_ACMUX_##Aa0, 3, 12) | \ - gF_(G_ACMUX_##Ac0, 3, 9) | \ - gF_(G_CCMUX_##a1, 4, 5) | \ - gF_(G_CCMUX_##c1, 5, 0), \ - gF_(G_CCMUX_##b0, 4, 28) | \ - gF_(G_CCMUX_##b1, 4, 24) | \ - gF_(G_ACMUX_##Aa1, 3, 21) | \ - gF_(G_ACMUX_##Ac1, 3, 18) | \ - gF_(G_CCMUX_##d0, 3, 15) | \ - gF_(G_ACMUX_##Ab0, 3, 12) | \ - gF_(G_ACMUX_##Ad0, 3, 9) | \ - gF_(G_CCMUX_##d1, 3, 6) | \ - gF_(G_ACMUX_##Ab1, 3, 3) | \ - gF_(G_ACMUX_##Ad1, 3, 0)) - -#define gsDPSetConvert(k0, k1, k2, k3, k4, k5) \ - gO_( \ - G_SETCONVERT, \ - gF_(k0, 9, 13) | \ - gF_(k1, 9, 4) | \ - gF_(gI_(k2) >> 5, 4, 0), \ - gF_(k2, 5, 27) | \ - gF_(k3, 9, 18) | \ - gF_(k4, 9, 9) | \ - gF_(k5, 9, 0)) - -#define gsDPSetTextureConvert(type) \ - gsSPSetOtherModeHi(G_MDSFT_TEXTCONV, G_MDSIZ_TEXTCONV, type) - -#define gsDPSetCycleType(type) \ - gsSPSetOtherModeHi(G_MDSFT_CYCLETYPE, G_MDSIZ_CYCLETYPE, type) - -#define gsDPSetDepthSource(source) \ - gsSPSetOtherModeLo(G_MDSFT_ZSRCSEL, G_MDSIZ_ZSRCSEL, source) - -#define gsDPSetCombineKey(type) \ - gsSPSetOtherModeHi(G_MDSFT_COMBKEY, G_MDSIZ_COMBKEY, type) - -#define gsDPSetKeyGB(cG, sG, wG, cB, sB, wB) \ - gO_( \ - G_SETKEYGB, \ - gF_(wG, 12, 12) | \ - gF_(wB, 12, 0), \ - gF_(cG, 8, 24) | \ - gF_(sG, 8, 16) | \ - gF_(cB, 8, 8) | \ - gF_(sB, 8, 0)) - -#define gsDPSetKeyR(cR, sR, wR) \ - gO_( \ - G_SETKEYR, 0, \ - gF_(wR, 12, 16) | \ - gF_(cR, 8, 8) | \ - gF_(sR, 8, 0)) - -#define gsDPSetPrimDepth(z, dz) \ - gO_( \ - G_SETPRIMDEPTH, \ - 0, \ - gF_(z, 16, 16) | \ - gF_(dz, 16, 0)) - -#define gsDPSetRenderMode(mode1, mode2) \ - gsSPSetOtherModeLo( \ - G_MDSFT_RENDERMODE, \ - G_MDSIZ_RENDERMODE, \ - gI_(mode1) | \ - gI_(mode2)) - -#define gsDPSetScissor(mode, ulx, uly, lrx, lry) \ - gsDPSetScissorFrac( \ - mode, \ - qu102(gI_(ulx)), \ - qu102(gI_(uly)), \ - qu102(gI_(lrx)), \ - qu102(gI_(lry))) - -#define gsDPSetScissorFrac(mode, ulx, uly, lrx, lry) \ - gO_( \ - G_SETSCISSOR, \ - gF_(ulx, 12, 12) | \ - gF_(uly, 12, 0), \ - gF_(mode, 2, 24) | \ - gF_(lrx, 12, 12) | \ - gF_(lry, 12, 0)) - -#define gsDPSetTextureDetail(type) \ - gsSPSetOtherModeHi(G_MDSFT_TEXTDETAIL, G_MDSIZ_TEXTDETAIL, type) - -#define gsDPSetTextureFilter(mode) \ - gsSPSetOtherModeHi(G_MDSFT_TEXTFILT, G_MDSIZ_TEXTFILT, mode) - -#define gsDPSetTextureLOD(mode) \ - gsSPSetOtherModeHi(G_MDSFT_TEXTLOD, G_MDSIZ_TEXTLOD, mode) - -#define gsDPSetTextureLUT(mode) \ - gsSPSetOtherModeHi(G_MDSFT_TEXTLUT, G_MDSIZ_TEXTLUT, mode) - -#define gsDPSetTexturePersp(enable) \ - gsSPSetOtherModeHi(G_MDSFT_TEXTPERSP, G_MDSIZ_TEXTPERSP, enable) - -#define gsDPSetTile(fmt, siz, line, tmem, tile, palette, \ - cmt, maskt, shiftt, cms, masks, shifts) \ - gO_( \ - G_SETTILE, \ - gF_(fmt, 3, 21) | \ - gF_(siz, 2, 19) | \ - gF_(line, 9, 9) | \ - gF_(tmem, 9, 0), \ - gF_(tile, 3, 24) | \ - gF_(palette, 4, 20) | \ - gF_(cmt, 2, 18) | \ - gF_(maskt, 4, 14) | \ - gF_(shiftt, 4, 10) | \ - gF_(cms, 2, 8) | \ - gF_(masks, 4, 4) | \ - gF_(shifts, 4, 0)) - -#define gsDPSetTileSize(tile, uls, ult, lrs, lrt) \ - gO_( \ - G_SETTILESIZE, \ - gF_(uls, 12, 12) | \ - gF_(ult, 12, 0), \ - gF_(tile, 3, 24) | \ - gF_(lrs, 12, 12) | \ - gF_(lrt, 12, 0)) - -#define gsSPBranchList(dl) \ - gsDisplayList(dl, 1) - -#define gsSPClipRatio(r) \ - gsMoveWd(G_MW_CLIP, G_MWO_CLIP_RNX, (uint16_t)(r)), \ - gsMoveWd(G_MW_CLIP, G_MWO_CLIP_RNY, (uint16_t)(r)), \ - gsMoveWd(G_MW_CLIP, G_MWO_CLIP_RPX, (uint16_t)-(r)), \ - gsMoveWd(G_MW_CLIP, G_MWO_CLIP_RPY, (uint16_t)-(r)) - -#define gsSPDisplayList(dl) \ - gsDisplayList(dl, 0) - -#define gsSPEndDisplayList() \ - gO_(G_ENDDL, 0, 0) - -#define gsSPFogFactor(fm, fo) \ - gsMoveWd( \ - G_MW_FOG, \ - G_MWO_FOG, \ - gF_(fm, 16, 16) | \ - gF_(fo, 16, 0)) - -#define gsSPFogPosition(min, max) \ - gsSPFogFactor( \ - (500 * 0x100) / ((max) - (min)), \ - (500 - (min)) * 0x100 / ((max) - (min))) - -#define gsSPLine3D(v0, v1, flag) \ - gsSPLineW3D(v0, v1, 0, flag) - -#define gsSPLookAt(l) \ - gsSPLookAtX(l), \ - gsSPLookAtY(gI_(l) + 0x10) - -#define gsSPSegment(seg, base) \ - gsMoveWd(G_MW_SEGMENT, (seg) * 4, base) - -#define gsSPSetLights0(lites) \ - gsSPNumLights(NUMLIGHTS_0), \ - gsSPLight(&(lites).l[0], 1), \ - gsSPLight(&(lites).a, 2) - -#define gsSPSetLights1(lites) \ - gsSPNumLights(NUMLIGHTS_1), \ - gsSPLight(&(lites).l[0], 1), \ - gsSPLight(&(lites).a, 2) - -#define gsSPSetLights2(lites) \ - gsSPNumLights(NUMLIGHTS_2), \ - gsSPLight(&(lites).l[0], 1), \ - gsSPLight(&(lites).l[1], 2), \ - gsSPLight(&(lites).a, 3) - -#define gsSPSetLights3(lites) \ - gsSPNumLights(NUMLIGHTS_3), \ - gsSPLight(&(lites).l[0], 1), \ - gsSPLight(&(lites).l[1], 2), \ - gsSPLight(&(lites).l[2], 3), \ - gsSPLight(&(lites).a, 4) - -#define gsSPSetLights4(lites) \ - gsSPNumLights(NUMLIGHTS_4), \ - gsSPLight(&(lites).l[0], 1), \ - gsSPLight(&(lites).l[1], 2), \ - gsSPLight(&(lites).l[2], 3), \ - gsSPLight(&(lites).l[3], 4), \ - gsSPLight(&(lites).a, 5) - -#define gsSPSetLights5(lites) \ - gsSPNumLights(NUMLIGHTS_5), \ - gsSPLight(&(lites).l[0], 1), \ - gsSPLight(&(lites).l[1], 2), \ - gsSPLight(&(lites).l[2], 3), \ - gsSPLight(&(lites).l[3], 4), \ - gsSPLight(&(lites).l[4], 5), \ - gsSPLight(&(lites).a, 6) - -#define gsSPSetLights6(lites) \ - gsSPNumLights(NUMLIGHTS_6), \ - gsSPLight(&(lites).l[0], 1), \ - gsSPLight(&(lites).l[1], 2), \ - gsSPLight(&(lites).l[2], 3), \ - gsSPLight(&(lites).l[3], 4), \ - gsSPLight(&(lites).l[4], 5), \ - gsSPLight(&(lites).l[5], 6), \ - gsSPLight(&(lites).a, 7) - -#define gsSPSetLights7(lites) \ - gsSPNumLights(NUMLIGHTS_7), \ - gsSPLight(&(lites).l[0], 1), \ - gsSPLight(&(lites).l[1], 2), \ - gsSPLight(&(lites).l[2], 3), \ - gsSPLight(&(lites).l[3], 4), \ - gsSPLight(&(lites).l[4], 5), \ - gsSPLight(&(lites).l[5], 6), \ - gsSPLight(&(lites).l[6], 7), \ - gsSPLight(&(lites).a, 8) - -#define gsSPSetStatus(sid, val) \ - gsMoveWd(G_MW_GENSTAT, sid, val) - -#define gsSPNumLights(n) \ - gsMoveWd(G_MW_NUMLIGHT, G_MWO_NUMLIGHT, NUML(n)) - -#define gsSPLightColor(Lightnum, packedcolor) \ - gsMoveWd(G_MW_LIGHTCOL, G_MWO_a##Lightnum, packedcolor), \ - gsMoveWd(G_MW_LIGHTCOL, G_MWO_b##Lightnum, packedcolor) - -#define gsSPTextureRectangle(ulx, uly, lrx, lry, tile, s, t, dsdx, dtdy) \ - gsTexRect(ulx, uly, lrx, lry, tile), \ - gsDPHalf1(gF_(s, 16, 16) | gF_(t, 16, 0)), \ - gsDPHalf2(gF_(dsdx, 16, 16) | gF_(dtdy, 16, 0)) - -#define gsSPScisTextureRectangle(ulx, uly, lrx, lry, tile, s, t, dsdx, dtdy) \ - gsTexRect(gScC_(ulx), gScC_(uly), gScC_(lrx), gScC_(lry), tile), \ - gsDPHalf1( \ - gF_(gScD_(s, ulx, dsdx), 16, 16) | \ - gF_(gScD_(t, uly, dtdy), 16, 0)), \ - gsDPHalf2(gF_(dsdx, 16, 16) | gF_(dtdy, 16, 0)) - -#define gsSPTextureRectangleFlip(ulx, uly, lrx, lry, tile, s, t, dsdx, dtdy) \ - gsTexRectFlip(ulx, uly, lrx, lry, tile), \ - gsDPHalf1(gF_(s, 16, 16) | gF_(t, 16, 0)), \ - gsDPHalf2(gF_(dsdx, 16, 16) | gF_(dtdy, 16, 0)) - -#define gsSPScisTextureRectangleFlip( \ - ulx, uly, lrx, lry, tile, s, t, dsdx, dtdy) \ - gsTexRectFlip(gScC_(ulx), gScC_(uly), gScC_(lrx), gScC_(lry), tile), \ - gsDPHalf1( \ - gF_(gScD_(s, ulx, dsdx), 16, 16) | \ - gF_(gScD_(t, uly, dtdy), 16, 0)), \ - gsDPHalf2(gF_(dsdx, 16, 16) | gF_(dtdy, 16, 0)) - -#define gsSPBgRectCopy(bg) \ - gO_(G_BG_COPY, 0, bg) - -#define gsSPBgRect1Cyc(bg) \ - gO_(G_BG_1CYC, 0, bg) - -#define gsSPObjRectangle(sp) \ - gO_(G_OBJ_RECTANGLE, 0, sp) - -#define gsSPObjRectangleR(sp) \ - gO_(G_OBJ_RECTANGLE_R, 0, sp) - -#define gsSPObjSprite(sp) \ - gO_(G_OBJ_SPRITE, 0, sp) - -#define gsSPObjMatrix(mtx) \ - gO_( \ - G_OBJ_MOVEMEM, \ - gF_(sizeof(uObjMtx) - 1, 8, 16), \ - mtx) - -#define gsSPObjSubMatrix(mtx) \ - gO_( \ - G_OBJ_MOVEMEM, \ - gF_(sizeof(uObjSubMtx) - 1, 8, 16) | \ - gF_(2, 16, 0), \ - mtx) - -#define gsSPObjRenderMode(mode) \ - gO_(G_OBJ_RENDERMODE, 0, mode) - -#define gsSPObjLoadTxtr(tx) \ - gO_(G_OBJ_LOADTXTR, 23, tx) - -#define gsSPObjLoadTxRect(txsp) \ - gO_(G_OBJ_LDTX_RECT, 47, txsp) - -#define gsSPObjLoadTxRectR(txsp) \ - gO_(G_OBJ_LDTX_RECT_R, 47, txsp) - -#define gsSPObjLoadTxSprite(txsp) \ - gO_(G_OBJ_LDTX_SPRITE, 47, txsp) - -#define gsSPSelectDL(ldl, sid, flag, mask) \ - gO_( \ - G_RDPHALF_0, \ - gF_(sid, 8, 16) | \ - gF_(ldl, 16, 0), \ - flag), \ - gO_( \ - G_SELECT_DL, \ - gF_(0x00, 8, 16) | \ - gF_(gI_(ldl) >> 16, 16, 0), \ - mask) - -#define gsSPSelectBranchDL(bdl, sid, flag, mask) \ - gO_( \ - G_RDPHALF_0, \ - gF_(sid, 8, 16) | \ - gF_(bdl, 16, 0), \ - flag), \ - gO_( \ - G_SELECT_DL, \ - gF_(0x01, 8, 16) | \ - gF_(gI_(bdl) >> 16, 16, 0), \ - mask) - -/* unlisted instructions */ - -#define gsDPLoadTLUTCmd(tile, count) \ - gO_( \ - G_LOADTLUT, \ - 0, \ - gF_(tile, 3, 24) | \ - gF_(count, 10, 14)) - -#define gsDPLoadTLUT(count, tmem, dram) \ - gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, dram), \ - gsDPTileSync(), \ - gsDPSetTile(0, 0, 0, tmem, G_TX_LOADTILE, 0, 0, 0, 0, 0, 0, 0), \ - gsDPLoadSync(), \ - gsDPLoadTLUTCmd(G_TX_LOADTILE, (count) - 1), \ - gsDPPipeSync() - -#define gsDisplayList(dl, branch) \ - gO_(G_DL, gF_(branch, 8, 16), dl) - -#define gsDPLoadTile(tile, uls, ult, lrs, lrt) \ - gO_( \ - G_LOADTILE, \ - gF_(uls, 12, 12) | \ - gF_(ult, 12, 0), \ - gF_(tile, 3, 24) | \ - gF_(lrs, 12, 12) | \ - gF_(lrt, 12, 0)) - -#define gsDPSetCombine(c) \ - gO_( \ - G_SETCOMBINE, \ - (gL_(c) >> 32) & 0xFFFFFFFF, \ - (gL_(c) >> 0) & 0xFFFFFFFF) - -#define gsSPSetOtherModeLo(shift, length, data) \ - gsSPSetOtherMode(G_SETOTHERMODE_L, shift, length, data) - -#define gsSPSetOtherModeHi(shift, length, data) \ - gsSPSetOtherMode(G_SETOTHERMODE_H, shift, length, data) - -#define gsDPSetOtherMode(mode0, mode1) \ - gO_(G_RDPSETOTHERMODE, gF_(mode0, 24, 0), mode1) - -#define gsTexRect(ulx, uly, lrx, lry, tile) \ - gO_( \ - G_TEXRECT, \ - gF_(lrx, 12, 12) | \ - gF_(lry, 12, 0), \ - gF_(tile, 3, 24) | \ - gF_(ulx, 12, 12) | \ - gF_(uly, 12, 0)) - -#define gsTexRectFlip(ulx, uly, lrx, lry, tile) \ - gO_( \ - G_TEXRECTFLIP, \ - gF_(lrx, 12, 12) | \ - gF_(lry, 12, 0), \ - gF_(tile, 3, 24) | \ - gF_(ulx, 12, 12) | \ - gF_(uly, 12, 0)) - -#define gsSPNoOp() \ - gO_(G_SPNOOP, 0, 0) - -#define gsDPHalf1(wordhi) \ - gO_(G_RDPHALF_1, 0, wordhi) - -#define gsDPHalf2(wordlo) \ - gO_(G_RDPHALF_2, 0, wordlo) - -#define gsDPWord(wordhi, wordlo) \ - gsDPHalf1(wordhi), \ - gsDPHalf2(wordlo) - -/* instruction macros for fast3d */ - -#if defined(F3D_GBI) - -# define gsSP1Triangle(v0, v1, v2, flag) \ - gO_( \ - G_TRI1, \ - 0, \ - gF_(flag, 8, 24) | \ - gF_(gI_(v0) * 10, 8, 16) | \ - gF_(gI_(v1) * 10, 8, 8) | \ - gF_(gI_(v2) * 10, 8, 0)) - -# define gsSPCullDisplayList(v0, vn) \ - gO_( \ - G_CULLDL, \ - (gI_(v0) & 0xF) * 40, \ - gI_((vn) + 1) & 0xF) * 40) - -# define gsSPLineW3D(v0, v1, wd, flag) \ - gO_( \ - G_LINE3D, \ - 0, \ - gF_(flag, 8, 24) | \ - gF_(gI_(v0) * 10, 8, 16) | \ - gF_(gI_(v1) * 10, 8, 8) | \ - gF_(wd, 8, 0)) - -# define gsSPVertex(v, n, v0) \ - gO_( \ - G_VTX, \ - gF_((n) - 1, 4, 20) | \ - gF_(v0, 4, 16) | \ - gF_(sizeof(Vtx) * (n), 16, 0), \ - v) - -#endif - -/* instruction macros for fast3d and beta f3dex */ -#if defined(F3D_GBI) || (defined(F3D_BETA) && defined(F3DEX_GBI)) - -# define gsSPModifyVertex(vtx, where, val) \ - gsMoveWd(G_MW_POINTS, (vtx) * 40 + (where), val) - -#endif - -/* instruction macros for fast3d and f3dex */ - -#if defined(F3D_GBI) || defined(F3DEX_GBI) - -# define gsSPForceMatrix(mptr) \ - gsMoveMem(16, G_MV_MATRIX_1, (char *)(mptr)), \ - gsMoveMem(16, G_MV_MATRIX_2, (char *)(mptr) + 16), \ - gsMoveMem(16, G_MV_MATRIX_3, (char *)(mptr) + 32), \ - gsMoveMem(16, G_MV_MATRIX_4, (char *)(mptr) + 48) - -# define gsSPSetGeometryMode(mode) \ - gO_(G_SETGEOMETRYMODE, 0, gI_(mode)) - -# define gsSPClearGeometryMode(mode) \ - gO_(G_CLEARGEOMETRYMODE, 0, gI_(mode)) - -# define gsSPLoadGeometryMode(mode) \ - gsSPClearGeometryMode(~gI_(0)), \ - gsSPSetGeometryMode(mode) - -# define gsSPInsertMatrix(where, num) \ - gsMoveWd(G_MW_MATRIX, where, num) - -# define gsSPLookAtX(l) \ - gsMoveMem(sizeof(Light), G_MV_LOOKATX, l) - -# define gsSPLookAtY(l) \ - gsMoveMem(sizeof(Light), G_MV_LOOKATY, l) - -# define gsSPMatrix(matrix, param) \ - gO_( \ - G_MTX, \ - gF_(param, 8, 16) | \ - gF_(sizeof(Mtx), 16, 0), \ - matrix) - -# define gsSPPopMatrix(param) \ - gO_(G_POPMTX, 0, param) - -# define gsSPLight(l, n) \ - gsMoveMem(sizeof(Light), G_MV_L0 + ((n) - 1) * 2, l) - -# define gsSPTexture(sc, tc, level, tile, on) \ - gO_( \ - G_TEXTURE, \ - gF_(level, 3, 11) | \ - gF_(tile, 3, 8) | \ - gF_(on, 8, 0), \ - gF_(sc, 16, 16) | \ - gF_(tc, 16, 0)) - -# define gsSPViewport(v) \ - gsMoveMem(sizeof(Vp), G_MV_VIEWPORT, v) - -# define gsSPSetOtherMode(opc, shift, length, data) \ - gO_( \ - opc, \ - gF_(shift, 8, 8) | \ - gF_(length, 8, 0), \ - data) - -# define gsMoveWd(index, offset, data) \ - gO_( \ - G_MOVEWORD, \ - gF_(offset, 16, 8) | \ - gF_(index, 8, 0), \ - data) - -# define gsMoveMem(size, index, address) \ - gO_( \ - G_MOVEMEM, \ - gF_(index, 8, 16) | \ - gF_(size, 16, 0), \ - address) - -#endif - -/* instruction macros for f3dex */ - -#if defined(F3DEX_GBI) - -# define gsSP1Triangle(v0, v1, v2, flag) \ - gO_( \ - G_TRI1, \ - 0, \ - gF_(gV3_(v0, v1, v2, flag) * 2, 8, 16) | \ - gF_(gV3_(v1, v2, v0, flag) * 2, 8, 8) | \ - gF_(gV3_(v2, v0, v1, flag) * 2, 8, 0)) - -# define gsSP1Quadrangle(v0, v1, v2, v3, flag) \ - gO_( \ - G_TRI2, \ - gF_(gV4_(v0, v1, v2, v3, flag) * 2, 8, 16) | \ - gF_(gV4_(v1, v2, v3, v0, flag) * 2, 8, 8) | \ - gF_(gV4_(v2, v3, v0, v1, flag) * 2, 8, 0), \ - gF_(gV4_(v0, v1, v2, v3, flag) * 2, 8, 16) | \ - gF_(gV4_(v2, v3, v0, v1, flag) * 2, 8, 8) | \ - gF_(gV4_(v3, v0, v1, v2, flag) * 2, 8, 0)) - -# define gsSPLineW3D(v0, v1, wd, flag) \ - gO_( \ - G_LINE3D, \ - 0, \ - gF_(gV2_(v0, v1, flag) * 2, 8, 16) | \ - gF_(gV2_(v1, v0, flag) * 2, 8, 8) | \ - gF_(wd, 8, 0)) - -# define gsSPVertex(v, n, v0) \ - gO_( \ - G_VTX, \ - gF_((v0) * 2, 8, 16) | \ - gF_(n, 6, 10) | \ - gF_(sizeof(Vtx) * (n) - 1, 10, 0), \ - v) - -#endif - -/* instruction macros for f3dex and f3dex2 */ - -#if defined(F3DEX_GBI) || defined(F3DEX_GBI_2) - -# define gsSP2Triangles(v00, v01, v02, flag0, v10, v11, v12, flag1) \ - gO_( \ - G_TRI2, \ - gF_(gV3_(v00, v01, v02, flag0) * 2, 8, 16) | \ - gF_(gV3_(v01, v02, v00, flag0) * 2, 8, 8) | \ - gF_(gV3_(v02, v00, v01, flag0) * 2, 8, 0), \ - gF_(gV3_(v10, v11, v12, flag1) * 2, 8, 16) | \ - gF_(gV3_(v11, v12, v10, flag1) * 2, 8, 8) | \ - gF_(gV3_(v12, v10, v11, flag1) * 2, 8, 0)) - -# define gsSPBranchLessZ(branchdl, vtx, zval, near, far, flag) \ - gsSPBranchLessZrg(branchdl, vtx, zval, near, far, flag, 0, G_MAXZ) - -# define gsSPBranchLessZrg(branchdl, vtx, zval, near, far, flag, zmin, zmax) \ - gsSPBranchLessZraw(branchdl, vtx, \ - G_DEPTOZSrg(zval, near, far, flag, zmin, zmax)) - -# define gsSPBranchLessZraw(branchdl, vtx, zval) \ - gsDPHalf1(branchdl), \ - gsBranchZ(vtx, zval) - -# define gsSPCullDisplayList(v0, vn) \ - gO_( \ - G_CULLDL, \ - gF_((v0) * 2, 16, 0), \ - gF_((vn) * 2, 16, 0)) - -# define gsSPLoadUcode(uc_start, uc_dstart) \ - gsSPLoadUcodeEx(uc_start, uc_dstart, 0x800) - -# define gsSPLoadUcodeL(ucode) \ - gsSPLoadUcode( \ - gI_(&ucode##TextStart) & 0x1FFFFFFF, \ - gI_(&ucode##DataStart) & 0x1FFFFFFF) - -# if !(defined(F3D_BETA) && defined(F3DEX_GBI)) -# define gsSPModifyVertex(vtx, where, val) \ - gO_( \ - G_MODIFYVTX, \ - gF_(where, 8, 16) | \ - gF_((vtx) * 2, 16, 0), \ - val) -# endif - -# define gsBranchZ(vtx, zval) \ - gO_( \ - G_BRANCH_Z, \ - gF_((vtx) * 5, 12, 12) | \ - gF_((vtx) * 2, 12, 0), \ - zval) - -# define gsLoadUcode(uc_start, uc_dsize) \ - gO_( \ - G_LOAD_UCODE, \ - gF_((uc_dsize) - 1, 16, 0), \ - uc_start) - -# define gsSPLoadUcodeEx(uc_start, uc_dstart, uc_dsize) \ - gsDPHalf1(uc_dstart), \ - gsLoadUcode(uc_start, uc_dsize) - -#endif - -/* instruction macros for f3dex2 */ - -#if defined(F3DEX_GBI_2) - -# define gsSP1Triangle(v0, v1, v2, flag) \ - gO_( \ - G_TRI1, \ - gF_(gV3_(v0, v1, v2, flag) * 2, 8, 16) | \ - gF_(gV3_(v1, v2, v0, flag) * 2, 8, 8) | \ - gF_(gV3_(v2, v0, v1, flag) * 2, 8, 0), \ - 0) - -# define gsSP1Quadrangle(v0, v1, v2, v3, flag) \ - gO_( \ - G_QUAD, \ - gF_(gV4_(v0, v1, v2, v3, flag) * 2, 8, 16) | \ - gF_(gV4_(v1, v2, v3, v0, flag) * 2, 8, 8) | \ - gF_(gV4_(v2, v3, v0, v1, flag) * 2, 8, 0), \ - gF_(gV4_(v0, v1, v2, v3, flag) * 2, 8, 16) | \ - gF_(gV4_(v2, v3, v0, v1, flag) * 2, 8, 8) | \ - gF_(gV4_(v3, v0, v1, v2, flag) * 2, 8, 0)) - -# define gsSPForceMatrix(mptr) \ - gsMoveMem(sizeof(Mtx), G_MV_MATRIX, 0, mptr), \ - gsMoveWd(G_MW_FORCEMTX, 0, 0x10000) - -# define gsSPSetGeometryMode(mode) \ - gsSPGeometryMode(0, mode) - -# define gsSPClearGeometryMode(mode) \ - gsSPGeometryMode(mode, 0) - -# define gsSPLoadGeometryMode(mode) \ - gsSPGeometryMode(~gI_(0), mode) - -# define gsSPLineW3D(v0, v1, wd, flag) \ - gO_( \ - G_LINE3D, \ - gF_(gV2_(v0, v1, flag) * 2, 8, 16) | \ - gF_(gV2_(v1, v0, flag) * 2, 8, 8) | \ - gF_(wd, 8, 0), \ - 0) - -# define gsSPLookAtX(l) \ - gsMoveMem(sizeof(Light), G_MV_LIGHT, G_MVO_LOOKATX, l) - -# define gsSPLookAtY(l) \ - gsMoveMem(sizeof(Light), G_MV_LIGHT, G_MVO_LOOKATY, l) - -# define gsSPMatrix(matrix, param) \ - gO_( \ - G_MTX, \ - gF_((sizeof(Mtx) - 1) / 8, 5, 19) | \ - gF_(gI_(param) ^ G_MTX_PUSH, 8, 0), \ - matrix) - -# define gsSPPopMatrix(param) \ - gsSPPopMatrixN(param, 1) - -# define gsSPPopMatrixN(param, n) \ - gO_( \ - G_POPMTX, \ - gF_((sizeof(Mtx) - 1) / 8, 5, 19) | \ - gF_(2, 8, 0), \ - sizeof(Mtx) * (n)) - -# define gsSPLight(l, n) \ - gsMoveMem(sizeof(Light), G_MV_LIGHT, ((n) + 1) * 0x18, l) - -# define gsSPTexture(sc, tc, level, tile, on) \ - gO_( \ - G_TEXTURE, \ - gF_(level, 3, 11) | \ - gF_(tile, 3, 8) | \ - gF_(on, 7, 1), \ - gF_(sc, 16, 16) | \ - gF_(tc, 16, 0)) - -# define gsSPVertex(v, n, v0) \ - gO_( \ - G_VTX, \ - gF_(n, 8, 12) | \ - gF_((v0) + (n), 7, 1), \ - v) - -# define gsSPViewport(v) \ - gsMoveMem(sizeof(Vp), G_MV_VIEWPORT, 0, v) - -# define gsSPGeometryMode(clearbits, setbits) \ - gO_( \ - G_GEOMETRYMODE, \ - gF_(~gI_(clearbits), 24, 0), \ - setbits) - -# define gsSPSetOtherMode(opc, shift, length, data) \ - gO_( \ - opc, \ - gF_(32 - (shift) - (length), 8, 8) | \ - gF_((length) - 1, 8, 0), \ - data) - -# define gsMoveWd(index, offset, data) \ - gO_( \ - G_MOVEWORD, \ - gF_(index, 8, 16) | \ - gF_(offset, 16, 0), \ - data) - -# define gsMoveMem(size, index, offset, address) \ - gO_( \ - G_MOVEMEM, \ - gF_((size - 1) / 8, 5, 19) | \ - gF_((offset) / 8, 8, 8) | \ - gF_(index, 8, 0), \ - address) - -# define gsSPDma_io(flag, dmem, dram, size) \ - gO_( \ - G_DMA_IO, \ - gF_(flag, 1, 23) | \ - gF_((dmem) / 8, 10, 13) | \ - gF_((size) - 1, 12, 0), \ - dram) - -# define gsSPDmaRead(dmem, dram, size) \ - gsSPDma_io(0, dmem, dram, size) - -# define gsSPDmaWrite(dmem, dram, size) \ - gsSPDma_io(1, dmem, dram, size) - -# define gsSpecial3(hi, lo) \ - gO_(G_SPECIAL_3, hi, lo) - -# define gsSpecial2(hi, lo) \ - gO_(G_SPECIAL_2, hi, lo) - -# define gsSpecial1(hi, lo) \ - gO_(G_SPECIAL_1, hi, lo) - -#endif - -/* instruction macros for beta fast3d and f3dex */ - -#if defined(F3D_BETA) && (defined(F3D_GBI) || defined(F3DEX_GBI)) - -# define gsSPPerspNormalize(scale) \ - gO_(G_PERSPNORM, 0, scale) - -#else - -# define gsSPPerspNormalize(scale) \ - gsMoveWd(G_MW_PERSPNORM, 0, scale) - -#endif - -/* dynamic instruction macros */ - -#define gDisplayListPut(gdl, ...) \ - ({ \ - Gfx Gd_[] = {__VA_ARGS__}; \ - for(size_t Gi_ = 0; Gi_ < sizeof(Gd_) / sizeof(Gfx); Gi_++) \ - { \ - *(Gfx *)(gdl) = Gd_[Gi_]; \ - } \ - (void)0; \ - }) -#define gDisplayListAppend(pgdl, ...) \ - ({ \ - Gfx Gd_[] = {__VA_ARGS__}; \ - for(size_t Gi_ = 0; Gi_ < sizeof(Gd_) / sizeof(Gfx); Gi_++) \ - { \ - *(*(Gfx **)(pgdl))++ = Gd_[Gi_]; \ - } \ - (void)0; \ - }) -#define gDisplayListData(pgdl, d) \ - ({ \ - Gfx **Gp_ = (void *)(pgdl); \ - struct \ - { \ - __typeof__(d) v; \ - } *Gd_, *Gs_; \ - *Gp_ -= (sizeof(*Gd_) + sizeof(Gfx) - 1) / sizeof(Gfx); \ - Gd_ = (void *)*Gp_; \ - Gs_ = (void *)&(d); \ - *Gd_ = *Gs_; \ - &Gd_->v; \ - }) -#define gDisplayListAlloc(pgdl, s) \ - ({ \ - Gfx **Gp_ = (void *)(pgdl); \ - *Gp_ -= ((s) + sizeof(Gfx) - 1) / sizeof(Gfx); \ - (void *)*Gp_; \ - }) - -#define gDPFillRectangle(gdl, ...) \ - gD_(gdl, gsDPFillRectangle, __VA_ARGS__) -#define gDPScisFillRectangle(gdl, ...) \ - gD_(gdl, gsDPScisFillRectangle, __VA_ARGS__) -#define gDPFullSync(gdl) \ - gDisplayListPut(gdl, gsDPFullSync()) -#define gDPLoadSync(gdl) \ - gDisplayListPut(gdl, gsDPLoadSync()) -#define gDPTileSync(gdl) \ - gDisplayListPut(gdl, gsDPTileSync()) -#define gDPPipeSync(gdl) \ - gDisplayListPut(gdl, gsDPPipeSync()) -#define gDPLoadTLUT_pal16(gdl, ...) \ - gD_(gdl, gsDPLoadTLUT_pal16, __VA_ARGS__) -#define gDPLoadTLUT_pal256(gdl, ...) \ - gD_(gdl, gsDPLoadTLUT_pal256, __VA_ARGS__) -#define gDPLoadTextureBlock(gdl, ...) \ - gD_(gdl, gsDPLoadTextureBlock, __VA_ARGS__) -#define gDPLoadTextureBlockS(gdl, ...) \ - gD_(gdl, gsDPLoadTextureBlockS, __VA_ARGS__) -#define gDPLoadTextureBlock_4b(gdl, ...) \ - gD_(gdl, gsDPLoadTextureBlock_4b, __VA_ARGS__) -#define gDPLoadTextureBlock_4bS(gdl, ...) \ - gD_(gdl, gsDPLoadTextureBlock_4bS, __VA_ARGS__) -#define gDPLoadTextureBlockYuv(gdl, ...) \ - gD_(gdl, gsDPLoadTextureBlockYuv, __VA_ARGS__) -#define gDPLoadTextureBlockYuvS(gdl, ...) \ - gD_(gdl, gsDPLoadTextureBlockYuvS, __VA_ARGS__) -#define _gDPLoadTextureBlock(gdl, ...) \ - gD_(gdl, _gsDPLoadTextureBlock, __VA_ARGS__) -#define _gDPLoadTextureBlockS(gdl, ...) \ - gD_(gdl, _gsDPLoadTextureBlockS, __VA_ARGS__) -#define _gDPLoadTextureBlock_4b(gdl, ...) \ - gD_(gdl, _gsDPLoadTextureBlock_4b, __VA_ARGS__) -#define _gDPLoadTextureBlock_4bS(gdl, ...) \ - gD_(gdl, _gsDPLoadTextureBlock_4bS, __VA_ARGS__) -#define _gDPLoadTextureBlockYuv(gdl, ...) \ - gD_(gdl, _gsDPLoadTextureBlockYuv, __VA_ARGS__) -#define _gDPLoadTextureBlockYuvS(gdl, ...) \ - gD_(gdl, _gsDPLoadTextureBlockYuvS, __VA_ARGS__) -#define gDPLoadMultiBlock(gdl, ...) \ - gD_(gdl, gsDPLoadMultiBlock, __VA_ARGS__) -#define gDPLoadMultiBlockS(gdl, ...) \ - gD_(gdl, gsDPLoadMultiBlockS, __VA_ARGS__) -#define gDPLoadMultiBlock_4b(gdl, ...) \ - gD_(gdl, gsDPLoadMultiBlock_4b, __VA_ARGS__) -#define gDPLoadMultiBlock_4bS(gdl, ...) \ - gD_(gdl, gsDPLoadMultiBlock_4bS, __VA_ARGS__) -#define gDPLoadMultiBlockYuv(gdl, ...) \ - gD_(gdl, gsDPLoadMultiBlockYuv, __VA_ARGS__) -#define gDPLoadMultiBlockYuvS(gdl, ...) \ - gD_(gdl, gsDPLoadMultiBlockYuvS, __VA_ARGS__) -#define gDPLoadTextureTile(gdl, ...) \ - gD_(gdl, gsDPLoadTextureTile, __VA_ARGS__) -#define gDPLoadTextureTile_4b(gdl, ...) \ - gD_(gdl, gsDPLoadTextureTile_4b, __VA_ARGS__) -#define gDPLoadTextureTileYuv(gdl, ...) \ - gD_(gdl, gsDPLoadTextureTileYuv, __VA_ARGS__) -#define _gDPLoadTextureTile(gdl, ...) \ - gD_(gdl, _gsDPLoadTextureTile, __VA_ARGS__) -#define _gDPLoadTextureTile_4b(gdl, ...) \ - gD_(gdl, _gsDPLoadTextureTile_4b, __VA_ARGS__) -#define _gDPLoadTextureTileYuv(gdl, ...) \ - gD_(gdl, _gsDPLoadTextureTileYuv, __VA_ARGS__) -#define gDPLoadMultiTile(gdl, ...) \ - gD_(gdl, gsDPLoadMultiTile, __VA_ARGS__) -#define gDPLoadMultiTile_4b(gdl, ...) \ - gD_(gdl, gsDPLoadMultiTile_4b, __VA_ARGS__) -#define gDPLoadMultiTileYuv(gdl, ...) \ - gD_(gdl, gsDPLoadMultiTileYuv, __VA_ARGS__) -#define gDPLoadBlock(gdl, ...) \ - gD_(gdl, gsDPLoadBlock, __VA_ARGS__) -#define gDPNoOp(gdl) \ - gDisplayListPut(gdl, gsDPNoOp()) -#define gDPNoOpTag(gdl, ...) \ - gD_(gdl, gsDPNoOpTag, __VA_ARGS__) -#define gDPPipelineMode(gdl, ...) \ - gD_(gdl, gsDPPipelineMode, __VA_ARGS__) -#define gDPSetBlendColor(gdl, ...) \ - gD_(gdl, gsDPSetBlendColor, __VA_ARGS__) -#define gDPSetEnvColor(gdl, ...) \ - gD_(gdl, gsDPSetEnvColor, __VA_ARGS__) -#define gDPSetFillColor(gdl, ...) \ - gD_(gdl, gsDPSetFillColor, __VA_ARGS__) -#define gDPSetFogColor(gdl, ...) \ - gD_(gdl, gsDPSetFogColor, __VA_ARGS__) -#define gDPSetPrimColor(gdl, ...) \ - gD_(gdl, gsDPSetPrimColor, __VA_ARGS__) -#define gDPSetColorImage(gdl, ...) \ - gD_(gdl, gsDPSetColorImage, __VA_ARGS__) -#define gDPSetDepthImage(gdl, ...) \ - gD_(gdl, gsDPSetDepthImage, __VA_ARGS__) -#define gDPSetTextureImage(gdl, ...) \ - gD_(gdl, gsDPSetTextureImage, __VA_ARGS__) -#define gDPSetHilite1Tile(gdl, ...) \ - gD_(gdl, gsDPSetHilite1Tile, __VA_ARGS__) -#define gDPSetHilite2Tile(gdl, ...) \ - gD_(gdl, gsDPSetHilite2Tile, __VA_ARGS__) -#define gDPSetAlphaCompare(gdl, ...) \ - gD_(gdl, gsDPSetAlphaCompare, __VA_ARGS__) -#define gDPSetAlphaDither(gdl, ...) \ - gD_(gdl, gsDPSetAlphaDither, __VA_ARGS__) -#define gDPSetColorDither(gdl, ...) \ - gD_(gdl, gsDPSetColorDither, __VA_ARGS__) -#define gDPSetCombineMode(gdl, ...) \ - gD_(gdl, gsDPSetCombineLERP, __VA_ARGS__) -#define gDPSetCombineLERP(gdl, ...) \ - gD_(gdl, gsDPSetCombineLERP, __VA_ARGS__) -#define gDPSetConvert(gdl, ...) \ - gD_(gdl, gsDPSetConvert, __VA_ARGS__) -#define gDPSetTextureConvert(gdl, ...) \ - gD_(gdl, gsDPSetTextureConvert, __VA_ARGS__) -#define gDPSetCycleType(gdl, ...) \ - gD_(gdl, gsDPSetCycleType, __VA_ARGS__) -#define gDPSetDepthSource(gdl, ...) \ - gD_(gdl, gsDPSetDepthSource, __VA_ARGS__) -#define gDPSetCombineKey(gdl, ...) \ - gD_(gdl, gsDPSetCombineKey, __VA_ARGS__) -#define gDPSetKeyGB(gdl, ...) \ - gD_(gdl, gsDPSetKeyGB, __VA_ARGS__) -#define gDPSetKeyR(gdl, ...) \ - gD_(gdl, gsDPSetKeyR, __VA_ARGS__) -#define gDPSetPrimDepth(gdl, ...) \ - gD_(gdl, gsDPSetPrimDepth, __VA_ARGS__) -#define gDPSetRenderMode(gdl, ...) \ - gD_(gdl, gsDPSetRenderMode, __VA_ARGS__) -#define gDPSetScissor(gdl, ...) \ - gD_(gdl, gsDPSetScissor, __VA_ARGS__) -#define gDPSetScissorFrac(gdl, ...) \ - gD_(gdl, gsDPSetScissorFrac, __VA_ARGS__) -#define gDPSetTextureDetail(gdl, ...) \ - gD_(gdl, gsDPSetTextureDetail, __VA_ARGS__) -#define gDPSetTextureFilter(gdl, ...) \ - gD_(gdl, gsDPSetTextureFilter, __VA_ARGS__) -#define gDPSetTextureLOD(gdl, ...) \ - gD_(gdl, gsDPSetTextureLOD, __VA_ARGS__) -#define gDPSetTextureLUT(gdl, ...) \ - gD_(gdl, gsDPSetTextureLUT, __VA_ARGS__) -#define gDPSetTexturePersp(gdl, ...) \ - gD_(gdl, gsDPSetTexturePersp, __VA_ARGS__) -#define gDPSetTile(gdl, ...) \ - gD_(gdl, gsDPSetTile, __VA_ARGS__) -#define gDPSetTileSize(gdl, ...) \ - gD_(gdl, gsDPSetTileSize, __VA_ARGS__) -#define gSP1Triangle(gdl, ...) \ - gD_(gdl, gsSP1Triangle, __VA_ARGS__) -#if defined(F3DEX_GBI) || defined(F3DEX_GBI_2) -# define gSP2Triangles(gdl, ...) \ - gD_(gdl, gsSP2Triangles, __VA_ARGS__) -# define gSP1Quadrangle(gdl, ...) \ - gD_(gdl, gsSP1Quadrangle, __VA_ARGS__) -# define gSPBranchLessZ(gdl, ...) \ - gD_(gdl, gsSPBranchLessZ, __VA_ARGS__) -# define gSPBranchLessZrg(gdl, ...) \ - gD_(gdl, gsSPBranchLessZrg, __VA_ARGS__) -# define gSPBranchLessZraw(gdl, ...) \ - gD_(gdl, gsSPBranchLessZraw, __VA_ARGS__) -#endif -#define gSPBranchList(gdl, ...) \ - gD_(gdl, gsSPBranchList, __VA_ARGS__) -#define gSPClipRatio(gdl, ...) \ - gD_(gdl, gsSPClipRatio, __VA_ARGS__) -#define gSPCullDisplayList(gdl, ...) \ - gD_(gdl, gsSPCullDisplayList, __VA_ARGS__) -#define gSPDisplayList(gdl, ...) \ - gD_(gdl, gsSPDisplayList, __VA_ARGS__) -#define gSPEndDisplayList(gdl) \ - gDisplayListPut(gdl, gsSPEndDisplayList()) -#define gSPFogFactor(gdl, ...) \ - gD_(gdl, gsSPFogFactor, __VA_ARGS__) -#define gSPFogPosition(gdl, ...) \ - gD_(gdl, gsSPFogPosition, __VA_ARGS__) -#define gSPForceMatrix(gdl, ...) \ - gD_(gdl, gsSPForceMatrix, __VA_ARGS__) -#define gSPSetGeometryMode(gdl, ...) \ - gD_(gdl, gsSPSetGeometryMode, __VA_ARGS__) -#define gSPClearGeometryMode(gdl, ...) \ - gD_(gdl, gsSPClearGeometryMode, __VA_ARGS__) -#define gSPLoadGeometryMode(gdl, ...) \ - gD_(gdl, gsSPLoadGeometryMode, __VA_ARGS__) -#if defined(F3D_GBI) || defined(F3DEX_GBI) -# define gSPInsertMatrix(gdl, ...) \ - gD_(gdl, gsSPInsertMatrix, __VA_ARGS__) -#endif -#define gSPLine3D(gdl, ...) \ - gD_(gdl, gsSPLine3D, __VA_ARGS__) -#define gSPLineW3D(gdl, ...) \ - gD_(gdl, gsSPLineW3D, __VA_ARGS__) -#define gSPLoadUcode(gdl, ...) \ - gD_(gdl, gsSPLoadUcode, __VA_ARGS__) -#define gSPLoadUcodeL(gdl, ...) \ - gD_(gdl, gsSPLoadUcodeL, __VA_ARGS__) -#define gSPLookAtX(gdl, ...) \ - gD_(gdl, gsSPLookAtX, __VA_ARGS__) -#define gSPLookAtY(gdl, ...) \ - gD_(gdl, gsSPLookAtY, __VA_ARGS__) -#define gSPLookAt(gdl, ...) \ - gD_(gdl, gsSPLookAt, __VA_ARGS__) -#define gSPMatrix(gdl, ...) \ - gD_(gdl, gsSPMatrix, __VA_ARGS__) -#define gSPModifyVertex(gdl, ...) \ - gD_(gdl, gsSPModifyVertex, __VA_ARGS__) -#define gSPPerspNormalize(gdl, ...) \ - gD_(gdl, gsSPPerspNormalize, __VA_ARGS__) -#define gSPPopMatrix(gdl, ...) \ - gD_(gdl, gsSPPopMatrix, __VA_ARGS__) -#if defined(F3DEX_GBI_2) -# define gSPPopMatrixN(gdl, ...) \ - gD_(gdl, gsSPPopMatrixN, __VA_ARGS__) -#endif -#define gSPSegment(gdl, ...) \ - gD_(gdl, gsSPSegment, __VA_ARGS__) -#define gSPSetLights0(gdl, ...) \ - gD_(gdl, gsSPSetLights0, __VA_ARGS__) -#define gSPSetLights1(gdl, ...) \ - gD_(gdl, gsSPSetLights1, __VA_ARGS__) -#define gSPSetLights2(gdl, ...) \ - gD_(gdl, gsSPSetLights2, __VA_ARGS__) -#define gSPSetLights3(gdl, ...) \ - gD_(gdl, gsSPSetLights3, __VA_ARGS__) -#define gSPSetLights4(gdl, ...) \ - gD_(gdl, gsSPSetLights4, __VA_ARGS__) -#define gSPSetLights5(gdl, ...) \ - gD_(gdl, gsSPSetLights5, __VA_ARGS__) -#define gSPSetLights6(gdl, ...) \ - gD_(gdl, gsSPSetLights6, __VA_ARGS__) -#define gSPSetLights7(gdl, ...) \ - gD_(gdl, gsSPSetLights7, __VA_ARGS__) -#define gSPSetStatus(gdl, ...) \ - gD_(gdl, gsSPSetStatus, __VA_ARGS__) -#define gSPNumLights(gdl, ...) \ - gD_(gdl, gsSPNumLights, __VA_ARGS__) -#define gSPLight(gdl, ...) \ - gD_(gdl, gsSPLight, __VA_ARGS__) -#define gSPLightColor(gdl, ...) \ - gD_(gdl, gsSPLightColor, __VA_ARGS__) -#define gSPTexture(gdl, ...) \ - gD_(gdl, gsSPTexture, __VA_ARGS__) -#define gSPTextureRectangle(gdl, ...) \ - gD_(gdl, gsSPTextureRectangle, __VA_ARGS__) -#define gSPScisTextureRectangle(gdl, ...) \ - gD_(gdl, gsSPScisTextureRectangle, __VA_ARGS__) -#define gSPTextureRectangleFlip(gdl, ...) \ - gD_(gdl, gsSPTextureRectangleFlip, __VA_ARGS__) -#define gSPScisTextureRectangleFlip(gdl, ...) \ - gD_(gdl, gsSPScisTextureRectangleFlip, __VA_ARGS__) -#define gSPVertex(gdl, ...) \ - gD_(gdl, gsSPVertex, __VA_ARGS__) -#define gSPViewport(gdl, ...) \ - gD_(gdl, gsSPViewport, __VA_ARGS__) -#define gSPBgRectCopy(gdl, ...) \ - gD_(gdl, gsSPBgRectCopy, __VA_ARGS__) -#define gSPBgRect1Cyc(gdl, ...) \ - gD_(gdl, gsSPBgRect1Cyc, __VA_ARGS__) -#define gSPObjRectangle(gdl, ...) \ - gD_(gdl, gsSPObjRectangle, __VA_ARGS__) -#define gSPObjRectangleR(gdl, ...) \ - gD_(gdl, gsSPObjRectangleR, __VA_ARGS__) -#define gSPObjSprite(gdl, ...) \ - gD_(gdl, gsSPObjSprite, __VA_ARGS__) -#define gSPObjMatrix(gdl, ...) \ - gD_(gdl, gsSPObjMatrix, __VA_ARGS__) -#define gSPObjSubMatrix(gdl, ...) \ - gD_(gdl, gsSPObjSubMatrix, __VA_ARGS__) -#define gSPObjRenderMode(gdl, ...) \ - gD_(gdl, gsSPObjRenderMode, __VA_ARGS__) -#define gSPObjLoadTxtr(gdl, ...) \ - gD_(gdl, gsSPObjLoadTxtr, __VA_ARGS__) -#define gSPObjLoadTxRect(gdl, ...) \ - gD_(gdl, gsSPObjLoadTxRect, __VA_ARGS__) -#define gSPObjLoadTxRectR(gdl, ...) \ - gD_(gdl, gsSPObjLoadTxRectR, __VA_ARGS__) -#define gSPObjLoadTxSprite(gdl, ...) \ - gD_(gdl, gsSPObjLoadTxSprite, __VA_ARGS__) -#define gSPSelectDL(gdl, ...) \ - gD_(gdl, gsSPSelectDL, __VA_ARGS__) -#define gSPSelectBranchDL(gdl, ...) \ - gD_(gdl, gsSPSelectBranchDL, __VA_ARGS__) -#define gDPLoadTLUTCmd(gdl, ...) \ - gD_(gdl, gsDPLoadTLUTCmd, __VA_ARGS__) -#define gDPLoadTLUT(gdl, ...) \ - gD_(gdl, gsDPLoadTLUT, __VA_ARGS__) -#if defined(F3DEX_GBI) || defined(F3DEX_GBI_2) -# define gBranchZ(gdl, ...) \ - gD_(gdl, gsBranchZ, __VA_ARGS__) -#endif -#define gDisplayList(gdl, ...) \ - gD_(gdl, gsDisplayList, __VA_ARGS__) -#define gDPHalf1(gdl, ...) \ - gD_(gdl, gsDPHalf1, __VA_ARGS__) -#define gDPHalf2(gdl, ...) \ - gD_(gdl, gsDPHalf2, __VA_ARGS__) -#define gDPLoadTile(gdl, ...) \ - gD_(gdl, gsDPLoadTile, __VA_ARGS__) -#define gDPSetCombine(gdl, ...) \ - gD_(gdl, gsDPSetCombine, __VA_ARGS__) -#if defined(F3DEX_GBI_2) -# define gSPGeometryMode(gdl, ...) \ - gD_(gdl, gsSPGeometryMode, __VA_ARGS__) -#endif -#define gSPSetOtherMode(gdl, ...) \ - gD_(gdl, gsSPSetOtherMode, __VA_ARGS__) -#define gSPSetOtherModeLo(gdl, ...) \ - gD_(gdl, gsSPSetOtherModeLo, __VA_ARGS__) -#define gSPSetOtherModeHi(gdl, ...) \ - gD_(gdl, gsSPSetOtherModeHi, __VA_ARGS__) -#define gDPSetOtherMode(gdl, ...) \ - gD_(gdl, gsDPSetOtherMode, __VA_ARGS__) -#define gMoveWd(gdl, ...) \ - gD_(gdl, gsMoveWd, __VA_ARGS__) -#define gMoveMem(gdl, ...) \ - gD_(gdl, gsMoveMem, __VA_ARGS__) -#if defined(F3DEX_GBI_2) -# define gSPDma_io(gdl, ...) \ - gD_(gdl, gsSPDma_io, __VA_ARGS__) -# define gSPDmaRead(gdl, ...) \ - gD_(gdl, gsSPDmaRead, __VA_ARGS__) -# define gSPDmaWrite(gdl, ...) \ - gD_(gdl, gsSPDmaWrite, __VA_ARGS__) -#endif -#if defined(F3DEX_GBI) || defined(F3DEX_GBI_2) -# define gLoadUcode(gdl, ...) \ - gD_(gdl, gsLoadUcode, __VA_ARGS__) -# define gSPLoadUcodeEx(gdl, ...) \ - gD_(gdl, gsSPLoadUcodeEx, __VA_ARGS__) -#endif -#define gTexRect(gdl, ...) \ - gD_(gdl, gsTexRect, __VA_ARGS__) -#define gTexRectFlip(gdl, ...) \ - gD_(gdl, gsTexRectFlip, __VA_ARGS__) -#define gSPNoOp(gdl) \ - gDisplayListPut(gdl, gsSPNoOp()) -#define gDPWord(gdl, ...) \ - gD_(gdl, gsDPWord, __VA_ARGS__) -#if defined(F3DEX_GBI_2) -# define gSpecial3(gdl, ...) \ - gD_(gdl, gsSpecial3, __VA_ARGS__) -# define gSpecial2(gdl, ...) \ - gD_(gdl, gsSpecial2, __VA_ARGS__) -# define gSpecial1(gdl, ...) \ - gD_(gdl, gsSpecial1, __VA_ARGS__) -#endif - -/* data types and structures */ -typedef uint8_t qu08_t; -typedef uint16_t qu016_t; -typedef int16_t qs48_t; -typedef int16_t qs510_t; -typedef uint16_t qu510_t; -typedef int16_t qs102_t; -typedef uint16_t qu102_t; -typedef int16_t qs105_t; -typedef uint16_t qu105_t; -typedef int16_t qs132_t; -typedef int16_t qs142_t; -typedef int32_t qs1516_t; -typedef int32_t qs1616_t; -typedef int32_t qs205_t; - -typedef uint16_t g_bglt_t; -typedef uint8_t g_ifmt_t; -typedef uint8_t g_isiz_t; -typedef uint16_t g_bgf_t; -typedef uint8_t g_objf_t; -typedef uint32_t g_objlt_t; - -typedef struct -{ - _Alignas(8) - uint32_t hi; - uint32_t lo; -} Gfx; - -typedef struct -{ - int32_t x1; - int32_t y1; - int32_t x2; - int32_t y2; -} Hilite_t; - -typedef union -{ - _Alignas(8) - Hilite_t h; -} Hilite; - -typedef int32_t Mtx_t[4][4]; - -typedef union -{ - _Alignas(8) - Mtx_t m; - int32_t l[16]; - struct - { - int16_t i[16]; - uint16_t f[16]; - }; -} Mtx; - -typedef struct -{ - uint8_t col[3]; - char pad1; - uint8_t colc[3]; - char pad2; - int8_t dir[3]; - char pad3; -} Light_t; - -typedef union -{ - _Alignas(8) - Light_t l; -} Light; - -typedef struct -{ - Light l[2]; -} LookAt; - -typedef struct -{ - uint8_t col[3]; - char pad1; - uint8_t colc[3]; - char pad2; -} Ambient_t; - -typedef union -{ - _Alignas(8) - Ambient_t l; -} Ambient; - -typedef struct -{ - Ambient a; - Light l[1]; -} Lights0, Lights1; - -typedef struct -{ - Ambient a; - Light l[2]; -} Lights2; - -typedef struct -{ - Ambient a; - Light l[3]; -} Lights3; - -typedef struct -{ - Ambient a; - Light l[4]; -} Lights4; - -typedef struct -{ - Ambient a; - Light l[5]; -} Lights5; - -typedef struct -{ - Ambient a; - Light l[6]; -} Lights6; - -typedef struct -{ - Ambient a; - Light l[7]; -} Lightsn, Lights7; - -typedef struct -{ - int16_t ob[3]; - uint16_t flag; - qs105_t tc[2]; - uint8_t cn[4]; -} Vtx_t; - -typedef struct -{ - int16_t ob[3]; - uint16_t flag; - qs105_t tc[2]; - int8_t n[3]; - uint8_t a; -} Vtx_tn; - -typedef union -{ - _Alignas(8) - Vtx_t v; - Vtx_tn n; -} Vtx; - -typedef struct -{ - qs142_t vscale[4]; - qs142_t vtrans[4]; -} Vp_t; - -typedef union -{ - _Alignas(8) - Vp_t vp; -} Vp; - -typedef struct -{ - qs1516_t A; - qs1516_t B; - qs1516_t C; - qs1516_t D; - qs102_t X; - qs102_t Y; - qu510_t BaseScaleX; - qu510_t BaseScaleY; -} uObjMtx_t; - -typedef union -{ - _Alignas(8) - uObjMtx_t m; -} uObjMtx; - -typedef struct -{ - qs102_t X; - qs102_t Y; - qu510_t BaseScaleX; - qu510_t BaseScaleY; -} uObjSubMtx_t; - -typedef union -{ - _Alignas(8) - uObjSubMtx_t m; -} uObjSubMtx; - -typedef struct -{ - qu105_t imageX; - qu102_t imageW; - qs102_t frameX; - qu102_t frameW; - qu105_t imageY; - qu102_t imageH; - qs102_t frameY; - qu102_t frameH; - uint64_t * imagePtr; - g_bglt_t imageLoad; - g_ifmt_t imageFmt; - g_isiz_t imageSiz; - uint16_t imagePal; - g_bgf_t imageFlip; - uint16_t tmemW; - qs132_t tmemH; - uint16_t tmemLoadSH; - uint16_t tmemLoadTH; - uint16_t tmemSizeW; - uint16_t tmemSize; -} uObjBg_t; - -typedef struct -{ - qu105_t imageX; - qu102_t imageW; - qs102_t frameX; - qu102_t frameW; - qu105_t imageY; - qu102_t imageH; - qs102_t frameY; - qu102_t frameH; - uint64_t * imagePtr; - g_bglt_t imageLoad; - g_ifmt_t imageFmt; - g_isiz_t imageSiz; - uint16_t imagePal; - g_bgf_t imageFlip; - qu510_t scaleW; - qu510_t scaleH; - qs205_t imageYorig; - char padding[4]; -} uObjScaleBg_t; - -typedef union -{ - _Alignas(8) - uObjBg_t b; - uObjScaleBg_t s; -} uObjBg; - -typedef struct -{ - qs102_t objX; - qu510_t scaleW; - qu105_t imageW; - uint16_t paddingX; - qs102_t objY; - qu510_t scaleH; - qu105_t imageH; - uint16_t paddingY; - uint16_t imageStride; - uint16_t imageAdrs; - g_ifmt_t imageFmt; - g_isiz_t imageSiz; - uint16_t imagePal; - g_objf_t imageFlags; -} uObjSprite_t; - -typedef union -{ - _Alignas(8) - uObjSprite_t s; -} uObjSprite; - -typedef struct -{ - g_objlt_t type; - uint64_t * image; - uint16_t tmem; - uint16_t tsize; - uint16_t tline; - uint16_t sid; - uint32_t flag; - uint32_t mask; -} uObjTxtrBlock_t; - -typedef struct -{ - g_objlt_t type; - uint64_t * image; - uint16_t tmem; - uint16_t twidth; - uint16_t theight; - uint16_t sid; - uint32_t flag; - uint32_t mask; -} uObjTxtrTile_t; - -typedef struct -{ - g_objlt_t type; - uint64_t * image; - uint16_t phead; - uint16_t pnum; - uint16_t zero; - uint16_t sid; - uint32_t flag; - uint32_t mask; -} uObjTxtrTLUT_t; - -typedef union -{ - _Alignas(8) - uObjTxtrBlock_t block; - uObjTxtrTile_t tile; - uObjTxtrTLUT_t tlut; -} uObjTxtr; - -typedef struct -{ - uObjTxtr txtr; - uObjSprite sprite; -} uObjTxSprite; - -/* rectangle scissoring macros */ -#define gScC_(c) ((c) < 0 ? 0 : (c)) -#define gScD_(t, c, d) \ - ( \ - (c) < 0 ? \ - ( \ - (d) < 0 ? \ - (t) + (c) * (d) / 0x80 : \ - (t) - (c) * (d) / 0x80 \ - ) : \ - (t) \ - ) - -/* texture loading helper macros */ -#define G_SIZ_LDSIZ(siz) ((siz) < G_IM_SIZ_16b ? G_IM_SIZ_16b : (siz)) -#define G_SIZ_BITS(siz) (4 << gI_(siz)) -#define G_SIZ_LDBITS(siz) ((siz) < G_IM_SIZ_16b ? G_SIZ_BITS(siz) : 16) -#define G_DXT(siz, width) \ - ( \ - (width) * G_SIZ_BITS(siz) > 64 ? \ - ((1 << 11) + (width) * G_SIZ_BITS(siz) / 64 - 1) / \ - ((width) * G_SIZ_BITS(siz) / 64) : \ - (1 << 11) \ - ) -#define G_LTB_LRS(width, height, siz) \ - ( \ - (((width) * (height) + 1) * G_SIZ_BITS(siz) - 1) / \ - G_SIZ_BITS(G_SIZ_LDSIZ(siz)) - 1 \ - ) -#define G_LDBLK_TXL(txl) \ - ( \ - (txl) > G_TX_LDBLK_MAX_TXL ? \ - G_TX_LDBLK_MAX_TXL : \ - (txl) \ - ) - -/* depth value macros */ -#define gZp_(zval, near, far) \ - ( \ - (1.f - (float)(near) / (float)(zval)) / \ - (1.f - (float)(near) / (float)(far)) \ - ) -#define gZo_(zval, near, far) \ - ( \ - ((float)(zval) - (float)(near)) / \ - ((float)(far) - (float)(near)) \ - ) -#define gZf_(zval, near, far, flag) \ - qs1616 \ - ( \ - (flag) == G_BZ_PERSP ? \ - gZp_(zval, near, far) : \ - gZo_(zval, near, far) \ - ) -#define G_DEPTOZSrg(zval, near, far, flag, zmin, zmax) \ - ( \ - gZf_(zval, near, far, flag) * \ - ((int32_t)((zmax) - (zmin)) & ~(int32_t)1) + \ - qs1616(zmin) \ - ) -#define G_DEPTOZS(zval, near, far, flag) \ - G_DEPTOZSrg(zval, near, far, flag, 0, G_MAXZ) - -/* vertex ordering macros */ -#define gV2_(v0, v1, flag) \ - ( \ - (flag) == 0 ? gI_(v0) : \ - gI_(v1) \ - ) -#define gV3_(v0, v1, v2, flag) \ - ( \ - (flag) == 0 ? gI_(v0) : \ - (flag) == 1 ? gI_(v1) : \ - gI_(v2) \ - ) -#define gV4_(v0, v1, v2, v3, flag) \ - ( \ - (flag) == 0 ? gI_(v0) : \ - (flag) == 1 ? gI_(v1) : \ - (flag) == 2 ? gI_(v2) : \ - gI_(v3) \ - ) - -/* sprite texture parameter macros */ -#define GS_PIX2TMEM(pix, siz) ((pix) * G_SIZ_BITS(siz) / 64) -#define GS_TB_TSIZE(pix, siz) (GS_PIX2TMEM(pix, siz) - 1) -#define GS_TB_TLINE(pix, siz) (((1 << 11) - 1) / GS_PIX2TMEM(pix, siz) + 1) -#define GS_TT_TWIDTH(pix, siz) (GS_PIX2TMEM(pix, siz) * 4 - 1) -#define GS_TT_THEIGHT(pix, siz) ((pix) * 4 - 1) -#define GS_PAL_HEAD(head) ((head) + 256) -#define GS_PAL_NUM(num) ((num) - 1) - -/* fixed-point conversion macros */ -#define qu08(n) ((qu08_t)((n) * 0x100)) -#define qu016(n) ((qu016_t)((n) * 0x10000)) -#define qs48(n) ((qs48_t)((n) * 0x0100)) -#define qs510(n) ((qs510_t)((n) * 0x0400)) -#define qu510(n) ((qu510_t)((n) * 0x0400)) -#define qs102(n) ((qs102_t)((n) * 0x0004)) -#define qu102(n) ((qu102_t)((n) * 0x0004)) -#define qs105(n) ((qs105_t)((n) * 0x0020)) -#define qu105(n) ((qu105_t)((n) * 0x0020)) -#define qs132(n) ((qs132_t)((n) * 0x0004)) -#define qs142(n) ((qs142_t)((n) * 0x0004)) -#define qs1516(n) ((qs1516_t)((n) * 0x00010000)) -#define qs1616(n) ((qs1616_t)((n) * 0x00010000)) -#define qs205(n) ((qs205_t)((n) * 0x00000020)) - -/* private helper macros */ -#define gI_(i) ((uint32_t)(i)) -#define gL_(l) ((uint64_t)(l)) -#define gF_(i, n, s) ((gI_(i) & ((gI_(1) << (n)) - 1)) << (s)) -#define gFL_(l, n, s) ((gL_(l) & ((gL_(1) << (n)) - 1)) << (s)) -#define gO_(opc, hi, lo) ((Gfx){gF_(opc, 8, 24) | gI_(hi), gI_(lo)}) -#define gD_(gdl, m, ...) gDisplayListPut(gdl, m(__VA_ARGS__)) - -#endif diff --git a/tools/ZAPD/lib/libgfxd/gfxd.c b/tools/ZAPD/lib/libgfxd/gfxd.c deleted file mode 100644 index 76d7ded8a7..0000000000 --- a/tools/ZAPD/lib/libgfxd/gfxd.c +++ /dev/null @@ -1,863 +0,0 @@ -#include -#include -#include -#include -#include -#ifdef _WIN32 -# include -# define read _read -# define write _write -#else -# include -#endif -#include "gbi.h" -#include "gfxd.h" -#include "priv.h" - -static TLOCAL struct gfxd_state state; - -static int buffer_input_fn(void *buf, int count) -{ - if (count > config.input_buf_size) - count = config.input_buf_size; - memcpy(buf, config.input_buf, count); - config.input_buf += count; - config.input_buf_size -= count; - return count; -} - -static int buffer_output_fn(const char *buf, int count) -{ - if (count > config.output_buf_size) - count = config.output_buf_size; - memcpy(config.output_buf, buf, count); - config.output_buf += count; - config.output_buf_size -= count; - return count; -} - -static int fd_input_fn(void *buf, int count) -{ - return read(config.input_fd, buf, count); -} - -static int fd_output_fn(const char *buf, int count) -{ - return write(config.output_fd, buf, count); -} - -static void swap_words(Gfx *gfx) -{ - uint8_t b[8]; - uint8_t *pw = (void *) gfx; - uint8_t *pb = b; - - int endian = config.endian; - int wordsize = config.wordsize; - - for (int i = 0; i < 8 / wordsize; i++) - { - if (endian == gfxd_endian_host) - { - switch (wordsize) - { - case 1: - { - uint8_t w = *(uint8_t *) pw; - *pb++ = w >> 0; - break; - } - case 2: - { - uint16_t w = *(uint16_t *) pw; - *pb++ = w >> 8; - *pb++ = w >> 0; - break; - } - case 4: - { - uint32_t w = *(uint32_t *) pw; - *pb++ = w >> 24; - *pb++ = w >> 16; - *pb++ = w >> 8; - *pb++ = w >> 0; - break; - } - case 8: - { - uint64_t w = *(uint64_t *) pw; - *pb++ = w >> 56; - *pb++ = w >> 48; - *pb++ = w >> 40; - *pb++ = w >> 32; - *pb++ = w >> 24; - *pb++ = w >> 16; - *pb++ = w >> 8; - *pb++ = w >> 0; - break; - } - } - } - else - { - for (int j = 0; j < wordsize; j++) - { - if (endian == gfxd_endian_little) - *pb++ = pw[wordsize - 1 - j]; - else - *pb++ = pw[j]; - } - } - pw += wordsize; - } - - gfx->hi = ((uint32_t) b[0] << 24) - | ((uint32_t) b[1] << 16) - | ((uint32_t) b[2] << 8) - | ((uint32_t) b[3] << 0); - gfx->lo = ((uint32_t) b[4] << 24) - | ((uint32_t) b[5] << 16) - | ((uint32_t) b[6] << 8) - | ((uint32_t) b[7] << 0); -} - -static void get_more_input(void) -{ - if (state.end_input != 0) - return; - - char *recv_buf = (void *) &state.gfx[0]; - - while (state.n_gfx < sizeof(state.gfx) / sizeof(state.gfx[0])) - { - int n_read = sizeof(state.gfx) - state.n_byte; - n_read = config.input_fn(&recv_buf[state.n_byte], n_read); - if (n_read == 0) - return; - state.n_byte += n_read; - - while (state.n_gfx < state.n_byte / sizeof(Gfx)) - { - Gfx gfx = state.gfx[state.n_gfx]; - gfxd_macro_t *m = &state.macro[state.n_gfx]; - - swap_words(&gfx); - - int ret = config.ucode->disas_fn(m, gfx.hi, gfx.lo); - if (ret != 0 && config.stop_on_invalid != 0) - { - state.end_input = 1; - state.ret = ret; - return; - } - - state.n_gfx++; - } - } -} - -static int32_t typed_arg_i(int type, int idx) -{ - const gfxd_value_t *v = gfxd_value_by_type(type, idx); - if (v != NULL) - return v->i; - else - return -1; -} - -static uint32_t typed_arg_u(int type, int idx) -{ - const gfxd_value_t *v = gfxd_value_by_type(type, idx); - if (v != NULL) - return v->u; - else - return 0; -} - - -TLOCAL struct gfxd_config config = -{ - .ucode = NULL, - .endian = gfxd_endian_big, - .wordsize = 4, - .arg = NULL, - - .stop_on_invalid = 1, - .stop_on_end = 1, - .emit_dec_color = 0, - .emit_q_macro = 0, - .emit_ext_macro = 0, - - .input_buf = NULL, - .input_buf_size = 0, - .input_fn = &buffer_input_fn, - - .output_buf = NULL, - .output_buf_size = 0, - .output_fn = &buffer_output_fn, - - .macro_fn = &gfxd_macro_dflt, - .arg_fn = &gfxd_arg_dflt, - - .tlut_fn = NULL, - .timg_fn = NULL, - .cimg_fn = NULL, - .zimg_fn = NULL, - .dl_fn = NULL, - .mtx_fn = NULL, - .lookat_fn = NULL, - .light_fn = NULL, - .seg_fn = NULL, - .vtx_fn = NULL, - .vp_fn = NULL, - .uctext_fn = NULL, - .ucdata_fn = NULL, - .dram_fn = NULL, -}; - -void gfxd_input_buffer(const void *buf, int size) -{ - config.input_buf = buf; - config.input_buf_size = size; - config.input_fn = &buffer_input_fn; -} - -void gfxd_output_buffer(char *buf, int size) -{ - config.output_buf = buf; - config.output_buf_size = size; - config.output_fn = &buffer_output_fn; -} - -void gfxd_input_fd(int fd) -{ - config.input_fd = fd; - config.input_fn = &fd_input_fn; -} - -void gfxd_output_fd(int fd) -{ - config.output_fd = fd; - config.output_fn = &fd_output_fn; -} - -void gfxd_input_callback(gfxd_input_fn_t *fn) -{ - if (fn != NULL) - config.input_fn = fn; - else - gfxd_input_buffer(NULL, 0); -} - -void gfxd_output_callback(gfxd_output_fn_t *fn) -{ - if (fn != NULL) - config.output_fn = fn; - else - gfxd_output_buffer(NULL, 0); -} - -void gfxd_macro_fn(gfxd_macro_fn_t *fn) -{ - if (fn != NULL) - config.macro_fn = fn; - else - config.macro_fn = gfxd_macro_dflt; -} - -void gfxd_arg_fn(gfxd_arg_fn_t *fn) -{ - if (fn != NULL) - config.arg_fn = fn; - else - config.arg_fn = gfxd_arg_dflt; -} - -int gfxd_write(const void *buf, int count) -{ - return config.output_fn(buf, count); -} - -int gfxd_puts(const char *str) -{ - return gfxd_write(str, strlen(str)); -} - -int gfxd_printf(const char *fmt, ...) -{ - char s[256]; - - va_list arg; - va_start(arg, fmt); - int n = vsnprintf(s, sizeof(s), fmt, arg); - va_end(arg); - - if (n > sizeof(s) - 1) - n = sizeof(s) - 1; - - return gfxd_write(s, n); -} - -int gfxd_print_value(int type, const gfxd_value_t *value) -{ - return config.ucode->arg_tbl[type].fn(value); -} - -int gfxd_macro_dflt(void) -{ - gfxd_macro_t *m = &state.macro[0]; - const gfxd_macro_type_t *t = &config.ucode->macro_tbl[m->id]; - - const char *name = gfxd_macro_name(); - if (name == NULL) - { - if (config.arg != NULL) - { - gfxd_puts(config.arg); - gfxd_puts(" = "); - } - - gfxd_puts("(Gfx){"); - } - else - { - gfxd_puts(name); - gfxd_puts("("); - - if (config.arg != NULL) - { - gfxd_puts(config.arg); - if (t->n_arg != 0) - gfxd_puts(", "); - } - } - - for (int i = 0; i < t->n_arg; i++) - { - if (i != 0) - gfxd_puts(", "); - - config.arg_fn(i); - } - - if (name == NULL) - gfxd_puts("}"); - else - gfxd_puts(")"); - - return 0; -} - -int gfxd_arg_callbacks(int arg_num) -{ - int id = gfxd_macro_id(); - - switch (gfxd_arg_type(arg_num)) - { - case gfxd_Tlut: - { - if (config.tlut_fn != NULL) - { - int32_t num; - if (id == gfxd_DPLoadTLUT_pal16) - num = 16; - else if (id == gfxd_DPLoadTLUT_pal256) - num = 256; - else - num = typed_arg_i(gfxd_Num, 0); - return config.tlut_fn( - typed_arg_u(gfxd_Tlut, 0), - typed_arg_i(gfxd_Pal, 0), - num); - } - break; - } - case gfxd_Timg: - { - if (config.timg_fn != NULL) - { - int32_t siz = typed_arg_i(gfxd_Siz, 0); - if (siz == -1) - siz = G_IM_SIZ_4b; - return config.timg_fn( - typed_arg_u(gfxd_Timg, 0), - typed_arg_i(gfxd_Fmt, 0), - siz, - typed_arg_i(gfxd_Dim, 0), - typed_arg_i(gfxd_Dim, 1), - typed_arg_i(gfxd_Pal, 0)); - } - break; - } - case gfxd_Cimg: - { - if (config.cimg_fn != NULL) - { - return config.cimg_fn( - typed_arg_u(gfxd_Cimg, 0), - typed_arg_i(gfxd_Fmt, 0), - typed_arg_i(gfxd_Siz, 0), - typed_arg_i(gfxd_Dim, 0)); - } - break; - } - case gfxd_Zimg: - { - if (config.zimg_fn != NULL) - { - return config.zimg_fn( - typed_arg_u(gfxd_Zimg, 0)); - } - break; - } - case gfxd_Dl: - { - if (config.dl_fn != NULL) - { - return config.dl_fn( - typed_arg_u(gfxd_Dl, 0)); - } - break; - } - case gfxd_Mtxptr: - { - if (config.mtx_fn != NULL) - { - return config.mtx_fn( - typed_arg_u(gfxd_Mtxptr, 0)); - } - break; - } - case gfxd_Lookatptr: - { - if (config.lookat_fn != NULL) - { - int32_t num; - if (id == gfxd_SPLookAt) - num = 2; - else - num = 1; - return config.lookat_fn( - typed_arg_u(gfxd_Lookatptr, 0), - num); - } - break; - } - case gfxd_Lightptr: - { - if (config.light_fn != NULL) - { - int32_t num; - if (id == gfxd_SPSetLights1) - num = 1; - else if (id == gfxd_SPSetLights2) - num = 2; - else if (id == gfxd_SPSetLights3) - num = 3; - else if (id == gfxd_SPSetLights4) - num = 4; - else if (id == gfxd_SPSetLights5) - num = 5; - else if (id == gfxd_SPSetLights6) - num = 6; - else if (id == gfxd_SPSetLights7) - num = 7; - else - num = 1; - return config.light_fn( - typed_arg_u(gfxd_Lightptr, 0), - num); - } - break; - - } - case gfxd_Segptr: - { - if (config.seg_fn != NULL) - { - return config.seg_fn( - typed_arg_u(gfxd_Segptr, 0), - typed_arg_i(gfxd_Seg, 0)); - } - break; - } - case gfxd_Vtxptr: - { - if (config.vtx_fn != NULL) - { - return config.vtx_fn( - typed_arg_u(gfxd_Vtxptr, 0), - typed_arg_i(gfxd_Num, 0)); - } - break; - } - case gfxd_Vpptr: - { - if (config.vp_fn != NULL) - { - return config.vp_fn( - typed_arg_u(gfxd_Vpptr, 0)); - } - break; - } - case gfxd_Uctext: - { - if (config.uctext_fn != NULL) - { - return config.uctext_fn( - typed_arg_u(gfxd_Uctext, 0), - 0x1000); - } - break; - } - case gfxd_Ucdata: - { - if (config.ucdata_fn != NULL) - { - uint32_t size; - if (id == gfxd_SPLoadUcodeEx) - size = typed_arg_u(gfxd_Size, 0); - else - size = 0x800; - return config.ucdata_fn( - typed_arg_u(gfxd_Ucdata, 0), - size); - } - break; - } - case gfxd_Dram: - { - if (config.dram_fn != NULL) - { - return config.dram_fn( - typed_arg_u(gfxd_Dram, 0), - typed_arg_u(gfxd_Size, 0)); - } - break; - } - } - - return 0; -} - -void gfxd_arg_dflt(int arg_num) -{ - if (gfxd_arg_callbacks(arg_num) == 0) - { - gfxd_arg_t *a = &state.macro[0].arg[arg_num]; - - gfxd_print_value(a->type, &a->value); - } -} - -void gfxd_tlut_callback(gfxd_tlut_fn_t *fn) -{ - config.tlut_fn = fn; -} - -void gfxd_timg_callback(gfxd_timg_fn_t *fn) -{ - config.timg_fn = fn; -} - -void gfxd_cimg_callback(gfxd_cimg_fn_t *fn) -{ - config.cimg_fn = fn; -} - -void gfxd_zimg_callback(gfxd_zimg_fn_t *fn) -{ - config.zimg_fn = fn; -} - -void gfxd_dl_callback(gfxd_dl_fn_t *fn) -{ - config.dl_fn = fn; -} - -void gfxd_mtx_callback(gfxd_mtx_fn_t *fn) -{ - config.mtx_fn = fn; -} - -void gfxd_lookat_callback(gfxd_lookat_fn_t *fn) -{ - config.lookat_fn = fn; -} - -void gfxd_light_callback(gfxd_light_fn_t *fn) -{ - config.light_fn = fn; -} - -void gfxd_seg_callback(gfxd_seg_fn_t *fn) -{ - config.seg_fn = fn; -} - -void gfxd_vtx_callback(gfxd_vtx_fn_t *fn) -{ - config.vtx_fn = fn; -} - -void gfxd_vp_callback(gfxd_vp_fn_t *fn) -{ - config.vp_fn = fn; -} - -void gfxd_uctext_callback(gfxd_uctext_fn_t *fn) -{ - config.uctext_fn = fn; -} - -void gfxd_ucdata_callback(gfxd_ucdata_fn_t *fn) -{ - config.ucdata_fn = fn; -} - -void gfxd_dram_callback(gfxd_dram_fn_t *fn) -{ - config.dram_fn = fn; -} - -void gfxd_target(gfxd_ucode_t ucode) -{ - config.ucode = ucode; -} - -void gfxd_endian(int endian, int wordsize) -{ - config.endian = endian; - config.wordsize = wordsize; -} - -void gfxd_dynamic(const char *arg) -{ - config.arg = arg; -} - -void gfxd_enable(int cap) -{ - switch (cap) - { - case gfxd_stop_on_invalid: - config.stop_on_invalid = 1; - break; - - case gfxd_stop_on_end: - config.stop_on_end = 1; - break; - - case gfxd_emit_dec_color: - config.emit_dec_color = 1; - break; - - case gfxd_emit_q_macro: - config.emit_q_macro = 1; - break; - - case gfxd_emit_ext_macro: - config.emit_ext_macro = 1; - break; - } -} - -void gfxd_disable(int cap) -{ - switch (cap) - { - case gfxd_stop_on_invalid: - config.stop_on_invalid = 0; - return; - - case gfxd_stop_on_end: - config.stop_on_end = 0; - return; - - case gfxd_emit_dec_color: - config.emit_dec_color = 0; - break; - - case gfxd_emit_q_macro: - config.emit_q_macro = 0; - break; - - case gfxd_emit_ext_macro: - config.emit_ext_macro = 0; - break; - } -} - -void gfxd_udata_set(void *ptr) -{ - config.udata = ptr; -} - -void *gfxd_udata_get(void) -{ - return config.udata; -} - -int gfxd_execute(void) -{ - state.macro_offset = 0; - state.n_byte = 0; - state.n_gfx = 0; - state.end_input = 0; - state.ret = 0; - - for (;;) - { - get_more_input(); - if (state.n_gfx == 0) - break; - - gfxd_macro_t *m = &state.macro[0]; - config.ucode->combine_fn(m, state.n_gfx); - - const gfxd_macro_type_t *t = &config.ucode->macro_tbl[m->id]; - if (t->ext != 0 && config.emit_ext_macro == 0) - { - Gfx gfx = state.gfx[0]; - swap_words(&gfx); - - t = &config.ucode->macro_tbl[gfxd_Invalid]; - t->disas_fn(m, gfx.hi, gfx.lo); - } - - int ret = config.macro_fn(); - if (ret != 0) - { - state.ret = ret; - break; - } - - if (config.stop_on_end != 0 - && (m->id == gfxd_SPBranchList - || m->id == gfxd_SPEndDisplayList)) - { - break; - } - - int n_pop = config.ucode->macro_tbl[m->id].n_gfx; - int n_rem = state.n_gfx - n_pop; - { - int n_byte = n_rem * sizeof(gfxd_macro_t); - memmove(&state.macro[0], &state.macro[n_pop], n_byte); - state.n_gfx = n_rem; - } - { - int n_byte = n_rem * sizeof(Gfx); - memmove(&state.gfx[0], &state.gfx[n_pop], n_byte); - state.n_byte = n_byte; - } - state.macro_offset += n_pop * sizeof(Gfx); - } - - return state.ret; -} - -int gfxd_macro_offset(void) -{ - return state.macro_offset; -} - -int gfxd_macro_packets(void) -{ - return config.ucode->macro_tbl[state.macro[0].id].n_gfx; -} - -const void *gfxd_macro_data(void) -{ - return state.gfx; -} - -int gfxd_macro_id(void) -{ - return state.macro[0].id; -} - -const char *gfxd_macro_name(void) -{ - int id = state.macro[0].id; - const gfxd_macro_type_t *t = &config.ucode->macro_tbl[id]; - - if (t->prefix == NULL && t->suffix == NULL) - { - return NULL; - } - else - { - static TLOCAL char buf[32]; - - char *p = buf; - if (t->prefix != NULL) - { - const char *s = t->prefix; - while (*s != '\0') - *p++ = *s++; - } - *p++ = 'g'; - if (config.arg == NULL) - *p++ = 's'; - if (t->suffix != NULL) - { - const char *s = t->suffix; - while (*s != '\0') - *p++ = *s++; - } - *p++ = '\0'; - - return buf; - } -} - -int gfxd_arg_count(void) -{ - return config.ucode->macro_tbl[state.macro[0].id].n_arg; -} - -int gfxd_arg_type(int arg_num) -{ - return state.macro[0].arg[arg_num].type; -} - -const char *gfxd_arg_name(int arg_num) -{ - return state.macro[0].arg[arg_num].name; -} - -int gfxd_arg_fmt(int arg_num) -{ - return config.ucode->arg_tbl[state.macro[0].arg[arg_num].type].fmt; -} - -const gfxd_value_t *gfxd_arg_value(int arg_num) -{ - return &state.macro[0].arg[arg_num].value; -} - -const gfxd_value_t *gfxd_value_by_type(int type, int idx) -{ - gfxd_macro_t *m = &state.macro[0]; - const gfxd_macro_type_t *t = &config.ucode->macro_tbl[m->id]; - - for (int i = 0; i < t->n_arg; i++) - { - gfxd_arg_t *a = &m->arg[i]; - if (a->type == type) - { - if (idx == 0) - return &a->value; - else - idx--; - } - } - - return NULL; -} - -int gfxd_arg_valid(int arg_num) -{ - return state.macro[0].arg[arg_num].bad == 0; -} diff --git a/tools/ZAPD/lib/libgfxd/gfxd.h b/tools/ZAPD/lib/libgfxd/gfxd.h deleted file mode 100644 index 268bbfa10f..0000000000 --- a/tools/ZAPD/lib/libgfxd/gfxd.h +++ /dev/null @@ -1,387 +0,0 @@ -#ifndef GFXD_H -#define GFXD_H -#include - -#ifdef __cplusplus -extern "C" -{ -#endif - -enum -{ - gfxd_Word, /* generic word */ - gfxd_Opcode, /* command opcode (G_*) */ - gfxd_Coordi, /* integer coordinate */ - gfxd_Coordq, /* fractional (q10.2) coordinate */ - gfxd_Pal, /* palette index */ - gfxd_Tlut, /* tlut pointer */ - gfxd_Timg, /* texture image pointer */ - gfxd_Tmem, /* tmem address */ - gfxd_Tile, /* tile index */ - gfxd_Fmt, /* texture format */ - gfxd_Siz, /* texture pixel size */ - gfxd_Dim, /* integer dimension (width / height) */ - gfxd_Cm, /* clamp and mirror flags */ - gfxd_Tm, /* tile mask */ - gfxd_Ts, /* tile shift */ - gfxd_Dxt, /* texture dxt */ - gfxd_Tag, /* generic tag */ - gfxd_Pm, /* pipeline mode */ - gfxd_Colorpart, /* color component */ - gfxd_Color, /* color */ - gfxd_Lodfrac, /* lod fraction (q0.8) */ - gfxd_Cimg, /* color image pointer */ - gfxd_Zimg, /* depth image pointer */ - gfxd_Ac, /* alpha compare mode */ - gfxd_Ad, /* alpha dither mode */ - gfxd_Cd, /* color dither mode */ - gfxd_Ccpre, /* color combiner preset index */ - gfxd_Ccmuxa, /* color mux operand (a) */ - gfxd_Ccmuxb, /* color mux operand (b) */ - gfxd_Ccmuxc, /* color mux operand (c) */ - gfxd_Ccmuxd, /* color mux operand (d) */ - gfxd_Acmuxabd, /* alpha mux operand (a, b, or d) */ - gfxd_Acmuxc, /* alpha mux operand (c) */ - gfxd_Cv, /* color convert operand */ - gfxd_Tc, /* texture convert mode */ - gfxd_Cyc, /* cycle type */ - gfxd_Zs, /* depth source mode */ - gfxd_Ck, /* combine key mode */ - gfxd_Keyscale, /* combine key scale */ - gfxd_Keywidth, /* combine key width */ - gfxd_Zi, /* integer depth */ - gfxd_Rm1, /* cycle 1 render mode */ - gfxd_Rm2, /* cycle 2 render mode */ - gfxd_Sc, /* scissor mode */ - gfxd_Td, /* texture detail mode */ - gfxd_Tf, /* texture filter mode */ - gfxd_Tl, /* texture LOD mode */ - gfxd_Tt, /* textuure LUT mode */ - gfxd_Tp, /* texture perspective mode */ - gfxd_Line, /* texture line size */ - gfxd_Vtx, /* vertex index */ - gfxd_Vtxflag, /* vertex flag */ - gfxd_Dl, /* display list pointer */ - gfxd_Zraw, /* raw depth value (q16.16) */ - gfxd_Dlflag, /* display list flag */ - gfxd_Cr, /* clip ratio */ - gfxd_Num, /* element count */ - gfxd_Fogz, /* fog factor */ - gfxd_Fogp, /* fog position (0 - 1000) */ - gfxd_Mtxptr, /* matrix pointer */ - gfxd_Gm, /* geometry mode */ - gfxd_Mwo_matrix, /* matrix moveword offset */ - gfxd_Linewd, /* line width (1.5 + q7.1) */ - gfxd_Uctext, /* microcode text pointer */ - gfxd_Ucdata, /* microcode data pointer */ - gfxd_Size, /* data size */ - gfxd_Lookatptr, /* lookat pointer */ - gfxd_Mtxparam, /* matrix param */ - gfxd_Mtxstack, /* matrix param (stack select only) */ - gfxd_Mwo_point, /* vertex moveword offset */ - gfxd_Wscale, /* w-component scale (perspnorm) */ - gfxd_Seg, /* segment number */ - gfxd_Segptr, /* segment pointer */ - gfxd_Lightsn, /* dereferenced Lighstn pointer */ - gfxd_Numlights, /* light count (NUMLIGHTS_*) */ - gfxd_Lightnum, /* light number (LIGHT_*) */ - gfxd_Lightptr, /* light pointer */ - gfxd_Tcscale, /* texture coordinate scale */ - gfxd_Switch, /* on-off value */ - gfxd_St, /* vertex coordinate (q10.5) */ - gfxd_Stdelta, /* vertex coordinate delta (q5.10) */ - gfxd_Vtxptr, /* vertex pointer */ - gfxd_Vpptr, /* viewport pointer */ - gfxd_Dram, /* generic dram address */ - gfxd_Sftlo, /* othermode lo shift */ - gfxd_Othermodelo, /* othermode lo value */ - gfxd_Sfthi, /* othermode hi shift */ - gfxd_Othermodehi, /* othermode hi value */ - gfxd_Mw, /* moveword index */ - gfxd_Mwo, /* moveword offset */ - gfxd_Mwo_clip, /* clip ratio moveword offset */ - gfxd_Mwo_lightcol, /* light color moveword offset */ - gfxd_Mv, /* movemem index */ - gfxd_Mvo, /* movemem offset */ - gfxd_Dmem, /* dmem address */ - gfxd_Dmaflag, /* dma io flag */ -}; - -enum -{ - gfxd_Invalid, - gfxd_DPFillRectangle, - gfxd_DPFullSync, - gfxd_DPLoadSync, - gfxd_DPTileSync, - gfxd_DPPipeSync, - gfxd_DPLoadTLUT_pal16, - gfxd_DPLoadTLUT_pal256, - gfxd_DPLoadMultiBlockYuvS, - gfxd_DPLoadMultiBlockYuv, - gfxd_DPLoadMultiBlock_4bS, - gfxd_DPLoadMultiBlock_4b, - gfxd_DPLoadMultiBlockS, - gfxd_DPLoadMultiBlock, - gfxd__DPLoadTextureBlockYuvS, - gfxd__DPLoadTextureBlockYuv, - gfxd__DPLoadTextureBlock_4bS, - gfxd__DPLoadTextureBlock_4b, - gfxd__DPLoadTextureBlockS, - gfxd__DPLoadTextureBlock, - gfxd_DPLoadTextureBlockYuvS, - gfxd_DPLoadTextureBlockYuv, - gfxd_DPLoadTextureBlock_4bS, - gfxd_DPLoadTextureBlock_4b, - gfxd_DPLoadTextureBlockS, - gfxd_DPLoadTextureBlock, - gfxd_DPLoadMultiTileYuv, - gfxd_DPLoadMultiTile_4b, - gfxd_DPLoadMultiTile, - gfxd__DPLoadTextureTileYuv, - gfxd__DPLoadTextureTile_4b, - gfxd__DPLoadTextureTile, - gfxd_DPLoadTextureTileYuv, - gfxd_DPLoadTextureTile_4b, - gfxd_DPLoadTextureTile, - gfxd_DPLoadBlock, - gfxd_DPNoOp, - gfxd_DPNoOpTag, - gfxd_DPPipelineMode, - gfxd_DPSetBlendColor, - gfxd_DPSetEnvColor, - gfxd_DPSetFillColor, - gfxd_DPSetFogColor, - gfxd_DPSetPrimColor, - gfxd_DPSetColorImage, - gfxd_DPSetDepthImage, - gfxd_DPSetTextureImage, - gfxd_DPSetAlphaCompare, - gfxd_DPSetAlphaDither, - gfxd_DPSetColorDither, - gfxd_DPSetCombineMode, - gfxd_DPSetCombineLERP, - gfxd_DPSetConvert, - gfxd_DPSetTextureConvert, - gfxd_DPSetCycleType, - gfxd_DPSetDepthSource, - gfxd_DPSetCombineKey, - gfxd_DPSetKeyGB, - gfxd_DPSetKeyR, - gfxd_DPSetPrimDepth, - gfxd_DPSetRenderMode, - gfxd_DPSetScissor, - gfxd_DPSetScissorFrac, - gfxd_DPSetTextureDetail, - gfxd_DPSetTextureFilter, - gfxd_DPSetTextureLOD, - gfxd_DPSetTextureLUT, - gfxd_DPSetTexturePersp, - gfxd_DPSetTile, - gfxd_DPSetTileSize, - gfxd_SP1Triangle, - gfxd_SP2Triangles, - gfxd_SP1Quadrangle, - gfxd_SPBranchLessZraw, - gfxd_SPBranchList, - gfxd_SPClipRatio, - gfxd_SPCullDisplayList, - gfxd_SPDisplayList, - gfxd_SPEndDisplayList, - gfxd_SPFogFactor, - gfxd_SPFogPosition, - gfxd_SPForceMatrix, - gfxd_SPSetGeometryMode, - gfxd_SPClearGeometryMode, - gfxd_SPLoadGeometryMode, - gfxd_SPInsertMatrix, - gfxd_SPLine3D, - gfxd_SPLineW3D, - gfxd_SPLoadUcode, - gfxd_SPLookAtX, - gfxd_SPLookAtY, - gfxd_SPLookAt, - gfxd_SPMatrix, - gfxd_SPModifyVertex, - gfxd_SPPerspNormalize, - gfxd_SPPopMatrix, - gfxd_SPPopMatrixN, - gfxd_SPSegment, - gfxd_SPSetLights1, - gfxd_SPSetLights2, - gfxd_SPSetLights3, - gfxd_SPSetLights4, - gfxd_SPSetLights5, - gfxd_SPSetLights6, - gfxd_SPSetLights7, - gfxd_SPNumLights, - gfxd_SPLight, - gfxd_SPLightColor, - gfxd_SPTexture, - gfxd_SPTextureRectangle, - gfxd_SPTextureRectangleFlip, - gfxd_SPVertex, - gfxd_SPViewport, - gfxd_DPLoadTLUTCmd, - gfxd_DPLoadTLUT, - gfxd_BranchZ, - gfxd_DisplayList, - gfxd_DPHalf1, - gfxd_DPHalf2, - gfxd_DPWord, - gfxd_DPLoadTile, - gfxd_SPGeometryMode, - gfxd_SPSetOtherMode, - gfxd_SPSetOtherModeLo, - gfxd_SPSetOtherModeHi, - gfxd_DPSetOtherMode, - gfxd_MoveWd, - gfxd_MoveMem, - gfxd_SPDma_io, - gfxd_SPDmaRead, - gfxd_SPDmaWrite, - gfxd_LoadUcode, - gfxd_SPLoadUcodeEx, - gfxd_TexRect, - gfxd_TexRectFlip, - gfxd_SPNoOp, - gfxd_Special3, - gfxd_Special2, - gfxd_Special1, -}; - -enum -{ - gfxd_stop_on_invalid, - gfxd_stop_on_end, - gfxd_emit_dec_color, - gfxd_emit_q_macro, - gfxd_emit_ext_macro, -}; - -enum -{ - gfxd_endian_big, - gfxd_endian_little, - gfxd_endian_host, -}; - -enum -{ - gfxd_argfmt_i, - gfxd_argfmt_u, - gfxd_argfmt_f, -}; - -typedef union -{ - int32_t i; - uint32_t u; - float f; -} gfxd_value_t; - -typedef const struct gfxd_ucode *gfxd_ucode_t; - -typedef int gfxd_input_fn_t(void *buf, int count); -void gfxd_input_buffer(const void *buf, int size); -void gfxd_input_fd(int fd); -void gfxd_input_callback(gfxd_input_fn_t *fn); - -typedef int gfxd_output_fn_t(const char *buf, int count); -void gfxd_output_buffer(char *buf, int size); -void gfxd_output_fd(int fd); -void gfxd_output_callback(gfxd_output_fn_t *fn); - -typedef int gfxd_macro_fn_t(void); -void gfxd_macro_fn(gfxd_macro_fn_t *fn); -gfxd_macro_fn_t gfxd_macro_dflt; - -typedef void gfxd_arg_fn_t(int arg_num); -void gfxd_arg_fn(gfxd_arg_fn_t *fn); -gfxd_arg_fn_t gfxd_arg_dflt; - -typedef int gfxd_tlut_fn_t(uint32_t tlut, int32_t idx, int32_t count); -void gfxd_tlut_callback(gfxd_tlut_fn_t *fn); - -typedef int gfxd_timg_fn_t(uint32_t timg, int32_t fmt, int32_t siz, - int32_t width, int32_t height, int32_t pal); -void gfxd_timg_callback(gfxd_timg_fn_t *fn); - -typedef int gfxd_cimg_fn_t(uint32_t cimg, int32_t fmt, int32_t siz, - int32_t width); -void gfxd_cimg_callback(gfxd_cimg_fn_t *fn); - -typedef int gfxd_zimg_fn_t(uint32_t zimg); -void gfxd_zimg_callback(gfxd_zimg_fn_t *fn); - -typedef int gfxd_dl_fn_t(uint32_t dl); -void gfxd_dl_callback(gfxd_dl_fn_t *fn); - -typedef int gfxd_mtx_fn_t(uint32_t mtx); -void gfxd_mtx_callback(gfxd_mtx_fn_t *fn); - -typedef int gfxd_lookat_fn_t(uint32_t lookat, int32_t count); -void gfxd_lookat_callback(gfxd_lookat_fn_t *fn); - -typedef int gfxd_light_fn_t(uint32_t light, int32_t count); -void gfxd_light_callback(gfxd_light_fn_t *fn); - -typedef int gfxd_seg_fn_t(uint32_t seg, int32_t num); -void gfxd_seg_callback(gfxd_seg_fn_t *fn); - -typedef int gfxd_vtx_fn_t(uint32_t vtx, int32_t num); -void gfxd_vtx_callback(gfxd_vtx_fn_t *fn); - -typedef int gfxd_vp_fn_t(uint32_t vp); -void gfxd_vp_callback(gfxd_vp_fn_t *fn); - -typedef int gfxd_uctext_fn_t(uint32_t text, uint32_t size); -void gfxd_uctext_callback(gfxd_uctext_fn_t *fn); - -typedef int gfxd_ucdata_fn_t(uint32_t data, uint32_t size); -void gfxd_ucdata_callback(gfxd_ucdata_fn_t *fn); - -typedef int gfxd_dram_fn_t(uint32_t dram, uint32_t size); -void gfxd_dram_callback(gfxd_dram_fn_t *fn); - -int gfxd_write(const void *buf, int count); -int gfxd_puts(const char *str); -int gfxd_printf(const char *fmt, ...); -int gfxd_print_value(int type, const gfxd_value_t *value); - -void gfxd_target(gfxd_ucode_t ucode); -void gfxd_endian(int endian, int wordsize); -void gfxd_dynamic(const char *arg); -void gfxd_enable(int cap); -void gfxd_disable(int cap); -void gfxd_udata_set(void *ptr); -void *gfxd_udata_get(void); - -int gfxd_execute(void); - -int gfxd_macro_offset(void); -int gfxd_macro_packets(void); -const void *gfxd_macro_data(void); -int gfxd_macro_id(void); -const char *gfxd_macro_name(void); - -int gfxd_arg_count(void); -int gfxd_arg_type(int arg_num); -const char *gfxd_arg_name(int arg_num); -int gfxd_arg_fmt(int arg_num); -const gfxd_value_t *gfxd_arg_value(int arg_num); -const gfxd_value_t *gfxd_value_by_type(int type, int idx); -int gfxd_arg_valid(int arg_num); -int gfxd_arg_callbacks(int arg_num); - -extern const gfxd_ucode_t gfxd_f3d; -extern const gfxd_ucode_t gfxd_f3db; -extern const gfxd_ucode_t gfxd_f3dex; -extern const gfxd_ucode_t gfxd_f3dexb; -extern const gfxd_ucode_t gfxd_f3dex2; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/tools/ZAPD/lib/libgfxd/priv.h b/tools/ZAPD/lib/libgfxd/priv.h deleted file mode 100644 index 37cb66b683..0000000000 --- a/tools/ZAPD/lib/libgfxd/priv.h +++ /dev/null @@ -1,123 +0,0 @@ -#ifndef GFXD_PRIV_H -#define GFXD_PRIV_H -#include "gfxd.h" - -#ifdef CONFIG_MT -# ifdef _MSC_VER -# define TLOCAL __declspec(thread) -# else -# define TLOCAL _Thread_local -# endif -#else -# define TLOCAL -#endif - -#define UCFUNC static inline - -#define config gfxd_config__ - -typedef int gfxd_argfn_t(const gfxd_value_t *v); - -typedef struct -{ - int fmt; - gfxd_argfn_t * fn; -} gfxd_arg_type_t; - -typedef struct -{ - int type; - const char * name; - gfxd_value_t value; - int bad; -} gfxd_arg_t; - -typedef struct -{ - int id; - gfxd_arg_t arg[18]; -} gfxd_macro_t; - -typedef int gfxd_disas_fn_t(gfxd_macro_t *macro, uint32_t hi, uint32_t lo); -typedef int gfxd_combine_fn_t(gfxd_macro_t *macro, int n_macro); - -typedef struct -{ - const char * prefix; - const char * suffix; - int opcode; - int n_arg; - int n_gfx; - gfxd_disas_fn_t * disas_fn; - gfxd_combine_fn_t * combine_fn; - int alias; - int ext; -} gfxd_macro_type_t; - -struct gfxd_ucode -{ - gfxd_disas_fn_t * disas_fn; - gfxd_combine_fn_t * combine_fn; - const gfxd_arg_type_t * arg_tbl; - const gfxd_macro_type_t * macro_tbl; -}; - -struct gfxd_state -{ - int macro_offset; - - Gfx gfx[9]; - int n_byte; - int n_gfx; - gfxd_macro_t macro[9]; - - int end_input; - int ret; -}; - -struct gfxd_config -{ - gfxd_ucode_t ucode; - int endian; - int wordsize; - const char * arg; - void * udata; - - int stop_on_invalid; - int stop_on_end; - int emit_dec_color; - int emit_q_macro; - int emit_ext_macro; - - const char * input_buf; - int input_buf_size; - int input_fd; - gfxd_input_fn_t * input_fn; - - char * output_buf; - int output_buf_size; - int output_fd; - gfxd_output_fn_t * output_fn; - - gfxd_macro_fn_t * macro_fn; - gfxd_arg_fn_t * arg_fn; - - gfxd_tlut_fn_t * tlut_fn; - gfxd_timg_fn_t * timg_fn; - gfxd_cimg_fn_t * cimg_fn; - gfxd_zimg_fn_t * zimg_fn; - gfxd_dl_fn_t * dl_fn; - gfxd_mtx_fn_t * mtx_fn; - gfxd_lookat_fn_t * lookat_fn; - gfxd_light_fn_t * light_fn; - gfxd_seg_fn_t * seg_fn; - gfxd_vtx_fn_t * vtx_fn; - gfxd_vp_fn_t * vp_fn; - gfxd_uctext_fn_t * uctext_fn; - gfxd_ucdata_fn_t * ucdata_fn; - gfxd_dram_fn_t * dram_fn; -}; - -extern TLOCAL struct gfxd_config gfxd_config__; - -#endif diff --git a/tools/ZAPD/lib/libgfxd/uc.c b/tools/ZAPD/lib/libgfxd/uc.c deleted file mode 100644 index 7efb091052..0000000000 --- a/tools/ZAPD/lib/libgfxd/uc.c +++ /dev/null @@ -1,54 +0,0 @@ -#include -#include -#include -#include "gbi.h" -#include "gfxd.h" -#include "priv.h" - -#include "uc_argfn.c" -#include "uc_argtbl.c" -#include "uc_macrofn.c" -#include "uc_macrotbl.c" - -UCFUNC int disas(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - int opcode = (hi >> 24) & 0xFF; - - for (int i = 0; i < sizeof(macro_tbl) / sizeof(macro_tbl[0]); i++) - { - const gfxd_macro_type_t *t = ¯o_tbl[i]; - if (t->disas_fn != NULL && t->opcode == opcode) - return t->disas_fn(m, hi, lo); - } - - return d_Invalid(m, hi, lo); -} - -UCFUNC int combine(gfxd_macro_t *m, int num) -{ - int opcode = macro_tbl[m->id].opcode; - - for (int i = 0; i < sizeof(macro_tbl) / sizeof(macro_tbl[0]); i++) - { - const gfxd_macro_type_t *t = ¯o_tbl[i]; - if (t->combine_fn != NULL - && t->opcode == opcode - && (t->ext == 0 || config.emit_ext_macro != 0)) - { - if (t->combine_fn(m, num) == 0) - return 0; - } - } - - return -1; -} - -static const struct gfxd_ucode uc = -{ - .disas_fn = disas, - .combine_fn = combine, - .arg_tbl = arg_tbl, - .macro_tbl = macro_tbl, -}; - -const gfxd_ucode_t uc_name = &uc; diff --git a/tools/ZAPD/lib/libgfxd/uc_argfn.c b/tools/ZAPD/lib/libgfxd/uc_argfn.c deleted file mode 100644 index f65feb60f7..0000000000 --- a/tools/ZAPD/lib/libgfxd/uc_argfn.c +++ /dev/null @@ -1,1814 +0,0 @@ -#define MDMASK(md) ((((uint32_t)1 << G_MDSIZ_##md) - 1) << G_MDSFT_##md) -#define MDMASK_RM_C1 ((uint32_t)0xCCCC0000) -#define MDMASK_RM_C2 ((uint32_t)0x33330000) -#define MDMASK_RM_LO ((uint32_t)0x0000FFF8) - -UCFUNC int argfn_i(const gfxd_value_t *v) -{ - return gfxd_printf("%" PRIi32, v->i); -} - -UCFUNC int argfn_u(const gfxd_value_t *v) -{ - return gfxd_printf("%" PRIu32, v->u); -} - -UCFUNC int argfn_x8(const gfxd_value_t *v) -{ - return gfxd_printf("0x%02" PRIX32, v->u); -} - -UCFUNC int argfn_x16(const gfxd_value_t *v) -{ - return gfxd_printf("0x%04" PRIX32, v->u); -} - -UCFUNC int argfn_x32(const gfxd_value_t *v) -{ - return gfxd_printf("0x%08" PRIX32, v->u); -} - -UCFUNC int argfn_color(const gfxd_value_t *v) -{ - if (config.emit_dec_color) - return gfxd_printf("%" PRIu32, v->u); - else - return gfxd_printf("0x%02" PRIX32, v->u); -} - -UCFUNC int argfn_qu08(const gfxd_value_t *v) -{ - if (v->u == 0) - return gfxd_puts("0"); - else if (config.emit_q_macro) - return gfxd_printf("qu08(%.16g)", v->u / 256.f); - else - return gfxd_printf("0x%02" PRIX32, v->u); -} - -UCFUNC int argfn_qu016(const gfxd_value_t *v) -{ - if (v->u == 0) - return gfxd_puts("0"); - else if (config.emit_q_macro) - return gfxd_printf("qu016(%.16g)", v->u / 65536.f); - else - return gfxd_printf("0x%04" PRIX32, v->u); -} - -UCFUNC int argfn_qs48(const gfxd_value_t *v) -{ - if (v->i == 0) - return gfxd_puts("0"); - else if (config.emit_q_macro) - return gfxd_printf("qs48(%.16g)", v->i / 256.f); - else - { - if (v->i < 0) - return gfxd_printf("-0x%04" PRIX32, (uint32_t)-v->i); - else - return gfxd_printf("0x%04" PRIX32, (uint32_t)v->i); - } -} - -UCFUNC int argfn_qs510(const gfxd_value_t *v) -{ - if (v->i == 0) - return gfxd_puts("0"); - else if (config.emit_q_macro) - return gfxd_printf("qs510(%.16g)", v->i / 1024.f); - else - { - if (v->i < 0) - return gfxd_printf("-0x%04" PRIX32, (uint32_t)-v->i); - else - return gfxd_printf("0x%04" PRIX32, (uint32_t)v->i); - } -} - -UCFUNC int argfn_qu102(const gfxd_value_t *v) -{ - if (v->u == 0) - return gfxd_puts("0"); - else if (config.emit_q_macro) - return gfxd_printf("qu102(%.16g)", v->u / 4.f); - else - return gfxd_printf("0x%04" PRIX32, v->u); -} - -UCFUNC int argfn_qs105(const gfxd_value_t *v) -{ - if (v->i == 0) - return gfxd_puts("0"); - else if (config.emit_q_macro) - return gfxd_printf("qs105(%.16g)", v->i / 32.f); - else - { - if (v->i < 0) - return gfxd_printf("-0x%04" PRIX32, (uint32_t)-v->i); - else - return gfxd_printf("0x%04" PRIX32, (uint32_t)v->i); - } -} - -UCFUNC int argfn_qs1616(const gfxd_value_t *v) -{ - if (v->i == 0) - return gfxd_puts("0"); - else if (config.emit_q_macro) - return gfxd_printf("qs1616(%.16g)", v->i / 65536.f); - else - { - if (v->i < 0) - return gfxd_printf("-0x%08" PRIX32, (uint32_t)-v->i); - else - return gfxd_printf("0x%08" PRIX32, (uint32_t)v->i); - } -} - -UCFUNC int argfn_opc(const gfxd_value_t *v) -{ - switch (v->i) - { - case G_SPNOOP: - return gfxd_puts("G_SPNOOP"); - case G_MTX: - return gfxd_puts("G_MTX"); - case G_MOVEMEM: - return gfxd_puts("G_MOVEMEM"); - case G_VTX: - return gfxd_puts("G_VTX"); - case G_DL: - return gfxd_puts("G_DL"); - case G_RDPHALF_2: - return gfxd_puts("G_RDPHALF_2"); - case G_RDPHALF_1: - return gfxd_puts("G_RDPHALF_1"); -#if defined(F3D_BETA) && (defined(F3D_GBI) || defined(F3DEX_GBI)) - case G_PERSPNORM: - return gfxd_puts("G_PERSPNORM"); -#endif - case G_LINE3D: - return gfxd_puts("G_LINE3D"); -#if defined(F3D_GBI) || defined(F3DEX_GBI) - case G_CLEARGEOMETRYMODE: - return gfxd_puts("G_CLEARGEOMETRYMODE"); - case G_SETGEOMETRYMODE: - return gfxd_puts("G_SETGEOMETRYMODE"); -#endif - case G_ENDDL: - return gfxd_puts("G_ENDDL"); - case G_SETOTHERMODE_L: - return gfxd_puts("G_SETOTHERMODE_L"); - case G_SETOTHERMODE_H: - return gfxd_puts("G_SETOTHERMODE_H"); - case G_TEXTURE: - return gfxd_puts("G_TEXTURE"); - case G_MOVEWORD: - return gfxd_puts("G_MOVEWORD"); - case G_POPMTX: - return gfxd_puts("G_POPMTX"); - case G_CULLDL: - return gfxd_puts("G_CULLDL"); - case G_TRI1: - return gfxd_puts("G_TRI1"); - case G_NOOP: - return gfxd_puts("G_NOOP"); -#if defined(F3DEX_GBI) || defined(F3DEX_GBI_2) - case G_LOAD_UCODE: - return gfxd_puts("G_LOAD_UCODE"); - case G_BRANCH_Z: - return gfxd_puts("G_BRANCH_Z"); - case G_TRI2: - return gfxd_puts("G_TRI2"); -# if !(defined(F3D_BETA) && defined(F3DEX_GBI)) - case G_MODIFYVTX: - return gfxd_puts("G_MODIFYVTX"); -# endif -#endif -#if defined(F3DEX_GBI_2) - case G_QUAD: - return gfxd_puts("G_QUAD"); - case G_SPECIAL_3: - return gfxd_puts("G_SPECIAL_3"); - case G_SPECIAL_2: - return gfxd_puts("G_SPECIAL_2"); - case G_SPECIAL_1: - return gfxd_puts("G_SPECIAL_1"); - case G_DMA_IO: - return gfxd_puts("G_DMA_IO"); - case G_GEOMETRYMODE: - return gfxd_puts("G_GEOMETRYMODE"); -#endif - case G_TEXRECT: - return gfxd_puts("G_TEXRECT"); - case G_TEXRECTFLIP: - return gfxd_puts("G_TEXRECTFLIP"); - case G_RDPLOADSYNC: - return gfxd_puts("G_RDPLOADSYNC"); - case G_RDPPIPESYNC: - return gfxd_puts("G_RDPPIPESYNC"); - case G_RDPTILESYNC: - return gfxd_puts("G_RDPTILESYNC"); - case G_RDPFULLSYNC: - return gfxd_puts("G_RDPFULLSYNC"); - case G_SETKEYGB: - return gfxd_puts("G_SETKEYGB"); - case G_SETKEYR: - return gfxd_puts("G_SETKEYR"); - case G_SETCONVERT: - return gfxd_puts("G_SETCONVERT"); - case G_SETSCISSOR: - return gfxd_puts("G_SETSCISSOR"); - case G_SETPRIMDEPTH: - return gfxd_puts("G_SETPRIMDEPTH"); - case G_RDPSETOTHERMODE: - return gfxd_puts("G_RDPSETOTHERMODE"); - case G_LOADTLUT: - return gfxd_puts("G_LOADTLUT"); - case G_SETTILESIZE: - return gfxd_puts("G_SETTILESIZE"); - case G_LOADBLOCK: - return gfxd_puts("G_LOADBLOCK"); - case G_LOADTILE: - return gfxd_puts("G_LOADTILE"); - case G_SETTILE: - return gfxd_puts("G_SETTILE"); - case G_FILLRECT: - return gfxd_puts("G_FILLRECT"); - case G_SETFILLCOLOR: - return gfxd_puts("G_SETFILLCOLOR"); - case G_SETFOGCOLOR: - return gfxd_puts("G_SETFOGCOLOR"); - case G_SETBLENDCOLOR: - return gfxd_puts("G_SETBLENDCOLOR"); - case G_SETPRIMCOLOR: - return gfxd_puts("G_SETPRIMCOLOR"); - case G_SETENVCOLOR: - return gfxd_puts("G_SETENVCOLOR"); - case G_SETCOMBINE: - return gfxd_puts("G_SETCOMBINE"); - case G_SETTIMG: - return gfxd_puts("G_SETTIMG"); - case G_SETZIMG: - return gfxd_puts("G_SETZIMG"); - case G_SETCIMG: - return gfxd_puts("G_SETCIMG"); - default: - return gfxd_printf("0x%02" PRIX32, (uint32_t)v->i); - } -} - -UCFUNC int argfn_fmt(const gfxd_value_t *v) -{ - switch (v->i) - { - case G_IM_FMT_RGBA: - return gfxd_puts("G_IM_FMT_RGBA"); - case G_IM_FMT_YUV: - return gfxd_puts("G_IM_FMT_YUV"); - case G_IM_FMT_CI: - return gfxd_puts("G_IM_FMT_CI"); - case G_IM_FMT_IA: - return gfxd_puts("G_IM_FMT_IA"); - case G_IM_FMT_I: - return gfxd_puts("G_IM_FMT_I"); - default: - return gfxd_printf("%" PRIi32, v->i); - } -} - -UCFUNC int argfn_siz(const gfxd_value_t *v) -{ - switch (v->i) - { - case G_IM_SIZ_4b: - return gfxd_puts("G_IM_SIZ_4b"); - case G_IM_SIZ_8b: - return gfxd_puts("G_IM_SIZ_8b"); - case G_IM_SIZ_16b: - return gfxd_puts("G_IM_SIZ_16b"); - case G_IM_SIZ_32b: - return gfxd_puts("G_IM_SIZ_32b"); - default: - return gfxd_printf("%" PRIi32, v->i); - } -} - -UCFUNC int argfn_cm(const gfxd_value_t *v) -{ - int n = 0; - if (v->u & G_TX_MIRROR) - n += gfxd_puts("G_TX_MIRROR"); - else - n += gfxd_puts("G_TX_NOMIRROR"); - if (v->u & G_TX_CLAMP) - n += gfxd_puts(" | G_TX_CLAMP"); - else - n += gfxd_puts(" | G_TX_WRAP"); - return n; -} - -UCFUNC int argfn_tm(const gfxd_value_t *v) -{ - if (v->i == 0) - return gfxd_puts("G_TX_NOMASK"); - else - return gfxd_printf("%" PRIi32, v->i); -} - -UCFUNC int argfn_ts(const gfxd_value_t *v) -{ - if (v->i == 0) - return gfxd_puts("G_TX_NOLOD"); - else - return gfxd_printf("%" PRIi32, v->i); -} - -UCFUNC int argfn_switch(const gfxd_value_t *v) -{ - switch (v->i) - { - case G_ON: - return gfxd_puts("G_ON"); - case G_OFF: - return gfxd_puts("G_OFF"); - default: - return gfxd_printf("%" PRIi32, v->i); - } -} - -UCFUNC int argfn_tile(const gfxd_value_t *v) -{ - if (v->i == G_TX_LOADTILE) - return gfxd_puts("G_TX_LOADTILE"); - else if (v->i == G_TX_RENDERTILE) - return gfxd_puts("G_TX_RENDERTILE"); - else - return gfxd_printf("%" PRIi32, v->i); -} - -UCFUNC int argfn_gm(const gfxd_value_t *v) -{ - int n = 0; - uint32_t arg = v->u; - if (arg & G_ZBUFFER) - n += gfxd_puts("G_ZBUFFER"); - if (arg & G_TEXTURE_ENABLE) - { - if (n > 0) - n += gfxd_puts(" | "); - n += gfxd_puts("G_TEXTURE_ENABLE"); - } - if (arg & G_SHADE) - { - if (n > 0) - n += gfxd_puts(" | "); - n += gfxd_puts("G_SHADE"); - } - if ((arg & G_CULL_BOTH) == G_CULL_BOTH) - { - if (n > 0) - n += gfxd_puts(" | "); - n += gfxd_puts("G_CULL_BOTH"); - } - else - { - if (arg & G_CULL_FRONT) - { - if (n > 0) - n += gfxd_puts(" | "); - n += gfxd_puts("G_CULL_FRONT"); - } - if (arg & G_CULL_BACK) - { - if (n > 0) - n += gfxd_puts(" | "); - n += gfxd_puts("G_CULL_BACK"); - } - } - if (arg & G_FOG) - { - if (n > 0) - n += gfxd_puts(" | "); - n += gfxd_puts("G_FOG"); - } - if (arg & G_LIGHTING) - { - if (n > 0) - n += gfxd_puts(" | "); - n += gfxd_puts("G_LIGHTING"); - } - if (arg & G_TEXTURE_GEN) - { - if (n > 0) - n += gfxd_puts(" | "); - n += gfxd_puts("G_TEXTURE_GEN"); - } - if (arg & G_TEXTURE_GEN_LINEAR) - { - if (n > 0) - n += gfxd_puts(" | "); - n += gfxd_puts("G_TEXTURE_GEN_LINEAR"); - } - if (arg & G_LOD) - { - if (n > 0) - n += gfxd_puts(" | "); - n += gfxd_puts("G_LOD"); - } - if (arg & G_SHADING_SMOOTH) - { - if (n > 0) - n += gfxd_puts(" | "); - n += gfxd_puts("G_SHADING_SMOOTH"); - } - if (arg & G_CLIPPING) - { - if (n > 0) - n += gfxd_puts(" | "); - n += gfxd_puts("G_CLIPPING"); - } - arg = arg & ~(G_ZBUFFER | G_TEXTURE_ENABLE | G_SHADE | G_CULL_BOTH | - G_FOG | G_LIGHTING | G_TEXTURE_GEN | - G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH | - G_CLIPPING); - if (arg) - { - if (n > 0) - n += gfxd_puts(" | "); - n += gfxd_printf("0x%08" PRIX32, arg); - } - return n; -} - -UCFUNC int argfn_sftlo(const gfxd_value_t *v) -{ - switch (v->i) - { - case G_MDSFT_ALPHACOMPARE: - return gfxd_puts("G_MDSFT_ALPHACOMPARE"); - case G_MDSFT_ZSRCSEL: - return gfxd_puts("G_MDSFT_ZSRCSEL"); - case G_MDSFT_RENDERMODE: - return gfxd_puts("G_MDSFT_RENDERMODE"); - case G_MDSFT_BLENDER: - return gfxd_puts("G_MDSFT_BLENDER"); - default: - return gfxd_printf("%" PRIi32, v->i); - } -} - -UCFUNC int rm_mode_str(uint32_t arg) -{ - int n = 0; - if (arg & AA_EN) - n += gfxd_puts("AA_EN"); - if (arg & Z_CMP) - { - if (n > 0) - n += gfxd_puts(" | "); - n += gfxd_puts("Z_CMP"); - } - if (arg & Z_UPD) - { - if (n > 0) - n += gfxd_puts(" | "); - n += gfxd_puts("Z_UPD"); - } - if (arg & IM_RD) - { - if (n > 0) - n += gfxd_puts(" | "); - n += gfxd_puts("IM_RD"); - } - if (arg & CLR_ON_CVG) - { - if (n > 0) - n += gfxd_puts(" | "); - n += gfxd_puts("CLR_ON_CVG"); - } - if (n > 0) - n += gfxd_puts(" | "); - int cvg = arg & 0x00000300; - switch (cvg) - { - case CVG_DST_CLAMP: - n += gfxd_puts("CVG_DST_CLAMP"); - break; - case CVG_DST_WRAP: - n += gfxd_puts("CVG_DST_WRAP"); - break; - case CVG_DST_FULL: - n += gfxd_puts("CVG_DST_FULL"); - break; - case CVG_DST_SAVE: - n += gfxd_puts("CVG_DST_SAVE"); - break; - } - int zmode = arg & 0x00000C00; - switch (zmode) - { - case ZMODE_OPA: - n += gfxd_puts(" | ZMODE_OPA"); - break; - case ZMODE_INTER: - n += gfxd_puts(" | ZMODE_INTER"); - break; - case ZMODE_XLU: - n += gfxd_puts(" | ZMODE_XLU"); - break; - case ZMODE_DEC: - n += gfxd_puts(" | ZMODE_DEC"); - break; - } - if (arg & CVG_X_ALPHA) - n += gfxd_puts(" | CVG_X_ALPHA"); - if (arg & ALPHA_CVG_SEL) - n += gfxd_puts(" | ALPHA_CVG_SEL"); - if (arg & FORCE_BL) - n += gfxd_puts(" | FORCE_BL"); - return n; -} - -UCFUNC int rm_cbl_str(uint32_t arg, int c) -{ - int n = 0; - if (c == 2) - arg <<= 2; - int bp = (arg >> 30) & 0b11; - switch (bp) - { - case G_BL_CLR_IN: - n += gfxd_printf("GBL_c%i(G_BL_CLR_IN", c); - break; - case G_BL_CLR_MEM: - n += gfxd_printf("GBL_c%i(G_BL_CLR_MEM", c); - break; - case G_BL_CLR_BL: - n += gfxd_printf("GBL_c%i(G_BL_CLR_BL", c); - break; - case G_BL_CLR_FOG: - n += gfxd_printf("GBL_c%i(G_BL_CLR_FOG", c); - break; - } - int ba = (arg >> 26) & 0b11; - switch (ba) - { - case G_BL_A_IN: - n += gfxd_puts(", G_BL_A_IN"); - break; - case G_BL_A_FOG: - n += gfxd_puts(", G_BL_A_FOG"); - break; - case G_BL_A_SHADE: - n += gfxd_puts(", G_BL_A_SHADE"); - break; - case G_BL_0: - n += gfxd_puts(", G_BL_0"); - break; - } - int bm = (arg >> 22) & 0b11; - switch (bm) - { - case G_BL_CLR_IN: - n += gfxd_puts(", G_BL_CLR_IN"); - break; - case G_BL_CLR_MEM: - n += gfxd_puts(", G_BL_CLR_MEM"); - break; - case G_BL_CLR_BL: - n += gfxd_puts(", G_BL_CLR_BL"); - break; - case G_BL_CLR_FOG: - n += gfxd_puts(", G_BL_CLR_FOG"); - break; - } - int bb = (arg >> 18) & 0b11; - switch (bb) - { - case G_BL_1MA: - n += gfxd_puts(", G_BL_1MA)"); - break; - case G_BL_A_MEM: - n += gfxd_puts(", G_BL_A_MEM)"); - break; - case G_BL_1: - n += gfxd_puts(", G_BL_1)"); - break; - case G_BL_0: - n += gfxd_puts(", G_BL_0)"); - break; - } - return n; -} - -struct rm_preset -{ - uint32_t rm; - const char * name; -}; - -static const struct rm_preset rm_presets[] = -{ - {G_RM_OPA_SURF, "G_RM_OPA_SURF"}, - {G_RM_OPA_SURF2, "G_RM_OPA_SURF2"}, - {G_RM_AA_OPA_SURF, "G_RM_AA_OPA_SURF"}, - {G_RM_AA_OPA_SURF2, "G_RM_AA_OPA_SURF2"}, - {G_RM_RA_OPA_SURF, "G_RM_RA_OPA_SURF"}, - {G_RM_RA_OPA_SURF2, "G_RM_RA_OPA_SURF2"}, - {G_RM_ZB_OPA_SURF, "G_RM_ZB_OPA_SURF"}, - {G_RM_ZB_OPA_SURF2, "G_RM_ZB_OPA_SURF2"}, - {G_RM_AA_ZB_OPA_SURF, "G_RM_AA_ZB_OPA_SURF"}, - {G_RM_AA_ZB_OPA_SURF2, "G_RM_AA_ZB_OPA_SURF2"}, - {G_RM_RA_ZB_OPA_SURF, "G_RM_RA_ZB_OPA_SURF"}, - {G_RM_RA_ZB_OPA_SURF2, "G_RM_RA_ZB_OPA_SURF2"}, - {G_RM_XLU_SURF, "G_RM_XLU_SURF"}, - {G_RM_XLU_SURF2, "G_RM_XLU_SURF2"}, - {G_RM_AA_XLU_SURF, "G_RM_AA_XLU_SURF"}, - {G_RM_AA_XLU_SURF2, "G_RM_AA_XLU_SURF2"}, - {G_RM_ZB_XLU_SURF, "G_RM_ZB_XLU_SURF"}, - {G_RM_ZB_XLU_SURF2, "G_RM_ZB_XLU_SURF2"}, - {G_RM_AA_ZB_XLU_SURF, "G_RM_AA_ZB_XLU_SURF"}, - {G_RM_AA_ZB_XLU_SURF2, "G_RM_AA_ZB_XLU_SURF2"}, - {G_RM_ZB_OPA_DECAL, "G_RM_ZB_OPA_DECAL"}, - {G_RM_ZB_OPA_DECAL2, "G_RM_ZB_OPA_DECAL2"}, - {G_RM_AA_ZB_OPA_DECAL, "G_RM_AA_ZB_OPA_DECAL"}, - {G_RM_AA_ZB_OPA_DECAL2, "G_RM_AA_ZB_OPA_DECAL2"}, - {G_RM_RA_ZB_OPA_DECAL, "G_RM_RA_ZB_OPA_DECAL"}, - {G_RM_RA_ZB_OPA_DECAL2, "G_RM_RA_ZB_OPA_DECAL2"}, - {G_RM_ZB_XLU_DECAL, "G_RM_ZB_XLU_DECAL"}, - {G_RM_ZB_XLU_DECAL2, "G_RM_ZB_XLU_DECAL2"}, - {G_RM_AA_ZB_XLU_DECAL, "G_RM_AA_ZB_XLU_DECAL"}, - {G_RM_AA_ZB_XLU_DECAL2, "G_RM_AA_ZB_XLU_DECAL2"}, - {G_RM_AA_ZB_OPA_INTER, "G_RM_AA_ZB_OPA_INTER"}, - {G_RM_AA_ZB_OPA_INTER2, "G_RM_AA_ZB_OPA_INTER2"}, - {G_RM_RA_ZB_OPA_INTER, "G_RM_RA_ZB_OPA_INTER"}, - {G_RM_RA_ZB_OPA_INTER2, "G_RM_RA_ZB_OPA_INTER2"}, - {G_RM_AA_ZB_XLU_INTER, "G_RM_AA_ZB_XLU_INTER"}, - {G_RM_AA_ZB_XLU_INTER2, "G_RM_AA_ZB_XLU_INTER2"}, - {G_RM_AA_XLU_LINE, "G_RM_AA_XLU_LINE"}, - {G_RM_AA_XLU_LINE2, "G_RM_AA_XLU_LINE2"}, - {G_RM_AA_ZB_XLU_LINE, "G_RM_AA_ZB_XLU_LINE"}, - {G_RM_AA_ZB_XLU_LINE2, "G_RM_AA_ZB_XLU_LINE2"}, - {G_RM_AA_DEC_LINE, "G_RM_AA_DEC_LINE"}, - {G_RM_AA_DEC_LINE2, "G_RM_AA_DEC_LINE2"}, - {G_RM_AA_ZB_DEC_LINE, "G_RM_AA_ZB_DEC_LINE"}, - {G_RM_AA_ZB_DEC_LINE2, "G_RM_AA_ZB_DEC_LINE2"}, - {G_RM_TEX_EDGE, "G_RM_TEX_EDGE"}, - {G_RM_TEX_EDGE2, "G_RM_TEX_EDGE2"}, - {G_RM_AA_TEX_EDGE, "G_RM_AA_TEX_EDGE"}, - {G_RM_AA_TEX_EDGE2, "G_RM_AA_TEX_EDGE2"}, - {G_RM_AA_ZB_TEX_EDGE, "G_RM_AA_ZB_TEX_EDGE"}, - {G_RM_AA_ZB_TEX_EDGE2, "G_RM_AA_ZB_TEX_EDGE2"}, - {G_RM_AA_ZB_TEX_INTER, "G_RM_AA_ZB_TEX_INTER"}, - {G_RM_AA_ZB_TEX_INTER2, "G_RM_AA_ZB_TEX_INTER2"}, - {G_RM_AA_SUB_SURF, "G_RM_AA_SUB_SURF"}, - {G_RM_AA_SUB_SURF2, "G_RM_AA_SUB_SURF2"}, - {G_RM_AA_ZB_SUB_SURF, "G_RM_AA_ZB_SUB_SURF"}, - {G_RM_AA_ZB_SUB_SURF2, "G_RM_AA_ZB_SUB_SURF2"}, - {G_RM_PCL_SURF, "G_RM_PCL_SURF"}, - {G_RM_PCL_SURF2, "G_RM_PCL_SURF2"}, - {G_RM_AA_PCL_SURF, "G_RM_AA_PCL_SURF"}, - {G_RM_AA_PCL_SURF2, "G_RM_AA_PCL_SURF2"}, - {G_RM_ZB_PCL_SURF, "G_RM_ZB_PCL_SURF"}, - {G_RM_ZB_PCL_SURF2, "G_RM_ZB_PCL_SURF2"}, - {G_RM_AA_ZB_PCL_SURF, "G_RM_AA_ZB_PCL_SURF"}, - {G_RM_AA_ZB_PCL_SURF2, "G_RM_AA_ZB_PCL_SURF2"}, - {G_RM_AA_OPA_TERR, "G_RM_AA_OPA_TERR"}, - {G_RM_AA_OPA_TERR2, "G_RM_AA_OPA_TERR2"}, - {G_RM_AA_ZB_OPA_TERR, "G_RM_AA_ZB_OPA_TERR"}, - {G_RM_AA_ZB_OPA_TERR2, "G_RM_AA_ZB_OPA_TERR2"}, - {G_RM_AA_TEX_TERR, "G_RM_AA_TEX_TERR"}, - {G_RM_AA_TEX_TERR2, "G_RM_AA_TEX_TERR2"}, - {G_RM_AA_ZB_TEX_TERR, "G_RM_AA_ZB_TEX_TERR"}, - {G_RM_AA_ZB_TEX_TERR2, "G_RM_AA_ZB_TEX_TERR2"}, - {G_RM_AA_SUB_TERR, "G_RM_AA_SUB_TERR"}, - {G_RM_AA_SUB_TERR2, "G_RM_AA_SUB_TERR2"}, - {G_RM_AA_ZB_SUB_TERR, "G_RM_AA_ZB_SUB_TERR"}, - {G_RM_AA_ZB_SUB_TERR2, "G_RM_AA_ZB_SUB_TERR2"}, - {G_RM_CLD_SURF, "G_RM_CLD_SURF"}, - {G_RM_CLD_SURF2, "G_RM_CLD_SURF2"}, - {G_RM_ZB_CLD_SURF, "G_RM_ZB_CLD_SURF"}, - {G_RM_ZB_CLD_SURF2, "G_RM_ZB_CLD_SURF2"}, - {G_RM_ZB_OVL_SURF, "G_RM_ZB_OVL_SURF"}, - {G_RM_ZB_OVL_SURF2, "G_RM_ZB_OVL_SURF2"}, - {G_RM_ADD, "G_RM_ADD"}, - {G_RM_ADD2, "G_RM_ADD2"}, - {G_RM_VISCVG, "G_RM_VISCVG"}, - {G_RM_VISCVG2, "G_RM_VISCVG2"}, - {G_RM_OPA_CI, "G_RM_OPA_CI"}, - {G_RM_OPA_CI2, "G_RM_OPA_CI2"}, - {G_RM_RA_SPRITE, "G_RM_RA_SPRITE"}, - {G_RM_RA_SPRITE2, "G_RM_RA_SPRITE2"}, -}; - -static const struct rm_preset bl1_presets[] = -{ - {G_RM_FOG_SHADE_A, "G_RM_FOG_SHADE_A"}, - {G_RM_FOG_PRIM_A, "G_RM_FOG_PRIM_A"}, - {G_RM_PASS, "G_RM_PASS"}, - {G_RM_NOOP, "G_RM_NOOP"}, -}; - -static const struct rm_preset bl2_presets[] = -{ - {G_RM_NOOP2, "G_RM_NOOP2"}, -}; - -UCFUNC int othermodelo_str(uint32_t arg, uint32_t which) -{ - int n = 0; - uint32_t rm_c1_mask = MDMASK_RM_C1; - uint32_t rm_c2_mask = MDMASK_RM_C2; - uint32_t rm_mode_lo = MDMASK_RM_LO; - uint32_t rm_mask = rm_c1_mask | rm_c2_mask | rm_mode_lo; - const struct rm_preset *pre_c1 = NULL; - const struct rm_preset *pre_c2 = NULL; - int n_rm_presets = sizeof(rm_presets) / sizeof(*rm_presets); - for (int i = 0; i < n_rm_presets; i++) - { - const struct rm_preset *pre = &rm_presets[i]; - uint32_t pre_extra = pre->rm & ~rm_mask; - uint32_t rm_c1 = arg & (rm_c1_mask | rm_mode_lo | pre_extra); - if (!pre_c1 && rm_c1 == pre->rm) - pre_c1 = pre; - uint32_t rm_c2 = arg & (rm_c2_mask | rm_mode_lo | pre_extra); - if (!pre_c2 && rm_c2 == pre->rm) - pre_c2 = pre; - } - if (!pre_c1 || !pre_c2 || pre_c1 + 1 != pre_c2) - { - int n_bl1_presets = sizeof(bl1_presets) / sizeof(*bl1_presets); - for (int i = 0; i < n_bl1_presets; i++) - { - const struct rm_preset *pre = &bl1_presets[i]; - uint32_t pre_extra = pre->rm & ~rm_mask; - uint32_t rm_c1 = arg & (rm_c1_mask | pre_extra); - if (rm_c1 == pre->rm) - { - pre_c1 = pre; - break; - } - } - int n_bl2_presets = sizeof(bl2_presets) / sizeof(*bl2_presets); - for (int i = 0; i < n_bl2_presets; i++) - { - const struct rm_preset *pre = &bl2_presets[i]; - uint32_t pre_extra = pre->rm & ~rm_mask; - uint32_t rm_c2 = arg & (rm_c2_mask | pre_extra); - if (rm_c2 == pre->rm) - { - pre_c2 = pre; - break; - } - } - } - uint32_t pre_rm = 0; - if (pre_c1) - pre_rm |= pre_c1->rm; - if (pre_c2) - pre_rm |= pre_c2->rm; - uint32_t ac_mask = MDMASK(ALPHACOMPARE); - if (((arg & ~pre_rm) | which) & ac_mask) - { - uint32_t ac = arg & ac_mask; - switch (ac) - { - case G_AC_NONE: - n += gfxd_puts("G_AC_NONE"); - break; - case G_AC_THRESHOLD: - n += gfxd_puts("G_AC_THRESHOLD"); - break; - case G_AC_DITHER: - n += gfxd_puts("G_AC_DITHER"); - break; - default: - n += gfxd_printf("0x%08" PRIX32, ac); - break; - } - } - uint32_t zs_mask = MDMASK(ZSRCSEL); - if (((arg & ~pre_rm) | which) & zs_mask) - { - if (n > 0) - n += gfxd_puts(" | "); - uint32_t zs = arg & zs_mask; - switch (zs) - { - case G_ZS_PIXEL: - n += gfxd_puts("G_ZS_PIXEL"); - break; - case G_ZS_PRIM: - n += gfxd_puts("G_ZS_PRIM"); - break; - default: - n += gfxd_printf("0x%08" PRIX32, zs); - break; - } - } - uint32_t rm = arg & (rm_mask | pre_rm); - if (((arg & ~pre_rm) | which) & rm_mode_lo) - { - if (n > 0) - n += gfxd_puts(" | "); - n += rm_mode_str(rm); - } - int c = 0; - if (which & rm_c1_mask) - c |= 1; - if (which & rm_c2_mask) - c |= 2; - if (c & 1 || (c == 0 && arg & rm_c1_mask)) - { - if (n > 0) - n += gfxd_puts(" | "); - if (pre_c1) - n += gfxd_printf("%s", pre_c1->name); - else - n += rm_cbl_str(rm, 1); - } - if (c & 2 || (c == 0 && arg & rm_c2_mask)) - { - if (n > 0) - n += gfxd_puts(" | "); - if (pre_c2) - n += gfxd_printf("%s", pre_c2->name); - else - n += rm_cbl_str(rm, 2); - } - uint32_t unk_mask = ~(rm_mask | ac_mask | zs_mask); - if (arg & unk_mask) - { - if (n > 0) - n += gfxd_puts(" | "); - uint32_t unk = arg & unk_mask; - n += gfxd_printf("0x%08" PRIX32, unk); - } - return n; -} - -UCFUNC int argfn_ac(const gfxd_value_t *v) -{ - return othermodelo_str(v->u, MDMASK(ALPHACOMPARE)); -} - -UCFUNC int argfn_zs(const gfxd_value_t *v) -{ - return othermodelo_str(v->u, MDMASK(ZSRCSEL)); -} - -UCFUNC int argfn_rm1(const gfxd_value_t *v) -{ - return othermodelo_str(v->u, MDMASK_RM_C1); -} - -UCFUNC int argfn_rm2(const gfxd_value_t *v) -{ - return othermodelo_str(v->u, MDMASK_RM_C2); -} - -UCFUNC int argfn_othermodelo(const gfxd_value_t *v) -{ - uint32_t mask = MDMASK(ALPHACOMPARE) | MDMASK(ZSRCSEL) | MDMASK_RM_C1 | - MDMASK_RM_C2; - return othermodelo_str(v->u, mask); -} - -UCFUNC int argfn_sfthi(const gfxd_value_t *v) -{ - switch (v->i) - { - case G_MDSFT_ALPHADITHER: - return gfxd_puts("G_MDSFT_ALPHADITHER"); - case G_MDSFT_RGBDITHER: - return gfxd_puts("G_MDSFT_RGBDITHER"); - case G_MDSFT_COMBKEY: - return gfxd_puts("G_MDSFT_COMBKEY"); - case G_MDSFT_TEXTCONV: - return gfxd_puts("G_MDSFT_TEXTCONV"); - case G_MDSFT_TEXTFILT: - return gfxd_puts("G_MDSFT_TEXTFILT"); - case G_MDSFT_TEXTLUT: - return gfxd_puts("G_MDSFT_TEXTLUT"); - case G_MDSFT_TEXTLOD: - return gfxd_puts("G_MDSFT_TEXTLOD"); - case G_MDSFT_TEXTDETAIL: - return gfxd_puts("G_MDSFT_TEXTDETAIL"); - case G_MDSFT_TEXTPERSP: - return gfxd_puts("G_MDSFT_TEXTPERSP"); - case G_MDSFT_CYCLETYPE: - return gfxd_puts("G_MDSFT_CYCLETYPE"); - case G_MDSFT_PIPELINE: - return gfxd_puts("G_MDSFT_PIPELINE"); - default: - return gfxd_printf("%" PRIi32, v->i); - } -} - -UCFUNC int othermodehi_str(uint32_t arg, uint32_t which) -{ - int n = 0; - uint32_t ad_mask = MDMASK(ALPHADITHER); - if ((arg | which) & ad_mask) - { - uint32_t ad = arg & ad_mask; - switch (ad) - { - case G_AD_PATTERN: - n += gfxd_puts("G_AD_PATTERN"); - break; - case G_AD_NOTPATTERN: - n += gfxd_puts("G_AD_NOTPATTERN"); - break; - case G_AD_NOISE: - n += gfxd_puts("G_AD_NOISE"); - break; - case G_AD_DISABLE: - n += gfxd_puts("G_AD_DISABLE"); - break; - default: - n += gfxd_printf("0x%08" PRIX32, ad); - break; - } - } - uint32_t cd_mask = MDMASK(RGBDITHER); - if ((arg | which) & cd_mask) - { - if (n > 0) - n += gfxd_puts(" | "); - uint32_t cd = arg & cd_mask; - switch (cd) - { - case G_CD_MAGICSQ: - n += gfxd_puts("G_CD_MAGICSQ"); - break; - case G_CD_BAYER: - n += gfxd_puts("G_CD_BAYER"); - break; - case G_CD_NOISE: - n += gfxd_puts("G_CD_NOISE"); - break; - case G_CD_DISABLE: - n += gfxd_puts("G_CD_DISABLE"); - break; - default: - n += gfxd_printf("0x%08" PRIX32, cd); - break; - } - } - uint32_t ck_mask = MDMASK(COMBKEY); - if ((arg | which) & ck_mask) - { - if (n > 0) - n += gfxd_puts(" | "); - uint32_t ck = arg & ck_mask; - switch (ck) - { - case G_CK_NONE: - n += gfxd_puts("G_CK_NONE"); - break; - case G_CK_KEY: - n += gfxd_puts("G_CK_KEY"); - break; - default: - n += gfxd_printf("0x%08" PRIX32, ck); - break; - } - } - uint32_t tc_mask = MDMASK(TEXTCONV); - if ((arg | which) & tc_mask) - { - if (n > 0) - n += gfxd_puts(" | "); - uint32_t tc = arg & tc_mask; - switch (tc) - { - case G_TC_CONV: - n += gfxd_puts("G_TC_CONV"); - break; - case G_TC_FILTCONV: - n += gfxd_puts("G_TC_FILTCONV"); - break; - case G_TC_FILT: - n += gfxd_puts("G_TC_FILT"); - break; - default: - n += gfxd_printf("0x%08" PRIX32, tc); - break; - } - } - uint32_t tf_mask = MDMASK(TEXTFILT); - if ((arg | which) & tf_mask) - { - if (n > 0) - n += gfxd_puts(" | "); - uint32_t tf = arg & tf_mask; - switch (tf) - { - case G_TF_POINT: - n += gfxd_puts("G_TF_POINT"); - break; - case G_TF_BILERP: - n += gfxd_puts("G_TF_BILERP"); - break; - case G_TF_AVERAGE: - n += gfxd_puts("G_TF_AVERAGE"); - break; - default: - n += gfxd_printf("0x%08" PRIX32, tf); - break; - } - } - uint32_t tt_mask = MDMASK(TEXTLUT); - if ((arg | which) & tt_mask) - { - if (n > 0) - n += gfxd_puts(" | "); - uint32_t tt = arg & tt_mask; - switch (tt) - { - case G_TT_NONE: - n += gfxd_puts("G_TT_NONE"); - break; - case G_TT_RGBA16: - n += gfxd_puts("G_TT_RGBA16"); - break; - case G_TT_IA16: - n += gfxd_puts("G_TT_IA16"); - break; - default: - n += gfxd_printf("0x%08" PRIX32, tt); - break; - } - } - uint32_t tl_mask = MDMASK(TEXTLOD); - if ((arg | which) & tl_mask) - { - if (n > 0) - n += gfxd_puts(" | "); - uint32_t tl = arg & tl_mask; - switch (tl) - { - case G_TL_TILE: - n += gfxd_puts("G_TL_TILE"); - break; - case G_TL_LOD: - n += gfxd_puts("G_TL_LOD"); - break; - default: - n += gfxd_printf("0x%08" PRIX32, tl); - break; - } - } - uint32_t td_mask = MDMASK(TEXTDETAIL); - if ((arg | which) & td_mask) - { - if (n > 0) - n += gfxd_puts(" | "); - uint32_t td = arg & td_mask; - switch (td) - { - case G_TD_CLAMP: - n += gfxd_puts("G_TD_CLAMP"); - break; - case G_TD_SHARPEN: - n += gfxd_puts("G_TD_SHARPEN"); - break; - case G_TD_DETAIL: - n += gfxd_puts("G_TD_DETAIL"); - break; - default: - n += gfxd_printf("0x%08" PRIX32, td); - break; - } - } - uint32_t tp_mask = MDMASK(TEXTPERSP); - if ((arg | which) & tp_mask) - { - if (n > 0) - n += gfxd_puts(" | "); - uint32_t tp = arg & tp_mask; - switch (tp) - { - case G_TP_NONE: - n += gfxd_puts("G_TP_NONE"); - break; - case G_TP_PERSP: - n += gfxd_puts("G_TP_PERSP"); - break; - default: - n += gfxd_printf("0x%08" PRIX32, tp); - break; - } - } - uint32_t cyc_mask = MDMASK(CYCLETYPE); - if ((arg | which) & cyc_mask) - { - if (n > 0) - n += gfxd_puts(" | "); - uint32_t cyc = arg & cyc_mask; - switch (cyc) - { - case G_CYC_1CYCLE: - n += gfxd_puts("G_CYC_1CYCLE"); - break; - case G_CYC_2CYCLE: - n += gfxd_puts("G_CYC_2CYCLE"); - break; - case G_CYC_COPY: - n += gfxd_puts("G_CYC_COPY"); - break; - case G_CYC_FILL: - n += gfxd_puts("G_CYC_FILL"); - break; - default: - n += gfxd_printf("0x%08" PRIX32, cyc); - break; - } - } - uint32_t pm_mask = MDMASK(PIPELINE); - if ((arg | which) & pm_mask) - { - if (n > 0) - n += gfxd_puts(" | "); - uint32_t pm = arg & pm_mask; - switch (pm) - { - case G_PM_NPRIMITIVE: - n += gfxd_puts("G_PM_NPRIMITIVE"); - break; - case G_PM_1PRIMITIVE: - n += gfxd_puts("G_PM_1PRIMITIVE"); - break; - default: - n += gfxd_printf("0x%08" PRIX32, pm); - break; - } - } - uint32_t unk_mask = ~(ad_mask | cd_mask | ck_mask | tc_mask | tf_mask | - tt_mask | tl_mask | td_mask | tp_mask | - cyc_mask | pm_mask); - if (arg & unk_mask) - { - if (n > 0) - n += gfxd_puts(" | "); - uint32_t unk = arg & unk_mask; - n += gfxd_printf("0x%08" PRIX32, unk); - } - return n; -} - -UCFUNC int argfn_ad(const gfxd_value_t *v) -{ - return othermodehi_str(v->u, MDMASK(ALPHADITHER)); -} - -UCFUNC int argfn_cd(const gfxd_value_t *v) -{ - return othermodehi_str(v->u, MDMASK(RGBDITHER)); -} - -UCFUNC int argfn_ck(const gfxd_value_t *v) -{ - return othermodehi_str(v->u, MDMASK(COMBKEY)); -} - -UCFUNC int argfn_tc(const gfxd_value_t *v) -{ - return othermodehi_str(v->u, MDMASK(TEXTCONV)); -} - -UCFUNC int argfn_tf(const gfxd_value_t *v) -{ - return othermodehi_str(v->u, MDMASK(TEXTFILT)); -} - -UCFUNC int argfn_tt(const gfxd_value_t *v) -{ - return othermodehi_str(v->u, MDMASK(TEXTLUT)); -} - -UCFUNC int argfn_tl(const gfxd_value_t *v) -{ - return othermodehi_str(v->u, MDMASK(TEXTLOD)); -} - -UCFUNC int argfn_td(const gfxd_value_t *v) -{ - return othermodehi_str(v->u, MDMASK(TEXTDETAIL)); -} - -UCFUNC int argfn_tp(const gfxd_value_t *v) -{ - return othermodehi_str(v->u, MDMASK(TEXTPERSP)); -} - -UCFUNC int argfn_cyc(const gfxd_value_t *v) -{ - return othermodehi_str(v->u, MDMASK(CYCLETYPE)); -} - -UCFUNC int argfn_pm(const gfxd_value_t *v) -{ - return othermodehi_str(v->u, MDMASK(PIPELINE)); -} - -UCFUNC int argfn_othermodehi(const gfxd_value_t *v) -{ - uint32_t mask = MDMASK(ALPHADITHER) | - MDMASK(RGBDITHER) | - MDMASK(COMBKEY) | - MDMASK(TEXTCONV) | - MDMASK(TEXTFILT) | - MDMASK(TEXTLUT) | - MDMASK(TEXTLOD) | - MDMASK(TEXTDETAIL) | - MDMASK(TEXTPERSP) | - MDMASK(CYCLETYPE) | - MDMASK(PIPELINE); - return othermodehi_str(v->u, mask); -} - -UCFUNC int argfn_cv(const gfxd_value_t *v) -{ - switch (v->i) - { - case G_CV_K0: - return gfxd_puts("G_CV_K0"); - case G_CV_K1: - return gfxd_puts("G_CV_K1"); - case G_CV_K2: - return gfxd_puts("G_CV_K2"); - case G_CV_K3: - return gfxd_puts("G_CV_K3"); - case G_CV_K4: - return gfxd_puts("G_CV_K4"); - case G_CV_K5: - return gfxd_puts("G_CV_K5"); - default: - return gfxd_printf("%" PRIi32, v->i); - } -} - -UCFUNC int argfn_ccmuxa(const gfxd_value_t *v) -{ - switch (v->i) - { - case G_CCMUX_COMBINED: - return gfxd_puts("COMBINED"); - case G_CCMUX_TEXEL0: - return gfxd_puts("TEXEL0"); - case G_CCMUX_TEXEL1: - return gfxd_puts("TEXEL1"); - case G_CCMUX_PRIMITIVE: - return gfxd_puts("PRIMITIVE"); - case G_CCMUX_SHADE: - return gfxd_puts("SHADE"); - case G_CCMUX_ENVIRONMENT: - return gfxd_puts("ENVIRONMENT"); - case G_CCMUX_1: - return gfxd_puts("1"); - case G_CCMUX_NOISE: - return gfxd_puts("NOISE"); - default: - return gfxd_puts("0"); - } -} - -UCFUNC int argfn_ccmuxb(const gfxd_value_t *v) -{ - switch (v->i) - { - case G_CCMUX_COMBINED: - return gfxd_puts("COMBINED"); - case G_CCMUX_TEXEL0: - return gfxd_puts("TEXEL0"); - case G_CCMUX_TEXEL1: - return gfxd_puts("TEXEL1"); - case G_CCMUX_PRIMITIVE: - return gfxd_puts("PRIMITIVE"); - case G_CCMUX_SHADE: - return gfxd_puts("SHADE"); - case G_CCMUX_ENVIRONMENT: - return gfxd_puts("ENVIRONMENT"); - case G_CCMUX_CENTER: - return gfxd_puts("CENTER"); - case G_CCMUX_K4: - return gfxd_puts("K4"); - default: - return gfxd_puts("0"); - } -} - -UCFUNC int argfn_ccmuxc(const gfxd_value_t *v) -{ - switch (v->i) - { - case G_CCMUX_COMBINED: - return gfxd_puts("COMBINED"); - case G_CCMUX_TEXEL0: - return gfxd_puts("TEXEL0"); - case G_CCMUX_TEXEL1: - return gfxd_puts("TEXEL1"); - case G_CCMUX_PRIMITIVE: - return gfxd_puts("PRIMITIVE"); - case G_CCMUX_SHADE: - return gfxd_puts("SHADE"); - case G_CCMUX_ENVIRONMENT: - return gfxd_puts("ENVIRONMENT"); - case G_CCMUX_SCALE: - return gfxd_puts("SCALE"); - case G_CCMUX_COMBINED_ALPHA: - return gfxd_puts("COMBINED_ALPHA"); - case G_CCMUX_TEXEL0_ALPHA: - return gfxd_puts("TEXEL0_ALPHA"); - case G_CCMUX_TEXEL1_ALPHA: - return gfxd_puts("TEXEL1_ALPHA"); - case G_CCMUX_PRIMITIVE_ALPHA: - return gfxd_puts("PRIMITIVE_ALPHA"); - case G_CCMUX_SHADE_ALPHA: - return gfxd_puts("SHADE_ALPHA"); - case G_CCMUX_ENV_ALPHA: - return gfxd_puts("ENV_ALPHA"); - case G_CCMUX_LOD_FRACTION: - return gfxd_puts("LOD_FRACTION"); - case G_CCMUX_PRIM_LOD_FRAC: - return gfxd_puts("PRIM_LOD_FRAC"); - case G_CCMUX_K5: - return gfxd_puts("K5"); - default: - return gfxd_puts("0"); - } -} - -UCFUNC int argfn_ccmuxd(const gfxd_value_t *v) -{ - switch (v->i) - { - case G_CCMUX_COMBINED: - return gfxd_puts("COMBINED"); - case G_CCMUX_TEXEL0: - return gfxd_puts("TEXEL0"); - case G_CCMUX_TEXEL1: - return gfxd_puts("TEXEL1"); - case G_CCMUX_PRIMITIVE: - return gfxd_puts("PRIMITIVE"); - case G_CCMUX_SHADE: - return gfxd_puts("SHADE"); - case G_CCMUX_ENVIRONMENT: - return gfxd_puts("ENVIRONMENT"); - case G_CCMUX_1: - return gfxd_puts("1"); - default: - return gfxd_puts("0"); - } -} - -UCFUNC int argfn_acmuxabd(const gfxd_value_t *v) -{ - switch (v->i) - { - case G_ACMUX_COMBINED: - return gfxd_puts("COMBINED"); - case G_ACMUX_TEXEL0: - return gfxd_puts("TEXEL0"); - case G_ACMUX_TEXEL1: - return gfxd_puts("TEXEL1"); - case G_ACMUX_PRIMITIVE: - return gfxd_puts("PRIMITIVE"); - case G_ACMUX_SHADE: - return gfxd_puts("SHADE"); - case G_ACMUX_ENVIRONMENT: - return gfxd_puts("ENVIRONMENT"); - case G_ACMUX_1: - return gfxd_puts("1"); - default: - return gfxd_puts("0"); - } -} - -UCFUNC int argfn_acmuxc(const gfxd_value_t *v) -{ - switch (v->i) - { - case G_ACMUX_LOD_FRACTION: - return gfxd_puts("LOD_FRACTION"); - case G_ACMUX_TEXEL0: - return gfxd_puts("TEXEL0"); - case G_ACMUX_TEXEL1: - return gfxd_puts("TEXEL1"); - case G_ACMUX_PRIMITIVE: - return gfxd_puts("PRIMITIVE"); - case G_ACMUX_SHADE: - return gfxd_puts("SHADE"); - case G_ACMUX_ENVIRONMENT: - return gfxd_puts("ENVIRONMENT"); - case G_ACMUX_PRIM_LOD_FRAC: - return gfxd_puts("PRIM_LOD_FRAC"); - default: - return gfxd_puts("0"); - } -} - -struct cc_mode -{ - int a; - int b; - int c; - int d; - int Aa; - int Ab; - int Ac; - int Ad; -}; - -struct cc_preset -{ - struct cc_mode mode; - const char * name; -}; - -#define CC_(a,b,c,d,Aa,Ab,Ac,Ad) \ - { \ - G_CCMUX_##a, G_CCMUX_##b, \ - G_CCMUX_##c, G_CCMUX_##d, \ - G_ACMUX_##Aa, G_ACMUX_##Ab, \ - G_ACMUX_##Ac, G_ACMUX_##Ad \ - } -#define CC(m) CC_(m) -static const struct cc_preset cc_presets[] = -{ - {CC(G_CC_MODULATEI), "G_CC_MODULATEI"}, - {CC(G_CC_MODULATEIA), "G_CC_MODULATEIA"}, - {CC(G_CC_MODULATEIDECALA), "G_CC_MODULATEIDECALA"}, - {CC(G_CC_MODULATERGB), "G_CC_MODULATERGB"}, - {CC(G_CC_MODULATERGBA), "G_CC_MODULATERGBA"}, - {CC(G_CC_MODULATERGBDECALA), "G_CC_MODULATERGBDECALA"}, - {CC(G_CC_MODULATEI_PRIM), "G_CC_MODULATEI_PRIM"}, - {CC(G_CC_MODULATEIA_PRIM), "G_CC_MODULATEIA_PRIM"}, - {CC(G_CC_MODULATEIDECALA_PRIM), "G_CC_MODULATEIDECALA_PRIM"}, - {CC(G_CC_MODULATERGB_PRIM), "G_CC_MODULATERGB_PRIM"}, - {CC(G_CC_MODULATERGBA_PRIM), "G_CC_MODULATERGBA_PRIM"}, - {CC(G_CC_MODULATERGBDECALA_PRIM), "G_CC_MODULATERGBDECALA_PRIM"}, - {CC(G_CC_DECALRGB), "G_CC_DECALRGB"}, - {CC(G_CC_DECALRGBA), "G_CC_DECALRGBA"}, - {CC(G_CC_BLENDI), "G_CC_BLENDI"}, - {CC(G_CC_BLENDIA), "G_CC_BLENDIA"}, - {CC(G_CC_BLENDIDECALA), "G_CC_BLENDIDECALA"}, - {CC(G_CC_BLENDRGBA), "G_CC_BLENDRGBA"}, - {CC(G_CC_BLENDRGBDECALA), "G_CC_BLENDRGBDECALA"}, - {CC(G_CC_REFLECTRGB), "G_CC_REFLECTRGB"}, - {CC(G_CC_REFLECTRGBDECALA), "G_CC_REFLECTRGBDECALA"}, - {CC(G_CC_HILITERGB), "G_CC_HILITERGB"}, - {CC(G_CC_HILITERGBA), "G_CC_HILITERGBA"}, - {CC(G_CC_HILITERGBDECALA), "G_CC_HILITERGBDECALA"}, - {CC(G_CC_1CYUV2RGB), "G_CC_1CYUV2RGB"}, - {CC(G_CC_PRIMITIVE), "G_CC_PRIMITIVE"}, - {CC(G_CC_SHADE), "G_CC_SHADE"}, - {CC(G_CC_ADDRGB), "G_CC_ADDRGB"}, - {CC(G_CC_ADDRGBDECALA), "G_CC_ADDRGBDECALA"}, - {CC(G_CC_SHADEDECALA), "G_CC_SHADEDECALA"}, - {CC(G_CC_BLENDPE), "G_CC_BLENDPE"}, - {CC(G_CC_BLENDPEDECALA), "G_CC_BLENDPEDECALA"}, - {CC(G_CC_TRILERP), "G_CC_TRILERP"}, - {CC(G_CC_TEMPLERP), "G_CC_TEMPLERP"}, - {CC(G_CC_INTERFERENCE), "G_CC_INTERFERENCE"}, - {CC(_G_CC_BLENDPE), "_G_CC_BLENDPE"}, - {CC(_G_CC_BLENDPEDECALA), "_G_CC_BLENDPEDECALA"}, - {CC(_G_CC_SPARSEST), "_G_CC_SPARSEST"}, - {CC(_G_CC_TWOCOLORTEX), "_G_CC_TWOCOLORTEX"}, - {CC(G_CC_MODULATEI2), "G_CC_MODULATEI2"}, - {CC(G_CC_MODULATEIA2), "G_CC_MODULATEIA2"}, - {CC(G_CC_MODULATERGB2), "G_CC_MODULATERGB2"}, - {CC(G_CC_MODULATERGBA2), "G_CC_MODULATERGBA2"}, - {CC(G_CC_MODULATEI_PRIM2), "G_CC_MODULATEI_PRIM2"}, - {CC(G_CC_MODULATEIA_PRIM2), "G_CC_MODULATEIA_PRIM2"}, - {CC(G_CC_MODULATERGB_PRIM2), "G_CC_MODULATERGB_PRIM2"}, - {CC(G_CC_MODULATERGBA_PRIM2), "G_CC_MODULATERGBA_PRIM2"}, - {CC(G_CC_DECALRGB2), "G_CC_DECALRGB2"}, - {CC(G_CC_BLENDI2), "G_CC_BLENDI2"}, - {CC(G_CC_BLENDIA2), "G_CC_BLENDIA2"}, - {CC(G_CC_HILITERGB2), "G_CC_HILITERGB2"}, - {CC(G_CC_HILITERGBA2), "G_CC_HILITERGBA2"}, - {CC(G_CC_HILITERGBDECALA2), "G_CC_HILITERGBDECALA2"}, - {CC(G_CC_HILITERGBPASSA2), "G_CC_HILITERGBPASSA2"}, - {CC(G_CC_CHROMA_KEY2), "G_CC_CHROMA_KEY2"}, - {CC(G_CC_YUV2RGB), "G_CC_YUV2RGB"}, - {CC(G_CC_PASS2), "G_CC_PASS2"}, -}; -#undef CC_ -#undef CC - -UCFUNC int argfn_ccpre(const gfxd_value_t *v) -{ - return gfxd_printf("%s", cc_presets[v->i].name); -} - -UCFUNC int argfn_sc(const gfxd_value_t *v) -{ - switch (v->i) - { - case G_SC_NON_INTERLACE: - return gfxd_puts("G_SC_NON_INTERLACE"); - case G_SC_EVEN_INTERLACE: - return gfxd_puts("G_SC_EVEN_INTERLACE"); - case G_SC_ODD_INTERLACE: - return gfxd_puts("G_SC_ODD_INTERLACE"); - default: - return gfxd_printf("%" PRIi32, v->i); - } -} - -#if defined(F3DEX_GBI) || defined(F3DEX_GBI_2) -UCFUNC int argfn_bz(const gfxd_value_t *v) -{ - switch (v->i) - { - case G_BZ_PERSP: - return gfxd_puts("G_BZ_PERSP"); - default: - return gfxd_puts("G_BZ_ORTHO"); - } -} -#endif - -UCFUNC int argfn_dlf(const gfxd_value_t *v) -{ - switch (v->i) - { - case G_DL_PUSH: - return gfxd_puts("G_DL_PUSH"); - case G_DL_NOPUSH: - return gfxd_puts("G_DL_NOPUSH"); - default: - return gfxd_printf("%" PRIi32, v->i);; - } -} - -UCFUNC int argfn_mp(const gfxd_value_t *v) -{ - int n = 0; - if (v->u & G_MTX_PUSH) - n += gfxd_puts("G_MTX_PUSH"); - else - n += gfxd_puts("G_MTX_NOPUSH"); - if (v->u & G_MTX_LOAD) - n += gfxd_puts(" | G_MTX_LOAD"); - else - n += gfxd_puts(" | G_MTX_MUL"); - if (v->u & G_MTX_PROJECTION) - n += gfxd_puts(" | G_MTX_PROJECTION"); - else - n += gfxd_puts(" | G_MTX_MODELVIEW"); - for (int i = 3; i < 8; i++) - if (v->u & (1 << i)) - n += gfxd_printf(" | 0x%02x", 1 << i); - return n; -} - -UCFUNC int argfn_ms(const gfxd_value_t *v) -{ - switch (v->i) - { - case G_MTX_MODELVIEW: - return gfxd_puts("G_MTX_MODELVIEW"); - case G_MTX_PROJECTION: - return gfxd_puts("G_MTX_PROJECTION"); - default: - return gfxd_printf("%" PRIi32, v->i); - } -} - -UCFUNC int argfn_mw(const gfxd_value_t *v) -{ - switch (v->i) - { - case G_MW_MATRIX: - return gfxd_puts("G_MW_MATRIX"); - case G_MW_NUMLIGHT: - return gfxd_puts("G_MW_NUMLIGHT"); - case G_MW_CLIP: - return gfxd_puts("G_MW_CLIP"); - case G_MW_SEGMENT: - return gfxd_puts("G_MW_SEGMENT"); - case G_MW_FOG: - return gfxd_puts("G_MW_FOG"); - case G_MW_LIGHTCOL: - return gfxd_puts("G_MW_LIGHTCOL"); - case G_MW_PERSPNORM: - return gfxd_puts("G_MW_PERSPNORM"); -#if defined(F3D_GBI) || defined(F3DEX_GBI) - case G_MW_POINTS: - return gfxd_puts("G_MW_POINTS"); -#endif -#if defined(F3DEX_GBI_2) - case G_MW_FORCEMTX: - return gfxd_puts("G_MW_FORCEMTX"); -#endif - default: - return gfxd_printf("%" PRIi32, v->i); - } -} - -UCFUNC int argfn_mwo_clip(const gfxd_value_t *v) -{ - switch (v->u) - { - case G_MWO_CLIP_RNX: - return gfxd_puts("G_MWO_CLIP_RNX"); - case G_MWO_CLIP_RNY: - return gfxd_puts("G_MWO_CLIP_RNY"); - case G_MWO_CLIP_RPX: - return gfxd_puts("G_MWO_CLIP_RPX"); - case G_MWO_CLIP_RPY: - return gfxd_puts("G_MWO_CLIP_RPY"); - default: - return gfxd_printf("0x%04" PRIX32, v->u); - } -} - -UCFUNC int argfn_mwo_lightcol(const gfxd_value_t *v) -{ - switch (v->u) - { - case G_MWO_aLIGHT_1: - return gfxd_puts("G_MWO_aLIGHT_1"); - case G_MWO_bLIGHT_1: - return gfxd_puts("G_MWO_bLIGHT_1"); - case G_MWO_aLIGHT_2: - return gfxd_puts("G_MWO_aLIGHT_2"); - case G_MWO_bLIGHT_2: - return gfxd_puts("G_MWO_bLIGHT_2"); - case G_MWO_aLIGHT_3: - return gfxd_puts("G_MWO_aLIGHT_3"); - case G_MWO_bLIGHT_3: - return gfxd_puts("G_MWO_bLIGHT_3"); - case G_MWO_aLIGHT_4: - return gfxd_puts("G_MWO_aLIGHT_4"); - case G_MWO_bLIGHT_4: - return gfxd_puts("G_MWO_bLIGHT_4"); - case G_MWO_aLIGHT_5: - return gfxd_puts("G_MWO_aLIGHT_5"); - case G_MWO_bLIGHT_5: - return gfxd_puts("G_MWO_bLIGHT_5"); - case G_MWO_aLIGHT_6: - return gfxd_puts("G_MWO_aLIGHT_6"); - case G_MWO_bLIGHT_6: - return gfxd_puts("G_MWO_bLIGHT_6"); - case G_MWO_aLIGHT_7: - return gfxd_puts("G_MWO_aLIGHT_7"); - case G_MWO_bLIGHT_7: - return gfxd_puts("G_MWO_bLIGHT_7"); - case G_MWO_aLIGHT_8: - return gfxd_puts("G_MWO_aLIGHT_8"); - case G_MWO_bLIGHT_8: - return gfxd_puts("G_MWO_bLIGHT_8"); - default: - return gfxd_printf("0x%04" PRIX32, v->u); - } -} - -UCFUNC int argfn_lightnum(const gfxd_value_t *v) -{ - return gfxd_printf("LIGHT_%" PRIi32, v->i); -} - -UCFUNC int argfn_lightsn(const gfxd_value_t *v) -{ - return gfxd_printf("*(Lightsn *)0x%08" PRIX32, v->u); -} - -UCFUNC int argfn_mwo_matrix(const gfxd_value_t *v) -{ - switch (v->u) - { - case G_MWO_MATRIX_XX_XY_I: - return gfxd_puts("G_MWO_MATRIX_XX_XY_I"); - case G_MWO_MATRIX_XZ_XW_I: - return gfxd_puts("G_MWO_MATRIX_XZ_XW_I"); - case G_MWO_MATRIX_YX_YY_I: - return gfxd_puts("G_MWO_MATRIX_YX_YY_I"); - case G_MWO_MATRIX_YZ_YW_I: - return gfxd_puts("G_MWO_MATRIX_YZ_YW_I"); - case G_MWO_MATRIX_ZX_ZY_I: - return gfxd_puts("G_MWO_MATRIX_ZX_ZY_I"); - case G_MWO_MATRIX_ZZ_ZW_I: - return gfxd_puts("G_MWO_MATRIX_ZZ_ZW_I"); - case G_MWO_MATRIX_WX_WY_I: - return gfxd_puts("G_MWO_MATRIX_WX_WY_I"); - case G_MWO_MATRIX_WZ_WW_I: - return gfxd_puts("G_MWO_MATRIX_WZ_WW_I"); - case G_MWO_MATRIX_XX_XY_F: - return gfxd_puts("G_MWO_MATRIX_XX_XY_F"); - case G_MWO_MATRIX_XZ_XW_F: - return gfxd_puts("G_MWO_MATRIX_XZ_XW_F"); - case G_MWO_MATRIX_YX_YY_F: - return gfxd_puts("G_MWO_MATRIX_YX_YY_F"); - case G_MWO_MATRIX_YZ_YW_F: - return gfxd_puts("G_MWO_MATRIX_YZ_YW_F"); - case G_MWO_MATRIX_ZX_ZY_F: - return gfxd_puts("G_MWO_MATRIX_ZX_ZY_F"); - case G_MWO_MATRIX_ZZ_ZW_F: - return gfxd_puts("G_MWO_MATRIX_ZZ_ZW_F"); - case G_MWO_MATRIX_WX_WY_F: - return gfxd_puts("G_MWO_MATRIX_WX_WY_F"); - case G_MWO_MATRIX_WZ_WW_F: - return gfxd_puts("G_MWO_MATRIX_WZ_WW_F"); - default: - return gfxd_printf("0x%04" PRIX32, v->u); - } -} - -UCFUNC int argfn_mwo_point(const gfxd_value_t *v) -{ - switch (v->u) - { - case G_MWO_POINT_RGBA: - return gfxd_puts("G_MWO_POINT_RGBA"); - case G_MWO_POINT_ST: - return gfxd_puts("G_MWO_POINT_ST"); - case G_MWO_POINT_XYSCREEN: - return gfxd_puts("G_MWO_POINT_XYSCREEN"); - case G_MWO_POINT_ZSCREEN: - return gfxd_puts("G_MWO_POINT_ZSCREEN"); - default: - return gfxd_printf("0x%04" PRIX32, v->u); - } -} - -UCFUNC int argfn_mv(const gfxd_value_t *v) -{ - switch (v->i) - { - case G_MV_VIEWPORT: - return gfxd_puts("G_MV_VIEWPORT"); -#if defined(F3D_GBI) || defined(F3DEX_GBI) - case G_MV_LOOKATY: - return gfxd_puts("G_MV_LOOKATY"); - case G_MV_LOOKATX: - return gfxd_puts("G_MV_LOOKATX"); - case G_MV_L0: - return gfxd_puts("G_MV_L0"); - case G_MV_L1: - return gfxd_puts("G_MV_L1"); - case G_MV_L2: - return gfxd_puts("G_MV_L2"); - case G_MV_L3: - return gfxd_puts("G_MV_L3"); - case G_MV_L4: - return gfxd_puts("G_MV_L4"); - case G_MV_L5: - return gfxd_puts("G_MV_L5"); - case G_MV_L6: - return gfxd_puts("G_MV_L6"); - case G_MV_L7: - return gfxd_puts("G_MV_L7"); - case G_MV_TXTATT: - return gfxd_puts("G_MV_TXTATT"); - case G_MV_MATRIX_2: - return gfxd_puts("G_MV_MATRIX_2"); - case G_MV_MATRIX_3: - return gfxd_puts("G_MV_MATRIX_3"); - case G_MV_MATRIX_4: - return gfxd_puts("G_MV_MATRIX_4"); - case G_MV_MATRIX_1: - return gfxd_puts("G_MV_MATRIX_1"); -#elif defined(F3DEX_GBI_2) - case G_MV_MMTX: - return gfxd_puts("G_MV_MMTX"); - case G_MV_PMTX: - return gfxd_puts("G_MV_PMTX"); - case G_MV_LIGHT: - return gfxd_puts("G_MV_LIGHT"); - case G_MV_POINT: - return gfxd_puts("G_MV_POINT"); - case G_MV_MATRIX: - return gfxd_puts("G_MV_MATRIX"); -#endif - default: - return gfxd_printf("%" PRIi32, v->i); - } -} - -UCFUNC int argfn_cr(const gfxd_value_t *v) -{ - switch (v->u) - { - case FRUSTRATIO_1: - return gfxd_puts("FRUSTRATIO_1"); - case FRUSTRATIO_2: - return gfxd_puts("FRUSTRATIO_2"); - case FRUSTRATIO_3: - return gfxd_puts("FRUSTRATIO_3"); - case FRUSTRATIO_4: - return gfxd_puts("FRUSTRATIO_4"); - case FRUSTRATIO_5: - return gfxd_puts("FRUSTRATIO_5"); - case FRUSTRATIO_6: - return gfxd_puts("FRUSTRATIO_6"); - default: - return gfxd_printf("%" PRIu32, v->u); - } -} diff --git a/tools/ZAPD/lib/libgfxd/uc_argtbl.c b/tools/ZAPD/lib/libgfxd/uc_argtbl.c deleted file mode 100644 index 22a0b65009..0000000000 --- a/tools/ZAPD/lib/libgfxd/uc_argtbl.c +++ /dev/null @@ -1,485 +0,0 @@ -static const gfxd_arg_type_t arg_tbl[] = -{ - [gfxd_Word] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_x32, - }, - [gfxd_Opcode] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_opc, - }, - [gfxd_Coordi] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_u, - }, - [gfxd_Coordq] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_qu102, - }, - [gfxd_Pal] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_i, - }, - [gfxd_Tlut] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_x32, - }, - [gfxd_Timg] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_x32, - }, - [gfxd_Tmem] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_x16, - }, - [gfxd_Tile] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_tile, - }, - [gfxd_Fmt] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_fmt, - }, - [gfxd_Siz] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_siz, - }, - [gfxd_Dim] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_i, - }, - [gfxd_Cm] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_cm, - }, - [gfxd_Tm] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_tm, - }, - [gfxd_Ts] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_ts, - }, - [gfxd_Dxt] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_u, - }, - [gfxd_Tag] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_x32, - }, - [gfxd_Pm] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_pm, - }, - [gfxd_Colorpart] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_color, - }, - [gfxd_Color] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_x32, - }, - [gfxd_Lodfrac] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_qu08, - }, - [gfxd_Cimg] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_x32, - }, - [gfxd_Zimg] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_x32, - }, - [gfxd_Ac] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_ac, - }, - [gfxd_Ad] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_ad, - }, - [gfxd_Cd] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_cd, - }, - [gfxd_Ccpre] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_ccpre, - }, - [gfxd_Ccmuxa] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_ccmuxa, - }, - [gfxd_Ccmuxb] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_ccmuxb, - }, - [gfxd_Ccmuxc] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_ccmuxc, - }, - [gfxd_Ccmuxd] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_ccmuxd, - }, - [gfxd_Acmuxabd] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_acmuxabd, - }, - [gfxd_Acmuxc] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_acmuxc, - }, - [gfxd_Cv] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_cv, - }, - [gfxd_Tc] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_tc, - }, - [gfxd_Cyc] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_cyc, - }, - [gfxd_Zs] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_zs, - }, - [gfxd_Ck] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_ck, - }, - [gfxd_Keyscale] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_color, - }, - [gfxd_Keywidth] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_qs48, - }, - [gfxd_Zi] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_i, - }, - [gfxd_Rm1] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_rm1, - }, - [gfxd_Rm2] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_rm2, - }, - [gfxd_Sc] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_sc, - }, - [gfxd_Td] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_td, - }, - [gfxd_Tf] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_tf, - }, - [gfxd_Tl] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_tl, - }, - [gfxd_Tt] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_tt, - }, - [gfxd_Tp] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_tp, - }, - [gfxd_Line] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_i, - }, - [gfxd_Vtx] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_i, - }, - [gfxd_Vtxflag] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_i, - }, - [gfxd_Dl] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_x32, - }, -#if defined(F3DEX_GBI) || defined(F3DEX_GBI_2) - [gfxd_Zraw] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_qs1616, - }, -#endif - [gfxd_Dlflag] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_dlf, - }, - [gfxd_Cr] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_cr, - }, - [gfxd_Num] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_i, - }, - [gfxd_Fogz] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_i, - }, - [gfxd_Fogp] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_i, - }, - [gfxd_Mtxptr] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_x32, - }, - [gfxd_Gm] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_gm, - }, - [gfxd_Mwo_matrix] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_mwo_matrix, - }, - [gfxd_Linewd] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_i, - }, - [gfxd_Uctext] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_x32, - }, - [gfxd_Ucdata] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_x32, - }, - [gfxd_Size] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_x16, - }, - [gfxd_Lookatptr] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_x32, - }, - [gfxd_Mtxparam] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_mp, - }, - [gfxd_Mtxstack] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_ms, - }, - [gfxd_Mwo_point] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_mwo_point, - }, - [gfxd_Wscale] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_qu016, - }, - [gfxd_Seg] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_x8, - }, - [gfxd_Segptr] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_x32, - }, - [gfxd_Lightsn] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_lightsn, - }, - [gfxd_Numlights] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_i, - }, - [gfxd_Lightnum] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_lightnum, - }, - [gfxd_Lightptr] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_x32, - }, - [gfxd_Tcscale] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_qu016, - }, - [gfxd_Switch] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_switch, - }, - [gfxd_St] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_qs105, - }, - [gfxd_Stdelta] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_qs510, - }, - [gfxd_Vtxptr] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_x32, - }, - [gfxd_Vpptr] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_x32, - }, - [gfxd_Dram] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_x32, - }, - [gfxd_Sftlo] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_sftlo, - }, - [gfxd_Othermodelo] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_othermodelo, - }, - [gfxd_Sfthi] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_sfthi, - }, - [gfxd_Othermodehi] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_othermodehi, - }, - [gfxd_Mw] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_mw, - }, - [gfxd_Mwo] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_x16, - }, - [gfxd_Mwo_clip] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_mwo_clip, - }, - [gfxd_Mwo_lightcol] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_mwo_lightcol, - }, - [gfxd_Mv] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_mv, - }, - [gfxd_Mvo] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_x16, - }, - [gfxd_Dmem] = - { - .fmt = gfxd_argfmt_u, - .fn = argfn_x16, - }, - [gfxd_Dmaflag] = - { - .fmt = gfxd_argfmt_i, - .fn = argfn_i, - }, -}; diff --git a/tools/ZAPD/lib/libgfxd/uc_f3d.c b/tools/ZAPD/lib/libgfxd/uc_f3d.c deleted file mode 100644 index 9465515108..0000000000 --- a/tools/ZAPD/lib/libgfxd/uc_f3d.c +++ /dev/null @@ -1,4 +0,0 @@ -#define uc_name gfxd_f3d -#define F3D_GBI - -#include "uc.c" diff --git a/tools/ZAPD/lib/libgfxd/uc_f3db.c b/tools/ZAPD/lib/libgfxd/uc_f3db.c deleted file mode 100644 index cd4990412d..0000000000 --- a/tools/ZAPD/lib/libgfxd/uc_f3db.c +++ /dev/null @@ -1,5 +0,0 @@ -#define uc_name gfxd_f3db -#define F3D_GBI -#define F3D_BETA - -#include "uc.c" diff --git a/tools/ZAPD/lib/libgfxd/uc_f3dex.c b/tools/ZAPD/lib/libgfxd/uc_f3dex.c deleted file mode 100644 index 2ec70d8aba..0000000000 --- a/tools/ZAPD/lib/libgfxd/uc_f3dex.c +++ /dev/null @@ -1,4 +0,0 @@ -#define uc_name gfxd_f3dex -#define F3DEX_GBI - -#include "uc.c" diff --git a/tools/ZAPD/lib/libgfxd/uc_f3dex2.c b/tools/ZAPD/lib/libgfxd/uc_f3dex2.c deleted file mode 100644 index 9a19c99038..0000000000 --- a/tools/ZAPD/lib/libgfxd/uc_f3dex2.c +++ /dev/null @@ -1,4 +0,0 @@ -#define uc_name gfxd_f3dex2 -#define F3DEX_GBI_2 - -#include "uc.c" diff --git a/tools/ZAPD/lib/libgfxd/uc_f3dexb.c b/tools/ZAPD/lib/libgfxd/uc_f3dexb.c deleted file mode 100644 index 2b5c30a4a6..0000000000 --- a/tools/ZAPD/lib/libgfxd/uc_f3dexb.c +++ /dev/null @@ -1,5 +0,0 @@ -#define uc_name gfxd_f3dexb -#define F3DEX_GBI -#define F3D_BETA - -#include "uc.c" diff --git a/tools/ZAPD/lib/libgfxd/uc_macrofn.c b/tools/ZAPD/lib/libgfxd/uc_macrofn.c deleted file mode 100644 index 46d4b4ee8c..0000000000 --- a/tools/ZAPD/lib/libgfxd/uc_macrofn.c +++ /dev/null @@ -1,2507 +0,0 @@ -static inline uint32_t getfield(uint32_t w, int n, int s) -{ - return (w >> s) & (((uint32_t)1 << n) - 1); -} - -static inline int32_t argvi(gfxd_macro_t *m, int idx) -{ - return m->arg[idx].value.i; -} - -static inline uint32_t argvu(gfxd_macro_t *m, int idx) -{ - return m->arg[idx].value.u; -} - -static inline float argvf(gfxd_macro_t *m, int idx) -{ - return m->arg[idx].value.f; -} - -static inline void argi(gfxd_macro_t *m, int idx, const char *name, - int32_t value, int type) -{ - m->arg[idx].type = type; - m->arg[idx].name = name; - m->arg[idx].value.i = value; - m->arg[idx].bad = 0; -} - -static inline void argu(gfxd_macro_t *m, int idx, const char *name, - uint32_t value, int type) -{ - m->arg[idx].type = type; - m->arg[idx].name = name; - m->arg[idx].value.u = value; - m->arg[idx].bad = 0; -} - -static inline void argf(gfxd_macro_t *m, int idx, const char *name, - float value, int type) -{ - m->arg[idx].type = type; - m->arg[idx].name = name; - m->arg[idx].value.f = value; - m->arg[idx].bad = 0; -} - -static inline void badarg(gfxd_macro_t *m, int idx) -{ - m->arg[idx].bad = 1; -} - -UCFUNC int32_t sx(uint32_t n, int bits) -{ - int32_t smin = (int32_t)1 << (bits - 1); - int32_t smax = (int32_t)1 << bits; - int32_t i = n; - if (i < smin) - return i; - else - return i - smax; -} - -UCFUNC int d_Invalid(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_Invalid; - argu(m, 0, "hi", hi, gfxd_Word); - argu(m, 1, "lo", lo, gfxd_Word); - return -1; -} - -UCFUNC int d_DPFillRectangle(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPFillRectangle; - argu(m, 0, "ulx", getfield(lo, 10, 14), gfxd_Coordi); - argu(m, 1, "uly", getfield(lo, 10, 2), gfxd_Coordi); - argu(m, 2, "lrx", getfield(hi, 10, 14), gfxd_Coordi); - argu(m, 3, "lry", getfield(hi, 10, 2), gfxd_Coordi); - return 0; -} - -UCFUNC int d_DPFullSync(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPFullSync; - return 0; -} - -UCFUNC int d_DPLoadSync(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPLoadSync; - return 0; -} - -UCFUNC int d_DPTileSync(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPTileSync; - return 0; -} - -UCFUNC int d_DPPipeSync(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPPipeSync; - return 0; -} - -UCFUNC int c_DPLoadTLUT_pal16(gfxd_macro_t *m, int n_macro) -{ - if (n_macro < 6) - return -1; - if (m[0].id != gfxd_DPSetTextureImage - || argvi(&m[0], 0) != G_IM_FMT_RGBA - || argvi(&m[0], 1) != G_IM_SIZ_16b - || argvi(&m[0], 2) != 1) - { - return -1; - } - uint32_t dram = argvu(&m[0], 3); - if (m[1].id != gfxd_DPTileSync) - return -1; - if (m[2].id != gfxd_DPSetTile - || argvi(&m[2], 0) != 0 - || argvi(&m[2], 1) != 0 - || argvi(&m[2], 2) != 0 - || argvu(&m[2], 3) < 0x100 - || argvu(&m[2], 3) % 0x10 != 0 - || argvi(&m[2], 4) != G_TX_LOADTILE - || argvi(&m[2], 5) != 0 - || argvu(&m[2], 6) != 0 - || argvi(&m[2], 7) != 0 - || argvi(&m[2], 8) != 0 - || argvu(&m[2], 9) != 0 - || argvi(&m[2], 10) != 0 - || argvi(&m[2], 11) != 0) - { - return -1; - } - int pal = (argvu(&m[2], 3) - 0x100) / 0x10; - if (m[3].id != gfxd_DPLoadSync) - return -1; - if (m[4].id != gfxd_DPLoadTLUTCmd - || argvi(&m[4], 0) != G_TX_LOADTILE - || argvi(&m[4], 1) != 15) - { - return -1; - } - if (m[5].id != gfxd_DPPipeSync) - return -1; - m->id = gfxd_DPLoadTLUT_pal16; - argi(m, 0, "pal", pal, gfxd_Pal); - argu(m, 1, "dram", dram, gfxd_Tlut); - return 0; -} - -UCFUNC int c_DPLoadTLUT_pal256(gfxd_macro_t *m, int n_macro) -{ - if (n_macro < 6) - return -1; - if (m[0].id != gfxd_DPSetTextureImage - || argvi(&m[0], 0) != G_IM_FMT_RGBA - || argvi(&m[0], 1) != G_IM_SIZ_16b - || argvi(&m[0], 2) != 1) - { - return -1; - } - uint32_t dram = argvu(&m[0], 3); - if (m[1].id != gfxd_DPTileSync) - return -1; - if (m[2].id != gfxd_DPSetTile - || argvi(&m[2], 0) != 0 - || argvi(&m[2], 1) != 0 - || argvi(&m[2], 2) != 0 - || argvu(&m[2], 3) != 0x100 - || argvi(&m[2], 4) != G_TX_LOADTILE - || argvi(&m[2], 5) != 0 - || argvu(&m[2], 6) != 0 - || argvi(&m[2], 7) != 0 - || argvi(&m[2], 8) != 0 - || argvu(&m[2], 9) != 0 - || argvi(&m[2], 10) != 0 - || argvi(&m[2], 11) != 0) - { - return -1; - } - if (m[3].id != gfxd_DPLoadSync) - return -1; - if (m[4].id != gfxd_DPLoadTLUTCmd - || argvi(&m[4], 0) != G_TX_LOADTILE - || argvi(&m[4], 1) != 255) - { - return -1; - } - if (m[5].id != gfxd_DPPipeSync) - return -1; - m->id = gfxd_DPLoadTLUT_pal256; - argu(m, 0, "dram", dram, gfxd_Tlut); - return 0; -} - -UCFUNC int c_ltb(gfxd_macro_t *m, int n_macro, int id, int mdxt, int mtmem, - int mrt, int myuv, int m4b) -{ - if (n_macro < 7) - return -1; - if (m[0].id != gfxd_DPSetTextureImage || argvi(&m[0], 2) != 1) - return -1; - g_ifmt_t fmt = argvi(&m[0], 0); - g_isiz_t ldsiz = argvi(&m[0], 1); - uint32_t timg = argvu(&m[0], 3); - if (myuv && fmt != G_IM_FMT_YUV) - return -1; - if (m[1].id != gfxd_DPSetTile - || argvi(&m[1], 0) != fmt - || argvi(&m[1], 1) != ldsiz - || argvi(&m[1], 2) != 0 - || argvi(&m[1], 4) != G_TX_LOADTILE - || argvi(&m[1], 5) != 0) - { - return -1; - } - uint32_t tmem = argvu(&m[1], 3); - unsigned cms = argvu(&m[1], 9); - unsigned cmt = argvu(&m[1], 6); - int masks = argvi(&m[1], 10); - int maskt = argvi(&m[1], 7); - int shifts = argvi(&m[1], 11); - int shiftt = argvi(&m[1], 8); - if (m[2].id != gfxd_DPLoadSync) - return -1; - if (m[3].id != gfxd_DPLoadBlock - || argvi(&m[3], 0) != G_TX_LOADTILE - || argvu(&m[3], 1) != 0 - || argvu(&m[3], 2) != 0) - { - return -1; - } - qu102_t ldlrs = argvu(&m[3], 3); - unsigned lddxt = argvu(&m[3], 4); - if (m[4].id != gfxd_DPPipeSync) - return -1; - if (m[5].id != gfxd_DPSetTile - || argvi(&m[5], 0) != fmt - || G_SIZ_LDSIZ(argvi(&m[5], 1)) != ldsiz - || argvu(&m[5], 3) != tmem - || argvu(&m[5], 6) != cmt - || argvi(&m[5], 7) != maskt - || argvi(&m[5], 8) != shiftt - || argvu(&m[5], 9) != cms - || argvi(&m[5], 10) != masks - || argvi(&m[5], 11) != shifts) - { - return -1; - } - int siz = argvi(&m[5], 1); - int rdline = argvi(&m[5], 2); - int rt = argvi(&m[5], 4); - int pal = argvi(&m[5], 5); - if (m4b && siz != G_IM_SIZ_4b) - return -1; - if (!(mrt && rt != G_TX_RENDERTILE && tmem == 0) - && (tmem != 0) != mtmem) - { - return -1; - } - if ((rt != G_TX_RENDERTILE) != mrt) - return -1; - if (m[6].id != gfxd_DPSetTileSize - || argvi(&m[6], 0) != rt - || argvu(&m[6], 1) != 0 - || argvu(&m[6], 2) != 0 - || (argvu(&m[6], 3) & 3) - || (argvu(&m[6], 4) & 3)) - { - return -1; - } - int width = (argvu(&m[6], 3) >> 2) + 1; - int height = (argvu(&m[6], 4) >> 2) + 1; - unsigned lrs = G_LDBLK_TXL(G_LTB_LRS(width, height, siz)); - unsigned dxt = 0; - if (!mdxt) - dxt = G_DXT(siz, width); - int line; - if (myuv) - line = (width + 7) / 8; - else - line = (width * G_SIZ_LDBITS(siz) + 63) / 64; - if (ldlrs != lrs || lddxt != dxt || rdline != line) - return -1; - m->id = id; - int i = 0; - argu(m, i++, "timg", timg, gfxd_Timg); - if (mtmem) - argu(m, i++, "tmem", tmem, gfxd_Tmem); - if (mrt) - argi(m, i++, "rtile", rt, gfxd_Tile); - argi(m, i++, "fmt", fmt, gfxd_Fmt); - if (!m4b) - argi(m, i++, "siz", siz, gfxd_Siz); - argi(m, i++, "width", width, gfxd_Dim); - argi(m, i++, "height", height, gfxd_Dim); - argi(m, i++, "pal", pal, gfxd_Pal); - argu(m, i++, "cms", cms, gfxd_Cm); - argu(m, i++, "cmt", cmt, gfxd_Cm); - argi(m, i++, "masks", masks, gfxd_Tm); - argi(m, i++, "maskt", maskt, gfxd_Tm); - argi(m, i++, "shifts", shifts, gfxd_Ts); - argi(m, i++, "shiftt", shiftt, gfxd_Ts); - return 0; -} - -UCFUNC int c_DPLoadMultiBlockYuvS(gfxd_macro_t *m, int n_macro) -{ - return c_ltb(m, n_macro, gfxd_DPLoadMultiBlockYuvS, 1, 1, 1, 1, 0); -} - -UCFUNC int c_DPLoadMultiBlockYuv(gfxd_macro_t *m, int n_macro) -{ - return c_ltb(m, n_macro, gfxd_DPLoadMultiBlockYuv, 0, 1, 1, 1, 0); -} - -UCFUNC int c_DPLoadMultiBlock_4bS(gfxd_macro_t *m, int n_macro) -{ - return c_ltb(m, n_macro, gfxd_DPLoadMultiBlock_4bS, 1, 1, 1, 0, 1); -} - -UCFUNC int c_DPLoadMultiBlock_4b(gfxd_macro_t *m, int n_macro) -{ - return c_ltb(m, n_macro, gfxd_DPLoadMultiBlock_4b, 0, 1, 1, 0, 1); -} - -UCFUNC int c_DPLoadMultiBlockS(gfxd_macro_t *m, int n_macro) -{ - return c_ltb(m, n_macro, gfxd_DPLoadMultiBlockS, 1, 1, 1, 0, 0); -} - -UCFUNC int c_DPLoadMultiBlock(gfxd_macro_t *m, int n_macro) -{ - return c_ltb(m, n_macro, gfxd_DPLoadMultiBlock, 0, 1, 1, 0, 0); -} - -UCFUNC int c__DPLoadTextureBlockYuvS(gfxd_macro_t *m, int n_macro) -{ - return c_ltb(m, n_macro, gfxd__DPLoadTextureBlockYuvS, 1, 1, 0, 1, 0); -} - -UCFUNC int c__DPLoadTextureBlockYuv(gfxd_macro_t *m, int n_macro) -{ - return c_ltb(m, n_macro, gfxd__DPLoadTextureBlockYuv, 0, 1, 0, 1, 0); -} - -UCFUNC int c__DPLoadTextureBlock_4bS(gfxd_macro_t *m, int n_macro) -{ - return c_ltb(m, n_macro, gfxd__DPLoadTextureBlock_4bS, 1, 1, 0, 0, 1); -} - -UCFUNC int c__DPLoadTextureBlock_4b(gfxd_macro_t *m, int n_macro) -{ - return c_ltb(m, n_macro, gfxd__DPLoadTextureBlock_4b, 0, 1, 0, 0, 1); -} - -UCFUNC int c__DPLoadTextureBlockS(gfxd_macro_t *m, int n_macro) -{ - return c_ltb(m, n_macro, gfxd__DPLoadTextureBlockS, 1, 1, 0, 0, 0); -} - -UCFUNC int c__DPLoadTextureBlock(gfxd_macro_t *m, int n_macro) -{ - return c_ltb(m, n_macro, gfxd__DPLoadTextureBlock, 0, 1, 0, 0, 0); -} - -UCFUNC int c_DPLoadTextureBlockYuvS(gfxd_macro_t *m, int n_macro) -{ - return c_ltb(m, n_macro, gfxd_DPLoadTextureBlockYuvS, 1, 0, 0, 1, 0); -} - -UCFUNC int c_DPLoadTextureBlockYuv(gfxd_macro_t *m, int n_macro) -{ - return c_ltb(m, n_macro, gfxd_DPLoadTextureBlockYuv, 0, 0, 0, 1, 0); -} - -UCFUNC int c_DPLoadTextureBlock_4bS(gfxd_macro_t *m, int n_macro) -{ - return c_ltb(m, n_macro, gfxd_DPLoadTextureBlock_4bS, 1, 0, 0, 0, 1); -} - -UCFUNC int c_DPLoadTextureBlock_4b(gfxd_macro_t *m, int n_macro) -{ - return c_ltb(m, n_macro, gfxd_DPLoadTextureBlock_4b, 0, 0, 0, 0, 1); -} - -UCFUNC int c_DPLoadTextureBlockS(gfxd_macro_t *m, int n_macro) -{ - return c_ltb(m, n_macro, gfxd_DPLoadTextureBlockS, 1, 0, 0, 0, 0); -} - -UCFUNC int c_DPLoadTextureBlock(gfxd_macro_t *m, int n_macro) -{ - return c_ltb(m, n_macro, gfxd_DPLoadTextureBlock, 0, 0, 0, 0, 0); -} - -UCFUNC int c_ltt(gfxd_macro_t *m, int n_macro, int id, int mtmem, int mrt, - int myuv, int m4b) -{ - if (n_macro < 7) - return -1; - if (m[0].id != gfxd_DPSetTextureImage) - return -1; - g_ifmt_t fmt = argvi(&m[0], 0); - g_isiz_t ldsiz = argvi(&m[0], 1); - int width = argvi(&m[0], 2); - if (m4b) - { - if (ldsiz != G_IM_SIZ_8b) - return -1; - width *= 2; - } - uint32_t timg = argvu(&m[0], 3); - if (myuv && fmt != G_IM_FMT_YUV) - return -1; - if (m[1].id != gfxd_DPSetTile - || argvi(&m[1], 0) != fmt - || argvi(&m[1], 1) != ldsiz - || argvi(&m[1], 4) != G_TX_LOADTILE - || argvi(&m[1], 5) != 0) - { - return -1; - } - int ldline = argvi(&m[1], 2); - uint32_t tmem = argvu(&m[1], 3); - unsigned cms = argvu(&m[1], 9); - unsigned cmt = argvu(&m[1], 6); - int masks = argvi(&m[1], 10); - int maskt = argvi(&m[1], 7); - int shifts = argvi(&m[1], 11); - int shiftt = argvi(&m[1], 8); - if (m[2].id != gfxd_DPLoadSync) - return -1; - if (m[3].id != gfxd_DPLoadTile - || argvi(&m[3], 0) != G_TX_LOADTILE - || (argvu(&m[3], 1) & 1) - || (argvu(&m[3], 2) & 3) - || (argvu(&m[3], 3) & 1) - || (argvu(&m[3], 4) & 3)) - { - return -1; - } - qu102_t lduls = argvu(&m[3], 1); - qu102_t ldult = argvu(&m[3], 2); - qu102_t ldlrs = argvu(&m[3], 3); - qu102_t ldlrt = argvu(&m[3], 4); - if (m[4].id != gfxd_DPPipeSync) - return -1; - if (m[5].id != gfxd_DPSetTile - || argvi(&m[5], 0) != fmt - || argvi(&m[5], 2) != ldline - || argvu(&m[5], 3) != tmem - || argvu(&m[5], 6) != cmt - || argvi(&m[5], 7) != maskt - || argvi(&m[5], 8) != shiftt - || argvu(&m[5], 9) != cms - || argvi(&m[5], 10) != masks - || argvi(&m[5], 11) != shifts) - { - return -1; - } - int siz = argvi(&m[5], 1); - int rt = argvi(&m[5], 4); - int pal = argvi(&m[5], 5); - if (m4b) - { - if (siz != G_IM_SIZ_4b) - return -1; - } - else if (siz != ldsiz) - return -1; - if (!(mrt && rt != G_TX_RENDERTILE && tmem == 0) - && (tmem != 0) != mtmem) - { - return -1; - } - if ((rt != G_TX_RENDERTILE) != mrt) - return -1; - if (m[6].id != gfxd_DPSetTileSize - || argvi(&m[6], 0) != rt - || (argvu(&m[6], 1) & 3) - || (argvu(&m[6], 2) & 3) - || (argvu(&m[6], 3) & 3) - || (argvu(&m[6], 4) & 3)) - { - return -1; - } - unsigned uls = argvu(&m[6], 1) >> 2; - unsigned ult = argvu(&m[6], 2) >> 2; - unsigned lrs = argvu(&m[6], 3) >> 2; - unsigned lrt = argvu(&m[6], 4) >> 2; - int line; - if (myuv) - line = ((lrs - uls + 1) + 7) / 8; - else if (m4b) - line = ((lrs - uls + 1) / 2 + 7) / 8; - else - line = ((lrs - uls + 1) * G_SIZ_LDBITS(siz) + 63) / 64; - if (m4b) - { - if (lduls != qu102(uls) / 2 || ldlrs != qu102(lrs) / 2) - return -1; - } - else if (lduls != qu102(uls) || ldlrs != qu102(lrs)) - return -1; - if (ldult != qu102(ult) || ldlrt != qu102(lrt) || ldline != line) - return -1; - m->id = id; - int i = 0; - argu(m, i++, "timg", timg, gfxd_Timg); - if (mtmem) - argu(m, i++, "tmem", tmem, gfxd_Tmem); - if (mrt) - argi(m, i++, "rtile", rt, gfxd_Tile); - argi(m, i++, "fmt", fmt, gfxd_Fmt); - if (!m4b) - argi(m, i++, "siz", siz, gfxd_Siz); - argi(m, i++, "width", width, gfxd_Dim); - argi(m, i++, "height", 0, gfxd_Dim); - argu(m, i++, "uls", uls, gfxd_Coordi); - argu(m, i++, "ult", ult, gfxd_Coordi); - argu(m, i++, "lrs", lrs, gfxd_Coordi); - argu(m, i++, "lrt", lrt, gfxd_Coordi); - argi(m, i++, "pal", pal, gfxd_Pal); - argu(m, i++, "cms", cms, gfxd_Cm); - argu(m, i++, "cmt", cmt, gfxd_Cm); - argi(m, i++, "masks", masks, gfxd_Tm); - argi(m, i++, "maskt", maskt, gfxd_Tm); - argi(m, i++, "shifts", shifts, gfxd_Ts); - argi(m, i++, "shiftt", shiftt, gfxd_Ts); - return 0; -} - -UCFUNC int c_DPLoadMultiTileYuv(gfxd_macro_t *m, int n_macro) -{ - return c_ltt(m, n_macro, gfxd_DPLoadMultiTileYuv, 1, 1, 1, 0); -} - -UCFUNC int c_DPLoadMultiTile_4b(gfxd_macro_t *m, int n_macro) -{ - return c_ltt(m, n_macro, gfxd_DPLoadMultiTile_4b, 1, 1, 0, 1); -} - -UCFUNC int c_DPLoadMultiTile(gfxd_macro_t *m, int n_macro) -{ - return c_ltt(m, n_macro, gfxd_DPLoadMultiTile, 1, 1, 0, 0); -} - -UCFUNC int c__DPLoadTextureTileYuv(gfxd_macro_t *m, int n_macro) -{ - return c_ltt(m, n_macro, gfxd__DPLoadTextureTileYuv, 1, 0, 1, 0); -} - -UCFUNC int c__DPLoadTextureTile_4b(gfxd_macro_t *m, int n_macro) -{ - return c_ltt(m, n_macro, gfxd__DPLoadTextureTile_4b, 1, 0, 0, 1); -} - -UCFUNC int c__DPLoadTextureTile(gfxd_macro_t *m, int n_macro) -{ - return c_ltt(m, n_macro, gfxd__DPLoadTextureTile, 1, 0, 0, 0); -} - -UCFUNC int c_DPLoadTextureTileYuv(gfxd_macro_t *m, int n_macro) -{ - return c_ltt(m, n_macro, gfxd_DPLoadTextureTileYuv, 0, 0, 1, 0); -} - -UCFUNC int c_DPLoadTextureTile_4b(gfxd_macro_t *m, int n_macro) -{ - return c_ltt(m, n_macro, gfxd_DPLoadTextureTile_4b, 0, 0, 0, 1); -} - -UCFUNC int c_DPLoadTextureTile(gfxd_macro_t *m, int n_macro) -{ - return c_ltt(m, n_macro, gfxd_DPLoadTextureTile, 0, 0, 0, 0); -} - -UCFUNC int d_DPLoadBlock(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPLoadBlock; - argi(m, 0, "tile", getfield(lo, 3, 24), gfxd_Tile); - argu(m, 1, "uls", getfield(hi, 12, 12), gfxd_Coordi); - argu(m, 2, "ult", getfield(hi, 12, 0), gfxd_Coordi); - argu(m, 3, "lrs", getfield(lo, 12, 12), gfxd_Coordi); - argu(m, 4, "dxt", getfield(lo, 12, 0), gfxd_Dxt); - if (argvu(m, 3) > G_TX_LDBLK_MAX_TXL) { - badarg(m, 3); - return -1; - } - else { - return 0; - } -} - -UCFUNC int d_DPNoOp(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPNoOp; - return 0; -} - -UCFUNC int d_DPNoOpTag(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - if (lo == 0) - return d_DPNoOp(m, hi, lo); - else - { - m->id = gfxd_DPNoOpTag; - argu(m, 0, "tag", lo, gfxd_Tag); - return 0; - } -} - -UCFUNC int d_DPPipelineMode(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPPipelineMode; - argu(m, 0, "mode", lo, gfxd_Pm); - return 0; -} - -UCFUNC int d_DPSetBlendColor(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetBlendColor; - argu(m, 0, "r", getfield(lo, 8, 24), gfxd_Colorpart); - argu(m, 1, "g", getfield(lo, 8, 16), gfxd_Colorpart); - argu(m, 2, "b", getfield(lo, 8, 8), gfxd_Colorpart); - argu(m, 3, "a", getfield(lo, 8, 0), gfxd_Colorpart); - return 0; -} - -UCFUNC int d_DPSetEnvColor(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetEnvColor; - argu(m, 0, "r", getfield(lo, 8, 24), gfxd_Colorpart); - argu(m, 1, "g", getfield(lo, 8, 16), gfxd_Colorpart); - argu(m, 2, "b", getfield(lo, 8, 8), gfxd_Colorpart); - argu(m, 3, "a", getfield(lo, 8, 0), gfxd_Colorpart); - return 0; -} - -UCFUNC int d_DPSetFillColor(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetFillColor; - argu(m, 0, "c", lo, gfxd_Color); - return 0; -} - -UCFUNC int d_DPSetFogColor(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetFogColor; - argu(m, 0, "r", getfield(lo, 8, 24), gfxd_Colorpart); - argu(m, 1, "g", getfield(lo, 8, 16), gfxd_Colorpart); - argu(m, 2, "b", getfield(lo, 8, 8), gfxd_Colorpart); - argu(m, 3, "a", getfield(lo, 8, 0), gfxd_Colorpart); - return 0; -} - -UCFUNC int d_DPSetPrimColor(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetPrimColor; - argu(m, 0, "m", getfield(hi, 8, 8), gfxd_Lodfrac); - argu(m, 1, "l", getfield(hi, 8, 0), gfxd_Lodfrac); - argu(m, 2, "r", getfield(lo, 8, 24), gfxd_Colorpart); - argu(m, 3, "g", getfield(lo, 8, 16), gfxd_Colorpart); - argu(m, 4, "b", getfield(lo, 8, 8), gfxd_Colorpart); - argu(m, 5, "a", getfield(lo, 8, 0), gfxd_Colorpart); - return 0; -} - -UCFUNC int d_DPSetColorImage(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetColorImage; - argi(m, 0, "fmt", getfield(hi, 3, 21), gfxd_Fmt); - argi(m, 1, "siz", getfield(hi, 2, 19), gfxd_Siz); - argi(m, 2, "width", getfield(hi, 12, 0) + 1, gfxd_Dim); - argu(m, 3, "cimg", lo, gfxd_Cimg); - return 0; -} - -UCFUNC int d_DPSetDepthImage(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetDepthImage; - argu(m, 0, "zimg", lo, gfxd_Zimg); - return 0; -} - -UCFUNC int d_DPSetTextureImage(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetTextureImage; - argi(m, 0, "fmt", getfield(hi, 3, 21), gfxd_Fmt); - argi(m, 1, "siz", getfield(hi, 2, 19), gfxd_Siz); - argi(m, 2, "width", getfield(hi, 12, 0) + 1, gfxd_Dim); - argu(m, 3, "timg", lo, gfxd_Timg); - return 0; -} - -UCFUNC int d_DPSetAlphaCompare(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetAlphaCompare; - argu(m, 0, "mode", lo, gfxd_Ac); - return 0; -} - -UCFUNC int d_DPSetAlphaDither(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetAlphaDither; - argu(m, 0, "mode", lo, gfxd_Ad); - return 0; -} - -UCFUNC int d_DPSetColorDither(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetColorDither; - argu(m, 0, "mode", lo, gfxd_Cd); - return 0; -} - -UCFUNC void cc_unpack(struct cc_mode *m0, struct cc_mode *m1, uint32_t hi, - uint32_t lo) -{ - m0->a = getfield(hi, 4, 20); - m0->b = getfield(lo, 4, 28); - m0->c = getfield(hi, 5, 15); - m0->d = getfield(lo, 3, 15); - m0->Aa = getfield(hi, 3, 12); - m0->Ab = getfield(lo, 3, 12); - m0->Ac = getfield(hi, 3, 9); - m0->Ad = getfield(lo, 3, 9); - m1->a = getfield(hi, 4, 5); - m1->b = getfield(lo, 4, 24); - m1->c = getfield(hi, 5, 0); - m1->d = getfield(lo, 3, 6); - m1->Aa = getfield(lo, 3, 21); - m1->Ab = getfield(lo, 3, 3); - m1->Ac = getfield(lo, 3, 18); - m1->Ad = getfield(lo, 3, 0); -} - -UCFUNC int cc_lookup(const struct cc_mode *m) -{ - struct cc_mode m_norm = *m; - if (m_norm.a > 0x7) m_norm.a = G_CCMUX_0; - if (m_norm.b > 0x7) m_norm.b = G_CCMUX_0; - if (m_norm.c > 0xF) m_norm.c = G_CCMUX_0; - if (m_norm.d > 0x6) m_norm.d = G_CCMUX_0; - m = &m_norm; - int n_presets = sizeof(cc_presets) / sizeof(*cc_presets); - for (int i = 0; i < n_presets; i++) - { - const struct cc_mode *p = &cc_presets[i].mode; - if (m->a == p->a - && m->b == p->b - && m->c == p->c - && m->d == p->d - && m->Aa == p->Aa - && m->Ab == p->Ab - && m->Ac == p->Ac - && m->Ad == p->Ad) - { - return i; - } - } - return -1; -} - -UCFUNC int d_DPSetCombineMode(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetCombineMode; - struct cc_mode m0; - struct cc_mode m1; - cc_unpack(&m0, &m1, hi, lo); - int p0 = cc_lookup(&m0); - int p1 = cc_lookup(&m1); - argi(m, 0, "mode1", p0, gfxd_Ccpre); - argi(m, 1, "mode2", p1, gfxd_Ccpre); - int ret = 0; - if (p0 == -1) - { - badarg(m, 0); - ret = -1; - } - if (p1 == -1) - { - badarg(m, 1); - ret = -1; - } - return ret; -} - -UCFUNC int d_DPSetCombineLERP(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - struct cc_mode m0; - struct cc_mode m1; - cc_unpack(&m0, &m1, hi, lo); - int p0 = cc_lookup(&m0); - int p1 = cc_lookup(&m1); - if (p0 != -1 && p1 != -1) - return d_DPSetCombineMode(m, hi, lo); - else - { - m->id = gfxd_DPSetCombineLERP; - argi(m, 0, "a0", m0.a, gfxd_Ccmuxa); - argi(m, 1, "b0", m0.b, gfxd_Ccmuxb); - argi(m, 2, "c0", m0.c, gfxd_Ccmuxc); - argi(m, 3, "d0", m0.d, gfxd_Ccmuxd); - argi(m, 4, "Aa0", m0.Aa, gfxd_Acmuxabd); - argi(m, 5, "Ab0", m0.Ab, gfxd_Acmuxabd); - argi(m, 6, "Ac0", m0.Ac, gfxd_Acmuxc); - argi(m, 7, "Ad0", m0.Ad, gfxd_Acmuxabd); - argi(m, 8, "a1", m1.a, gfxd_Ccmuxa); - argi(m, 9, "b1", m1.b, gfxd_Ccmuxb); - argi(m, 10, "c1", m1.c, gfxd_Ccmuxc); - argi(m, 11, "d1", m1.d, gfxd_Ccmuxd); - argi(m, 12, "Aa1", m1.Aa, gfxd_Acmuxabd); - argi(m, 13, "Ab1", m1.Ab, gfxd_Acmuxabd); - argi(m, 14, "Ac1", m1.Ac, gfxd_Acmuxc); - argi(m, 15, "Ad1", m1.Ad, gfxd_Acmuxabd); - return 0; - } -} - -UCFUNC int d_DPSetConvert(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetConvert; - argi(m, 0, "k0", sx(getfield(hi, 9, 13), 9), gfxd_Cv); - argi(m, 1, "k1", sx(getfield(hi, 9, 4), 9), gfxd_Cv); - argi(m, 2, "k2", sx((getfield(hi, 4, 0) << 5) | getfield(lo, 5, 27), 9), - gfxd_Cv); - argi(m, 3, "k3", sx(getfield(lo, 9, 18), 9), gfxd_Cv); - argi(m, 4, "k4", sx(getfield(lo, 9, 9), 9), gfxd_Cv); - argi(m, 5, "k5", sx(getfield(lo, 9, 0), 9), gfxd_Cv); - return 0; -} - -UCFUNC int d_DPSetTextureConvert(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetTextureConvert; - argu(m, 0, "mode", lo, gfxd_Tc); - return 0; -} - -UCFUNC int d_DPSetCycleType(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetCycleType; - argu(m, 0, "mode", lo, gfxd_Cyc); - return 0; -} - -UCFUNC int d_DPSetDepthSource(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetDepthSource; - argu(m, 0, "mode", lo, gfxd_Zs); - return 0; -} - -UCFUNC int d_DPSetCombineKey(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetCombineKey; - argu(m, 0, "mode", lo, gfxd_Ck); - return 0; -} - -UCFUNC int d_DPSetKeyGB(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetKeyGB; - argu(m, 0, "cG", getfield(lo, 8, 24), gfxd_Color); - argu(m, 1, "sG", getfield(lo, 8, 16), gfxd_Keyscale); - argi(m, 2, "wG", sx(getfield(hi, 12, 12), 12), gfxd_Keywidth); - argu(m, 3, "cB", getfield(lo, 8, 8), gfxd_Color); - argu(m, 4, "sB", getfield(lo, 8, 0), gfxd_Keyscale); - argi(m, 5, "wB", sx(getfield(hi, 12, 0), 12), gfxd_Keywidth); - return 0; -} - -UCFUNC int d_DPSetKeyR(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetKeyR; - argu(m, 0, "cR", getfield(lo, 8, 8), gfxd_Color); - argu(m, 1, "sR", getfield(lo, 8, 0), gfxd_Keyscale); - argi(m, 2, "wR", sx(getfield(lo, 12, 16), 12), gfxd_Keywidth); - return 0; -} - -UCFUNC int d_DPSetPrimDepth(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetPrimDepth; - argi(m, 0, "z", sx(getfield(lo, 16, 16), 16), gfxd_Zi); - argi(m, 1, "dz", sx(getfield(lo, 16, 0), 16), gfxd_Zi); - return 0; -} - -UCFUNC int d_DPSetRenderMode(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetRenderMode; - argu(m, 0, "mode1", lo, gfxd_Rm1); - argu(m, 1, "mode2", lo, gfxd_Rm2); - return 0; -} - -UCFUNC int d_DPSetScissor(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetScissor; - argi(m, 0, "mode", getfield(lo, 2, 24), gfxd_Sc); - argu(m, 1, "ulx", getfield(hi, 10, 14), gfxd_Coordi); - argu(m, 2, "uly", getfield(hi, 10, 2), gfxd_Coordi); - argu(m, 3, "lrx", getfield(lo, 10, 14), gfxd_Coordi); - argu(m, 4, "lry", getfield(lo, 10, 2), gfxd_Coordi); - return 0; -} - -UCFUNC int d_DPSetScissorFrac(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - qu102_t ulx = getfield(hi, 12, 12); - qu102_t uly = getfield(hi, 12, 0); - qu102_t lrx = getfield(lo, 12, 12); - qu102_t lry = getfield(lo, 12, 0); - if ((ulx & 3) || (uly & 3) || (lrx & 3) || (lry & 3)) - { - m->id = gfxd_DPSetScissorFrac; - argi(m, 0, "mode", getfield(lo, 2, 24), gfxd_Sc); - argu(m, 1, "ulx", ulx, gfxd_Coordq); - argu(m, 2, "uly", uly, gfxd_Coordq); - argu(m, 3, "lrx", lrx, gfxd_Coordq); - argu(m, 4, "lry", lry, gfxd_Coordq); - return 0; - } - else - return d_DPSetScissor(m, hi, lo); -} - -UCFUNC int d_DPSetTextureDetail(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetTextureDetail; - argu(m, 0, "mode", lo, gfxd_Td); - return 0; -} - -UCFUNC int d_DPSetTextureFilter(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetTextureFilter; - argu(m, 0, "mode", lo, gfxd_Tf); - return 0; -} - -UCFUNC int d_DPSetTextureLOD(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetTextureLOD; - argu(m, 0, "mode", lo, gfxd_Tl); - return 0; -} - -UCFUNC int d_DPSetTextureLUT(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetTextureLUT; - argu(m, 0, "mode", lo, gfxd_Tt); - return 0; -} - -UCFUNC int d_DPSetTexturePersp(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetTexturePersp; - argu(m, 0, "mode", lo, gfxd_Tp); - return 0; -} - -UCFUNC int d_DPSetTile(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetTile; - argi(m, 0, "fmt", getfield(hi, 3, 21), gfxd_Fmt); - argi(m, 1, "siz", getfield(hi, 2, 19), gfxd_Siz); - argi(m, 2, "line", getfield(hi, 9, 9), gfxd_Line); - argu(m, 3, "tmem", getfield(hi, 9, 0), gfxd_Tmem); - argi(m, 4, "tile", getfield(lo, 3, 24), gfxd_Tile); - argi(m, 5, "pal", getfield(lo, 4, 20), gfxd_Pal); - argu(m, 6, "cmt", getfield(lo, 2, 18), gfxd_Cm); - argi(m, 7, "maskt", getfield(lo, 4, 14), gfxd_Tm); - argi(m, 8, "shiftt", getfield(lo, 4, 10), gfxd_Ts); - argu(m, 9, "cms", getfield(lo, 2, 8), gfxd_Cm); - argi(m, 10, "masks", getfield(lo, 4, 4), gfxd_Tm); - argi(m, 11, "shifts", getfield(lo, 4, 0), gfxd_Ts); - return 0; -} - -UCFUNC int d_DPSetTileSize(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetTileSize; - argi(m, 0, "tile", getfield(lo, 3, 24), gfxd_Tile); - argu(m, 1, "uls", getfield(hi, 12, 12), gfxd_Coordq); - argu(m, 2, "ult", getfield(hi, 12, 0), gfxd_Coordq); - argu(m, 3, "lrs", getfield(lo, 12, 12), gfxd_Coordq); - argu(m, 4, "lrt", getfield(lo, 12, 0), gfxd_Coordq); - return 0; -} - -#if defined(F3D_GBI) -UCFUNC int d_SP1Triangle(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SP1Triangle; - int n0 = getfield(lo, 8, 16); - int n1 = getfield(lo, 8, 8); - int n2 = getfield(lo, 8, 0); - argi(m, 0, "v0", n0 / 10, gfxd_Vtx); - argi(m, 1, "v1", n1 / 10, gfxd_Vtx); - argi(m, 2, "v2", n2 / 10, gfxd_Vtx); - argi(m, 3, "flag", getfield(lo, 8, 24), gfxd_Vtxflag); - int ret = 0; - if (n0 % 10 != 0) - { - badarg(m, 0); - ret = -1; - } - if (n1 % 10 != 0) - { - badarg(m, 1); - ret = -1; - } - if (n2 % 10 != 0) - { - badarg(m, 2); - ret = -1; - } - return ret; -} -#elif defined(F3DEX_GBI) -UCFUNC int d_SP1Triangle(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SP1Triangle; - int n0 = getfield(lo, 8, 16); - int n1 = getfield(lo, 8, 8); - int n2 = getfield(lo, 8, 0); - argi(m, 0, "v0", n0 / 2, gfxd_Vtx); - argi(m, 1, "v1", n1 / 2, gfxd_Vtx); - argi(m, 2, "v2", n2 / 2, gfxd_Vtx); - argi(m, 3, "flag", 0, gfxd_Vtxflag); - int ret = 0; - if (n0 % 2 != 0) - { - badarg(m, 0); - ret = -1; - } - if (n1 % 2 != 0) - { - badarg(m, 1); - ret = -1; - } - if (n2 % 2 != 0) - { - badarg(m, 2); - ret = -1; - } - return ret; -} -#elif defined(F3DEX_GBI_2) -UCFUNC int d_SP1Triangle(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SP1Triangle; - int n0 = getfield(hi, 8, 16); - int n1 = getfield(hi, 8, 8); - int n2 = getfield(hi, 8, 0); - argi(m, 0, "v0", n0 / 2, gfxd_Vtx); - argi(m, 1, "v1", n1 / 2, gfxd_Vtx); - argi(m, 2, "v2", n2 / 2, gfxd_Vtx); - argi(m, 3, "flag", 0, gfxd_Vtxflag); - int ret = 0; - if (n0 % 2 != 0) - { - badarg(m, 0); - ret = -1; - } - if (n1 % 2 != 0) - { - badarg(m, 1); - ret = -1; - } - if (n2 % 2 != 0) - { - badarg(m, 2); - ret = -1; - } - return ret; -} -#endif - -#if defined(F3DEX_GBI) || defined(F3DEX_GBI_2) -UCFUNC int d_SP1Quadrangle(gfxd_macro_t *m, uint32_t hi, uint32_t lo); -UCFUNC int d_SP2Triangles(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - int n00 = getfield(hi, 8, 16); - int n01 = getfield(hi, 8, 8); - int n02 = getfield(hi, 8, 0); - int n10 = getfield(lo, 8, 16); - int n11 = getfield(lo, 8, 8); - int n12 = getfield(lo, 8, 0); -#if defined(F3DEX_GBI) - if (n00 == n10 && n02 == n11) - return d_SP1Quadrangle(m, hi, lo); -#endif - m->id = gfxd_SP2Triangles; - argi(m, 0, "v00", n00 / 2, gfxd_Vtx); - argi(m, 1, "v01", n01 / 2, gfxd_Vtx); - argi(m, 2, "v02", n02 / 2, gfxd_Vtx); - argi(m, 3, "flag0", 0, gfxd_Vtxflag); - argi(m, 4, "v10", n10 / 2, gfxd_Vtx); - argi(m, 5, "v11", n11 / 2, gfxd_Vtx); - argi(m, 6, "v12", n12 / 2, gfxd_Vtx); - argi(m, 7, "flag1", 0, gfxd_Vtxflag); - int ret = 0; - if (n00 % 2 != 0) - { - badarg(m, 0); - ret = -1; - } - if (n01 % 2 != 0) - { - badarg(m, 1); - ret = -1; - } - if (n02 % 2 != 0) - { - badarg(m, 2); - ret = -1; - } - if (n10 % 2 != 0) - { - badarg(m, 4); - ret = -1; - } - if (n11 % 2 != 0) - { - badarg(m, 5); - ret = -1; - } - if (n12 % 2 != 0) - { - badarg(m, 6); - ret = -1; - } - return ret; -} - -UCFUNC int d_SP1Quadrangle(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SP1Quadrangle; - int n00 = getfield(hi, 8, 16); - int n01 = getfield(hi, 8, 8); - int n02 = getfield(hi, 8, 0); - int n10 = getfield(lo, 8, 16); - int n11 = getfield(lo, 8, 8); - int n12 = getfield(lo, 8, 0); - int v00 = n00 / 2; - int v01 = n01 / 2; - int v02 = n02 / 2; - int v10 = n10 / 2; - int v11 = n11 / 2; - int v12 = n12 / 2; - argi(m, 0, "v0", v00, gfxd_Vtx); - argi(m, 1, "v1", v01, gfxd_Vtx); - argi(m, 2, "v2", v11, gfxd_Vtx); - argi(m, 3, "v3", v12, gfxd_Vtx); - argi(m, 4, "flag", 0, gfxd_Vtxflag); - int ret = 0; - if (v00 != v10 || n00 % 2 != 0 || n10 % 2 != 0) - { - badarg(m, 0); - ret = -1; - } - if (n01 % 2 != 0) - { - badarg(m, 1); - ret = -1; - } - if (v02 != v11 || n02 % 2 != 0 || n11 % 2 != 0) - { - badarg(m, 2); - ret = -1; - } - if (n12 % 2 != 0) - { - badarg(m, 3); - ret = -1; - } - return ret; -} - -UCFUNC int c_SPBranchLessZraw(gfxd_macro_t *m, int n_macro) -{ - if (n_macro < 2) - return -1; - if (m[0].id != gfxd_DPHalf1) - return -1; - uint32_t branchdl = argvu(&m[0], 0); - if (m[1].id != gfxd_BranchZ) - return -1; - int32_t vtx = argvi(&m[1], 0); - int32_t zval = argvi(&m[1], 1); - m->id = gfxd_SPBranchLessZraw; - argu(m, 0, "dl", branchdl, gfxd_Dl); - argi(m, 1, "vtx", vtx, gfxd_Vtx); - argi(m, 2, "zval", zval, gfxd_Zraw); - return 0; -} -#endif - -UCFUNC int d_SPBranchList(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPBranchList; - argu(m, 0, "dl", lo, gfxd_Dl); - return 0; -} - -UCFUNC int c_SPClipRatio(gfxd_macro_t *m, int n_macro) -{ - if (n_macro < 4) - return -1; - if (m[0].id != gfxd_MoveWd - || argvi(&m[0], 0) != G_MW_CLIP - || argvu(&m[0], 1) != G_MWO_CLIP_RNX) - { - return -1; - } - uint32_t r = argvu(&m[0], 2); - if (m[1].id != gfxd_MoveWd - || argvi(&m[1], 0) != G_MW_CLIP - || argvu(&m[1], 1) != G_MWO_CLIP_RNY - || argvu(&m[1], 2) != r) - { - return -1; - } - if (m[2].id != gfxd_MoveWd - || argvi(&m[2], 0) != G_MW_CLIP - || argvu(&m[2], 1) != G_MWO_CLIP_RPX - || ((uint32_t)1 << 16) - argvu(&m[2], 2) != r) - { - return -1; - } - if (m[3].id != gfxd_MoveWd - || argvi(&m[3], 0) != G_MW_CLIP - || argvu(&m[3], 1) != G_MWO_CLIP_RPY - || ((uint32_t)1 << 16) - argvu(&m[3], 2) != r) - { - return -1; - } - m->id = gfxd_SPClipRatio; - argi(m, 0, "r", r, gfxd_Cr); - return 0; -} - -#if defined(F3D_GBI) -UCFUNC int d_SPCullDisplayList(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPCullDisplayList; - int n0 = getfield(hi, 24, 0); - int nn = getfield(lo, 16, 0); - argi(m, 0, "v0", n0 / 40, gfxd_Vtx); - argi(m, 1, "vn", nn / 40 - 1, gfxd_Num); - int ret = 0; - if (n0 % 40 != 0) - { - badarg(m, 0); - ret = -1; - } - if (nn % 40 != 0) - { - badarg(m, 1); - ret = -1; - } - return ret; -} -#elif defined(F3DEX_GBI) || defined(F3DEX_GBI_2) -UCFUNC int d_SPCullDisplayList(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPCullDisplayList; - int n0 = getfield(hi, 16, 0); - int nn = getfield(lo, 16, 0); - argi(m, 0, "v0", n0 / 2, gfxd_Vtx); - argi(m, 1, "vn", nn / 2, gfxd_Num); - int ret = 0; - if (n0 % 2 != 0) - { - badarg(m, 0); - ret = -1; - } - if (nn % 2 != 0) - { - badarg(m, 1); - ret = -1; - } - return ret; -} -#endif - -UCFUNC int d_SPDisplayList(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPDisplayList; - argu(m, 0, "dl", lo, gfxd_Dl); - return 0; -} - -UCFUNC int d_SPEndDisplayList(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPEndDisplayList; - return 0; -} - -UCFUNC int d_SPFogFactor(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPFogFactor; - argi(m, 0, "fm", sx(getfield(lo, 16, 16), 16), gfxd_Fogz); - argi(m, 1, "fo", sx(getfield(lo, 16, 0), 16), gfxd_Fogz); - return 0; -} - -UCFUNC int d_SPFogPosition(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - int x = sx(getfield(lo, 16, 16), 16); - int y = sx(getfield(lo, 16, 0), 16); - if (x == 0) - return d_SPFogFactor(m, hi, lo); - else - { - int d = 128000 / x; - int yd = y * d; - if (yd > 0) - yd += 255; - else if (yd < 0) - yd -= 255; - int min = 500 - yd / 256; - int max = d + min; - - if (min >= 0 && min <= 1000 && max >= 0 && max <= 1000) - { - m->id = gfxd_SPFogPosition; - argi(m, 0, "min", min, gfxd_Fogp); - argi(m, 1, "max", max, gfxd_Fogp); - return 0; - } - else - return d_SPFogFactor(m, hi, lo); - } -} - -#if defined(F3D_GBI) || defined(F3DEX_GBI) -UCFUNC int c_SPForceMatrix(gfxd_macro_t *m, int n_macro) -{ - if (n_macro < 4) - return -1; - for (int i = 0; i < 4; i++) - if (m[i].id != gfxd_MoveMem - || argvu(&m[i], 0) != 16 - || argvu(&m[i], 2) != argvu(&m[0], 2) + i * 16) - { - return -1; - } - if (argvi(&m[0], 1) != G_MV_MATRIX_1 - || argvi(&m[1], 1) != G_MV_MATRIX_2 - || argvi(&m[2], 1) != G_MV_MATRIX_3 - || argvi(&m[3], 1) != G_MV_MATRIX_4) - { - return -1; - } - uint32_t mptr = argvu(&m[0], 2); - m->id = gfxd_SPForceMatrix; - argu(m, 0, "mptr", mptr, gfxd_Mtxptr); - return 0; -} -#elif defined(F3DEX_GBI_2) -UCFUNC int c_SPForceMatrix(gfxd_macro_t *m, int n_macro) -{ - if (n_macro < 2) - return -1; - if (m[0].id != gfxd_MoveMem - || argvu(&m[0], 0) != sizeof(Mtx) - || argvi(&m[0], 1) != G_MV_MATRIX - || argvu(&m[0], 2) != 0) - { - return -1; - } - uint32_t mptr = argvu(&m[0], 3); - if (m[1].id != gfxd_MoveWd - || argvi(&m[1], 0) != G_MW_FORCEMTX - || argvu(&m[1], 1) != 0 - || argvu(&m[1], 2) != 0x10000) - { - return -1; - } - m->id = gfxd_SPForceMatrix; - argu(m, 0, "mptr", mptr, gfxd_Mtxptr); - return 0; -} -#endif - -UCFUNC int d_SPSetGeometryMode(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPSetGeometryMode; - argu(m, 0, "mode", lo, gfxd_Gm); - return 0; -} - -UCFUNC int d_SPClearGeometryMode(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPClearGeometryMode; -#if defined(F3D_GBI) || defined(F3DEX_GBI) - argu(m, 0, "mode", lo, gfxd_Gm); -#elif defined(F3DEX_GBI_2) - argu(m, 0, "mode", getfield(~hi, 24, 0), gfxd_Gm); -#endif - return 0; -} - -#if defined(F3D_GBI) || defined(F3DEX_GBI) -UCFUNC int c_SPLoadGeometryMode(gfxd_macro_t *m, int n_macro) -{ - if (n_macro < 2) - return -1; - if (m[0].id != gfxd_SPClearGeometryMode - || argvu(&m[0], 0) != 0xFFFFFFFF - || m[1].id != gfxd_SPSetGeometryMode) - { - return -1; - } - uint32_t mode = argvu(&m[1], 0); - m->id = gfxd_SPLoadGeometryMode; - argu(m, 0, "mode", mode, gfxd_Gm); - return 0; -} -#elif defined(F3DEX_GBI_2) -UCFUNC int d_SPLoadGeometryMode(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPLoadGeometryMode; - argu(m, 0, "mode", lo, gfxd_Gm); - return 0; -} -#endif - -#if defined(F3D_GBI) || defined(F3DEX_GBI) -UCFUNC int d_SPInsertMatrix(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPInsertMatrix; - argu(m, 0, "where", getfield(hi, 16, 8), gfxd_Mwo_matrix); - argu(m, 1, "val", lo, gfxd_Word); - return 0; -} -#endif - -#if defined(F3D_GBI) -UCFUNC int d_SPLine3D(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPLine3D; - int n0 = getfield(lo, 8, 16); - int n1 = getfield(lo, 8, 8); - argi(m, 0, "v0", n0 / 10, gfxd_Vtx); - argi(m, 1, "v1", n1 / 10, gfxd_Vtx); - argi(m, 2, "flag", getfield(lo, 8, 24), gfxd_Vtxflag); - int ret = 0; - if (n0 % 10 != 0) - { - badarg(m, 0); - ret = -1; - } - if (n1 % 10 != 0) - { - badarg(m, 1); - ret = -1; - } - return ret; -} -#elif defined(F3DEX_GBI) -UCFUNC int d_SPLine3D(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPLine3D; - int n0 = getfield(lo, 8, 16); - int n1 = getfield(lo, 8, 8); - argi(m, 0, "v0", n0 / 2, gfxd_Vtx); - argi(m, 1, "v1", n1 / 2, gfxd_Vtx); - argi(m, 2, "flag", 0, gfxd_Vtxflag); - int ret = 0; - if (n0 % 2 != 0) - { - badarg(m, 0); - ret = -1; - } - if (n1 % 2 != 0) - { - badarg(m, 1); - ret = -1; - } - return ret; -} -#elif defined(F3DEX_GBI_2) -UCFUNC int d_SPLine3D(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPLine3D; - int n0 = getfield(hi, 8, 16); - int n1 = getfield(hi, 8, 8); - argi(m, 0, "v0", n0 / 2, gfxd_Vtx); - argi(m, 1, "v1", n1 / 2, gfxd_Vtx); - argi(m, 2, "flag", 0, gfxd_Vtxflag); - int ret = 0; - if (n0 % 2 != 0) - { - badarg(m, 0); - ret = -1; - } - if (n1 % 2 != 0) - { - badarg(m, 1); - ret = -1; - } - return ret; -} -#endif - -#if defined(F3D_GBI) -UCFUNC int d_SPLineW3D(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - int wd = getfield(lo, 8, 0); - if (wd == 0) - return d_SPLine3D(m, hi, lo); - else - { - m->id = gfxd_SPLineW3D; - int n0 = getfield(lo, 8, 16); - int n1 = getfield(lo, 8, 8); - argi(m, 0, "v0", n0 / 10, gfxd_Vtx); - argi(m, 1, "v1", n1 / 10, gfxd_Vtx); - argi(m, 2, "wd", wd, gfxd_Linewd); - argi(m, 3, "flag", getfield(lo, 8, 24), gfxd_Vtxflag); - int ret = 0; - if (n0 % 10 != 0) - { - badarg(m, 0); - ret = -1; - } - if (n1 % 10 != 0) - { - badarg(m, 1); - ret = -1; - } - return ret; - } -} -#elif defined(F3DEX_GBI) || defined(F3DEX_GBI_2) -UCFUNC int d_SPLineW3D(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - int wd = getfield(hi, 8, 0); - if (wd == 0) - return d_SPLine3D(m, hi, lo); - else - { - m->id = gfxd_SPLineW3D; - int n0 = getfield(hi, 8, 16); - int n1 = getfield(hi, 8, 8); - argi(m, 0, "v0", n0 / 2, gfxd_Vtx); - argi(m, 1, "v1", n1 / 2, gfxd_Vtx); - argi(m, 2, "wd", wd, gfxd_Linewd); - argi(m, 3, "flag", 0, gfxd_Vtxflag); - int ret = 0; - if (n0 % 2 != 0) - { - badarg(m, 0); - ret = -1; - } - if (n1 % 2 != 0) - { - badarg(m, 1); - ret = -1; - } - return ret; - } -} -#endif - -#if defined(F3DEX_GBI) || defined(F3DEX_GBI_2) -UCFUNC int c_SPLoadUcode(gfxd_macro_t *m, int n_macro) -{ - if (n_macro < 2) - return -1; - if (m[0].id != gfxd_DPHalf1) - return -1; - uint32_t uc_dstart = argvu(&m[0], 0); - if (m[1].id != gfxd_LoadUcode) - return -1; - uint32_t uc_start = argvu(&m[1], 0); - uint32_t uc_dsize = argvu(&m[1], 1); - if (uc_dsize != 0x800) - return -1; - m->id = gfxd_SPLoadUcode; - argu(m, 0, "uc_start", uc_start, gfxd_Uctext); - argu(m, 1, "uc_dstart", uc_dstart, gfxd_Ucdata); - return 0; -} -#endif - -UCFUNC int d_SPLookAtX(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPLookAtX; - argu(m, 0, "l", lo, gfxd_Lookatptr); - return 0; -} - -UCFUNC int d_SPLookAtY(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPLookAtY; - argu(m, 0, "l", lo, gfxd_Lookatptr); - return 0; -} - -UCFUNC int c_SPLookAt(gfxd_macro_t *m, int n_macro) -{ - if (n_macro < 2) - return -1; - if (m[0].id != gfxd_SPLookAtX) - return -1; - uint32_t l = argvu(&m[0], 0); - if (m[1].id != gfxd_SPLookAtY || argvu(&m[1], 0) != l + 0x10) - return -1; - m->id = gfxd_SPLookAt; - argu(m, 0, "l", l, gfxd_Lookatptr); - return 0; -} - -#if defined(F3D_GBI) || defined(F3DEX_GBI) -UCFUNC int d_SPMatrix(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPMatrix; - int x = getfield(hi, 16, 0); - argu(m, 0, "matrix", lo, gfxd_Mtxptr); - argi(m, 1, "param", getfield(hi, 8, 16), gfxd_Mtxparam); - if (x != sizeof(Mtx)) - return -1; - else - return 0; -} -#elif defined(F3DEX_GBI_2) -UCFUNC int d_SPMatrix(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPMatrix; - int x = getfield(hi, 5, 19); - argu(m, 0, "matrix", lo, gfxd_Mtxptr); - argi(m, 1, "param", getfield(hi, 8, 0) ^ G_MTX_PUSH, gfxd_Mtxparam); - if (x != (sizeof(Mtx) - 1) / 8) - return -1; - else - return 0; -} -#endif - -#if defined(F3D_GBI) || (defined(F3D_BETA) && defined(F3DEX_GBI)) -UCFUNC int d_SPModifyVertex(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPModifyVertex; - int offset = getfield(hi, 16, 8); - argi(m, 0, "vtx", offset / 40, gfxd_Vtx); - argu(m, 1, "where", offset % 40, gfxd_Mwo_point); - argu(m, 2, "val", lo, gfxd_Word); - return 0; -} -#elif defined(F3DEX_GBI) || defined(F3DEX_GBI_2) -UCFUNC int d_SPModifyVertex(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPModifyVertex; - int vtx = getfield(hi, 16, 0); - argi(m, 0, "vtx", vtx / 2, gfxd_Vtx); - argu(m, 1, "where", getfield(hi, 8, 16), gfxd_Mwo_point); - argu(m, 2, "val", lo, gfxd_Word); - int ret = 0; - if (vtx % 2 != 0) - { - badarg(m, 0); - ret = -1; - } - return ret; -} -#endif - -UCFUNC int d_SPPerspNormalize(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPPerspNormalize; - argu(m, 0, "scale", getfield(lo, 16, 0), gfxd_Wscale); - return 0; -} - -UCFUNC int d_SPPopMatrix(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPPopMatrix; -#if defined(F3D_GBI) || defined(F3DEX_GBI) - argi(m, 0, "param", lo, gfxd_Mtxstack); -#elif defined(F3DEX_GBI_2) - argi(m, 0, "param", G_MTX_MODELVIEW, gfxd_Mtxstack); -#endif - return 0; -} - -#if defined(F3DEX_GBI_2) -UCFUNC int d_SPPopMatrixN(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - int len = (getfield(hi, 5, 19) + 1) * 8; - int ofs = getfield(hi, 8, 8) * 8; - int idx = getfield(hi, 8, 0); - int n = lo / sizeof(Mtx); - if (lo % sizeof(Mtx) == 0 - && len == sizeof(Mtx) - && ofs == 0 - && idx == 2 - && n == 1) - { - return d_SPPopMatrix(m, hi, lo); - } - m->id = gfxd_SPPopMatrixN; - argi(m, 0, "param", G_MTX_MODELVIEW, gfxd_Mtxstack); - argi(m, 1, "num", n, gfxd_Num); - int ret = 0; - if (lo % sizeof(Mtx) != 0) - { - badarg(m, 1); - ret = -1; - } - if (len != sizeof(Mtx) || ofs != 0 || idx != 2) - ret = -1; - return ret; -} -#endif - -UCFUNC int d_SPSegment(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPSegment; -#if defined(F3D_GBI) || defined(F3DEX_GBI) - int offset = getfield(hi, 16, 8); -#elif defined(F3DEX_GBI_2) - int offset = getfield(hi, 16, 0); -#endif - argu(m, 0, "seg", offset / 4, gfxd_Seg); - argu(m, 1, "base", lo, gfxd_Segptr); - int ret = 0; - if (offset % 4 != 0) - { - badarg(m, 0); - ret = -1; - } - return ret; -} - -UCFUNC int c_SPSetLightsN(gfxd_macro_t *m, int n_macro, int id, int numlights) -{ - if (n_macro < 2 + numlights) - return -1; - if (m[0].id != gfxd_SPNumLights || argvi(&m[0], 0) != numlights) - return -1; - int a = 1 + numlights; - if (m[a].id != gfxd_SPLight || argvi(&m[a], 1) != a) - return -1; - uint32_t l = argvu(&m[a], 0); - for (int i = 1; i <= numlights; i++) - { - int offset = sizeof(Ambient) + sizeof(Light) * (i - 1); - if (m[i].id != gfxd_SPLight - || argvu(&m[i], 0) != l + offset - || argvi(&m[i], 1) != i) - { - return -1; - } - } - m->id = id; - argu(m, 0, "l", l, gfxd_Lightsn); - return 0; -} - -UCFUNC int c_SPSetLights1(gfxd_macro_t *m, int n_macro) -{ - return c_SPSetLightsN(m, n_macro, gfxd_SPSetLights1, NUMLIGHTS_1); -} - -UCFUNC int c_SPSetLights2(gfxd_macro_t *m, int n_macro) -{ - return c_SPSetLightsN(m, n_macro, gfxd_SPSetLights2, NUMLIGHTS_2); -} - -UCFUNC int c_SPSetLights3(gfxd_macro_t *m, int n_macro) -{ - return c_SPSetLightsN(m, n_macro, gfxd_SPSetLights3, NUMLIGHTS_3); -} - -UCFUNC int c_SPSetLights4(gfxd_macro_t *m, int n_macro) -{ - return c_SPSetLightsN(m, n_macro, gfxd_SPSetLights4, NUMLIGHTS_4); -} - -UCFUNC int c_SPSetLights5(gfxd_macro_t *m, int n_macro) -{ - return c_SPSetLightsN(m, n_macro, gfxd_SPSetLights5, NUMLIGHTS_5); -} - -UCFUNC int c_SPSetLights6(gfxd_macro_t *m, int n_macro) -{ - return c_SPSetLightsN(m, n_macro, gfxd_SPSetLights6, NUMLIGHTS_6); -} - -UCFUNC int c_SPSetLights7(gfxd_macro_t *m, int n_macro) -{ - return c_SPSetLightsN(m, n_macro, gfxd_SPSetLights7, NUMLIGHTS_7); -} - -#if defined(F3D_GBI) || defined(F3DEX_GBI) -UCFUNC int d_SPNumLights(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPNumLights; - argi(m, 0, "n", (lo - 0x80000000) / 32 - 1, gfxd_Numlights); - int ret = 0; - if (lo < 0x80000040 || lo % 32 != 0) - { - badarg(m, 0); - ret = -1; - } - return ret; -} -#elif defined(F3DEX_GBI_2) -UCFUNC int d_SPNumLights(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPNumLights; - argi(m, 0, "n", lo / 24, gfxd_Numlights); - int ret = 0; - if (lo < 24 || lo % 24 != 0) - { - badarg(m, 0); - ret = -1; - } - return ret; -} -#endif - -#if defined(F3D_GBI) || defined(F3DEX_GBI) -UCFUNC int d_SPLight(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - int n = (getfield(hi, 8, 16) - G_MV_L0) / 2 + 1; - m->id = gfxd_SPLight; - argu(m, 0, "l", lo, gfxd_Lightptr); - argi(m, 1, "n", n, gfxd_Num); - return 0; -} -#elif defined(F3DEX_GBI_2) -UCFUNC int d_SPLight(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - int n = (getfield(hi, 8, 8) * 8 / 24) - 1; - m->id = gfxd_SPLight; - argu(m, 0, "l", lo, gfxd_Lightptr); - argi(m, 1, "n", n, gfxd_Num); - return 0; -} -#endif - -UCFUNC int c_SPLightColor(gfxd_macro_t *m, int n_macro) -{ - if (n_macro < 2) - return -1; - if (m[0].id != gfxd_MoveWd - || argvi(&m[0], 0) != G_MW_LIGHTCOL - || argvu(&m[0], 1) % 0x18 != 0 - || argvu(&m[0], 1) > G_MWO_aLIGHT_8) - { - return -1; - } - uint32_t offset = argvu(&m[0], 1); - uint32_t packedcolor = argvu(&m[0], 2); - if (m[1].id != gfxd_MoveWd - || argvi(&m[1], 0) != G_MW_LIGHTCOL - || argvu(&m[1], 1) != offset + 4 - || argvu(&m[1], 2) != packedcolor) - { - return -1; - } - m->id = gfxd_SPLightColor; - argi(m, 0, "n", offset / 0x18 + 1, gfxd_Lightnum); - argu(m, 1, "c", packedcolor, gfxd_Color); - return 0; -} - -UCFUNC int d_SPTexture(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPTexture; - argu(m, 0, "sc", getfield(lo, 16, 16), gfxd_Tcscale); - argu(m, 1, "tc", getfield(lo, 16, 0), gfxd_Tcscale); - argi(m, 2, "level", getfield(hi, 3, 11), gfxd_Num); - argi(m, 3, "tile", getfield(hi, 3, 8), gfxd_Tile); -#if defined(F3D_GBI) || defined(F3DEX_GBI) - argi(m, 4, "on", getfield(hi, 8, 0), gfxd_Switch); -#elif defined(F3DEX_GBI_2) - argi(m, 4, "on", getfield(hi, 7, 1), gfxd_Switch); -#endif - return 0; -} - -UCFUNC int c_SPTextureRectangle(gfxd_macro_t *m, int n_macro) -{ - if (n_macro < 3) - return -1; - if (m[0].id != gfxd_TexRect) - return -1; - qu102_t ulx = argvu(&m[0], 0); - qu102_t uly = argvu(&m[0], 1); - qu102_t lrx = argvu(&m[0], 2); - qu102_t lry = argvu(&m[0], 3); - int tile = argvi(&m[0], 4); - if (m[1].id != gfxd_DPHalf1) - return -1; - qs105_t s = sx(getfield(argvu(&m[1], 0), 16, 16), 16); - qs105_t t = sx(getfield(argvu(&m[1], 0), 16, 0), 16); - if (m[2].id != gfxd_DPHalf2) - return -1; - qs510_t dsdx = sx(getfield(argvu(&m[2], 0), 16, 16), 16); - qs510_t dtdy = sx(getfield(argvu(&m[2], 0), 16, 0), 16); - m->id = gfxd_SPTextureRectangle; - argu(m, 0, "ulx", ulx, gfxd_Coordq); - argu(m, 1, "uly", uly, gfxd_Coordq); - argu(m, 2, "lrx", lrx, gfxd_Coordq); - argu(m, 3, "lry", lry, gfxd_Coordq); - argi(m, 4, "tile", tile, gfxd_Tile); - argi(m, 5, "s", s, gfxd_St); - argi(m, 6, "t", t, gfxd_St); - argi(m, 7, "dsdx", dsdx, gfxd_Stdelta); - argi(m, 8, "dtdy", dtdy, gfxd_Stdelta); - return 0; -} - -UCFUNC int c_SPTextureRectangleFlip(gfxd_macro_t *m, int n_macro) -{ - if (n_macro < 3) - return -1; - if (m[0].id != gfxd_TexRectFlip) - return -1; - qu102_t ulx = argvu(&m[0], 0); - qu102_t uly = argvu(&m[0], 1); - qu102_t lrx = argvu(&m[0], 2); - qu102_t lry = argvu(&m[0], 3); - int tile = argvi(&m[0], 4); - if (m[1].id != gfxd_DPHalf1) - return -1; - qs105_t s = sx(getfield(argvu(&m[1], 0), 16, 16), 16); - qs105_t t = sx(getfield(argvu(&m[1], 0), 16, 0), 16); - if (m[2].id != gfxd_DPHalf2) - return -1; - qs510_t dsdx = sx(getfield(argvu(&m[2], 0), 16, 16), 16); - qs510_t dtdy = sx(getfield(argvu(&m[2], 0), 16, 0), 16); - m->id = gfxd_SPTextureRectangleFlip; - argu(m, 0, "ulx", ulx, gfxd_Coordq); - argu(m, 1, "uly", uly, gfxd_Coordq); - argu(m, 2, "lrx", lrx, gfxd_Coordq); - argu(m, 3, "lry", lry, gfxd_Coordq); - argi(m, 4, "tile", tile, gfxd_Tile); - argi(m, 5, "s", s, gfxd_St); - argi(m, 6, "t", t, gfxd_St); - argi(m, 7, "dsdx", dsdx, gfxd_Stdelta); - argi(m, 8, "dtdy", dtdy, gfxd_Stdelta); - return 0; -} - -#if defined(F3D_GBI) -UCFUNC int d_SPVertex(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPVertex; - int n = getfield(hi, 4, 20) + 1; - int v0 = getfield(hi, 4, 16); - int size = getfield(hi, 16, 0); - argu(m, 0, "v", lo, gfxd_Vtxptr); - argi(m, 1, "n", n, gfxd_Num); - argi(m, 2, "v0", v0, gfxd_Vtx); - int ret = 0; - if (size != sizeof(Vtx) * n) - { - badarg(m, 1); - ret = -1; - } - return ret; -} -#elif defined(F3DEX_GBI) -UCFUNC int d_SPVertex(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPVertex; - int n = getfield(hi, 6, 10); - int v0 = getfield(hi, 8, 16); - int size = getfield(hi, 10, 0); - argu(m, 0, "v", lo, gfxd_Vtxptr); - argi(m, 1, "n", n, gfxd_Num); - argi(m, 2, "v0", v0 / 2, gfxd_Vtx); - int ret = 0; - if (size != sizeof(Vtx) * n - 1) - { - badarg(m, 1); - ret = -1; - } - if (v0 % 2 != 0) - { - badarg(m, 2); - ret = -1; - } - return ret; -} -#elif defined(F3DEX_GBI_2) -UCFUNC int d_SPVertex(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPVertex; - int n = getfield(hi, 8, 12); - int v0 = getfield(hi, 7, 1) - n; - argu(m, 0, "v", lo, gfxd_Vtxptr); - argi(m, 1, "n", n, gfxd_Num); - argi(m, 2, "v0", v0, gfxd_Vtx); - return 0; -} -#endif - -UCFUNC int d_SPViewport(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPViewport; - argu(m, 0, "v", lo, gfxd_Vpptr); - return 0; -} - -UCFUNC int d_DPLoadTLUTCmd(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPLoadTLUTCmd; - argi(m, 0, "tile", getfield(lo, 3, 24), gfxd_Tile); - argi(m, 1, "count", getfield(lo, 10, 14), gfxd_Num); - return 0; -} - -UCFUNC int c_DPLoadTLUT(gfxd_macro_t *m, int n_macro) -{ - if (n_macro < 6) - return -1; - if (m[0].id != gfxd_DPSetTextureImage - || argvi(&m[0], 0) != G_IM_FMT_RGBA - || argvi(&m[0], 1) != G_IM_SIZ_16b - || argvi(&m[0], 2) != 1) - { - return -1; - } - uint32_t dram = argvu(&m[0], 3); - if (m[1].id != gfxd_DPTileSync) - return -1; - if (m[2].id != gfxd_DPSetTile - || argvi(&m[2], 0) != 0 - || argvi(&m[2], 1) != 0 - || argvi(&m[2], 2) != 0 - || argvi(&m[2], 4) != G_TX_LOADTILE - || argvi(&m[2], 5) != 0 - || argvu(&m[2], 6) != 0 - || argvi(&m[2], 7) != 0 - || argvi(&m[2], 8) != 0 - || argvu(&m[2], 9) != 0 - || argvi(&m[2], 10) != 0 - || argvi(&m[2], 11) != 0) - { - return -1; - } - uint32_t tmem = argvu(&m[2], 3); - if (m[3].id != gfxd_DPLoadSync) - return -1; - if (m[4].id != gfxd_DPLoadTLUTCmd || argvi(&m[4], 0) != G_TX_LOADTILE) - return -1; - int count = argvi(&m[4], 1) + 1; - if (m[5].id != gfxd_DPPipeSync) - return -1; - m->id = gfxd_DPLoadTLUT; - argi(m, 0, "count", count, gfxd_Num); - argu(m, 1, "tmem", tmem, gfxd_Tmem); - argu(m, 2, "dram", dram, gfxd_Tlut); - return 0; -} - -#if defined(F3DEX_GBI) || defined(F3DEX_GBI_2) -UCFUNC int d_BranchZ(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_BranchZ; - int na = getfield(hi, 12, 12); - int nb = getfield(hi, 12, 0); - int32_t zval; - if (lo > 0x7FFFFFFF) - zval = INT32_MIN + (int32_t)(lo & 0x7FFFFFFF); - else - zval = lo; - argi(m, 0, "vtx", nb / 2, gfxd_Vtx); - argi(m, 1, "zval", zval, gfxd_Zraw); - int ret = 0; - if (nb % 2 != 0 || na / 5 != nb / 2 || na % 5 != 0) - { - badarg(m, 0); - ret = -1; - } - return ret; -} -#endif - -UCFUNC int d_DisplayList(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - int flag = getfield(hi, 8, 16); - if (flag == 0) - return d_SPDisplayList(m, hi, lo); - else if (flag == 1) - return d_SPBranchList(m, hi, lo); - else - { - m->id = gfxd_DisplayList; - argu(m, 0, "dl", lo, gfxd_Dl); - argi(m, 1, "flag", flag, gfxd_Dlflag); - return 0; - } -} - -UCFUNC int d_DPHalf1(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPHalf1; - argu(m, 0, "hi", lo, gfxd_Word); - return 0; -} - -UCFUNC int d_DPHalf2(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPHalf2; - argu(m, 0, "lo", lo, gfxd_Word); - return 0; -} - -UCFUNC int c_DPWord(gfxd_macro_t *m, int n_macro) -{ - if (n_macro < 2) - return -1; - if (m[0].id != gfxd_DPHalf1 || m[1].id != gfxd_DPHalf2) - return -1; - uint32_t wordhi = argvu(&m[0], 0); - uint32_t wordlo = argvu(&m[1], 0); - m->id = gfxd_DPWord; - argu(m, 0, "wordhi", wordhi, gfxd_Word); - argu(m, 1, "wordlo", wordlo, gfxd_Word); - return 0; -} - -UCFUNC int d_DPLoadTile(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPLoadTile; - argi(m, 0, "tile", getfield(lo, 3, 24), gfxd_Tile); - argu(m, 1, "uls", getfield(hi, 12, 12), gfxd_Coordq); - argu(m, 2, "ult", getfield(hi, 12, 0), gfxd_Coordq); - argu(m, 3, "lrs", getfield(lo, 12, 12), gfxd_Coordq); - argu(m, 4, "lrt", getfield(lo, 12, 0), gfxd_Coordq); - return 0; -} - -#if defined(F3DEX_GBI_2) -UCFUNC int d_SPGeometryMode(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - uint32_t clearbits = getfield(~hi, 24, 0); - uint32_t setbits = lo; - if (clearbits == 0 && setbits != 0) - return d_SPSetGeometryMode(m, hi, lo); - else if (clearbits != 0 && setbits == 0) - return d_SPClearGeometryMode(m, hi, lo); - else if (clearbits == 0x00FFFFFF) - return d_SPLoadGeometryMode(m, hi, lo); - else - { - m->id = gfxd_SPGeometryMode; - argu(m, 0, "c", clearbits, gfxd_Gm); - argu(m, 1, "s", setbits, gfxd_Gm); - return 0; - } -} -#endif - -UCFUNC int d_SPSetOtherMode(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPSetOtherMode; - int opc = getfield(hi, 8, 24); -#if defined(F3D_GBI) || defined(F3DEX_GBI) - int length = getfield(hi, 8, 0); - int shift = getfield(hi, 8, 8); -#elif defined(F3DEX_GBI_2) - int length = getfield(hi, 8, 0) + 1; - int shift = 32 - (getfield(hi, 8, 8) + length); -#endif - argi(m, 0, "opc", opc, gfxd_Opcode); - argi(m, 1, "sft", shift, gfxd_Sftlo); - argi(m, 2, "len", length, gfxd_Num); - if (opc == G_SETOTHERMODE_H) - argu(m, 3, "mode", lo, gfxd_Othermodehi); - else if (opc == G_SETOTHERMODE_L) - argu(m, 3, "mode", lo, gfxd_Othermodelo); - else - argu(m, 3, "mode", lo, gfxd_Word); - return 0; -} - -UCFUNC int d_SPSetOtherModeLo(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ -#if defined(F3D_GBI) || defined(F3DEX_GBI) - int length = getfield(hi, 8, 0); - int shift = getfield(hi, 8, 8); -#elif defined(F3DEX_GBI_2) - int length = getfield(hi, 8, 0) + 1; - int shift = 32 - (getfield(hi, 8, 8) + length); -#endif - if (shift == G_MDSFT_ALPHACOMPARE && length == G_MDSIZ_ALPHACOMPARE) - return d_DPSetAlphaCompare(m, hi, lo); - else if (shift == G_MDSFT_ZSRCSEL && length == G_MDSIZ_ZSRCSEL) - return d_DPSetDepthSource(m, hi, lo); - else if (shift == G_MDSFT_RENDERMODE && length == G_MDSIZ_RENDERMODE) - return d_DPSetRenderMode(m, hi, lo); - else if (config.emit_ext_macro) - { - m->id = gfxd_SPSetOtherModeLo; - argi(m, 0, "sft", shift, gfxd_Sftlo); - argi(m, 1, "len", length, gfxd_Num); - argu(m, 2, "mode", lo, gfxd_Othermodelo); - return 0; - } - else - return d_SPSetOtherMode(m, hi, lo); -} - -UCFUNC int d_SPSetOtherModeHi(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ -#if defined(F3D_GBI) || defined(F3DEX_GBI) - int length = getfield(hi, 8, 0); - int shift = getfield(hi, 8, 8); -#elif defined(F3DEX_GBI_2) - int length = getfield(hi, 8, 0) + 1; - int shift = 32 - (getfield(hi, 8, 8) + length); -#endif - if (shift == G_MDSFT_ALPHADITHER && length == G_MDSIZ_ALPHADITHER) - return d_DPSetAlphaDither(m, hi, lo); - else if (shift == G_MDSFT_RGBDITHER && length == G_MDSIZ_RGBDITHER) - return d_DPSetColorDither(m, hi, lo); - else if (shift == G_MDSFT_COMBKEY && length == G_MDSIZ_COMBKEY) - return d_DPSetCombineKey(m, hi, lo); - else if (shift == G_MDSFT_TEXTCONV && length == G_MDSIZ_TEXTCONV) - return d_DPSetTextureConvert(m, hi, lo); - else if (shift == G_MDSFT_TEXTFILT && length == G_MDSIZ_TEXTFILT) - return d_DPSetTextureFilter(m, hi, lo); - else if (shift == G_MDSFT_TEXTLUT && length == G_MDSIZ_TEXTLUT) - return d_DPSetTextureLUT(m, hi, lo); - else if (shift == G_MDSFT_TEXTLOD && length == G_MDSIZ_TEXTLOD) - return d_DPSetTextureLOD(m, hi, lo); - else if (shift == G_MDSFT_TEXTDETAIL && length == G_MDSIZ_TEXTDETAIL) - return d_DPSetTextureDetail(m, hi, lo); - else if (shift == G_MDSFT_TEXTPERSP && length == G_MDSIZ_TEXTPERSP) - return d_DPSetTexturePersp(m, hi, lo); - else if (shift == G_MDSFT_CYCLETYPE && length == G_MDSIZ_CYCLETYPE) - return d_DPSetCycleType(m, hi, lo); - else if (shift == G_MDSFT_PIPELINE && length == G_MDSIZ_PIPELINE) - return d_DPPipelineMode(m, hi, lo); - else if (config.emit_ext_macro) - { - m->id = gfxd_SPSetOtherModeHi; - argi(m, 0, "sft", shift, gfxd_Sfthi); - argi(m, 1, "len", length, gfxd_Num); - argu(m, 2, "mode", lo, gfxd_Othermodehi); - return 0; - } - else - return d_SPSetOtherMode(m, hi, lo); -} - -UCFUNC int d_DPSetOtherMode(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_DPSetOtherMode; - argu(m, 0, "hi", getfield(hi, 24, 0), gfxd_Othermodehi); - argu(m, 1, "lo", lo, gfxd_Othermodelo); - return 0; -} - -UCFUNC int d_MoveWd(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ -#if defined(F3D_GBI) || defined(F3DEX_GBI) - int index = getfield(hi, 8, 0); - int offset = getfield(hi, 16, 8); -#elif defined(F3DEX_GBI_2) - int index = getfield(hi, 8, 16); - int offset = getfield(hi, 16, 0); -#endif - if (index == G_MW_FOG && offset == G_MWO_FOG) - return d_SPFogPosition(m, hi, lo); -#if !(defined(F3D_BETA) && (defined(F3D_GBI) || defined(F3DEX_GBI))) - else if (index == G_MW_PERSPNORM && offset == 0) - return d_SPPerspNormalize(m, hi, lo); -#endif - else if (index == G_MW_SEGMENT) - return d_SPSegment(m, hi, lo); - else if (index == G_MW_NUMLIGHT && offset == G_MWO_NUMLIGHT) - return d_SPNumLights(m, hi, lo); -#if defined(F3D_GBI) || (defined(F3D_BETA) && defined(F3DEX_GBI)) - else if (index == G_MW_POINTS) - return d_SPModifyVertex(m, hi, lo); -#endif -#if defined(F3D_GBI) || defined(F3DEX_GBI) - else if (index == G_MW_MATRIX) - return d_SPInsertMatrix(m, hi, lo); -#endif - else - { - m->id = gfxd_MoveWd; - argi(m, 0, "index", index, gfxd_Mw); - if (index == G_MW_MATRIX) - argu(m, 1, "offset", offset, gfxd_Mwo_matrix); - else if (index == G_MW_CLIP) - argu(m, 1, "offset", offset, gfxd_Mwo_clip); - else if (index == G_MW_LIGHTCOL) - argu(m, 1, "offset", offset, gfxd_Mwo_lightcol); - else - argu(m, 1, "offset", offset, gfxd_Mwo); - argu(m, 2, "value", lo, gfxd_Word); - } - return 0; -} - -#if defined(F3D_GBI) || defined(F3DEX_GBI) -UCFUNC int d_MoveMem(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - int size = getfield(hi, 16, 0); - int index = getfield(hi, 8, 16); - if (size == sizeof(Light) - && index >= G_MV_L0 - && index <= G_MV_L7 - && index % 2 == 0) - { - return d_SPLight(m, hi, lo); - } - else if (size == sizeof(Light) && index == G_MV_LOOKATX) - return d_SPLookAtX(m, hi, lo); - else if (size == sizeof(Light) && index == G_MV_LOOKATY) - return d_SPLookAtY(m, hi, lo); - else if (size == sizeof(Vp) && index == G_MV_VIEWPORT) - return d_SPViewport(m, hi, lo); - else - { - m->id = gfxd_MoveMem; - argu(m, 0, "size", size, gfxd_Size); - argi(m, 1, "index", index, gfxd_Mv); - argu(m, 2, "dram", lo, gfxd_Dram); - return 0; - } -} -#elif defined(F3DEX_GBI_2) -UCFUNC int d_MoveMem(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - int size = (getfield(hi, 5, 19) + 1) * 8; - int index = getfield(hi, 8, 0); - int offset = getfield(hi, 8, 8) * 8; - if (size == sizeof(Light) - && index == G_MV_LIGHT - && offset >= G_MVO_L0 - && offset <= G_MVO_L7 - && offset % 0x18 == 0) - { - return d_SPLight(m, hi, lo); - } - else if (size == sizeof(Light) - && index == G_MV_LIGHT - && offset == G_MVO_LOOKATX) - { - return d_SPLookAtX(m, hi, lo); - } - else if (size == sizeof(Light) - && index == G_MV_LIGHT - && offset == G_MVO_LOOKATY) - { - return d_SPLookAtY(m, hi, lo); - } - else if (size == sizeof(Vp) - && index == G_MV_VIEWPORT - && offset == 0) - { - return d_SPViewport(m, hi, lo); - } - else - { - m->id = gfxd_MoveMem; - argu(m, 0, "size", size, gfxd_Size); - argi(m, 1, "index", index, gfxd_Mv); - argu(m, 2, "offset", offset, gfxd_Size); - argu(m, 3, "dram", lo, gfxd_Dram); - return 0; - } -} -#endif - -#if defined(F3DEX_GBI_2) -UCFUNC int d_SPDmaRead(gfxd_macro_t *m, uint32_t hi, uint32_t lo); -UCFUNC int d_SPDmaWrite(gfxd_macro_t *m, uint32_t hi, uint32_t lo); -UCFUNC int d_SPDma_io(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - int flag = getfield(hi, 1, 23); - if (flag == 0) - return d_SPDmaRead(m, hi, lo); - else if (flag == 1) - return d_SPDmaWrite(m, hi, lo); - else - { - m->id = gfxd_SPDma_io; - argi(m, 0, "flag", flag, gfxd_Dmaflag); - argu(m, 1, "dmem", getfield(hi, 10, 13) * 8, gfxd_Dmem); - argu(m, 2, "dram", lo, gfxd_Dram); - argu(m, 3, "size", getfield(hi, 12, 10) + 1, gfxd_Size); - return 0; - } -} - -UCFUNC int d_SPDmaRead(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPDmaRead; - argu(m, 0, "dmem", getfield(hi, 10, 13) * 8, gfxd_Dmem); - argu(m, 1, "dram", lo, gfxd_Dram); - argu(m, 2, "size", getfield(hi, 12, 10) + 1, gfxd_Size); - return 0; -} - -UCFUNC int d_SPDmaWrite(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPDmaWrite; - argu(m, 0, "dmem", getfield(hi, 10, 13) * 8, gfxd_Dmem); - argu(m, 1, "dram", lo, gfxd_Dram); - argu(m, 2, "size", getfield(hi, 12, 10) + 1, gfxd_Size); - return 0; -} -#endif - -#if defined(F3DEX_GBI) || defined(F3DEX_GBI_2) -UCFUNC int d_LoadUcode(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_LoadUcode; - argu(m, 0, "uc_start", lo, gfxd_Uctext); - argu(m, 1, "uc_dsize", getfield(hi, 16, 0) + 1, gfxd_Size); - return 0; -} - -UCFUNC int c_SPLoadUcodeEx(gfxd_macro_t *m, int n_macro) -{ - if (n_macro < 2) - return -1; - if (m[0].id != gfxd_DPHalf1) - return -1; - uint32_t uc_dstart = argvu(&m[0], 0); - if (m[1].id != gfxd_LoadUcode) - return -1; - uint32_t uc_start = argvu(&m[1], 0); - uint32_t uc_dsize = argvu(&m[1], 1); - m->id = gfxd_SPLoadUcodeEx; - argu(m, 0, "uc_start", uc_start, gfxd_Uctext); - argu(m, 1, "uc_dstart", uc_dstart, gfxd_Ucdata); - argu(m, 2, "uc_dsize", uc_dsize, gfxd_Size); - return 0; -} -#endif - -UCFUNC int d_TexRect(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_TexRect; - argu(m, 0, "ulx", getfield(lo, 12, 12), gfxd_Coordq); - argu(m, 1, "uly", getfield(lo, 12, 0), gfxd_Coordq); - argu(m, 2, "lrx", getfield(hi, 12, 12), gfxd_Coordq); - argu(m, 3, "lry", getfield(hi, 12, 0), gfxd_Coordq); - argi(m, 4, "tile", getfield(lo, 3, 24), gfxd_Tile); - return 0; -} - -UCFUNC int d_TexRectFlip(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_TexRectFlip; - argu(m, 0, "ulx", getfield(lo, 12, 12), gfxd_Coordq); - argu(m, 1, "uly", getfield(lo, 12, 0), gfxd_Coordq); - argu(m, 2, "lrx", getfield(hi, 12, 12), gfxd_Coordq); - argu(m, 3, "lry", getfield(hi, 12, 0), gfxd_Coordq); - argi(m, 4, "tile", getfield(lo, 3, 24), gfxd_Tile); - return 0; -} - -UCFUNC int d_SPNoOp(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_SPNoOp; - return 0; -} - -#if defined(F3DEX_GBI_2) -UCFUNC int d_Special3(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_Special3; - argu(m, 0, "hi", getfield(hi, 24, 0), gfxd_Word); - argu(m, 1, "lo", lo, gfxd_Word); - return 0; -} - -UCFUNC int d_Special2(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_Special2; - argu(m, 0, "hi", getfield(hi, 24, 0), gfxd_Word); - argu(m, 1, "lo", lo, gfxd_Word); - return 0; -} - -UCFUNC int d_Special1(gfxd_macro_t *m, uint32_t hi, uint32_t lo) -{ - m->id = gfxd_Special1; - argu(m, 0, "hi", getfield(hi, 24, 0), gfxd_Word); - argu(m, 1, "lo", lo, gfxd_Word); - return 0; -} -#endif diff --git a/tools/ZAPD/lib/libgfxd/uc_macrotbl.c b/tools/ZAPD/lib/libgfxd/uc_macrotbl.c deleted file mode 100644 index a8939cede0..0000000000 --- a/tools/ZAPD/lib/libgfxd/uc_macrotbl.c +++ /dev/null @@ -1,1397 +0,0 @@ -static const gfxd_macro_type_t macro_tbl[] = -{ - [gfxd_Invalid] = - { - .prefix = NULL, - .suffix = NULL, - .opcode = -1, - .n_gfx = 1, - .n_arg = 2, - .disas_fn = d_Invalid, - }, - [gfxd_DPFillRectangle] = - { - .prefix = NULL, - .suffix = "DPFillRectangle", - .opcode = G_FILLRECT, - .n_gfx = 1, - .n_arg = 4, - .disas_fn = d_DPFillRectangle, - }, - [gfxd_DPFullSync] = - { - .prefix = NULL, - .suffix = "DPFullSync", - .opcode = G_RDPFULLSYNC, - .n_gfx = 1, - .n_arg = 0, - .disas_fn = d_DPFullSync, - }, - [gfxd_DPLoadSync] = - { - .prefix = NULL, - .suffix = "DPLoadSync", - .opcode = G_RDPLOADSYNC, - .n_gfx = 1, - .n_arg = 0, - .disas_fn = d_DPLoadSync, - }, - [gfxd_DPTileSync] = - { - .prefix = NULL, - .suffix = "DPTileSync", - .opcode = G_RDPTILESYNC, - .n_gfx = 1, - .n_arg = 0, - .disas_fn = d_DPTileSync, - }, - [gfxd_DPPipeSync] = - { - .prefix = NULL, - .suffix = "DPPipeSync", - .opcode = G_RDPPIPESYNC, - .n_gfx = 1, - .n_arg = 0, - .disas_fn = d_DPPipeSync, - }, - [gfxd_DPLoadTLUT_pal16] = - { - .prefix = NULL, - .suffix = "DPLoadTLUT_pal16", - .opcode = G_SETTIMG, - .n_gfx = 6, - .n_arg = 2, - .combine_fn = c_DPLoadTLUT_pal16, - }, - [gfxd_DPLoadTLUT_pal256] = - { - .prefix = NULL, - .suffix = "DPLoadTLUT_pal256", - .opcode = G_SETTIMG, - .n_gfx = 6, - .n_arg = 1, - .combine_fn = c_DPLoadTLUT_pal256, - }, - [gfxd_DPLoadMultiBlockYuvS] = - { - .prefix = NULL, - .suffix = "DPLoadMultiBlockYuvS", - .opcode = G_SETTIMG, - .n_gfx = 7, - .n_arg = 14, - .combine_fn = c_DPLoadMultiBlockYuvS, - .ext = 1, - }, - [gfxd_DPLoadMultiBlockYuv] = - { - .prefix = NULL, - .suffix = "DPLoadMultiBlockYuv", - .opcode = G_SETTIMG, - .n_gfx = 7, - .n_arg = 14, - .combine_fn = c_DPLoadMultiBlockYuv, - .ext = 1, - }, - [gfxd_DPLoadMultiBlock_4bS] = - { - .prefix = NULL, - .suffix = "DPLoadMultiBlock_4bS", - .opcode = G_SETTIMG, - .n_gfx = 7, - .n_arg = 13, - .combine_fn = c_DPLoadMultiBlock_4bS, - }, - [gfxd_DPLoadMultiBlock_4b] = - { - .prefix = NULL, - .suffix = "DPLoadMultiBlock_4b", - .opcode = G_SETTIMG, - .n_gfx = 7, - .n_arg = 13, - .combine_fn = c_DPLoadMultiBlock_4b, - }, - [gfxd_DPLoadMultiBlockS] = - { - .prefix = NULL, - .suffix = "DPLoadMultiBlockS", - .opcode = G_SETTIMG, - .n_gfx = 7, - .n_arg = 14, - .combine_fn = c_DPLoadMultiBlockS, - }, - [gfxd_DPLoadMultiBlock] = - { - .prefix = NULL, - .suffix = "DPLoadMultiBlock", - .opcode = G_SETTIMG, - .n_gfx = 7, - .n_arg = 14, - .combine_fn = c_DPLoadMultiBlock, - }, - [gfxd__DPLoadTextureBlockYuvS] = - { - .prefix = "_", - .suffix = "DPLoadTextureBlockYuvS", - .opcode = G_SETTIMG, - .n_gfx = 7, - .n_arg = 13, - .combine_fn = c__DPLoadTextureBlockYuvS, - .ext = 1, - }, - [gfxd__DPLoadTextureBlockYuv] = - { - .prefix = "_", - .suffix = "DPLoadTextureBlockYuv", - .opcode = G_SETTIMG, - .n_gfx = 7, - .n_arg = 13, - .combine_fn = c__DPLoadTextureBlockYuv, - .ext = 1, - }, - [gfxd__DPLoadTextureBlock_4bS] = - { - .prefix = "_", - .suffix = "DPLoadTextureBlock_4bS", - .opcode = G_SETTIMG, - .n_gfx = 7, - .n_arg = 12, - .combine_fn = c__DPLoadTextureBlock_4bS, - .ext = 1, - }, - [gfxd__DPLoadTextureBlock_4b] = - { - .prefix = "_", - .suffix = "DPLoadTextureBlock_4b", - .opcode = G_SETTIMG, - .n_gfx = 7, - .n_arg = 12, - .combine_fn = c__DPLoadTextureBlock_4b, - }, - [gfxd__DPLoadTextureBlockS] = - { - .prefix = "_", - .suffix = "DPLoadTextureBlockS", - .opcode = G_SETTIMG, - .n_gfx = 7, - .n_arg = 13, - .combine_fn = c__DPLoadTextureBlockS, - .ext = 1, - }, - [gfxd__DPLoadTextureBlock] = - { - .prefix = "_", - .suffix = "DPLoadTextureBlock", - .opcode = G_SETTIMG, - .n_gfx = 7, - .n_arg = 13, - .combine_fn = c__DPLoadTextureBlock, - }, - [gfxd_DPLoadTextureBlockYuvS] = - { - .prefix = NULL, - .suffix = "DPLoadTextureBlockYuvS", - .opcode = G_SETTIMG, - .n_gfx = 7, - .n_arg = 12, - .combine_fn = c_DPLoadTextureBlockYuvS, - .ext = 1, - }, - [gfxd_DPLoadTextureBlockYuv] = - { - .prefix = NULL, - .suffix = "DPLoadTextureBlockYuv", - .opcode = G_SETTIMG, - .n_gfx = 7, - .n_arg = 12, - .combine_fn = c_DPLoadTextureBlockYuv, - .ext = 1, - }, - [gfxd_DPLoadTextureBlock_4bS] = - { - .prefix = NULL, - .suffix = "DPLoadTextureBlock_4bS", - .opcode = G_SETTIMG, - .n_gfx = 7, - .n_arg = 11, - .combine_fn = c_DPLoadTextureBlock_4bS, - }, - [gfxd_DPLoadTextureBlock_4b] = - { - .prefix = NULL, - .suffix = "DPLoadTextureBlock_4b", - .opcode = G_SETTIMG, - .n_gfx = 7, - .n_arg = 11, - .combine_fn = c_DPLoadTextureBlock_4b, - }, - [gfxd_DPLoadTextureBlockS] = - { - .prefix = NULL, - .suffix = "DPLoadTextureBlockS", - .opcode = G_SETTIMG, - .n_gfx = 7, - .n_arg = 12, - .combine_fn = c_DPLoadTextureBlockS, - }, - [gfxd_DPLoadTextureBlock] = - { - .prefix = NULL, - .suffix = "DPLoadTextureBlock", - .opcode = G_SETTIMG, - .n_gfx = 7, - .n_arg = 12, - .combine_fn = c_DPLoadTextureBlock, - }, - [gfxd_DPLoadMultiTileYuv] = - { - .prefix = NULL, - .suffix = "DPLoadMultiTileYuv", - .opcode = G_SETTIMG, - .n_gfx = 7, - .n_arg = 18, - .combine_fn = c_DPLoadMultiTileYuv, - .ext = 1, - }, - [gfxd_DPLoadMultiTile_4b] = - { - .prefix = NULL, - .suffix = "DPLoadMultiTile_4b", - .opcode = G_SETTIMG, - .n_gfx = 7, - .n_arg = 17, - .combine_fn = c_DPLoadMultiTile_4b, - }, - [gfxd_DPLoadMultiTile] = - { - .prefix = NULL, - .suffix = "DPLoadMultiTile", - .opcode = G_SETTIMG, - .n_gfx = 7, - .n_arg = 18, - .combine_fn = c_DPLoadMultiTile, - }, - [gfxd__DPLoadTextureTileYuv] = - { - .prefix = "_", - .suffix = "DPLoadTextureTileYuv", - .opcode = G_SETTIMG, - .n_gfx = 7, - .n_arg = 17, - .combine_fn = c__DPLoadTextureTileYuv, - .ext = 1, - }, - [gfxd__DPLoadTextureTile_4b] = - { - .prefix = "_", - .suffix = "DPLoadTextureTile_4b", - .opcode = G_SETTIMG, - .n_gfx = 7, - .n_arg = 16, - .combine_fn = c__DPLoadTextureTile_4b, - .ext = 1, - }, - [gfxd__DPLoadTextureTile] = - { - .prefix = "_", - .suffix = "DPLoadTextureTile", - .opcode = G_SETTIMG, - .n_gfx = 7, - .n_arg = 17, - .combine_fn = c__DPLoadTextureTile, - .ext = 1, - }, - [gfxd_DPLoadTextureTileYuv] = - { - .prefix = NULL, - .suffix = "DPLoadTextureTileYuv", - .opcode = G_SETTIMG, - .n_gfx = 7, - .n_arg = 16, - .combine_fn = c_DPLoadTextureTileYuv, - .ext = 1, - }, - [gfxd_DPLoadTextureTile_4b] = - { - .prefix = NULL, - .suffix = "DPLoadTextureTile_4b", - .opcode = G_SETTIMG, - .n_gfx = 7, - .n_arg = 15, - .combine_fn = c_DPLoadTextureTile_4b, - }, - [gfxd_DPLoadTextureTile] = - { - .prefix = NULL, - .suffix = "DPLoadTextureTile", - .opcode = G_SETTIMG, - .n_gfx = 7, - .n_arg = 16, - .combine_fn = c_DPLoadTextureTile, - }, - [gfxd_DPLoadBlock] = - { - .prefix = NULL, - .suffix = "DPLoadBlock", - .opcode = G_LOADBLOCK, - .n_gfx = 1, - .n_arg = 5, - .disas_fn = d_DPLoadBlock, - }, - [gfxd_DPNoOp] = - { - .prefix = NULL, - .suffix = "DPNoOp", - .opcode = G_NOOP, - .n_gfx = 1, - .n_arg = 0, - .alias = gfxd_DPNoOpTag, - }, - [gfxd_DPNoOpTag] = - { - .prefix = NULL, - .suffix = "DPNoOpTag", - .opcode = G_NOOP, - .n_gfx = 1, - .n_arg = 1, - .disas_fn = d_DPNoOpTag, - }, - [gfxd_DPPipelineMode] = - { - .prefix = NULL, - .suffix = "DPPipelineMode", - .opcode = G_SETOTHERMODE_H, - .n_gfx = 1, - .n_arg = 1, - .alias = gfxd_SPSetOtherModeHi, - }, - [gfxd_DPSetBlendColor] = - { - .prefix = NULL, - .suffix = "DPSetBlendColor", - .opcode = G_SETBLENDCOLOR, - .n_gfx = 1, - .n_arg = 4, - .disas_fn = d_DPSetBlendColor, - }, - [gfxd_DPSetEnvColor] = - { - .prefix = NULL, - .suffix = "DPSetEnvColor", - .opcode = G_SETENVCOLOR, - .n_gfx = 1, - .n_arg = 4, - .disas_fn = d_DPSetEnvColor, - }, - [gfxd_DPSetFillColor] = - { - .prefix = NULL, - .suffix = "DPSetFillColor", - .opcode = G_SETFILLCOLOR, - .n_gfx = 1, - .n_arg = 1, - .disas_fn = d_DPSetFillColor, - }, - [gfxd_DPSetFogColor] = - { - .prefix = NULL, - .suffix = "DPSetFogColor", - .opcode = G_SETFOGCOLOR, - .n_gfx = 1, - .n_arg = 4, - .disas_fn = d_DPSetFogColor, - }, - [gfxd_DPSetPrimColor] = - { - .prefix = NULL, - .suffix = "DPSetPrimColor", - .opcode = G_SETPRIMCOLOR, - .n_gfx = 1, - .n_arg = 6, - .disas_fn = d_DPSetPrimColor, - }, - [gfxd_DPSetColorImage] = - { - .prefix = NULL, - .suffix = "DPSetColorImage", - .opcode = G_SETCIMG, - .n_gfx = 1, - .n_arg = 4, - .disas_fn = d_DPSetColorImage, - }, - [gfxd_DPSetDepthImage] = - { - .prefix = NULL, - .suffix = "DPSetDepthImage", - .opcode = G_SETZIMG, - .n_gfx = 1, - .n_arg = 1, - .disas_fn = d_DPSetDepthImage, - }, - [gfxd_DPSetTextureImage] = - { - .prefix = NULL, - .suffix = "DPSetTextureImage", - .opcode = G_SETTIMG, - .n_gfx = 1, - .n_arg = 4, - .disas_fn = d_DPSetTextureImage, - }, - [gfxd_DPSetAlphaCompare] = - { - .prefix = NULL, - .suffix = "DPSetAlphaCompare", - .opcode = G_SETOTHERMODE_L, - .n_gfx = 1, - .n_arg = 1, - .alias = gfxd_SPSetOtherModeLo, - }, - [gfxd_DPSetAlphaDither] = - { - .prefix = NULL, - .suffix = "DPSetAlphaDither", - .opcode = G_SETOTHERMODE_H, - .n_gfx = 1, - .n_arg = 1, - .alias = gfxd_SPSetOtherModeHi, - }, - [gfxd_DPSetColorDither] = - { - .prefix = NULL, - .suffix = "DPSetColorDither", - .opcode = G_SETOTHERMODE_H, - .n_gfx = 1, - .n_arg = 1, - .alias = gfxd_SPSetOtherModeHi, - }, - [gfxd_DPSetCombineMode] = - { - .prefix = NULL, - .suffix = "DPSetCombineMode", - .opcode = G_SETCOMBINE, - .n_gfx = 1, - .n_arg = 2, - .alias = gfxd_DPSetCombineLERP, - }, - [gfxd_DPSetCombineLERP] = - { - .prefix = NULL, - .suffix = "DPSetCombineLERP", - .opcode = G_SETCOMBINE, - .n_gfx = 1, - .n_arg = 16, - .disas_fn = d_DPSetCombineLERP, - }, - [gfxd_DPSetConvert] = - { - .prefix = NULL, - .suffix = "DPSetConvert", - .opcode = G_SETCONVERT, - .n_gfx = 1, - .n_arg = 6, - .disas_fn = d_DPSetConvert, - }, - [gfxd_DPSetTextureConvert] = - { - .prefix = NULL, - .suffix = "DPSetTextureConvert", - .opcode = G_SETOTHERMODE_H, - .n_gfx = 1, - .n_arg = 1, - .alias = gfxd_SPSetOtherModeHi, - }, - [gfxd_DPSetCycleType] = - { - .prefix = NULL, - .suffix = "DPSetCycleType", - .opcode = G_SETOTHERMODE_H, - .n_gfx = 1, - .n_arg = 1, - .alias = gfxd_SPSetOtherModeHi, - }, - [gfxd_DPSetDepthSource] = - { - .prefix = NULL, - .suffix = "DPSetDepthSource", - .opcode = G_SETOTHERMODE_L, - .n_gfx = 1, - .n_arg = 1, - .alias = gfxd_SPSetOtherModeLo, - }, - [gfxd_DPSetCombineKey] = - { - .prefix = NULL, - .suffix = "DPSetCombineKey", - .opcode = G_SETOTHERMODE_H, - .n_gfx = 1, - .n_arg = 1, - .alias = gfxd_SPSetOtherModeHi, - }, - [gfxd_DPSetKeyGB] = - { - .prefix = NULL, - .suffix = "DPSetKeyGB", - .opcode = G_SETKEYGB, - .n_gfx = 1, - .n_arg = 6, - .disas_fn = d_DPSetKeyGB, - }, - [gfxd_DPSetKeyR] = - { - .prefix = NULL, - .suffix = "DPSetKeyR", - .opcode = G_SETKEYR, - .n_gfx = 1, - .n_arg = 3, - .disas_fn = d_DPSetKeyR, - }, - [gfxd_DPSetPrimDepth] = - { - .prefix = NULL, - .suffix = "DPSetPrimDepth", - .opcode = G_SETPRIMDEPTH, - .n_gfx = 1, - .n_arg = 2, - .disas_fn = d_DPSetPrimDepth, - }, - [gfxd_DPSetRenderMode] = - { - .prefix = NULL, - .suffix = "DPSetRenderMode", - .opcode = G_SETOTHERMODE_L, - .n_gfx = 1, - .n_arg = 2, - .alias = gfxd_SPSetOtherModeLo, - }, - [gfxd_DPSetScissor] = - { - .prefix = NULL, - .suffix = "DPSetScissor", - .opcode = G_SETSCISSOR, - .n_gfx = 1, - .n_arg = 5, - .alias = gfxd_DPSetScissorFrac, - }, - [gfxd_DPSetScissorFrac] = - { - .prefix = NULL, - .suffix = "DPSetScissorFrac", - .opcode = G_SETSCISSOR, - .n_gfx = 1, - .n_arg = 5, - .disas_fn = d_DPSetScissorFrac, - }, - [gfxd_DPSetTextureDetail] = - { - .prefix = NULL, - .suffix = "DPSetTextureDetail", - .opcode = G_SETOTHERMODE_H, - .n_gfx = 1, - .n_arg = 1, - .alias = gfxd_SPSetOtherModeHi, - }, - [gfxd_DPSetTextureFilter] = - { - .prefix = NULL, - .suffix = "DPSetTextureFilter", - .opcode = G_SETOTHERMODE_H, - .n_gfx = 1, - .n_arg = 1, - .alias = gfxd_SPSetOtherModeHi, - }, - [gfxd_DPSetTextureLOD] = - { - .prefix = NULL, - .suffix = "DPSetTextureLOD", - .opcode = G_SETOTHERMODE_H, - .n_gfx = 1, - .n_arg = 1, - .alias = gfxd_SPSetOtherModeHi, - }, - [gfxd_DPSetTextureLUT] = - { - .prefix = NULL, - .suffix = "DPSetTextureLUT", - .opcode = G_SETOTHERMODE_H, - .n_gfx = 1, - .n_arg = 1, - .alias = gfxd_SPSetOtherModeHi, - }, - [gfxd_DPSetTexturePersp] = - { - .prefix = NULL, - .suffix = "DPSetTexturePersp", - .opcode = G_SETOTHERMODE_H, - .n_gfx = 1, - .n_arg = 1, - .alias = gfxd_SPSetOtherModeHi, - }, - [gfxd_DPSetTile] = - { - .prefix = NULL, - .suffix = "DPSetTile", - .opcode = G_SETTILE, - .n_gfx = 1, - .n_arg = 12, - .disas_fn = d_DPSetTile, - }, - [gfxd_DPSetTileSize] = - { - .prefix = NULL, - .suffix = "DPSetTileSize", - .opcode = G_SETTILESIZE, - .n_gfx = 1, - .n_arg = 5, - .disas_fn = d_DPSetTileSize, - }, - [gfxd_SP1Triangle] = - { - .prefix = NULL, - .suffix = "SP1Triangle", - .opcode = G_TRI1, - .n_gfx = 1, - .n_arg = 4, - .disas_fn = d_SP1Triangle, - }, -#if defined(F3DEX_GBI) || defined(F3DEX_GBI_2) - [gfxd_SP2Triangles] = - { - .prefix = NULL, - .suffix = "SP2Triangles", - .opcode = G_TRI2, - .n_gfx = 1, - .n_arg = 8, - .disas_fn = d_SP2Triangles, - }, -#endif -#if defined(F3DEX_GBI) - [gfxd_SP1Quadrangle] = - { - .prefix = NULL, - .suffix = "SP1Quadrangle", - .opcode = G_TRI2, - .n_gfx = 1, - .n_arg = 5, - .alias = gfxd_SP2Triangles, - }, -#elif defined(F3DEX_GBI_2) - [gfxd_SP1Quadrangle] = - { - .prefix = NULL, - .suffix = "SP1Quadrangle", - .opcode = G_QUAD, - .n_gfx = 1, - .n_arg = 5, - .disas_fn = d_SP1Quadrangle, - }, -#endif -#if defined(F3DEX_GBI) || defined(F3DEX_GBI_2) - [gfxd_SPBranchLessZraw] = - { - .prefix = NULL, - .suffix = "SPBranchLessZraw", - .opcode = G_RDPHALF_1, - .n_gfx = 2, - .n_arg = 3, - .combine_fn = c_SPBranchLessZraw, - }, -#endif - [gfxd_SPBranchList] = - { - .prefix = NULL, - .suffix = "SPBranchList", - .opcode = G_DL, - .n_gfx = 1, - .n_arg = 1, - .alias = gfxd_DisplayList, - }, - [gfxd_SPClipRatio] = - { - .prefix = NULL, - .suffix = "SPClipRatio", - .opcode = G_MOVEWORD, - .n_gfx = 4, - .n_arg = 1, - .combine_fn = c_SPClipRatio, - }, - [gfxd_SPCullDisplayList] = - { - .prefix = NULL, - .suffix = "SPCullDisplayList", - .opcode = G_CULLDL, - .n_gfx = 1, - .n_arg = 2, - .disas_fn = d_SPCullDisplayList, - }, - [gfxd_SPDisplayList] = - { - .prefix = NULL, - .suffix = "SPDisplayList", - .opcode = G_DL, - .n_gfx = 1, - .n_arg = 1, - .alias = gfxd_DisplayList, - }, - [gfxd_SPEndDisplayList] = - { - .prefix = NULL, - .suffix = "SPEndDisplayList", - .opcode = G_ENDDL, - .n_gfx = 1, - .n_arg = 0, - .disas_fn = d_SPEndDisplayList, - }, - [gfxd_SPFogFactor] = - { - .prefix = NULL, - .suffix = "SPFogFactor", - .opcode = G_MOVEWORD, - .n_gfx = 1, - .n_arg = 2, - .alias = gfxd_SPFogPosition, - }, - [gfxd_SPFogPosition] = - { - .prefix = NULL, - .suffix = "SPFogPosition", - .opcode = G_MOVEWORD, - .n_gfx = 1, - .n_arg = 2, - .alias = gfxd_MoveWd, - }, -#if defined(F3D_GBI) || defined(F3DEX_GBI) - [gfxd_SPForceMatrix] = - { - .prefix = NULL, - .suffix = "SPForceMatrix", - .opcode = G_MOVEMEM, - .n_gfx = 4, - .n_arg = 1, - .combine_fn = c_SPForceMatrix, - }, - [gfxd_SPSetGeometryMode] = - { - .prefix = NULL, - .suffix = "SPSetGeometryMode", - .opcode = G_SETGEOMETRYMODE, - .n_gfx = 1, - .n_arg = 1, - .disas_fn = d_SPSetGeometryMode, - }, - [gfxd_SPClearGeometryMode] = - { - .prefix = NULL, - .suffix = "SPClearGeometryMode", - .opcode = G_CLEARGEOMETRYMODE, - .n_gfx = 1, - .n_arg = 1, - .disas_fn = d_SPClearGeometryMode, - }, - [gfxd_SPLoadGeometryMode] = - { - .prefix = NULL, - .suffix = "SPLoadGeometryMode", - .opcode = G_CLEARGEOMETRYMODE, - .n_gfx = 2, - .n_arg = 1, - .combine_fn = c_SPLoadGeometryMode, - }, -#elif defined(F3DEX_GBI_2) - [gfxd_SPForceMatrix] = - { - .prefix = NULL, - .suffix = "SPForceMatrix", - .opcode = G_MOVEMEM, - .n_gfx = 2, - .n_arg = 1, - .combine_fn = c_SPForceMatrix, - }, - [gfxd_SPSetGeometryMode] = - { - .prefix = NULL, - .suffix = "SPSetGeometryMode", - .opcode = G_GEOMETRYMODE, - .n_gfx = 1, - .n_arg = 1, - .alias = gfxd_SPGeometryMode, - }, - [gfxd_SPClearGeometryMode] = - { - .prefix = NULL, - .suffix = "SPClearGeometryMode", - .opcode = G_GEOMETRYMODE, - .n_gfx = 1, - .n_arg = 1, - .alias = gfxd_SPGeometryMode, - }, - [gfxd_SPLoadGeometryMode] = - { - .prefix = NULL, - .suffix = "SPLoadGeometryMode", - .opcode = G_GEOMETRYMODE, - .n_gfx = 1, - .n_arg = 1, - .alias = gfxd_SPGeometryMode, - }, -#endif -#if defined(F3D_GBI) || defined(F3DEX_GBI) - [gfxd_SPInsertMatrix] = - { - .prefix = NULL, - .suffix = "SPInsertMatrix", - .opcode = G_MOVEWORD, - .n_gfx = 1, - .n_arg = 2, - .alias = gfxd_MoveWd, - }, -#endif - [gfxd_SPLine3D] = - { - .prefix = NULL, - .suffix = "SPLine3D", - .opcode = G_LINE3D, - .n_gfx = 1, - .n_arg = 3, - .alias = gfxd_SPLineW3D, - }, - [gfxd_SPLineW3D] = - { - .prefix = NULL, - .suffix = "SPLineW3D", - .opcode = G_LINE3D, - .n_gfx = 1, - .n_arg = 4, - .disas_fn = d_SPLineW3D, - }, -#if defined(F3DEX_GBI) || defined(F3DEX_GBI_2) - [gfxd_SPLoadUcode] = - { - .prefix = NULL, - .suffix = "SPLoadUcode", - .opcode = G_RDPHALF_1, - .n_gfx = 2, - .n_arg = 2, - .combine_fn = c_SPLoadUcode, - }, -#endif - [gfxd_SPLookAtX] = - { - .prefix = NULL, - .suffix = "SPLookAtX", - .opcode = G_MOVEMEM, - .n_gfx = 1, - .n_arg = 1, - .alias = gfxd_MoveMem, - }, - [gfxd_SPLookAtY] = - { - .prefix = NULL, - .suffix = "SPLookAtY", - .opcode = G_MOVEMEM, - .n_gfx = 1, - .n_arg = 1, - .alias = gfxd_MoveMem, - }, - [gfxd_SPLookAt] = - { - .prefix = NULL, - .suffix = "SPLookAt", - .opcode = G_MOVEMEM, - .n_gfx = 2, - .n_arg = 1, - .combine_fn = c_SPLookAt, - }, - [gfxd_SPMatrix] = - { - .prefix = NULL, - .suffix = "SPMatrix", - .opcode = G_MTX, - .n_gfx = 1, - .n_arg = 2, - .disas_fn = d_SPMatrix, - }, -#if defined(F3D_GBI) || (defined(F3D_BETA) && defined(F3DEX_GBI)) - [gfxd_SPModifyVertex] = - { - .prefix = NULL, - .suffix = "SPModifyVertex", - .opcode = G_MOVEWORD, - .n_gfx = 1, - .n_arg = 3, - .alias = gfxd_MoveWd, - }, -#elif defined(F3DEX_GBI) || defined(F3DEX_GBI_2) - [gfxd_SPModifyVertex] = - { - .prefix = NULL, - .suffix = "SPModifyVertex", - .opcode = G_MODIFYVTX, - .n_gfx = 1, - .n_arg = 3, - .disas_fn = d_SPModifyVertex, - }, -#endif -#if defined(F3D_BETA) && (defined(F3D_GBI) || defined(F3DEX_GBI)) - [gfxd_SPPerspNormalize] = - { - .prefix = NULL, - .suffix = "SPPerspNormalize", - .opcode = G_PERSPNORM, - .n_gfx = 1, - .n_arg = 1, - .disas_fn = d_SPPerspNormalize, - }, -#else - [gfxd_SPPerspNormalize] = - { - .prefix = NULL, - .suffix = "SPPerspNormalize", - .opcode = G_MOVEWORD, - .n_gfx = 1, - .n_arg = 1, - .alias = gfxd_MoveWd, - }, -#endif -#if defined(F3D_GBI) || defined(F3DEX_GBI) - [gfxd_SPPopMatrix] = - { - .prefix = NULL, - .suffix = "SPPopMatrix", - .opcode = G_POPMTX, - .n_gfx = 1, - .n_arg = 1, - .disas_fn = d_SPPopMatrix, - }, -#elif defined(F3DEX_GBI_2) - [gfxd_SPPopMatrix] = - { - .prefix = NULL, - .suffix = "SPPopMatrix", - .opcode = G_POPMTX, - .n_gfx = 1, - .n_arg = 1, - .alias = gfxd_SPPopMatrixN, - }, - [gfxd_SPPopMatrixN] = - { - .prefix = NULL, - .suffix = "SPPopMatrixN", - .opcode = G_POPMTX, - .n_gfx = 1, - .n_arg = 2, - .disas_fn = d_SPPopMatrixN, - }, -#endif - [gfxd_SPSegment] = - { - .prefix = NULL, - .suffix = "SPSegment", - .opcode = G_MOVEWORD, - .n_gfx = 1, - .n_arg = 2, - .alias = gfxd_MoveWd, - }, - [gfxd_SPSetLights1] = - { - .prefix = NULL, - .suffix = "SPSetLights1", - .opcode = G_MOVEWORD, - .n_gfx = 3, - .n_arg = 1, - .combine_fn = c_SPSetLights1, - }, - [gfxd_SPSetLights2] = - { - .prefix = NULL, - .suffix = "SPSetLights2", - .opcode = G_MOVEWORD, - .n_gfx = 4, - .n_arg = 1, - .combine_fn = c_SPSetLights2, - }, - [gfxd_SPSetLights3] = - { - .prefix = NULL, - .suffix = "SPSetLights3", - .opcode = G_MOVEWORD, - .n_gfx = 5, - .n_arg = 1, - .combine_fn = c_SPSetLights3, - }, - [gfxd_SPSetLights4] = - { - .prefix = NULL, - .suffix = "SPSetLights4", - .opcode = G_MOVEWORD, - .n_gfx = 6, - .n_arg = 1, - .combine_fn = c_SPSetLights4, - }, - [gfxd_SPSetLights5] = - { - .prefix = NULL, - .suffix = "SPSetLights5", - .opcode = G_MOVEWORD, - .n_gfx = 7, - .n_arg = 1, - .combine_fn = c_SPSetLights5, - }, - [gfxd_SPSetLights6] = - { - .prefix = NULL, - .suffix = "SPSetLights6", - .opcode = G_MOVEWORD, - .n_gfx = 8, - .n_arg = 1, - .combine_fn = c_SPSetLights6, - }, - [gfxd_SPSetLights7] = - { - .prefix = NULL, - .suffix = "SPSetLights7", - .opcode = G_MOVEWORD, - .n_gfx = 9, - .n_arg = 1, - .combine_fn = c_SPSetLights7, - }, - [gfxd_SPNumLights] = - { - .prefix = NULL, - .suffix = "SPNumLights", - .opcode = G_MOVEWORD, - .n_gfx = 1, - .n_arg = 1, - .alias = gfxd_MoveWd, - }, - [gfxd_SPLight] = - { - .prefix = NULL, - .suffix = "SPLight", - .opcode = G_MOVEMEM, - .n_gfx = 1, - .n_arg = 2, - .alias = gfxd_MoveMem, - }, - [gfxd_SPLightColor] = - { - .prefix = NULL, - .suffix = "SPLightColor", - .opcode = G_MOVEWORD, - .n_gfx = 2, - .n_arg = 2, - .combine_fn = c_SPLightColor, - }, - [gfxd_SPTexture] = - { - .prefix = NULL, - .suffix = "SPTexture", - .opcode = G_TEXTURE, - .n_gfx = 1, - .n_arg = 5, - .disas_fn = d_SPTexture, - }, - [gfxd_SPTextureRectangle] = - { - .prefix = NULL, - .suffix = "SPTextureRectangle", - .opcode = G_TEXRECT, - .n_gfx = 3, - .n_arg = 9, - .combine_fn = c_SPTextureRectangle, - }, - [gfxd_SPTextureRectangleFlip] = - { - .prefix = NULL, - .suffix = "SPTextureRectangleFlip", - .opcode = G_TEXRECTFLIP, - .n_gfx = 3, - .n_arg = 9, - .combine_fn = c_SPTextureRectangleFlip, - }, - [gfxd_SPVertex] = - { - .prefix = NULL, - .suffix = "SPVertex", - .opcode = G_VTX, - .n_gfx = 1, - .n_arg = 3, - .disas_fn = d_SPVertex, - }, - [gfxd_SPViewport] = - { - .prefix = NULL, - .suffix = "SPViewport", - .opcode = G_MOVEMEM, - .n_gfx = 1, - .n_arg = 1, - .alias = gfxd_MoveMem, - }, - [gfxd_DPLoadTLUTCmd] = - { - .prefix = NULL, - .suffix = "DPLoadTLUTCmd", - .opcode = G_LOADTLUT, - .n_gfx = 1, - .n_arg = 2, - .disas_fn = d_DPLoadTLUTCmd, - }, - [gfxd_DPLoadTLUT] = - { - .prefix = NULL, - .suffix = "DPLoadTLUT", - .opcode = G_SETTIMG, - .n_gfx = 6, - .n_arg = 3, - .combine_fn = c_DPLoadTLUT, - }, -#if defined(F3DEX_GBI) || defined(F3DEX_GBI_2) - [gfxd_BranchZ] = - { - .prefix = NULL, - .suffix = "BranchZ", - .opcode = G_BRANCH_Z, - .n_gfx = 1, - .n_arg = 2, - .disas_fn = d_BranchZ, - .ext = 1, - }, -#endif - [gfxd_DisplayList] = - { - .prefix = NULL, - .suffix = "DisplayList", - .opcode = G_DL, - .n_gfx = 1, - .n_arg = 2, - .disas_fn = d_DisplayList, - .ext = 1, - }, - [gfxd_DPHalf1] = - { - .prefix = NULL, - .suffix = "DPHalf1", - .opcode = G_RDPHALF_1, - .n_gfx = 1, - .n_arg = 1, - .disas_fn = d_DPHalf1, - .ext = 1, - }, - [gfxd_DPHalf2] = - { - .prefix = NULL, - .suffix = "DPHalf2", - .opcode = G_RDPHALF_2, - .n_gfx = 1, - .n_arg = 1, - .disas_fn = d_DPHalf2, - .ext = 1, - }, - [gfxd_DPWord] = - { - .prefix = NULL, - .suffix = "DPWord", - .opcode = G_RDPHALF_1, - .n_gfx = 2, - .n_arg = 2, - .combine_fn = c_DPWord, - }, - [gfxd_DPLoadTile] = - { - .prefix = NULL, - .suffix = "DPLoadTile", - .opcode = G_LOADTILE, - .n_gfx = 1, - .n_arg = 5, - .disas_fn = d_DPLoadTile, - }, -#if defined(F3DEX_GBI_2) - [gfxd_SPGeometryMode] = - { - .prefix = NULL, - .suffix = "SPGeometryMode", - .opcode = G_GEOMETRYMODE, - .n_gfx = 1, - .n_arg = 2, - .disas_fn = d_SPGeometryMode, - }, -#endif - [gfxd_SPSetOtherMode] = - { - .prefix = NULL, - .suffix = "SPSetOtherMode", - .opcode = -1, - .n_gfx = 1, - .n_arg = 4, - .disas_fn = d_SPSetOtherMode, - }, - [gfxd_SPSetOtherModeLo] = - { - .prefix = NULL, - .suffix = "SPSetOtherModeLo", - .opcode = G_SETOTHERMODE_L, - .n_gfx = 1, - .n_arg = 3, - .disas_fn = d_SPSetOtherModeLo, - .ext = 1, - }, - [gfxd_SPSetOtherModeHi] = - { - .prefix = NULL, - .suffix = "SPSetOtherModeHi", - .opcode = G_SETOTHERMODE_H, - .n_gfx = 1, - .n_arg = 3, - .disas_fn = d_SPSetOtherModeHi, - .ext = 1, - }, - [gfxd_DPSetOtherMode] = - { - .prefix = NULL, - .suffix = "DPSetOtherMode", - .opcode = G_RDPSETOTHERMODE, - .n_gfx = 1, - .n_arg = 2, - .disas_fn = d_DPSetOtherMode, - }, - [gfxd_MoveWd] = - { - .prefix = NULL, - .suffix = "MoveWd", - .opcode = G_MOVEWORD, - .n_gfx = 1, - .n_arg = 3, - .disas_fn = d_MoveWd, - }, -#if defined(F3D_GBI) || defined(F3DEX_GBI) - [gfxd_MoveMem] = - { - .prefix = NULL, - .suffix = "MoveMem", - .opcode = G_MOVEMEM, - .n_gfx = 1, - .n_arg = 3, - .disas_fn = d_MoveMem, - .ext = 1, - }, -#elif defined(F3DEX_GBI_2) - [gfxd_MoveMem] = - { - .prefix = NULL, - .suffix = "MoveMem", - .opcode = G_MOVEMEM, - .n_gfx = 1, - .n_arg = 4, - .disas_fn = d_MoveMem, - .ext = 1, - }, -#endif -#if defined(F3DEX_GBI_2) - [gfxd_SPDma_io] = - { - .prefix = NULL, - .suffix = "SPDma_io", - .opcode = G_DMA_IO, - .n_gfx = 1, - .n_arg = 4, - .disas_fn = d_SPDma_io, - }, - [gfxd_SPDmaRead] = - { - .prefix = NULL, - .suffix = "SPDmaRead", - .opcode = G_DMA_IO, - .n_gfx = 1, - .n_arg = 3, - .alias = gfxd_SPDma_io, - }, - [gfxd_SPDmaWrite] = - { - .prefix = NULL, - .suffix = "SPDmaWrite", - .opcode = G_DMA_IO, - .n_gfx = 1, - .n_arg = 3, - .alias = gfxd_SPDma_io, - }, -#endif -#if defined(F3DEX_GBI) || defined(F3DEX_GBI_2) - [gfxd_LoadUcode] = - { - .prefix = NULL, - .suffix = "LoadUcode", - .opcode = G_LOAD_UCODE, - .n_gfx = 1, - .n_arg = 2, - .disas_fn = d_LoadUcode, - }, - [gfxd_SPLoadUcodeEx] = - { - .prefix = NULL, - .suffix = "SPLoadUcodeEx", - .opcode = G_RDPHALF_1, - .n_gfx = 2, - .n_arg = 3, - .combine_fn = c_SPLoadUcodeEx, - }, -#endif - [gfxd_TexRect] = - { - .prefix = NULL, - .suffix = "TexRect", - .opcode = G_TEXRECT, - .n_gfx = 1, - .n_arg = 5, - .disas_fn = d_TexRect, - .ext = 1, - }, - [gfxd_TexRectFlip] = - { - .prefix = NULL, - .suffix = "TexRectFlip", - .opcode = G_TEXRECTFLIP, - .n_gfx = 1, - .n_arg = 5, - .disas_fn = d_TexRectFlip, - .ext = 1, - }, - [gfxd_SPNoOp] = - { - .prefix = NULL, - .suffix = "SPNoOp", - .opcode = G_SPNOOP, - .n_gfx = 1, - .n_arg = 0, - .disas_fn = d_SPNoOp, - }, -#if defined(F3DEX_GBI_2) - [gfxd_Special3] = - { - .prefix = NULL, - .suffix = "Special3", - .opcode = G_SPECIAL_3, - .n_gfx = 1, - .n_arg = 2, - .disas_fn = d_Special3, - .ext = 1, - }, - [gfxd_Special2] = - { - .prefix = NULL, - .suffix = "Special2", - .opcode = G_SPECIAL_2, - .n_gfx = 1, - .n_arg = 2, - .disas_fn = d_Special2, - .ext = 1, - }, - [gfxd_Special1] = - { - .prefix = NULL, - .suffix = "Special1", - .opcode = G_SPECIAL_1, - .n_gfx = 1, - .n_arg = 2, - .disas_fn = d_Special1, - .ext = 1, - }, -#endif -}; diff --git a/tools/ZAPD/lib/tinyxml2/tinyxml2.cpp b/tools/ZAPD/lib/tinyxml2/tinyxml2.cpp deleted file mode 100644 index 23a3a6ce47..0000000000 --- a/tools/ZAPD/lib/tinyxml2/tinyxml2.cpp +++ /dev/null @@ -1,2837 +0,0 @@ -/* -Original code by Lee Thomason (www.grinninglizard.com) - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - -#include "tinyxml2.h" - -#include // yes, this one new style header, is in the Android SDK. -#if defined(ANDROID_NDK) || defined(__BORLANDC__) || defined(__QNXNTO__) -# include -# include -#else -# include -# include -#endif - -#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) && (!defined WINCE) - // Microsoft Visual Studio, version 2005 and higher. Not WinCE. - /*int _snprintf_s( - char *buffer, - size_t sizeOfBuffer, - size_t count, - const char *format [, - argument] ... - );*/ - static inline int TIXML_SNPRINTF( char* buffer, size_t size, const char* format, ... ) - { - va_list va; - va_start( va, format ); - int result = vsnprintf_s( buffer, size, _TRUNCATE, format, va ); - va_end( va ); - return result; - } - - static inline int TIXML_VSNPRINTF( char* buffer, size_t size, const char* format, va_list va ) - { - int result = vsnprintf_s( buffer, size, _TRUNCATE, format, va ); - return result; - } - - #define TIXML_VSCPRINTF _vscprintf - #define TIXML_SSCANF sscanf_s -#elif defined _MSC_VER - // Microsoft Visual Studio 2003 and earlier or WinCE - #define TIXML_SNPRINTF _snprintf - #define TIXML_VSNPRINTF _vsnprintf - #define TIXML_SSCANF sscanf - #if (_MSC_VER < 1400 ) && (!defined WINCE) - // Microsoft Visual Studio 2003 and not WinCE. - #define TIXML_VSCPRINTF _vscprintf // VS2003's C runtime has this, but VC6 C runtime or WinCE SDK doesn't have. - #else - // Microsoft Visual Studio 2003 and earlier or WinCE. - static inline int TIXML_VSCPRINTF( const char* format, va_list va ) - { - int len = 512; - for (;;) { - len = len*2; - char* str = new char[len](); - const int required = _vsnprintf(str, len, format, va); - delete[] str; - if ( required != -1 ) { - TIXMLASSERT( required >= 0 ); - len = required; - break; - } - } - TIXMLASSERT( len >= 0 ); - return len; - } - #endif -#else - // GCC version 3 and higher - //#warning( "Using sn* functions." ) - #define TIXML_SNPRINTF snprintf - #define TIXML_VSNPRINTF vsnprintf - static inline int TIXML_VSCPRINTF( const char* format, va_list va ) - { - int len = vsnprintf( 0, 0, format, va ); - TIXMLASSERT( len >= 0 ); - return len; - } - #define TIXML_SSCANF sscanf -#endif - - -static const char LINE_FEED = (char)0x0a; // all line endings are normalized to LF -static const char LF = LINE_FEED; -static const char CARRIAGE_RETURN = (char)0x0d; // CR gets filtered out -static const char CR = CARRIAGE_RETURN; -static const char SINGLE_QUOTE = '\''; -static const char DOUBLE_QUOTE = '\"'; - -// Bunch of unicode info at: -// http://www.unicode.org/faq/utf_bom.html -// ef bb bf (Microsoft "lead bytes") - designates UTF-8 - -static const unsigned char TIXML_UTF_LEAD_0 = 0xefU; -static const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; -static const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; - -namespace tinyxml2 -{ - -struct Entity { - const char* pattern; - int length; - char value; -}; - -static const int NUM_ENTITIES = 5; -static const Entity entities[NUM_ENTITIES] = { - { "quot", 4, DOUBLE_QUOTE }, - { "amp", 3, '&' }, - { "apos", 4, SINGLE_QUOTE }, - { "lt", 2, '<' }, - { "gt", 2, '>' } -}; - - -StrPair::~StrPair() -{ - Reset(); -} - - -void StrPair::TransferTo( StrPair* other ) -{ - if ( this == other ) { - return; - } - // This in effect implements the assignment operator by "moving" - // ownership (as in auto_ptr). - - TIXMLASSERT( other != 0 ); - TIXMLASSERT( other->_flags == 0 ); - TIXMLASSERT( other->_start == 0 ); - TIXMLASSERT( other->_end == 0 ); - - other->Reset(); - - other->_flags = _flags; - other->_start = _start; - other->_end = _end; - - _flags = 0; - _start = 0; - _end = 0; -} - - -void StrPair::Reset() -{ - if ( _flags & NEEDS_DELETE ) { - delete [] _start; - } - _flags = 0; - _start = 0; - _end = 0; -} - - -void StrPair::SetStr( const char* str, int flags ) -{ - TIXMLASSERT( str ); - Reset(); - size_t len = strlen( str ); - TIXMLASSERT( _start == 0 ); - _start = new char[ len+1 ]; - memcpy( _start, str, len+1 ); - _end = _start + len; - _flags = flags | NEEDS_DELETE; -} - - -char* StrPair::ParseText( char* p, const char* endTag, int strFlags, int* curLineNumPtr ) -{ - TIXMLASSERT( p ); - TIXMLASSERT( endTag && *endTag ); - TIXMLASSERT(curLineNumPtr); - - char* start = p; - char endChar = *endTag; - size_t length = strlen( endTag ); - - // Inner loop of text parsing. - while ( *p ) { - if ( *p == endChar && strncmp( p, endTag, length ) == 0 ) { - Set( start, p, strFlags ); - return p + length; - } else if (*p == '\n') { - ++(*curLineNumPtr); - } - ++p; - TIXMLASSERT( p ); - } - return 0; -} - - -char* StrPair::ParseName( char* p ) -{ - if ( !p || !(*p) ) { - return 0; - } - if ( !XMLUtil::IsNameStartChar( *p ) ) { - return 0; - } - - char* const start = p; - ++p; - while ( *p && XMLUtil::IsNameChar( *p ) ) { - ++p; - } - - Set( start, p, 0 ); - return p; -} - - -void StrPair::CollapseWhitespace() -{ - // Adjusting _start would cause undefined behavior on delete[] - TIXMLASSERT( ( _flags & NEEDS_DELETE ) == 0 ); - // Trim leading space. - _start = XMLUtil::SkipWhiteSpace( _start, 0 ); - - if ( *_start ) { - const char* p = _start; // the read pointer - char* q = _start; // the write pointer - - while( *p ) { - if ( XMLUtil::IsWhiteSpace( *p )) { - p = XMLUtil::SkipWhiteSpace( p, 0 ); - if ( *p == 0 ) { - break; // don't write to q; this trims the trailing space. - } - *q = ' '; - ++q; - } - *q = *p; - ++q; - ++p; - } - *q = 0; - } -} - - -const char* StrPair::GetStr() -{ - TIXMLASSERT( _start ); - TIXMLASSERT( _end ); - if ( _flags & NEEDS_FLUSH ) { - *_end = 0; - _flags ^= NEEDS_FLUSH; - - if ( _flags ) { - const char* p = _start; // the read pointer - char* q = _start; // the write pointer - - while( p < _end ) { - if ( (_flags & NEEDS_NEWLINE_NORMALIZATION) && *p == CR ) { - // CR-LF pair becomes LF - // CR alone becomes LF - // LF-CR becomes LF - if ( *(p+1) == LF ) { - p += 2; - } - else { - ++p; - } - *q = LF; - ++q; - } - else if ( (_flags & NEEDS_NEWLINE_NORMALIZATION) && *p == LF ) { - if ( *(p+1) == CR ) { - p += 2; - } - else { - ++p; - } - *q = LF; - ++q; - } - else if ( (_flags & NEEDS_ENTITY_PROCESSING) && *p == '&' ) { - // Entities handled by tinyXML2: - // - special entities in the entity table [in/out] - // - numeric character reference [in] - // 中 or 中 - - if ( *(p+1) == '#' ) { - const int buflen = 10; - char buf[buflen] = { 0 }; - int len = 0; - char* adjusted = const_cast( XMLUtil::GetCharacterRef( p, buf, &len ) ); - if ( adjusted == 0 ) { - *q = *p; - ++p; - ++q; - } - else { - TIXMLASSERT( 0 <= len && len <= buflen ); - TIXMLASSERT( q + len <= adjusted ); - p = adjusted; - memcpy( q, buf, len ); - q += len; - } - } - else { - bool entityFound = false; - for( int i = 0; i < NUM_ENTITIES; ++i ) { - const Entity& entity = entities[i]; - if ( strncmp( p + 1, entity.pattern, entity.length ) == 0 - && *( p + entity.length + 1 ) == ';' ) { - // Found an entity - convert. - *q = entity.value; - ++q; - p += entity.length + 2; - entityFound = true; - break; - } - } - if ( !entityFound ) { - // fixme: treat as error? - ++p; - ++q; - } - } - } - else { - *q = *p; - ++p; - ++q; - } - } - *q = 0; - } - // The loop below has plenty going on, and this - // is a less useful mode. Break it out. - if ( _flags & NEEDS_WHITESPACE_COLLAPSING ) { - CollapseWhitespace(); - } - _flags = (_flags & NEEDS_DELETE); - } - TIXMLASSERT( _start ); - return _start; -} - - - - -// --------- XMLUtil ----------- // - -const char* XMLUtil::writeBoolTrue = "true"; -const char* XMLUtil::writeBoolFalse = "false"; - -void XMLUtil::SetBoolSerialization(const char* writeTrue, const char* writeFalse) -{ - static const char* defTrue = "true"; - static const char* defFalse = "false"; - - writeBoolTrue = (writeTrue) ? writeTrue : defTrue; - writeBoolFalse = (writeFalse) ? writeFalse : defFalse; -} - - -const char* XMLUtil::ReadBOM( const char* p, bool* bom ) -{ - TIXMLASSERT( p ); - TIXMLASSERT( bom ); - *bom = false; - const unsigned char* pu = reinterpret_cast(p); - // Check for BOM: - if ( *(pu+0) == TIXML_UTF_LEAD_0 - && *(pu+1) == TIXML_UTF_LEAD_1 - && *(pu+2) == TIXML_UTF_LEAD_2 ) { - *bom = true; - p += 3; - } - TIXMLASSERT( p ); - return p; -} - - -void XMLUtil::ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ) -{ - const unsigned long BYTE_MASK = 0xBF; - const unsigned long BYTE_MARK = 0x80; - const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; - - if (input < 0x80) { - *length = 1; - } - else if ( input < 0x800 ) { - *length = 2; - } - else if ( input < 0x10000 ) { - *length = 3; - } - else if ( input < 0x200000 ) { - *length = 4; - } - else { - *length = 0; // This code won't convert this correctly anyway. - return; - } - - output += *length; - - // Scary scary fall throughs are annotated with carefully designed comments - // to suppress compiler warnings such as -Wimplicit-fallthrough in gcc - switch (*length) { - case 4: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - //fall through - case 3: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - //fall through - case 2: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - //fall through - case 1: - --output; - *output = (char)(input | FIRST_BYTE_MARK[*length]); - break; - default: - TIXMLASSERT( false ); - } -} - - -const char* XMLUtil::GetCharacterRef( const char* p, char* value, int* length ) -{ - // Presume an entity, and pull it out. - *length = 0; - - if ( *(p+1) == '#' && *(p+2) ) { - unsigned long ucs = 0; - TIXMLASSERT( sizeof( ucs ) >= 4 ); - ptrdiff_t delta = 0; - unsigned mult = 1; - static const char SEMICOLON = ';'; - - if ( *(p+2) == 'x' ) { - // Hexadecimal. - const char* q = p+3; - if ( !(*q) ) { - return 0; - } - - q = strchr( q, SEMICOLON ); - - if ( !q ) { - return 0; - } - TIXMLASSERT( *q == SEMICOLON ); - - delta = q-p; - --q; - - while ( *q != 'x' ) { - unsigned int digit = 0; - - if ( *q >= '0' && *q <= '9' ) { - digit = *q - '0'; - } - else if ( *q >= 'a' && *q <= 'f' ) { - digit = *q - 'a' + 10; - } - else if ( *q >= 'A' && *q <= 'F' ) { - digit = *q - 'A' + 10; - } - else { - return 0; - } - TIXMLASSERT( digit < 16 ); - TIXMLASSERT( digit == 0 || mult <= UINT_MAX / digit ); - const unsigned int digitScaled = mult * digit; - TIXMLASSERT( ucs <= ULONG_MAX - digitScaled ); - ucs += digitScaled; - TIXMLASSERT( mult <= UINT_MAX / 16 ); - mult *= 16; - --q; - } - } - else { - // Decimal. - const char* q = p+2; - if ( !(*q) ) { - return 0; - } - - q = strchr( q, SEMICOLON ); - - if ( !q ) { - return 0; - } - TIXMLASSERT( *q == SEMICOLON ); - - delta = q-p; - --q; - - while ( *q != '#' ) { - if ( *q >= '0' && *q <= '9' ) { - const unsigned int digit = *q - '0'; - TIXMLASSERT( digit < 10 ); - TIXMLASSERT( digit == 0 || mult <= UINT_MAX / digit ); - const unsigned int digitScaled = mult * digit; - TIXMLASSERT( ucs <= ULONG_MAX - digitScaled ); - ucs += digitScaled; - } - else { - return 0; - } - TIXMLASSERT( mult <= UINT_MAX / 10 ); - mult *= 10; - --q; - } - } - // convert the UCS to UTF-8 - ConvertUTF32ToUTF8( ucs, value, length ); - return p + delta + 1; - } - return p+1; -} - - -void XMLUtil::ToStr( int v, char* buffer, int bufferSize ) -{ - TIXML_SNPRINTF( buffer, bufferSize, "%d", v ); -} - - -void XMLUtil::ToStr( unsigned v, char* buffer, int bufferSize ) -{ - TIXML_SNPRINTF( buffer, bufferSize, "%u", v ); -} - - -void XMLUtil::ToStr( bool v, char* buffer, int bufferSize ) -{ - TIXML_SNPRINTF( buffer, bufferSize, "%s", v ? writeBoolTrue : writeBoolFalse); -} - -/* - ToStr() of a number is a very tricky topic. - https://github.com/leethomason/tinyxml2/issues/106 -*/ -void XMLUtil::ToStr( float v, char* buffer, int bufferSize ) -{ - TIXML_SNPRINTF( buffer, bufferSize, "%.8g", v ); -} - - -void XMLUtil::ToStr( double v, char* buffer, int bufferSize ) -{ - TIXML_SNPRINTF( buffer, bufferSize, "%.17g", v ); -} - - -void XMLUtil::ToStr(int64_t v, char* buffer, int bufferSize) -{ - // horrible syntax trick to make the compiler happy about %lld - TIXML_SNPRINTF(buffer, bufferSize, "%lld", (long long)v); -} - - -bool XMLUtil::ToInt( const char* str, int* value ) -{ - if ( TIXML_SSCANF( str, "%d", value ) == 1 ) { - return true; - } - return false; -} - -bool XMLUtil::ToUnsigned( const char* str, unsigned *value ) -{ - if ( TIXML_SSCANF( str, "%u", value ) == 1 ) { - return true; - } - return false; -} - -bool XMLUtil::ToBool( const char* str, bool* value ) -{ - int ival = 0; - if ( ToInt( str, &ival )) { - *value = (ival==0) ? false : true; - return true; - } - if ( StringEqual( str, "true" ) ) { - *value = true; - return true; - } - else if ( StringEqual( str, "false" ) ) { - *value = false; - return true; - } - return false; -} - - -bool XMLUtil::ToFloat( const char* str, float* value ) -{ - if ( TIXML_SSCANF( str, "%f", value ) == 1 ) { - return true; - } - return false; -} - - -bool XMLUtil::ToDouble( const char* str, double* value ) -{ - if ( TIXML_SSCANF( str, "%lf", value ) == 1 ) { - return true; - } - return false; -} - - -bool XMLUtil::ToInt64(const char* str, int64_t* value) -{ - long long v = 0; // horrible syntax trick to make the compiler happy about %lld - if (TIXML_SSCANF(str, "%lld", &v) == 1) { - *value = (int64_t)v; - return true; - } - return false; -} - - -char* XMLDocument::Identify( char* p, XMLNode** node ) -{ - TIXMLASSERT( node ); - TIXMLASSERT( p ); - char* const start = p; - int const startLine = _parseCurLineNum; - p = XMLUtil::SkipWhiteSpace( p, &_parseCurLineNum ); - if( !*p ) { - *node = 0; - TIXMLASSERT( p ); - return p; - } - - // These strings define the matching patterns: - static const char* xmlHeader = { "( _commentPool ); - returnNode->_parseLineNum = _parseCurLineNum; - p += xmlHeaderLen; - } - else if ( XMLUtil::StringEqual( p, commentHeader, commentHeaderLen ) ) { - returnNode = CreateUnlinkedNode( _commentPool ); - returnNode->_parseLineNum = _parseCurLineNum; - p += commentHeaderLen; - } - else if ( XMLUtil::StringEqual( p, cdataHeader, cdataHeaderLen ) ) { - XMLText* text = CreateUnlinkedNode( _textPool ); - returnNode = text; - returnNode->_parseLineNum = _parseCurLineNum; - p += cdataHeaderLen; - text->SetCData( true ); - } - else if ( XMLUtil::StringEqual( p, dtdHeader, dtdHeaderLen ) ) { - returnNode = CreateUnlinkedNode( _commentPool ); - returnNode->_parseLineNum = _parseCurLineNum; - p += dtdHeaderLen; - } - else if ( XMLUtil::StringEqual( p, elementHeader, elementHeaderLen ) ) { - returnNode = CreateUnlinkedNode( _elementPool ); - returnNode->_parseLineNum = _parseCurLineNum; - p += elementHeaderLen; - } - else { - returnNode = CreateUnlinkedNode( _textPool ); - returnNode->_parseLineNum = _parseCurLineNum; // Report line of first non-whitespace character - p = start; // Back it up, all the text counts. - _parseCurLineNum = startLine; - } - - TIXMLASSERT( returnNode ); - TIXMLASSERT( p ); - *node = returnNode; - return p; -} - - -bool XMLDocument::Accept( XMLVisitor* visitor ) const -{ - TIXMLASSERT( visitor ); - if ( visitor->VisitEnter( *this ) ) { - for ( const XMLNode* node=FirstChild(); node; node=node->NextSibling() ) { - if ( !node->Accept( visitor ) ) { - break; - } - } - } - return visitor->VisitExit( *this ); -} - - -// --------- XMLNode ----------- // - -XMLNode::XMLNode( XMLDocument* doc ) : - _document( doc ), - _parent( 0 ), - _value(), - _parseLineNum( 0 ), - _firstChild( 0 ), _lastChild( 0 ), - _prev( 0 ), _next( 0 ), - _userData( 0 ), - _memPool( 0 ) -{ -} - - -XMLNode::~XMLNode() -{ - DeleteChildren(); - if ( _parent ) { - _parent->Unlink( this ); - } -} - -const char* XMLNode::Value() const -{ - // Edge case: XMLDocuments don't have a Value. Return null. - if ( this->ToDocument() ) - return 0; - return _value.GetStr(); -} - -void XMLNode::SetValue( const char* str, bool staticMem ) -{ - if ( staticMem ) { - _value.SetInternedStr( str ); - } - else { - _value.SetStr( str ); - } -} - -XMLNode* XMLNode::DeepClone(XMLDocument* target) const -{ - XMLNode* clone = this->ShallowClone(target); - if (!clone) return 0; - - for (const XMLNode* child = this->FirstChild(); child; child = child->NextSibling()) { - XMLNode* childClone = child->DeepClone(target); - TIXMLASSERT(childClone); - clone->InsertEndChild(childClone); - } - return clone; -} - -void XMLNode::DeleteChildren() -{ - while( _firstChild ) { - TIXMLASSERT( _lastChild ); - DeleteChild( _firstChild ); - } - _firstChild = _lastChild = 0; -} - - -void XMLNode::Unlink( XMLNode* child ) -{ - TIXMLASSERT( child ); - TIXMLASSERT( child->_document == _document ); - TIXMLASSERT( child->_parent == this ); - if ( child == _firstChild ) { - _firstChild = _firstChild->_next; - } - if ( child == _lastChild ) { - _lastChild = _lastChild->_prev; - } - - if ( child->_prev ) { - child->_prev->_next = child->_next; - } - if ( child->_next ) { - child->_next->_prev = child->_prev; - } - child->_next = 0; - child->_prev = 0; - child->_parent = 0; -} - - -void XMLNode::DeleteChild( XMLNode* node ) -{ - TIXMLASSERT( node ); - TIXMLASSERT( node->_document == _document ); - TIXMLASSERT( node->_parent == this ); - Unlink( node ); - TIXMLASSERT(node->_prev == 0); - TIXMLASSERT(node->_next == 0); - TIXMLASSERT(node->_parent == 0); - DeleteNode( node ); -} - - -XMLNode* XMLNode::InsertEndChild( XMLNode* addThis ) -{ - TIXMLASSERT( addThis ); - if ( addThis->_document != _document ) { - TIXMLASSERT( false ); - return 0; - } - InsertChildPreamble( addThis ); - - if ( _lastChild ) { - TIXMLASSERT( _firstChild ); - TIXMLASSERT( _lastChild->_next == 0 ); - _lastChild->_next = addThis; - addThis->_prev = _lastChild; - _lastChild = addThis; - - addThis->_next = 0; - } - else { - TIXMLASSERT( _firstChild == 0 ); - _firstChild = _lastChild = addThis; - - addThis->_prev = 0; - addThis->_next = 0; - } - addThis->_parent = this; - return addThis; -} - - -XMLNode* XMLNode::InsertFirstChild( XMLNode* addThis ) -{ - TIXMLASSERT( addThis ); - if ( addThis->_document != _document ) { - TIXMLASSERT( false ); - return 0; - } - InsertChildPreamble( addThis ); - - if ( _firstChild ) { - TIXMLASSERT( _lastChild ); - TIXMLASSERT( _firstChild->_prev == 0 ); - - _firstChild->_prev = addThis; - addThis->_next = _firstChild; - _firstChild = addThis; - - addThis->_prev = 0; - } - else { - TIXMLASSERT( _lastChild == 0 ); - _firstChild = _lastChild = addThis; - - addThis->_prev = 0; - addThis->_next = 0; - } - addThis->_parent = this; - return addThis; -} - - -XMLNode* XMLNode::InsertAfterChild( XMLNode* afterThis, XMLNode* addThis ) -{ - TIXMLASSERT( addThis ); - if ( addThis->_document != _document ) { - TIXMLASSERT( false ); - return 0; - } - - TIXMLASSERT( afterThis ); - - if ( afterThis->_parent != this ) { - TIXMLASSERT( false ); - return 0; - } - if ( afterThis == addThis ) { - // Current state: BeforeThis -> AddThis -> OneAfterAddThis - // Now AddThis must disappear from it's location and then - // reappear between BeforeThis and OneAfterAddThis. - // So just leave it where it is. - return addThis; - } - - if ( afterThis->_next == 0 ) { - // The last node or the only node. - return InsertEndChild( addThis ); - } - InsertChildPreamble( addThis ); - addThis->_prev = afterThis; - addThis->_next = afterThis->_next; - afterThis->_next->_prev = addThis; - afterThis->_next = addThis; - addThis->_parent = this; - return addThis; -} - - - - -const XMLElement* XMLNode::FirstChildElement( const char* name ) const -{ - for( const XMLNode* node = _firstChild; node; node = node->_next ) { - const XMLElement* element = node->ToElementWithName( name ); - if ( element ) { - return element; - } - } - return 0; -} - - -const XMLElement* XMLNode::LastChildElement( const char* name ) const -{ - for( const XMLNode* node = _lastChild; node; node = node->_prev ) { - const XMLElement* element = node->ToElementWithName( name ); - if ( element ) { - return element; - } - } - return 0; -} - - -const XMLElement* XMLNode::NextSiblingElement( const char* name ) const -{ - for( const XMLNode* node = _next; node; node = node->_next ) { - const XMLElement* element = node->ToElementWithName( name ); - if ( element ) { - return element; - } - } - return 0; -} - - -const XMLElement* XMLNode::PreviousSiblingElement( const char* name ) const -{ - for( const XMLNode* node = _prev; node; node = node->_prev ) { - const XMLElement* element = node->ToElementWithName( name ); - if ( element ) { - return element; - } - } - return 0; -} - - -char* XMLNode::ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ) -{ - // This is a recursive method, but thinking about it "at the current level" - // it is a pretty simple flat list: - // - // - // - // With a special case: - // - // - // - // - // Where the closing element (/foo) *must* be the next thing after the opening - // element, and the names must match. BUT the tricky bit is that the closing - // element will be read by the child. - // - // 'endTag' is the end tag for this node, it is returned by a call to a child. - // 'parentEnd' is the end tag for the parent, which is filled in and returned. - - XMLDocument::DepthTracker tracker(_document); - if (_document->Error()) - return 0; - - while( p && *p ) { - XMLNode* node = 0; - - p = _document->Identify( p, &node ); - TIXMLASSERT( p ); - if ( node == 0 ) { - break; - } - - int initialLineNum = node->_parseLineNum; - - StrPair endTag; - p = node->ParseDeep( p, &endTag, curLineNumPtr ); - if ( !p ) { - DeleteNode( node ); - if ( !_document->Error() ) { - _document->SetError( XML_ERROR_PARSING, initialLineNum, 0); - } - break; - } - - XMLDeclaration* decl = node->ToDeclaration(); - if ( decl ) { - // Declarations are only allowed at document level - // - // Multiple declarations are allowed but all declarations - // must occur before anything else. - // - // Optimized due to a security test case. If the first node is - // a declaration, and the last node is a declaration, then only - // declarations have so far been addded. - bool wellLocated = false; - - if (ToDocument()) { - if (FirstChild()) { - wellLocated = - FirstChild() && - FirstChild()->ToDeclaration() && - LastChild() && - LastChild()->ToDeclaration(); - } - else { - wellLocated = true; - } - } - if ( !wellLocated ) { - _document->SetError( XML_ERROR_PARSING_DECLARATION, initialLineNum, "XMLDeclaration value=%s", decl->Value()); - DeleteNode( node ); - break; - } - } - - XMLElement* ele = node->ToElement(); - if ( ele ) { - // We read the end tag. Return it to the parent. - if ( ele->ClosingType() == XMLElement::CLOSING ) { - if ( parentEndTag ) { - ele->_value.TransferTo( parentEndTag ); - } - node->_memPool->SetTracked(); // created and then immediately deleted. - DeleteNode( node ); - return p; - } - - // Handle an end tag returned to this level. - // And handle a bunch of annoying errors. - bool mismatch = false; - if ( endTag.Empty() ) { - if ( ele->ClosingType() == XMLElement::OPEN ) { - mismatch = true; - } - } - else { - if ( ele->ClosingType() != XMLElement::OPEN ) { - mismatch = true; - } - else if ( !XMLUtil::StringEqual( endTag.GetStr(), ele->Name() ) ) { - mismatch = true; - } - } - if ( mismatch ) { - _document->SetError( XML_ERROR_MISMATCHED_ELEMENT, initialLineNum, "XMLElement name=%s", ele->Name()); - DeleteNode( node ); - break; - } - } - InsertEndChild( node ); - } - return 0; -} - -/*static*/ void XMLNode::DeleteNode( XMLNode* node ) -{ - if ( node == 0 ) { - return; - } - TIXMLASSERT(node->_document); - if (!node->ToDocument()) { - node->_document->MarkInUse(node); - } - - MemPool* pool = node->_memPool; - node->~XMLNode(); - pool->Free( node ); -} - -void XMLNode::InsertChildPreamble( XMLNode* insertThis ) const -{ - TIXMLASSERT( insertThis ); - TIXMLASSERT( insertThis->_document == _document ); - - if (insertThis->_parent) { - insertThis->_parent->Unlink( insertThis ); - } - else { - insertThis->_document->MarkInUse(insertThis); - insertThis->_memPool->SetTracked(); - } -} - -const XMLElement* XMLNode::ToElementWithName( const char* name ) const -{ - const XMLElement* element = this->ToElement(); - if ( element == 0 ) { - return 0; - } - if ( name == 0 ) { - return element; - } - if ( XMLUtil::StringEqual( element->Name(), name ) ) { - return element; - } - return 0; -} - -// --------- XMLText ---------- // -char* XMLText::ParseDeep( char* p, StrPair*, int* curLineNumPtr ) -{ - if ( this->CData() ) { - p = _value.ParseText( p, "]]>", StrPair::NEEDS_NEWLINE_NORMALIZATION, curLineNumPtr ); - if ( !p ) { - _document->SetError( XML_ERROR_PARSING_CDATA, _parseLineNum, 0 ); - } - return p; - } - else { - int flags = _document->ProcessEntities() ? StrPair::TEXT_ELEMENT : StrPair::TEXT_ELEMENT_LEAVE_ENTITIES; - if ( _document->WhitespaceMode() == COLLAPSE_WHITESPACE ) { - flags |= StrPair::NEEDS_WHITESPACE_COLLAPSING; - } - - p = _value.ParseText( p, "<", flags, curLineNumPtr ); - if ( p && *p ) { - return p-1; - } - if ( !p ) { - _document->SetError( XML_ERROR_PARSING_TEXT, _parseLineNum, 0 ); - } - } - return 0; -} - - -XMLNode* XMLText::ShallowClone( XMLDocument* doc ) const -{ - if ( !doc ) { - doc = _document; - } - XMLText* text = doc->NewText( Value() ); // fixme: this will always allocate memory. Intern? - text->SetCData( this->CData() ); - return text; -} - - -bool XMLText::ShallowEqual( const XMLNode* compare ) const -{ - TIXMLASSERT( compare ); - const XMLText* text = compare->ToText(); - return ( text && XMLUtil::StringEqual( text->Value(), Value() ) ); -} - - -bool XMLText::Accept( XMLVisitor* visitor ) const -{ - TIXMLASSERT( visitor ); - return visitor->Visit( *this ); -} - - -// --------- XMLComment ---------- // - -XMLComment::XMLComment( XMLDocument* doc ) : XMLNode( doc ) -{ -} - - -XMLComment::~XMLComment() -{ -} - - -char* XMLComment::ParseDeep( char* p, StrPair*, int* curLineNumPtr ) -{ - // Comment parses as text. - p = _value.ParseText( p, "-->", StrPair::COMMENT, curLineNumPtr ); - if ( p == 0 ) { - _document->SetError( XML_ERROR_PARSING_COMMENT, _parseLineNum, 0 ); - } - return p; -} - - -XMLNode* XMLComment::ShallowClone( XMLDocument* doc ) const -{ - if ( !doc ) { - doc = _document; - } - XMLComment* comment = doc->NewComment( Value() ); // fixme: this will always allocate memory. Intern? - return comment; -} - - -bool XMLComment::ShallowEqual( const XMLNode* compare ) const -{ - TIXMLASSERT( compare ); - const XMLComment* comment = compare->ToComment(); - return ( comment && XMLUtil::StringEqual( comment->Value(), Value() )); -} - - -bool XMLComment::Accept( XMLVisitor* visitor ) const -{ - TIXMLASSERT( visitor ); - return visitor->Visit( *this ); -} - - -// --------- XMLDeclaration ---------- // - -XMLDeclaration::XMLDeclaration( XMLDocument* doc ) : XMLNode( doc ) -{ -} - - -XMLDeclaration::~XMLDeclaration() -{ - //printf( "~XMLDeclaration\n" ); -} - - -char* XMLDeclaration::ParseDeep( char* p, StrPair*, int* curLineNumPtr ) -{ - // Declaration parses as text. - p = _value.ParseText( p, "?>", StrPair::NEEDS_NEWLINE_NORMALIZATION, curLineNumPtr ); - if ( p == 0 ) { - _document->SetError( XML_ERROR_PARSING_DECLARATION, _parseLineNum, 0 ); - } - return p; -} - - -XMLNode* XMLDeclaration::ShallowClone( XMLDocument* doc ) const -{ - if ( !doc ) { - doc = _document; - } - XMLDeclaration* dec = doc->NewDeclaration( Value() ); // fixme: this will always allocate memory. Intern? - return dec; -} - - -bool XMLDeclaration::ShallowEqual( const XMLNode* compare ) const -{ - TIXMLASSERT( compare ); - const XMLDeclaration* declaration = compare->ToDeclaration(); - return ( declaration && XMLUtil::StringEqual( declaration->Value(), Value() )); -} - - - -bool XMLDeclaration::Accept( XMLVisitor* visitor ) const -{ - TIXMLASSERT( visitor ); - return visitor->Visit( *this ); -} - -// --------- XMLUnknown ---------- // - -XMLUnknown::XMLUnknown( XMLDocument* doc ) : XMLNode( doc ) -{ -} - - -XMLUnknown::~XMLUnknown() -{ -} - - -char* XMLUnknown::ParseDeep( char* p, StrPair*, int* curLineNumPtr ) -{ - // Unknown parses as text. - p = _value.ParseText( p, ">", StrPair::NEEDS_NEWLINE_NORMALIZATION, curLineNumPtr ); - if ( !p ) { - _document->SetError( XML_ERROR_PARSING_UNKNOWN, _parseLineNum, 0 ); - } - return p; -} - - -XMLNode* XMLUnknown::ShallowClone( XMLDocument* doc ) const -{ - if ( !doc ) { - doc = _document; - } - XMLUnknown* text = doc->NewUnknown( Value() ); // fixme: this will always allocate memory. Intern? - return text; -} - - -bool XMLUnknown::ShallowEqual( const XMLNode* compare ) const -{ - TIXMLASSERT( compare ); - const XMLUnknown* unknown = compare->ToUnknown(); - return ( unknown && XMLUtil::StringEqual( unknown->Value(), Value() )); -} - - -bool XMLUnknown::Accept( XMLVisitor* visitor ) const -{ - TIXMLASSERT( visitor ); - return visitor->Visit( *this ); -} - -// --------- XMLAttribute ---------- // - -const char* XMLAttribute::Name() const -{ - return _name.GetStr(); -} - -const char* XMLAttribute::Value() const -{ - return _value.GetStr(); -} - -char* XMLAttribute::ParseDeep( char* p, bool processEntities, int* curLineNumPtr ) -{ - // Parse using the name rules: bug fix, was using ParseText before - p = _name.ParseName( p ); - if ( !p || !*p ) { - return 0; - } - - // Skip white space before = - p = XMLUtil::SkipWhiteSpace( p, curLineNumPtr ); - if ( *p != '=' ) { - return 0; - } - - ++p; // move up to opening quote - p = XMLUtil::SkipWhiteSpace( p, curLineNumPtr ); - if ( *p != '\"' && *p != '\'' ) { - return 0; - } - - char endTag[2] = { *p, 0 }; - ++p; // move past opening quote - - p = _value.ParseText( p, endTag, processEntities ? StrPair::ATTRIBUTE_VALUE : StrPair::ATTRIBUTE_VALUE_LEAVE_ENTITIES, curLineNumPtr ); - return p; -} - - -void XMLAttribute::SetName( const char* n ) -{ - _name.SetStr( n ); -} - - -XMLError XMLAttribute::QueryIntValue( int* value ) const -{ - if ( XMLUtil::ToInt( Value(), value )) { - return XML_SUCCESS; - } - return XML_WRONG_ATTRIBUTE_TYPE; -} - - -XMLError XMLAttribute::QueryUnsignedValue( unsigned int* value ) const -{ - if ( XMLUtil::ToUnsigned( Value(), value )) { - return XML_SUCCESS; - } - return XML_WRONG_ATTRIBUTE_TYPE; -} - - -XMLError XMLAttribute::QueryInt64Value(int64_t* value) const -{ - if (XMLUtil::ToInt64(Value(), value)) { - return XML_SUCCESS; - } - return XML_WRONG_ATTRIBUTE_TYPE; -} - - -XMLError XMLAttribute::QueryBoolValue( bool* value ) const -{ - if ( XMLUtil::ToBool( Value(), value )) { - return XML_SUCCESS; - } - return XML_WRONG_ATTRIBUTE_TYPE; -} - - -XMLError XMLAttribute::QueryFloatValue( float* value ) const -{ - if ( XMLUtil::ToFloat( Value(), value )) { - return XML_SUCCESS; - } - return XML_WRONG_ATTRIBUTE_TYPE; -} - - -XMLError XMLAttribute::QueryDoubleValue( double* value ) const -{ - if ( XMLUtil::ToDouble( Value(), value )) { - return XML_SUCCESS; - } - return XML_WRONG_ATTRIBUTE_TYPE; -} - - -void XMLAttribute::SetAttribute( const char* v ) -{ - _value.SetStr( v ); -} - - -void XMLAttribute::SetAttribute( int v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - _value.SetStr( buf ); -} - - -void XMLAttribute::SetAttribute( unsigned v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - _value.SetStr( buf ); -} - - -void XMLAttribute::SetAttribute(int64_t v) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr(v, buf, BUF_SIZE); - _value.SetStr(buf); -} - - - -void XMLAttribute::SetAttribute( bool v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - _value.SetStr( buf ); -} - -void XMLAttribute::SetAttribute( double v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - _value.SetStr( buf ); -} - -void XMLAttribute::SetAttribute( float v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - _value.SetStr( buf ); -} - - -// --------- XMLElement ---------- // -XMLElement::XMLElement( XMLDocument* doc ) : XMLNode( doc ), - _closingType( OPEN ), - _rootAttribute( 0 ) -{ -} - - -XMLElement::~XMLElement() -{ - while( _rootAttribute ) { - XMLAttribute* next = _rootAttribute->_next; - DeleteAttribute( _rootAttribute ); - _rootAttribute = next; - } -} - - -const XMLAttribute* XMLElement::FindAttribute( const char* name ) const -{ - for( XMLAttribute* a = _rootAttribute; a; a = a->_next ) { - if ( XMLUtil::StringEqual( a->Name(), name ) ) { - return a; - } - } - return 0; -} - - -const char* XMLElement::Attribute( const char* name, const char* value ) const -{ - const XMLAttribute* a = FindAttribute( name ); - if ( !a ) { - return 0; - } - if ( !value || XMLUtil::StringEqual( a->Value(), value )) { - return a->Value(); - } - return 0; -} - -int XMLElement::IntAttribute(const char* name, int defaultValue) const -{ - int i = defaultValue; - QueryIntAttribute(name, &i); - return i; -} - -unsigned XMLElement::UnsignedAttribute(const char* name, unsigned defaultValue) const -{ - unsigned i = defaultValue; - QueryUnsignedAttribute(name, &i); - return i; -} - -int64_t XMLElement::Int64Attribute(const char* name, int64_t defaultValue) const -{ - int64_t i = defaultValue; - QueryInt64Attribute(name, &i); - return i; -} - -bool XMLElement::BoolAttribute(const char* name, bool defaultValue) const -{ - bool b = defaultValue; - QueryBoolAttribute(name, &b); - return b; -} - -double XMLElement::DoubleAttribute(const char* name, double defaultValue) const -{ - double d = defaultValue; - QueryDoubleAttribute(name, &d); - return d; -} - -float XMLElement::FloatAttribute(const char* name, float defaultValue) const -{ - float f = defaultValue; - QueryFloatAttribute(name, &f); - return f; -} - -const char* XMLElement::GetText() const -{ - if ( FirstChild() && FirstChild()->ToText() ) { - return FirstChild()->Value(); - } - return 0; -} - - -void XMLElement::SetText( const char* inText ) -{ - if ( FirstChild() && FirstChild()->ToText() ) - FirstChild()->SetValue( inText ); - else { - XMLText* theText = GetDocument()->NewText( inText ); - InsertFirstChild( theText ); - } -} - - -void XMLElement::SetText( int v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - SetText( buf ); -} - - -void XMLElement::SetText( unsigned v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - SetText( buf ); -} - - -void XMLElement::SetText(int64_t v) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr(v, buf, BUF_SIZE); - SetText(buf); -} - - -void XMLElement::SetText( bool v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - SetText( buf ); -} - - -void XMLElement::SetText( float v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - SetText( buf ); -} - - -void XMLElement::SetText( double v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - SetText( buf ); -} - - -XMLError XMLElement::QueryIntText( int* ival ) const -{ - if ( FirstChild() && FirstChild()->ToText() ) { - const char* t = FirstChild()->Value(); - if ( XMLUtil::ToInt( t, ival ) ) { - return XML_SUCCESS; - } - return XML_CAN_NOT_CONVERT_TEXT; - } - return XML_NO_TEXT_NODE; -} - - -XMLError XMLElement::QueryUnsignedText( unsigned* uval ) const -{ - if ( FirstChild() && FirstChild()->ToText() ) { - const char* t = FirstChild()->Value(); - if ( XMLUtil::ToUnsigned( t, uval ) ) { - return XML_SUCCESS; - } - return XML_CAN_NOT_CONVERT_TEXT; - } - return XML_NO_TEXT_NODE; -} - - -XMLError XMLElement::QueryInt64Text(int64_t* ival) const -{ - if (FirstChild() && FirstChild()->ToText()) { - const char* t = FirstChild()->Value(); - if (XMLUtil::ToInt64(t, ival)) { - return XML_SUCCESS; - } - return XML_CAN_NOT_CONVERT_TEXT; - } - return XML_NO_TEXT_NODE; -} - - -XMLError XMLElement::QueryBoolText( bool* bval ) const -{ - if ( FirstChild() && FirstChild()->ToText() ) { - const char* t = FirstChild()->Value(); - if ( XMLUtil::ToBool( t, bval ) ) { - return XML_SUCCESS; - } - return XML_CAN_NOT_CONVERT_TEXT; - } - return XML_NO_TEXT_NODE; -} - - -XMLError XMLElement::QueryDoubleText( double* dval ) const -{ - if ( FirstChild() && FirstChild()->ToText() ) { - const char* t = FirstChild()->Value(); - if ( XMLUtil::ToDouble( t, dval ) ) { - return XML_SUCCESS; - } - return XML_CAN_NOT_CONVERT_TEXT; - } - return XML_NO_TEXT_NODE; -} - - -XMLError XMLElement::QueryFloatText( float* fval ) const -{ - if ( FirstChild() && FirstChild()->ToText() ) { - const char* t = FirstChild()->Value(); - if ( XMLUtil::ToFloat( t, fval ) ) { - return XML_SUCCESS; - } - return XML_CAN_NOT_CONVERT_TEXT; - } - return XML_NO_TEXT_NODE; -} - -int XMLElement::IntText(int defaultValue) const -{ - int i = defaultValue; - QueryIntText(&i); - return i; -} - -unsigned XMLElement::UnsignedText(unsigned defaultValue) const -{ - unsigned i = defaultValue; - QueryUnsignedText(&i); - return i; -} - -int64_t XMLElement::Int64Text(int64_t defaultValue) const -{ - int64_t i = defaultValue; - QueryInt64Text(&i); - return i; -} - -bool XMLElement::BoolText(bool defaultValue) const -{ - bool b = defaultValue; - QueryBoolText(&b); - return b; -} - -double XMLElement::DoubleText(double defaultValue) const -{ - double d = defaultValue; - QueryDoubleText(&d); - return d; -} - -float XMLElement::FloatText(float defaultValue) const -{ - float f = defaultValue; - QueryFloatText(&f); - return f; -} - - -XMLAttribute* XMLElement::FindOrCreateAttribute( const char* name ) -{ - XMLAttribute* last = 0; - XMLAttribute* attrib = 0; - for( attrib = _rootAttribute; - attrib; - last = attrib, attrib = attrib->_next ) { - if ( XMLUtil::StringEqual( attrib->Name(), name ) ) { - break; - } - } - if ( !attrib ) { - attrib = CreateAttribute(); - TIXMLASSERT( attrib ); - if ( last ) { - TIXMLASSERT( last->_next == 0 ); - last->_next = attrib; - } - else { - TIXMLASSERT( _rootAttribute == 0 ); - _rootAttribute = attrib; - } - attrib->SetName( name ); - } - return attrib; -} - - -void XMLElement::DeleteAttribute( const char* name ) -{ - XMLAttribute* prev = 0; - for( XMLAttribute* a=_rootAttribute; a; a=a->_next ) { - if ( XMLUtil::StringEqual( name, a->Name() ) ) { - if ( prev ) { - prev->_next = a->_next; - } - else { - _rootAttribute = a->_next; - } - DeleteAttribute( a ); - break; - } - prev = a; - } -} - - -char* XMLElement::ParseAttributes( char* p, int* curLineNumPtr ) -{ - XMLAttribute* prevAttribute = 0; - - // Read the attributes. - while( p ) { - p = XMLUtil::SkipWhiteSpace( p, curLineNumPtr ); - if ( !(*p) ) { - _document->SetError( XML_ERROR_PARSING_ELEMENT, _parseLineNum, "XMLElement name=%s", Name() ); - return 0; - } - - // attribute. - if (XMLUtil::IsNameStartChar( *p ) ) { - XMLAttribute* attrib = CreateAttribute(); - TIXMLASSERT( attrib ); - attrib->_parseLineNum = _document->_parseCurLineNum; - - int attrLineNum = attrib->_parseLineNum; - - p = attrib->ParseDeep( p, _document->ProcessEntities(), curLineNumPtr ); - if ( !p || Attribute( attrib->Name() ) ) { - DeleteAttribute( attrib ); - _document->SetError( XML_ERROR_PARSING_ATTRIBUTE, attrLineNum, "XMLElement name=%s", Name() ); - return 0; - } - // There is a minor bug here: if the attribute in the source xml - // document is duplicated, it will not be detected and the - // attribute will be doubly added. However, tracking the 'prevAttribute' - // avoids re-scanning the attribute list. Preferring performance for - // now, may reconsider in the future. - if ( prevAttribute ) { - TIXMLASSERT( prevAttribute->_next == 0 ); - prevAttribute->_next = attrib; - } - else { - TIXMLASSERT( _rootAttribute == 0 ); - _rootAttribute = attrib; - } - prevAttribute = attrib; - } - // end of the tag - else if ( *p == '>' ) { - ++p; - break; - } - // end of the tag - else if ( *p == '/' && *(p+1) == '>' ) { - _closingType = CLOSED; - return p+2; // done; sealed element. - } - else { - _document->SetError( XML_ERROR_PARSING_ELEMENT, _parseLineNum, 0 ); - return 0; - } - } - return p; -} - -void XMLElement::DeleteAttribute( XMLAttribute* attribute ) -{ - if ( attribute == 0 ) { - return; - } - MemPool* pool = attribute->_memPool; - attribute->~XMLAttribute(); - pool->Free( attribute ); -} - -XMLAttribute* XMLElement::CreateAttribute() -{ - TIXMLASSERT( sizeof( XMLAttribute ) == _document->_attributePool.ItemSize() ); - XMLAttribute* attrib = new (_document->_attributePool.Alloc() ) XMLAttribute(); - TIXMLASSERT( attrib ); - attrib->_memPool = &_document->_attributePool; - attrib->_memPool->SetTracked(); - return attrib; -} - -// -// -// foobar -// -char* XMLElement::ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ) -{ - // Read the element name. - p = XMLUtil::SkipWhiteSpace( p, curLineNumPtr ); - - // The closing element is the form. It is - // parsed just like a regular element then deleted from - // the DOM. - if ( *p == '/' ) { - _closingType = CLOSING; - ++p; - } - - p = _value.ParseName( p ); - if ( _value.Empty() ) { - return 0; - } - - p = ParseAttributes( p, curLineNumPtr ); - if ( !p || !*p || _closingType != OPEN ) { - return p; - } - - p = XMLNode::ParseDeep( p, parentEndTag, curLineNumPtr ); - return p; -} - - - -XMLNode* XMLElement::ShallowClone( XMLDocument* doc ) const -{ - if ( !doc ) { - doc = _document; - } - XMLElement* element = doc->NewElement( Value() ); // fixme: this will always allocate memory. Intern? - for( const XMLAttribute* a=FirstAttribute(); a; a=a->Next() ) { - element->SetAttribute( a->Name(), a->Value() ); // fixme: this will always allocate memory. Intern? - } - return element; -} - - -bool XMLElement::ShallowEqual( const XMLNode* compare ) const -{ - TIXMLASSERT( compare ); - const XMLElement* other = compare->ToElement(); - if ( other && XMLUtil::StringEqual( other->Name(), Name() )) { - - const XMLAttribute* a=FirstAttribute(); - const XMLAttribute* b=other->FirstAttribute(); - - while ( a && b ) { - if ( !XMLUtil::StringEqual( a->Value(), b->Value() ) ) { - return false; - } - a = a->Next(); - b = b->Next(); - } - if ( a || b ) { - // different count - return false; - } - return true; - } - return false; -} - - -bool XMLElement::Accept( XMLVisitor* visitor ) const -{ - TIXMLASSERT( visitor ); - if ( visitor->VisitEnter( *this, _rootAttribute ) ) { - for ( const XMLNode* node=FirstChild(); node; node=node->NextSibling() ) { - if ( !node->Accept( visitor ) ) { - break; - } - } - } - return visitor->VisitExit( *this ); -} - - -// --------- XMLDocument ----------- // - -// Warning: List must match 'enum XMLError' -const char* XMLDocument::_errorNames[XML_ERROR_COUNT] = { - "XML_SUCCESS", - "XML_NO_ATTRIBUTE", - "XML_WRONG_ATTRIBUTE_TYPE", - "XML_ERROR_FILE_NOT_FOUND", - "XML_ERROR_FILE_COULD_NOT_BE_OPENED", - "XML_ERROR_FILE_READ_ERROR", - "XML_ERROR_PARSING_ELEMENT", - "XML_ERROR_PARSING_ATTRIBUTE", - "XML_ERROR_PARSING_TEXT", - "XML_ERROR_PARSING_CDATA", - "XML_ERROR_PARSING_COMMENT", - "XML_ERROR_PARSING_DECLARATION", - "XML_ERROR_PARSING_UNKNOWN", - "XML_ERROR_EMPTY_DOCUMENT", - "XML_ERROR_MISMATCHED_ELEMENT", - "XML_ERROR_PARSING", - "XML_CAN_NOT_CONVERT_TEXT", - "XML_NO_TEXT_NODE", - "XML_ELEMENT_DEPTH_EXCEEDED" -}; - - -XMLDocument::XMLDocument( bool processEntities, Whitespace whitespaceMode ) : - XMLNode( 0 ), - _writeBOM( false ), - _processEntities( processEntities ), - _errorID(XML_SUCCESS), - _whitespaceMode( whitespaceMode ), - _errorStr(), - _errorLineNum( 0 ), - _charBuffer( 0 ), - _parseCurLineNum( 0 ), - _parsingDepth(0), - _unlinked(), - _elementPool(), - _attributePool(), - _textPool(), - _commentPool() -{ - // avoid VC++ C4355 warning about 'this' in initializer list (C4355 is off by default in VS2012+) - _document = this; -} - - -XMLDocument::~XMLDocument() -{ - Clear(); -} - - -void XMLDocument::MarkInUse(XMLNode* node) -{ - TIXMLASSERT(node); - TIXMLASSERT(node->_parent == 0); - - for (int i = 0; i < _unlinked.Size(); ++i) { - if (node == _unlinked[i]) { - _unlinked.SwapRemove(i); - break; - } - } -} - -void XMLDocument::Clear() -{ - DeleteChildren(); - while( _unlinked.Size()) { - DeleteNode(_unlinked[0]); // Will remove from _unlinked as part of delete. - } - -#ifdef TINYXML2_DEBUG - const bool hadError = Error(); -#endif - ClearError(); - - delete [] _charBuffer; - _charBuffer = 0; - _parsingDepth = 0; - -#if 0 - _textPool.Trace( "text" ); - _elementPool.Trace( "element" ); - _commentPool.Trace( "comment" ); - _attributePool.Trace( "attribute" ); -#endif - -#ifdef TINYXML2_DEBUG - if ( !hadError ) { - TIXMLASSERT( _elementPool.CurrentAllocs() == _elementPool.Untracked() ); - TIXMLASSERT( _attributePool.CurrentAllocs() == _attributePool.Untracked() ); - TIXMLASSERT( _textPool.CurrentAllocs() == _textPool.Untracked() ); - TIXMLASSERT( _commentPool.CurrentAllocs() == _commentPool.Untracked() ); - } -#endif -} - - -void XMLDocument::DeepCopy(XMLDocument* target) const -{ - TIXMLASSERT(target); - if (target == this) { - return; // technically success - a no-op. - } - - target->Clear(); - for (const XMLNode* node = this->FirstChild(); node; node = node->NextSibling()) { - target->InsertEndChild(node->DeepClone(target)); - } -} - -XMLElement* XMLDocument::NewElement( const char* name ) -{ - XMLElement* ele = CreateUnlinkedNode( _elementPool ); - ele->SetName( name ); - return ele; -} - - -XMLComment* XMLDocument::NewComment( const char* str ) -{ - XMLComment* comment = CreateUnlinkedNode( _commentPool ); - comment->SetValue( str ); - return comment; -} - - -XMLText* XMLDocument::NewText( const char* str ) -{ - XMLText* text = CreateUnlinkedNode( _textPool ); - text->SetValue( str ); - return text; -} - - -XMLDeclaration* XMLDocument::NewDeclaration( const char* str ) -{ - XMLDeclaration* dec = CreateUnlinkedNode( _commentPool ); - dec->SetValue( str ? str : "xml version=\"1.0\" encoding=\"UTF-8\"" ); - return dec; -} - - -XMLUnknown* XMLDocument::NewUnknown( const char* str ) -{ - XMLUnknown* unk = CreateUnlinkedNode( _commentPool ); - unk->SetValue( str ); - return unk; -} - -static FILE* callfopen( const char* filepath, const char* mode ) -{ - TIXMLASSERT( filepath ); - TIXMLASSERT( mode ); -#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) && (!defined WINCE) - FILE* fp = 0; - errno_t err = fopen_s( &fp, filepath, mode ); - if ( err ) { - return 0; - } -#else - FILE* fp = fopen( filepath, mode ); -#endif - return fp; -} - -void XMLDocument::DeleteNode( XMLNode* node ) { - TIXMLASSERT( node ); - TIXMLASSERT(node->_document == this ); - if (node->_parent) { - node->_parent->DeleteChild( node ); - } - else { - // Isn't in the tree. - // Use the parent delete. - // Also, we need to mark it tracked: we 'know' - // it was never used. - node->_memPool->SetTracked(); - // Call the static XMLNode version: - XMLNode::DeleteNode(node); - } -} - - -XMLError XMLDocument::LoadFile( const char* filename ) -{ - if ( !filename ) { - TIXMLASSERT( false ); - SetError( XML_ERROR_FILE_COULD_NOT_BE_OPENED, 0, "filename=" ); - return _errorID; - } - - Clear(); - FILE* fp = callfopen( filename, "rb" ); - if ( !fp ) { - SetError( XML_ERROR_FILE_NOT_FOUND, 0, "filename=%s", filename ); - return _errorID; - } - LoadFile( fp ); - fclose( fp ); - return _errorID; -} - -// This is likely overengineered template art to have a check that unsigned long value incremented -// by one still fits into size_t. If size_t type is larger than unsigned long type -// (x86_64-w64-mingw32 target) then the check is redundant and gcc and clang emit -// -Wtype-limits warning. This piece makes the compiler select code with a check when a check -// is useful and code with no check when a check is redundant depending on how size_t and unsigned long -// types sizes relate to each other. -template -= sizeof(size_t))> -struct LongFitsIntoSizeTMinusOne { - static bool Fits( unsigned long value ) - { - return value < (size_t)-1; - } -}; - -template <> -struct LongFitsIntoSizeTMinusOne { - static bool Fits( unsigned long ) - { - return true; - } -}; - -XMLError XMLDocument::LoadFile( FILE* fp ) -{ - Clear(); - - fseek( fp, 0, SEEK_SET ); - if ( fgetc( fp ) == EOF && ferror( fp ) != 0 ) { - SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 ); - return _errorID; - } - - fseek( fp, 0, SEEK_END ); - const long filelength = ftell( fp ); - fseek( fp, 0, SEEK_SET ); - if ( filelength == -1L ) { - SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 ); - return _errorID; - } - TIXMLASSERT( filelength >= 0 ); - - if ( !LongFitsIntoSizeTMinusOne<>::Fits( filelength ) ) { - // Cannot handle files which won't fit in buffer together with null terminator - SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 ); - return _errorID; - } - - if ( filelength == 0 ) { - SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 ); - return _errorID; - } - - const size_t size = filelength; - TIXMLASSERT( _charBuffer == 0 ); - _charBuffer = new char[size+1]; - size_t read = fread( _charBuffer, 1, size, fp ); - if ( read != size ) { - SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 ); - return _errorID; - } - - _charBuffer[size] = 0; - - Parse(); - return _errorID; -} - - -XMLError XMLDocument::SaveFile( const char* filename, bool compact ) -{ - if ( !filename ) { - TIXMLASSERT( false ); - SetError( XML_ERROR_FILE_COULD_NOT_BE_OPENED, 0, "filename=" ); - return _errorID; - } - - FILE* fp = callfopen( filename, "w" ); - if ( !fp ) { - SetError( XML_ERROR_FILE_COULD_NOT_BE_OPENED, 0, "filename=%s", filename ); - return _errorID; - } - SaveFile(fp, compact); - fclose( fp ); - return _errorID; -} - - -XMLError XMLDocument::SaveFile( FILE* fp, bool compact ) -{ - // Clear any error from the last save, otherwise it will get reported - // for *this* call. - ClearError(); - XMLPrinter stream( fp, compact ); - Print( &stream ); - return _errorID; -} - - -XMLError XMLDocument::Parse( const char* p, size_t len ) -{ - Clear(); - - if ( len == 0 || !p || !*p ) { - SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 ); - return _errorID; - } - if ( len == (size_t)(-1) ) { - len = strlen( p ); - } - TIXMLASSERT( _charBuffer == 0 ); - _charBuffer = new char[ len+1 ]; - memcpy( _charBuffer, p, len ); - _charBuffer[len] = 0; - - Parse(); - if ( Error() ) { - // clean up now essentially dangling memory. - // and the parse fail can put objects in the - // pools that are dead and inaccessible. - DeleteChildren(); - _elementPool.Clear(); - _attributePool.Clear(); - _textPool.Clear(); - _commentPool.Clear(); - } - return _errorID; -} - - -void XMLDocument::Print( XMLPrinter* streamer ) const -{ - if ( streamer ) { - Accept( streamer ); - } - else { - XMLPrinter stdoutStreamer( stdout ); - Accept( &stdoutStreamer ); - } -} - - -void XMLDocument::SetError( XMLError error, int lineNum, const char* format, ... ) -{ - TIXMLASSERT( error >= 0 && error < XML_ERROR_COUNT ); - _errorID = error; - _errorLineNum = lineNum; - _errorStr.Reset(); - - size_t BUFFER_SIZE = 1000; - char* buffer = new char[BUFFER_SIZE]; - - TIXMLASSERT(sizeof(error) <= sizeof(int)); - TIXML_SNPRINTF(buffer, BUFFER_SIZE, "Error=%s ErrorID=%d (0x%x) Line number=%d", ErrorIDToName(error), int(error), int(error), lineNum); - - if (format) { - size_t len = strlen(buffer); - TIXML_SNPRINTF(buffer + len, BUFFER_SIZE - len, ": "); - len = strlen(buffer); - - va_list va; - va_start(va, format); - TIXML_VSNPRINTF(buffer + len, BUFFER_SIZE - len, format, va); - va_end(va); - } - _errorStr.SetStr(buffer); - delete[] buffer; -} - - -/*static*/ const char* XMLDocument::ErrorIDToName(XMLError errorID) -{ - TIXMLASSERT( errorID >= 0 && errorID < XML_ERROR_COUNT ); - const char* errorName = _errorNames[errorID]; - TIXMLASSERT( errorName && errorName[0] ); - return errorName; -} - -const char* XMLDocument::ErrorStr() const -{ - return _errorStr.Empty() ? "" : _errorStr.GetStr(); -} - - -void XMLDocument::PrintError() const -{ - printf("%s\n", ErrorStr()); -} - -const char* XMLDocument::ErrorName() const -{ - return ErrorIDToName(_errorID); -} - -void XMLDocument::Parse() -{ - TIXMLASSERT( NoChildren() ); // Clear() must have been called previously - TIXMLASSERT( _charBuffer ); - _parseCurLineNum = 1; - _parseLineNum = 1; - char* p = _charBuffer; - p = XMLUtil::SkipWhiteSpace( p, &_parseCurLineNum ); - p = const_cast( XMLUtil::ReadBOM( p, &_writeBOM ) ); - if ( !*p ) { - SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 ); - return; - } - ParseDeep(p, 0, &_parseCurLineNum ); -} - -void XMLDocument::PushDepth() -{ - _parsingDepth++; - if (_parsingDepth == TINYXML2_MAX_ELEMENT_DEPTH) { - SetError(XML_ELEMENT_DEPTH_EXCEEDED, _parseCurLineNum, "Element nesting is too deep." ); - } -} - -void XMLDocument::PopDepth() -{ - TIXMLASSERT(_parsingDepth > 0); - --_parsingDepth; -} - -XMLPrinter::XMLPrinter( FILE* file, bool compact, int depth ) : - _elementJustOpened( false ), - _stack(), - _firstElement( true ), - _fp( file ), - _depth( depth ), - _textDepth( -1 ), - _processEntities( true ), - _compactMode( compact ), - _buffer() -{ - for( int i=0; i'] = true; // not required, but consistency is nice - _buffer.Push( 0 ); -} - - -void XMLPrinter::Print( const char* format, ... ) -{ - va_list va; - va_start( va, format ); - - if ( _fp ) { - vfprintf( _fp, format, va ); - } - else { - const int len = TIXML_VSCPRINTF( format, va ); - // Close out and re-start the va-args - va_end( va ); - TIXMLASSERT( len >= 0 ); - va_start( va, format ); - TIXMLASSERT( _buffer.Size() > 0 && _buffer[_buffer.Size() - 1] == 0 ); - char* p = _buffer.PushArr( len ) - 1; // back up over the null terminator. - TIXML_VSNPRINTF( p, len+1, format, va ); - } - va_end( va ); -} - - -void XMLPrinter::Write( const char* data, size_t size ) -{ - if ( _fp ) { - fwrite ( data , sizeof(char), size, _fp); - } - else { - char* p = _buffer.PushArr( static_cast(size) ) - 1; // back up over the null terminator. - memcpy( p, data, size ); - p[size] = 0; - } -} - - -void XMLPrinter::Putc( char ch ) -{ - if ( _fp ) { - fputc ( ch, _fp); - } - else { - char* p = _buffer.PushArr( sizeof(char) ) - 1; // back up over the null terminator. - p[0] = ch; - p[1] = 0; - } -} - - -void XMLPrinter::PrintSpace( int depth ) -{ - for( int i=0; i 0 && *q < ENTITY_RANGE ) { - // Check for entities. If one is found, flush - // the stream up until the entity, write the - // entity, and keep looking. - if ( flag[(unsigned char)(*q)] ) { - while ( p < q ) { - const size_t delta = q - p; - const int toPrint = ( INT_MAX < delta ) ? INT_MAX : (int)delta; - Write( p, toPrint ); - p += toPrint; - } - bool entityPatternPrinted = false; - for( int i=0; i( bom ) ); - } - if ( writeDec ) { - PushDeclaration( "xml version=\"1.0\"" ); - } -} - - -void XMLPrinter::OpenElement( const char* name, bool compactMode ) -{ - SealElementIfJustOpened(); - _stack.Push( name ); - - if ( _textDepth < 0 && !_firstElement && !compactMode ) { - Putc( '\n' ); - } - if ( !compactMode ) { - PrintSpace( _depth ); - } - - Write ( "<" ); - Write ( name ); - - _elementJustOpened = true; - _firstElement = false; - ++_depth; -} - - -void XMLPrinter::PushAttribute( const char* name, const char* value ) -{ - TIXMLASSERT( _elementJustOpened ); - Putc ( ' ' ); - Write( name ); - Write( "=\"" ); - PrintString( value, false ); - Putc ( '\"' ); -} - - -void XMLPrinter::PushAttribute( const char* name, int v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - PushAttribute( name, buf ); -} - - -void XMLPrinter::PushAttribute( const char* name, unsigned v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - PushAttribute( name, buf ); -} - - -void XMLPrinter::PushAttribute(const char* name, int64_t v) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr(v, buf, BUF_SIZE); - PushAttribute(name, buf); -} - - -void XMLPrinter::PushAttribute( const char* name, bool v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - PushAttribute( name, buf ); -} - - -void XMLPrinter::PushAttribute( const char* name, double v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - PushAttribute( name, buf ); -} - - -void XMLPrinter::CloseElement( bool compactMode ) -{ - --_depth; - const char* name = _stack.Pop(); - - if ( _elementJustOpened ) { - Write( "/>" ); - } - else { - if ( _textDepth < 0 && !compactMode) { - Putc( '\n' ); - PrintSpace( _depth ); - } - Write ( "" ); - } - - if ( _textDepth == _depth ) { - _textDepth = -1; - } - if ( _depth == 0 && !compactMode) { - Putc( '\n' ); - } - _elementJustOpened = false; -} - - -void XMLPrinter::SealElementIfJustOpened() -{ - if ( !_elementJustOpened ) { - return; - } - _elementJustOpened = false; - Putc( '>' ); -} - - -void XMLPrinter::PushText( const char* text, bool cdata ) -{ - _textDepth = _depth-1; - - SealElementIfJustOpened(); - if ( cdata ) { - Write( "" ); - } - else { - PrintString( text, true ); - } -} - -void XMLPrinter::PushText( int64_t value ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( value, buf, BUF_SIZE ); - PushText( buf, false ); -} - -void XMLPrinter::PushText( int value ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( value, buf, BUF_SIZE ); - PushText( buf, false ); -} - - -void XMLPrinter::PushText( unsigned value ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( value, buf, BUF_SIZE ); - PushText( buf, false ); -} - - -void XMLPrinter::PushText( bool value ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( value, buf, BUF_SIZE ); - PushText( buf, false ); -} - - -void XMLPrinter::PushText( float value ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( value, buf, BUF_SIZE ); - PushText( buf, false ); -} - - -void XMLPrinter::PushText( double value ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( value, buf, BUF_SIZE ); - PushText( buf, false ); -} - - -void XMLPrinter::PushComment( const char* comment ) -{ - SealElementIfJustOpened(); - if ( _textDepth < 0 && !_firstElement && !_compactMode) { - Putc( '\n' ); - PrintSpace( _depth ); - } - _firstElement = false; - - Write( "" ); -} - - -void XMLPrinter::PushDeclaration( const char* value ) -{ - SealElementIfJustOpened(); - if ( _textDepth < 0 && !_firstElement && !_compactMode) { - Putc( '\n' ); - PrintSpace( _depth ); - } - _firstElement = false; - - Write( "" ); -} - - -void XMLPrinter::PushUnknown( const char* value ) -{ - SealElementIfJustOpened(); - if ( _textDepth < 0 && !_firstElement && !_compactMode) { - Putc( '\n' ); - PrintSpace( _depth ); - } - _firstElement = false; - - Write( "' ); -} - - -bool XMLPrinter::VisitEnter( const XMLDocument& doc ) -{ - _processEntities = doc.ProcessEntities(); - if ( doc.HasBOM() ) { - PushHeader( true, false ); - } - return true; -} - - -bool XMLPrinter::VisitEnter( const XMLElement& element, const XMLAttribute* attribute ) -{ - const XMLElement* parentElem = 0; - if ( element.Parent() ) { - parentElem = element.Parent()->ToElement(); - } - const bool compactMode = parentElem ? CompactMode( *parentElem ) : _compactMode; - OpenElement( element.Name(), compactMode ); - while ( attribute ) { - PushAttribute( attribute->Name(), attribute->Value() ); - attribute = attribute->Next(); - } - return true; -} - - -bool XMLPrinter::VisitExit( const XMLElement& element ) -{ - CloseElement( CompactMode(element) ); - return true; -} - - -bool XMLPrinter::Visit( const XMLText& text ) -{ - PushText( text.Value(), text.CData() ); - return true; -} - - -bool XMLPrinter::Visit( const XMLComment& comment ) -{ - PushComment( comment.Value() ); - return true; -} - -bool XMLPrinter::Visit( const XMLDeclaration& declaration ) -{ - PushDeclaration( declaration.Value() ); - return true; -} - - -bool XMLPrinter::Visit( const XMLUnknown& unknown ) -{ - PushUnknown( unknown.Value() ); - return true; -} - -} // namespace tinyxml2 diff --git a/tools/ZAPD/lib/tinyxml2/tinyxml2.h b/tools/ZAPD/lib/tinyxml2/tinyxml2.h deleted file mode 100644 index 7cd3127363..0000000000 --- a/tools/ZAPD/lib/tinyxml2/tinyxml2.h +++ /dev/null @@ -1,2309 +0,0 @@ -/* -Original code by Lee Thomason (www.grinninglizard.com) - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - -#ifndef TINYXML2_INCLUDED -#define TINYXML2_INCLUDED - -#if defined(ANDROID_NDK) || defined(__BORLANDC__) || defined(__QNXNTO__) -# include -# include -# include -# include -# include -# if defined(__PS3__) -# include -# endif -#else -# include -# include -# include -# include -# include -#endif -#include - -/* - TODO: intern strings instead of allocation. -*/ -/* - gcc: - g++ -Wall -DTINYXML2_DEBUG tinyxml2.cpp xmltest.cpp -o gccxmltest.exe - - Formatting, Artistic Style: - AStyle.exe --style=1tbs --indent-switches --break-closing-brackets --indent-preprocessor tinyxml2.cpp tinyxml2.h -*/ - -#if defined( _DEBUG ) || defined (__DEBUG__) -# ifndef TINYXML2_DEBUG -# define TINYXML2_DEBUG -# endif -#endif - -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable: 4251) -#endif - -#ifdef _WIN32 -# ifdef TINYXML2_EXPORT -# define TINYXML2_LIB __declspec(dllexport) -# elif defined(TINYXML2_IMPORT) -# define TINYXML2_LIB __declspec(dllimport) -# else -# define TINYXML2_LIB -# endif -#elif __GNUC__ >= 4 -# define TINYXML2_LIB __attribute__((visibility("default"))) -#else -# define TINYXML2_LIB -#endif - - -#if defined(TINYXML2_DEBUG) -# if defined(_MSC_VER) -# // "(void)0," is for suppressing C4127 warning in "assert(false)", "assert(true)" and the like -# define TIXMLASSERT( x ) if ( !((void)0,(x))) { __debugbreak(); } -# elif defined (ANDROID_NDK) -# include -# define TIXMLASSERT( x ) if ( !(x)) { __android_log_assert( "assert", "grinliz", "ASSERT in '%s' at %d.", __FILE__, __LINE__ ); } -# else -# include -# define TIXMLASSERT assert -# endif -#else -# define TIXMLASSERT( x ) {} -#endif - - -/* Versioning, past 1.0.14: - http://semver.org/ -*/ -static const int TIXML2_MAJOR_VERSION = 7; -static const int TIXML2_MINOR_VERSION = 0; -static const int TIXML2_PATCH_VERSION = 1; - -#define TINYXML2_MAJOR_VERSION 7 -#define TINYXML2_MINOR_VERSION 0 -#define TINYXML2_PATCH_VERSION 1 - -// A fixed element depth limit is problematic. There needs to be a -// limit to avoid a stack overflow. However, that limit varies per -// system, and the capacity of the stack. On the other hand, it's a trivial -// attack that can result from ill, malicious, or even correctly formed XML, -// so there needs to be a limit in place. -static const int TINYXML2_MAX_ELEMENT_DEPTH = 100; - -namespace tinyxml2 -{ -class XMLDocument; -class XMLElement; -class XMLAttribute; -class XMLComment; -class XMLText; -class XMLDeclaration; -class XMLUnknown; -class XMLPrinter; - -/* - A class that wraps strings. Normally stores the start and end - pointers into the XML file itself, and will apply normalization - and entity translation if actually read. Can also store (and memory - manage) a traditional char[] - - Isn't clear why TINYXML2_LIB is needed; but seems to fix #719 -*/ -class TINYXML2_LIB StrPair -{ -public: - enum { - NEEDS_ENTITY_PROCESSING = 0x01, - NEEDS_NEWLINE_NORMALIZATION = 0x02, - NEEDS_WHITESPACE_COLLAPSING = 0x04, - - TEXT_ELEMENT = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION, - TEXT_ELEMENT_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION, - ATTRIBUTE_NAME = 0, - ATTRIBUTE_VALUE = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION, - ATTRIBUTE_VALUE_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION, - COMMENT = NEEDS_NEWLINE_NORMALIZATION - }; - - StrPair() : _flags( 0 ), _start( 0 ), _end( 0 ) {} - ~StrPair(); - - void Set( char* start, char* end, int flags ) { - TIXMLASSERT( start ); - TIXMLASSERT( end ); - Reset(); - _start = start; - _end = end; - _flags = flags | NEEDS_FLUSH; - } - - const char* GetStr(); - - bool Empty() const { - return _start == _end; - } - - void SetInternedStr( const char* str ) { - Reset(); - _start = const_cast(str); - } - - void SetStr( const char* str, int flags=0 ); - - char* ParseText( char* in, const char* endTag, int strFlags, int* curLineNumPtr ); - char* ParseName( char* in ); - - void TransferTo( StrPair* other ); - void Reset(); - -private: - void CollapseWhitespace(); - - enum { - NEEDS_FLUSH = 0x100, - NEEDS_DELETE = 0x200 - }; - - int _flags; - char* _start; - char* _end; - - StrPair( const StrPair& other ); // not supported - void operator=( const StrPair& other ); // not supported, use TransferTo() -}; - - -/* - A dynamic array of Plain Old Data. Doesn't support constructors, etc. - Has a small initial memory pool, so that low or no usage will not - cause a call to new/delete -*/ -template -class DynArray -{ -public: - DynArray() : - _mem( _pool ), - _allocated( INITIAL_SIZE ), - _size( 0 ) - { - } - - ~DynArray() { - if ( _mem != _pool ) { - delete [] _mem; - } - } - - void Clear() { - _size = 0; - } - - void Push( T t ) { - TIXMLASSERT( _size < INT_MAX ); - EnsureCapacity( _size+1 ); - _mem[_size] = t; - ++_size; - } - - T* PushArr( int count ) { - TIXMLASSERT( count >= 0 ); - TIXMLASSERT( _size <= INT_MAX - count ); - EnsureCapacity( _size+count ); - T* ret = &_mem[_size]; - _size += count; - return ret; - } - - T Pop() { - TIXMLASSERT( _size > 0 ); - --_size; - return _mem[_size]; - } - - void PopArr( int count ) { - TIXMLASSERT( _size >= count ); - _size -= count; - } - - bool Empty() const { - return _size == 0; - } - - T& operator[](int i) { - TIXMLASSERT( i>= 0 && i < _size ); - return _mem[i]; - } - - const T& operator[](int i) const { - TIXMLASSERT( i>= 0 && i < _size ); - return _mem[i]; - } - - const T& PeekTop() const { - TIXMLASSERT( _size > 0 ); - return _mem[ _size - 1]; - } - - int Size() const { - TIXMLASSERT( _size >= 0 ); - return _size; - } - - int Capacity() const { - TIXMLASSERT( _allocated >= INITIAL_SIZE ); - return _allocated; - } - - void SwapRemove(int i) { - TIXMLASSERT(i >= 0 && i < _size); - TIXMLASSERT(_size > 0); - _mem[i] = _mem[_size - 1]; - --_size; - } - - const T* Mem() const { - TIXMLASSERT( _mem ); - return _mem; - } - - T* Mem() { - TIXMLASSERT( _mem ); - return _mem; - } - -private: - DynArray( const DynArray& ); // not supported - void operator=( const DynArray& ); // not supported - - void EnsureCapacity( int cap ) { - TIXMLASSERT( cap > 0 ); - if ( cap > _allocated ) { - TIXMLASSERT( cap <= INT_MAX / 2 ); - int newAllocated = cap * 2; - T* newMem = new T[newAllocated]; - TIXMLASSERT( newAllocated >= _size ); - memcpy( newMem, _mem, sizeof(T)*_size ); // warning: not using constructors, only works for PODs - if ( _mem != _pool ) { - delete [] _mem; - } - _mem = newMem; - _allocated = newAllocated; - } - } - - T* _mem; - T _pool[INITIAL_SIZE]; - int _allocated; // objects allocated - int _size; // number objects in use -}; - - -/* - Parent virtual class of a pool for fast allocation - and deallocation of objects. -*/ -class MemPool -{ -public: - MemPool() {} - virtual ~MemPool() {} - - virtual int ItemSize() const = 0; - virtual void* Alloc() = 0; - virtual void Free( void* ) = 0; - virtual void SetTracked() = 0; -}; - - -/* - Template child class to create pools of the correct type. -*/ -template< int ITEM_SIZE > -class MemPoolT : public MemPool -{ -public: - MemPoolT() : _blockPtrs(), _root(0), _currentAllocs(0), _nAllocs(0), _maxAllocs(0), _nUntracked(0) {} - ~MemPoolT() { - MemPoolT< ITEM_SIZE >::Clear(); - } - - void Clear() { - // Delete the blocks. - while( !_blockPtrs.Empty()) { - Block* lastBlock = _blockPtrs.Pop(); - delete lastBlock; - } - _root = 0; - _currentAllocs = 0; - _nAllocs = 0; - _maxAllocs = 0; - _nUntracked = 0; - } - - virtual int ItemSize() const { - return ITEM_SIZE; - } - int CurrentAllocs() const { - return _currentAllocs; - } - - virtual void* Alloc() { - if ( !_root ) { - // Need a new block. - Block* block = new Block(); - _blockPtrs.Push( block ); - - Item* blockItems = block->items; - for( int i = 0; i < ITEMS_PER_BLOCK - 1; ++i ) { - blockItems[i].next = &(blockItems[i + 1]); - } - blockItems[ITEMS_PER_BLOCK - 1].next = 0; - _root = blockItems; - } - Item* const result = _root; - TIXMLASSERT( result != 0 ); - _root = _root->next; - - ++_currentAllocs; - if ( _currentAllocs > _maxAllocs ) { - _maxAllocs = _currentAllocs; - } - ++_nAllocs; - ++_nUntracked; - return result; - } - - virtual void Free( void* mem ) { - if ( !mem ) { - return; - } - --_currentAllocs; - Item* item = static_cast( mem ); -#ifdef TINYXML2_DEBUG - memset( item, 0xfe, sizeof( *item ) ); -#endif - item->next = _root; - _root = item; - } - void Trace( const char* name ) { - printf( "Mempool %s watermark=%d [%dk] current=%d size=%d nAlloc=%d blocks=%d\n", - name, _maxAllocs, _maxAllocs * ITEM_SIZE / 1024, _currentAllocs, - ITEM_SIZE, _nAllocs, _blockPtrs.Size() ); - } - - void SetTracked() { - --_nUntracked; - } - - int Untracked() const { - return _nUntracked; - } - - // This number is perf sensitive. 4k seems like a good tradeoff on my machine. - // The test file is large, 170k. - // Release: VS2010 gcc(no opt) - // 1k: 4000 - // 2k: 4000 - // 4k: 3900 21000 - // 16k: 5200 - // 32k: 4300 - // 64k: 4000 21000 - // Declared public because some compilers do not accept to use ITEMS_PER_BLOCK - // in private part if ITEMS_PER_BLOCK is private - enum { ITEMS_PER_BLOCK = (4 * 1024) / ITEM_SIZE }; - -private: - MemPoolT( const MemPoolT& ); // not supported - void operator=( const MemPoolT& ); // not supported - - union Item { - Item* next; - char itemData[ITEM_SIZE]; - }; - struct Block { - Item items[ITEMS_PER_BLOCK]; - }; - DynArray< Block*, 10 > _blockPtrs; - Item* _root; - - int _currentAllocs; - int _nAllocs; - int _maxAllocs; - int _nUntracked; -}; - - - -/** - Implements the interface to the "Visitor pattern" (see the Accept() method.) - If you call the Accept() method, it requires being passed a XMLVisitor - class to handle callbacks. For nodes that contain other nodes (Document, Element) - you will get called with a VisitEnter/VisitExit pair. Nodes that are always leafs - are simply called with Visit(). - - If you return 'true' from a Visit method, recursive parsing will continue. If you return - false, no children of this node or its siblings will be visited. - - All flavors of Visit methods have a default implementation that returns 'true' (continue - visiting). You need to only override methods that are interesting to you. - - Generally Accept() is called on the XMLDocument, although all nodes support visiting. - - You should never change the document from a callback. - - @sa XMLNode::Accept() -*/ -class TINYXML2_LIB XMLVisitor -{ -public: - virtual ~XMLVisitor() {} - - /// Visit a document. - virtual bool VisitEnter( const XMLDocument& /*doc*/ ) { - return true; - } - /// Visit a document. - virtual bool VisitExit( const XMLDocument& /*doc*/ ) { - return true; - } - - /// Visit an element. - virtual bool VisitEnter( const XMLElement& /*element*/, const XMLAttribute* /*firstAttribute*/ ) { - return true; - } - /// Visit an element. - virtual bool VisitExit( const XMLElement& /*element*/ ) { - return true; - } - - /// Visit a declaration. - virtual bool Visit( const XMLDeclaration& /*declaration*/ ) { - return true; - } - /// Visit a text node. - virtual bool Visit( const XMLText& /*text*/ ) { - return true; - } - /// Visit a comment node. - virtual bool Visit( const XMLComment& /*comment*/ ) { - return true; - } - /// Visit an unknown node. - virtual bool Visit( const XMLUnknown& /*unknown*/ ) { - return true; - } -}; - -// WARNING: must match XMLDocument::_errorNames[] -enum XMLError { - XML_SUCCESS = 0, - XML_NO_ATTRIBUTE, - XML_WRONG_ATTRIBUTE_TYPE, - XML_ERROR_FILE_NOT_FOUND, - XML_ERROR_FILE_COULD_NOT_BE_OPENED, - XML_ERROR_FILE_READ_ERROR, - XML_ERROR_PARSING_ELEMENT, - XML_ERROR_PARSING_ATTRIBUTE, - XML_ERROR_PARSING_TEXT, - XML_ERROR_PARSING_CDATA, - XML_ERROR_PARSING_COMMENT, - XML_ERROR_PARSING_DECLARATION, - XML_ERROR_PARSING_UNKNOWN, - XML_ERROR_EMPTY_DOCUMENT, - XML_ERROR_MISMATCHED_ELEMENT, - XML_ERROR_PARSING, - XML_CAN_NOT_CONVERT_TEXT, - XML_NO_TEXT_NODE, - XML_ELEMENT_DEPTH_EXCEEDED, - - XML_ERROR_COUNT -}; - - -/* - Utility functionality. -*/ -class TINYXML2_LIB XMLUtil -{ -public: - static const char* SkipWhiteSpace( const char* p, int* curLineNumPtr ) { - TIXMLASSERT( p ); - - while( IsWhiteSpace(*p) ) { - if (curLineNumPtr && *p == '\n') { - ++(*curLineNumPtr); - } - ++p; - } - TIXMLASSERT( p ); - return p; - } - static char* SkipWhiteSpace( char* p, int* curLineNumPtr ) { - return const_cast( SkipWhiteSpace( const_cast(p), curLineNumPtr ) ); - } - - // Anything in the high order range of UTF-8 is assumed to not be whitespace. This isn't - // correct, but simple, and usually works. - static bool IsWhiteSpace( char p ) { - return !IsUTF8Continuation(p) && isspace( static_cast(p) ); - } - - inline static bool IsNameStartChar( unsigned char ch ) { - if ( ch >= 128 ) { - // This is a heuristic guess in attempt to not implement Unicode-aware isalpha() - return true; - } - if ( isalpha( ch ) ) { - return true; - } - return ch == ':' || ch == '_'; - } - - inline static bool IsNameChar( unsigned char ch ) { - return IsNameStartChar( ch ) - || isdigit( ch ) - || ch == '.' - || ch == '-'; - } - - inline static bool StringEqual( const char* p, const char* q, int nChar=INT_MAX ) { - if ( p == q ) { - return true; - } - TIXMLASSERT( p ); - TIXMLASSERT( q ); - TIXMLASSERT( nChar >= 0 ); - return strncmp( p, q, nChar ) == 0; - } - - inline static bool IsUTF8Continuation( char p ) { - return ( p & 0x80 ) != 0; - } - - static const char* ReadBOM( const char* p, bool* hasBOM ); - // p is the starting location, - // the UTF-8 value of the entity will be placed in value, and length filled in. - static const char* GetCharacterRef( const char* p, char* value, int* length ); - static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ); - - // converts primitive types to strings - static void ToStr( int v, char* buffer, int bufferSize ); - static void ToStr( unsigned v, char* buffer, int bufferSize ); - static void ToStr( bool v, char* buffer, int bufferSize ); - static void ToStr( float v, char* buffer, int bufferSize ); - static void ToStr( double v, char* buffer, int bufferSize ); - static void ToStr(int64_t v, char* buffer, int bufferSize); - - // converts strings to primitive types - static bool ToInt( const char* str, int* value ); - static bool ToUnsigned( const char* str, unsigned* value ); - static bool ToBool( const char* str, bool* value ); - static bool ToFloat( const char* str, float* value ); - static bool ToDouble( const char* str, double* value ); - static bool ToInt64(const char* str, int64_t* value); - - // Changes what is serialized for a boolean value. - // Default to "true" and "false". Shouldn't be changed - // unless you have a special testing or compatibility need. - // Be careful: static, global, & not thread safe. - // Be sure to set static const memory as parameters. - static void SetBoolSerialization(const char* writeTrue, const char* writeFalse); - -private: - static const char* writeBoolTrue; - static const char* writeBoolFalse; -}; - - -/** XMLNode is a base class for every object that is in the - XML Document Object Model (DOM), except XMLAttributes. - Nodes have siblings, a parent, and children which can - be navigated. A node is always in a XMLDocument. - The type of a XMLNode can be queried, and it can - be cast to its more defined type. - - A XMLDocument allocates memory for all its Nodes. - When the XMLDocument gets deleted, all its Nodes - will also be deleted. - - @verbatim - A Document can contain: Element (container or leaf) - Comment (leaf) - Unknown (leaf) - Declaration( leaf ) - - An Element can contain: Element (container or leaf) - Text (leaf) - Attributes (not on tree) - Comment (leaf) - Unknown (leaf) - - @endverbatim -*/ -class TINYXML2_LIB XMLNode -{ - friend class XMLDocument; - friend class XMLElement; -public: - - /// Get the XMLDocument that owns this XMLNode. - const XMLDocument* GetDocument() const { - TIXMLASSERT( _document ); - return _document; - } - /// Get the XMLDocument that owns this XMLNode. - XMLDocument* GetDocument() { - TIXMLASSERT( _document ); - return _document; - } - - /// Safely cast to an Element, or null. - virtual XMLElement* ToElement() { - return 0; - } - /// Safely cast to Text, or null. - virtual XMLText* ToText() { - return 0; - } - /// Safely cast to a Comment, or null. - virtual XMLComment* ToComment() { - return 0; - } - /// Safely cast to a Document, or null. - virtual XMLDocument* ToDocument() { - return 0; - } - /// Safely cast to a Declaration, or null. - virtual XMLDeclaration* ToDeclaration() { - return 0; - } - /// Safely cast to an Unknown, or null. - virtual XMLUnknown* ToUnknown() { - return 0; - } - - virtual const XMLElement* ToElement() const { - return 0; - } - virtual const XMLText* ToText() const { - return 0; - } - virtual const XMLComment* ToComment() const { - return 0; - } - virtual const XMLDocument* ToDocument() const { - return 0; - } - virtual const XMLDeclaration* ToDeclaration() const { - return 0; - } - virtual const XMLUnknown* ToUnknown() const { - return 0; - } - - /** The meaning of 'value' changes for the specific type. - @verbatim - Document: empty (NULL is returned, not an empty string) - Element: name of the element - Comment: the comment text - Unknown: the tag contents - Text: the text string - @endverbatim - */ - const char* Value() const; - - /** Set the Value of an XML node. - @sa Value() - */ - void SetValue( const char* val, bool staticMem=false ); - - /// Gets the line number the node is in, if the document was parsed from a file. - int GetLineNum() const { return _parseLineNum; } - - /// Get the parent of this node on the DOM. - const XMLNode* Parent() const { - return _parent; - } - - XMLNode* Parent() { - return _parent; - } - - /// Returns true if this node has no children. - bool NoChildren() const { - return !_firstChild; - } - - /// Get the first child node, or null if none exists. - const XMLNode* FirstChild() const { - return _firstChild; - } - - XMLNode* FirstChild() { - return _firstChild; - } - - /** Get the first child element, or optionally the first child - element with the specified name. - */ - const XMLElement* FirstChildElement( const char* name = 0 ) const; - - XMLElement* FirstChildElement( const char* name = 0 ) { - return const_cast(const_cast(this)->FirstChildElement( name )); - } - - /// Get the last child node, or null if none exists. - const XMLNode* LastChild() const { - return _lastChild; - } - - XMLNode* LastChild() { - return _lastChild; - } - - /** Get the last child element or optionally the last child - element with the specified name. - */ - const XMLElement* LastChildElement( const char* name = 0 ) const; - - XMLElement* LastChildElement( const char* name = 0 ) { - return const_cast(const_cast(this)->LastChildElement(name) ); - } - - /// Get the previous (left) sibling node of this node. - const XMLNode* PreviousSibling() const { - return _prev; - } - - XMLNode* PreviousSibling() { - return _prev; - } - - /// Get the previous (left) sibling element of this node, with an optionally supplied name. - const XMLElement* PreviousSiblingElement( const char* name = 0 ) const ; - - XMLElement* PreviousSiblingElement( const char* name = 0 ) { - return const_cast(const_cast(this)->PreviousSiblingElement( name ) ); - } - - /// Get the next (right) sibling node of this node. - const XMLNode* NextSibling() const { - return _next; - } - - XMLNode* NextSibling() { - return _next; - } - - /// Get the next (right) sibling element of this node, with an optionally supplied name. - const XMLElement* NextSiblingElement( const char* name = 0 ) const; - - XMLElement* NextSiblingElement( const char* name = 0 ) { - return const_cast(const_cast(this)->NextSiblingElement( name ) ); - } - - /** - Add a child node as the last (right) child. - If the child node is already part of the document, - it is moved from its old location to the new location. - Returns the addThis argument or 0 if the node does not - belong to the same document. - */ - XMLNode* InsertEndChild( XMLNode* addThis ); - - XMLNode* LinkEndChild( XMLNode* addThis ) { - return InsertEndChild( addThis ); - } - /** - Add a child node as the first (left) child. - If the child node is already part of the document, - it is moved from its old location to the new location. - Returns the addThis argument or 0 if the node does not - belong to the same document. - */ - XMLNode* InsertFirstChild( XMLNode* addThis ); - /** - Add a node after the specified child node. - If the child node is already part of the document, - it is moved from its old location to the new location. - Returns the addThis argument or 0 if the afterThis node - is not a child of this node, or if the node does not - belong to the same document. - */ - XMLNode* InsertAfterChild( XMLNode* afterThis, XMLNode* addThis ); - - /** - Delete all the children of this node. - */ - void DeleteChildren(); - - /** - Delete a child of this node. - */ - void DeleteChild( XMLNode* node ); - - /** - Make a copy of this node, but not its children. - You may pass in a Document pointer that will be - the owner of the new Node. If the 'document' is - null, then the node returned will be allocated - from the current Document. (this->GetDocument()) - - Note: if called on a XMLDocument, this will return null. - */ - virtual XMLNode* ShallowClone( XMLDocument* document ) const = 0; - - /** - Make a copy of this node and all its children. - - If the 'target' is null, then the nodes will - be allocated in the current document. If 'target' - is specified, the memory will be allocated is the - specified XMLDocument. - - NOTE: This is probably not the correct tool to - copy a document, since XMLDocuments can have multiple - top level XMLNodes. You probably want to use - XMLDocument::DeepCopy() - */ - XMLNode* DeepClone( XMLDocument* target ) const; - - /** - Test if 2 nodes are the same, but don't test children. - The 2 nodes do not need to be in the same Document. - - Note: if called on a XMLDocument, this will return false. - */ - virtual bool ShallowEqual( const XMLNode* compare ) const = 0; - - /** Accept a hierarchical visit of the nodes in the TinyXML-2 DOM. Every node in the - XML tree will be conditionally visited and the host will be called back - via the XMLVisitor interface. - - This is essentially a SAX interface for TinyXML-2. (Note however it doesn't re-parse - the XML for the callbacks, so the performance of TinyXML-2 is unchanged by using this - interface versus any other.) - - The interface has been based on ideas from: - - - http://www.saxproject.org/ - - http://c2.com/cgi/wiki?HierarchicalVisitorPattern - - Which are both good references for "visiting". - - An example of using Accept(): - @verbatim - XMLPrinter printer; - tinyxmlDoc.Accept( &printer ); - const char* xmlcstr = printer.CStr(); - @endverbatim - */ - virtual bool Accept( XMLVisitor* visitor ) const = 0; - - /** - Set user data into the XMLNode. TinyXML-2 in - no way processes or interprets user data. - It is initially 0. - */ - void SetUserData(void* userData) { _userData = userData; } - - /** - Get user data set into the XMLNode. TinyXML-2 in - no way processes or interprets user data. - It is initially 0. - */ - void* GetUserData() const { return _userData; } - -protected: - explicit XMLNode( XMLDocument* ); - virtual ~XMLNode(); - - virtual char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr); - - XMLDocument* _document; - XMLNode* _parent; - mutable StrPair _value; - int _parseLineNum; - - XMLNode* _firstChild; - XMLNode* _lastChild; - - XMLNode* _prev; - XMLNode* _next; - - void* _userData; - -private: - MemPool* _memPool; - void Unlink( XMLNode* child ); - static void DeleteNode( XMLNode* node ); - void InsertChildPreamble( XMLNode* insertThis ) const; - const XMLElement* ToElementWithName( const char* name ) const; - - XMLNode( const XMLNode& ); // not supported - XMLNode& operator=( const XMLNode& ); // not supported -}; - - -/** XML text. - - Note that a text node can have child element nodes, for example: - @verbatim - This is bold - @endverbatim - - A text node can have 2 ways to output the next. "normal" output - and CDATA. It will default to the mode it was parsed from the XML file and - you generally want to leave it alone, but you can change the output mode with - SetCData() and query it with CData(). -*/ -class TINYXML2_LIB XMLText : public XMLNode -{ - friend class XMLDocument; -public: - virtual bool Accept( XMLVisitor* visitor ) const; - - virtual XMLText* ToText() { - return this; - } - virtual const XMLText* ToText() const { - return this; - } - - /// Declare whether this should be CDATA or standard text. - void SetCData( bool isCData ) { - _isCData = isCData; - } - /// Returns true if this is a CDATA text element. - bool CData() const { - return _isCData; - } - - virtual XMLNode* ShallowClone( XMLDocument* document ) const; - virtual bool ShallowEqual( const XMLNode* compare ) const; - -protected: - explicit XMLText( XMLDocument* doc ) : XMLNode( doc ), _isCData( false ) {} - virtual ~XMLText() {} - - char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ); - -private: - bool _isCData; - - XMLText( const XMLText& ); // not supported - XMLText& operator=( const XMLText& ); // not supported -}; - - -/** An XML Comment. */ -class TINYXML2_LIB XMLComment : public XMLNode -{ - friend class XMLDocument; -public: - virtual XMLComment* ToComment() { - return this; - } - virtual const XMLComment* ToComment() const { - return this; - } - - virtual bool Accept( XMLVisitor* visitor ) const; - - virtual XMLNode* ShallowClone( XMLDocument* document ) const; - virtual bool ShallowEqual( const XMLNode* compare ) const; - -protected: - explicit XMLComment( XMLDocument* doc ); - virtual ~XMLComment(); - - char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr); - -private: - XMLComment( const XMLComment& ); // not supported - XMLComment& operator=( const XMLComment& ); // not supported -}; - - -/** In correct XML the declaration is the first entry in the file. - @verbatim - - @endverbatim - - TinyXML-2 will happily read or write files without a declaration, - however. - - The text of the declaration isn't interpreted. It is parsed - and written as a string. -*/ -class TINYXML2_LIB XMLDeclaration : public XMLNode -{ - friend class XMLDocument; -public: - virtual XMLDeclaration* ToDeclaration() { - return this; - } - virtual const XMLDeclaration* ToDeclaration() const { - return this; - } - - virtual bool Accept( XMLVisitor* visitor ) const; - - virtual XMLNode* ShallowClone( XMLDocument* document ) const; - virtual bool ShallowEqual( const XMLNode* compare ) const; - -protected: - explicit XMLDeclaration( XMLDocument* doc ); - virtual ~XMLDeclaration(); - - char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ); - -private: - XMLDeclaration( const XMLDeclaration& ); // not supported - XMLDeclaration& operator=( const XMLDeclaration& ); // not supported -}; - - -/** Any tag that TinyXML-2 doesn't recognize is saved as an - unknown. It is a tag of text, but should not be modified. - It will be written back to the XML, unchanged, when the file - is saved. - - DTD tags get thrown into XMLUnknowns. -*/ -class TINYXML2_LIB XMLUnknown : public XMLNode -{ - friend class XMLDocument; -public: - virtual XMLUnknown* ToUnknown() { - return this; - } - virtual const XMLUnknown* ToUnknown() const { - return this; - } - - virtual bool Accept( XMLVisitor* visitor ) const; - - virtual XMLNode* ShallowClone( XMLDocument* document ) const; - virtual bool ShallowEqual( const XMLNode* compare ) const; - -protected: - explicit XMLUnknown( XMLDocument* doc ); - virtual ~XMLUnknown(); - - char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ); - -private: - XMLUnknown( const XMLUnknown& ); // not supported - XMLUnknown& operator=( const XMLUnknown& ); // not supported -}; - - - -/** An attribute is a name-value pair. Elements have an arbitrary - number of attributes, each with a unique name. - - @note The attributes are not XMLNodes. You may only query the - Next() attribute in a list. -*/ -class TINYXML2_LIB XMLAttribute -{ - friend class XMLElement; -public: - /// The name of the attribute. - const char* Name() const; - - /// The value of the attribute. - const char* Value() const; - - /// Gets the line number the attribute is in, if the document was parsed from a file. - int GetLineNum() const { return _parseLineNum; } - - /// The next attribute in the list. - const XMLAttribute* Next() const { - return _next; - } - - /** IntValue interprets the attribute as an integer, and returns the value. - If the value isn't an integer, 0 will be returned. There is no error checking; - use QueryIntValue() if you need error checking. - */ - int IntValue() const { - int i = 0; - QueryIntValue(&i); - return i; - } - - int64_t Int64Value() const { - int64_t i = 0; - QueryInt64Value(&i); - return i; - } - - /// Query as an unsigned integer. See IntValue() - unsigned UnsignedValue() const { - unsigned i=0; - QueryUnsignedValue( &i ); - return i; - } - /// Query as a boolean. See IntValue() - bool BoolValue() const { - bool b=false; - QueryBoolValue( &b ); - return b; - } - /// Query as a double. See IntValue() - double DoubleValue() const { - double d=0; - QueryDoubleValue( &d ); - return d; - } - /// Query as a float. See IntValue() - float FloatValue() const { - float f=0; - QueryFloatValue( &f ); - return f; - } - - /** QueryIntValue interprets the attribute as an integer, and returns the value - in the provided parameter. The function will return XML_SUCCESS on success, - and XML_WRONG_ATTRIBUTE_TYPE if the conversion is not successful. - */ - XMLError QueryIntValue( int* value ) const; - /// See QueryIntValue - XMLError QueryUnsignedValue( unsigned int* value ) const; - /// See QueryIntValue - XMLError QueryInt64Value(int64_t* value) const; - /// See QueryIntValue - XMLError QueryBoolValue( bool* value ) const; - /// See QueryIntValue - XMLError QueryDoubleValue( double* value ) const; - /// See QueryIntValue - XMLError QueryFloatValue( float* value ) const; - - /// Set the attribute to a string value. - void SetAttribute( const char* value ); - /// Set the attribute to value. - void SetAttribute( int value ); - /// Set the attribute to value. - void SetAttribute( unsigned value ); - /// Set the attribute to value. - void SetAttribute(int64_t value); - /// Set the attribute to value. - void SetAttribute( bool value ); - /// Set the attribute to value. - void SetAttribute( double value ); - /// Set the attribute to value. - void SetAttribute( float value ); - -private: - enum { BUF_SIZE = 200 }; - - XMLAttribute() : _name(), _value(),_parseLineNum( 0 ), _next( 0 ), _memPool( 0 ) {} - virtual ~XMLAttribute() {} - - XMLAttribute( const XMLAttribute& ); // not supported - void operator=( const XMLAttribute& ); // not supported - void SetName( const char* name ); - - char* ParseDeep( char* p, bool processEntities, int* curLineNumPtr ); - - mutable StrPair _name; - mutable StrPair _value; - int _parseLineNum; - XMLAttribute* _next; - MemPool* _memPool; -}; - - -/** The element is a container class. It has a value, the element name, - and can contain other elements, text, comments, and unknowns. - Elements also contain an arbitrary number of attributes. -*/ -class TINYXML2_LIB XMLElement : public XMLNode -{ - friend class XMLDocument; -public: - /// Get the name of an element (which is the Value() of the node.) - const char* Name() const { - return Value(); - } - /// Set the name of the element. - void SetName( const char* str, bool staticMem=false ) { - SetValue( str, staticMem ); - } - - virtual XMLElement* ToElement() { - return this; - } - virtual const XMLElement* ToElement() const { - return this; - } - virtual bool Accept( XMLVisitor* visitor ) const; - - /** Given an attribute name, Attribute() returns the value - for the attribute of that name, or null if none - exists. For example: - - @verbatim - const char* value = ele->Attribute( "foo" ); - @endverbatim - - The 'value' parameter is normally null. However, if specified, - the attribute will only be returned if the 'name' and 'value' - match. This allow you to write code: - - @verbatim - if ( ele->Attribute( "foo", "bar" ) ) callFooIsBar(); - @endverbatim - - rather than: - @verbatim - if ( ele->Attribute( "foo" ) ) { - if ( strcmp( ele->Attribute( "foo" ), "bar" ) == 0 ) callFooIsBar(); - } - @endverbatim - */ - const char* Attribute( const char* name, const char* value=0 ) const; - - /** Given an attribute name, IntAttribute() returns the value - of the attribute interpreted as an integer. The default - value will be returned if the attribute isn't present, - or if there is an error. (For a method with error - checking, see QueryIntAttribute()). - */ - int IntAttribute(const char* name, int defaultValue = 0) const; - /// See IntAttribute() - unsigned UnsignedAttribute(const char* name, unsigned defaultValue = 0) const; - /// See IntAttribute() - int64_t Int64Attribute(const char* name, int64_t defaultValue = 0) const; - /// See IntAttribute() - bool BoolAttribute(const char* name, bool defaultValue = false) const; - /// See IntAttribute() - double DoubleAttribute(const char* name, double defaultValue = 0) const; - /// See IntAttribute() - float FloatAttribute(const char* name, float defaultValue = 0) const; - - /** Given an attribute name, QueryIntAttribute() returns - XML_SUCCESS, XML_WRONG_ATTRIBUTE_TYPE if the conversion - can't be performed, or XML_NO_ATTRIBUTE if the attribute - doesn't exist. If successful, the result of the conversion - will be written to 'value'. If not successful, nothing will - be written to 'value'. This allows you to provide default - value: - - @verbatim - int value = 10; - QueryIntAttribute( "foo", &value ); // if "foo" isn't found, value will still be 10 - @endverbatim - */ - XMLError QueryIntAttribute( const char* name, int* value ) const { - const XMLAttribute* a = FindAttribute( name ); - if ( !a ) { - return XML_NO_ATTRIBUTE; - } - return a->QueryIntValue( value ); - } - - /// See QueryIntAttribute() - XMLError QueryUnsignedAttribute( const char* name, unsigned int* value ) const { - const XMLAttribute* a = FindAttribute( name ); - if ( !a ) { - return XML_NO_ATTRIBUTE; - } - return a->QueryUnsignedValue( value ); - } - - /// See QueryIntAttribute() - XMLError QueryInt64Attribute(const char* name, int64_t* value) const { - const XMLAttribute* a = FindAttribute(name); - if (!a) { - return XML_NO_ATTRIBUTE; - } - return a->QueryInt64Value(value); - } - - /// See QueryIntAttribute() - XMLError QueryBoolAttribute( const char* name, bool* value ) const { - const XMLAttribute* a = FindAttribute( name ); - if ( !a ) { - return XML_NO_ATTRIBUTE; - } - return a->QueryBoolValue( value ); - } - /// See QueryIntAttribute() - XMLError QueryDoubleAttribute( const char* name, double* value ) const { - const XMLAttribute* a = FindAttribute( name ); - if ( !a ) { - return XML_NO_ATTRIBUTE; - } - return a->QueryDoubleValue( value ); - } - /// See QueryIntAttribute() - XMLError QueryFloatAttribute( const char* name, float* value ) const { - const XMLAttribute* a = FindAttribute( name ); - if ( !a ) { - return XML_NO_ATTRIBUTE; - } - return a->QueryFloatValue( value ); - } - - /// See QueryIntAttribute() - XMLError QueryStringAttribute(const char* name, const char** value) const { - const XMLAttribute* a = FindAttribute(name); - if (!a) { - return XML_NO_ATTRIBUTE; - } - *value = a->Value(); - return XML_SUCCESS; - } - - - - /** Given an attribute name, QueryAttribute() returns - XML_SUCCESS, XML_WRONG_ATTRIBUTE_TYPE if the conversion - can't be performed, or XML_NO_ATTRIBUTE if the attribute - doesn't exist. It is overloaded for the primitive types, - and is a generally more convenient replacement of - QueryIntAttribute() and related functions. - - If successful, the result of the conversion - will be written to 'value'. If not successful, nothing will - be written to 'value'. This allows you to provide default - value: - - @verbatim - int value = 10; - QueryAttribute( "foo", &value ); // if "foo" isn't found, value will still be 10 - @endverbatim - */ - XMLError QueryAttribute( const char* name, int* value ) const { - return QueryIntAttribute( name, value ); - } - - XMLError QueryAttribute( const char* name, unsigned int* value ) const { - return QueryUnsignedAttribute( name, value ); - } - - XMLError QueryAttribute(const char* name, int64_t* value) const { - return QueryInt64Attribute(name, value); - } - - XMLError QueryAttribute( const char* name, bool* value ) const { - return QueryBoolAttribute( name, value ); - } - - XMLError QueryAttribute( const char* name, double* value ) const { - return QueryDoubleAttribute( name, value ); - } - - XMLError QueryAttribute( const char* name, float* value ) const { - return QueryFloatAttribute( name, value ); - } - - /// Sets the named attribute to value. - void SetAttribute( const char* name, const char* value ) { - XMLAttribute* a = FindOrCreateAttribute( name ); - a->SetAttribute( value ); - } - /// Sets the named attribute to value. - void SetAttribute( const char* name, int value ) { - XMLAttribute* a = FindOrCreateAttribute( name ); - a->SetAttribute( value ); - } - /// Sets the named attribute to value. - void SetAttribute( const char* name, unsigned value ) { - XMLAttribute* a = FindOrCreateAttribute( name ); - a->SetAttribute( value ); - } - - /// Sets the named attribute to value. - void SetAttribute(const char* name, int64_t value) { - XMLAttribute* a = FindOrCreateAttribute(name); - a->SetAttribute(value); - } - - /// Sets the named attribute to value. - void SetAttribute( const char* name, bool value ) { - XMLAttribute* a = FindOrCreateAttribute( name ); - a->SetAttribute( value ); - } - /// Sets the named attribute to value. - void SetAttribute( const char* name, double value ) { - XMLAttribute* a = FindOrCreateAttribute( name ); - a->SetAttribute( value ); - } - /// Sets the named attribute to value. - void SetAttribute( const char* name, float value ) { - XMLAttribute* a = FindOrCreateAttribute( name ); - a->SetAttribute( value ); - } - - /** - Delete an attribute. - */ - void DeleteAttribute( const char* name ); - - /// Return the first attribute in the list. - const XMLAttribute* FirstAttribute() const { - return _rootAttribute; - } - /// Query a specific attribute in the list. - const XMLAttribute* FindAttribute( const char* name ) const; - - /** Convenience function for easy access to the text inside an element. Although easy - and concise, GetText() is limited compared to getting the XMLText child - and accessing it directly. - - If the first child of 'this' is a XMLText, the GetText() - returns the character string of the Text node, else null is returned. - - This is a convenient method for getting the text of simple contained text: - @verbatim - This is text - const char* str = fooElement->GetText(); - @endverbatim - - 'str' will be a pointer to "This is text". - - Note that this function can be misleading. If the element foo was created from - this XML: - @verbatim - This is text - @endverbatim - - then the value of str would be null. The first child node isn't a text node, it is - another element. From this XML: - @verbatim - This is text - @endverbatim - GetText() will return "This is ". - */ - const char* GetText() const; - - /** Convenience function for easy access to the text inside an element. Although easy - and concise, SetText() is limited compared to creating an XMLText child - and mutating it directly. - - If the first child of 'this' is a XMLText, SetText() sets its value to - the given string, otherwise it will create a first child that is an XMLText. - - This is a convenient method for setting the text of simple contained text: - @verbatim - This is text - fooElement->SetText( "Hullaballoo!" ); - Hullaballoo! - @endverbatim - - Note that this function can be misleading. If the element foo was created from - this XML: - @verbatim - This is text - @endverbatim - - then it will not change "This is text", but rather prefix it with a text element: - @verbatim - Hullaballoo!This is text - @endverbatim - - For this XML: - @verbatim - - @endverbatim - SetText() will generate - @verbatim - Hullaballoo! - @endverbatim - */ - void SetText( const char* inText ); - /// Convenience method for setting text inside an element. See SetText() for important limitations. - void SetText( int value ); - /// Convenience method for setting text inside an element. See SetText() for important limitations. - void SetText( unsigned value ); - /// Convenience method for setting text inside an element. See SetText() for important limitations. - void SetText(int64_t value); - /// Convenience method for setting text inside an element. See SetText() for important limitations. - void SetText( bool value ); - /// Convenience method for setting text inside an element. See SetText() for important limitations. - void SetText( double value ); - /// Convenience method for setting text inside an element. See SetText() for important limitations. - void SetText( float value ); - - /** - Convenience method to query the value of a child text node. This is probably best - shown by example. Given you have a document is this form: - @verbatim - - 1 - 1.4 - - @endverbatim - - The QueryIntText() and similar functions provide a safe and easier way to get to the - "value" of x and y. - - @verbatim - int x = 0; - float y = 0; // types of x and y are contrived for example - const XMLElement* xElement = pointElement->FirstChildElement( "x" ); - const XMLElement* yElement = pointElement->FirstChildElement( "y" ); - xElement->QueryIntText( &x ); - yElement->QueryFloatText( &y ); - @endverbatim - - @returns XML_SUCCESS (0) on success, XML_CAN_NOT_CONVERT_TEXT if the text cannot be converted - to the requested type, and XML_NO_TEXT_NODE if there is no child text to query. - - */ - XMLError QueryIntText( int* ival ) const; - /// See QueryIntText() - XMLError QueryUnsignedText( unsigned* uval ) const; - /// See QueryIntText() - XMLError QueryInt64Text(int64_t* uval) const; - /// See QueryIntText() - XMLError QueryBoolText( bool* bval ) const; - /// See QueryIntText() - XMLError QueryDoubleText( double* dval ) const; - /// See QueryIntText() - XMLError QueryFloatText( float* fval ) const; - - int IntText(int defaultValue = 0) const; - - /// See QueryIntText() - unsigned UnsignedText(unsigned defaultValue = 0) const; - /// See QueryIntText() - int64_t Int64Text(int64_t defaultValue = 0) const; - /// See QueryIntText() - bool BoolText(bool defaultValue = false) const; - /// See QueryIntText() - double DoubleText(double defaultValue = 0) const; - /// See QueryIntText() - float FloatText(float defaultValue = 0) const; - - // internal: - enum ElementClosingType { - OPEN, // - CLOSED, // - CLOSING // - }; - ElementClosingType ClosingType() const { - return _closingType; - } - virtual XMLNode* ShallowClone( XMLDocument* document ) const; - virtual bool ShallowEqual( const XMLNode* compare ) const; - -protected: - char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ); - -private: - XMLElement( XMLDocument* doc ); - virtual ~XMLElement(); - XMLElement( const XMLElement& ); // not supported - void operator=( const XMLElement& ); // not supported - - XMLAttribute* FindOrCreateAttribute( const char* name ); - char* ParseAttributes( char* p, int* curLineNumPtr ); - static void DeleteAttribute( XMLAttribute* attribute ); - XMLAttribute* CreateAttribute(); - - enum { BUF_SIZE = 200 }; - ElementClosingType _closingType; - // The attribute list is ordered; there is no 'lastAttribute' - // because the list needs to be scanned for dupes before adding - // a new attribute. - XMLAttribute* _rootAttribute; -}; - - -enum Whitespace { - PRESERVE_WHITESPACE, - COLLAPSE_WHITESPACE -}; - - -/** A Document binds together all the functionality. - It can be saved, loaded, and printed to the screen. - All Nodes are connected and allocated to a Document. - If the Document is deleted, all its Nodes are also deleted. -*/ -class TINYXML2_LIB XMLDocument : public XMLNode -{ - friend class XMLElement; - // Gives access to SetError and Push/PopDepth, but over-access for everything else. - // Wishing C++ had "internal" scope. - friend class XMLNode; - friend class XMLText; - friend class XMLComment; - friend class XMLDeclaration; - friend class XMLUnknown; -public: - /// constructor - XMLDocument( bool processEntities = true, Whitespace whitespaceMode = PRESERVE_WHITESPACE ); - ~XMLDocument(); - - virtual XMLDocument* ToDocument() { - TIXMLASSERT( this == _document ); - return this; - } - virtual const XMLDocument* ToDocument() const { - TIXMLASSERT( this == _document ); - return this; - } - - /** - Parse an XML file from a character string. - Returns XML_SUCCESS (0) on success, or - an errorID. - - You may optionally pass in the 'nBytes', which is - the number of bytes which will be parsed. If not - specified, TinyXML-2 will assume 'xml' points to a - null terminated string. - */ - XMLError Parse( const char* xml, size_t nBytes=(size_t)(-1) ); - - /** - Load an XML file from disk. - Returns XML_SUCCESS (0) on success, or - an errorID. - */ - XMLError LoadFile( const char* filename ); - - /** - Load an XML file from disk. You are responsible - for providing and closing the FILE*. - - NOTE: The file should be opened as binary ("rb") - not text in order for TinyXML-2 to correctly - do newline normalization. - - Returns XML_SUCCESS (0) on success, or - an errorID. - */ - XMLError LoadFile( FILE* ); - - /** - Save the XML file to disk. - Returns XML_SUCCESS (0) on success, or - an errorID. - */ - XMLError SaveFile( const char* filename, bool compact = false ); - - /** - Save the XML file to disk. You are responsible - for providing and closing the FILE*. - - Returns XML_SUCCESS (0) on success, or - an errorID. - */ - XMLError SaveFile( FILE* fp, bool compact = false ); - - bool ProcessEntities() const { - return _processEntities; - } - Whitespace WhitespaceMode() const { - return _whitespaceMode; - } - - /** - Returns true if this document has a leading Byte Order Mark of UTF8. - */ - bool HasBOM() const { - return _writeBOM; - } - /** Sets whether to write the BOM when writing the file. - */ - void SetBOM( bool useBOM ) { - _writeBOM = useBOM; - } - - /** Return the root element of DOM. Equivalent to FirstChildElement(). - To get the first node, use FirstChild(). - */ - XMLElement* RootElement() { - return FirstChildElement(); - } - const XMLElement* RootElement() const { - return FirstChildElement(); - } - - /** Print the Document. If the Printer is not provided, it will - print to stdout. If you provide Printer, this can print to a file: - @verbatim - XMLPrinter printer( fp ); - doc.Print( &printer ); - @endverbatim - - Or you can use a printer to print to memory: - @verbatim - XMLPrinter printer; - doc.Print( &printer ); - // printer.CStr() has a const char* to the XML - @endverbatim - */ - void Print( XMLPrinter* streamer=0 ) const; - virtual bool Accept( XMLVisitor* visitor ) const; - - /** - Create a new Element associated with - this Document. The memory for the Element - is managed by the Document. - */ - XMLElement* NewElement( const char* name ); - /** - Create a new Comment associated with - this Document. The memory for the Comment - is managed by the Document. - */ - XMLComment* NewComment( const char* comment ); - /** - Create a new Text associated with - this Document. The memory for the Text - is managed by the Document. - */ - XMLText* NewText( const char* text ); - /** - Create a new Declaration associated with - this Document. The memory for the object - is managed by the Document. - - If the 'text' param is null, the standard - declaration is used.: - @verbatim - - @endverbatim - */ - XMLDeclaration* NewDeclaration( const char* text=0 ); - /** - Create a new Unknown associated with - this Document. The memory for the object - is managed by the Document. - */ - XMLUnknown* NewUnknown( const char* text ); - - /** - Delete a node associated with this document. - It will be unlinked from the DOM. - */ - void DeleteNode( XMLNode* node ); - - void ClearError() { - SetError(XML_SUCCESS, 0, 0); - } - - /// Return true if there was an error parsing the document. - bool Error() const { - return _errorID != XML_SUCCESS; - } - /// Return the errorID. - XMLError ErrorID() const { - return _errorID; - } - const char* ErrorName() const; - static const char* ErrorIDToName(XMLError errorID); - - /** Returns a "long form" error description. A hopefully helpful - diagnostic with location, line number, and/or additional info. - */ - const char* ErrorStr() const; - - /// A (trivial) utility function that prints the ErrorStr() to stdout. - void PrintError() const; - - /// Return the line where the error occurred, or zero if unknown. - int ErrorLineNum() const - { - return _errorLineNum; - } - - /// Clear the document, resetting it to the initial state. - void Clear(); - - /** - Copies this document to a target document. - The target will be completely cleared before the copy. - If you want to copy a sub-tree, see XMLNode::DeepClone(). - - NOTE: that the 'target' must be non-null. - */ - void DeepCopy(XMLDocument* target) const; - - // internal - char* Identify( char* p, XMLNode** node ); - - // internal - void MarkInUse(XMLNode*); - - virtual XMLNode* ShallowClone( XMLDocument* /*document*/ ) const { - return 0; - } - virtual bool ShallowEqual( const XMLNode* /*compare*/ ) const { - return false; - } - -private: - XMLDocument( const XMLDocument& ); // not supported - void operator=( const XMLDocument& ); // not supported - - bool _writeBOM; - bool _processEntities; - XMLError _errorID; - Whitespace _whitespaceMode; - mutable StrPair _errorStr; - int _errorLineNum; - char* _charBuffer; - int _parseCurLineNum; - int _parsingDepth; - // Memory tracking does add some overhead. - // However, the code assumes that you don't - // have a bunch of unlinked nodes around. - // Therefore it takes less memory to track - // in the document vs. a linked list in the XMLNode, - // and the performance is the same. - DynArray _unlinked; - - MemPoolT< sizeof(XMLElement) > _elementPool; - MemPoolT< sizeof(XMLAttribute) > _attributePool; - MemPoolT< sizeof(XMLText) > _textPool; - MemPoolT< sizeof(XMLComment) > _commentPool; - - static const char* _errorNames[XML_ERROR_COUNT]; - - void Parse(); - - void SetError( XMLError error, int lineNum, const char* format, ... ); - - // Something of an obvious security hole, once it was discovered. - // Either an ill-formed XML or an excessively deep one can overflow - // the stack. Track stack depth, and error out if needed. - class DepthTracker { - public: - explicit DepthTracker(XMLDocument * document) { - this->_document = document; - document->PushDepth(); - } - ~DepthTracker() { - _document->PopDepth(); - } - private: - XMLDocument * _document; - }; - void PushDepth(); - void PopDepth(); - - template - NodeType* CreateUnlinkedNode( MemPoolT& pool ); -}; - -template -inline NodeType* XMLDocument::CreateUnlinkedNode( MemPoolT& pool ) -{ - TIXMLASSERT( sizeof( NodeType ) == PoolElementSize ); - TIXMLASSERT( sizeof( NodeType ) == pool.ItemSize() ); - NodeType* returnNode = new (pool.Alloc()) NodeType( this ); - TIXMLASSERT( returnNode ); - returnNode->_memPool = &pool; - - _unlinked.Push(returnNode); - return returnNode; -} - -/** - A XMLHandle is a class that wraps a node pointer with null checks; this is - an incredibly useful thing. Note that XMLHandle is not part of the TinyXML-2 - DOM structure. It is a separate utility class. - - Take an example: - @verbatim - - - - - - - @endverbatim - - Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very - easy to write a *lot* of code that looks like: - - @verbatim - XMLElement* root = document.FirstChildElement( "Document" ); - if ( root ) - { - XMLElement* element = root->FirstChildElement( "Element" ); - if ( element ) - { - XMLElement* child = element->FirstChildElement( "Child" ); - if ( child ) - { - XMLElement* child2 = child->NextSiblingElement( "Child" ); - if ( child2 ) - { - // Finally do something useful. - @endverbatim - - And that doesn't even cover "else" cases. XMLHandle addresses the verbosity - of such code. A XMLHandle checks for null pointers so it is perfectly safe - and correct to use: - - @verbatim - XMLHandle docHandle( &document ); - XMLElement* child2 = docHandle.FirstChildElement( "Document" ).FirstChildElement( "Element" ).FirstChildElement().NextSiblingElement(); - if ( child2 ) - { - // do something useful - @endverbatim - - Which is MUCH more concise and useful. - - It is also safe to copy handles - internally they are nothing more than node pointers. - @verbatim - XMLHandle handleCopy = handle; - @endverbatim - - See also XMLConstHandle, which is the same as XMLHandle, but operates on const objects. -*/ -class TINYXML2_LIB XMLHandle -{ -public: - /// Create a handle from any node (at any depth of the tree.) This can be a null pointer. - explicit XMLHandle( XMLNode* node ) : _node( node ) { - } - /// Create a handle from a node. - explicit XMLHandle( XMLNode& node ) : _node( &node ) { - } - /// Copy constructor - XMLHandle( const XMLHandle& ref ) : _node( ref._node ) { - } - /// Assignment - XMLHandle& operator=( const XMLHandle& ref ) { - _node = ref._node; - return *this; - } - - /// Get the first child of this handle. - XMLHandle FirstChild() { - return XMLHandle( _node ? _node->FirstChild() : 0 ); - } - /// Get the first child element of this handle. - XMLHandle FirstChildElement( const char* name = 0 ) { - return XMLHandle( _node ? _node->FirstChildElement( name ) : 0 ); - } - /// Get the last child of this handle. - XMLHandle LastChild() { - return XMLHandle( _node ? _node->LastChild() : 0 ); - } - /// Get the last child element of this handle. - XMLHandle LastChildElement( const char* name = 0 ) { - return XMLHandle( _node ? _node->LastChildElement( name ) : 0 ); - } - /// Get the previous sibling of this handle. - XMLHandle PreviousSibling() { - return XMLHandle( _node ? _node->PreviousSibling() : 0 ); - } - /// Get the previous sibling element of this handle. - XMLHandle PreviousSiblingElement( const char* name = 0 ) { - return XMLHandle( _node ? _node->PreviousSiblingElement( name ) : 0 ); - } - /// Get the next sibling of this handle. - XMLHandle NextSibling() { - return XMLHandle( _node ? _node->NextSibling() : 0 ); - } - /// Get the next sibling element of this handle. - XMLHandle NextSiblingElement( const char* name = 0 ) { - return XMLHandle( _node ? _node->NextSiblingElement( name ) : 0 ); - } - - /// Safe cast to XMLNode. This can return null. - XMLNode* ToNode() { - return _node; - } - /// Safe cast to XMLElement. This can return null. - XMLElement* ToElement() { - return ( _node ? _node->ToElement() : 0 ); - } - /// Safe cast to XMLText. This can return null. - XMLText* ToText() { - return ( _node ? _node->ToText() : 0 ); - } - /// Safe cast to XMLUnknown. This can return null. - XMLUnknown* ToUnknown() { - return ( _node ? _node->ToUnknown() : 0 ); - } - /// Safe cast to XMLDeclaration. This can return null. - XMLDeclaration* ToDeclaration() { - return ( _node ? _node->ToDeclaration() : 0 ); - } - -private: - XMLNode* _node; -}; - - -/** - A variant of the XMLHandle class for working with const XMLNodes and Documents. It is the - same in all regards, except for the 'const' qualifiers. See XMLHandle for API. -*/ -class TINYXML2_LIB XMLConstHandle -{ -public: - explicit XMLConstHandle( const XMLNode* node ) : _node( node ) { - } - explicit XMLConstHandle( const XMLNode& node ) : _node( &node ) { - } - XMLConstHandle( const XMLConstHandle& ref ) : _node( ref._node ) { - } - - XMLConstHandle& operator=( const XMLConstHandle& ref ) { - _node = ref._node; - return *this; - } - - const XMLConstHandle FirstChild() const { - return XMLConstHandle( _node ? _node->FirstChild() : 0 ); - } - const XMLConstHandle FirstChildElement( const char* name = 0 ) const { - return XMLConstHandle( _node ? _node->FirstChildElement( name ) : 0 ); - } - const XMLConstHandle LastChild() const { - return XMLConstHandle( _node ? _node->LastChild() : 0 ); - } - const XMLConstHandle LastChildElement( const char* name = 0 ) const { - return XMLConstHandle( _node ? _node->LastChildElement( name ) : 0 ); - } - const XMLConstHandle PreviousSibling() const { - return XMLConstHandle( _node ? _node->PreviousSibling() : 0 ); - } - const XMLConstHandle PreviousSiblingElement( const char* name = 0 ) const { - return XMLConstHandle( _node ? _node->PreviousSiblingElement( name ) : 0 ); - } - const XMLConstHandle NextSibling() const { - return XMLConstHandle( _node ? _node->NextSibling() : 0 ); - } - const XMLConstHandle NextSiblingElement( const char* name = 0 ) const { - return XMLConstHandle( _node ? _node->NextSiblingElement( name ) : 0 ); - } - - - const XMLNode* ToNode() const { - return _node; - } - const XMLElement* ToElement() const { - return ( _node ? _node->ToElement() : 0 ); - } - const XMLText* ToText() const { - return ( _node ? _node->ToText() : 0 ); - } - const XMLUnknown* ToUnknown() const { - return ( _node ? _node->ToUnknown() : 0 ); - } - const XMLDeclaration* ToDeclaration() const { - return ( _node ? _node->ToDeclaration() : 0 ); - } - -private: - const XMLNode* _node; -}; - - -/** - Printing functionality. The XMLPrinter gives you more - options than the XMLDocument::Print() method. - - It can: - -# Print to memory. - -# Print to a file you provide. - -# Print XML without a XMLDocument. - - Print to Memory - - @verbatim - XMLPrinter printer; - doc.Print( &printer ); - SomeFunction( printer.CStr() ); - @endverbatim - - Print to a File - - You provide the file pointer. - @verbatim - XMLPrinter printer( fp ); - doc.Print( &printer ); - @endverbatim - - Print without a XMLDocument - - When loading, an XML parser is very useful. However, sometimes - when saving, it just gets in the way. The code is often set up - for streaming, and constructing the DOM is just overhead. - - The Printer supports the streaming case. The following code - prints out a trivially simple XML file without ever creating - an XML document. - - @verbatim - XMLPrinter printer( fp ); - printer.OpenElement( "foo" ); - printer.PushAttribute( "foo", "bar" ); - printer.CloseElement(); - @endverbatim -*/ -class TINYXML2_LIB XMLPrinter : public XMLVisitor -{ -public: - /** Construct the printer. If the FILE* is specified, - this will print to the FILE. Else it will print - to memory, and the result is available in CStr(). - If 'compact' is set to true, then output is created - with only required whitespace and newlines. - */ - XMLPrinter( FILE* file=0, bool compact = false, int depth = 0 ); - virtual ~XMLPrinter() {} - - /** If streaming, write the BOM and declaration. */ - void PushHeader( bool writeBOM, bool writeDeclaration ); - /** If streaming, start writing an element. - The element must be closed with CloseElement() - */ - void OpenElement( const char* name, bool compactMode=false ); - /// If streaming, add an attribute to an open element. - void PushAttribute( const char* name, const char* value ); - void PushAttribute( const char* name, int value ); - void PushAttribute( const char* name, unsigned value ); - void PushAttribute(const char* name, int64_t value); - void PushAttribute( const char* name, bool value ); - void PushAttribute( const char* name, double value ); - /// If streaming, close the Element. - virtual void CloseElement( bool compactMode=false ); - - /// Add a text node. - void PushText( const char* text, bool cdata=false ); - /// Add a text node from an integer. - void PushText( int value ); - /// Add a text node from an unsigned. - void PushText( unsigned value ); - /// Add a text node from an unsigned. - void PushText(int64_t value); - /// Add a text node from a bool. - void PushText( bool value ); - /// Add a text node from a float. - void PushText( float value ); - /// Add a text node from a double. - void PushText( double value ); - - /// Add a comment - void PushComment( const char* comment ); - - void PushDeclaration( const char* value ); - void PushUnknown( const char* value ); - - virtual bool VisitEnter( const XMLDocument& /*doc*/ ); - virtual bool VisitExit( const XMLDocument& /*doc*/ ) { - return true; - } - - virtual bool VisitEnter( const XMLElement& element, const XMLAttribute* attribute ); - virtual bool VisitExit( const XMLElement& element ); - - virtual bool Visit( const XMLText& text ); - virtual bool Visit( const XMLComment& comment ); - virtual bool Visit( const XMLDeclaration& declaration ); - virtual bool Visit( const XMLUnknown& unknown ); - - /** - If in print to memory mode, return a pointer to - the XML file in memory. - */ - const char* CStr() const { - return _buffer.Mem(); - } - /** - If in print to memory mode, return the size - of the XML file in memory. (Note the size returned - includes the terminating null.) - */ - int CStrSize() const { - return _buffer.Size(); - } - /** - If in print to memory mode, reset the buffer to the - beginning. - */ - void ClearBuffer() { - _buffer.Clear(); - _buffer.Push(0); - _firstElement = true; - } - -protected: - virtual bool CompactMode( const XMLElement& ) { return _compactMode; } - - /** Prints out the space before an element. You may override to change - the space and tabs used. A PrintSpace() override should call Print(). - */ - virtual void PrintSpace( int depth ); - void Print( const char* format, ... ); - void Write( const char* data, size_t size ); - inline void Write( const char* data ) { Write( data, strlen( data ) ); } - void Putc( char ch ); - - void SealElementIfJustOpened(); - bool _elementJustOpened; - DynArray< const char*, 10 > _stack; - -private: - void PrintString( const char*, bool restrictedEntitySet ); // prints out, after detecting entities. - - bool _firstElement; - FILE* _fp; - int _depth; - int _textDepth; - bool _processEntities; - bool _compactMode; - - enum { - ENTITY_RANGE = 64, - BUF_SIZE = 200 - }; - bool _entityFlag[ENTITY_RANGE]; - bool _restrictedEntityFlag[ENTITY_RANGE]; - - DynArray< char, 20 > _buffer; - - // Prohibit cloning, intentionally not implemented - XMLPrinter( const XMLPrinter& ); - XMLPrinter& operator=( const XMLPrinter& ); -}; - - -} // tinyxml2 - -#if defined(_MSC_VER) -# pragma warning(pop) -#endif - -#endif // TINYXML2_INCLUDED diff --git a/tools/ZAPDConfigs/ActorList.txt b/tools/ZAPDConfigs/ActorList.txt deleted file mode 100644 index a0395eb277..0000000000 --- a/tools/ZAPDConfigs/ActorList.txt +++ /dev/null @@ -1,472 +0,0 @@ -ACTOR_PLAYER -ACTOR_UNSET_1 -ACTOR_EN_TEST -ACTOR_UNSET_3 -ACTOR_EN_GIRLA -ACTOR_UNSET_5 -ACTOR_UNSET_6 -ACTOR_EN_PART -ACTOR_EN_LIGHT -ACTOR_EN_DOOR -ACTOR_EN_BOX -ACTOR_BG_DY_YOSEIZO -ACTOR_BG_HIDAN_FIREWALL -ACTOR_EN_POH -ACTOR_EN_OKUTA -ACTOR_BG_YDAN_SP -ACTOR_EN_BOM -ACTOR_EN_WALLMAS -ACTOR_EN_DODONGO -ACTOR_EN_FIREFLY -ACTOR_EN_HORSE -ACTOR_EN_ITEM00 -ACTOR_EN_ARROW -ACTOR_UNSET_17 -ACTOR_EN_ELF -ACTOR_EN_NIW -ACTOR_UNSET_1A -ACTOR_EN_TITE -ACTOR_EN_REEBA -ACTOR_EN_PEEHAT -ACTOR_EN_BUTTE -ACTOR_UNSET_1F -ACTOR_EN_INSECT -ACTOR_EN_FISH -ACTOR_UNSET_22 -ACTOR_EN_HOLL -ACTOR_EN_SCENE_CHANGE -ACTOR_EN_ZF -ACTOR_EN_HATA -ACTOR_BOSS_DODONGO -ACTOR_BOSS_GOMA -ACTOR_EN_ZL1 -ACTOR_EN_VIEWER -ACTOR_EN_GOMA -ACTOR_BG_PUSHBOX -ACTOR_EN_BUBBLE -ACTOR_DOOR_SHUTTER -ACTOR_EN_DODOJR -ACTOR_EN_BDFIRE -ACTOR_UNSET_31 -ACTOR_EN_BOOM -ACTOR_EN_TORCH2 -ACTOR_EN_BILI -ACTOR_EN_TP -ACTOR_UNSET_36 -ACTOR_EN_ST -ACTOR_EN_BW -ACTOR_EN_A_OBJ -ACTOR_EN_EIYER -ACTOR_EN_RIVER_SOUND -ACTOR_EN_HORSE_NORMAL -ACTOR_EN_OSSAN -ACTOR_BG_TREEMOUTH -ACTOR_BG_DODOAGO -ACTOR_BG_HIDAN_DALM -ACTOR_BG_HIDAN_HROCK -ACTOR_EN_HORSE_GANON -ACTOR_BG_HIDAN_ROCK -ACTOR_BG_HIDAN_RSEKIZOU -ACTOR_BG_HIDAN_SEKIZOU -ACTOR_BG_HIDAN_SIMA -ACTOR_BG_HIDAN_SYOKU -ACTOR_EN_XC -ACTOR_BG_HIDAN_CURTAIN -ACTOR_BG_SPOT00_HANEBASI -ACTOR_EN_MB -ACTOR_EN_BOMBF -ACTOR_EN_ZL2 -ACTOR_BG_HIDAN_FSLIFT -ACTOR_EN_OE2 -ACTOR_BG_YDAN_HASI -ACTOR_BG_YDAN_MARUTA -ACTOR_BOSS_GANONDROF -ACTOR_UNSET_53 -ACTOR_EN_AM -ACTOR_EN_DEKUBABA -ACTOR_EN_M_FIRE1 -ACTOR_EN_M_THUNDER -ACTOR_BG_DDAN_JD -ACTOR_BG_BREAKWALL -ACTOR_EN_JJ -ACTOR_EN_HORSE_ZELDA -ACTOR_BG_DDAN_KD -ACTOR_DOOR_WARP1 -ACTOR_OBJ_SYOKUDAI -ACTOR_ITEM_B_HEART -ACTOR_EN_DEKUNUTS -ACTOR_BG_MENKURI_KAITEN -ACTOR_BG_MENKURI_EYE -ACTOR_EN_VALI -ACTOR_BG_MIZU_MOVEBG -ACTOR_BG_MIZU_WATER -ACTOR_ARMS_HOOK -ACTOR_EN_FHG -ACTOR_BG_MORI_HINERI -ACTOR_EN_BB -ACTOR_BG_TOKI_HIKARI -ACTOR_EN_YUKABYUN -ACTOR_BG_TOKI_SWD -ACTOR_EN_FHG_FIRE -ACTOR_BG_MJIN -ACTOR_BG_HIDAN_KOUSI -ACTOR_DOOR_TOKI -ACTOR_BG_HIDAN_HAMSTEP -ACTOR_EN_BIRD -ACTOR_UNSET_73 -ACTOR_UNSET_74 -ACTOR_UNSET_75 -ACTOR_UNSET_76 -ACTOR_EN_WOOD02 -ACTOR_UNSET_78 -ACTOR_UNSET_79 -ACTOR_UNSET_7A -ACTOR_UNSET_7B -ACTOR_EN_LIGHTBOX -ACTOR_EN_PU_BOX -ACTOR_UNSET_7E -ACTOR_UNSET_7F -ACTOR_EN_TRAP -ACTOR_EN_AROW_TRAP -ACTOR_EN_VASE -ACTOR_UNSET_83 -ACTOR_EN_TA -ACTOR_EN_TK -ACTOR_BG_MORI_BIGST -ACTOR_BG_MORI_ELEVATOR -ACTOR_BG_MORI_KAITENKABE -ACTOR_BG_MORI_RAKKATENJO -ACTOR_EN_VM -ACTOR_DEMO_EFFECT -ACTOR_DEMO_KANKYO -ACTOR_BG_HIDAN_FWBIG -ACTOR_EN_FLOORMAS -ACTOR_EN_HEISHI1 -ACTOR_EN_RD -ACTOR_EN_PO_SISTERS -ACTOR_BG_HEAVY_BLOCK -ACTOR_BG_PO_EVENT -ACTOR_OBJ_MURE -ACTOR_EN_SW -ACTOR_BOSS_FD -ACTOR_OBJECT_KANKYO -ACTOR_EN_DU -ACTOR_EN_FD -ACTOR_EN_HORSE_LINK_CHILD -ACTOR_DOOR_ANA -ACTOR_BG_SPOT02_OBJECTS -ACTOR_BG_HAKA -ACTOR_MAGIC_WIND -ACTOR_MAGIC_FIRE -ACTOR_UNSET_A0 -ACTOR_EN_RU1 -ACTOR_BOSS_FD2 -ACTOR_EN_FD_FIRE -ACTOR_EN_DH -ACTOR_EN_DHA -ACTOR_EN_RL -ACTOR_EN_ENCOUNT1 -ACTOR_DEMO_DU -ACTOR_DEMO_IM -ACTOR_DEMO_TRE_LGT -ACTOR_EN_FW -ACTOR_BG_VB_SIMA -ACTOR_EN_VB_BALL -ACTOR_BG_HAKA_MEGANE -ACTOR_BG_HAKA_MEGANEBG -ACTOR_BG_HAKA_SHIP -ACTOR_BG_HAKA_SGAMI -ACTOR_UNSET_B2 -ACTOR_EN_HEISHI2 -ACTOR_EN_ENCOUNT2 -ACTOR_EN_FIRE_ROCK -ACTOR_EN_BROB -ACTOR_MIR_RAY -ACTOR_BG_SPOT09_OBJ -ACTOR_BG_SPOT18_OBJ -ACTOR_BOSS_VA -ACTOR_BG_HAKA_TUBO -ACTOR_BG_HAKA_TRAP -ACTOR_BG_HAKA_HUTA -ACTOR_BG_HAKA_ZOU -ACTOR_BG_SPOT17_FUNEN -ACTOR_EN_SYATEKI_ITM -ACTOR_EN_SYATEKI_MAN -ACTOR_EN_TANA -ACTOR_EN_NB -ACTOR_BOSS_MO -ACTOR_EN_SB -ACTOR_EN_BIGOKUTA -ACTOR_EN_KAREBABA -ACTOR_BG_BDAN_OBJECTS -ACTOR_DEMO_SA -ACTOR_DEMO_GO -ACTOR_EN_IN -ACTOR_EN_TR -ACTOR_BG_SPOT16_BOMBSTONE -ACTOR_UNSET_CE -ACTOR_BG_HIDAN_KOWARERUKABE -ACTOR_BG_BOMBWALL -ACTOR_BG_SPOT08_ICEBLOCK -ACTOR_EN_RU2 -ACTOR_OBJ_DEKUJR -ACTOR_BG_MIZU_UZU -ACTOR_BG_SPOT06_OBJECTS -ACTOR_BG_ICE_OBJECTS -ACTOR_BG_HAKA_WATER -ACTOR_UNSET_D8 -ACTOR_EN_MA2 -ACTOR_EN_BOM_CHU -ACTOR_EN_HORSE_GAME_CHECK -ACTOR_BOSS_TW -ACTOR_EN_RR -ACTOR_EN_BA -ACTOR_EN_BX -ACTOR_EN_ANUBICE -ACTOR_EN_ANUBICE_FIRE -ACTOR_BG_MORI_HASHIGO -ACTOR_BG_MORI_HASHIRA4 -ACTOR_BG_MORI_IDOMIZU -ACTOR_BG_SPOT16_DOUGHNUT -ACTOR_BG_BDAN_SWITCH -ACTOR_EN_MA1 -ACTOR_BOSS_GANON -ACTOR_BOSS_SST -ACTOR_UNSET_EA -ACTOR_UNSET_EB -ACTOR_EN_NY -ACTOR_EN_FR -ACTOR_ITEM_SHIELD -ACTOR_BG_ICE_SHELTER -ACTOR_EN_ICE_HONO -ACTOR_ITEM_OCARINA -ACTOR_UNSET_F2 -ACTOR_UNSET_F3 -ACTOR_MAGIC_DARK -ACTOR_DEMO_6K -ACTOR_EN_ANUBICE_TAG -ACTOR_BG_HAKA_GATE -ACTOR_BG_SPOT15_SAKU -ACTOR_BG_JYA_GOROIWA -ACTOR_BG_JYA_ZURERUKABE -ACTOR_UNSET_FB -ACTOR_BG_JYA_COBRA -ACTOR_BG_JYA_KANAAMI -ACTOR_FISHING -ACTOR_OBJ_OSHIHIKI -ACTOR_BG_GATE_SHUTTER -ACTOR_EFF_DUST -ACTOR_BG_SPOT01_FUSYA -ACTOR_BG_SPOT01_IDOHASHIRA -ACTOR_BG_SPOT01_IDOMIZU -ACTOR_BG_PO_SYOKUDAI -ACTOR_BG_GANON_OTYUKA -ACTOR_BG_SPOT15_RRBOX -ACTOR_BG_UMAJUMP -ACTOR_UNSET_109 -ACTOR_ARROW_FIRE -ACTOR_ARROW_ICE -ACTOR_ARROW_LIGHT -ACTOR_UNSET_10D -ACTOR_UNSET_10E -ACTOR_ITEM_ETCETERA -ACTOR_OBJ_KIBAKO -ACTOR_OBJ_TSUBO -ACTOR_EN_WONDER_ITEM -ACTOR_EN_IK -ACTOR_DEMO_IK -ACTOR_EN_SKJ -ACTOR_EN_SKJNEEDLE -ACTOR_EN_G_SWITCH -ACTOR_DEMO_EXT -ACTOR_DEMO_SHD -ACTOR_EN_DNS -ACTOR_ELF_MSG -ACTOR_EN_HONOTRAP -ACTOR_EN_TUBO_TRAP -ACTOR_OBJ_ICE_POLY -ACTOR_BG_SPOT03_TAKI -ACTOR_BG_SPOT07_TAKI -ACTOR_EN_FZ -ACTOR_EN_PO_RELAY -ACTOR_BG_RELAY_OBJECTS -ACTOR_EN_DIVING_GAME -ACTOR_EN_KUSA -ACTOR_OBJ_BEAN -ACTOR_OBJ_BOMBIWA -ACTOR_UNSET_128 -ACTOR_UNSET_129 -ACTOR_OBJ_SWITCH -ACTOR_OBJ_ELEVATOR -ACTOR_OBJ_LIFT -ACTOR_OBJ_HSBLOCK -ACTOR_EN_OKARINA_TAG -ACTOR_EN_YABUSAME_MARK -ACTOR_EN_GOROIWA -ACTOR_EN_EX_RUPPY -ACTOR_EN_TORYO -ACTOR_EN_DAIKU -ACTOR_UNSET_134 -ACTOR_EN_NWC -ACTOR_EN_BLKOBJ -ACTOR_ITEM_INBOX -ACTOR_EN_GE1 -ACTOR_OBJ_BLOCKSTOP -ACTOR_EN_SDA -ACTOR_EN_CLEAR_TAG -ACTOR_EN_NIW_LADY -ACTOR_EN_GM -ACTOR_EN_MS -ACTOR_EN_HS -ACTOR_BG_INGATE -ACTOR_EN_KANBAN -ACTOR_EN_HEISHI3 -ACTOR_EN_SYATEKI_NIW -ACTOR_EN_ATTACK_NIW -ACTOR_BG_SPOT01_IDOSOKO -ACTOR_EN_SA -ACTOR_EN_WONDER_TALK -ACTOR_BG_GJYO_BRIDGE -ACTOR_EN_DS -ACTOR_EN_MK -ACTOR_EN_BOM_BOWL_MAN -ACTOR_EN_BOM_BOWL_PIT -ACTOR_EN_OWL -ACTOR_EN_ISHI -ACTOR_OBJ_HANA -ACTOR_OBJ_LIGHTSWITCH -ACTOR_OBJ_MURE2 -ACTOR_EN_GO -ACTOR_EN_FU -ACTOR_UNSET_154 -ACTOR_EN_CHANGER -ACTOR_BG_JYA_MEGAMI -ACTOR_BG_JYA_LIFT -ACTOR_BG_JYA_BIGMIRROR -ACTOR_BG_JYA_BOMBCHUIWA -ACTOR_BG_JYA_AMISHUTTER -ACTOR_BG_JYA_BOMBIWA -ACTOR_BG_SPOT18_BASKET -ACTOR_UNSET_15D -ACTOR_EN_GANON_ORGAN -ACTOR_EN_SIOFUKI -ACTOR_EN_STREAM -ACTOR_UNSET_161 -ACTOR_EN_MM -ACTOR_EN_KO -ACTOR_EN_KZ -ACTOR_EN_WEATHER_TAG -ACTOR_BG_SST_FLOOR -ACTOR_EN_ANI -ACTOR_EN_EX_ITEM -ACTOR_BG_JYA_IRONOBJ -ACTOR_EN_JS -ACTOR_EN_JSJUTAN -ACTOR_EN_CS -ACTOR_EN_MD -ACTOR_EN_HY -ACTOR_EN_GANON_MANT -ACTOR_EN_OKARINA_EFFECT -ACTOR_EN_MAG -ACTOR_DOOR_GERUDO -ACTOR_ELF_MSG2 -ACTOR_DEMO_GT -ACTOR_EN_PO_FIELD -ACTOR_EFC_ERUPC -ACTOR_BG_ZG -ACTOR_EN_HEISHI4 -ACTOR_EN_ZL3 -ACTOR_BOSS_GANON2 -ACTOR_EN_KAKASI -ACTOR_EN_TAKARA_MAN -ACTOR_OBJ_MAKEOSHIHIKI -ACTOR_OCEFF_SPOT -ACTOR_END_TITLE -ACTOR_UNSET_180 -ACTOR_EN_TORCH -ACTOR_DEMO_EC -ACTOR_SHOT_SUN -ACTOR_EN_DY_EXTRA -ACTOR_EN_WONDER_TALK2 -ACTOR_EN_GE2 -ACTOR_OBJ_ROOMTIMER -ACTOR_EN_SSH -ACTOR_EN_STH -ACTOR_OCEFF_WIPE -ACTOR_OCEFF_STORM -ACTOR_EN_WEIYER -ACTOR_BG_SPOT05_SOKO -ACTOR_BG_JYA_1FLIFT -ACTOR_BG_JYA_HAHENIRON -ACTOR_BG_SPOT12_GATE -ACTOR_BG_SPOT12_SAKU -ACTOR_EN_HINTNUTS -ACTOR_EN_NUTSBALL -ACTOR_BG_SPOT00_BREAK -ACTOR_EN_SHOPNUTS -ACTOR_EN_IT -ACTOR_EN_GELDB -ACTOR_OCEFF_WIPE2 -ACTOR_OCEFF_WIPE3 -ACTOR_EN_NIW_GIRL -ACTOR_EN_DOG -ACTOR_EN_SI -ACTOR_BG_SPOT01_OBJECTS2 -ACTOR_OBJ_COMB -ACTOR_BG_SPOT11_BAKUDANKABE -ACTOR_OBJ_KIBAKO2 -ACTOR_EN_DNT_DEMO -ACTOR_EN_DNT_JIJI -ACTOR_EN_DNT_NOMAL -ACTOR_EN_GUEST -ACTOR_BG_BOM_GUARD -ACTOR_EN_HS2 -ACTOR_DEMO_KEKKAI -ACTOR_BG_SPOT08_BAKUDANKABE -ACTOR_BG_SPOT17_BAKUDANKABE -ACTOR_UNSET_1AA -ACTOR_OBJ_MURE3 -ACTOR_EN_TG -ACTOR_EN_MU -ACTOR_EN_GO2 -ACTOR_EN_WF -ACTOR_EN_SKB -ACTOR_DEMO_GJ -ACTOR_DEMO_GEFF -ACTOR_BG_GND_FIREMEIRO -ACTOR_BG_GND_DARKMEIRO -ACTOR_BG_GND_SOULMEIRO -ACTOR_BG_GND_NISEKABE -ACTOR_BG_GND_ICEBLOCK -ACTOR_EN_GB -ACTOR_EN_GS -ACTOR_BG_MIZU_BWALL -ACTOR_BG_MIZU_SHUTTER -ACTOR_EN_DAIKU_KAKARIKO -ACTOR_BG_BOWL_WALL -ACTOR_EN_WALL_TUBO -ACTOR_EN_PO_DESERT -ACTOR_EN_CROW -ACTOR_DOOR_KILLER -ACTOR_BG_SPOT11_OASIS -ACTOR_BG_SPOT18_FUTA -ACTOR_BG_SPOT18_SHUTTER -ACTOR_EN_MA3 -ACTOR_EN_COW -ACTOR_BG_ICE_TURARA -ACTOR_BG_ICE_SHUTTER -ACTOR_EN_KAKASI2 -ACTOR_EN_KAKASI3 -ACTOR_OCEFF_WIPE4 -ACTOR_EN_EG -ACTOR_BG_MENKURI_NISEKABE -ACTOR_EN_ZO -ACTOR_OBJ_MAKEKINSUTA -ACTOR_EN_GE3 -ACTOR_OBJ_TIMEBLOCK -ACTOR_OBJ_HAMISHI -ACTOR_EN_ZL4 -ACTOR_EN_MM2 -ACTOR_BG_JYA_BLOCK -ACTOR_OBJ_WARP2BLOCK -ACTOR_ID_MAX \ No newline at end of file diff --git a/tools/ZAPDConfigs/EntranceList.txt b/tools/ZAPDConfigs/EntranceList.txt deleted file mode 100644 index 5ff4617df1..0000000000 --- a/tools/ZAPDConfigs/EntranceList.txt +++ /dev/null @@ -1,1556 +0,0 @@ -ENTR_DEKU_TREE_0 -ENTR_DEKU_TREE_0_1 -ENTR_DEKU_TREE_0_2 -ENTR_DEKU_TREE_0_3 -ENTR_DODONGOS_CAVERN_0 -ENTR_DODONGOS_CAVERN_0_1 -ENTR_DODONGOS_CAVERN_0_2 -ENTR_DODONGOS_CAVERN_0_3 -ENTR_GERUDO_TRAINING_GROUND_0 -ENTR_GERUDO_TRAINING_GROUND_0_1 -ENTR_GERUDO_TRAINING_GROUND_0_2 -ENTR_GERUDO_TRAINING_GROUND_0_3 -ENTR_FOREST_TEMPLE_BOSS_0 -ENTR_FOREST_TEMPLE_BOSS_0_1 -ENTR_FOREST_TEMPLE_BOSS_0_2 -ENTR_FOREST_TEMPLE_BOSS_0_3 -ENTR_WATER_TEMPLE_0 -ENTR_WATER_TEMPLE_0_1 -ENTR_WATER_TEMPLE_0_2 -ENTR_WATER_TEMPLE_0_3 -ENTR_UNUSED_6E -ENTR_UNUSED_6E_1 -ENTR_UNUSED_6E_2 -ENTR_UNUSED_6E_3 -ENTR_SASATEST_0 -ENTR_SASATEST_0_1 -ENTR_SASATEST_0_2 -ENTR_SASATEST_0_3 -ENTR_SYOTES_0 -ENTR_SYOTES_0_1 -ENTR_SYOTES_0_2 -ENTR_SYOTES_0_3 -ENTR_SYOTES2_0 -ENTR_SYOTES2_0_1 -ENTR_SYOTES2_0_2 -ENTR_SYOTES2_0_3 -ENTR_TESTROOM_0 -ENTR_TESTROOM_0_1 -ENTR_TESTROOM_0_2 -ENTR_TESTROOM_0_3 -ENTR_JABU_JABU_0 -ENTR_JABU_JABU_0_1 -ENTR_JABU_JABU_0_2 -ENTR_JABU_JABU_0_3 -ENTR_JABU_JABU_0_4 -ENTR_ROYAL_FAMILYS_TOMB_0 -ENTR_ROYAL_FAMILYS_TOMB_0_1 -ENTR_ROYAL_FAMILYS_TOMB_0_2 -ENTR_ROYAL_FAMILYS_TOMB_0_3 -ENTR_ROYAL_FAMILYS_TOMB_0_4 -ENTR_ROYAL_FAMILYS_TOMB_0_5 -ENTR_MARKET_ENTRANCE_DAY_0 -ENTR_MARKET_ENTRANCE_NIGHT_0_1 -ENTR_MARKET_ENTRANCE_RUINS_0_2 -ENTR_MARKET_ENTRANCE_RUINS_0_3 -ENTR_SHADOW_TEMPLE_0 -ENTR_SHADOW_TEMPLE_0_1 -ENTR_SHADOW_TEMPLE_0_2 -ENTR_SHADOW_TEMPLE_0_3 -ENTR_SHOOTING_GALLERY_0 -ENTR_SHOOTING_GALLERY_0_1 -ENTR_SHOOTING_GALLERY_0_2 -ENTR_SHOOTING_GALLERY_0_3 -ENTR_GROTTOS_0 -ENTR_GROTTOS_0_1 -ENTR_GROTTOS_0_2 -ENTR_GROTTOS_0_3 -ENTR_LAKESIDE_LABORATORY_0 -ENTR_LAKESIDE_LABORATORY_0_1 -ENTR_LAKESIDE_LABORATORY_0_2 -ENTR_LAKESIDE_LABORATORY_0_3 -ENTR_SUTARU_0 -ENTR_SUTARU_0_1 -ENTR_SUTARU_0_2 -ENTR_SUTARU_0_3 -ENTR_GRAVE_WITH_FAIRYS_FOUNTAIN_0 -ENTR_GRAVE_WITH_FAIRYS_FOUNTAIN_0_1 -ENTR_GRAVE_WITH_FAIRYS_FOUNTAIN_0_2 -ENTR_GRAVE_WITH_FAIRYS_FOUNTAIN_0_3 -ENTR_LON_LON_BUILDINGS_0 -ENTR_LON_LON_BUILDINGS_0_1 -ENTR_LON_LON_BUILDINGS_0_2 -ENTR_LON_LON_BUILDINGS_0_3 -ENTR_TEMPLE_OF_TIME_0 -ENTR_TEMPLE_OF_TIME_0_1 -ENTR_TEMPLE_OF_TIME_0_2 -ENTR_TEMPLE_OF_TIME_0_3 -ENTR_TEMPLE_OF_TIME_0_4 -ENTR_TEMPLE_OF_TIME_0_5 -ENTR_TEMPLE_OF_TIME_0_6 -ENTR_TEMPLE_OF_TIME_0_7 -ENTR_TEMPLE_OF_TIME_0_8 -ENTR_TEMPLE_OF_TIME_0_9 -ENTR_TEMPLE_OF_TIME_0_10 -ENTR_TEMPLE_OF_TIME_0_11 -ENTR_TEMPLE_OF_TIME_0_12 -ENTR_TEMPLE_OF_TIME_0_13 -ENTR_TEMPLE_OF_TIME_0_14 -ENTR_TEMPLE_OF_TIME_0_15 -ENTR_TREASURE_BOX_SHOP_0 -ENTR_TREASURE_BOX_SHOP_0_1 -ENTR_TREASURE_BOX_SHOP_0_2 -ENTR_TREASURE_BOX_SHOP_0_3 -ENTR_BACK_ALLEY_DAY_3 -ENTR_BACK_ALLEY_NIGHT_3_1 -ENTR_BACK_ALLEY_DAY_3_2 -ENTR_BACK_ALLEY_NIGHT_3_3 -ENTR_CHAMBER_OF_THE_SAGES_0 -ENTR_CHAMBER_OF_THE_SAGES_0_1 -ENTR_CHAMBER_OF_THE_SAGES_0_2 -ENTR_CHAMBER_OF_THE_SAGES_0_3 -ENTR_CHAMBER_OF_THE_SAGES_0_4 -ENTR_CHAMBER_OF_THE_SAGES_0_5 -ENTR_CHAMBER_OF_THE_SAGES_0_6 -ENTR_POTION_SHOP_GRANNY_0 -ENTR_POTION_SHOP_GRANNY_0_1 -ENTR_POTION_SHOP_GRANNY_0_2 -ENTR_POTION_SHOP_GRANNY_0_3 -ENTR_HAIRAL_NIWA2_0 -ENTR_HAIRAL_NIWA2_0_1 -ENTR_HAIRAL_NIWA2_0_2 -ENTR_HAIRAL_NIWA2_0_3 -ENTR_CASTLE_COURTYARD_GUARDS_DAY_0 -ENTR_CASTLE_COURTYARD_GUARDS_NIGHT_0_1 -ENTR_CASTLE_COURTYARD_GUARDS_DAY_0_2 -ENTR_CASTLE_COURTYARD_GUARDS_NIGHT_0_3 -ENTR_MARKET_GUARD_HOUSE_0 -ENTR_MARKET_GUARD_HOUSE_0_1 -ENTR_MARKET_GUARD_HOUSE_0_2 -ENTR_MARKET_GUARD_HOUSE_0_3 -ENTR_SPIRIT_TEMPLE_0 -ENTR_SPIRIT_TEMPLE_0_1 -ENTR_SPIRIT_TEMPLE_0_2 -ENTR_SPIRIT_TEMPLE_0_3 -ENTR_SPIRIT_TEMPLE_0_4 -ENTR_SPIRIT_TEMPLE_0_5 -ENTR_ICE_CAVERN_0 -ENTR_ICE_CAVERN_0_1 -ENTR_ICE_CAVERN_0_2 -ENTR_ICE_CAVERN_0_3 -ENTR_ICE_CAVERN_0_4 -ENTR_SPIRIT_TEMPLE_BOSS_0 -ENTR_SPIRIT_TEMPLE_BOSS_0_1 -ENTR_SPIRIT_TEMPLE_BOSS_0_2 -ENTR_SPIRIT_TEMPLE_BOSS_0_3 -ENTR_SPIRIT_TEMPLE_BOSS_0_4 -ENTR_SPIRIT_TEMPLE_BOSS_0_5 -ENTR_SPIRIT_TEMPLE_BOSS_0_6 -ENTR_TEST01_0 -ENTR_TEST01_0_1 -ENTR_TEST01_0_2 -ENTR_TEST01_0_3 -ENTR_BOTTOM_OF_THE_WELL_0 -ENTR_BOTTOM_OF_THE_WELL_0_1 -ENTR_BOTTOM_OF_THE_WELL_0_2 -ENTR_BOTTOM_OF_THE_WELL_0_3 -ENTR_TWINS_HOUSE_0 -ENTR_TWINS_HOUSE_0_1 -ENTR_TWINS_HOUSE_0_2 -ENTR_TWINS_HOUSE_0_3 -ENTR_CUTSCENE_MAP_0 -ENTR_CUTSCENE_MAP_0_1 -ENTR_CUTSCENE_MAP_0_2 -ENTR_CUTSCENE_MAP_0_3 -ENTR_CUTSCENE_MAP_0_4 -ENTR_CUTSCENE_MAP_0_5 -ENTR_CUTSCENE_MAP_0_6 -ENTR_CUTSCENE_MAP_0_7 -ENTR_CUTSCENE_MAP_0_8 -ENTR_CUTSCENE_MAP_0_9 -ENTR_CUTSCENE_MAP_0_10 -ENTR_CUTSCENE_MAP_0_11 -ENTR_CUTSCENE_MAP_0_12 -ENTR_BACK_ALLEY_DAY_0 -ENTR_BACK_ALLEY_NIGHT_0_1 -ENTR_BACK_ALLEY_DAY_0_2 -ENTR_BACK_ALLEY_NIGHT_0_3 -ENTR_MARKET_DAY_0 -ENTR_MARKET_NIGHT_0_1 -ENTR_MARKET_RUINS_0_2 -ENTR_MARKET_RUINS_0_3 -ENTR_MARKET_DAY_0_4 -ENTR_DEPTH_TEST_0 -ENTR_BAZAAR_0 -ENTR_BAZAAR_0_1 -ENTR_BAZAAR_0_2 -ENTR_BAZAAR_0_3 -ENTR_LINKS_HOUSE_0 -ENTR_LINKS_HOUSE_0_1 -ENTR_LINKS_HOUSE_0_2 -ENTR_LINKS_HOUSE_0_3 -ENTR_LINKS_HOUSE_0_4 -ENTR_LINKS_HOUSE_0_5 -ENTR_KOKIRI_SHOP_0 -ENTR_KOKIRI_SHOP_0_1 -ENTR_KOKIRI_SHOP_0_2 -ENTR_KOKIRI_SHOP_0_3 -ENTR_DODONGOS_CAVERN_1 -ENTR_DODONGOS_CAVERN_1_1 -ENTR_DODONGOS_CAVERN_1_2 -ENTR_DODONGOS_CAVERN_1_3 -ENTR_KNOW_IT_ALL_BROS_HOUSE_0 -ENTR_KNOW_IT_ALL_BROS_HOUSE_0_1 -ENTR_KNOW_IT_ALL_BROS_HOUSE_0_2 -ENTR_KNOW_IT_ALL_BROS_HOUSE_0_3 -ENTR_HYRULE_FIELD_0 -ENTR_HYRULE_FIELD_0_1 -ENTR_HYRULE_FIELD_0_2 -ENTR_HYRULE_FIELD_0_3 -ENTR_HYRULE_FIELD_0_4 -ENTR_HYRULE_FIELD_0_5 -ENTR_HYRULE_FIELD_0_6 -ENTR_HYRULE_FIELD_0_7 -ENTR_HYRULE_FIELD_0_8 -ENTR_HYRULE_FIELD_0_9 -ENTR_HYRULE_FIELD_0_10 -ENTR_HYRULE_FIELD_0_11 -ENTR_HYRULE_FIELD_0_12 -ENTR_HYRULE_FIELD_0_13 -ENTR_KAKARIKO_VILLAGE_0 -ENTR_KAKARIKO_VILLAGE_0_1 -ENTR_KAKARIKO_VILLAGE_0_2 -ENTR_KAKARIKO_VILLAGE_0_3 -ENTR_KAKARIKO_VILLAGE_0_4 -ENTR_KAKARIKO_VILLAGE_0_5 -ENTR_KAKARIKO_VILLAGE_0_6 -ENTR_KAKARIKO_VILLAGE_0_7 -ENTR_KAKARIKO_VILLAGE_0_8 -ENTR_GRAVEYARD_0 -ENTR_GRAVEYARD_0_1 -ENTR_GRAVEYARD_0_2 -ENTR_GRAVEYARD_0_3 -ENTR_GRAVEYARD_0_4 -ENTR_GRAVEYARD_0_5 -ENTR_ZORAS_RIVER_0 -ENTR_ZORAS_RIVER_0_1 -ENTR_ZORAS_RIVER_0_2 -ENTR_ZORAS_RIVER_0_3 -ENTR_KOKIRI_FOREST_0 -ENTR_KOKIRI_FOREST_0_1 -ENTR_KOKIRI_FOREST_0_2 -ENTR_KOKIRI_FOREST_0_3 -ENTR_KOKIRI_FOREST_0_4 -ENTR_KOKIRI_FOREST_0_5 -ENTR_KOKIRI_FOREST_0_6 -ENTR_KOKIRI_FOREST_0_7 -ENTR_KOKIRI_FOREST_0_8 -ENTR_KOKIRI_FOREST_0_9 -ENTR_KOKIRI_FOREST_0_10 -ENTR_KOKIRI_FOREST_0_11 -ENTR_KOKIRI_FOREST_0_12 -ENTR_KOKIRI_FOREST_0_13 -ENTR_SACRED_FOREST_MEADOW_0 -ENTR_SACRED_FOREST_MEADOW_0_1 -ENTR_SACRED_FOREST_MEADOW_0_2 -ENTR_SACRED_FOREST_MEADOW_0_3 -ENTR_SACRED_FOREST_MEADOW_0_4 -ENTR_SACRED_FOREST_MEADOW_0_5 -ENTR_LAKE_HYLIA_0 -ENTR_LAKE_HYLIA_0_1 -ENTR_LAKE_HYLIA_0_2 -ENTR_LAKE_HYLIA_0_3 -ENTR_LAKE_HYLIA_0_4 -ENTR_LAKE_HYLIA_0_5 -ENTR_ZORAS_DOMAIN_0 -ENTR_ZORAS_DOMAIN_0_1 -ENTR_ZORAS_DOMAIN_0_2 -ENTR_ZORAS_DOMAIN_0_3 -ENTR_ZORAS_DOMAIN_0_4 -ENTR_ZORAS_DOMAIN_0_5 -ENTR_ZORAS_FOUNTAIN_0 -ENTR_ZORAS_FOUNTAIN_0_1 -ENTR_ZORAS_FOUNTAIN_0_2 -ENTR_ZORAS_FOUNTAIN_0_3 -ENTR_ZORAS_FOUNTAIN_0_4 -ENTR_ZORAS_FOUNTAIN_0_5 -ENTR_ZORAS_FOUNTAIN_0_6 -ENTR_ZORAS_FOUNTAIN_0_7 -ENTR_ZORAS_FOUNTAIN_0_8 -ENTR_GERUDO_VALLEY_0 -ENTR_GERUDO_VALLEY_0_1 -ENTR_GERUDO_VALLEY_0_2 -ENTR_GERUDO_VALLEY_0_3 -ENTR_GERUDO_VALLEY_0_4 -ENTR_GERUDO_VALLEY_0_5 -ENTR_GERUDO_VALLEY_0_6 -ENTR_LOST_WOODS_0 -ENTR_LOST_WOODS_0_1 -ENTR_LOST_WOODS_0_2 -ENTR_LOST_WOODS_0_3 -ENTR_LOST_WOODS_0_4 -ENTR_DESERT_COLOSSUS_0 -ENTR_DESERT_COLOSSUS_0_1 -ENTR_DESERT_COLOSSUS_0_2 -ENTR_DESERT_COLOSSUS_0_3 -ENTR_DESERT_COLOSSUS_0_4 -ENTR_DESERT_COLOSSUS_0_5 -ENTR_GERUDOS_FORTRESS_0 -ENTR_GERUDOS_FORTRESS_0_1 -ENTR_GERUDOS_FORTRESS_0_2 -ENTR_GERUDOS_FORTRESS_0_3 -ENTR_GERUDOS_FORTRESS_0_4 -ENTR_GERUDOS_FORTRESS_0_5 -ENTR_GERUDOS_FORTRESS_0_6 -ENTR_HAUNTED_WASTELAND_0 -ENTR_HAUNTED_WASTELAND_0_1 -ENTR_HAUNTED_WASTELAND_0_2 -ENTR_HAUNTED_WASTELAND_0_3 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_1 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_1_1 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_1_2 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_1_3 -ENTR_HYRULE_CASTLE_0 -ENTR_HYRULE_CASTLE_0_1 -ENTR_OUTSIDE_GANONS_CASTLE_0_2 -ENTR_OUTSIDE_GANONS_CASTLE_0_3 -ENTR_OUTSIDE_GANONS_CASTLE_0_4 -ENTR_DEATH_MOUNTAIN_TRAIL_0 -ENTR_DEATH_MOUNTAIN_TRAIL_0_1 -ENTR_DEATH_MOUNTAIN_TRAIL_0_2 -ENTR_DEATH_MOUNTAIN_TRAIL_0_3 -ENTR_DEATH_MOUNTAIN_TRAIL_0_4 -ENTR_DEATH_MOUNTAIN_TRAIL_0_5 -ENTR_DEATH_MOUNTAIN_TRAIL_0_6 -ENTR_DEATH_MOUNTAIN_TRAIL_0_7 -ENTR_DEATH_MOUNTAIN_TRAIL_0_8 -ENTR_DEATH_MOUNTAIN_TRAIL_0_9 -ENTR_DEATH_MOUNTAIN_CRATER_0 -ENTR_DEATH_MOUNTAIN_CRATER_0_1 -ENTR_DEATH_MOUNTAIN_CRATER_0_2 -ENTR_DEATH_MOUNTAIN_CRATER_0_3 -ENTR_DEATH_MOUNTAIN_CRATER_0_4 -ENTR_DEATH_MOUNTAIN_CRATER_0_5 -ENTR_GORON_CITY_0 -ENTR_GORON_CITY_0_1 -ENTR_GORON_CITY_0_2 -ENTR_GORON_CITY_0_3 -ENTR_GORON_CITY_0_4 -ENTR_GORON_CITY_0_5 -ENTR_ZORAS_DOMAIN_3 -ENTR_ZORAS_DOMAIN_3_1 -ENTR_ZORAS_DOMAIN_3_2 -ENTR_ZORAS_DOMAIN_3_3 -ENTR_LON_LON_RANCH_0 -ENTR_LON_LON_RANCH_0_1 -ENTR_LON_LON_RANCH_0_2 -ENTR_LON_LON_RANCH_0_3 -ENTR_LON_LON_RANCH_0_4 -ENTR_LON_LON_RANCH_0_5 -ENTR_LON_LON_RANCH_0_6 -ENTR_LON_LON_RANCH_0_7 -ENTR_LON_LON_RANCH_0_8 -ENTR_LON_LON_RANCH_0_9 -ENTR_LON_LON_RANCH_0_10 -ENTR_LON_LON_RANCH_0_11 -ENTR_LON_LON_RANCH_0_12 -ENTR_LON_LON_RANCH_0_13 -ENTR_FIRE_TEMPLE_0 -ENTR_FIRE_TEMPLE_0_1 -ENTR_FIRE_TEMPLE_0_2 -ENTR_FIRE_TEMPLE_0_3 -ENTR_FOREST_TEMPLE_0 -ENTR_FOREST_TEMPLE_0_1 -ENTR_FOREST_TEMPLE_0_2 -ENTR_FOREST_TEMPLE_0_3 -ENTR_SHOOTING_GALLERY_1 -ENTR_SHOOTING_GALLERY_1_1 -ENTR_SHOOTING_GALLERY_1_2 -ENTR_SHOOTING_GALLERY_1_3 -ENTR_TEMPLE_OF_TIME_EXTERIOR_DAY_0 -ENTR_TEMPLE_OF_TIME_EXTERIOR_NIGHT_0_1 -ENTR_TEMPLE_OF_TIME_EXTERIOR_RUINS_0_2 -ENTR_TEMPLE_OF_TIME_EXTERIOR_RUINS_0_3 -ENTR_FIRE_TEMPLE_1 -ENTR_FIRE_TEMPLE_1_1 -ENTR_FIRE_TEMPLE_1_2 -ENTR_FIRE_TEMPLE_1_3 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_0 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_0_1 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_0_2 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_0_3 -ENTR_HYRULE_FIELD_1 -ENTR_HYRULE_FIELD_1_1 -ENTR_HYRULE_FIELD_1_2 -ENTR_HYRULE_FIELD_1_3 -ENTR_HYRULE_FIELD_2 -ENTR_HYRULE_FIELD_2_1 -ENTR_HYRULE_FIELD_2_2 -ENTR_HYRULE_FIELD_2_3 -ENTR_HYRULE_FIELD_3 -ENTR_HYRULE_FIELD_3_1 -ENTR_HYRULE_FIELD_3_2 -ENTR_HYRULE_FIELD_3_3 -ENTR_HYRULE_FIELD_4 -ENTR_HYRULE_FIELD_4_1 -ENTR_HYRULE_FIELD_4_2 -ENTR_HYRULE_FIELD_4_3 -ENTR_HYRULE_FIELD_5 -ENTR_HYRULE_FIELD_5_1 -ENTR_HYRULE_FIELD_5_2 -ENTR_HYRULE_FIELD_5_3 -ENTR_KAKARIKO_VILLAGE_1 -ENTR_KAKARIKO_VILLAGE_1_1 -ENTR_KAKARIKO_VILLAGE_1_2 -ENTR_KAKARIKO_VILLAGE_1_3 -ENTR_KAKARIKO_VILLAGE_2 -ENTR_KAKARIKO_VILLAGE_2_1 -ENTR_KAKARIKO_VILLAGE_2_2 -ENTR_KAKARIKO_VILLAGE_2_3 -ENTR_ZORAS_RIVER_1 -ENTR_ZORAS_RIVER_1_1 -ENTR_ZORAS_RIVER_1_2 -ENTR_ZORAS_RIVER_1_3 -ENTR_ZORAS_RIVER_2 -ENTR_ZORAS_RIVER_2_1 -ENTR_ZORAS_RIVER_2_2 -ENTR_ZORAS_RIVER_2_3 -ENTR_ZORAS_DOMAIN_1 -ENTR_ZORAS_DOMAIN_1_1 -ENTR_ZORAS_DOMAIN_1_2 -ENTR_ZORAS_DOMAIN_1_3 -ENTR_GERUDO_VALLEY_1 -ENTR_GERUDO_VALLEY_1_1 -ENTR_GERUDO_VALLEY_1_2 -ENTR_GERUDO_VALLEY_1_3 -ENTR_LOST_WOODS_1 -ENTR_LOST_WOODS_1_1 -ENTR_LOST_WOODS_1_2 -ENTR_LOST_WOODS_1_3 -ENTR_LOST_WOODS_2 -ENTR_LOST_WOODS_2_1 -ENTR_LOST_WOODS_2_2 -ENTR_LOST_WOODS_2_3 -ENTR_LOST_WOODS_3 -ENTR_LOST_WOODS_3_1 -ENTR_LOST_WOODS_3_2 -ENTR_LOST_WOODS_3_3 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_2 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_2_1 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_2_2 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_2_3 -ENTR_DEATH_MOUNTAIN_TRAIL_1 -ENTR_DEATH_MOUNTAIN_TRAIL_1_1 -ENTR_DEATH_MOUNTAIN_TRAIL_1_2 -ENTR_DEATH_MOUNTAIN_TRAIL_1_3 -ENTR_DEATH_MOUNTAIN_TRAIL_2 -ENTR_DEATH_MOUNTAIN_TRAIL_2_1 -ENTR_DEATH_MOUNTAIN_TRAIL_2_2 -ENTR_DEATH_MOUNTAIN_TRAIL_2_3 -ENTR_GORON_CITY_1 -ENTR_GORON_CITY_1_1 -ENTR_GORON_CITY_1_2 -ENTR_GORON_CITY_1_3 -ENTR_LAKESIDE_LABORATORY_1 -ENTR_LAKESIDE_LABORATORY_1_1 -ENTR_LAKESIDE_LABORATORY_1_2 -ENTR_LAKESIDE_LABORATORY_1_3 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_5 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_5_1 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_5_2 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_5_3 -ENTR_MARKET_DAY_8 -ENTR_MARKET_NIGHT_8_1 -ENTR_MARKET_RUINS_8_2 -ENTR_MARKET_RUINS_8_3 -ENTR_MARKET_DAY_9 -ENTR_MARKET_NIGHT_9_1 -ENTR_MARKET_RUINS_9_2 -ENTR_MARKET_RUINS_9_3 -ENTR_MARKET_DAY_10 -ENTR_MARKET_NIGHT_10_1 -ENTR_MARKET_RUINS_10_2 -ENTR_MARKET_RUINS_10_3 -ENTR_ZORAS_RIVER_3 -ENTR_ZORAS_RIVER_3_1 -ENTR_ZORAS_RIVER_3_2 -ENTR_ZORAS_RIVER_3_3 -ENTR_ZORAS_RIVER_4 -ENTR_ZORAS_RIVER_4_1 -ENTR_ZORAS_RIVER_4_2 -ENTR_ZORAS_RIVER_4_3 -ENTR_DESERT_COLOSSUS_1 -ENTR_DESERT_COLOSSUS_1_1 -ENTR_DESERT_COLOSSUS_1_2 -ENTR_DESERT_COLOSSUS_1_3 -ENTR_DESERT_COLOSSUS_2 -ENTR_DESERT_COLOSSUS_2_1 -ENTR_DESERT_COLOSSUS_2_2 -ENTR_DESERT_COLOSSUS_2_3 -ENTR_DESERT_COLOSSUS_3 -ENTR_DESERT_COLOSSUS_3_1 -ENTR_DESERT_COLOSSUS_3_2 -ENTR_DESERT_COLOSSUS_3_3 -ENTR_DESERT_COLOSSUS_4 -ENTR_DESERT_COLOSSUS_4_1 -ENTR_DESERT_COLOSSUS_4_2 -ENTR_DESERT_COLOSSUS_4_3 -ENTR_DESERT_COLOSSUS_5 -ENTR_DESERT_COLOSSUS_5_1 -ENTR_DESERT_COLOSSUS_5_2 -ENTR_DESERT_COLOSSUS_5_3 -ENTR_DESERT_COLOSSUS_6 -ENTR_DESERT_COLOSSUS_6_1 -ENTR_DESERT_COLOSSUS_6_2 -ENTR_DESERT_COLOSSUS_6_3 -ENTR_HYRULE_FIELD_6 -ENTR_HYRULE_FIELD_6_1 -ENTR_HYRULE_FIELD_6_2 -ENTR_HYRULE_FIELD_6_3 -ENTR_HYRULE_FIELD_7 -ENTR_HYRULE_FIELD_7_1 -ENTR_HYRULE_FIELD_7_2 -ENTR_HYRULE_FIELD_7_3 -ENTR_KAKARIKO_VILLAGE_3 -ENTR_KAKARIKO_VILLAGE_3_1 -ENTR_KAKARIKO_VILLAGE_3_2 -ENTR_KAKARIKO_VILLAGE_3_3 -ENTR_GRAVEYARD_1 -ENTR_GRAVEYARD_1_1 -ENTR_GRAVEYARD_1_2 -ENTR_GRAVEYARD_1_3 -ENTR_KOKIRI_FOREST_1 -ENTR_KOKIRI_FOREST_1_1 -ENTR_KOKIRI_FOREST_1_2 -ENTR_KOKIRI_FOREST_1_3 -ENTR_KOKIRI_FOREST_2 -ENTR_KOKIRI_FOREST_2_1 -ENTR_KOKIRI_FOREST_2_2 -ENTR_KOKIRI_FOREST_2_3 -ENTR_KOKIRI_FOREST_3 -ENTR_KOKIRI_FOREST_3_1 -ENTR_KOKIRI_FOREST_3_2 -ENTR_KOKIRI_FOREST_3_3 -ENTR_SACRED_FOREST_MEADOW_1 -ENTR_SACRED_FOREST_MEADOW_1_1 -ENTR_SACRED_FOREST_MEADOW_1_2 -ENTR_SACRED_FOREST_MEADOW_1_3 -ENTR_LAKE_HYLIA_1 -ENTR_LAKE_HYLIA_1_1 -ENTR_LAKE_HYLIA_1_2 -ENTR_LAKE_HYLIA_1_3 -ENTR_LAKE_HYLIA_2 -ENTR_LAKE_HYLIA_2_1 -ENTR_LAKE_HYLIA_2_2 -ENTR_LAKE_HYLIA_2_3 -ENTR_ZORAS_FOUNTAIN_1 -ENTR_ZORAS_FOUNTAIN_1_1 -ENTR_ZORAS_FOUNTAIN_1_2 -ENTR_ZORAS_FOUNTAIN_1_3 -ENTR_ZORAS_FOUNTAIN_2 -ENTR_ZORAS_FOUNTAIN_2_1 -ENTR_ZORAS_FOUNTAIN_2_2 -ENTR_ZORAS_FOUNTAIN_2_3 -ENTR_GERUDO_VALLEY_2 -ENTR_GERUDO_VALLEY_2_1 -ENTR_GERUDO_VALLEY_2_2 -ENTR_GERUDO_VALLEY_2_3 -ENTR_GERUDO_VALLEY_3 -ENTR_GERUDO_VALLEY_3_1 -ENTR_GERUDO_VALLEY_3_2 -ENTR_GERUDO_VALLEY_3_3 -ENTR_GERUDOS_FORTRESS_1 -ENTR_GERUDOS_FORTRESS_1_1 -ENTR_GERUDOS_FORTRESS_1_2 -ENTR_GERUDOS_FORTRESS_1_3 -ENTR_GERUDOS_FORTRESS_2 -ENTR_GERUDOS_FORTRESS_2_1 -ENTR_GERUDOS_FORTRESS_2_2 -ENTR_GERUDOS_FORTRESS_2_3 -ENTR_GERUDOS_FORTRESS_3 -ENTR_GERUDOS_FORTRESS_3_1 -ENTR_GERUDOS_FORTRESS_3_2 -ENTR_GERUDOS_FORTRESS_3_3 -ENTR_HYRULE_CASTLE_1 -ENTR_HYRULE_CASTLE_1_1 -ENTR_OUTSIDE_GANONS_CASTLE_1_2 -ENTR_OUTSIDE_GANONS_CASTLE_1_3 -ENTR_HYRULE_CASTLE_1_4 -ENTR_DEATH_MOUNTAIN_TRAIL_3 -ENTR_DEATH_MOUNTAIN_TRAIL_3_1 -ENTR_DEATH_MOUNTAIN_TRAIL_3_2 -ENTR_DEATH_MOUNTAIN_TRAIL_3_3 -ENTR_DEATH_MOUNTAIN_CRATER_1 -ENTR_DEATH_MOUNTAIN_CRATER_1_1 -ENTR_DEATH_MOUNTAIN_CRATER_1_2 -ENTR_DEATH_MOUNTAIN_CRATER_1_3 -ENTR_DEATH_MOUNTAIN_CRATER_2 -ENTR_DEATH_MOUNTAIN_CRATER_2_1 -ENTR_DEATH_MOUNTAIN_CRATER_2_2 -ENTR_DEATH_MOUNTAIN_CRATER_2_3 -ENTR_FOREST_TEMPLE_1 -ENTR_FOREST_TEMPLE_1_1 -ENTR_FOREST_TEMPLE_1_2 -ENTR_FOREST_TEMPLE_1_3 -ENTR_DEKU_TREE_1 -ENTR_DEKU_TREE_1_1 -ENTR_DEKU_TREE_1_2 -ENTR_DEKU_TREE_1_3 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_3 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_3_1 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_3_2 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_3_3 -ENTR_MARKET_DAY_1 -ENTR_MARKET_NIGHT_1_1 -ENTR_MARKET_RUINS_1_2 -ENTR_MARKET_RUINS_1_3 -ENTR_MARKET_DAY_2 -ENTR_MARKET_NIGHT_2_1 -ENTR_MARKET_RUINS_2_2 -ENTR_MARKET_RUINS_2_3 -ENTR_MARKET_DAY_3 -ENTR_MARKET_NIGHT_3_1 -ENTR_MARKET_RUINS_3_2 -ENTR_MARKET_RUINS_3_3 -ENTR_KOKIRI_FOREST_4 -ENTR_KOKIRI_FOREST_4_1 -ENTR_KOKIRI_FOREST_4_2 -ENTR_KOKIRI_FOREST_4_3 -ENTR_KOKIRI_FOREST_5 -ENTR_KOKIRI_FOREST_5_1 -ENTR_KOKIRI_FOREST_5_2 -ENTR_KOKIRI_FOREST_5_3 -ENTR_MARKET_ENTRANCE_DAY_2 -ENTR_MARKET_ENTRANCE_NIGHT_2_1 -ENTR_MARKET_ENTRANCE_RUINS_2_2 -ENTR_MARKET_ENTRANCE_RUINS_2_3 -ENTR_LINKS_HOUSE_1 -ENTR_LINKS_HOUSE_1_1 -ENTR_LINKS_HOUSE_1_2 -ENTR_LINKS_HOUSE_1_3 -ENTR_MARKET_ENTRANCE_DAY_1 -ENTR_MARKET_ENTRANCE_NIGHT_1_1 -ENTR_MARKET_ENTRANCE_RUINS_1_2 -ENTR_MARKET_ENTRANCE_RUINS_1_3 -ENTR_HYRULE_FIELD_8 -ENTR_HYRULE_FIELD_8_1 -ENTR_HYRULE_FIELD_8_2 -ENTR_HYRULE_FIELD_8_3 -ENTR_HYRULE_FIELD_9 -ENTR_HYRULE_FIELD_9_1 -ENTR_HYRULE_FIELD_9_2 -ENTR_HYRULE_FIELD_9_3 -ENTR_HYRULE_FIELD_10 -ENTR_HYRULE_FIELD_10_1 -ENTR_HYRULE_FIELD_10_2 -ENTR_HYRULE_FIELD_10_3 -ENTR_KOKIRI_FOREST_6 -ENTR_KOKIRI_FOREST_6_1 -ENTR_KOKIRI_FOREST_6_2 -ENTR_KOKIRI_FOREST_6_3 -ENTR_HYRULE_FIELD_11 -ENTR_HYRULE_FIELD_11_1 -ENTR_HYRULE_FIELD_11_2 -ENTR_HYRULE_FIELD_11_3 -ENTR_HYRULE_FIELD_12 -ENTR_HYRULE_FIELD_12_1 -ENTR_HYRULE_FIELD_12_2 -ENTR_HYRULE_FIELD_12_3 -ENTR_HYRULE_FIELD_13 -ENTR_HYRULE_FIELD_13_1 -ENTR_HYRULE_FIELD_13_2 -ENTR_HYRULE_FIELD_13_3 -ENTR_CASTLE_COURTYARD_GUARDS_DAY_1 -ENTR_CASTLE_COURTYARD_GUARDS_NIGHT_1_1 -ENTR_CASTLE_COURTYARD_GUARDS_DAY_1_2 -ENTR_CASTLE_COURTYARD_GUARDS_NIGHT_1_3 -ENTR_BACK_ALLEY_DAY_1 -ENTR_BACK_ALLEY_NIGHT_1_1 -ENTR_BACK_ALLEY_DAY_1_2 -ENTR_BACK_ALLEY_NIGHT_1_3 -ENTR_MARKET_DAY_4 -ENTR_MARKET_NIGHT_4_1 -ENTR_MARKET_RUINS_4_2 -ENTR_MARKET_RUINS_4_3 -ENTR_MARKET_DAY_5 -ENTR_MARKET_NIGHT_5_1 -ENTR_MARKET_RUINS_5_2 -ENTR_MARKET_RUINS_5_3 -ENTR_KAKARIKO_VILLAGE_4 -ENTR_KAKARIKO_VILLAGE_4_1 -ENTR_KAKARIKO_VILLAGE_4_2 -ENTR_KAKARIKO_VILLAGE_4_3 -ENTR_GERUDOS_FORTRESS_4 -ENTR_GERUDOS_FORTRESS_4_1 -ENTR_GERUDOS_FORTRESS_4_2 -ENTR_GERUDOS_FORTRESS_4_3 -ENTR_LON_LON_RANCH_1 -ENTR_LON_LON_RANCH_1_1 -ENTR_LON_LON_RANCH_1_2 -ENTR_LON_LON_RANCH_1_3 -ENTR_SHADOW_TEMPLE_1 -ENTR_SHADOW_TEMPLE_1_1 -ENTR_SHADOW_TEMPLE_1_2 -ENTR_SHADOW_TEMPLE_1_3 -ENTR_SHADOW_TEMPLE_2 -ENTR_SHADOW_TEMPLE_2_1 -ENTR_SHADOW_TEMPLE_2_2 -ENTR_SHADOW_TEMPLE_2_3 -ENTR_GERUDOS_FORTRESS_5 -ENTR_GERUDOS_FORTRESS_5_1 -ENTR_GERUDOS_FORTRESS_5_2 -ENTR_GERUDOS_FORTRESS_5_3 -ENTR_GERUDOS_FORTRESS_6 -ENTR_GERUDOS_FORTRESS_6_1 -ENTR_GERUDOS_FORTRESS_6_2 -ENTR_GERUDOS_FORTRESS_6_3 -ENTR_GERUDOS_FORTRESS_7 -ENTR_GERUDOS_FORTRESS_7_1 -ENTR_GERUDOS_FORTRESS_7_2 -ENTR_GERUDOS_FORTRESS_7_3 -ENTR_GERUDOS_FORTRESS_8 -ENTR_GERUDOS_FORTRESS_8_1 -ENTR_GERUDOS_FORTRESS_8_2 -ENTR_GERUDOS_FORTRESS_8_3 -ENTR_TEMPLE_OF_TIME_2 -ENTR_TEMPLE_OF_TIME_2_1 -ENTR_TEMPLE_OF_TIME_2_2 -ENTR_TEMPLE_OF_TIME_2_3 -ENTR_CHAMBER_OF_THE_SAGES_1 -ENTR_CHAMBER_OF_THE_SAGES_1_1 -ENTR_CHAMBER_OF_THE_SAGES_1_2 -ENTR_CHAMBER_OF_THE_SAGES_1_3 -ENTR_GERUDOS_FORTRESS_9 -ENTR_GERUDOS_FORTRESS_9_1 -ENTR_GERUDOS_FORTRESS_9_2 -ENTR_GERUDOS_FORTRESS_9_3 -ENTR_GERUDOS_FORTRESS_10 -ENTR_GERUDOS_FORTRESS_10_1 -ENTR_GERUDOS_FORTRESS_10_2 -ENTR_GERUDOS_FORTRESS_10_3 -ENTR_GERUDOS_FORTRESS_11 -ENTR_GERUDOS_FORTRESS_11_1 -ENTR_GERUDOS_FORTRESS_11_2 -ENTR_GERUDOS_FORTRESS_11_3 -ENTR_GERUDOS_FORTRESS_12 -ENTR_GERUDOS_FORTRESS_12_1 -ENTR_GERUDOS_FORTRESS_12_2 -ENTR_GERUDOS_FORTRESS_12_3 -ENTR_LON_LON_RANCH_2 -ENTR_LON_LON_RANCH_2_1 -ENTR_LON_LON_RANCH_2_2 -ENTR_LON_LON_RANCH_2_3 -ENTR_LON_LON_RANCH_3 -ENTR_LON_LON_RANCH_3_1 -ENTR_LON_LON_RANCH_3_2 -ENTR_LON_LON_RANCH_3_3 -ENTR_TEST_SHOOTING_GALLERY_0 -ENTR_TEST_SHOOTING_GALLERY_0_1 -ENTR_TEST_SHOOTING_GALLERY_0_2 -ENTR_TEST_SHOOTING_GALLERY_0_3 -ENTR_TEST_SACRED_FOREST_MEADOW_0_4 -ENTR_TEST_CUTSCENE_MAP_0_5 -ENTR_TEST_SHOOTING_GALLERY_0_6 -ENTR_TEST_SHOOTING_GALLERY_0_7 -ENTR_TEST_SHOOTING_GALLERY_0_8 -ENTR_TEST_SHOOTING_GALLERY_0_9 -ENTR_TEST_SHOOTING_GALLERY_0_10 -ENTR_SPIRIT_TEMPLE_1 -ENTR_SPIRIT_TEMPLE_1_1 -ENTR_SPIRIT_TEMPLE_1_2 -ENTR_SPIRIT_TEMPLE_1_3 -ENTR_STABLE_0 -ENTR_STABLE_0_1 -ENTR_STABLE_0_2 -ENTR_STABLE_0_3 -ENTR_KAKARIKO_CENTER_GUEST_HOUSE_0 -ENTR_KAKARIKO_CENTER_GUEST_HOUSE_0_1 -ENTR_KAKARIKO_CENTER_GUEST_HOUSE_0_2 -ENTR_KAKARIKO_CENTER_GUEST_HOUSE_0_3 -ENTR_JABU_JABU_BOSS_0 -ENTR_JABU_JABU_BOSS_0_1 -ENTR_JABU_JABU_BOSS_0_2 -ENTR_JABU_JABU_BOSS_0_3 -ENTR_FIRE_TEMPLE_BOSS_0 -ENTR_FIRE_TEMPLE_BOSS_0_1 -ENTR_FIRE_TEMPLE_BOSS_0_2 -ENTR_FIRE_TEMPLE_BOSS_0_3 -ENTR_LAKE_HYLIA_6 -ENTR_LAKE_HYLIA_6_1 -ENTR_LAKE_HYLIA_6_2 -ENTR_LAKE_HYLIA_6_3 -ENTR_GRAVEKEEPERS_HUT_0 -ENTR_GRAVEKEEPERS_HUT_0_1 -ENTR_GRAVEKEEPERS_HUT_0_2 -ENTR_GRAVEKEEPERS_HUT_0_3 -ENTR_HYRULE_FIELD_14 -ENTR_HYRULE_FIELD_14_1 -ENTR_HYRULE_FIELD_14_2 -ENTR_HYRULE_FIELD_14_3 -ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_0 -ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_0_1 -ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_0_2 -ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_0_3 -ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_0_4 -ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_0_5 -ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_0_6 -ENTR_REDEAD_GRAVE_0 -ENTR_REDEAD_GRAVE_0_1 -ENTR_REDEAD_GRAVE_0_2 -ENTR_REDEAD_GRAVE_0_3 -ENTR_TEMPLE_OF_TIME_3 -ENTR_TEMPLE_OF_TIME_3_1 -ENTR_TEMPLE_OF_TIME_3_2 -ENTR_TEMPLE_OF_TIME_3_3 -ENTR_TEMPLE_OF_TIME_4 -ENTR_TEMPLE_OF_TIME_4_1 -ENTR_TEMPLE_OF_TIME_4_2 -ENTR_TEMPLE_OF_TIME_4_3 -ENTR_ZORAS_DOMAIN_4 -ENTR_ZORAS_DOMAIN_4_1 -ENTR_ZORAS_DOMAIN_4_2 -ENTR_ZORAS_DOMAIN_4_3 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_2 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_2_1 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_2_2 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_2_3 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_3 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_3_1 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_3_2 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_3_3 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_4 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_4_1 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_4_2 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_4_3 -ENTR_KOKIRI_FOREST_7 -ENTR_KOKIRI_FOREST_7_1 -ENTR_KOKIRI_FOREST_7_2 -ENTR_KOKIRI_FOREST_7_3 -ENTR_KOKIRI_FOREST_8 -ENTR_KOKIRI_FOREST_8_1 -ENTR_KOKIRI_FOREST_8_2 -ENTR_KOKIRI_FOREST_8_3 -ENTR_HYRULE_CASTLE_2 -ENTR_HYRULE_CASTLE_2_1 -ENTR_OUTSIDE_GANONS_CASTLE_2_2 -ENTR_OUTSIDE_GANONS_CASTLE_2_3 -ENTR_HYRULE_CASTLE_2_4 -ENTR_KAKARIKO_VILLAGE_5 -ENTR_KAKARIKO_VILLAGE_5_1 -ENTR_KAKARIKO_VILLAGE_5_2 -ENTR_KAKARIKO_VILLAGE_5_3 -ENTR_KAKARIKO_VILLAGE_6 -ENTR_KAKARIKO_VILLAGE_6_1 -ENTR_KAKARIKO_VILLAGE_6_2 -ENTR_KAKARIKO_VILLAGE_6_3 -ENTR_KAKARIKO_VILLAGE_7 -ENTR_KAKARIKO_VILLAGE_7_1 -ENTR_KAKARIKO_VILLAGE_7_2 -ENTR_KAKARIKO_VILLAGE_7_3 -ENTR_KAKARIKO_VILLAGE_8 -ENTR_KAKARIKO_VILLAGE_8_1 -ENTR_KAKARIKO_VILLAGE_8_2 -ENTR_KAKARIKO_VILLAGE_8_3 -ENTR_GRAVEYARD_2 -ENTR_GRAVEYARD_2_1 -ENTR_GRAVEYARD_2_2 -ENTR_GRAVEYARD_2_3 -ENTR_GRAVEYARD_3 -ENTR_GRAVEYARD_3_1 -ENTR_GRAVEYARD_3_2 -ENTR_GRAVEYARD_3_3 -ENTR_GRAVEYARD_4 -ENTR_GRAVEYARD_4_1 -ENTR_GRAVEYARD_4_2 -ENTR_GRAVEYARD_4_3 -ENTR_GRAVEYARD_5 -ENTR_GRAVEYARD_5_1 -ENTR_GRAVEYARD_5_2 -ENTR_GRAVEYARD_5_3 -ENTR_HAUNTED_WASTELAND_1 -ENTR_HAUNTED_WASTELAND_1_1 -ENTR_HAUNTED_WASTELAND_1_2 -ENTR_HAUNTED_WASTELAND_1_3 -ENTR_HAUNTED_WASTELAND_2 -ENTR_HAUNTED_WASTELAND_2_1 -ENTR_HAUNTED_WASTELAND_2_2 -ENTR_HAUNTED_WASTELAND_2_3 -ENTR_FAIRYS_FOUNTAIN_0 -ENTR_FAIRYS_FOUNTAIN_0_1 -ENTR_FAIRYS_FOUNTAIN_0_2 -ENTR_FAIRYS_FOUNTAIN_0_3 -ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_0 -ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_0_1 -ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_0_2 -ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_0_3 -ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_0_4 -ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_0_5 -ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_0_6 -ENTR_LON_LON_RANCH_4 -ENTR_LON_LON_RANCH_4_1 -ENTR_LON_LON_RANCH_4_2 -ENTR_LON_LON_RANCH_4_3 -ENTR_GORON_SHOP_0 -ENTR_GORON_SHOP_0_1 -ENTR_GORON_SHOP_0_2 -ENTR_GORON_SHOP_0_3 -ENTR_ZORA_SHOP_0 -ENTR_ZORA_SHOP_0_1 -ENTR_ZORA_SHOP_0_2 -ENTR_ZORA_SHOP_0_3 -ENTR_POTION_SHOP_KAKARIKO_0 -ENTR_POTION_SHOP_KAKARIKO_0_1 -ENTR_POTION_SHOP_KAKARIKO_0_2 -ENTR_POTION_SHOP_KAKARIKO_0_3 -ENTR_POTION_SHOP_MARKET_0 -ENTR_POTION_SHOP_MARKET_0_1 -ENTR_POTION_SHOP_MARKET_0_2 -ENTR_POTION_SHOP_MARKET_0_3 -ENTR_BACK_ALLEY_DAY_4 -ENTR_BACK_ALLEY_NIGHT_4_1 -ENTR_BACK_ALLEY_DAY_4_2 -ENTR_BACK_ALLEY_NIGHT_4_3 -ENTR_BOMBCHU_SHOP_0 -ENTR_BOMBCHU_SHOP_0_1 -ENTR_BOMBCHU_SHOP_0_2 -ENTR_BOMBCHU_SHOP_0_3 -ENTR_ZORAS_FOUNTAIN_5 -ENTR_ZORAS_FOUNTAIN_5_1 -ENTR_ZORAS_FOUNTAIN_5_2 -ENTR_ZORAS_FOUNTAIN_5_3 -ENTR_DOG_LADY_HOUSE_0 -ENTR_DOG_LADY_HOUSE_0_1 -ENTR_DOG_LADY_HOUSE_0_2 -ENTR_DOG_LADY_HOUSE_0_3 -ENTR_IMPAS_HOUSE_0 -ENTR_IMPAS_HOUSE_0_1 -ENTR_IMPAS_HOUSE_0_2 -ENTR_IMPAS_HOUSE_0_3 -ENTR_CARPENTERS_TENT_0 -ENTR_CARPENTERS_TENT_0_1 -ENTR_CARPENTERS_TENT_0_2 -ENTR_CARPENTERS_TENT_0_3 -ENTR_GERUDOS_FORTRESS_13 -ENTR_GERUDOS_FORTRESS_13_1 -ENTR_GERUDOS_FORTRESS_13_2 -ENTR_GERUDOS_FORTRESS_13_3 -ENTR_GERUDOS_FORTRESS_14 -ENTR_GERUDOS_FORTRESS_14_1 -ENTR_GERUDOS_FORTRESS_14_2 -ENTR_GERUDOS_FORTRESS_14_3 -ENTR_GERUDOS_FORTRESS_15 -ENTR_GERUDOS_FORTRESS_15_1 -ENTR_GERUDOS_FORTRESS_15_2 -ENTR_GERUDOS_FORTRESS_15_3 -ENTR_GERUDOS_FORTRESS_16 -ENTR_GERUDOS_FORTRESS_16_1 -ENTR_GERUDOS_FORTRESS_16_2 -ENTR_GERUDOS_FORTRESS_16_3 -ENTR_GERUDOS_FORTRESS_17 -ENTR_GERUDOS_FORTRESS_17_1 -ENTR_GERUDOS_FORTRESS_17_2 -ENTR_GERUDOS_FORTRESS_17_3 -ENTR_MARKET_DAY_6 -ENTR_MARKET_NIGHT_6_1 -ENTR_MARKET_RUINS_6_2 -ENTR_MARKET_RUINS_6_3 -ENTR_MARKET_DAY_7 -ENTR_MARKET_NIGHT_7_1 -ENTR_MARKET_RUINS_7_2 -ENTR_MARKET_RUINS_7_3 -ENTR_BACK_ALLEY_DAY_2 -ENTR_BACK_ALLEY_NIGHT_2_1 -ENTR_BACK_ALLEY_DAY_2_2 -ENTR_BACK_ALLEY_NIGHT_2_3 -ENTR_ZORAS_DOMAIN_2 -ENTR_ZORAS_DOMAIN_2_1 -ENTR_ZORAS_DOMAIN_2_2 -ENTR_ZORAS_DOMAIN_2_3 -ENTR_LAKE_HYLIA_3 -ENTR_LAKE_HYLIA_3_1 -ENTR_LAKE_HYLIA_3_2 -ENTR_LAKE_HYLIA_3_3 -ENTR_LAKE_HYLIA_4 -ENTR_LAKE_HYLIA_4_1 -ENTR_LAKE_HYLIA_4_2 -ENTR_LAKE_HYLIA_4_3 -ENTR_GERUDO_VALLEY_4 -ENTR_GERUDO_VALLEY_4_1 -ENTR_GERUDO_VALLEY_4_2 -ENTR_GERUDO_VALLEY_4_3 -ENTR_ZORAS_FOUNTAIN_3 -ENTR_ZORAS_FOUNTAIN_3_1 -ENTR_ZORAS_FOUNTAIN_3_2 -ENTR_ZORAS_FOUNTAIN_3_3 -ENTR_ZORAS_FOUNTAIN_4 -ENTR_ZORAS_FOUNTAIN_4_1 -ENTR_ZORAS_FOUNTAIN_4_2 -ENTR_ZORAS_FOUNTAIN_4_3 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_4 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_4_1 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_4_2 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_4_3 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_5 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_5_1 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_5_2 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_5_3 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_6 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_6_1 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_6_2 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_6_3 -ENTR_POTION_SHOP_KAKARIKO_1 -ENTR_POTION_SHOP_KAKARIKO_1_1 -ENTR_POTION_SHOP_KAKARIKO_1_2 -ENTR_POTION_SHOP_KAKARIKO_1_3 -ENTR_POTION_SHOP_KAKARIKO_2 -ENTR_POTION_SHOP_KAKARIKO_2_1 -ENTR_POTION_SHOP_KAKARIKO_2_2 -ENTR_POTION_SHOP_KAKARIKO_2_3 -ENTR_SPIRIT_TEMPLE_2 -ENTR_SPIRIT_TEMPLE_2_1 -ENTR_SPIRIT_TEMPLE_2_2 -ENTR_SPIRIT_TEMPLE_2_3 -ENTR_SPIRIT_TEMPLE_3 -ENTR_SPIRIT_TEMPLE_3_1 -ENTR_SPIRIT_TEMPLE_3_2 -ENTR_SPIRIT_TEMPLE_3_3 -ENTR_SPIRIT_TEMPLE_4 -ENTR_SPIRIT_TEMPLE_4_1 -ENTR_SPIRIT_TEMPLE_4_2 -ENTR_SPIRIT_TEMPLE_4_3 -ENTR_GORON_CITY_2 -ENTR_GORON_CITY_2_1 -ENTR_GORON_CITY_2_2 -ENTR_GORON_CITY_2_3 -ENTR_CASTLE_COURTYARD_ZELDA_0 -ENTR_CASTLE_COURTYARD_ZELDA_0_1 -ENTR_CASTLE_COURTYARD_ZELDA_0_2 -ENTR_CASTLE_COURTYARD_ZELDA_0_3 -ENTR_CASTLE_COURTYARD_ZELDA_0_4 -ENTR_CASTLE_COURTYARD_ZELDA_0_5 -ENTR_CASTLE_COURTYARD_ZELDA_0_6 -ENTR_JABU_JABU_1 -ENTR_JABU_JABU_1_1 -ENTR_JABU_JABU_1_2 -ENTR_JABU_JABU_1_3 -ENTR_DODONGOS_CAVERN_BOSS_0 -ENTR_DODONGOS_CAVERN_BOSS_0_1 -ENTR_DODONGOS_CAVERN_BOSS_0_2 -ENTR_DODONGOS_CAVERN_BOSS_0_3 -ENTR_DEKU_TREE_BOSS_0 -ENTR_DEKU_TREE_BOSS_0_1 -ENTR_DEKU_TREE_BOSS_0_2 -ENTR_DEKU_TREE_BOSS_0_3 -ENTR_SHADOW_TEMPLE_BOSS_0 -ENTR_SHADOW_TEMPLE_BOSS_0_1 -ENTR_SHADOW_TEMPLE_BOSS_0_2 -ENTR_SHADOW_TEMPLE_BOSS_0_3 -ENTR_WATER_TEMPLE_BOSS_0 -ENTR_WATER_TEMPLE_BOSS_0_1 -ENTR_WATER_TEMPLE_BOSS_0_2 -ENTR_WATER_TEMPLE_BOSS_0_3 -ENTR_GANONS_TOWER_0 -ENTR_GANONS_TOWER_0_1 -ENTR_GANONS_TOWER_0_2 -ENTR_GANONS_TOWER_0_3 -ENTR_GANONDORF_BOSS_0 -ENTR_GANONDORF_BOSS_0_1 -ENTR_GANONDORF_BOSS_0_2 -ENTR_GANONDORF_BOSS_0_3 -ENTR_WATER_TEMPLE_1 -ENTR_WATER_TEMPLE_1_1 -ENTR_WATER_TEMPLE_1_2 -ENTR_WATER_TEMPLE_1_3 -ENTR_GANONS_TOWER_1 -ENTR_GANONS_TOWER_1_1 -ENTR_GANONS_TOWER_1_2 -ENTR_GANONS_TOWER_1_3 -ENTR_GANONS_TOWER_2 -ENTR_GANONS_TOWER_2_1 -ENTR_GANONS_TOWER_2_2 -ENTR_GANONS_TOWER_2_3 -ENTR_LON_LON_RANCH_5 -ENTR_LON_LON_RANCH_5_1 -ENTR_LON_LON_RANCH_5_2 -ENTR_LON_LON_RANCH_5_3 -ENTR_MIDOS_HOUSE_0 -ENTR_MIDOS_HOUSE_0_1 -ENTR_MIDOS_HOUSE_0_2 -ENTR_MIDOS_HOUSE_0_3 -ENTR_SARIAS_HOUSE_0 -ENTR_SARIAS_HOUSE_0_1 -ENTR_SARIAS_HOUSE_0_2 -ENTR_SARIAS_HOUSE_0_3 -ENTR_BACK_ALLEY_HOUSE_0 -ENTR_BACK_ALLEY_HOUSE_0_1 -ENTR_BACK_ALLEY_HOUSE_0_2 -ENTR_BACK_ALLEY_HOUSE_0_3 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_0 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_0_1 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_0_2 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_0_3 -ENTR_KOKIRI_FOREST_9 -ENTR_KOKIRI_FOREST_9_1 -ENTR_KOKIRI_FOREST_9_2 -ENTR_KOKIRI_FOREST_9_3 -ENTR_KOKIRI_FOREST_10 -ENTR_KOKIRI_FOREST_10_1 -ENTR_KOKIRI_FOREST_10_2 -ENTR_KOKIRI_FOREST_10_3 -ENTR_KAKARIKO_VILLAGE_9 -ENTR_KAKARIKO_VILLAGE_9_1 -ENTR_KAKARIKO_VILLAGE_9_2 -ENTR_KAKARIKO_VILLAGE_9_3 -ENTR_WINDMILL_AND_DAMPES_GRAVE_0 -ENTR_WINDMILL_AND_DAMPES_GRAVE_0_1 -ENTR_WINDMILL_AND_DAMPES_GRAVE_0_2 -ENTR_WINDMILL_AND_DAMPES_GRAVE_0_3 -ENTR_WINDMILL_AND_DAMPES_GRAVE_1 -ENTR_WINDMILL_AND_DAMPES_GRAVE_1_1 -ENTR_WINDMILL_AND_DAMPES_GRAVE_1_2 -ENTR_WINDMILL_AND_DAMPES_GRAVE_1_3 -ENTR_KOKIRI_FOREST_11 -ENTR_KOKIRI_FOREST_11_1 -ENTR_KOKIRI_FOREST_11_2 -ENTR_KOKIRI_FOREST_11_3 -ENTR_DEATH_MOUNTAIN_TRAIL_4 -ENTR_DEATH_MOUNTAIN_TRAIL_4_1 -ENTR_DEATH_MOUNTAIN_TRAIL_4_2 -ENTR_DEATH_MOUNTAIN_TRAIL_4_3 -ENTR_FISHING_POND_0 -ENTR_FISHING_POND_0_1 -ENTR_FISHING_POND_0_2 -ENTR_FISHING_POND_0_3 -ENTR_KAKARIKO_VILLAGE_10 -ENTR_KAKARIKO_VILLAGE_10_1 -ENTR_KAKARIKO_VILLAGE_10_2 -ENTR_KAKARIKO_VILLAGE_10_3 -ENTR_INSIDE_GANONS_CASTLE_0 -ENTR_INSIDE_GANONS_CASTLE_0_1 -ENTR_INSIDE_GANONS_CASTLE_0_2 -ENTR_INSIDE_GANONS_CASTLE_0_3 -ENTR_INSIDE_GANONS_CASTLE_0_4 -ENTR_INSIDE_GANONS_CASTLE_0_5 -ENTR_INSIDE_GANONS_CASTLE_0_6 -ENTR_INSIDE_GANONS_CASTLE_0_7 -ENTR_INSIDE_GANONS_CASTLE_0_8 -ENTR_INSIDE_GANONS_CASTLE_0_9 -ENTR_INSIDE_GANONS_CASTLE_0_10 -ENTR_TEMPLE_OF_TIME_EXTERIOR_DAY_1 -ENTR_TEMPLE_OF_TIME_EXTERIOR_NIGHT_1_1 -ENTR_TEMPLE_OF_TIME_EXTERIOR_RUINS_1_2 -ENTR_TEMPLE_OF_TIME_EXTERIOR_RUINS_1_3 -ENTR_HYRULE_FIELD_15 -ENTR_HYRULE_FIELD_15_1 -ENTR_HYRULE_FIELD_15_2 -ENTR_HYRULE_FIELD_15_3 -ENTR_DEATH_MOUNTAIN_TRAIL_5 -ENTR_DEATH_MOUNTAIN_TRAIL_5_1 -ENTR_DEATH_MOUNTAIN_TRAIL_5_2 -ENTR_DEATH_MOUNTAIN_TRAIL_5_3 -ENTR_HYRULE_CASTLE_4 -ENTR_HYRULE_CASTLE_4_1 -ENTR_OUTSIDE_GANONS_CASTLE_4_2 -ENTR_OUTSIDE_GANONS_CASTLE_4_3 -ENTR_DEATH_MOUNTAIN_CRATER_3 -ENTR_DEATH_MOUNTAIN_CRATER_3_1 -ENTR_DEATH_MOUNTAIN_CRATER_3_2 -ENTR_DEATH_MOUNTAIN_CRATER_3_3 -ENTR_THIEVES_HIDEOUT_0 -ENTR_THIEVES_HIDEOUT_0_1 -ENTR_THIEVES_HIDEOUT_0_2 -ENTR_THIEVES_HIDEOUT_0_3 -ENTR_THIEVES_HIDEOUT_1 -ENTR_THIEVES_HIDEOUT_1_1 -ENTR_THIEVES_HIDEOUT_1_2 -ENTR_THIEVES_HIDEOUT_1_3 -ENTR_THIEVES_HIDEOUT_2 -ENTR_THIEVES_HIDEOUT_2_1 -ENTR_THIEVES_HIDEOUT_2_2 -ENTR_THIEVES_HIDEOUT_2_3 -ENTR_THIEVES_HIDEOUT_3 -ENTR_THIEVES_HIDEOUT_3_1 -ENTR_THIEVES_HIDEOUT_3_2 -ENTR_THIEVES_HIDEOUT_3_3 -ENTR_THIEVES_HIDEOUT_4 -ENTR_THIEVES_HIDEOUT_4_1 -ENTR_THIEVES_HIDEOUT_4_2 -ENTR_THIEVES_HIDEOUT_4_3 -ENTR_THIEVES_HIDEOUT_5 -ENTR_THIEVES_HIDEOUT_5_1 -ENTR_THIEVES_HIDEOUT_5_2 -ENTR_THIEVES_HIDEOUT_5_3 -ENTR_THIEVES_HIDEOUT_6 -ENTR_THIEVES_HIDEOUT_6_1 -ENTR_THIEVES_HIDEOUT_6_2 -ENTR_THIEVES_HIDEOUT_6_3 -ENTR_THIEVES_HIDEOUT_7 -ENTR_THIEVES_HIDEOUT_7_1 -ENTR_THIEVES_HIDEOUT_7_2 -ENTR_THIEVES_HIDEOUT_7_3 -ENTR_THIEVES_HIDEOUT_8 -ENTR_THIEVES_HIDEOUT_8_1 -ENTR_THIEVES_HIDEOUT_8_2 -ENTR_THIEVES_HIDEOUT_8_3 -ENTR_THIEVES_HIDEOUT_9 -ENTR_THIEVES_HIDEOUT_9_1 -ENTR_THIEVES_HIDEOUT_9_2 -ENTR_THIEVES_HIDEOUT_9_3 -ENTR_THIEVES_HIDEOUT_10 -ENTR_THIEVES_HIDEOUT_10_1 -ENTR_THIEVES_HIDEOUT_10_2 -ENTR_THIEVES_HIDEOUT_10_3 -ENTR_THIEVES_HIDEOUT_11 -ENTR_THIEVES_HIDEOUT_11_1 -ENTR_THIEVES_HIDEOUT_11_2 -ENTR_THIEVES_HIDEOUT_11_3 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_7 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_7_1 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_7_2 -ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_7_3 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_1 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_1_1 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_1_2 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_1_3 -ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_1 -ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_1_1 -ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_1_2 -ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_1_3 -ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_2 -ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_2_1 -ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_2_2 -ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_2_3 -ENTR_LOST_WOODS_4 -ENTR_LOST_WOODS_4_1 -ENTR_LOST_WOODS_4_2 -ENTR_LOST_WOODS_4_3 -ENTR_LON_LON_RANCH_6 -ENTR_LON_LON_RANCH_6_1 -ENTR_LON_LON_RANCH_6_2 -ENTR_LON_LON_RANCH_6_3 -ENTR_LON_LON_RANCH_7 -ENTR_LON_LON_RANCH_7_1 -ENTR_LON_LON_RANCH_7_2 -ENTR_LON_LON_RANCH_7_3 -ENTR_LOST_WOODS_5 -ENTR_LOST_WOODS_5_1 -ENTR_LOST_WOODS_5_2 -ENTR_LOST_WOODS_5_3 -ENTR_LOST_WOODS_6 -ENTR_LOST_WOODS_6_1 -ENTR_LOST_WOODS_6_2 -ENTR_LOST_WOODS_6_3 -ENTR_LOST_WOODS_7 -ENTR_LOST_WOODS_7_1 -ENTR_LOST_WOODS_7_2 -ENTR_LOST_WOODS_7_3 -ENTR_LOST_WOODS_8 -ENTR_LOST_WOODS_8_1 -ENTR_LOST_WOODS_8_2 -ENTR_LOST_WOODS_8_3 -ENTR_GORON_CITY_3 -ENTR_GORON_CITY_3_1 -ENTR_GORON_CITY_3_2 -ENTR_GORON_CITY_3_3 -ENTR_LAKE_HYLIA_5 -ENTR_LAKE_HYLIA_5_1 -ENTR_LAKE_HYLIA_5_2 -ENTR_LAKE_HYLIA_5_3 -ENTR_SHADOW_TEMPLE_3 -ENTR_SHADOW_TEMPLE_3_1 -ENTR_SHADOW_TEMPLE_3_2 -ENTR_SHADOW_TEMPLE_3_3 -ENTR_KAKARIKO_VILLAGE_11 -ENTR_KAKARIKO_VILLAGE_11_1 -ENTR_KAKARIKO_VILLAGE_11_2 -ENTR_KAKARIKO_VILLAGE_11_3 -ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_3 -ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_3_1 -ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_3_2 -ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_3_3 -ENTR_DEATH_MOUNTAIN_CRATER_4 -ENTR_DEATH_MOUNTAIN_CRATER_4_1 -ENTR_DEATH_MOUNTAIN_CRATER_4_2 -ENTR_DEATH_MOUNTAIN_CRATER_4_3 -ENTR_HYRULE_CASTLE_3 -ENTR_HYRULE_CASTLE_3_1 -ENTR_OUTSIDE_GANONS_CASTLE_3_2 -ENTR_OUTSIDE_GANONS_CASTLE_3_3 -ENTR_HYRULE_CASTLE_3_4 -ENTR_KAKARIKO_VILLAGE_12 -ENTR_KAKARIKO_VILLAGE_12_1 -ENTR_KAKARIKO_VILLAGE_12_2 -ENTR_KAKARIKO_VILLAGE_12_3 -ENTR_WINDMILL_AND_DAMPES_GRAVE_2 -ENTR_WINDMILL_AND_DAMPES_GRAVE_2_1 -ENTR_WINDMILL_AND_DAMPES_GRAVE_2_2 -ENTR_WINDMILL_AND_DAMPES_GRAVE_2_3 -ENTR_BOMBCHU_BOWLING_ALLEY_0 -ENTR_BOMBCHU_BOWLING_ALLEY_0_1 -ENTR_BOMBCHU_BOWLING_ALLEY_0_2 -ENTR_BOMBCHU_BOWLING_ALLEY_0_3 -ENTR_GRAVEYARD_6 -ENTR_GRAVEYARD_6_1 -ENTR_GRAVEYARD_6_2 -ENTR_GRAVEYARD_6_3 -ENTR_HYRULE_FIELD_16 -ENTR_HYRULE_FIELD_16_1 -ENTR_HYRULE_FIELD_16_2 -ENTR_HYRULE_FIELD_16_3 -ENTR_KAKARIKO_VILLAGE_13 -ENTR_KAKARIKO_VILLAGE_13_1 -ENTR_KAKARIKO_VILLAGE_13_2 -ENTR_KAKARIKO_VILLAGE_13_3 -ENTR_GANON_BOSS_0 -ENTR_GANON_BOSS_0_1 -ENTR_GANON_BOSS_0_2 -ENTR_GANON_BOSS_0_3 -ENTR_GANON_BOSS_0_4 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_6 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_6_1 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_6_2 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_6_3 -ENTR_BESITU_0 -ENTR_BESITU_0_1 -ENTR_BESITU_0_2 -ENTR_BESITU_0_3 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_7 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_7_1 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_7_2 -ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_7_3 -ENTR_BOMBCHU_SHOP_1 -ENTR_BOMBCHU_SHOP_1_1 -ENTR_BOMBCHU_SHOP_1_2 -ENTR_BOMBCHU_SHOP_1_3 -ENTR_BAZAAR_1 -ENTR_BAZAAR_1_1 -ENTR_BAZAAR_1_2 -ENTR_BAZAAR_1_3 -ENTR_HAPPY_MASK_SHOP_0 -ENTR_HAPPY_MASK_SHOP_0_1 -ENTR_HAPPY_MASK_SHOP_0_2 -ENTR_HAPPY_MASK_SHOP_0_3 -ENTR_INSIDE_GANONS_CASTLE_1 -ENTR_INSIDE_GANONS_CASTLE_1_1 -ENTR_INSIDE_GANONS_CASTLE_1_2 -ENTR_INSIDE_GANONS_CASTLE_1_3 -ENTR_INSIDE_GANONS_CASTLE_2 -ENTR_INSIDE_GANONS_CASTLE_2_1 -ENTR_INSIDE_GANONS_CASTLE_2_2 -ENTR_INSIDE_GANONS_CASTLE_2_3 -ENTR_INSIDE_GANONS_CASTLE_3 -ENTR_INSIDE_GANONS_CASTLE_3_1 -ENTR_INSIDE_GANONS_CASTLE_3_2 -ENTR_INSIDE_GANONS_CASTLE_3_3 -ENTR_INSIDE_GANONS_CASTLE_4 -ENTR_INSIDE_GANONS_CASTLE_4_1 -ENTR_INSIDE_GANONS_CASTLE_4_2 -ENTR_INSIDE_GANONS_CASTLE_4_3 -ENTR_INSIDE_GANONS_CASTLE_5 -ENTR_INSIDE_GANONS_CASTLE_5_1 -ENTR_INSIDE_GANONS_CASTLE_5_2 -ENTR_INSIDE_GANONS_CASTLE_5_3 -ENTR_INSIDE_GANONS_CASTLE_6 -ENTR_INSIDE_GANONS_CASTLE_6_1 -ENTR_INSIDE_GANONS_CASTLE_6_2 -ENTR_INSIDE_GANONS_CASTLE_6_3 -ENTR_INSIDE_GANONS_CASTLE_7 -ENTR_INSIDE_GANONS_CASTLE_7_1 -ENTR_INSIDE_GANONS_CASTLE_7_2 -ENTR_INSIDE_GANONS_CASTLE_7_3 -ENTR_HOUSE_OF_SKULLTULA_0 -ENTR_HOUSE_OF_SKULLTULA_0_1 -ENTR_HOUSE_OF_SKULLTULA_0_2 -ENTR_HOUSE_OF_SKULLTULA_0_3 -ENTR_KAKARIKO_VILLAGE_14 -ENTR_KAKARIKO_VILLAGE_14_1 -ENTR_KAKARIKO_VILLAGE_14_2 -ENTR_KAKARIKO_VILLAGE_14_3 -ENTR_LON_LON_RANCH_8 -ENTR_LON_LON_RANCH_8_1 -ENTR_LON_LON_RANCH_8_2 -ENTR_LON_LON_RANCH_8_3 -ENTR_LON_LON_RANCH_9 -ENTR_LON_LON_RANCH_9_1 -ENTR_LON_LON_RANCH_9_2 -ENTR_LON_LON_RANCH_9_3 -ENTR_LAKE_HYLIA_7 -ENTR_LAKE_HYLIA_7_1 -ENTR_LAKE_HYLIA_7_2 -ENTR_LAKE_HYLIA_7_3 -ENTR_DEATH_MOUNTAIN_CRATER_5 -ENTR_DEATH_MOUNTAIN_CRATER_5_1 -ENTR_DEATH_MOUNTAIN_CRATER_5_2 -ENTR_DEATH_MOUNTAIN_CRATER_5_3 -ENTR_GRAVEYARD_7 -ENTR_GRAVEYARD_7_1 -ENTR_GRAVEYARD_7_2 -ENTR_GRAVEYARD_7_3 -ENTR_INSIDE_GANONS_CASTLE_COLLAPSE_0 -ENTR_INSIDE_GANONS_CASTLE_COLLAPSE_0_1 -ENTR_INSIDE_GANONS_CASTLE_COLLAPSE_0_2 -ENTR_INSIDE_GANONS_CASTLE_COLLAPSE_0_3 -ENTR_THIEVES_HIDEOUT_12 -ENTR_THIEVES_HIDEOUT_12_1 -ENTR_THIEVES_HIDEOUT_12_2 -ENTR_THIEVES_HIDEOUT_12_3 -ENTR_ROYAL_FAMILYS_TOMB_1 -ENTR_ROYAL_FAMILYS_TOMB_1_1 -ENTR_ROYAL_FAMILYS_TOMB_1_2 -ENTR_ROYAL_FAMILYS_TOMB_1_3 -ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_1 -ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_1_1 -ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_1_2 -ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_1_3 -ENTR_DESERT_COLOSSUS_7 -ENTR_DESERT_COLOSSUS_7_1 -ENTR_DESERT_COLOSSUS_7_2 -ENTR_DESERT_COLOSSUS_7_3 -ENTR_GRAVEYARD_8 -ENTR_GRAVEYARD_8_1 -ENTR_GRAVEYARD_8_2 -ENTR_GRAVEYARD_8_3 -ENTR_FOREST_TEMPLE_2 -ENTR_FOREST_TEMPLE_2_1 -ENTR_FOREST_TEMPLE_2_2 -ENTR_FOREST_TEMPLE_2_3 -ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_2 -ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_2_1 -ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_2_2 -ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_2_3 -ENTR_TEMPLE_OF_TIME_5 -ENTR_TEMPLE_OF_TIME_5_1 -ENTR_TEMPLE_OF_TIME_5_2 -ENTR_TEMPLE_OF_TIME_5_3 -ENTR_TEMPLE_OF_TIME_6 -ENTR_TEMPLE_OF_TIME_6_1 -ENTR_TEMPLE_OF_TIME_6_2 -ENTR_TEMPLE_OF_TIME_6_3 -ENTR_HYRULE_FIELD_17 -ENTR_HYRULE_FIELD_17_1 -ENTR_HYRULE_FIELD_17_2 -ENTR_HYRULE_FIELD_17_3 -ENTR_GROTTOS_1 -ENTR_GROTTOS_1_1 -ENTR_GROTTOS_1_2 -ENTR_GROTTOS_1_3 -ENTR_GROTTOS_2 -ENTR_GROTTOS_2_1 -ENTR_GROTTOS_2_2 -ENTR_GROTTOS_2_3 -ENTR_GROTTOS_3 -ENTR_GROTTOS_3_1 -ENTR_GROTTOS_3_2 -ENTR_GROTTOS_3_3 -ENTR_GROTTOS_4 -ENTR_GROTTOS_4_1 -ENTR_GROTTOS_4_2 -ENTR_GROTTOS_4_3 -ENTR_GROTTOS_5 -ENTR_GROTTOS_5_1 -ENTR_GROTTOS_5_2 -ENTR_GROTTOS_5_3 -ENTR_GROTTOS_6 -ENTR_GROTTOS_6_1 -ENTR_GROTTOS_6_2 -ENTR_GROTTOS_6_3 -ENTR_GROTTOS_7 -ENTR_GROTTOS_7_1 -ENTR_GROTTOS_7_2 -ENTR_GROTTOS_7_3 -ENTR_GROTTOS_8 -ENTR_GROTTOS_8_1 -ENTR_GROTTOS_8_2 -ENTR_GROTTOS_8_3 -ENTR_GROTTOS_9 -ENTR_GROTTOS_9_1 -ENTR_GROTTOS_9_2 -ENTR_GROTTOS_9_3 -ENTR_GROTTOS_10 -ENTR_GROTTOS_10_1 -ENTR_GROTTOS_10_2 -ENTR_GROTTOS_10_3 -ENTR_GROTTOS_11 -ENTR_GROTTOS_11_1 -ENTR_GROTTOS_11_2 -ENTR_GROTTOS_11_3 -ENTR_GROTTOS_12 -ENTR_GROTTOS_12_1 -ENTR_GROTTOS_12_2 -ENTR_GROTTOS_12_3 -ENTR_IMPAS_HOUSE_1 -ENTR_IMPAS_HOUSE_1_1 -ENTR_IMPAS_HOUSE_1_2 -ENTR_IMPAS_HOUSE_1_3 -ENTR_BOTTOM_OF_THE_WELL_1 -ENTR_BOTTOM_OF_THE_WELL_1_1 -ENTR_BOTTOM_OF_THE_WELL_1_2 -ENTR_BOTTOM_OF_THE_WELL_1_3 -ENTR_LON_LON_BUILDINGS_1 -ENTR_LON_LON_BUILDINGS_1_1 -ENTR_LON_LON_BUILDINGS_1_2 -ENTR_LON_LON_BUILDINGS_1_3 -ENTR_LON_LON_RANCH_10 -ENTR_LON_LON_RANCH_10_1 -ENTR_LON_LON_RANCH_10_2 -ENTR_LON_LON_RANCH_10_3 -ENTR_ICE_CAVERN_1 -ENTR_ICE_CAVERN_1_1 -ENTR_ICE_CAVERN_1_2 -ENTR_ICE_CAVERN_1_3 -ENTR_KAKARIKO_VILLAGE_15 -ENTR_KAKARIKO_VILLAGE_15_1 -ENTR_KAKARIKO_VILLAGE_15_2 -ENTR_KAKARIKO_VILLAGE_15_3 -ENTR_LOST_WOODS_9 -ENTR_LOST_WOODS_9_1 -ENTR_LOST_WOODS_9_2 -ENTR_LOST_WOODS_9_3 -ENTR_LON_LON_BUILDINGS_2 -ENTR_LON_LON_BUILDINGS_2_1 -ENTR_LON_LON_BUILDINGS_2_2 -ENTR_LON_LON_BUILDINGS_2_3 -ENTR_KOKIRI_FOREST_12 -ENTR_KOKIRI_FOREST_12_1 -ENTR_KOKIRI_FOREST_12_2 -ENTR_KOKIRI_FOREST_12_3 -ENTR_SPIRIT_TEMPLE_BOSS_2 -ENTR_SPIRIT_TEMPLE_BOSS_2_1 -ENTR_SPIRIT_TEMPLE_BOSS_2_2 -ENTR_SPIRIT_TEMPLE_BOSS_2_3 -ENTR_CASTLE_COURTYARD_ZELDA_1 -ENTR_CASTLE_COURTYARD_ZELDA_1_1 -ENTR_CASTLE_COURTYARD_ZELDA_1_2 -ENTR_CASTLE_COURTYARD_ZELDA_1_3 -ENTR_TEMPLE_OF_TIME_7 -ENTR_TEMPLE_OF_TIME_7_1 -ENTR_TEMPLE_OF_TIME_7_2 -ENTR_TEMPLE_OF_TIME_7_3 -ENTR_GERUDOS_FORTRESS_18 -ENTR_GERUDOS_FORTRESS_18_1 -ENTR_GERUDOS_FORTRESS_18_2 -ENTR_GERUDOS_FORTRESS_18_3 -ENTR_GROTTOS_13 -ENTR_GROTTOS_13_1 -ENTR_GROTTOS_13_2 -ENTR_GROTTOS_13_3 -ENTR_SACRED_FOREST_MEADOW_2 -ENTR_SACRED_FOREST_MEADOW_2_1 -ENTR_SACRED_FOREST_MEADOW_2_2 -ENTR_SACRED_FOREST_MEADOW_2_3 -ENTR_LAKE_HYLIA_8 -ENTR_LAKE_HYLIA_8_1 -ENTR_LAKE_HYLIA_8_2 -ENTR_LAKE_HYLIA_8_3 -ENTR_SACRED_FOREST_MEADOW_3 -ENTR_SACRED_FOREST_MEADOW_3_1 -ENTR_SACRED_FOREST_MEADOW_3_2 -ENTR_SACRED_FOREST_MEADOW_3_3 -ENTR_LAKE_HYLIA_9 -ENTR_LAKE_HYLIA_9_1 -ENTR_LAKE_HYLIA_9_2 -ENTR_LAKE_HYLIA_9_3 -ENTR_DESERT_COLOSSUS_8 -ENTR_DESERT_COLOSSUS_8_1 -ENTR_DESERT_COLOSSUS_8_2 -ENTR_DESERT_COLOSSUS_8_3 diff --git a/tools/ZAPDConfigs/EnumData.xml b/tools/ZAPDConfigs/EnumData.xml deleted file mode 100644 index bbe0b2d07a..0000000000 --- a/tools/ZAPDConfigs/EnumData.xml +++ /dev/null @@ -1,599 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tools/ZAPDConfigs/ObjectList.txt b/tools/ZAPDConfigs/ObjectList.txt deleted file mode 100644 index 1ecc3441bb..0000000000 --- a/tools/ZAPDConfigs/ObjectList.txt +++ /dev/null @@ -1,402 +0,0 @@ -OBJECT_INVALID -OBJECT_GAMEPLAY_KEEP -OBJECT_GAMEPLAY_FIELD_KEEP -OBJECT_GAMEPLAY_DANGEON_KEEP -OBJECT_UNSET_4 -OBJECT_UNSET_5 -OBJECT_HUMAN -OBJECT_OKUTA -OBJECT_CROW -OBJECT_POH -OBJECT_DY_OBJ -OBJECT_WALLMASTER -OBJECT_DODONGO -OBJECT_FIREFLY -OBJECT_BOX -OBJECT_FIRE -OBJECT_UNSET_10 -OBJECT_UNSET_11 -OBJECT_BUBBLE -OBJECT_NIW -OBJECT_LINK_BOY -OBJECT_LINK_CHILD -OBJECT_TITE -OBJECT_REEBA -OBJECT_PEEHAT -OBJECT_KINGDODONGO -OBJECT_HORSE -OBJECT_ZF -OBJECT_GOMA -OBJECT_ZL1 -OBJECT_GOL -OBJECT_DODOJR -OBJECT_TORCH2 -OBJECT_BL -OBJECT_TP -OBJECT_OA1 -OBJECT_ST -OBJECT_BW -OBJECT_EI -OBJECT_HORSE_NORMAL -OBJECT_OB1 -OBJECT_O_ANIME -OBJECT_SPOT04_OBJECTS -OBJECT_DDAN_OBJECTS -OBJECT_HIDAN_OBJECTS -OBJECT_HORSE_GANON -OBJECT_OA2 -OBJECT_SPOT00_OBJECTS -OBJECT_MB -OBJECT_BOMBF -OBJECT_SK2 -OBJECT_OE1 -OBJECT_OE_ANIME -OBJECT_OE2 -OBJECT_YDAN_OBJECTS -OBJECT_GND -OBJECT_AM -OBJECT_DEKUBABA -OBJECT_UNSET_3A -OBJECT_OA3 -OBJECT_OA4 -OBJECT_OA5 -OBJECT_OA6 -OBJECT_OA7 -OBJECT_JJ -OBJECT_OA8 -OBJECT_OA9 -OBJECT_OB2 -OBJECT_OB3 -OBJECT_OB4 -OBJECT_HORSE_ZELDA -OBJECT_OPENING_DEMO1 -OBJECT_WARP1 -OBJECT_B_HEART -OBJECT_DEKUNUTS -OBJECT_OE3 -OBJECT_OE4 -OBJECT_MENKURI_OBJECTS -OBJECT_OE5 -OBJECT_OE6 -OBJECT_OE7 -OBJECT_OE8 -OBJECT_OE9 -OBJECT_OE10 -OBJECT_OE11 -OBJECT_OE12 -OBJECT_VALI -OBJECT_OA10 -OBJECT_OA11 -OBJECT_MIZU_OBJECTS -OBJECT_FHG -OBJECT_OSSAN -OBJECT_MORI_HINERI1 -OBJECT_BB -OBJECT_TOKI_OBJECTS -OBJECT_YUKABYUN -OBJECT_ZL2 -OBJECT_MJIN -OBJECT_MJIN_FLASH -OBJECT_MJIN_DARK -OBJECT_MJIN_FLAME -OBJECT_MJIN_ICE -OBJECT_MJIN_SOUL -OBJECT_MJIN_WIND -OBJECT_MJIN_OKA -OBJECT_HAKA_OBJECTS -OBJECT_SPOT06_OBJECTS -OBJECT_ICE_OBJECTS -OBJECT_RELAY_OBJECTS -OBJECT_PO_FIELD -OBJECT_PO_COMPOSER -OBJECT_MORI_HINERI1A -OBJECT_MORI_HINERI2 -OBJECT_MORI_HINERI2A -OBJECT_MORI_OBJECTS -OBJECT_MORI_TEX -OBJECT_SPOT08_OBJ -OBJECT_WARP2 -OBJECT_HATA -OBJECT_BIRD -OBJECT_UNSET_78 -OBJECT_UNSET_79 -OBJECT_UNSET_7A -OBJECT_UNSET_7B -OBJECT_WOOD02 -OBJECT_UNSET_7D -OBJECT_UNSET_7E -OBJECT_UNSET_7F -OBJECT_UNSET_80 -OBJECT_LIGHTBOX -OBJECT_PU_BOX -OBJECT_UNSET_83 -OBJECT_UNSET_84 -OBJECT_TRAP -OBJECT_VASE -OBJECT_IM -OBJECT_TA -OBJECT_TK -OBJECT_XC -OBJECT_VM -OBJECT_BV -OBJECT_HAKACH_OBJECTS -OBJECT_EFC_CRYSTAL_LIGHT -OBJECT_EFC_FIRE_BALL -OBJECT_EFC_FLASH -OBJECT_EFC_LGT_SHOWER -OBJECT_EFC_STAR_FIELD -OBJECT_GOD_LGT -OBJECT_LIGHT_RING -OBJECT_TRIFORCE_SPOT -OBJECT_BDAN_OBJECTS -OBJECT_SD -OBJECT_RD -OBJECT_PO_SISTERS -OBJECT_HEAVY_OBJECT -OBJECT_GNDD -OBJECT_FD -OBJECT_DU -OBJECT_FW -OBJECT_MEDAL -OBJECT_HORSE_LINK_CHILD -OBJECT_SPOT02_OBJECTS -OBJECT_HAKA -OBJECT_RU1 -OBJECT_SYOKUDAI -OBJECT_FD2 -OBJECT_DH -OBJECT_RL -OBJECT_EFC_TW -OBJECT_DEMO_TRE_LGT -OBJECT_GI_KEY -OBJECT_MIR_RAY -OBJECT_BROB -OBJECT_GI_JEWEL -OBJECT_SPOT09_OBJ -OBJECT_SPOT18_OBJ -OBJECT_BDOOR -OBJECT_SPOT17_OBJ -OBJECT_SHOP_DUNGEN -OBJECT_NB -OBJECT_MO -OBJECT_SB -OBJECT_GI_MELODY -OBJECT_GI_HEART -OBJECT_GI_COMPASS -OBJECT_GI_BOSSKEY -OBJECT_GI_MEDAL -OBJECT_GI_NUTS -OBJECT_SA -OBJECT_GI_HEARTS -OBJECT_GI_ARROWCASE -OBJECT_GI_BOMBPOUCH -OBJECT_IN -OBJECT_TR -OBJECT_SPOT16_OBJ -OBJECT_OE1S -OBJECT_OE4S -OBJECT_OS_ANIME -OBJECT_GI_BOTTLE -OBJECT_GI_STICK -OBJECT_GI_MAP -OBJECT_OF1D_MAP -OBJECT_RU2 -OBJECT_GI_SHIELD_1 -OBJECT_DEKUJR -OBJECT_GI_MAGICPOT -OBJECT_GI_BOMB_1 -OBJECT_OF1S -OBJECT_MA2 -OBJECT_GI_PURSE -OBJECT_HNI -OBJECT_TW -OBJECT_RR -OBJECT_BXA -OBJECT_ANUBICE -OBJECT_GI_GERUDO -OBJECT_GI_ARROW -OBJECT_GI_BOMB_2 -OBJECT_GI_EGG -OBJECT_GI_SCALE -OBJECT_GI_SHIELD_2 -OBJECT_GI_HOOKSHOT -OBJECT_GI_OCARINA -OBJECT_GI_MILK -OBJECT_MA1 -OBJECT_GANON -OBJECT_SST -OBJECT_NY_UNUSED -OBJECT_UNSET_E4 -OBJECT_NY -OBJECT_FR -OBJECT_GI_PACHINKO -OBJECT_GI_BOOMERANG -OBJECT_GI_BOW -OBJECT_GI_GLASSES -OBJECT_GI_LIQUID -OBJECT_ANI -OBJECT_DEMO_6K -OBJECT_GI_SHIELD_3 -OBJECT_GI_LETTER -OBJECT_SPOT15_OBJ -OBJECT_JYA_OBJ -OBJECT_GI_CLOTHES -OBJECT_GI_BEAN -OBJECT_GI_FISH -OBJECT_GI_SAW -OBJECT_GI_HAMMER -OBJECT_GI_GRASS -OBJECT_GI_LONGSWORD -OBJECT_SPOT01_OBJECTS -OBJECT_MD_UNUSED -OBJECT_MD -OBJECT_KM1 -OBJECT_KW1 -OBJECT_ZO -OBJECT_KZ -OBJECT_UMAJUMP -OBJECT_MASTERKOKIRI -OBJECT_MASTERKOKIRIHEAD -OBJECT_MASTERGOLON -OBJECT_MASTERZOORA -OBJECT_AOB -OBJECT_IK -OBJECT_AHG -OBJECT_CNE -OBJECT_GI_NIWATORI -OBJECT_SKJ -OBJECT_GI_BOTTLE_LETTER -OBJECT_BJI -OBJECT_BBA -OBJECT_GI_OCARINA_0 -OBJECT_DS -OBJECT_ANE -OBJECT_BOJ -OBJECT_SPOT03_OBJECT -OBJECT_SPOT07_OBJECT -OBJECT_FZ -OBJECT_BOB -OBJECT_GE1 -OBJECT_YABUSAME_POINT -OBJECT_GI_BOOTS_2 -OBJECT_GI_SEED -OBJECT_GND_MAGIC -OBJECT_D_ELEVATOR -OBJECT_D_HSBLOCK -OBJECT_D_LIFT -OBJECT_MAMENOKI -OBJECT_GOROIWA -OBJECT_UNSET_120 -OBJECT_TORYO -OBJECT_DAIKU -OBJECT_UNSET_123 -OBJECT_NWC -OBJECT_BLKOBJ -OBJECT_GM -OBJECT_MS -OBJECT_HS -OBJECT_INGATE -OBJECT_LIGHTSWITCH -OBJECT_KUSA -OBJECT_TSUBO -OBJECT_GI_GLOVES -OBJECT_GI_COIN -OBJECT_KANBAN -OBJECT_GJYO_OBJECTS -OBJECT_OWL -OBJECT_MK -OBJECT_FU -OBJECT_GI_KI_TAN_MASK -OBJECT_GI_REDEAD_MASK -OBJECT_GI_SKJ_MASK -OBJECT_GI_RABIT_MASK -OBJECT_GI_TRUTH_MASK -OBJECT_GANON_OBJECTS -OBJECT_SIOFUKI -OBJECT_STREAM -OBJECT_MM -OBJECT_FA -OBJECT_OS -OBJECT_GI_EYE_LOTION -OBJECT_GI_POWDER -OBJECT_GI_MUSHROOM -OBJECT_GI_TICKETSTONE -OBJECT_GI_BROKENSWORD -OBJECT_JS -OBJECT_CS -OBJECT_GI_PRESCRIPTION -OBJECT_GI_BRACELET -OBJECT_GI_SOLDOUT -OBJECT_GI_FROG -OBJECT_MAG -OBJECT_DOOR_GERUDO -OBJECT_GT -OBJECT_EFC_ERUPC -OBJECT_ZL2_ANIME1 -OBJECT_ZL2_ANIME2 -OBJECT_GI_GOLONMASK -OBJECT_GI_ZORAMASK -OBJECT_GI_GERUDOMASK -OBJECT_GANON2 -OBJECT_KA -OBJECT_TS -OBJECT_ZG -OBJECT_GI_HOVERBOOTS -OBJECT_GI_M_ARROW -OBJECT_DS2 -OBJECT_EC -OBJECT_FISH -OBJECT_GI_SUTARU -OBJECT_GI_GODDESS -OBJECT_SSH -OBJECT_BIGOKUTA -OBJECT_BG -OBJECT_SPOT05_OBJECTS -OBJECT_SPOT12_OBJ -OBJECT_BOMBIWA -OBJECT_HINTNUTS -OBJECT_RS -OBJECT_SPOT00_BREAK -OBJECT_GLA -OBJECT_SHOPNUTS -OBJECT_GELDB -OBJECT_GR -OBJECT_DOG -OBJECT_JYA_IRON -OBJECT_JYA_DOOR -OBJECT_UNSET_16E -OBJECT_SPOT11_OBJ -OBJECT_KIBAKO2 -OBJECT_DNS -OBJECT_DNK -OBJECT_GI_FIRE -OBJECT_GI_INSECT -OBJECT_GI_BUTTERFLY -OBJECT_GI_GHOST -OBJECT_GI_SOUL -OBJECT_BOWL -OBJECT_DEMO_KEKKAI -OBJECT_EFC_DOUGHNUT -OBJECT_GI_DEKUPOUCH -OBJECT_GANON_ANIME1 -OBJECT_GANON_ANIME2 -OBJECT_GANON_ANIME3 -OBJECT_GI_RUPY -OBJECT_SPOT01_MATOYA -OBJECT_SPOT01_MATOYAB -OBJECT_MU -OBJECT_WF -OBJECT_SKB -OBJECT_GJ -OBJECT_GEFF -OBJECT_HAKA_DOOR -OBJECT_GS -OBJECT_PS -OBJECT_BWALL -OBJECT_COW -OBJECT_COB -OBJECT_GI_SWORD_1 -OBJECT_DOOR_KILLER -OBJECT_OUKE_HAKA -OBJECT_TIMEBLOCK -OBJECT_ZL4 \ No newline at end of file diff --git a/tools/ZAPDConfigs/SpecialEntranceList.txt b/tools/ZAPDConfigs/SpecialEntranceList.txt deleted file mode 100644 index fdd12773de..0000000000 --- a/tools/ZAPDConfigs/SpecialEntranceList.txt +++ /dev/null @@ -1,7 +0,0 @@ -ENTR_RETURN_GREAT_FAIRYS_FOUNTAIN_SPELLS -ENTR_RETURN_SHOOTING_GALLERY -ENTR_RETURN_2 -ENTR_RETURN_BAZAAR -ENTR_RETURN_4 -ENTR_RETURN_GREAT_FAIRYS_FOUNTAIN_MAGIC -ENTR_RETURN_GROTTO diff --git a/tools/ZAPDConfigs/gc-eu-mq-dbg/Config.xml b/tools/ZAPDConfigs/gc-eu-mq-dbg/Config.xml deleted file mode 100644 index 0b6ea61ff5..0000000000 --- a/tools/ZAPDConfigs/gc-eu-mq-dbg/Config.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/tools/ZAPDConfigs/gc-eu-mq-dbg/SymbolMap.txt b/tools/ZAPDConfigs/gc-eu-mq-dbg/SymbolMap.txt deleted file mode 100644 index 99b4bad0a6..0000000000 --- a/tools/ZAPDConfigs/gc-eu-mq-dbg/SymbolMap.txt +++ /dev/null @@ -1,2 +0,0 @@ -8012DB20 gMtxClear -80A8E610 sShadowTex diff --git a/tools/ZAPDConfigs/gc-eu-mq/Config.xml b/tools/ZAPDConfigs/gc-eu-mq/Config.xml deleted file mode 100644 index 0b6ea61ff5..0000000000 --- a/tools/ZAPDConfigs/gc-eu-mq/Config.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/tools/ZAPDConfigs/gc-eu-mq/SymbolMap.txt b/tools/ZAPDConfigs/gc-eu-mq/SymbolMap.txt deleted file mode 100644 index 70056f6b08..0000000000 --- a/tools/ZAPDConfigs/gc-eu-mq/SymbolMap.txt +++ /dev/null @@ -1,2 +0,0 @@ -800FBC00 gMtxClear -80A72FA0 sShadowTex diff --git a/tools/ZAPDConfigs/gc-eu/Config.xml b/tools/ZAPDConfigs/gc-eu/Config.xml deleted file mode 100644 index 0b6ea61ff5..0000000000 --- a/tools/ZAPDConfigs/gc-eu/Config.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/tools/ZAPDConfigs/gc-eu/SymbolMap.txt b/tools/ZAPDConfigs/gc-eu/SymbolMap.txt deleted file mode 100644 index b523f5646d..0000000000 --- a/tools/ZAPDConfigs/gc-eu/SymbolMap.txt +++ /dev/null @@ -1,2 +0,0 @@ -800FBC20 gMtxClear -80A73020 sShadowTex diff --git a/tools/ZAPDConfigs/gc-jp-ce/Config.xml b/tools/ZAPDConfigs/gc-jp-ce/Config.xml deleted file mode 100644 index b2f4e3e4d3..0000000000 --- a/tools/ZAPDConfigs/gc-jp-ce/Config.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/tools/ZAPDConfigs/gc-jp-ce/SymbolMap.txt b/tools/ZAPDConfigs/gc-jp-ce/SymbolMap.txt deleted file mode 100644 index 12d96f7aa2..0000000000 --- a/tools/ZAPDConfigs/gc-jp-ce/SymbolMap.txt +++ /dev/null @@ -1,2 +0,0 @@ -800FE2A0 gMtxClear -80A74120 sShadowTex diff --git a/tools/ZAPDConfigs/gc-jp-mq/Config.xml b/tools/ZAPDConfigs/gc-jp-mq/Config.xml deleted file mode 100644 index b2f4e3e4d3..0000000000 --- a/tools/ZAPDConfigs/gc-jp-mq/Config.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/tools/ZAPDConfigs/gc-jp-mq/SymbolMap.txt b/tools/ZAPDConfigs/gc-jp-mq/SymbolMap.txt deleted file mode 100644 index 8dcd14d673..0000000000 --- a/tools/ZAPDConfigs/gc-jp-mq/SymbolMap.txt +++ /dev/null @@ -1,2 +0,0 @@ -800FE2A0 gMtxClear -80A740D0 sShadowTex diff --git a/tools/ZAPDConfigs/gc-jp/Config.xml b/tools/ZAPDConfigs/gc-jp/Config.xml deleted file mode 100644 index b2f4e3e4d3..0000000000 --- a/tools/ZAPDConfigs/gc-jp/Config.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/tools/ZAPDConfigs/gc-jp/SymbolMap.txt b/tools/ZAPDConfigs/gc-jp/SymbolMap.txt deleted file mode 100644 index 2062d21792..0000000000 --- a/tools/ZAPDConfigs/gc-jp/SymbolMap.txt +++ /dev/null @@ -1,2 +0,0 @@ -800FE2C0 gMtxClear -80A74150 sShadowTex diff --git a/tools/ZAPDConfigs/gc-us-mq/Config.xml b/tools/ZAPDConfigs/gc-us-mq/Config.xml deleted file mode 100644 index b2f4e3e4d3..0000000000 --- a/tools/ZAPDConfigs/gc-us-mq/Config.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/tools/ZAPDConfigs/gc-us-mq/SymbolMap.txt b/tools/ZAPDConfigs/gc-us-mq/SymbolMap.txt deleted file mode 100644 index 3ea1df6ccf..0000000000 --- a/tools/ZAPDConfigs/gc-us-mq/SymbolMap.txt +++ /dev/null @@ -1,2 +0,0 @@ -800FE280 gMtxClear -80A740B0 sShadowTex diff --git a/tools/ZAPDConfigs/gc-us/Config.xml b/tools/ZAPDConfigs/gc-us/Config.xml deleted file mode 100644 index b2f4e3e4d3..0000000000 --- a/tools/ZAPDConfigs/gc-us/Config.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/tools/ZAPDConfigs/gc-us/SymbolMap.txt b/tools/ZAPDConfigs/gc-us/SymbolMap.txt deleted file mode 100644 index 554f92028a..0000000000 --- a/tools/ZAPDConfigs/gc-us/SymbolMap.txt +++ /dev/null @@ -1,2 +0,0 @@ -800FE2A0 gMtxClear -80A74130 sShadowTex diff --git a/tools/ZAPDConfigs/ique-cn/Config.xml b/tools/ZAPDConfigs/ique-cn/Config.xml deleted file mode 100644 index b2f4e3e4d3..0000000000 --- a/tools/ZAPDConfigs/ique-cn/Config.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/tools/ZAPDConfigs/ique-cn/SymbolMap.txt b/tools/ZAPDConfigs/ique-cn/SymbolMap.txt deleted file mode 100644 index 52ff547fde..0000000000 --- a/tools/ZAPDConfigs/ique-cn/SymbolMap.txt +++ /dev/null @@ -1,2 +0,0 @@ -80106980 gMtxClear -80AE0B10 sShadowTex diff --git a/tools/ZAPDConfigs/ntsc-1.0/Config.xml b/tools/ZAPDConfigs/ntsc-1.0/Config.xml deleted file mode 100644 index b2f4e3e4d3..0000000000 --- a/tools/ZAPDConfigs/ntsc-1.0/Config.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/tools/ZAPDConfigs/ntsc-1.0/SymbolMap.txt b/tools/ZAPDConfigs/ntsc-1.0/SymbolMap.txt deleted file mode 100644 index f19720a6c6..0000000000 --- a/tools/ZAPDConfigs/ntsc-1.0/SymbolMap.txt +++ /dev/null @@ -1,2 +0,0 @@ -800FEDB0 gMtxClear -80AE0AE0 sShadowTex diff --git a/tools/ZAPDConfigs/ntsc-1.1/Config.xml b/tools/ZAPDConfigs/ntsc-1.1/Config.xml deleted file mode 100644 index b2f4e3e4d3..0000000000 --- a/tools/ZAPDConfigs/ntsc-1.1/Config.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/tools/ZAPDConfigs/ntsc-1.1/SymbolMap.txt b/tools/ZAPDConfigs/ntsc-1.1/SymbolMap.txt deleted file mode 100644 index 8bf78d7c3c..0000000000 --- a/tools/ZAPDConfigs/ntsc-1.1/SymbolMap.txt +++ /dev/null @@ -1,2 +0,0 @@ -800FEF70 gMtxClear -80AE0C80 sShadowTex diff --git a/tools/ZAPDConfigs/ntsc-1.2/Config.xml b/tools/ZAPDConfigs/ntsc-1.2/Config.xml deleted file mode 100644 index b2f4e3e4d3..0000000000 --- a/tools/ZAPDConfigs/ntsc-1.2/Config.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/tools/ZAPDConfigs/ntsc-1.2/SymbolMap.txt b/tools/ZAPDConfigs/ntsc-1.2/SymbolMap.txt deleted file mode 100644 index 2b9bac5cb0..0000000000 --- a/tools/ZAPDConfigs/ntsc-1.2/SymbolMap.txt +++ /dev/null @@ -1,2 +0,0 @@ -800FF3F0 gMtxClear -80AE0FE0 sShadowTex diff --git a/tools/ZAPDConfigs/pal-1.0/Config.xml b/tools/ZAPDConfigs/pal-1.0/Config.xml deleted file mode 100644 index 0b6ea61ff5..0000000000 --- a/tools/ZAPDConfigs/pal-1.0/Config.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/tools/ZAPDConfigs/pal-1.0/SymbolMap.txt b/tools/ZAPDConfigs/pal-1.0/SymbolMap.txt deleted file mode 100644 index 1f09fd7edd..0000000000 --- a/tools/ZAPDConfigs/pal-1.0/SymbolMap.txt +++ /dev/null @@ -1,2 +0,0 @@ -800FCD00 gMtxClear -80AE19F0 sShadowTex diff --git a/tools/ZAPDConfigs/pal-1.1/Config.xml b/tools/ZAPDConfigs/pal-1.1/Config.xml deleted file mode 100644 index 0b6ea61ff5..0000000000 --- a/tools/ZAPDConfigs/pal-1.1/Config.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/tools/ZAPDConfigs/pal-1.1/SymbolMap.txt b/tools/ZAPDConfigs/pal-1.1/SymbolMap.txt deleted file mode 100644 index a326070e29..0000000000 --- a/tools/ZAPDConfigs/pal-1.1/SymbolMap.txt +++ /dev/null @@ -1,2 +0,0 @@ -800FCD40 gMtxClear -80AE1B80 sShadowTex diff --git a/tools/assets/Makefile b/tools/assets/Makefile new file mode 100644 index 0000000000..324e19d571 --- /dev/null +++ b/tools/assets/Makefile @@ -0,0 +1,13 @@ +all: +# must build n64texconv before build_from_png + $(MAKE) -C n64texconv + $(MAKE) -C build_from_png + +clean: + $(MAKE) -C n64texconv clean + $(MAKE) -C build_from_png clean + +distclean: clean + $(MAKE) -C n64texconv distclean + +.PHONY: all clean distclean diff --git a/tools/assets/build_from_png/.gitignore b/tools/assets/build_from_png/.gitignore new file mode 100644 index 0000000000..e0d6a78806 --- /dev/null +++ b/tools/assets/build_from_png/.gitignore @@ -0,0 +1 @@ +build_from_png diff --git a/tools/assets/build_from_png/Makefile b/tools/assets/build_from_png/Makefile new file mode 100644 index 0000000000..4a74a0d6e8 --- /dev/null +++ b/tools/assets/build_from_png/Makefile @@ -0,0 +1,17 @@ +CFLAGS := -Wall -Werror -O3 + +ifeq ($(shell $(CC) --version | grep clang),) + OMPFLAGS := -fopenmp +else + OMPFLAGS := +endif + +default: build_from_png + +clean: + $(RM) build_from_png + +.PHONY: default clean + +build_from_png: build_from_png.c ../n64texconv/libn64texconv.a + $(CC) $(CFLAGS) -o $@ $^ $(OMPFLAGS) -lz -lm diff --git a/tools/assets/build_from_png/build_from_png.c b/tools/assets/build_from_png/build_from_png.c new file mode 100644 index 0000000000..2d4b5a8022 --- /dev/null +++ b/tools/assets/build_from_png/build_from_png.c @@ -0,0 +1,694 @@ +// SPDX-FileCopyrightText: © 2024 ZeldaRET +// SPDX-License-Identifier: MIT + +// Note: this is statically linked with GPL binaries, making the binary GPL-licensed + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../n64texconv/src/libn64texconv/bin2c.h" +#include "../n64texconv/src/libn64texconv/n64texconv.h" + +#define NUM_FORMATS 9 +static const struct fmt_info { + const char* name; + int fmt; + int siz; +} fmt_map[NUM_FORMATS] = { + // clang-format off + { "i4", G_IM_FMT_I, G_IM_SIZ_4b, }, + { "i8", G_IM_FMT_I, G_IM_SIZ_8b, }, + { "ci4", G_IM_FMT_CI, G_IM_SIZ_4b, }, + { "ci8", G_IM_FMT_CI, G_IM_SIZ_8b, }, + { "ia4", G_IM_FMT_IA, G_IM_SIZ_4b, }, + { "ia8", G_IM_FMT_IA, G_IM_SIZ_8b, }, + { "ia16", G_IM_FMT_IA, G_IM_SIZ_16b, }, + { "rgba16", G_IM_FMT_RGBA, G_IM_SIZ_16b, }, + { "rgba32", G_IM_FMT_RGBA, G_IM_SIZ_32b, }, + // clang-format on +}; + +enum sub_format { + SUBFMT_SPLIT_LO, + SUBFMT_SPLIT_HI, + SUBFMT_MAX, + SUBFMT_NONE +}; +static const char* subfmt_map[SUBFMT_MAX] = { + [SUBFMT_SPLIT_LO] = "split_lo", + [SUBFMT_SPLIT_HI] = "split_hi", +}; + +#define strequ(s1, s2) (strcmp(s1, s2) == 0) +#define strstartswith(s, prefix) (strncmp(s, prefix, strlen(prefix)) == 0) +static bool strendswith(const char* s, const char* suffix) { + size_t len_s = strlen(s); + size_t len_suffix = strlen(suffix); + return (len_s >= len_suffix) && (strncmp(s + len_s - len_suffix, suffix, len_suffix) == 0); +} + +static bool parse_png_p(char* png_p_buf, const struct fmt_info** fmtp, enum sub_format* subfmt, int* elem_sizep, + size_t* len_png_p_prefix, char** tlut_namep, int* tlut_elem_sizep, bool print_err) { + // The last 5 (or less) suffixes, without the '.' + const int max_n_suffixes = 5; + char* png_p_suffixes[max_n_suffixes]; + int n_suffixes_found = 0; + size_t i = strlen(png_p_buf); + while (i != 0) { + i--; + if (png_p_buf[i] == '.') { + png_p_suffixes[n_suffixes_found] = &png_p_buf[i + 1]; + n_suffixes_found++; + if (n_suffixes_found >= max_n_suffixes) { + break; + } + png_p_buf[i] = '\0'; + } + } + + if (n_suffixes_found == 0 || !strequ(png_p_suffixes[0], "png")) { + if (print_err) { + fprintf(stderr, "png path doesn't end with .png\n"); + } + return false; + } + int i_suffix = 1; + int i_suffix_elemtype = -1; + int i_suffix_tlut = -1; + int i_suffix_fmt = -1; + if (i_suffix < n_suffixes_found && + (strequ(png_p_suffixes[i_suffix], "u32") || strequ(png_p_suffixes[i_suffix], "u64"))) { + i_suffix_elemtype = i_suffix; + i_suffix++; + } + if (i_suffix < n_suffixes_found && strstartswith(png_p_suffixes[i_suffix], "tlut_")) { + i_suffix_tlut = i_suffix; + i_suffix++; + } + + *subfmt = SUBFMT_NONE; + if (i_suffix < n_suffixes_found) { + for (size_t i = 0; i < SUBFMT_MAX; i++) { + if (strequ(subfmt_map[i], png_p_suffixes[i_suffix])) { + i_suffix++; + *subfmt = i; + break; + } + } + } + + if (i_suffix >= n_suffixes_found) { + if (print_err) { + fprintf(stderr, "png path is missing a .format suffix\n"); + } + return false; + } + i_suffix_fmt = i_suffix; + + if (len_png_p_prefix != NULL) { + // The length of the png path up to the format suffix + *len_png_p_prefix = (png_p_suffixes[i_suffix] - strlen(".")) - png_p_buf; + } + + if (i_suffix_elemtype < 0) { + // No elem type suffix, default to u64 + *elem_sizep = 8; + } else { + if (strequ(png_p_suffixes[i_suffix_elemtype], "u64")) { + *elem_sizep = 8; + } else if (strequ(png_p_suffixes[i_suffix_elemtype], "u32")) { + *elem_sizep = 4; + } else { + // unreachable + assert(false); + } + } + + const struct fmt_info* fmt = NULL; + + for (size_t i = 0; i < NUM_FORMATS; i++) { + if (strequ(fmt_map[i].name, png_p_suffixes[i_suffix_fmt])) { + fmt = &fmt_map[i]; + break; + } + } + + if (fmt == NULL) { + if (print_err) { + fprintf(stderr, "png path is missing a .format suffix\n"); + } + return false; + } + + if ((*subfmt == SUBFMT_SPLIT_LO || *subfmt == SUBFMT_SPLIT_HI) && + !(fmt->fmt == G_IM_FMT_CI && fmt->siz == G_IM_SIZ_8b)) { + if (print_err) { + fprintf(stderr, "Can't use split_lo/split_hi sub-formats with a format other than ci8\n"); + } + return false; + } + + if (fmt->fmt == G_IM_FMT_CI && i_suffix_tlut >= 0) { + size_t tlut_elemtype_suffix_length; + if (strendswith(png_p_suffixes[i_suffix_tlut], "_u64")) { + *tlut_elem_sizep = 8; + tlut_elemtype_suffix_length = strlen("_u64"); + } else if (strendswith(png_p_suffixes[i_suffix_tlut], "_u32")) { + *tlut_elem_sizep = 4; + tlut_elemtype_suffix_length = strlen("_u32"); + } else { + // No tlut elem type, default to u64 + *tlut_elem_sizep = 8; + tlut_elemtype_suffix_length = 0; + } + // extract "ABC" from the "tlut_ABC_uXX" suffix + if (strlen(png_p_suffixes[i_suffix_tlut]) <= (strlen("tlut_") + tlut_elemtype_suffix_length)) { + if (print_err) { + fprintf(stderr, "png path with ci format has a bad .tlut_ suffix\n"); + } + return false; + } + png_p_suffixes[i_suffix_tlut][strlen(png_p_suffixes[i_suffix_tlut]) - tlut_elemtype_suffix_length] = '\0'; + *tlut_namep = strdup(png_p_suffixes[i_suffix_tlut] + strlen("tlut_")); + } + + *fmtp = fmt; + + return true; +} + +static void free_dir_list(char** dir_list) { + for (size_t i = 0; dir_list[i] != NULL; i++) { + free(dir_list[i]); + } + free(dir_list); +} + +/** + * Returns a NULL-terminated array of filenames in `dir_p`, + * or NULL if an error happens. + */ +static char** new_dir_list(const char* dir_p) { + DIR* dir = opendir(dir_p); + if (dir == NULL) { + perror("opendir"); + return NULL; + } + + size_t len_dir_list = 0; + size_t maxlen_dir_list = 16; + char** dir_list = malloc(sizeof(char* [maxlen_dir_list])); + + while (true) { + errno = 0; + struct dirent* dirent = readdir(dir); + if (dirent == NULL) { + if (errno != 0) { + perror("readdir"); + assert(len_dir_list < maxlen_dir_list); + dir_list[len_dir_list] = NULL; + free_dir_list(dir_list); + return NULL; + } + break; + } + assert(len_dir_list < maxlen_dir_list); + dir_list[len_dir_list] = strdup(dirent->d_name); + len_dir_list++; + + if (len_dir_list >= maxlen_dir_list) { + maxlen_dir_list *= 2; + dir_list = realloc(dir_list, sizeof(char* [maxlen_dir_list])); + } + } + + assert(len_dir_list < maxlen_dir_list); + dir_list[len_dir_list] = NULL; + + if (closedir(dir) != 0) { + perror("closedir"); + free_dir_list(dir_list); + return NULL; + } + return dir_list; +} + +static char* make_inc_c_p(const char* png_p, const char* out_dir_p) { + char* png_p_buf = strdup(png_p); + char* png_stem = basename(png_p_buf); + assert(strendswith(png_stem, ".png")); // checked by parse_png_p + png_stem[strlen(png_stem) - strlen(".png")] = '\0'; // cut off .png suffix + char* inc_c_p = malloc(strlen(out_dir_p) + strlen("/") + strlen(png_stem) + strlen(".inc.c") + 1); + sprintf(inc_c_p, "%s/%s.inc.c", out_dir_p, png_stem); + free(png_p_buf); + return inc_c_p; +} + +static bool handle_non_ci(const char* png_p, const struct fmt_info* fmt, int elem_size, const char* out_dir_p) { + bool success = true; + + // read png + struct n64_image* img = n64texconv_image_from_png(png_p, fmt->fmt, fmt->siz, G_IM_FMT_RGBA); + if (img == NULL) { + fprintf(stderr, "Could not read png %s\n", png_p); + success = false; + } + + // write image + if (success) { + char* inc_c_p = make_inc_c_p(png_p, out_dir_p); + + success = n64texconv_image_to_c_file(inc_c_p, img, false, false, elem_size) == 0; + if (!success) { + fprintf(stderr, "Could not write image to %s\n", inc_c_p); + } + + free(inc_c_p); + } + + if (img != NULL) { + n64texconv_image_free(img); + } + return success; +} + +static bool handle_ci_single(const char* png_p, const struct fmt_info* fmt, enum sub_format subfmt, int elem_size, + const char* out_dir_p, size_t len_png_p_prefix) { + const int tlut_elem_size = 8; + + bool success = true; + + if (subfmt != SUBFMT_NONE) { + // TODO + fprintf(stderr, "sub-formats are not supported for ci images with a non-shared tlut\n"); + return false; + } + + // read png + struct n64_image* img = n64texconv_image_from_png(png_p, fmt->fmt, fmt->siz, G_IM_FMT_RGBA); + if (img == NULL) { + fprintf(stderr, "Could not read png %s\n", png_p); + success = false; + } + + // write image + if (success) { + char* inc_c_p = make_inc_c_p(png_p, out_dir_p); + success = n64texconv_image_to_c_file(inc_c_p, img, false, false, elem_size) == 0; + if (!success) { + fprintf(stderr, "Could not write image to %s\n", inc_c_p); + } + free(inc_c_p); + } + + // write palette + if (success) { + char* png_p_buf = strdup(png_p); + png_p_buf[len_png_p_prefix] = '\0'; // cut off the suffixes + char* png_stem = basename(png_p_buf); + char* pal_inc_c_p = + malloc(strlen(out_dir_p) + strlen("/") + strlen(png_stem) + strlen(".tlut.rgba16.inc.c") + 1); + sprintf(pal_inc_c_p, "%s/%s.tlut.rgba16.inc.c", out_dir_p, png_stem); + free(png_p_buf); + + success = n64texconv_palette_to_c_file(pal_inc_c_p, img->pal, true, tlut_elem_size) == 0; + if (!success) { + fprintf(stderr, "Could not write palette to %s\n", pal_inc_c_p); + } + free(pal_inc_c_p); + } + + if (img != NULL) { + n64texconv_palette_free(img->pal); + n64texconv_image_free(img); + } + return success; +} + +static bool handle_ci_shared_tlut(const char* png_p, const struct fmt_info* fmt, enum sub_format subfmt, + const char* out_dir_p, char** in_dirs, int num_in_dirs, char* tlut_name, + int tlut_elem_size) { + const size_t len_out_dir_p = strlen(out_dir_p); + + size_t len_pngs_with_tlut = 0; + size_t maxlen_pngs_with_tlut = 16; + struct other_png_info { + char* png_p; + char* name; // pointer into png_p; don't free + int elem_size; + struct n64_image* img; + }* pngs_with_tlut = malloc(sizeof(struct other_png_info[maxlen_pngs_with_tlut])); + + // list pngs using the TLUT `tlut_name` into `pngs_with_tlut` + for (int j = 0; j < num_in_dirs; j++) { + const char* in_dir_p = in_dirs[j]; + const size_t len_in_dir_p = strlen(in_dir_p); + + char** in_dir_list = new_dir_list(in_dir_p); + if (in_dir_list == NULL) { + fprintf(stderr, "Couldn't list files in %s\n", in_dir_p); + return false; + } + + for (size_t i = 0; in_dir_list[i] != NULL; i++) { + char* direntry_name_buf = strdup(in_dir_list[i]); + const struct fmt_info* direntry_fmt; + enum sub_format direntry_subfmt; + int direntry_elem_size; + char* direntry_tlut_name = NULL; + int direntry_tlut_elem_size = -1; + if (parse_png_p(direntry_name_buf, &direntry_fmt, &direntry_subfmt, &direntry_elem_size, NULL, + &direntry_tlut_name, &direntry_tlut_elem_size, false)) { + if (direntry_fmt->fmt == G_IM_FMT_CI && direntry_tlut_name != NULL) { + if (strequ(tlut_name, direntry_tlut_name)) { + // TODO mismatching sub-format could be supported + if (direntry_fmt != fmt || direntry_subfmt != subfmt || + direntry_tlut_elem_size != tlut_elem_size) { + fprintf( + stderr, + "Images sharing TLUT \"%s\" have mismatching format, sub-format or tlut elem size:\n" + "%s\n" + "%s/%s\n", + tlut_name, png_p, in_dir_p, in_dir_list[i]); + free(direntry_name_buf); + free_dir_list(in_dir_list); + return false; + } + + bool png_name_already_found = false; + for (size_t k = 0; k < len_pngs_with_tlut; k++) { + if (strequ(pngs_with_tlut[k].name, in_dir_list[i])) { + png_name_already_found = true; + break; + } + } + + if (!png_name_already_found) { + if (len_pngs_with_tlut == maxlen_pngs_with_tlut) { + maxlen_pngs_with_tlut *= 2; + pngs_with_tlut = + realloc(pngs_with_tlut, sizeof(struct other_png_info[maxlen_pngs_with_tlut])); + } + assert(len_pngs_with_tlut < maxlen_pngs_with_tlut); + char* other_png_p = malloc(len_in_dir_p + strlen("/") + strlen(in_dir_list[i]) + 1); + sprintf(other_png_p, "%s/%s", in_dir_p, in_dir_list[i]); + pngs_with_tlut[len_pngs_with_tlut].png_p = other_png_p; + pngs_with_tlut[len_pngs_with_tlut].name = other_png_p + len_in_dir_p + strlen("/"); + pngs_with_tlut[len_pngs_with_tlut].elem_size = direntry_elem_size; + pngs_with_tlut[len_pngs_with_tlut].img = NULL; + len_pngs_with_tlut++; + } + } + } + } + free(direntry_name_buf); + } + assert(len_pngs_with_tlut <= maxlen_pngs_with_tlut); + + free_dir_list(in_dir_list); + } + + bool success = true; + + // read "reference" png + struct n64_image* ref_img = n64texconv_image_from_png(png_p, G_IM_FMT_CI, fmt->siz, G_IM_FMT_RGBA); + if (ref_img == NULL) { + fprintf(stderr, "Could not read png %s\n", png_p); + success = false; + } + + // read all pngs that share the TLUT + if (success) { + for (size_t i = 0; i < len_pngs_with_tlut; i++) { + struct n64_image* other_img = + n64texconv_image_from_png(pngs_with_tlut[i].png_p, G_IM_FMT_CI, fmt->siz, G_IM_FMT_RGBA); + pngs_with_tlut[i].img = other_img; + if (other_img == NULL) { + fprintf(stderr, "Could not read other png %s\n", pngs_with_tlut[i].png_p); + success = false; + break; + } + } + } + + if (success) { + // check if all palettes are the same + bool all_other_pngs_match_ref_img_pal = true; + for (size_t i = 0; i < len_pngs_with_tlut; i++) { + assert(pngs_with_tlut[i].img != NULL); +#ifdef VERBOSE + fprintf(stderr, "%s %s\n", pngs_with_tlut[i].name, pngs_with_tlut[i].png_p); +#endif + if (all_other_pngs_match_ref_img_pal) { + struct n64_image* other_img = pngs_with_tlut[i].img; + bool pal_matches_ref = other_img->pal->count == ref_img->pal->count && + memcmp(other_img->pal->texels, ref_img->pal->texels, + sizeof(struct color[ref_img->pal->count])) == 0; + if (!pal_matches_ref) { + all_other_pngs_match_ref_img_pal = false; + } + } + } + + char* pal_inc_c_p = + malloc(len_out_dir_p + strlen("/") + strlen(tlut_name) + strlen(".tlut.rgba16.uXX.inc.c") + 1); + assert(tlut_elem_size == 8 || tlut_elem_size == 4); + sprintf(pal_inc_c_p, "%s/%s.tlut.rgba16%s.inc.c", out_dir_p, tlut_name, tlut_elem_size == 8 ? "" : ".u32"); + + const unsigned int max_colors = fmt->siz == G_IM_SIZ_4b ? 16 + : subfmt == SUBFMT_SPLIT_LO || subfmt == SUBFMT_SPLIT_HI ? 128 + : 256; + + if (all_other_pngs_match_ref_img_pal && ref_img->pal->count <= max_colors) { + // write matching palette, and matching color indices for all pngs +#ifdef VERBOSE + fprintf(stderr, "Matching data detected!\n"); +#endif + + // pass pad_to_8b=true to account for the case where this is in fact not matching data + // (the png was silently palettized by n64texconv) + // Note: this forces all palette sizes to be 8-aligned, even u32-element-typed ones + int ret = n64texconv_palette_to_c_file(pal_inc_c_p, ref_img->pal, true, tlut_elem_size); + success = ret == 0; + if (!success) { + fprintf(stderr, "Could not write palette to %s (%d)\n", pal_inc_c_p, ret); + } + + if (success) { + for (size_t i = 0; i < len_pngs_with_tlut; i++) { + char* inc_c_p = make_inc_c_p(pngs_with_tlut[i].png_p, out_dir_p); + + if (subfmt == SUBFMT_SPLIT_HI) { + size_t size = pngs_with_tlut[i].img->width * pngs_with_tlut[i].img->height; + uint8_t bin[size]; + for (size_t j = 0; j < size; j++) { + // ensured by the `ref_img->pal->count <= max_colors` check + assert(pngs_with_tlut[i].img->color_indices[j] < 128); + + bin[j] = 128 + pngs_with_tlut[i].img->color_indices[j]; + } + success = bin2c_file(inc_c_p, bin, size, 0, pngs_with_tlut[i].elem_size) == 0; + } else { + success = n64texconv_image_to_c_file(inc_c_p, pngs_with_tlut[i].img, false, false, + pngs_with_tlut[i].elem_size) == 0; + } + if (!success) { + fprintf(stderr, "Could not write image to %s\n", inc_c_p); + } + free(inc_c_p); + if (!success) { + break; + } + } + } + } else { + // co-palettize all pngs +#ifdef VERBOSE + fprintf(stderr, "Non-matching data detected!\n"); +#endif + const bool copaletize_write_out_pngs = true; + + const size_t num_images = len_pngs_with_tlut; + uint8_t* out_indices[num_images]; + struct color* texels[num_images]; + size_t widths[num_images]; + size_t heights[num_images]; + for (size_t i = 0; i < len_pngs_with_tlut; i++) { + assert(pngs_with_tlut[i].img != NULL); + out_indices[i] = malloc(pngs_with_tlut[i].img->width * pngs_with_tlut[i].img->height); + texels[i] = pngs_with_tlut[i].img->texels; + widths[i] = pngs_with_tlut[i].img->width; + heights[i] = pngs_with_tlut[i].img->height; + } + struct color out_pal[max_colors]; + size_t out_pal_count; + const float dither_level = 0.5f; + + success = n64texconv_quantize_shared(out_indices, out_pal, &out_pal_count, texels, widths, heights, + num_images, max_colors, dither_level) == 0; + if (!success) { + fprintf(stderr, "Could not co-palettize images\n"); + } + + // write palette to .inc.c + struct n64_palette pal = { out_pal, G_IM_FMT_RGBA, out_pal_count }; + if (success) { + int ret = n64texconv_palette_to_c_file(pal_inc_c_p, &pal, true, tlut_elem_size); + success = ret == 0; + if (!success) { + fprintf(stderr, "Could not write generated palette to %s (%d)\n", pal_inc_c_p, ret); + } + } + // write palette to .png + if (success) { + if (copaletize_write_out_pngs) { + char* pal_out_png_p = strdup(pal_inc_c_p); + assert(strendswith(pal_inc_c_p, ".inc.c")); + pal_out_png_p[strlen(pal_out_png_p) - strlen(".inc.c")] = '\0'; + strcat(pal_out_png_p, ".png"); + success = n64texconv_palette_to_png(pal_out_png_p, &pal) == 0; + if (!success) { + fprintf(stderr, "Could not write generated palette to png %s\n", pal_out_png_p); + } + free(pal_out_png_p); + } + } + + // write images... + if (success) { + for (size_t i = 0; i < len_pngs_with_tlut; i++) { + char* other_png_p_buf = strdup(pngs_with_tlut[i].png_p); + char* other_png_stem = basename(other_png_p_buf); + assert(strendswith(other_png_stem, ".png")); // checked by parse_png_p + other_png_stem[strlen(other_png_stem) - strlen(".png")] = '\0'; // cut off .png suffix + char* inc_c_p = malloc(len_out_dir_p + strlen("/") + strlen(other_png_stem) + strlen(".inc.c") + 1); + sprintf(inc_c_p, "%s/%s.inc.c", out_dir_p, other_png_stem); + free(other_png_p_buf); + + struct n64_image img = { + pngs_with_tlut[i].img->width, + pngs_with_tlut[i].img->height, + G_IM_FMT_CI, + fmt->siz, + &pal, + pngs_with_tlut[i].img->texels, + out_indices[i], + }; + + // ... to .inc.c + if (subfmt == SUBFMT_SPLIT_HI) { + size_t size = img.width * img.height; + uint8_t bin[size]; + for (size_t j = 0; j < size; j++) { + // ensured by `max_colors` being 128 for SUBFMT_SPLIT_* + assert(img.color_indices[j] < 128); + + bin[j] = 128 + img.color_indices[j]; + } + success = bin2c_file(inc_c_p, bin, size, 0, pngs_with_tlut[i].elem_size) == 0; + } else { + success = + n64texconv_image_to_c_file(inc_c_p, &img, false, false, pngs_with_tlut[i].elem_size) == 0; + } + if (!success) { + fprintf(stderr, "Could not write palettized image to %s\n", inc_c_p); + break; + } + + // ... to .png + if (copaletize_write_out_pngs) { + char* out_png_p = strdup(inc_c_p); + assert(strendswith(inc_c_p, ".inc.c")); + out_png_p[strlen(out_png_p) - strlen(".inc.c")] = '\0'; + strcat(out_png_p, ".png"); + success = n64texconv_image_to_png(out_png_p, &img, false) == 0; + if (!success) { + fprintf(stderr, "Could not write palettized image to png %s\n", out_png_p); + } + free(out_png_p); + if (!success) { + break; + } + } + } + } + + for (size_t i = 0; i < num_images; i++) { + free(out_indices[i]); + } + } + + free(pal_inc_c_p); + } + + if (ref_img != NULL) { + n64texconv_image_free(ref_img); + } + + for (size_t i = 0; i < len_pngs_with_tlut; i++) { + free(pngs_with_tlut[i].png_p); + if (pngs_with_tlut[i].img != NULL) { + n64texconv_palette_free(pngs_with_tlut[i].img->pal); + n64texconv_image_free(pngs_with_tlut[i].img); + } + } + free(pngs_with_tlut); + + return success; +} + +int main(int argc, char** argv) { + if (argc < 3) { + usage: + fprintf(stderr, + "Usage: build_from_png path/to/file.png path/to/out/folder/ [path/to/input/folder1/ ...]\n" + "The png file should be named like:\n" + " - texName.format[.].png (non-ci formats or ci formats with a non-shared tlut)\n" + " - texName.ci<4|8>.tlut_tlutName[_][.].png (ci formats with a shared tlut)\n"); + return EXIT_FAILURE; + } + const char* png_p = argv[1]; + const char* out_dir_p = argv[2]; + char** in_dirs = argv + 3; + const int num_in_dirs = argc - 3; + + const struct fmt_info* fmt; + enum sub_format subfmt; + int elem_size; + size_t len_png_p_prefix; + char* tlut_name = NULL; + int tlut_elem_size = -1; + + { + char* png_p_buf = strdup(png_p); + bool success = + parse_png_p(png_p_buf, &fmt, &subfmt, &elem_size, &len_png_p_prefix, &tlut_name, &tlut_elem_size, true); + free(png_p_buf); + if (!success) { + goto usage; + } + } + + bool success; + + if (fmt->fmt != G_IM_FMT_CI) { + success = handle_non_ci(png_p, fmt, elem_size, out_dir_p); + } else { + if (tlut_name == NULL) { + success = handle_ci_single(png_p, fmt, subfmt, elem_size, out_dir_p, len_png_p_prefix); + } else { + success = + handle_ci_shared_tlut(png_p, fmt, subfmt, out_dir_p, in_dirs, num_in_dirs, tlut_name, tlut_elem_size); + free(tlut_name); + } + } + + return success ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/tools/assets/conf.py b/tools/assets/conf.py new file mode 100644 index 0000000000..f31582a988 --- /dev/null +++ b/tools/assets/conf.py @@ -0,0 +1,2 @@ +WRITE_HINTS = True +I_D_OMEGALUL = True # IDO specific things that may be otherwise different diff --git a/tools/assets/descriptor/README.md b/tools/assets/descriptor/README.md new file mode 100644 index 0000000000..6336e0d417 --- /dev/null +++ b/tools/assets/descriptor/README.md @@ -0,0 +1 @@ +This package serves as an abstraction layer wrapping assets xml files. diff --git a/tools/assets/descriptor/__main__.py b/tools/assets/descriptor/__main__.py new file mode 100644 index 0000000000..0d3f4e6dc3 --- /dev/null +++ b/tools/assets/descriptor/__main__.py @@ -0,0 +1,32 @@ +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +from pprint import pprint as vanilla_pprint + +try: + from rich.pretty import pprint +except ImportError: + pprint = vanilla_pprint + +from tools import version_config + +from . import base + + +def main(): + vc = version_config.load_version_config("gc-eu-mq-dbg") + + pools = base.get_resources_desc(vc) + + try: + for pool in pools: + if any(coll.out_path.name == "gameplay_keep" for coll in pool.collections): + vanilla_pprint(pool) + else: + pprint(pool) + input("Press enter for next pool") + except KeyboardInterrupt: + print() + + +main() diff --git a/tools/assets/descriptor/base.py b/tools/assets/descriptor/base.py new file mode 100644 index 0000000000..a0833ec093 --- /dev/null +++ b/tools/assets/descriptor/base.py @@ -0,0 +1,318 @@ +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +import abc +import dataclasses +from functools import cache +from pathlib import Path +from typing import Callable, Optional +from xml.etree import ElementTree + +from tools import version_config + + +class BackingMemory(abc.ABC): + pass + + +@dataclasses.dataclass +class BaseromFileBackingMemory(BackingMemory): + name: str + range: Optional[tuple[int, int]] + """If set, consider file_data[range[0]:range[1]] instead of the full file""" + + +@dataclasses.dataclass +class NoBackingMemory(BackingMemory): + pass + + +# eq=False so this uses id-based equality and hashing +# Subclasses must also be made to use id-based equality and hashing +@dataclasses.dataclass(eq=False) +class ResourceDesc(abc.ABC): + """A resource is a data unit. + For example, a symbol's data such as a DList or a texture.""" + + symbol_name: str + offset: int + """How many bytes into the backing memory the resource is located at""" + collection: "ResourcesDescCollection" = dataclasses.field(repr=False) + origin: object + """opaque object with data about where this resource comes from (for debugging)""" + + hack_modes: set[str] = dataclasses.field(init=False, default_factory=set) + + +class StartAddress(abc.ABC): + pass + + +@dataclasses.dataclass +class VRAMStartAddress(StartAddress): + vram: int + + +@dataclasses.dataclass +class SegmentStartAddress(StartAddress): + segment: int + + +@dataclasses.dataclass(eq=False) +class ResourcesDescCollection: + """A collection is a list of resources backed by the same memory.""" + + out_path: Path + backing_memory: BackingMemory + start_address: Optional[StartAddress] + resources: list[ResourceDesc] + last_modified_time: float + depends: list["ResourcesDescCollection"] + + +@dataclasses.dataclass(eq=False) +class ResourcesDescCollectionsPool: + """A pool contains a minimal set of interconnected collections. + For example, gkeep and all files using gkeep, + or more simply a single collection with no connection.""" + + collections: list[ResourcesDescCollection] + + +ResourceHandlerPass2Callback = Callable[[ResourcesDescCollectionsPool], None] + + +@dataclasses.dataclass +class ResourceHandlerNeedsPass2Exception(Exception): + resource: ResourceDesc + pass2_callback: ResourceHandlerPass2Callback + + +# eq=False so this uses id-based equality and hashing +@dataclasses.dataclass(eq=False) +class AssetConfigPiece: + ac: version_config.AssetConfig + last_modified_time: float = None + etree: ElementTree.ElementTree = None + depends: list["AssetConfigPiece"] = dataclasses.field(default_factory=list) + """The AssetConfigPiece s this instance depends on""" + collections: list[ResourcesDescCollection] = dataclasses.field(default_factory=list) + + +def get_resources_desc(vc: version_config.VersionConfig): + # Wrap AssetConfig objects in AssetConfigPiece for hashability and to collect data + acps = [AssetConfigPiece(ac) for ac in vc.assets] + + # Parse xmls + for acp in acps: + acp.last_modified_time = acp.ac.xml_path.stat().st_mtime + try: + with acp.ac.xml_path.open(encoding="UTF-8") as f: + etree = ElementTree.parse(f) + acp.etree = etree + except Exception as e: + raise Exception(f"Error when parsing XML for {acp}") from e + + # Resolve pools + acp_by_name = {acp.ac.name: acp for acp in acps} + pools = {acp: {acp} for acp in acps} + for acp in acps: + try: + rootelem = acp.etree.getroot() + assert rootelem.tag == "Root", rootelem.tag + for fileelem in rootelem: + assert fileelem.tag in {"ExternalFile", "File"}, fileelem.tag + if fileelem.tag == "ExternalFile": + externalfile_name = str( + Path(fileelem.attrib["OutPath"]).relative_to("assets") + ) + assert externalfile_name in acp_by_name, externalfile_name + externalfile_acp = acp_by_name[externalfile_name] + acp.depends.append(externalfile_acp) + acp_pool = pools[acp] + externalfile_acp_pool = pools[externalfile_acp] + merged_pool = acp_pool | externalfile_acp_pool + for merged_pool_acp in merged_pool: + pools[merged_pool_acp] = merged_pool + except Exception as e: + raise Exception(f"Error while resolving pools with {acp}") from e + + # List unique pools + pools_unique: list[set[AssetConfigPiece]] = [] + while pools: + pool = next(iter(pools.values())) + pools_unique.append(pool) + for acp in pool: + del pools[acp] + + # Build resources for all pools + pools: list[ResourcesDescCollectionsPool] = [] + for pool in pools_unique: + try: + all_needs_pass2_exceptions: list[ResourceHandlerNeedsPass2Exception] = [] + rescolls: list[ResourcesDescCollection] = [] + + # Pass 1: create Resource objects + for acp in pool: + try: + rootelem = acp.etree.getroot() + for fileelem in rootelem: + if fileelem.tag == "File": + rc, needs_pass2_exceptions = ( + _get_resources_fileelem_to_resourcescollection_pass1( + vc, pool, acp, fileelem + ) + ) + acp.collections.append(rc) + rescolls.append(rc) + all_needs_pass2_exceptions.extend(needs_pass2_exceptions) + except Exception as e: + raise Exception(f"Error with {acp}") from e + + rcpool = ResourcesDescCollectionsPool(rescolls) + + # + for acp in pool: + for acp_coll in acp.collections: + acp_coll.depends.extend( + (_coll for _coll in acp.collections if _coll != acp_coll) + ) + for acp_dep in acp.depends: + acp_coll.depends.extend(acp_dep.collections) + + # Pass 2: execute callbacks + for needs_pass2_exc in all_needs_pass2_exceptions: + try: + needs_pass2_exc.pass2_callback(rcpool) + except Exception as e: + raise Exception( + f"Error with pass 2 callback for {needs_pass2_exc.resource}" + ) from e + + pools.append(rcpool) + + except Exception as e: + raise Exception(f"Error with pool {pool}") from e + + return pools + + +def _get_resources_fileelem_to_resourcescollection_pass1( + vc: version_config.VersionConfig, + pool: list[AssetConfigPiece], + acp: AssetConfigPiece, + fileelem: ElementTree.Element, +): + # Determine backing_memory + if acp.ac.start_offset is None: + assert acp.ac.end_offset is None + baserom_file_range = None + else: + assert acp.ac.end_offset is not None + baserom_file_range = (acp.ac.start_offset, acp.ac.end_offset) + backing_memory = BaseromFileBackingMemory( + name=fileelem.attrib["Name"], + range=baserom_file_range, + ) + + # Determine start_address + if any( + acp.ac.name.startswith(_prefix) for _prefix in ("code/", "n64dd/", "overlays/") + ): + # File start address is vram + assert "Segment" not in fileelem.attrib + assert acp.ac.start_offset is not None and acp.ac.end_offset is not None, ( + "Unsupported combination: " + f"start/end offset not in config for vram asset {acp.ac.name}" + ) + if acp.ac.name.startswith("overlays/"): + overlay_name = acp.ac.name.split("/")[1] + start_address = VRAMStartAddress( + vc.dmadata_segments[overlay_name].vram + acp.ac.start_offset + ) + else: + file_name = acp.ac.name.split("/")[0] # "code" or "n64dd" + start_address = VRAMStartAddress( + vc.dmadata_segments[file_name].vram + acp.ac.start_offset + ) + elif "Segment" in fileelem.attrib: + # File start address is a segmented address + assert acp.ac.start_offset is None and acp.ac.end_offset is None, ( + "Unsupported combination: " + "start/end offset in config and file starts at a segmented address" + ) + start_address = SegmentStartAddress(int(fileelem.attrib["Segment"])) + else: + # File does not have a start address + start_address = None + + # resources + resources: list[ResourceDesc] = [] + collection = ResourcesDescCollection( + Path(acp.ac.name), + backing_memory, + start_address, + resources, + acp.last_modified_time, + [], + ) + needs_pass2_exceptions: list[ResourceHandlerNeedsPass2Exception] = [] + for reselem in fileelem: + try: + symbol_name = reselem.attrib["Name"] + offset = int(reselem.attrib["Offset"], 16) + res_handler = _get_resource_handler(reselem.tag) + try: + res = res_handler(symbol_name, offset, collection, reselem) + except ResourceHandlerNeedsPass2Exception as needs_pass2_exc: + res = needs_pass2_exc.resource + needs_pass2_exceptions.append(needs_pass2_exc) + assert isinstance(res, ResourceDesc) + resources.append(res) + except Exception as e: + raise Exception( + "Error with resource element:\n" + + ElementTree.tostring(reselem, encoding="unicode") + ) from e + + return collection, needs_pass2_exceptions + + +ResourceHandler = Callable[ + [str, int, ResourcesDescCollection, ElementTree.Element], + ResourceDesc, +] + + +@cache +def _get_resource_handler(tag: str) -> ResourceHandler: + from . import n64resources + from . import z64resources + + resource_handlers = { + "DList": n64resources.handler_DList, + "Blob": n64resources.handler_Blob, + "Mtx": n64resources.handler_Mtx, + "Array": n64resources.handler_Array, + "Texture": n64resources.handler_Texture, + "Collision": z64resources.handler_Collision, + "Animation": z64resources.handler_Animation, + "PlayerAnimation": z64resources.handler_PlayerAnimation, + "LegacyAnimation": z64resources.handler_LegacyAnimation, + "Cutscene": z64resources.handler_Cutscene, + "Scene": z64resources.handler_Scene, + "Room": z64resources.handler_Room, + "PlayerAnimationData": z64resources.handler_PlayerAnimationData, + "Path": z64resources.handler_PathList, + "Skeleton": z64resources.handler_Skeleton, + "Limb": z64resources.handler_Limb, + "CurveAnimation": z64resources.handler_CurveAnimation, + "LimbTable": z64resources.handler_LimbTable, + } + + rh = resource_handlers.get(tag) + + if rh is None: + raise Exception(f"Unknown resource tag {tag}") + else: + return rh diff --git a/tools/assets/descriptor/n64resources.py b/tools/assets/descriptor/n64resources.py new file mode 100644 index 0000000000..fe7c7172da --- /dev/null +++ b/tools/assets/descriptor/n64resources.py @@ -0,0 +1,241 @@ +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +import dataclasses +import enum +from xml.etree.ElementTree import Element + +from ..n64 import G_IM_FMT, G_IM_SIZ + +from .base import ( + ResourceDesc, + ResourcesDescCollection, + ResourcesDescCollectionsPool, + ResourceHandlerNeedsPass2Exception, + BaseromFileBackingMemory, +) +from . import xml_errors + +# TODO remove +STATIC_ATTRIB = {"Static"} + + +class GfxMicroCode(enum.Enum): + F3DEX = enum.auto() + F3DEX2 = enum.auto() + + +@dataclasses.dataclass(eq=False) +class DListResourceDesc(ResourceDesc): + ucode: GfxMicroCode + raw_pointers: set[int] = dataclasses.field(default_factory=set) + """Pointers in the dlist that are fine to keep raw ("in hex") instead of using symbols""" + + +def handler_DList(symbol_name, offset, collection, reselem: Element): + xml_errors.check_attrib( + reselem, {"Name", "Offset"}, {"Ucode", "RawPointers"} | STATIC_ATTRIB + ) + if "Ucode" in reselem.attrib: + ucode = GfxMicroCode[reselem.attrib["Ucode"].upper()] + else: + ucode = GfxMicroCode.F3DEX2 + res = DListResourceDesc(symbol_name, offset, collection, reselem, ucode) + raw_pointers_str = reselem.attrib.get("RawPointers") + if raw_pointers_str: + for rp_str in raw_pointers_str.split(","): + res.raw_pointers.add(int(rp_str, 16)) + return res + + +@dataclasses.dataclass(eq=False) +class BlobResourceDesc(ResourceDesc): + size: int + + +def handler_Blob(symbol_name, offset, collection, reselem: Element): + xml_errors.check_attrib(reselem, {"Name", "Offset", "Size"}, STATIC_ATTRIB) + size = int(reselem.attrib["Size"], 16) + return BlobResourceDesc(symbol_name, offset, collection, reselem, size) + + +@dataclasses.dataclass(eq=False) +class MtxResourceDesc(ResourceDesc): + pass + + +def handler_Mtx(symbol_name, offset, collection, reselem: Element): + xml_errors.check_attrib(reselem, {"Name", "Offset"}, STATIC_ATTRIB) + return MtxResourceDesc(symbol_name, offset, collection, reselem) + + +@dataclasses.dataclass(eq=False) +class S16ArrayResourceDesc(ResourceDesc): + count: int + + +@dataclasses.dataclass(eq=False) +class Vec3sArrayResourceDesc(ResourceDesc): + count: int + + +@dataclasses.dataclass(eq=False) +class VtxArrayResourceDesc(ResourceDesc): + count: int + + +def handler_Array(symbol_name, offset, collection, reselem: Element): + xml_errors.check_attrib(reselem, {"Name", "Offset", "Count"}, STATIC_ATTRIB) + count = int(reselem.attrib["Count"]) + assert len(reselem) == 1, "Expected exactly one child of Array node" + array_elem = reselem[0] + if array_elem.tag == "Vtx": + array_resource_type = VtxArrayResourceDesc + elif ( + array_elem.tag == "Vector" + and array_elem.attrib["Type"] == "s16" + and int(array_elem.attrib["Dimensions"]) == 3 + ): + array_resource_type = Vec3sArrayResourceDesc + elif array_elem.tag == "Scalar" and array_elem.attrib["Type"] == "s16": + array_resource_type = S16ArrayResourceDesc + else: + raise NotImplementedError(f"Array of {array_elem.tag}") + return array_resource_type(symbol_name, offset, collection, reselem, count) + + +class TextureFormat(enum.Enum): + RGBA16 = (G_IM_FMT.RGBA, G_IM_SIZ._16b) + RGBA32 = (G_IM_FMT.RGBA, G_IM_SIZ._32b) + CI4 = (G_IM_FMT.CI, G_IM_SIZ._4b) + CI8 = (G_IM_FMT.CI, G_IM_SIZ._8b) + I4 = (G_IM_FMT.I, G_IM_SIZ._4b) + I8 = (G_IM_FMT.I, G_IM_SIZ._8b) + IA4 = (G_IM_FMT.IA, G_IM_SIZ._4b) + IA8 = (G_IM_FMT.IA, G_IM_SIZ._8b) + IA16 = (G_IM_FMT.IA, G_IM_SIZ._16b) + + def __init__(self, fmt: G_IM_FMT, siz: G_IM_SIZ): + self.fmt = fmt + self.siz = siz + + +@dataclasses.dataclass(eq=False) +class TextureResourceDesc(ResourceDesc): + format: TextureFormat + width: int + height: int + + +@dataclasses.dataclass(eq=False) +class CITextureResourceDesc(TextureResourceDesc): + tlut: TextureResourceDesc + + +def handler_Texture( + symbol_name, offset, collection: ResourcesDescCollection, reselem: Element +): + xml_errors.check_attrib( + reselem, + {"Name", "Offset", "Format", "Width", "Height"}, + # TODO remove OutName, SplitTlut + { + "OutName", + "SplitTlut", + "TlutOffset", + "ExternalTlut", + "ExternalTlutOffset", + "HackMode", + } + | STATIC_ATTRIB, + ) + format = TextureFormat[reselem.attrib["Format"].upper()] + width = int(reselem.attrib["Width"]) + height = int(reselem.attrib["Height"]) + if format.fmt == G_IM_FMT.CI: + res = CITextureResourceDesc( + symbol_name, offset, collection, reselem, format, width, height, None + ) + + if reselem.attrib.get("SplitTlut") == "true": + res.hack_modes.add("hackmode_split_tlut_true") + if reselem.attrib.get("SplitTlut") == "false": + res.hack_modes.add("hackmode_split_tlut_false") + + assert ( + "TlutOffset" in reselem.attrib or "ExternalTlutOffset" in reselem.attrib + ), f"CI texture {symbol_name} is missing a tlut offset" + + if "TlutOffset" in reselem.attrib: + xml_errors.check_attrib( + reselem, + {"Name", "Offset", "Format", "Width", "Height", "TlutOffset"}, + # TODO remove OutName, SplitTlut + {"OutName", "SplitTlut", "HackMode"} | STATIC_ATTRIB, + ) + tlut_offset = int(reselem.attrib["TlutOffset"], 16) + + def pass2_callback(pool: ResourcesDescCollectionsPool): + matching_tlut_resources = [ + res for res in collection.resources if res.offset == tlut_offset + ] + assert len(matching_tlut_resources) == 1, ( + f"Found {len(matching_tlut_resources)} resources at TlutOffset " + f"0x{tlut_offset:X} instead of exactly one" + ) + assert isinstance( + matching_tlut_resources[0], TextureResourceDesc + ), matching_tlut_resources[0] + res.tlut = matching_tlut_resources[0] + + else: + xml_errors.check_attrib( + reselem, + { + "Name", + "Offset", + "Format", + "Width", + "Height", + "ExternalTlut", + "ExternalTlutOffset", + }, + # TODO remove OutName, SplitTlut + {"OutName", "SplitTlut", "HackMode"} | STATIC_ATTRIB, + ) + external_tlut_file = reselem.attrib["ExternalTlut"] + external_tlut_offset = int(reselem.attrib["ExternalTlutOffset"], 16) + + def pass2_callback(pool: ResourcesDescCollectionsPool): + matching_collections = [ + coll + for coll in pool.collections + if isinstance(coll.backing_memory, BaseromFileBackingMemory) + and coll.backing_memory.name == external_tlut_file + ] + assert len(matching_collections) == 1 + matching_tlut_resources = [ + res + for res in matching_collections[0].resources + if res.offset == external_tlut_offset + ] + assert len(matching_tlut_resources) == 1, matching_tlut_resources + assert isinstance( + matching_tlut_resources[0], TextureResourceDesc + ), matching_tlut_resources[0] + res.tlut = matching_tlut_resources[0] + + raise ResourceHandlerNeedsPass2Exception(res, pass2_callback) + else: + xml_errors.check_attrib( + reselem, + {"Name", "Offset", "Format", "Width", "Height"}, + # TODO remove OutName + {"OutName", "HackMode"} | STATIC_ATTRIB, + ) + res = TextureResourceDesc( + symbol_name, offset, collection, reselem, format, width, height + ) + if reselem.attrib.get("HackMode") == "ignore_orphaned_tlut": + res.hack_modes.add("hackmode_ignore_orphaned_tlut") + return res diff --git a/tools/assets/descriptor/spec.md b/tools/assets/descriptor/spec.md new file mode 100644 index 0000000000..c038a13f82 --- /dev/null +++ b/tools/assets/descriptor/spec.md @@ -0,0 +1,291 @@ +This document describes the expected structure of xml files describing assets. + +# Top elements + +## `Root` + +```xml + + ... + +``` + +This is the root element in the file, containing exclusively `` and `` elements as direct children. + +## `File` + +```xml + + ... + +``` + +A `` contains resources elements as children. + +- Required attributes: `Name` +- Optional attributes: `Segment` + +`Name` is the name of the baserom file from which the data is to be extracted. + +`Segment` (decimal) is the segment number for the file. + +## `ExternalFile` + +```xml + +``` + +Declare the ``s in the xml may reference symbols from an external file. + +The external file is located by matching its name against the list of assets in the version's `config.yml`. + +For example, `baseroms/gc-eu/config.yml` contains + +```yml +assets: +- name: objects/gameplay_keep + xml_path: assets/xml/objects/gameplay_keep_pal.xml +``` + +then `` refers to that gameplay_keep entry, which uses the `gameplay_keep_pal.xml` xml file when extracting assets for version gc-eu. + + +# Resource elements + +Resource elements describe resources. Resources are pieces of data corresponding to a symbol each. + +Two attributes are required on all resource elements: `Name` and `Offset`. + +- `Name` is the name of the symbol associated to the resource. +- `Offset` is the location in bytes from the start of the file data. + +## `Blob` + +```xml + +``` + +Unstructured binary data. + +- Required attributes: `Size` + +`Size` is the size of the binary blob in bytes. + +## `DList` + +```xml + +``` + +A display list. + +- Optional attributes: `Ucode`, `RawPointers` + +`Ucode` (defaults to `f3dex2`) picks the graphics microcode for which to disassemble the dlist. It may be `f3dex` or `f3dex2`. + +`RawPointers` (defaults to an empty value) is a comma-separated list of values the display list uses as raw pointers ("hex" instead of a symbol). The purpose of this attribute is to silence extraction warnings. + +## `Mtx` + +```xml + +``` + +A fixed-point matrix. + +## `Texture` + +```xml + + + +``` + +A texture, an image in one of the native N64 formats. + +- Required attributes for all formats: `Format`, `Width`, `Height` +- Required attributes for CI formats (`ci4`, `ci8`): `TlutOffset`, or `ExternalTlut` and `ExternalTlutOffset` + +`Format` is the format of the texture, one of `rgba32`, `rgba16`, `i4`, `i8`, `ia4`, `ia8`, `ia16`, `ci4` or `ci8`. + +`Width` and `Height` specify the dimensions of the texture. + +For CI formats, the TLUT (Texture Look Up Table, or palette) must be specified with either `TlutOffset` if the TLUT is in the same file as the texture, or both of `ExternalTlut` and `ExternalTlutOffset` if the TLUT is in a different file. `ExternalTlut` is the name of the baserom file where the TLUT is. In both cases, the TLUT must also be declared as a resource. + +## `Array` + +```xml + + + + + + + + + +``` + +An array of vertices, vectors or scalars. The child element determines the array's element type. + +- Required attributes: `Count` + +`Count` is the length of the array. + +The child element may be one of `` (for `Vtx[]`), `` (for `Vec3s[]`) or `` (for `s16[]`). + +## `Scene` + +```xml + +``` + +Scene commands. + +## `Room` + +```xml + +``` + +Room commands. + +## `Collision` + +```xml + +``` + +Collision header. + +## `Cutscene` + +```xml + +``` + +Cutscene script. + +## `Path` + +```xml + +``` + +Path list. + +- Required attributes: `NumPaths` + +`NumPaths` is the length of the path list. + +## `Skeleton` + +```xml + +``` + +Skeleton header. + +- Required attributes: `Type`, `LimbType` +- Optional attributes: `LimbNone`, `LimbMax`, `EnumName` + +`Type` is the type of the skeleton, one of `Normal`, `Flex` or `Curve`. + +`LimbType` is the type of limb used in the skeleton, one of `Standard`, `LOD`, `Skin`, `Curve` or `Legacy`. + +Not all skeleton types are compatible with all limb types: + +`LimbType` | Compatible skeleton `Type` +-----------|--------------------------- +`Standard` | `Normal`, `Flex` +`LOD` | `Normal`, `Flex` +`Skin` | `Normal` +`Curve` | `Curve` +`Legacy` | none + +`LimbNone`, `LimbMax`, `EnumName` can be set to override the corresponding names in the generated limb enum: + +```c +typedef enum NameLimb { + NAME_LIMB_NONE, + ... + NAME_LIMB_MAX +} NameLimb; +``` + +## `LimbTable` + +```xml + +``` + +Limb table. + +- Required attributes: `LimbType`, `Count` + +`LimbType` is one of `Standard`, `LOD`, `Skin`, `Curve` or `Legacy`. + +`Count` is the amount of limbs. + +## `Limb` + +```xml + +``` + +Limb of a skeleton. + +- Required attributes: `LimbType` +- Optional attributes: `EnumName` + +`LimbType` is one of `Standard`, `LOD`, `Skin`, `Curve` or `Legacy`. + +`EnumName` can be set to override the limb name in the generated limb enum. + +## `Animation` + +```xml + +``` + +Animation header. + +## `CurveAnimation` + +```xml + +``` + +Curve animation header. + +- Required attributes: `SkelOffset` + +`SkelOffset` is the offset of the skeleton which uses this animation. The skeleton must also be declared as a resource. + +## `LegacyAnimation` + +```xml + +``` + +Legacy animation header. + +## `PlayerAnimation` + +```xml + +``` + +Player animation header. + +## `PlayerAnimationData` + +```xml + +``` + +Player animation data. + +- Required attributes: `FrameCount` + +`FrameCount` is the amount of frames in the animation. diff --git a/tools/assets/descriptor/xml_errors.py b/tools/assets/descriptor/xml_errors.py new file mode 100644 index 0000000000..7d7f6e0197 --- /dev/null +++ b/tools/assets/descriptor/xml_errors.py @@ -0,0 +1,31 @@ +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +from xml.etree import ElementTree + + +class XMLDescError(Exception): + pass + + +def check_attrib( + elem: ElementTree.Element, + required: set[str], + optional: set[str] = set(), +): + required_and_missing = required - elem.attrib.keys() + if required_and_missing: + raise XMLDescError( + "Missing attributes on " + + ElementTree.tostring(elem, encoding="unicode") + + ": " + + ", ".join(required_and_missing) + ) + unknown = elem.attrib.keys() - required - optional + if unknown: + raise XMLDescError( + "Unknown attributes on " + + ElementTree.tostring(elem, encoding="unicode") + + ": " + + ", ".join(unknown) + ) diff --git a/tools/assets/descriptor/z64resources.py b/tools/assets/descriptor/z64resources.py new file mode 100644 index 0000000000..fba264151f --- /dev/null +++ b/tools/assets/descriptor/z64resources.py @@ -0,0 +1,218 @@ +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +import dataclasses +import enum +from typing import Optional +from xml.etree.ElementTree import Element + +from .base import ( + ResourceDesc, + ResourcesDescCollection, + ResourceHandlerNeedsPass2Exception, +) +from . import xml_errors + + +@dataclasses.dataclass(eq=False) +class CollisionResourceDesc(ResourceDesc): + pass + + +def handler_Collision(symbol_name, offset, collection, reselem: Element): + xml_errors.check_attrib(reselem, {"Name", "Offset"}) + return CollisionResourceDesc(symbol_name, offset, collection, reselem) + + +@dataclasses.dataclass(eq=False) +class AnimationResourceDesc(ResourceDesc): + pass + + +def handler_Animation(symbol_name, offset, collection, reselem: Element): + xml_errors.check_attrib(reselem, {"Name", "Offset"}) + return AnimationResourceDesc(symbol_name, offset, collection, reselem) + + +@dataclasses.dataclass(eq=False) +class PlayerAnimationResourceDesc(ResourceDesc): + pass + + +def handler_PlayerAnimation(symbol_name, offset, collection, reselem: Element): + xml_errors.check_attrib(reselem, {"Name", "Offset"}) + return PlayerAnimationResourceDesc(symbol_name, offset, collection, reselem) + + +@dataclasses.dataclass(eq=False) +class LegacyAnimationResourceDesc(ResourceDesc): + pass + + +def handler_LegacyAnimation(symbol_name, offset, collection, reselem: Element): + xml_errors.check_attrib(reselem, {"Name", "Offset"}) + return LegacyAnimationResourceDesc(symbol_name, offset, collection, reselem) + + +@dataclasses.dataclass(eq=False) +class CutsceneResourceDesc(ResourceDesc): + pass + + +def handler_Cutscene(symbol_name, offset, collection, reselem: Element): + xml_errors.check_attrib(reselem, {"Name", "Offset"}) + return CutsceneResourceDesc(symbol_name, offset, collection, reselem) + + +@dataclasses.dataclass(eq=False) +class SceneResourceDesc(ResourceDesc): + pass + + +def handler_Scene(symbol_name, offset, collection, reselem: Element): + xml_errors.check_attrib(reselem, {"Name", "Offset"}) + return SceneResourceDesc(symbol_name, offset, collection, reselem) + + +@dataclasses.dataclass(eq=False) +class RoomResourceDesc(ResourceDesc): + pass + + +def handler_Room(symbol_name, offset, collection, reselem: Element): + xml_errors.check_attrib(reselem, {"Name", "Offset"}, {"HackMode"}) + res = RoomResourceDesc(symbol_name, offset, collection, reselem) + if reselem.attrib.get("HackMode") == "syotes_room": + res.hack_modes.add("hackmode_syotes_room") + return res + + +@dataclasses.dataclass(eq=False) +class PlayerAnimationDataResourceDesc(ResourceDesc): + frame_count: int + + +def handler_PlayerAnimationData(symbol_name, offset, collection, reselem: Element): + xml_errors.check_attrib(reselem, {"Name", "Offset", "FrameCount"}) + frame_count = int(reselem.attrib["FrameCount"]) + return PlayerAnimationDataResourceDesc( + symbol_name, offset, collection, reselem, frame_count + ) + + +@dataclasses.dataclass(eq=False) +class PathListResourceDesc(ResourceDesc): + num_paths: int + + +def handler_PathList(symbol_name, offset, collection, reselem: Element): + xml_errors.check_attrib(reselem, {"Name", "Offset", "NumPaths"}) + num_paths = int(reselem.attrib["NumPaths"]) + return PathListResourceDesc(symbol_name, offset, collection, reselem, num_paths) + + +class SkeletonType(enum.Enum): + NORMAL = enum.auto() + FLEX = enum.auto() + CURVE = enum.auto() + + +class LimbType(enum.Enum): + STANDARD = enum.auto() + LOD = enum.auto() + SKIN = enum.auto() + CURVE = enum.auto() + LEGACY = enum.auto() + + +@dataclasses.dataclass(eq=False) +class SkeletonResourceDesc(ResourceDesc): + type: SkeletonType + limb_type: LimbType + limb_enum_name: Optional[str] + limb_enum_none_member_name: Optional[str] + limb_enum_max_member_name: Optional[str] + + +def handler_Skeleton(symbol_name, offset, collection, reselem: Element): + xml_errors.check_attrib( + reselem, + {"Name", "Offset", "Type", "LimbType"}, + {"EnumName", "LimbNone", "LimbMax"}, + ) + skel_type = SkeletonType[reselem.attrib["Type"].upper()] + limb_type = LimbType[reselem.attrib["LimbType"].upper()] + return SkeletonResourceDesc( + symbol_name, + offset, + collection, + reselem, + skel_type, + limb_type, + reselem.attrib.get("EnumName"), + reselem.attrib.get("LimbNone"), + reselem.attrib.get("LimbMax"), + ) + + +@dataclasses.dataclass(eq=False) +class LimbResourceDesc(ResourceDesc): + limb_type: LimbType + limb_enum_member_name: Optional[str] + + +def handler_Limb(symbol_name, offset, collection, reselem: Element): + xml_errors.check_attrib(reselem, {"Name", "Offset", "LimbType"}, {"EnumName"}) + limb_type = LimbType[reselem.attrib["LimbType"].upper()] + return LimbResourceDesc( + symbol_name, + offset, + collection, + reselem, + limb_type, + reselem.attrib.get("EnumName"), + ) + + +@dataclasses.dataclass(eq=False) +class LimbTableResourceDesc(ResourceDesc): + limb_type: LimbType + count: int + + +def handler_LimbTable(symbol_name, offset, collection, reselem: Element): + xml_errors.check_attrib(reselem, {"Name", "Offset", "LimbType", "Count"}) + limb_type = LimbType[reselem.attrib["LimbType"].upper()] + count = int(reselem.attrib["Count"]) + return LimbTableResourceDesc( + symbol_name, offset, collection, reselem, limb_type, count + ) + + +@dataclasses.dataclass(eq=False) +class CurveAnimationResourceDesc(ResourceDesc): + skeleton: SkeletonResourceDesc + + +def handler_CurveAnimation( + symbol_name, offset, collection: ResourcesDescCollection, reselem: Element +): + xml_errors.check_attrib(reselem, {"Name", "Offset", "SkelOffset"}) + res = CurveAnimationResourceDesc(symbol_name, offset, collection, reselem, None) + + skel_offset = int(reselem.attrib["SkelOffset"], 16) + + def pass2_callback(pool): + matching_tlut_resources = [ + res for res in collection.resources if res.offset == skel_offset + ] + assert len(matching_tlut_resources) == 1, ( + f"Found {len(matching_tlut_resources)} resources at SkelOffset " + f"0x{skel_offset:X} instead of exactly one" + ) + assert isinstance( + matching_tlut_resources[0], SkeletonResourceDesc + ), matching_tlut_resources[0] + res.skeleton = matching_tlut_resources[0] + + raise ResourceHandlerNeedsPass2Exception(res, pass2_callback) diff --git a/tools/assets/extract/__main__.py b/tools/assets/extract/__main__.py new file mode 100644 index 0000000000..62676350b5 --- /dev/null +++ b/tools/assets/extract/__main__.py @@ -0,0 +1,13 @@ +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +from . import extract_xml_z64 + +if __name__ == "__main__": + profile = False + if profile: + import cProfile + + cProfile.run("extract_xml_z64.main()", "cprofile_extract_assets.txt") + else: + extract_xml_z64.main() diff --git a/tools/assets/extract/extase/__init__.py b/tools/assets/extract/extase/__init__.py new file mode 100644 index 0000000000..d399882039 --- /dev/null +++ b/tools/assets/extract/extase/__init__.py @@ -0,0 +1,1135 @@ +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +from pathlib import Path +import abc +from dataclasses import dataclass +import enum +import reprlib + +import io +from typing import TYPE_CHECKING, Sequence, Optional, Union, Any, Iterable + +from pprint import pprint + +if TYPE_CHECKING: + from .memorymap import MemoryContext + + +# 0: nothing, 1: in progress & waiting, 2: all +VERBOSE_FILE_TRY_PARSE_DATA = 0 +VERBOSE_REPORT_RESBUF = False + +DUMP_REPORTERS_IN_SOURCE = False +DUMP_XML_IN_SOURCE = False + +DONT_MERGE_RESOURCE_BUFFERS_FROM_DIFFERENT_USERS = False + +# +# file +# + +# sentinel value +RESOURCE_PARSE_SUCCESS = object() + + +class ResourceParseException(Exception): + pass + + +class ResourceParseWaiting(ResourceParseException): + """Resource has nothing to do and can't be parsed yet, try again later. + + For example, another resource may need to be parsed first. + + If all resources fail to parse in this way, it means parsing has come to a deadlock. + """ + + def __init__(self, *args, waiting_for: list[Any]): + """ + waiting_for should be a non-empty list of things the resource is currently waiting for. + (one item per meaningful thing that is waited for) + It is only meant for informational purpose (such as debugging). + It may contain more than the strict minimum the resource needs to make some progress, + and less than everything the resource needs to be fully parsed. + """ + assert waiting_for + super().__init__(*args, waiting_for) + self.waiting_for = waiting_for + + +class ResourceParseInProgress(ResourceParseException): + """Resource can't be parsed yet, try again later. + But there was progress (as opposed to ResourceParseWaiting indicating no progress). + + "Progress" includes: + - other resources were reported + - information was passed to or made available to other resources + - data was partially parsed + """ + + def __init__(self, *args, new_progress_done: list[Any], waiting_for: list[Any]): + """ + new_progress_done, waiting_for: see ResourceParseWaiting.__init__ + """ + assert new_progress_done and waiting_for + super().__init__(*args, new_progress_done, waiting_for) + self.new_progress_done = new_progress_done + self.waiting_for = waiting_for + + +class ResourceParseImpossible(ResourceParseException): + """Resource cannot be parsed, neither now nor later. + + For example, there is unexpected data or values that cannot be handled properly. + """ + + pass + + +class GetResourceAtResult(enum.Enum): + DEFINITIVE = enum.auto() + PERHAPS = enum.auto() + NONE_YET = enum.auto() + + +@dataclass +class ResourceBufferMarker: + name: str + file_start: int + file_end: int + users: set["Resource"] + + +@dataclass +class ResourcesOverlapError(Exception): + overlaps: list[tuple["Resource", "Resource"]] + + +class File: + """A file is a collection of resources + + It typically corresponds to a rom file (segment) but doesn't have to + It doesn't even need to correspond to the entirety of one or more .c files, + it can be only a fraction + + It can also correspond to how some memory is laid out, + for example what a segment "contains" in the context of a file or resource. + """ + + def __init__( + self, + name: str, + *, + data: Optional[memoryview] = None, + size: Optional[int] = None, + alignment: int = 8, + ): + self.name = name + if data is None != size is None: + raise Exception( + "Exactly one of either data or size must be provided", data, size + ) + if data is not None: + self.data = data + self.size = len(data) + else: + assert size is not None + self.data = None + self.size = size + self.alignment = alignment + self._resources: list[Resource] = [] + self._is_resources_sorted = True + self.referenced_files: set[File] = set() + self.resource_buffer_markers_by_resource_type: dict[ + type[Resource], list[ResourceBufferMarker] + ] = dict() + + def add_resource(self, resource: "Resource"): + assert resource is not None + assert resource not in self._resources + self._resources.append(resource) + self._is_resources_sorted = False + + def extend_resources(self, resources: Sequence["Resource"]): + self._resources.extend(resources) + self._is_resources_sorted = False + + def sort_resources(self): + self._resources.sort(key=lambda resource: resource.range_start) + self._is_resources_sorted = True + + def get_resource_at(self, offset: int): + if __debug__: + # FIXME when resources overlap during parse, nothing catches that + # (and nothing can really catch it because of the unk-size resources) + # probably implement this check properly by finding all resources at the offset below, + # hopefully there is at most one and do normal operation, + # or if there are >=2 then error (or best_effort: pick the furthest resource?) + self.sort_resources() + self.check_overlapping_resources() + assert offset < self.size + + # Resources may use a defined range with both start and end defined, + # or a range that only has its start defined. + + # While looking for a resource with a defined range the request offset + # belongs to, also keep track of the last resource that starts at or before + # offset (note: that resource may or may not have an end range defined). + last_resource_before_offset: Union[Resource, None] = None + + for resource in self._resources: + + if resource.range_start <= offset: + if ( + last_resource_before_offset is None + or last_resource_before_offset.range_start < resource.range_start + ): + last_resource_before_offset = resource + + if resource.range_end is not None: + # If the requested offset falls within a defined range, return that + # resource with GetResourceAtResult.DEFINITIVE . + if resource.range_start <= offset < resource.range_end: + return GetResourceAtResult.DEFINITIVE, resource + + # If the loop exits normally, without returning a defined range resource, + # check if the last resource starting at or before the requested offset + # (if any) has an undefined range. + if ( + last_resource_before_offset is not None + and last_resource_before_offset.range_end is None + ): + if last_resource_before_offset.range_start == offset: + # Resources are always more than 0 bytes in size, so if the resource + # starts exactly at the requested offset, then it is guaranteed to + # cover (at least) that offset. + return GetResourceAtResult.DEFINITIVE, last_resource_before_offset + else: + # Return it with GetResourceAtResult.PERHAPS , as it may extend up to + # and beyond the requested offset (or not). + return GetResourceAtResult.PERHAPS, last_resource_before_offset + else: + # No (potential) resource at that offset (currently). + return GetResourceAtResult.NONE_YET, None + + def get_overlapping_resources(self): + if not self._is_resources_sorted: + raise Exception("sort resources first") + + overlaps: list[tuple[Resource, Resource]] = [] + + for i in range(1, len(self._resources)): + resource_a = self._resources[i - 1] + + if resource_a.range_end is not None: + for j in range(i, len(self._resources)): + resource_b = self._resources[j] + + # This should hold true, as resources are sorted + assert resource_a.range_start <= resource_b.range_start + + if resource_a.range_end > resource_b.range_start: + overlaps.append((resource_a, resource_b)) + else: + break + else: + for j in range(i, len(self._resources)): + resource_b = self._resources[j] + + assert resource_a.range_start <= resource_b.range_start + + if resource_a.range_start == resource_b.range_start: + overlaps.append((resource_a, resource_b)) + else: + break + + return overlaps + + def check_overlapping_resources(self): + try: + overlaps = self.get_overlapping_resources() + if overlaps: + raise ResourcesOverlapError(overlaps) + except: + print(self.str_report()) + raise + + def get_non_parsed_resources(self): + return [resource for resource in self._resources if not resource.is_data_parsed] + + def check_non_parsed_resources(self): + try: + resources_data_not_parsed = self.get_non_parsed_resources() + if resources_data_not_parsed: + print(len(resources_data_not_parsed), "resource(s) not parsed:") + for resource in resources_data_not_parsed: + print(resource) + if hasattr(resource, "last_parse_waiting_e"): + print( + " last_parse_waiting_e =", + repr(resource.last_parse_waiting_e), + ) + else: + print("??? no last_parse_waiting_e ???") + print("then why has", resource.name, "not been parsed?") + BEST_EFFORT = False # TODO move + if BEST_EFFORT: + print("BEST_EFFORT: removing non-parsed resources") + for resource in resources_data_not_parsed: + self._resources.remove(resource) + self.add_resource( + BinaryBlobResource( + self, + resource.range_start, + ( + resource.range_end + if resource.range_end is not None + else ( + resource.range_start + + 4 # TODO 4 if I_D_OMEGALUL else 1 + ) + ), + f"{resource.name}_bin_placeholder", + ) + ) + return + raise Exception( + "resources not parsed", + len(resources_data_not_parsed), + [(r.name, r.__class__) for r in resources_data_not_parsed], + resources_data_not_parsed, + ) + except: + print(self.str_report()) + raise + + def try_parse_resources_data(self, file_memory_context: "MemoryContext"): + """Returns true if any progress was made between the method being called and the method returning.""" + any_progress = False + + while True: + any_data_parsed = False + + # Parsing resources may add more, copy the list + # to avoid concurrent modification while iterating + resources_copy = self._resources.copy() + + for resource in resources_copy: + if resource.is_data_parsed: + pass + else: + resource.last_parse_waiting_e = None + resource_memory_context = file_memory_context # TODO + try: + ret_try_parse_data = resource.try_parse_data( + resource_memory_context + ) + except ResourceParseInProgress as e: + any_progress = True + if VERBOSE_FILE_TRY_PARSE_DATA >= 1: + pprint( + ( + "(in progress) Defering parsing", + resource, + "progress:", + e.new_progress_done, + "waiting:", + e.waiting_for, + ) + ) + except ResourceParseWaiting as e: + if VERBOSE_FILE_TRY_PARSE_DATA >= 1: + pprint( + ( + "(waiting) Defering parsing", + resource, + "waiting:", + e.waiting_for, + ) + ) + resource.last_parse_waiting_e = e + except ( + ResourceParseException + ) as e: # TODO ResourceParseImpossible ? + # TODO replace resource with binblob or something idk + print("Error while attempting to parse data", resource) + raise + except: + # TODO replace resource with binblob or something idk + print("Error while attempting to parse data", resource) + raise + else: + # Catch try_parse_data mistakenly returning successfully + # (instead of raising) by enforcing having it return a sentinel value + assert ret_try_parse_data is RESOURCE_PARSE_SUCCESS, ( + "Resources should return RESOURCE_PARSE_SUCCESS when parsing is successful, " + "or raise ResourceParseInProgress/ResourceParseWaiting if parsing is unsuccessful", + resource, + resource.try_parse_data, + ) + + # resource parsed successfully + if VERBOSE_FILE_TRY_PARSE_DATA >= 2: + pprint(("(success) Done parsing", resource)) + any_progress = True + assert resource.range_end is not None, ( + resource, + resource.__class__, + ) + resource.is_data_parsed = True + any_data_parsed = True + + any_resource_added = len(self._resources) != len(resources_copy) + keep_looping = any_data_parsed or any_resource_added + if not keep_looping: + break + + return any_progress + + def mark_resource_buffer( + self, + reporter: "Resource", + resource_type: type["Resource"], + name: str, + file_start: int, + file_end: int, + ): + # Ignore markers falling within existing resources + result, resource = self.get_resource_at(file_start) + if result == GetResourceAtResult.DEFINITIVE: + if resource.range_start <= file_start < file_end <= resource.range_end: + assert isinstance(resource, resource_type) + resource.reporters.add(reporter) + return + + # Check for intersection with existing resources + for resource in self._resources: + # TODO and when resource.range_end is None ? + if resource.range_end is not None and ( + resource.range_start <= file_start < resource.range_end + or resource.range_start < file_end <= resource.range_end + ): + raise Exception( + f"Resource buffer {name=} of {resource_type=}" + f" to be marked at {file_start:#X}-{file_end:#X}" + f" intersects with existing {resource=}" + ) + + resource_buffer_markers = ( + self.resource_buffer_markers_by_resource_type.setdefault(resource_type, []) + ) + resource_buffer_markers.append( + ResourceBufferMarker(name, file_start, file_end, {reporter}) + ) + + resource_buffer_markers.sort(key=lambda rbm: rbm.file_start) + + def do_fuse(i_start, i_end): + assert i_start < i_end + if i_start + 1 == i_end: + return False + fused = resource_buffer_markers[i_start:i_end] + users = set() + for rbm in fused: + users.update(rbm.users) + resource_buffer_markers[i_start:i_end] = [ + ResourceBufferMarker( + fused[0].name.removesuffix("_fused_") + "_fused_", # TODO + fused[0].file_start, + fused[-1].file_end, + users, + ) + ] + return True + + def fuse_more(): + stride_first_i = None + for i, rbm in enumerate(resource_buffer_markers): + if stride_first_i is None: + stride_first_i = i + else: + assert i > 0 + prev = resource_buffer_markers[i - 1] + if prev.file_end < rbm.file_start or ( + DONT_MERGE_RESOURCE_BUFFERS_FROM_DIFFERENT_USERS + and prev.file_end == rbm.file_start + and prev.users != rbm.users + ): + # disjointed + if do_fuse(stride_first_i, i): + return True + stride_first_i = i + if stride_first_i is not None: + return do_fuse(stride_first_i, len(resource_buffer_markers)) + else: + return False + + while fuse_more(): + pass + + def commit_resource_buffers(self): + # TODO rework resource buffers handling + # this won't play well with manually defined vtx arrays + # probably can't merge the vbuf refs so quick + for ( + resource_type, + resource_buffer_markers, + ) in self.resource_buffer_markers_by_resource_type.items(): + if VERBOSE_REPORT_RESBUF: + print(resource_type, resource_buffer_markers) + for rbm in resource_buffer_markers: + result, resource = self.get_resource_at(rbm.file_start) + assert ( + result != GetResourceAtResult.PERHAPS + ), "commit_resource_buffers should be called at a point where all resources have a definitive range" + if result == GetResourceAtResult.NONE_YET: + resource = resource_type( + self, rbm.file_start, rbm.file_end, rbm.name + ) + resource.reporters.update(rbm.users) + self.add_resource(resource) + else: + assert result == GetResourceAtResult.DEFINITIVE + assert ( + resource.range_start + <= rbm.file_start + < rbm.file_end + <= resource.range_end + ), ( + "marked resource buffer overlaps with existing resource but also extends out of that resource", + hex(rbm.file_start), + hex(rbm.file_end), + rbm, + resource, + ) + + # TODO ? not really reporters but at least users, figure out reporters/users + resource.reporters.update(rbm.users) + self.resource_buffer_markers_by_resource_type = dict() + + def add_unaccounted_resources(self, *, I_D_OMEGALUL: bool): + assert self._is_resources_sorted + assert self.data is not None + + unaccounted_resources: list[Resource] = [] + + def add_unaccounted(range_start, range_end): + if I_D_OMEGALUL: + # IDO aligns every declaration to 4, so declaring zeros + # that is actually padding for that purpose throws off matching. + # This block strips such zeros from the unaccounted range. + + # Compute the amount of bytes from range_start to the + # next multiple of 4. + pad_bytes = (4 - range_start % 4) % 4 + if pad_bytes != 0: + pad_range_end = range_start + pad_bytes + assert pad_range_end <= range_end + pad_data = self.data[range_start:pad_range_end] + if set(pad_data) != {0}: + raise Exception( + "Expected pad bytes to be 0", + hex(range_start), + hex(pad_range_end), + set(pad_data), + bytes(pad_data), + ) + pad_resource = ZeroPaddingResource( + self, + range_start, + pad_range_end, + f"{self.name}_zero_padding_{range_start:06X}", + include_in_source=False, + ) + unaccounted_resources.append(pad_resource) + range_start += pad_bytes + if range_start == range_end: + # It turns out the whole unaccounted range is + # zero padding, so do nothing else + return + assert range_start < range_end + unaccounted_data = self.data[range_start:range_end] + if set(unaccounted_data) == {0}: + unaccounted_resource = ZeroPaddingResource( + self, + range_start, + range_end, + f"{self.name}_zeros_{range_start:06X}", + ) + else: + unaccounted_resource = BinaryBlobResource( + self, + range_start, + range_end, + f"{self.name}_unaccounted_{range_start:06X}", + ) + unaccounted_resources.append(unaccounted_resource) + + if self._resources: + # Add unaccounted if needed at the start of the file + resource_first = self._resources[0] + if resource_first.range_start > 0: + add_unaccounted( + 0, + resource_first.range_start, + ) + + # Add unaccounted if needed at the end of the file + resource_last = self._resources[-1] + if resource_last.range_end < len(self.data): + add_unaccounted( + resource_last.range_end, + len(self.data), + ) + else: + # Add unaccounted for the whole file + add_unaccounted(0, len(self.data)) + + for i in range(1, len(self._resources)): + resource_a = self._resources[i - 1] + resource_b = self._resources[i] + assert resource_a.range_end <= resource_b.range_start + + # Add unaccounted if needed between two successive resources + if resource_a.range_end < resource_b.range_start: + try: + add_unaccounted( + resource_a.range_end, + resource_b.range_start, + ) + except: + print( + "Could not add an unaccounted resource between the two resources:" + ) + print(resource_a) + print(resource_b) + raise + + self.extend_resources(unaccounted_resources) + + def set_resources_paths(self, extracted_path, build_path, out_path): + for resource in self._resources: + resource.set_paths(extracted_path, build_path, out_path) + + def write_resources_extracted(self, file_memory_context: "MemoryContext"): + for resource in self._resources: + assert resource.is_data_parsed, resource + resource_memory_context = file_memory_context # TODO + try: + resource.extract_to_path.parent.mkdir(parents=True, exist_ok=True) + resource.write_extracted(resource_memory_context) + except: + print("Couldn't write extracted resource", resource) + raise + + # These two are set by calling set_source_path + source_c_path: Path + source_h_path: Path + + def set_source_path(self, source_path: Path): + file_name = self.name + + # May catch random problems but not a hard requirement otherwise + assert file_name and all( + (c in "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789") + for c in file_name + ), file_name + + self.source_file_name = file_name + self.source_c_path = source_path / f"{file_name}.c" + self.source_h_path = source_path / f"{file_name}.h" + + def write_source(self): + assert hasattr( + self, "source_c_path" + ), "set_source_path must be called before write_source" + assert hasattr(self, "source_h_path") + self.source_c_path.parent.mkdir(parents=True, exist_ok=True) + self.source_h_path.parent.mkdir(parents=True, exist_ok=True) + with self.source_c_path.open("w") as c: + with self.source_h_path.open("w") as h: + + # Paths to files to be included + file_include_paths_complete: list[Path] = [] + file_include_paths_complete.append(self.source_h_path) + for referenced_file in self.referenced_files: + assert isinstance(referenced_file, File), referenced_file + assert hasattr(referenced_file, "source_c_path"), ( + "set_source_path must be called on all files before any write_source call", + referenced_file, + ) + assert hasattr(referenced_file, "source_h_path") + file_include_paths_complete.append(referenced_file.source_h_path) + + # Same as file_include_paths_complete, + # but paths that can be are made relative to the source C. + file_include_paths: list[Path] = [] + for path_complete in file_include_paths_complete: + try: + path = path_complete.relative_to(self.source_c_path.parent) + except ValueError: + # Included path is not relative to this file's source C folder. + # Just use the complete path. + path = path_complete + file_include_paths.append(path) + + included_headers_in_c = set() + included_headers_in_h = set() + + for resource in self._resources: + incls = resource.get_c_includes() + assert not isinstance(incls, str) + included_headers_in_c.update(incls) + + incls = resource.get_h_includes() + assert not isinstance(incls, str) + included_headers_in_h.update(incls) + + for file_include_path in file_include_paths: + c.write(f'#include "{file_include_path}"\n') + c.write("\n") + c.writelines( + f'#include "{_h}"\n' for _h in sorted(included_headers_in_c) + ) + c.write("\n") + + INCLUDE_GUARD = self.source_file_name.upper() + "_H" + + h.writelines( + ( + f"#ifndef {INCLUDE_GUARD}\n", + f"#define {INCLUDE_GUARD}\n", + "\n", + ) + ) + h.writelines( + f'#include "{_h}"\n' for _h in sorted(included_headers_in_h) + ) + h.write("\n") + + if not self._is_resources_sorted: + self.sort_resources() + for resource in self._resources: + + if resource.write_c_definition(c): + c.write("\n") + + resource.write_c_declaration(h) + + h.writelines( + ( + "\n", + "#endif\n", + ) + ) + + def str_report(self): + return "\n".join( + f"0x{resource.range_start:06X}-" + + ( + f"0x{resource.range_end:06X}" + if resource.range_end is not None + else "..." + ) + + f" {resource.name}" + for resource in self._resources + ) + + @reprlib.recursive_repr() + def __repr__(self): + return ( + self.__class__.__qualname__ + + f"({self.name!r}, data is None={self.data is None}, size={self.size}, {self._resources!r})" + ) + + def __rich_repr__(self): + yield "name", self.name + yield "data is None", self.data is None + yield "size", self.size + yield "resources", self._resources + + __rich_repr__.angular = True + + +# +# resources +# + + +class Resource(abc.ABC): + """A resource is a blob of data inside a file. + + (at least for now,) one resource = one symbol + + Examples: + - a struct-defined piece of data, such as a SkeletonHeader + - an array of data, such as a display list Gfx[], or a texture u64[] + """ + + braces_in_source = True + + def __init_subclass__(cls, /, can_size_be_unknown=False, **kwargs): + super().__init_subclass__(**kwargs) + cls.can_size_be_unknown = can_size_be_unknown + + def __init__( + self, + file: File, + range_start: int, + range_end: Optional[int], + name: str, + ): + assert ( + 0 <= range_start < file.size + ), f"{range_start=:#08X} out of range [0,{file.size=:#08X})" + if range_end is None: + assert self.can_size_be_unknown + else: + assert ( + range_start < range_end <= file.size + ), f"{range_end=:#08X} out of range [{range_start=:#08X},{file.size=:#08X})" + + self.file = file + + self.range_start = range_start + """Offset in the file data this resource starts at (inclusive) + + Example: + range_start = 1 and range_end = 3 + means the resource is two bytes, the second and third bytes in the file + """ + + self.range_end = range_end + """Offset in the file data this resource end at (exclusive) + + May be None if the resource size isn't known yet + (only if can_size_be_unknown is True, see __init_subclass__) + Must be set at the latest before try_parse_data returns normally (without raising) + + See range_start + """ + + self.name = name + """Name of this resource, for logging/reporting. + + This member is NOT to be used as a C identifier, symbol name or file name. + + See also: + - symbol_name + - get_filename_stem + """ + + self.symbol_name = name + """Name of the symbol to use to reference this resource""" + + self.is_data_parsed = False + """Will be set to true when the resource is successfully parsed + (after a successful try_parse_data call) + """ + + self.reporters: set[Resource] = set() + """Collection of all the resources having reported this resource + TODO figure out what to do with this, for now thinking debugging""" + + @abc.abstractmethod + def try_parse_data(self, memory_context: "MemoryContext"): + """Parse this resource's data bytes + + This can typically result in finding more resources, + for example from pointer types. + + If data can't be parsed yet, ResourceParseInProgress or ResourceParseWaiting should be raised. + Then this will be called again later. + + Raising other ResourceParseException s abandons parsing this resource. + Other exceptions raised are not caught. + + Note this can both add found resources to the file, + and wait before further parsing its own data (by raising ResourceParseInProgress). + + If data is successfully parsed, the method should return normally + and RESOURCE_PARSE_SUCCESS should be returned. + Then this will not be called again. + """ + ... + + @abc.abstractmethod + def get_c_reference(self, resource_offset: int) -> str: + """Get a C expression for referencing data in this resource (as a pointer) + + The offset `resource_offset` is relative to the resource: + 0 means the start of the resource data, + and NOT the start of the file the resource is in. + + Should raise `ValueError` if the `resource_offset` isn't meaningful. + + Examples: + - `StructData data`, `get_c_reference(0)` -> `&data` + - `u8 array[]`, `get_c_reference(0)` -> `&array[0]` + - `u8 array[]`, `get_c_reference(6)` -> `&array[6]` + - `u16 array[]`, `get_c_reference(6)` -> `&array[3]` + - `u16 array[]`, `get_c_reference(1)` -> raises `ValueError` + - `u64 texture[]`, `get_c_reference(0)` -> `texture` + """ + ... + + def get_c_expression_length(self, resource_offset: int): + """Get a C expression for referencing the length of data in this resource + + The offset `resource_offset` is relative to the resource, as in get_c_reference. + + Should raise `ValueError` if the `resource_offset` isn't meaningful. + + Examples: + - `StructData data`, `get_c_expression_length(0)` -> raises `ValueError` + - `u8 array[]`, `get_c_reference(0)` -> `ARRAY_COUNT(array)` + - `u8 array[]`, `get_c_reference(1)` -> raises `ValueError` + """ + # Override in children classes if needed + raise ValueError( + "This resource has no data with a length that can be referenced", + self.__class__, + self, + ) + + needs_build = False + """Whether this resource needs processing by the build system. + + If False, it is extracted directly as .inc.c and included as is. + + See set_paths + """ + + extracted_path_suffix = ".inc.c" + """The file extension for constructing the path to extract this resource to. + + See set_paths + """ + + def get_filename_stem(self): + """Stem (name without suffix) for the file to write this resource to + + See set_paths + """ + return self.name + + # These two are set by calling set_paths + extract_to_path: Path + inc_c_path: Path + + def set_paths(self, extracted_path: Path, build_path: Path, out_path: Path): + """Compute and set `self.extract_to_path` and `self.inc_c_path` + + Examples with + extracted_path: `extracted/VERSION/` + build_path: `build/VERSION/` + out_path: `assets/.../` + + Binary: extracted_path_suffix = ".bin" + with get_filename_stem() = "blob" + extract_to_path: `extracted/VERSION/assets/.../blob.bin` + inc_c_path: `assets/.../blob.inc.c` + + C: extracted_path_suffix = ".inc.c" + with get_filename_stem() = "data" + extract_to_path: `extracted/VERSION/assets/.../data.inc.c` + inc_c_path: `assets/.../data.inc.c` + + rgba16 image: extracted_path_suffix = ".png" + with get_filename_stem() = "img.rgba16" + extract_to_path: `extracted/VERSION/assets/.../img.rgba16.png` + inc_c_path: `assets/.../img.rgba16.inc.c` + """ + + filename_stem = self.get_filename_stem() + + extract_to_path = ( + extracted_path / out_path / (filename_stem + self.extracted_path_suffix) + ) + + if not self.needs_build: + assert self.extracted_path_suffix == ".inc.c" + inc_c_path = out_path / (filename_stem + ".inc.c") + + self.extract_to_path = extract_to_path + self.inc_c_path = inc_c_path + + def get_c_includes(self) -> Iterable[str]: + return () + + def get_h_includes(self) -> Iterable[str]: + return () + + @abc.abstractmethod + def write_extracted(self, memory_context: "MemoryContext") -> None: + """Write the extracted resource data to self.extract_to_path""" + ... + + @abc.abstractmethod + def get_c_declaration_base(self) -> str: + """Get the base source for declaring this resource's symbol in C. + + For example: + - "u8 blob[]", `return f"u8 {self.symbol_name}[]"` + - "DataStruct data", `return f"DataStruct {self.symbol_name}"` + """ + ... + + def get_as_xml(self) -> str: + raise NotImplementedError() + + def write_c_definition(self, c: io.TextIOBase) -> bool: + """ + Returns True if something was written + """ + + if DUMP_REPORTERS_IN_SOURCE: + c.write(f"//R: {' '.join(_r.name for _r in self.reporters)}\n") + if DUMP_XML_IN_SOURCE: + try: + xml = self.get_as_xml() + except NotImplementedError: + pass + else: + c.write("/*\n") + c.write(xml) + c.write("\n") + c.write("*/\n") + + if hasattr(self, "HACK_IS_STATIC_ON"): + c.write("static ") + c.write(self.get_c_declaration_base()) + if self.braces_in_source: + c.write(" = {\n") + else: + c.write(" =\n") + + c.write(f'#include "{self.inc_c_path}"\n') + if self.braces_in_source: + c.write("};\n") + else: + c.write(";\n") + + return True + + def write_c_declaration(self, h: io.TextIOBase) -> None: + + if hasattr(self, "HACK_IS_STATIC_ON"): + h.write("static ") + else: + h.write("extern ") + h.write(self.get_c_declaration_base()) + h.write(";\n") + + @reprlib.recursive_repr() + def __repr__(self): + return ( + self.__class__.__qualname__ + + "(" + + ", ".join( + ( + repr(self.name), + ( + f"0x{self.range_start:08X}-" + + ( + f"0x{self.range_end:08X}" + if self.range_end is not None + else "..." + ) + ), + f"file.name={self.file.name!r}", + ) + ) + + ")" + ) + + def __rich_repr__(self): + yield self.name + yield ( + f"0x{self.range_start:08X}-" + + (f"0x{self.range_end:08X}" if self.range_end is not None else "...") + ) + yield "file.name", self.file.name + + __rich_repr__.angular = True + + +class ZeroPaddingResource(Resource): + def __init__( + self, + file: File, + range_start: int, + range_end: int, + name: str, + *, + include_in_source=True, + ): + # TODO move to try_parse_data ? + assert set(file.data[range_start:range_end]) == {0} + super().__init__(file, range_start, range_end, name) + self.include_in_source = include_in_source + + def try_parse_data(self, memory_context): + # Nothing specific to do + return RESOURCE_PARSE_SUCCESS + + def get_c_reference(self, resource_offset): + raise ValueError("Referencing zero padding should not happen") + + def get_c_includes(self): + return ("ultra64.h",) + + def write_extracted(self, memory_context): + # No need to extract zeros + pass + + def get_c_declaration_base(self): + length_bytes = self.range_end - self.range_start + assert length_bytes > 0 + return f"u8 {self.symbol_name}[{length_bytes}]" + + def write_c_definition(self, c: io.TextIOBase): + if self.include_in_source: + c.write(self.get_c_declaration_base()) + c.write(" = { 0 };\n") + return True + else: + return False + + def write_c_declaration(self, h: io.TextIOBase): + # No need to declare zeros + pass + + +class BinaryBlobResource(Resource): + needs_build = True + extracted_path_suffix = "" + + def try_parse_data(self, memory_context): + # Nothing specific to do + return RESOURCE_PARSE_SUCCESS + + def get_c_reference(self, resource_offset): + return f"&{self.symbol_name}[{resource_offset}]" + + def get_filename_stem(self): + return super().get_filename_stem() + ".bin" + + def get_h_includes(self): + return ("ultra64.h",) + + def write_extracted(self, memory_context): + data = self.file.data[self.range_start : self.range_end] + assert len(data) == self.range_end - self.range_start + self.extract_to_path.write_bytes(data) + + def get_c_declaration_base(self): + return f"u8 {self.symbol_name}[]" + + def get_c_expression_length(self, resource_offset: int): + raise Exception( + "A binary blob resource could support returning a C expression for its length, " + "but it would be error-prone due to the 'anything goes' nature of binary blobs. " + "Make a dedicated resource instead" + ) diff --git a/tools/assets/extract/extase/cdata_resources.py b/tools/assets/extract/extase/cdata_resources.py new file mode 100644 index 0000000000..8358694a9f --- /dev/null +++ b/tools/assets/extract/extase/cdata_resources.py @@ -0,0 +1,521 @@ +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +import abc +import dataclasses +import io +from typing import TYPE_CHECKING, Callable, Any, Sequence, Union + +if TYPE_CHECKING: + from .memorymap import MemoryContext + +from . import ( + RESOURCE_PARSE_SUCCESS, + Resource, + File, + ResourceParseWaiting, +) + +from .repr_c_struct import ( + CData, + CData_Value, + CData_Struct, + CData_Array, +) + + +@dataclasses.dataclass +class CDataExtWriteContext: + f: io.TextIOBase + line_prefix: str + inhibit_top_braces: bool + + +class CDataExt(CData, abc.ABC): + + report_f = None + write_f = None + + def set_report( + self, report_f: Callable[["CDataResource", "MemoryContext", Any], None] + ): + self.report_f = report_f + return self + + def set_write( + self, + write_f: Callable[ + ["CDataResource", "MemoryContext", Any, CDataExtWriteContext], + bool, + ], + ): + """ + write_f should return True if it wrote anything + """ + self.write_f = write_f + return self + + def freeze(self): + self.set_report = None + self.set_write = None + return self + + @abc.abstractmethod + def write_default( + self, + resource: "CDataResource", + memory_context: "MemoryContext", + v: Any, + f: io.TextIOBase, + line_prefix: str, + *, + inhibit_top_braces: bool, + ) -> bool: ... + + def report( + self, + resource: "CDataResource", + memory_context: "MemoryContext", + v: Any, + ): + if self.report_f: + try: + self.report_f(resource, memory_context, v) + except: + print("Error reporting data", self, self.report_f, resource, v) + raise + + def write( + self, + resource: "CDataResource", + memory_context: "MemoryContext", + v: Any, + f: io.TextIOBase, + line_prefix: str, + *, + inhibit_top_braces: bool, + ) -> bool: + """ + Returns True if something has been written + (typically, False will be returned if this data is struct padding) + """ + if self.write_f: + ret = self.write_f( + resource, + memory_context, + v, + CDataExtWriteContext(f, line_prefix, inhibit_top_braces), + ) + # This assert is meant to ensure the function returns a value at all, + # since it's easy to forget to return a value (typically True) + assert isinstance(ret, bool), ("must return a bool", self.write_f) + else: + ret = self.write_default( + resource, + memory_context, + v, + f, + line_prefix, + inhibit_top_braces=inhibit_top_braces, + ) + assert isinstance(ret, bool), self + return ret + + +class CDataExt_Value(CData_Value, CDataExt): + is_padding = False + + def padding(self): + self.is_padding = True + return self + + def freeze(self): + self.padding = None + return super().freeze() + + def set_write_str_v(self, str_v: Callable[[Any], str]): + """Utility wrapper for set_write, writes the value as stringified by str_v.""" + + def write_f( + resource: "CDataResource", + memory_context: "MemoryContext", + v: Any, + wctx: CDataExtWriteContext, + ): + wctx.f.write(wctx.line_prefix) + wctx.f.write(str_v(v)) + return True + + self.set_write(write_f) + return self + + def report(self, resource, memory_context, v): + super().report(resource, memory_context, v) + if self.is_padding: + if v != 0: + raise Exception("non-0 padding") + + def write_default( + self, resource, memory_context, v, f, line_prefix, *, inhibit_top_braces + ): + assert ( + not inhibit_top_braces + ), "CDataExt_Value can't inhibit top braces, it doesn't have any" + if not self.is_padding: + f.write(line_prefix) + f.write(str(v)) + return True + else: + return False + + +CDataExt_Value.s8 = CDataExt_Value("b").freeze() +CDataExt_Value.u8 = CDataExt_Value("B").freeze() +CDataExt_Value.s16 = CDataExt_Value("h").freeze() +CDataExt_Value.u16 = CDataExt_Value("H").freeze() +CDataExt_Value.s32 = CDataExt_Value("i").freeze() +CDataExt_Value.u32 = CDataExt_Value("I").freeze() +CDataExt_Value.f32 = CDataExt_Value("f").freeze() +CDataExt_Value.f64 = CDataExt_Value("d").freeze() +CDataExt_Value.pointer = CDataExt_Value("I").freeze() + +CDataExt_Value.pad8 = CDataExt_Value("b").padding().freeze() +CDataExt_Value.pad16 = CDataExt_Value("h").padding().freeze() +CDataExt_Value.pad32 = CDataExt_Value("i").padding().freeze() + + +INDENT = " " * 4 + + +class CDataExt_Array(CData_Array, CDataExt): + def __init__(self, element_cdata_ext: CDataExt, length: int): + super().__init__(element_cdata_ext, length) + self.element_cdata_ext = element_cdata_ext + + def report(self, resource, memory_context, v): + assert isinstance(v, list) + super().report(resource, memory_context, v) + for elem in v: + self.element_cdata_ext.report(resource, memory_context, elem) + + def write_default( + self, resource, memory_context, v, f, line_prefix, *, inhibit_top_braces + ): + assert isinstance(v, list) + if not inhibit_top_braces: + f.write(line_prefix) + f.write("{\n") + for i, elem in enumerate(v): + ret = self.element_cdata_ext.write( + resource, + memory_context, + elem, + f, + line_prefix + INDENT, + inhibit_top_braces=False, + ) + assert ret + f.write(f", // {i}\n") + if not inhibit_top_braces: + f.write(line_prefix) + f.write("}") + return True + + +class CDataExt_Struct(CData_Struct, CDataExt): + def __init__(self, members: Sequence[tuple[str, CDataExt]]): + super().__init__(members) + self.members_ext = members + + def report(self, resource, memory_context, v): + assert isinstance(v, dict) + super().report(resource, memory_context, v) + for member_name, member_cdata_ext in self.members_ext: + member_cdata_ext.report(resource, memory_context, v[member_name]) + + def write_default( + self, resource, memory_context, v, f, line_prefix, *, inhibit_top_braces + ): + assert isinstance(v, dict) + if not inhibit_top_braces: + f.write(line_prefix) + f.write("{\n") + for member_name, member_cdata_ext in self.members_ext: + if member_cdata_ext.write( + resource, + memory_context, + v[member_name], + f, + line_prefix + INDENT, + inhibit_top_braces=False, + ): + f.write(f", // {member_name}\n") + if not inhibit_top_braces: + f.write(line_prefix) + f.write("}") + return True + + +class CDataResource(Resource): + + # Set by child classes + cdata_ext: CDataExt + + # Resource implementation + + def __init__(self, file: File, range_start: int, name: str): + if not self.can_size_be_unknown: + assert hasattr(self, "cdata_ext"), self.__class__ + assert self.cdata_ext is not None + range_end = range_start + self.cdata_ext.size + else: + if hasattr(self, "cdata_ext") and self.cdata_ext is not None: + range_end = range_start + self.cdata_ext.size + else: + range_end = None + super().__init__(file, range_start, range_end, name) + self._is_cdata_processed = False + + def try_parse_data(self, memory_context: "MemoryContext"): + if self.can_size_be_unknown: + assert hasattr(self, "cdata_ext") and self.cdata_ext is not None, ( + "Subclasses with can_size_be_unknown=True should redefine try_parse_data" + " and call the superclass definition (CDataResource.try_parse_data)" + " only once cdata_ext has been set", + self.__class__, + ) + assert ( + self.range_end is not None + ), "Subclasses with can_size_be_unknown=True should also set range_end once the size is known" + assert hasattr(self, "cdata_ext") + assert self.cdata_ext is not None + + # In case the subclass does more involved processing, the self.is_data_parsed + # bool wouldn't necessarily reflect the state of the cdata. + # Use own bool self._is_cdata_processed to remember if cdata has been unpacked and + # reported already. + if not self._is_cdata_processed: + self.cdata_unpacked = self.cdata_ext.unpack_from( + self.file.data, self.range_start + ) + + self.cdata_ext.report(self, memory_context, self.cdata_unpacked) + + self._is_cdata_processed = True + + return RESOURCE_PARSE_SUCCESS + + def write_extracted(self, memory_context): + with self.extract_to_path.open("w") as f: + self.cdata_ext.write( + self, + memory_context, + self.cdata_unpacked, + f, + "", + inhibit_top_braces=self.braces_in_source, + ) + f.write("\n") + + +class CDataArrayResource(CDataResource): + """Helper for variable-length array resources. + + The length is unknown at object creation, and must be set eventually + with set_length (for example by another resource). + + The length being set then allows this resource to be parsed. + + For static-length array resources, just use CDataResource. + """ + + def __init_subclass__(cls, /, **kwargs): + super().__init_subclass__(can_size_be_unknown=True, **kwargs) + + elem_cdata_ext: CDataExt + + def __init__(self, file: File, range_start: int, name: str): + super().__init__(file, range_start, name) + self._length: Union[None, int] = None + + def set_length(self, length: int): + if self._length is not None: + if self._length != length: + raise Exception( + "length already set and is different", self._length, length + ) + assert length > 0 + self._length = length + + def try_parse_data(self, memory_context: "MemoryContext"): + if self._length is None: + raise ResourceParseWaiting(waiting_for=["self._length"]) + assert isinstance(self.elem_cdata_ext, CDataExt), (self.__class__, self) + self.cdata_ext = CDataExt_Array(self.elem_cdata_ext, self._length) + self.range_end = self.range_start + self.cdata_ext.size + return super().try_parse_data(memory_context) + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return self.symbol_name + else: + raise ValueError + + def get_c_expression_length(self, resource_offset: int): + if resource_offset == 0: + return f"ARRAY_COUNT({self.symbol_name})" + else: + raise ValueError + + +class CDataArrayNamedLengthResource(CDataArrayResource): + """CDataArrayResource and with a macro (define) for its length. + + This is useful for arrays that have a length that should be referenced somewhere, + but cannot due to the order the definitions are in. + + This writes a macro to the .h for the length, along the symbol declaration, + to be used in the declaration base (! by the subclass, in get_c_declaration_base) + """ + + def __init__(self, file: File, range_start: int, name: str): + super().__init__(file, range_start, name) + self.length_name = f"LENGTH_{self.symbol_name}" + + def write_c_declaration(self, h: io.TextIOBase): + h.write(f"#define {self.length_name} {self._length}\n") + super().write_c_declaration(h) + + +cdata_ext_Vec3s = CDataExt_Struct( + ( + ("x", CDataExt_Value.s16), + ("y", CDataExt_Value.s16), + ("z", CDataExt_Value.s16), + ) +).freeze() + + +def write_Vec3s_aligned(resource, memory_context, v, wctx: CDataExtWriteContext): + s = f'{v["x"]:6}, {v["y"]:6}, {v["z"]:6}' + if not wctx.inhibit_top_braces: + s = "{ " + s + " }" + wctx.f.write(wctx.line_prefix) + wctx.f.write(s) + return True + + +cdata_ext_Vec3s_aligned = ( + CDataExt_Struct( + ( + ("x", CDataExt_Value.s16), + ("y", CDataExt_Value.s16), + ("z", CDataExt_Value.s16), + ) + ) + .set_write(write_Vec3s_aligned) + .freeze() +) + + +class Vec3sArrayResource(CDataResource): + + elem_cdata_ext = cdata_ext_Vec3s + + def __init__(self, file: File, range_start: int, name: str, length: int): + assert length > 0 + self.cdata_ext = CDataExt_Array(self.elem_cdata_ext, length) + super().__init__(file, range_start, name) + + def get_c_declaration_base(self): + return f"Vec3s {self.symbol_name}[]" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return self.symbol_name + else: + raise ValueError() + + def get_c_expression_length(self, resource_offset: int): + if resource_offset == 0: + return f"ARRAY_COUNT({self.symbol_name})" + else: + raise ValueError() + + def get_h_includes(self): + return ("z64math.h",) + + +class S16ArrayResource(CDataResource): + + elem_cdata_ext = CDataExt_Value.s16 + + def __init__(self, file: File, range_start: int, name: str, length: int): + assert length > 0 + self.cdata_ext = CDataExt_Array(self.elem_cdata_ext, length) + super().__init__(file, range_start, name) + + def get_c_declaration_base(self): + if hasattr(self, "HACK_IS_STATIC_ON"): + return f"s16 {self.symbol_name}[{self.cdata_ext.size // self.elem_cdata_ext.size}]" + return f"s16 {self.symbol_name}[]" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return self.symbol_name + else: + raise ValueError() + + def get_c_expression_length(self, resource_offset: int): + if resource_offset == 0: + return f"ARRAY_COUNT({self.symbol_name})" + else: + raise ValueError() + + def get_h_includes(self): + return ("ultra64.h",) + + +cdata_ext_Vec3f = CDataExt_Struct( + ( + ("x", CDataExt_Value.f32), + ("y", CDataExt_Value.f32), + ("z", CDataExt_Value.f32), + ) +) + + +def fmt_hex_s(v: int, nibbles: int = 0): + """Format v to 0x-prefixed uppercase hexadecimal, using (at least) the specified amount of nibbles. + + Meant for signed values (_s suffix), + adds a space in place of where the - sign would be for positive values. + + Note compared to this, + - f"{v:#X}" would produce an uppercase 0X (1 -> 0X1) + - f"0x{v:X}" doesn't work with negative values (-1 -> 0x-1) + """ + v_str = f"{v:0{nibbles}X}" + if v < 0: + v_str = v_str.removeprefix("-") + return f"-0x{v_str}" + else: + return f" 0x{v_str}" + + +def fmt_hex_u(v: int, nibbles: int = 0): + """Format v to 0x-prefixed uppercase hexadecimal, using (at least) the specified amount of nibbles. + + Meant for unsigned values (_u suffix), + but won't fail for negative values. + + See: fmt_hex_s + """ + v_str = f"{v:0{nibbles}X}" + if v < 0: + # Also handle v being negative just in case, + # it will only mean the output isn't aligned as expected + v_str = v_str.removeprefix("-") + return f"-0x{v_str}" + else: + return f"0x{v_str}" diff --git a/tools/assets/extract/extase/memorymap.py b/tools/assets/extract/extase/memorymap.py new file mode 100644 index 0000000000..0064357bfe --- /dev/null +++ b/tools/assets/extract/extase/memorymap.py @@ -0,0 +1,428 @@ +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +import abc +from dataclasses import dataclass + +from typing import Callable, TypeVar, Generic + +try: + from rich.pretty import pprint as rich_pprint +except ImportError: + rich_pprint = print + +from . import Resource, File, GetResourceAtResult + + +# when failing to resolve an address, +# (try to) keep going by creating "fake" files/resources +# or defaulting to poor choices (e.g. raw addresses) +BEST_EFFORT = True +if BEST_EFFORT: + VERBOSE_BEST_EFFORT = 1 + VERBOSE_BEST_EFFORT_LVL1_IGNORED_SEGS = { + 1, # billboard matrix segment + 8, # often used for eye/mouth textures, or various dlist callbacks. same for 9-0xC + 9, + 0xA, + 0xB, + 0xC, + 0xD, # matrix buffer for skeletons dlists + } + + +# RangeMap + +RangeMapValueT = TypeVar("RangeMapValueT") + + +class RangeMap(Generic[RangeMapValueT]): + def __init__(self): + self.values_by_range: dict[tuple[int, int], RangeMapValueT] = dict() + + def set(self, range_start: int, range_end: int, value: RangeMapValueT): + assert range_start < range_end + current_values_in_range = self.get_all_in_range(range_start, range_end) + if current_values_in_range: + raise Exception( + "Range already used (at least partially)", + hex(range_start), + hex(range_end), + current_values_in_range, + ) + self.values_by_range[(range_start, range_end)] = value + + def get_all_by_predicate(self, predicate: Callable[[int, int], bool]): + """Return all values associated to a range for which the predicate returns True""" + values: dict[tuple[int, int], RangeMapValueT] = dict() + for (range_start, range_end), value in self.values_by_range.items(): + if predicate(range_start, range_end): + values[(range_start, range_end)] = value + return values + + def get_all_in_range(self, range_start: int, range_end: int): + """Return all values associated to a range intersecting with the given range""" + assert range_start < range_end + + def check_intersect(value_range_start, value_range_end): + assert value_range_start < value_range_end + if range_end <= value_range_start: + return False + if value_range_end <= range_start: + return False + return True + + return self.get_all_by_predicate(check_intersect) + + def get(self, offset) -> RangeMapValueT: + """Return the value associated to the range the given offset is in, + if any, or raise IndexError""" + + def check_belong(value_range_start, value_range_end): + assert value_range_start < value_range_end + return value_range_start <= offset < value_range_end + + values = self.get_all_by_predicate(check_belong) + assert len(values) <= 1, values + if values: + return next(iter(values.values())) + else: + raise IndexError(offset) + + def copy(self): + """Returns a shallow copy""" + other = RangeMap() + other.values_by_range = self.values_by_range.copy() + return other + + +class NoResourceError(Exception): + """There is no resource at the requested address""" + + pass + + +class UnexpectedResourceTypeError(Exception): + """There is a resource at the requested address, but of the wrong type""" + + pass + + +class UnmappedAddressError(Exception): + """Indicates an address could not be resolved because nothing was found for the address.""" + + pass + + +AttributeValueT = TypeVar("AttributeValueT") + + +@dataclass(frozen=True) +class Attribute(Generic[AttributeValueT]): + name: str # Uniquely identifies the attribute + value_type: type[AttributeValueT] + + def __eq__(self, other): + if isinstance(other, Attribute): + return self.name == other.name + else: + return False + + def __hash__(self): + return hash(self.name) + + +class Attributes: + c_reference = Attribute("c_reference", str) + c_expression_length = Attribute("c_expression_length", str) + + +ResourceT = TypeVar("ResourceT", bound="Resource") + + +class AddressResolveResult: + def __init__(self, original_address: int, file: File, file_offset: int): + self.original_address = original_address + """Original address that was resolved to this result (for debugging purposes)""" + + self.file = file + self.file_offset = file_offset + + def get_resource(self, resource_type: type[ResourceT]) -> ResourceT: + result, resource = self.file.get_resource_at(self.file_offset) + if result != GetResourceAtResult.DEFINITIVE: + raise NoResourceError("No definitive resource", result) + assert resource is not None + if resource.range_start != self.file_offset: + raise NoResourceError( + "No resource at (exactly) the requested address", resource + ) + if not isinstance(resource, resource_type): + raise UnexpectedResourceTypeError(resource, resource_type) + return resource + + def get_attribute(self, attribute: Attribute[AttributeValueT]) -> AttributeValueT: + result, resource = self.file.get_resource_at(self.file_offset) + + if result != GetResourceAtResult.DEFINITIVE: + raise Exception("No definitive resource", result) + assert resource is not None + + resource_offset = self.file_offset - resource.range_start + + if attribute == Attributes.c_reference: + value = resource.get_c_reference(resource_offset) + elif attribute == Attributes.c_expression_length: + value = resource.get_c_expression_length(resource_offset) + else: + raise NotImplementedError(attribute) + + if not isinstance(value, attribute.value_type): + raise Exception( + "Resource gave an attribute value of unexpected type", + resource, + attribute, + value, + type(value), + ) + + return value + + def __repr__(self): + return ( + "AddressResolveResult(" + f"original_address=0x{self.original_address:08X}, " + f"file_name={self.file.name!r}, " + f"file_offset=0x{self.file_offset:X})" + ) + + +class AddressResolver(abc.ABC): + @abc.abstractmethod + def resolve( + self, original_address: int, address_offset: int + ) -> AddressResolveResult: ... + + +class MemoryMap: + def __init__(self): + self.direct = RangeMap[AddressResolver]() + self.segments: dict[int, RangeMap[AddressResolver]] = { + segment_num: RangeMap[AddressResolver]() for segment_num in range(1, 16) + } + + def copy(self): + """Returns a copy that is independently mutable + + (only the mappings are copied, the underlying AddressResolver s are the same) + """ + other = MemoryMap() + other.direct = self.direct.copy() + other.segments = { + segment_num: segment_range_map.copy() + for segment_num, segment_range_map in self.segments.items() + } + return other + + +def get_segment_num(address: int): + return (address & 0x0F00_0000) >> 24 + + +@dataclass +class FileDirectAddressResolver(AddressResolver): + direct_file_offset_start: int + target_file: File + + def resolve(self, original_address, address_offset): + file_offset = address_offset - self.direct_file_offset_start + return AddressResolveResult(original_address, self.target_file, file_offset) + + +@dataclass +class FileSegmentAddressResolver(AddressResolver): + target_file: File + + def resolve(self, original_address, address_offset): + file_offset = address_offset + return AddressResolveResult(original_address, self.target_file, file_offset) + + +class MemoryContext: + """ + handles segmented addresses, pointers, external symbols (eg gMtxClear) + + maps offsets to data + """ + + def __init__(self, dmadata_table_rom_file_name_by_vrom): + self.memory_map = MemoryMap() + self.dmadata_table_rom_file_name_by_vrom = dmadata_table_rom_file_name_by_vrom + + def copy(self): + other = MemoryContext(self.dmadata_table_rom_file_name_by_vrom) + other.memory_map = self.memory_map.copy() + return other + + def get_dmadata_table_rom_file_name_from_vrom(self, vromStart, vromEnd): + return self.dmadata_table_rom_file_name_by_vrom[(vromStart, vromEnd)] + + def _direct_address_to_offset(self, address: int): + segment_num = get_segment_num(address) + if segment_num != 0: + raise ValueError("Address is segmented, not direct", hex(address)) + # The 0xF000_0000 bits are ignored. Not 100% correct but simplest + offset = address & 0x00FF_FFFF + return offset + + def set_direct_file(self, address: int, target_file: File): + direct_file_offset_start = self._direct_address_to_offset(address) + direct_file_offset_end = direct_file_offset_start + target_file.size + + self.memory_map.direct.set( + direct_file_offset_start, + direct_file_offset_end, + FileDirectAddressResolver(direct_file_offset_start, target_file), + ) + + def set_segment_file(self, segment_num: int, target_file: File): + if not (1 <= segment_num < 16): + raise ValueError( + "Segment number must be between 1 and 15 (inclusive)", segment_num + ) + + self.memory_map.segments[segment_num].set( + 0, 0x0100_0000, FileSegmentAddressResolver(target_file) + ) + + def resolve_direct(self, address: int): + offset = self._direct_address_to_offset(address) + try: + address_resolver = self.memory_map.direct.get(offset) + except IndexError as e: + raise UnmappedAddressError( + "direct address is not mapped", f"0x{address:08X}" + ) from e + return address_resolver.resolve(address, offset) + + def resolve_segmented(self, address: int): + segment_num = get_segment_num(address) + if segment_num == 0: + return self.resolve_direct(address) + else: + assert address & 0xF000_0000 == 0 + offset = address & 0x00FF_FFFF + try: + address_resolver = self.memory_map.segments[segment_num].get(offset) + except IndexError as e: + raise UnmappedAddressError( + "segment address is not mapped", f"0x{address:08X}" + ) from e + return address_resolver.resolve(address, offset) + + def report_resource_at_segmented( + self, + reporter: Resource, + address: int, + resource_type: type[ResourceT], + new_resource_pointed_to: Callable[[File, int], ResourceT], + ) -> ResourceT: + try: + resolve_result = self.resolve_segmented(address) + except UnmappedAddressError as e: + if BEST_EFFORT: + fake_file = File(f"besteffort_fakefile_{address:08X}", size=0x0100_0000) + fake_resource = new_resource_pointed_to(fake_file, 0) + fake_resource.reporters.add(reporter) + fake_file.add_resource(fake_resource) + if VERBOSE_BEST_EFFORT >= 2 or ( + VERBOSE_BEST_EFFORT >= 1 + and (address >> 24) not in VERBOSE_BEST_EFFORT_LVL1_IGNORED_SEGS + ): + print("BEST_EFFORT: ignored error e=") + rich_pprint(e) + print(" on resource report by reporter=") + rich_pprint(reporter) + print(f" at {address=:#08X}") + print(" and created fake_file=") + rich_pprint(fake_file), + print(" and fake_resource=") + rich_pprint(fake_resource) + fake_file.FAKE_FOR_BEST_EFFORT = True + fake_resource.FAKE_FOR_BEST_EFFORT = True + return fake_resource + raise + try: + resource = resolve_result.get_resource(resource_type) + except NoResourceError: + resource = None + except UnexpectedResourceTypeError: + print("Could not resolve segment address for reporting", resolve_result) + raise + else: + assert resource is not None + if resource is None: + resource = new_resource_pointed_to( + resolve_result.file, + resolve_result.file_offset, + ) + resolve_result.file.add_resource(resource) + resource.reporters.add(reporter) + return resource + + def mark_resource_buffer_at_segmented( + self, + reporter: Resource, + resource_type: type[Resource], + name: str, + address_start: int, + address_end: int, + ): + # Note: this function assumes the whole address_start-address_end range resolves the same way. + # It not being the case would be very weird, but it's not checked here + try: + resolve_result = self.resolve_segmented(address_start) + except UnmappedAddressError as e: + if BEST_EFFORT: + if VERBOSE_BEST_EFFORT >= 2 or ( + VERBOSE_BEST_EFFORT >= 1 + and (address_start >> 24) + not in VERBOSE_BEST_EFFORT_LVL1_IGNORED_SEGS + ): + print("BEST_EFFORT: ignored error e=") + rich_pprint(e) + print(" and skipping marking resource buffer for reporter=") + rich_pprint(reporter) + print( + f" {resource_type=} {address_start=:#08X} {address_end=:#08X}" + ) + return + raise + file_start = resolve_result.file_offset + file_end = file_start + address_end - address_start + resolve_result.file.mark_resource_buffer( + reporter, resource_type, name, file_start, file_end + ) + + def get_attribute_at_segmented( + self, address: int, attribute: Attribute[AttributeValueT] + ): + return self.resolve_segmented(address).get_attribute(attribute) + + def get_c_reference_at_segmented(self, address: int): + try: + return self.get_attribute_at_segmented(address, Attributes.c_reference) + except UnmappedAddressError as e: + if BEST_EFFORT: + if VERBOSE_BEST_EFFORT >= 2 or ( + VERBOSE_BEST_EFFORT >= 1 + and (address >> 24) not in VERBOSE_BEST_EFFORT_LVL1_IGNORED_SEGS + ): + print("BEST_EFFORT: ignored error e="), + rich_pprint(e) + print(f" and returning raw address=0x{address:08X}") + return f"0x{address:08X}" + raise + + def get_c_expression_length_at_segmented(self, address: int): + return self.get_attribute_at_segmented(address, Attributes.c_expression_length) diff --git a/tools/assets/extract/extase/repr_c_struct.py b/tools/assets/extract/extase/repr_c_struct.py new file mode 100644 index 0000000000..3548ede370 --- /dev/null +++ b/tools/assets/extract/extase/repr_c_struct.py @@ -0,0 +1,223 @@ +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +import struct +import abc +from typing import Sequence, Any + + +# NOTE: this system does NOT handle struct alignment/padding automatically, it should be made explicit + +# this system voluntarily does not handle variable length arrays. which is not a valid "type" in C anyway (?) +# having variable-sized data is too messy to handle, because it needs a size at some point anyway +# This choice allows the root CData ABC to have a size as a guaranteed attribute + + +# BOSA = "Byte Order, Size, and Alignment" for the struct module +# Big Endian +STRUCT_BOSA_CHAR = ">" + + +class CData(abc.ABC): + @abc.abstractmethod + def __init__(self, size: int): + self.size = size + + # Unpack + + @abc.abstractmethod + def unpack_from(self, data: memoryview, offset: int = 0) -> Any: ... + + +class CData_Value(CData): + def __init__(self, format_char: str): + assert format_char in set("bBhHiIfd") + self.unpack_struct = struct.Struct(STRUCT_BOSA_CHAR + format_char) + super().__init__(self.unpack_struct.size) + + def unpack_from(self, data: memoryview, offset: int = 0): + return self.unpack_struct.unpack_from(data, offset)[0] + + +CData_Value.s8 = CData_Value("b") +CData_Value.u8 = CData_Value("B") +CData_Value.s16 = CData_Value("h") +CData_Value.u16 = CData_Value("H") +CData_Value.s32 = CData_Value("i") +CData_Value.u32 = CData_Value("I") +CData_Value.f32 = CData_Value("f") +CData_Value.f64 = CData_Value("d") +CData_Value.pointer = CData_Value("I") + + +class CData_Array(CData): + def __init__(self, element_cdata: CData, length: int): + assert length > 0 + self.element_cdata = element_cdata + self.length = length + super().__init__(element_cdata.size * length) + + def unpack_from(self, data: memoryview, offset: int = 0): + array_unpacked = [] + + for i in range(self.length): + unpacked = self.element_cdata.unpack_from(data, offset) + array_unpacked.append(unpacked) + offset += self.element_cdata.size + + assert len(array_unpacked) == self.length + + return array_unpacked + + +class CData_Struct(CData): + def __init__(self, members: Sequence[tuple[str, CData]]): + # assert all members have different names + assert len(members) == len( + set(member_name for member_name, member_cdata in members) + ), members + + self.members = members + super().__init__( + sum(member_cdata.size for member_name, member_cdata in members) + ) + + if __debug__: + # Check alignment + + # This may mess up with CData instances other than CData_Value, Array and Struct + def get_required_alignment(cdata: CData): + if isinstance(cdata, CData_Struct): + return max( + get_required_alignment(cdata_member_cdata) + for cdata_member_name, cdata_member_cdata in cdata.members + ) + elif isinstance(cdata, CData_Array): + return get_required_alignment(cdata.element_cdata) + else: + # Assume the alignment requirement corresponds to the size + # (e.g. this is correct for CData_Value) + return cdata.size + + # Check alignment of the members of the struct + offset = 0 + for member_name, member_cdata in members: + alignment = get_required_alignment(member_cdata) + assert offset % alignment == 0, (member_name, offset, alignment) + offset += member_cdata.size + + # Check alignment of the struct size + alignment = get_required_alignment(self) + assert self.size % alignment == 0, (self.size, alignment) + + def unpack_from(self, data: memoryview, offset: int = 0): + struct_unpacked = dict() + + for member_name, member_cdata in self.members: + member_unpacked = member_cdata.unpack_from(data, offset) + struct_unpacked[member_name] = member_unpacked + offset += member_cdata.size + + return struct_unpacked + + +def try_stuff(): + """ + struct { + s8 fun; + // u8 pad; + s16 games; + } array[] = { { 1, 2 }, { 3, 4 } }; + + + u8 varLenArray[] = { 1, 2, 3 }; + + struct { + u8* ptr; + u16 len; + struct { + s32 secret1; + u32 secret2; + } mySubStruct; + } data = { varLenArray, 3, { 421, 0x01020304 } }; + """ + + array_bytes = bytes( + [ + 1, + 0, + *(0, 2), + 3, + 0, + *(0, 4), + ] + ) + varLenArray_bytes = bytes([1, 2, 3]) + data_bytes = bytes( + [ + *(0x12, 0x34, 0x56, 0x78), + *(0, 3), + 0, + 0, + *(0, 0, 421 >> 8, 421 & 0xFF), + *(1, 2, 3, 4), + ] + ) + + arrayElem_CData_Struct = CData_Struct( + ( + ("fun", CData_Value.s8), + ("pad1", CData_Value.s8), + ("games", CData_Value.s16), + ) + ) + array_CData_Array = CData_Array(arrayElem_CData_Struct, 2) + + print(array_CData_Array.unpack_from(array_bytes)) + + mySubStruct_CData_Struct = CData_Struct( + ( + ("secret1", CData_Value.s32), + ("secret2", CData_Value.u32), + ) + ) + + data_CData_Struct = CData_Struct( + ( + ("ptr", CData_Value.pointer), + ("len", CData_Value.u16), + ("pad_6", CData_Value.s16), + ("mySubStruct", mySubStruct_CData_Struct), + ) + ) + + data_unpacked = data_CData_Struct.unpack_from(data_bytes) + print(data_unpacked) + + varLenArray_CData_Array = CData_Array(CData_Value.u8, data_unpacked["len"]) + + print(varLenArray_CData_Array.unpack_from(varLenArray_bytes)) + + data_integratedSubStruct_CData_Struct = CData_Struct( + ( + ("ptr", CData_Value.pointer), + ("len", CData_Value.u16), + ("pad_6", CData_Value.s16), + ( + "mySubStruct", + CData_Struct( + ( + ("secret1", CData_Value.s32), + ("secret2", CData_Value.u32), + ) + ), + ), + ) + ) + + data_unpacked = data_integratedSubStruct_CData_Struct.unpack_from(data_bytes) + print(data_unpacked) + + +if __name__ == "__main__": + try_stuff() diff --git a/tools/assets/extract/extase_oot64/animation_resources.py b/tools/assets/extract/extase_oot64/animation_resources.py new file mode 100644 index 0000000000..ec7e4bbac3 --- /dev/null +++ b/tools/assets/extract/extase_oot64/animation_resources.py @@ -0,0 +1,205 @@ +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ..extase.memorymap import MemoryContext + +from ..extase import ( + RESOURCE_PARSE_SUCCESS, + ResourceParseWaiting, + File, +) +from ..extase.cdata_resources import ( + CDataResource, + CDataExt_Value, + CDataExt_Struct, + CDataExt_Array, + CDataExtWriteContext, +) + + +class AnimationFrameDataResource(CDataResource, can_size_be_unknown=True): + def write_binang(resource, memory_context, v, wctx: CDataExtWriteContext): + wctx.f.write(wctx.line_prefix) + wctx.f.write(f" 0x{v:04X}" if v >= 0 else "-0x" + f"{v:04X}".removeprefix("-")) + return True + + elem_cdata_ext = CDataExt_Value("h").set_write(write_binang) + + def __init__(self, file: File, range_start: int, name: str): + super().__init__(file, range_start, name) + self.length = None + + def try_parse_data(self, memory_context): + if self.length is not None: + self.cdata_ext = CDataExt_Array(self.elem_cdata_ext, self.length) + self.range_end = self.range_start + self.cdata_ext.size + return super().try_parse_data(memory_context) + else: + raise ResourceParseWaiting(waiting_for=["self.length"]) + + def get_c_declaration_base(self): + return f"s16 {self.symbol_name}[]" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return self.symbol_name + else: + raise ValueError() + + def get_h_includes(self): + return ("ultra64.h",) + + +class AnimationJointIndicesResource(CDataResource, can_size_be_unknown=True): + elem_cdata_ext = CDataExt_Struct( + ( + ("x", CDataExt_Value.u16), + ("y", CDataExt_Value.u16), + ("z", CDataExt_Value.u16), + ) + ) + + def __init__(self, file: File, range_start: int, name: str): + super().__init__(file, range_start, name) + self.length = None + + def try_parse_data(self, memory_context): + if self.length is not None: + self.cdata_ext = CDataExt_Array(self.elem_cdata_ext, self.length) + self.range_end = self.range_start + self.cdata_ext.size + return super().try_parse_data(memory_context) + else: + raise ResourceParseWaiting(waiting_for=["self.length"]) + + def get_c_declaration_base(self): + return f"JointIndex {self.symbol_name}[]" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return self.symbol_name + else: + raise ValueError() + + def get_h_includes(self): + return ("z64animation.h",) + + +class AnimationResource(CDataResource): + def write_frameData( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + assert isinstance(v, int) + address = v + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + return True + + def write_jointIndices( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + assert isinstance(v, int) + address = v + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + return True + + cdata_ext = CDataExt_Struct( + ( + ( + "common", + CDataExt_Struct((("frameCount", CDataExt_Value.s16),)), + ), + ("pad2", CDataExt_Value.pad16), + ( + "frameData", + CDataExt_Value("I").set_write(write_frameData), + ), + ( + "jointIndices", + CDataExt_Value("I").set_write(write_jointIndices), + ), + ("staticIndexMax", CDataExt_Value.u16), + ("padE", CDataExt_Value.pad16), + ) + ) + + def try_parse_data(self, memory_context): + super().try_parse_data(memory_context) + + frameData_address = self.cdata_unpacked["frameData"] + assert isinstance(frameData_address, int) + resource_frameData = memory_context.report_resource_at_segmented( + self, + frameData_address, + AnimationFrameDataResource, + lambda file, offset: AnimationFrameDataResource( + file, + offset, + f"{self.name}_{frameData_address:08X}_FrameData", + ), + ) + + jointIndices_address = self.cdata_unpacked["jointIndices"] + assert isinstance(jointIndices_address, int) + resource_jointIndices = memory_context.report_resource_at_segmented( + self, + jointIndices_address, + AnimationJointIndicesResource, + lambda file, offset: AnimationJointIndicesResource( + file, + offset, + f"{self.name}_{jointIndices_address:08X}_JointIndices", + ), + ) + + # The length of the frameData and jointIndices arrays is + # for now assumed to fill the space to the animation, + # at the very least before subtracting the offsets check that + # the offsets belong to the same file + # TODO better idea for computing this data's size + + if not (resource_frameData.file == resource_jointIndices.file == self.file): + raise NotImplementedError( + "Expected frameData and jointIndices to be in the same file as the animation", + self.cdata_unpacked, + resource_frameData.file, + resource_jointIndices.file, + self.file, + ) + + if ( + resource_frameData.range_start + < resource_jointIndices.range_start + < self.range_start + ): + resource_frameData.length = ( + resource_jointIndices.range_start - resource_frameData.range_start + ) // AnimationFrameDataResource.elem_cdata_ext.size + resource_jointIndices.length = ( + self.range_start - resource_jointIndices.range_start + ) // AnimationJointIndicesResource.elem_cdata_ext.size + else: + raise NotImplementedError( + "Expected offsets of frameData, jointIndices, animation to be in order", + self.cdata_unpacked, + hex(resource_frameData.range_start), + hex(resource_jointIndices.range_start), + hex(self.range_start), + ) + + return RESOURCE_PARSE_SUCCESS + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return f"&{self.symbol_name}" + else: + raise ValueError() + + def get_c_declaration_base(self): + return f"AnimationHeader {self.symbol_name}" + + def get_h_includes(self): + return ("z64animation.h",) diff --git a/tools/assets/extract/extase_oot64/collision_resources.py b/tools/assets/extract/extase_oot64/collision_resources.py new file mode 100644 index 0000000000..bf7925be88 --- /dev/null +++ b/tools/assets/extract/extase_oot64/collision_resources.py @@ -0,0 +1,812 @@ +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +from typing import TYPE_CHECKING, Optional + +if TYPE_CHECKING: + from ..extase.memorymap import MemoryContext + +from ..extase import ( + File, + RESOURCE_PARSE_SUCCESS, + ResourceParseInProgress, + ResourceParseWaiting, +) +from ..extase.cdata_resources import ( + CDataResource, + CDataExt_Struct, + CDataExt_Array, + CDataExt_Value, + CDataExtWriteContext, + cdata_ext_Vec3s, + cdata_ext_Vec3s_aligned, + INDENT, + fmt_hex_u, +) + +from .. import oot64_data + +# TODO would be better for array resources to be of unknown size at instanciation +# and have their size set later, like LimbsArrayResource, +# which allows declaring them with offsets in xmls and have the data parsing +# fill in the length for both cases of it instantiating the array, +# and it being instantiated much earlier from the xml + + +class CollisionVtxListResource(CDataResource): + cdata_ext_elem = cdata_ext_Vec3s_aligned + + def __init__(self, file: File, range_start: int, name: str, length: int): + self.cdata_ext = CDataExt_Array(self.cdata_ext_elem, length) + super().__init__(file, range_start, name) + + def get_c_declaration_base(self): + if hasattr(self, "HACK_IS_STATIC_ON"): + return f"Vec3s {self.symbol_name}[{self.cdata_ext.length}]" + return f"Vec3s {self.symbol_name}[]" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return self.symbol_name + else: + raise ValueError() + + def get_c_expression_length(self, resource_offset: int): + if resource_offset == 0: + return f"ARRAY_COUNT({self.symbol_name})" + else: + raise ValueError() + + def get_h_includes(self): + return ("z64math.h",) + + +class CollisionPolyListResource(CDataResource): + def write_vtxData( + resource: "CollisionPolyListResource", + memory_context: "MemoryContext", + v, + wctx: CDataExtWriteContext, + ): + assert isinstance(v, list) + assert len(v) == 3 + vtxData = v + f = wctx.f + f.write(wctx.line_prefix) + f.write("{\n") + for i in range(3): + vI = vtxData[i] + vtxId = vI & 0x1FFF + flags = (vI & 0xE000) >> 13 + flags_str_list = [] + if i == 0: + if flags & 1: + flags &= ~1 + flags_str_list.append("COLPOLY_IGNORE_CAMERA") + if flags & 2: + flags &= ~2 + flags_str_list.append("COLPOLY_IGNORE_ENTITY") + if flags & 4: + flags &= ~4 + flags_str_list.append("COLPOLY_IGNORE_PROJECTILES") + elif i == 1: + if flags & 1: + flags &= ~1 + flags_str_list.append("COLPOLY_IS_FLOOR_CONVEYOR") + if flags != 0: + flags_str_list.append(f"0x{flags:X}") + if flags_str_list: + flags_str = " | ".join(flags_str_list) + else: + flags_str = "0" + f.write(wctx.line_prefix) + f.write(INDENT) + f.write(f"COLPOLY_VTX({vtxId}, {flags_str}), // {i}\n") + f.write(wctx.line_prefix) + f.write("}") + return True + + def write_normal_component( + resource: "CollisionPolyListResource", + memory_context: "MemoryContext", + v, + wctx: CDataExtWriteContext, + ): + assert isinstance(v, int) + nf = v / 0x7FFF + + if int(round(nf, 5) * 0x7FFF) != v: + if v < 0: + nf -= 0.000_01 + elif v > 0: + nf += 0.000_01 + + ns = f"{nf:.5f}" + while ns[-1] == "0" and ns[-2] != ".": + ns = ns[:-1] + + wctx.f.write(wctx.line_prefix) + wctx.f.write(f"COLPOLY_SNORMAL({ns})") + + return True + + normal_component = CDataExt_Value("h").set_write(write_normal_component) + cdata_ext_elem = CDataExt_Struct( + ( + ("type", CDataExt_Value.u16), + ("vtxData", CDataExt_Array(CDataExt_Value.u16, 3).set_write(write_vtxData)), + ( + "normal", + CDataExt_Struct( + ( + ("x", normal_component), + ("y", normal_component), + ("z", normal_component), + ) + ), + ), + ("dist", CDataExt_Value.s16), + ) + ) + + def __init__(self, file: File, range_start: int, name: str, length: int): + self.cdata_ext = CDataExt_Array(self.cdata_ext_elem, length) + super().__init__(file, range_start, name) + + def try_parse_data(self, memory_context): + super().try_parse_data(memory_context) + self.max_surface_type_index = max(elem["type"] for elem in self.cdata_unpacked) + assert isinstance(self.max_surface_type_index, int) + return RESOURCE_PARSE_SUCCESS + + def get_c_declaration_base(self): + if hasattr(self, "HACK_IS_STATIC_ON"): + return f"CollisionPoly {self.symbol_name}[{self.cdata_ext.length}]" + return f"CollisionPoly {self.symbol_name}[]" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return self.symbol_name + else: + raise ValueError() + + def get_c_expression_length(self, resource_offset: int): + if resource_offset == 0: + return f"ARRAY_COUNT({self.symbol_name})" + else: + raise ValueError() + + def get_h_includes(self): + return ("z64bgcheck.h",) + + +class CollisionSurfaceTypeListResource(CDataResource): + def write_data( + resource: "CollisionSurfaceTypeListResource", + memory_context: "MemoryContext", + v, + wctx: CDataExtWriteContext, + ): + assert isinstance(v, list) + assert len(v) == 2 + f = wctx.f + + f.write(wctx.line_prefix) + f.write("{\n") + + for i_data, bitfield_info in ( + ( + 0, + ( + (0x000000FF, 0, "bgCamIndex", int), + (0x00001F00, 8, "exitIndex", int), + (0x0003E000, 13, "floorType", oot64_data.misc_ids.FLOOR_TYPES), + (0x001C0000, 18, "unk18", int), + (0x03E00000, 21, "wallType", oot64_data.misc_ids.WALL_TYPES), + ( + 0x3C000000, + 26, + "floorProperty", + oot64_data.misc_ids.FLOOR_PROPERTIES, + ), + (0x40000000, 30, "isSoft", bool), + (0x80000000, 31, "isHorseBlocked", bool), + ), + ), + ( + 1, + ( + (0x0000000F, 0, "material", oot64_data.misc_ids.SURFACE_MATERIALS), + (0x00000030, 4, "floorEffect", oot64_data.misc_ids.FLOOR_EFFECTS), + (0x000007C0, 6, "lightSetting", int), + (0x0001F800, 11, "echo", int), + (0x00020000, 17, "canHookshot", bool), + ( + 0x001C0000, + 18, + "conveyorSpeed", + oot64_data.misc_ids.CONVEYOR_SPEEDS, + ), + ( + 0x07E00000, + 21, + "conveyorDirection", + lambda val: f"CONVEYOR_DIRECTION_FROM_BINANG({fmt_hex_u(val * (0x10000 // 64))})", + ), + (0x08000000, 27, "unk27", bool), + ), + ), + ): + + data_val = v[i_data] + + f.write(wctx.line_prefix) + f.write(INDENT) + f.write(f"SURFACETYPE{i_data}(\n") + + lines = [] + for mask, shift, name, fmt_info in bitfield_info: + val = (data_val & mask) >> shift + + if fmt_info == int: + lines.append(f"/* {name} */ {val}") + elif fmt_info == bool: + assert val in {0, 1} + lines.append(f"/* {name} */ {'true' if val else 'false'}") + elif isinstance(fmt_info, dict): + lines.append(fmt_info[val]) + elif callable(fmt_info): + lines.append(fmt_info(val)) + else: + lines.append(f"/* {name} */ {val}") + + f.write(",\n".join(f"{wctx.line_prefix}{INDENT * 2}{_l}" for _l in lines)) + + f.write("\n") + f.write(wctx.line_prefix) + f.write(INDENT) + f.write("),\n") + + f.write(wctx.line_prefix) + f.write("}") + + return True + + cdata_ext_elem = CDataExt_Struct( + (("data", CDataExt_Array(CDataExt_Value.u32, 2).set_write(write_data)),) + ) + + def __init__(self, file: File, range_start: int, name: str, length: int): + self.cdata_ext = CDataExt_Array(self.cdata_ext_elem, length) + super().__init__(file, range_start, name) + + def try_parse_data(self, memory_context): + super().try_parse_data(memory_context) + self.max_bgCamIndex = max( + elem["data"][0] & 0xFF for elem in self.cdata_unpacked + ) + self.max_exitIndex = max( + (elem["data"][0] & 0x00001F00) >> 8 for elem in self.cdata_unpacked + ) + return RESOURCE_PARSE_SUCCESS + + def get_c_declaration_base(self): + if hasattr(self, "HACK_IS_STATIC_ON"): + return f"SurfaceType {self.symbol_name}[{self.cdata_ext.length}]" + return f"SurfaceType {self.symbol_name}[]" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return self.symbol_name + else: + raise ValueError() + + def get_c_includes(self): + return ("stdbool.h",) + + def get_h_includes(self): + return ("z64bgcheck.h",) + + +class BgCamFuncDataResource(CDataResource): + element_cdata_ext = cdata_ext_Vec3s + + def __init__(self, file: File, range_start: int, range_end: int, name: str): + count = (range_end - range_start) // self.element_cdata_ext.size + self.cdata_ext = CDataExt_Array(self.element_cdata_ext, count) + super().__init__(file, range_start, name) + + def get_c_declaration_base(self): + if hasattr(self, "HACK_IS_STATIC_ON"): + return f"Vec3s {self.symbol_name}[{self.cdata_ext.length}]" + return f"Vec3s {self.symbol_name}[]" + + def get_c_reference(self, resource_offset: int): + if resource_offset % self.element_cdata_ext.size != 0: + raise ValueError( + "unaligned offset into Vec3s array (BgCamFuncData)", + hex(resource_offset), + self.element_cdata_ext.size, + ) + index = resource_offset // self.element_cdata_ext.size + return f"&{self.symbol_name}[{index}]" + + def get_h_includes(self): + return ("z64math.h",) + + +class CollisionBgCamListResource(CDataResource): + def write_bgCamFuncData( + resource: "CollisionSurfaceTypeListResource", + memory_context: "MemoryContext", + v, + wctx: CDataExtWriteContext, + ): + assert isinstance(v, int) + address = v + wctx.f.write(wctx.line_prefix) + if address != 0: + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + else: + wctx.f.write("NULL") + return True + + cdata_ext_elem = CDataExt_Struct( + ( + ( + "setting", + CDataExt_Value("H").set_write_str_v( + lambda v: oot64_data.get_camera_setting_type_name(v) + ), + ), + ("count", CDataExt_Value.s16), + ( + "bgCamFuncData", + CDataExt_Value("I").set_write(write_bgCamFuncData), + ), # Vec3s* + ) + ) + + def __init__(self, file: File, range_start: int, name: str, length: int): + self.cdata_ext = CDataExt_Array(self.cdata_ext_elem, length) + super().__init__(file, range_start, name) + + def try_parse_data(self, memory_context): + super().try_parse_data(memory_context) + # Note: operating directly on the segmented addresses here, + # so assuming from the start all bgCamFuncData use the same segment + bgCamFuncData_buffer_start = None + bgCamFuncData_buffer_end = None + for bgCamInfo in self.cdata_unpacked: + count = bgCamInfo["count"] + assert isinstance(count, int) + bgCamFuncData = bgCamInfo["bgCamFuncData"] + assert isinstance(bgCamFuncData, int) + + if bgCamFuncData == 0: + continue + + if bgCamFuncData_buffer_start is None: + bgCamFuncData_buffer_start = bgCamFuncData + bgCamFuncData_buffer_end = ( + bgCamFuncData + count * BgCamFuncDataResource.element_cdata_ext.size + ) + continue + + assert bgCamFuncData_buffer_start is not None + assert bgCamFuncData_buffer_end is not None + if bgCamFuncData != bgCamFuncData_buffer_end: + raise NotImplementedError( + "bgCamFuncData buffer not used in the same order as its elements" + ) + bgCamFuncData_buffer_end += ( + count * BgCamFuncDataResource.element_cdata_ext.size + ) + if bgCamFuncData_buffer_start is not None: + assert bgCamFuncData_buffer_end is not None + memory_context.report_resource_at_segmented( + self, + bgCamFuncData_buffer_start, + BgCamFuncDataResource, + lambda file, offset: BgCamFuncDataResource( + file, + offset, + offset + bgCamFuncData_buffer_end - bgCamFuncData_buffer_start, + f"{self.name}_{bgCamFuncData_buffer_start:08X}_BgCamFuncData", + ), + ) + return RESOURCE_PARSE_SUCCESS + + def get_c_declaration_base(self): + if hasattr(self, "HACK_IS_STATIC_ON"): + return f"BgCamInfo {self.symbol_name}[{self.cdata_ext.length}]" + return f"BgCamInfo {self.symbol_name}[]" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return self.symbol_name + else: + raise ValueError() + + def get_c_includes(self): + return ("z64camera.h",) + + def get_h_includes(self): + return ("z64bgcheck.h",) + + +class CollisionWaterBoxesResource(CDataResource): + + def write_properties(v): + bgCamIndex = (v >> 0) & 0xFF + lightIndex = (v >> 8) & 0x1F + room = (v >> 13) & 0x3F + setFlag19 = (v >> 19) & 1 + return f"WATERBOX_PROPERTIES(/* bgCamIndex */ {bgCamIndex}, /* lightIndex */ {lightIndex}, /* room */ {room}, /* setFlag19 */ {'true' if setFlag19 else 'false'})" + + elem_cdata_ext = CDataExt_Struct( + ( + ("xMin", CDataExt_Value.s16), + ("ySurface", CDataExt_Value.s16), + ("zMin", CDataExt_Value.s16), + ("xLength", CDataExt_Value.s16), + ("zLength", CDataExt_Value.s16), + ("pad12", CDataExt_Value.pad16), + ("properties", CDataExt_Value("I").set_write_str_v(write_properties)), + ) + ) + + def __init__(self, file: File, range_start: int, name: str, length: int): + self.cdata_ext = CDataExt_Array(self.elem_cdata_ext, length) + super().__init__(file, range_start, name) + + def get_c_declaration_base(self): + return f"WaterBox {self.symbol_name}[]" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return self.symbol_name + else: + raise ValueError + + def get_c_expression_length(self, resource_offset: int): + if resource_offset == 0: + return f"ARRAY_COUNT({self.symbol_name})" + else: + raise ValueError + + def get_c_includes(self): + return ("stdbool.h",) + + def get_h_includes(self): + return ("z64bgcheck.h",) + + +def transfer_HACK_IS_STATIC_ON(source, dest): + if hasattr(source, "HACK_IS_STATIC_ON"): + dest.HACK_IS_STATIC_ON = source.HACK_IS_STATIC_ON + return dest + + +class CollisionResource(CDataResource): + def write_numVertices( + resource: "CollisionResource", + memory_context: "MemoryContext", + v, + wctx: CDataExtWriteContext, + ): + wctx.f.write(wctx.line_prefix) + wctx.f.write( + memory_context.get_c_expression_length_at_segmented( + resource.cdata_unpacked["vtxList"] + ) + ) + return True + + def report_vtxList( + resource: "CollisionResource", memory_context: "MemoryContext", v + ): + assert isinstance(v, int) + address = v + memory_context.report_resource_at_segmented( + resource, + address, + CollisionVtxListResource, + lambda file, offset: transfer_HACK_IS_STATIC_ON( + resource, + CollisionVtxListResource( + file, + offset, + f"{resource.name}_{address:08X}_VtxList", + resource.cdata_unpacked["numVertices"], + ), + ), + ) + + def write_vtxList( + resource: "CollisionResource", + memory_context: "MemoryContext", + v, + wctx: CDataExtWriteContext, + ): + assert isinstance(v, int) + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_reference_at_segmented(v)) + return True + + def write_numPolygons( + resource: "CollisionResource", + memory_context: "MemoryContext", + v, + wctx: CDataExtWriteContext, + ): + wctx.f.write(wctx.line_prefix) + wctx.f.write( + memory_context.get_c_expression_length_at_segmented( + resource.cdata_unpacked["polyList"] + ) + ) + return True + + def report_polyList( + resource: "CollisionResource", memory_context: "MemoryContext", v + ): + assert isinstance(v, int) + address = v + resource.resource_polyList = memory_context.report_resource_at_segmented( + resource, + address, + CollisionPolyListResource, + lambda file, offset: transfer_HACK_IS_STATIC_ON( + resource, + CollisionPolyListResource( + file, + offset, + f"{resource.name}_{address:08X}_PolyList", + resource.cdata_unpacked["numPolygons"], + ), + ), + ) + + def write_polyList( + resource: "CollisionResource", + memory_context: "MemoryContext", + v, + wctx: CDataExtWriteContext, + ): + assert isinstance(v, int) + address = v + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + return True + + def write_numWaterBoxes( + resource: "CollisionResource", + memory_context: "MemoryContext", + v, + wctx: CDataExtWriteContext, + ): + wctx.f.write(wctx.line_prefix) + length = resource.cdata_unpacked["numWaterBoxes"] + if length != 0: + wctx.f.write( + memory_context.get_c_expression_length_at_segmented( + resource.cdata_unpacked["waterBoxes"] + ) + ) + else: + wctx.f.write("0") + return True + + def report_waterBoxes( + resource: "CollisionResource", memory_context: "MemoryContext", v + ): + assert isinstance(v, int) + address = v + length = resource.cdata_unpacked["numWaterBoxes"] + if length != 0: + assert address != 0, address # should not be NULL + memory_context.report_resource_at_segmented( + resource, + address, + CollisionWaterBoxesResource, + lambda file, offset: transfer_HACK_IS_STATIC_ON( + resource, + CollisionWaterBoxesResource( + file, + offset, + f"{resource.name}_{address:08X}_WaterBoxes", + length, + ), + ), + ) + + def write_surfaceTypeList( + resource: "CollisionResource", + memory_context: "MemoryContext", + v, + wctx: CDataExtWriteContext, + ): + assert isinstance(v, int) + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_reference_at_segmented(v)) + return True + + def write_bgCamList( + resource: "CollisionResource", + memory_context: "MemoryContext", + v, + wctx: CDataExtWriteContext, + ): + assert isinstance(v, int) + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_reference_at_segmented(v)) + return True + + def write_waterBoxes( + resource: "CollisionResource", + memory_context: "MemoryContext", + v, + wctx: CDataExtWriteContext, + ): + assert isinstance(v, int) + length = resource.cdata_unpacked["numWaterBoxes"] + f = wctx.f + f.write(wctx.line_prefix) + if length != 0: + f.write(memory_context.get_c_reference_at_segmented(v)) + else: + if v == 0: + f.write("NULL") + else: + f.write(f"0x{v:08X}") + return True + + cdata_ext = CDataExt_Struct( + ( + ("minBounds", cdata_ext_Vec3s), + ("maxBounds", cdata_ext_Vec3s), + ("numVertices", CDataExt_Value("H").set_write(write_numVertices)), + ("pad14", CDataExt_Value.pad16), + ( + "vtxList", + CDataExt_Value("I").set_report(report_vtxList).set_write(write_vtxList), + ), # Vec3s* + ("numPolygons", CDataExt_Value("H").set_write(write_numPolygons)), + ("pad22", CDataExt_Value.pad16), + ( + "polyList", + CDataExt_Value("I") + .set_report(report_polyList) + .set_write(write_polyList), + ), # CollisionPoly* + ( + "surfaceTypeList", + CDataExt_Value("I").set_write(write_surfaceTypeList), + ), # SurfaceType* + ("bgCamList", CDataExt_Value("I").set_write(write_bgCamList)), # BgCamInfo* + ("numWaterBoxes", CDataExt_Value("H").set_write(write_numWaterBoxes)), + ("pad38", CDataExt_Value.pad16), + ( + "waterBoxes", + CDataExt_Value("I") + .set_report(report_waterBoxes) + .set_write(write_waterBoxes), + ), # WaterBox* + ) + ) + + def __init__(self, file: File, range_start: int, name: str): + super().__init__(file, range_start, name) + + self.length_exitList: Optional[int] = None + + self.resource_polyList: Optional[CollisionPolyListResource] = None + self.resource_surfaceTypeList: Optional[CollisionSurfaceTypeListResource] = None + self.resource_bgCamList: Optional[CollisionBgCamListResource] = None + + def try_parse_data(self, memory_context): + super().try_parse_data(memory_context) + + assert self.resource_polyList is not None + + new_progress_done = [] + waiting_for = [] + + # If the CollisionPolyListResource is parsed + if self.resource_polyList.is_data_parsed: + # report surfaceTypeList based on its length guessed from polyList data + length_surfaceTypeList = self.resource_polyList.max_surface_type_index + 1 + surfaceTypeList_address = self.cdata_unpacked["surfaceTypeList"] + assert isinstance(surfaceTypeList_address, int) + self.resource_surfaceTypeList = memory_context.report_resource_at_segmented( + self, + surfaceTypeList_address, + CollisionSurfaceTypeListResource, + lambda file, offset: transfer_HACK_IS_STATIC_ON( + self, + CollisionSurfaceTypeListResource( + file, + offset, + f"{self.name}_{surfaceTypeList_address:08X}_SurfaceTypes", + length_surfaceTypeList, # TODO change CollisionSurfaceTypeListResource to a CDataArrayResource (same with more resources) + ), + ), + ) + + new_progress_done.append("reported CollisionSurfaceTypeListResource") + else: + waiting_for.append( + ( + "waiting for CollisionPolyListResource" + " to be parsed to report CollisionSurfaceTypeListResource", + self.resource_polyList, + ) + ) + + if self.resource_surfaceTypeList is not None: + # If the CollisionSurfaceTypeListResource is parsed + if self.resource_surfaceTypeList.is_data_parsed: + # report bgCamList based on its length guessed from surfaceTypeList data + length_bgCamList = self.resource_surfaceTypeList.max_bgCamIndex + 1 + bgCamList_address = self.cdata_unpacked["bgCamList"] + assert isinstance(bgCamList_address, int) + self.resource_bgCamList = memory_context.report_resource_at_segmented( + self, + bgCamList_address, + CollisionBgCamListResource, + lambda file, offset: transfer_HACK_IS_STATIC_ON( + self, + CollisionBgCamListResource( + file, + offset, + f"{self.name}_{bgCamList_address:08X}_BgCamList", + length_bgCamList, + ), + ), + ) + + # exitIndex is 1-indexed, so e.g. if the max is 1 the list is of length 1. + self.length_exitList = self.resource_surfaceTypeList.max_exitIndex + + new_progress_done.append("reported CollisionBgCamListResource") + else: + waiting_for.append( + ( + "waiting for CollisionSurfaceTypeListResource" + " to be parsed to report CollisionBgCamListResource", + self.resource_surfaceTypeList, + ) + ) + else: + waiting_for.append("self.resource_surfaceTypeList") + + if waiting_for: + if new_progress_done: + raise ResourceParseInProgress( + new_progress_done=new_progress_done, waiting_for=waiting_for + ) + else: + raise ResourceParseWaiting(waiting_for=waiting_for) + + assert ( + self.resource_surfaceTypeList is not None + and self.resource_bgCamList is not None + and self.length_exitList is not None + ) + return RESOURCE_PARSE_SUCCESS + + def get_c_declaration_base(self): + return f"CollisionHeader {self.symbol_name}" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return f"&{self.symbol_name}" + else: + raise ValueError() + + def get_c_includes(self): + return ("array_count.h",) + + def get_h_includes(self): + return ("z64bgcheck.h",) diff --git a/tools/assets/extract/extase_oot64/dlist_resources.py b/tools/assets/extract/extase_oot64/dlist_resources.py new file mode 100644 index 0000000000..63e8635a69 --- /dev/null +++ b/tools/assets/extract/extase_oot64/dlist_resources.py @@ -0,0 +1,1588 @@ +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +import enum +import io +from pathlib import Path +import reprlib + +from typing import TYPE_CHECKING, Union, Optional, Callable + +try: + from rich.pretty import pprint as rich_pprint +except ImportError: + rich_pprint = print + +import pygfxd + +if TYPE_CHECKING: + from ..extase.memorymap import MemoryContext +from ..extase.memorymap import UnmappedAddressError, UnexpectedResourceTypeError + +from ..extase import ( + RESOURCE_PARSE_SUCCESS, + ResourceParseWaiting, + Resource, + File, +) +from ..extase.cdata_resources import ( + CDataResource, + CDataExt_Array, + CDataExt_Struct, + CDataExt_Value, + CDataExtWriteContext, + INDENT, + fmt_hex_s, + fmt_hex_u, +) + + +BEST_EFFORT = True + +VERBOSE_ColorIndexedTexturesManager = False +VERBOSE_BEST_EFFORT_TLUT_NO_REAL_USER = True + +EXPLICIT_DL_AND_TEX_SIZES = True + + +class MtxResource(CDataResource): + braces_in_source = False + + def write_mtx(resource, memory_context, v, wctx: CDataExtWriteContext): + assert isinstance(v, dict) + assert v.keys() == {"intPart", "fracPart"} + intPart = v["intPart"] + fracPart = v["fracPart"] + + f = wctx.f + f.write(wctx.line_prefix) + f.write("gdSPDefMtx(\n") + + for i in range(4): + if i != 0: + f.write(",\n") + f.write(wctx.line_prefix + INDENT) + + for j in range(4): + # #define IPART(x) (((s32)((x) * 0x10000) >> 16) & 0xFFFF) + xi = intPart[j][i] + # #define FPART(x) ((s32)((x) * 0x10000) & 0xFFFF) + xf = fracPart[j][i] + # Reconstruct the `(s32)((x) * 0x10000)` but as a u32 + # (u32 since intPart and fracPart are u16 arrays) + # This works since `(s32)((x) * 0x10000)` in the IPART and FPART + # macros could be switched to `(u32)(s32)((x) * 0x10000)` without issue + u32_x_s15_16 = (xi << 16) | xf + # Cast to s32 (`(s32)(u32)(s32)((x) * 0x10000)` == `(s32)((x) * 0x10000)`) + s32_x_s15_16 = ( + u32_x_s15_16 + if u32_x_s15_16 < 0x8000_0000 + else u32_x_s15_16 - 0x1_0000_0000 + ) + x = s32_x_s15_16 / 0x10000 + + if j != 0: + f.write(", ") + f.write(f"{x}f") + f.write("\n") + + f.write(wctx.line_prefix) + f.write(")") + + return True + + cdata_ext = CDataExt_Struct( + ( + ("intPart", CDataExt_Array(CDataExt_Array(CDataExt_Value.u16, 4), 4)), + ("fracPart", CDataExt_Array(CDataExt_Array(CDataExt_Value.u16, 4), 4)), + ) + ).set_write(write_mtx) + + def get_c_declaration_base(self): + return f"Mtx {self.symbol_name}" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return f"&{self.symbol_name}" + else: + raise ValueError + + def get_h_includes(self): + return ("ultra64.h",) + + +class VtxArrayResource(CDataResource): + def write_elem(resource, memory_context, v, wctx: CDataExtWriteContext): + assert isinstance(v, dict) + wctx.f.write(wctx.line_prefix) + wctx.f.write( + f"VTX({v['x']:6}, {v['y']:6}, {v['z']:6}, " + f"{fmt_hex_s(v['s']):>7}, {fmt_hex_s(v['t']):>7}, " + f"{fmt_hex_u(v['crnx'], 2)}, {fmt_hex_u(v['cgny'], 2)}, {fmt_hex_u(v['cbnz'], 2)}, {fmt_hex_u(v['a'], 2)})" + ) + return True + + element_cdata_ext = CDataExt_Struct( + ( + ("x", CDataExt_Value.s16), + ("y", CDataExt_Value.s16), + ("z", CDataExt_Value.s16), + ( + "pad6", + CDataExt_Value.pad16, + ), # Not technically padding but unused and expected to always be 0 + ("s", CDataExt_Value.s16), + ("t", CDataExt_Value.s16), + ("crnx", CDataExt_Value.u8), + ("cgny", CDataExt_Value.u8), + ("cbnz", CDataExt_Value.u8), + ("a", CDataExt_Value.u8), + ) + ).set_write(write_elem) + + def __init__(self, file: File, range_start: int, range_end: int, name: str): + num = (range_end - range_start) // self.element_cdata_ext.size + self.cdata_ext = CDataExt_Array(self.element_cdata_ext, num) + super().__init__(file, range_start, name) + + def get_as_xml(self): + return f"""\ + + + """ + + def get_c_declaration_base(self): + if hasattr(self, "HACK_IS_STATIC_ON"): + return f"Vtx {self.symbol_name}[{self.cdata_ext.length}]" + return f"Vtx {self.symbol_name}[]" + + def get_c_reference(self, resource_offset: int): + if resource_offset % self.element_cdata_ext.size != 0: + raise ValueError( + "unaligned offset into vtx array", + hex(resource_offset), + self.element_cdata_ext.size, + ) + index = resource_offset // self.element_cdata_ext.size + return f"&{self.symbol_name}[{index}]" + + def get_c_includes(self): + return ("gfx.h",) + + def get_h_includes(self): + return ("ultra64.h",) + + +from ...n64 import G_IM_FMT, G_IM_SIZ, G_TT, G_MDSFT_TEXTLUT +from ... import n64texconv + +G_IM_FMT_n64texconv_by_n64 = { + G_IM_FMT.RGBA: n64texconv.G_IM_FMT_RGBA, + G_IM_FMT.YUV: n64texconv.G_IM_FMT_YUV, + G_IM_FMT.CI: n64texconv.G_IM_FMT_CI, + G_IM_FMT.IA: n64texconv.G_IM_FMT_IA, + G_IM_FMT.I: n64texconv.G_IM_FMT_I, +} +G_IM_SIZ_n64texconv_by_n64 = { + G_IM_SIZ._4b: n64texconv.G_IM_SIZ_4b, + G_IM_SIZ._8b: n64texconv.G_IM_SIZ_8b, + G_IM_SIZ._16b: n64texconv.G_IM_SIZ_16b, + G_IM_SIZ._32b: n64texconv.G_IM_SIZ_32b, +} + + +def write_n64_image_to_png( + path: Path, width: int, height: int, fmt: G_IM_FMT, siz: G_IM_SIZ, data: memoryview +): + n64texconv.N64Image.from_bin( + data, + width, + height, + G_IM_FMT_n64texconv_by_n64[fmt], + G_IM_SIZ_n64texconv_by_n64[siz], + ).to_png(str(path), False) + + +def write_n64_image_to_png_color_indexed( + path: Path, + width: int, + height: int, + fmt: G_IM_FMT, + siz: G_IM_SIZ, + data: memoryview, + tlut_data: memoryview, + tlut_count: int, + tlut_fmt: G_IM_FMT, +): + assert tlut_count * 2 == len(tlut_data) + n64texconv.N64Image.from_bin( + data, + width, + height, + G_IM_FMT_n64texconv_by_n64[fmt], + G_IM_SIZ_n64texconv_by_n64[siz], + n64texconv.N64Palette.from_bin(tlut_data, G_IM_FMT_n64texconv_by_n64[tlut_fmt]), + ).to_png(str(path), False) + + +class TextureResource(Resource): + needs_build = True + extracted_path_suffix = ".png" + + def __init__( + self, + file: File, + range_start: int, + name: str, + fmt: G_IM_FMT, + siz: G_IM_SIZ, + width: int, + height: int, + ): + size_bits = siz.bpp * width * height + assert size_bits % 8 == 0, size_bits + size_bytes = size_bits // 8 + range_end = range_start + size_bytes + + super().__init__(file, range_start, range_end, name) + + self.fmt = fmt + self.siz = siz + self.width = width + self.height = height + + # For handling color-indexed textures: + self.resource_tlut: Optional[TextureResource] = None + """For CI textures, the TLUT used""" + self.resources_ci_list: list[TextureResource] = [] + """For TLUT "textures", the CI textures using it""" + + if size_bytes % 8 == 0 and (file.alignment + range_start) % 8 == 0: + self.alignment = 8 + elif size_bytes % 4 == 0 and (file.alignment + range_start) % 4 == 0: + self.alignment = 4 + else: + raise NotImplementedError( + "unimplemented: unaligned texture size/offset", + hex(size_bytes), + hex(range_start), + ) + + alignment_bits = self.alignment * 8 + self.elem_type = f"u{alignment_bits}" + assert self.elem_type in {"u64", "u32"} + + self.width_name = f"{self.symbol_name}_WIDTH" + self.height_name = f"{self.symbol_name}_HEIGHT" + + def get_c_declaration_base(self): + if hasattr(self, "HACK_IS_STATIC_ON") and self.is_tlut(): + raise NotImplementedError + if hasattr(self, "HACK_IS_STATIC_ON") or EXPLICIT_DL_AND_TEX_SIZES: + if not self.is_tlut(): + return f"{self.elem_type} {self.symbol_name}[{self.height_name} * {self.width_name} * {self.siz.bpp} / 8 / sizeof({self.elem_type})]" + return f"{self.elem_type} {self.symbol_name}[]" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return self.symbol_name + else: + raise ValueError(self, hex(resource_offset)) + + def resources_ci_list_append(self, resource_ci: "TextureResource"): + if resource_ci not in self.resources_ci_list: + self.resources_ci_list.append(resource_ci) + + HACK_NO_CHECK_TLUT_BOUNDS = self.name in { + # this TLUT should be 184 colors instead of 136 as defined in the xml, + # but then it would overlap with gZelda2_6TLUT. + "gZelda2_5TLUT", + # the skybox TLUTs are used "weirdly" (TODO understand) + "gSunriseSkyboxTLUT", + "gSunsetSkyboxTLUT", + "gDayOvercastSkyboxTLUT", + "gNightOvercastSkyboxTLUT", + "gHoly1SkyboxTLUT", + } + + if __debug__ and not HACK_NO_CHECK_TLUT_BOUNDS: + # if not a TLUTResource, but only a TextureResource, + # this TLUT is xml-defined (using ) + if self.__class__ == TextureResource: + # check the CI texture doesn't index OOB into this tlut + + if resource_ci.file.data is None: + # TODO see similar in TLUTResource.resources_ci_list_append + return + + # Copypasted from TLUTResource.resources_ci_list_append + + resource_ci_data = resource_ci.file.data[ + resource_ci.range_start : resource_ci.range_end + ] + + assert resource_ci.siz in {G_IM_SIZ._4b, G_IM_SIZ._8b} + + if resource_ci.siz == G_IM_SIZ._4b: + v_max = max(max((b >> 4) & 0xF, b & 0xF) for b in resource_ci_data) + assert v_max < 16 + + if resource_ci.siz == G_IM_SIZ._8b: + v_max = max(resource_ci_data) + assert v_max < 256 + + new_min_count = v_max + 1 + + # end Copypasted + + cur_count = self.width * self.height + + assert cur_count >= new_min_count, ( + "TLUT resource", + self, + "is defined as having", + cur_count, + "colors, but there is an image using it as having at least", + new_min_count, + "colors:", + resource_ci, + ) + + def set_tlut(self, resource_tlut: "TextureResource"): + assert self.fmt == G_IM_FMT.CI, (self, resource_tlut) + if self.resource_tlut is not None: + HACK_NO_FAIL_MULTIPLE_TLUTS = self.name in { + "gZelda2Tex_003A08", + } + if self.resource_tlut != resource_tlut and not HACK_NO_FAIL_MULTIPLE_TLUTS: + # Technically not impossible so NotImplementedError + raise NotImplementedError( + "Color-indexed texture using two different TLUTs", + self, + resource_tlut, + ) + return + + # Assert resource_tlut is rgba16. + # Note it could be ia16, but that's not implemented + assert ( + resource_tlut.fmt == G_IM_FMT.RGBA and resource_tlut.siz == G_IM_SIZ._16b + ), resource_tlut + + self.resource_tlut = resource_tlut + assert self not in resource_tlut.resources_ci_list + resource_tlut.resources_ci_list_append(self) + + def try_parse_data(self, memory_context): + if self.fmt != G_IM_FMT.CI: + # Nothing to do + return RESOURCE_PARSE_SUCCESS + else: + if self.resource_tlut is None: + raise ResourceParseWaiting(waiting_for=["self.resource_tlut"]) + return RESOURCE_PARSE_SUCCESS + + def is_tlut(self): + """The result is only meaningful after all resources have been parsed + + (otherwise, for example, the dlists referencing this resource + as a tlut may not have been parsed and this would be considered + a regular texture) + """ + return len(self.resources_ci_list) != 0 + + def is_shared_tlut(self): + # Same caveat as is_tlut + return len(self.resources_ci_list) >= 2 + + def tlut_can_omit_tlut_info_from_users(self): + assert self.is_tlut() + return len(self.resources_ci_list) == 1 and self.alignment == 8 + + def tlut_get_count(self): + assert self.is_tlut() + return self.width * self.height + + def get_filename_stem(self): + format_name = f"{self.fmt.name.lower()}{self.siz.bpp}" + + if self.elem_type != "u64": + elem_type_suffix = f".{self.elem_type}" + else: + elem_type_suffix = "" + + if self.fmt == G_IM_FMT.CI: + assert self.resource_tlut is not None + tlut_info = f"tlut_{self.resource_tlut.name}" + if self.resource_tlut.elem_type != "u64": + tlut_info += f"_{self.resource_tlut.elem_type}" + if not self.resource_tlut.tlut_can_omit_tlut_info_from_users(): + return f"{self.name}.{format_name}.{tlut_info}{elem_type_suffix}" + else: + return f"{self.name}.{format_name}{elem_type_suffix}" + elif self.is_tlut(): + if not self.tlut_can_omit_tlut_info_from_users(): + return f"{self.name}.tlut.{format_name}{elem_type_suffix}" + else: + return f"{self.resources_ci_list[0].name}.tlut.{format_name}{elem_type_suffix}" + else: + return f"{self.name}.{format_name}{elem_type_suffix}" + + def write_extracted(self, memory_context): + if self.is_tlut(): + # TLUTs are extracted as part of the color-indexed textures using them + + def is_all_resources_fake(): + return all( + hasattr(res, "FAKE_FOR_BEST_EFFORT") + for res in self.resources_ci_list + ) + + if BEST_EFFORT: + if is_all_resources_fake(): + assert self.fmt == G_IM_FMT.RGBA + + if VERBOSE_BEST_EFFORT_TLUT_NO_REAL_USER and not getattr( + self, "HACK_ignore_orphaned_tlut", False + ): + print( + "BEST_EFFORT", + "no real (non-fake for best effort) ci resource uses this tlut", + ) + rich_pprint(self) + print( + " extracting the tlut as its own png", + self.extract_to_path.resolve().as_uri(), + "instead of relying on it being generated", + "\n (note while the result may build and match the tlut probably is", + "the wrong size since there was no ci image to take/guess its length from)", + ) + + # Extract the tlut as png instead of relying on + # it being generated from pngs using it, since + # there are no such pngs. + # (Copypaste of the general case (non-tlut) below): + data = self.file.data[self.range_start : self.range_end] + assert len(data) == self.range_end - self.range_start + write_n64_image_to_png( + self.extract_to_path, + self.width, + self.height, + self.fmt, + self.siz, + data, + ) + else: + # assert this TLUT is used by at least one real resource, + # otherwise it won't be generated by anything + assert not is_all_resources_fake() + return + + data = self.file.data[self.range_start : self.range_end] + assert len(data) == self.range_end - self.range_start + if self.fmt == G_IM_FMT.CI: + tlut_data = self.resource_tlut.file.data[ + self.resource_tlut.range_start : self.resource_tlut.range_end + ] + tlut_count = self.resource_tlut.tlut_get_count() + tlut_fmt = self.resource_tlut.fmt + write_n64_image_to_png_color_indexed( + self.extract_to_path, + self.width, + self.height, + self.fmt, + self.siz, + data, + tlut_data, + tlut_count, + tlut_fmt, + ) + else: + write_n64_image_to_png( + self.extract_to_path, self.width, self.height, self.fmt, self.siz, data + ) + + def write_c_declaration(self, h: io.TextIOBase): + if self.is_tlut(): + # TODO + h.writelines( + (f"//#define {self.symbol_name}_TLUT_COUNT {self.tlut_get_count()}\n",) + ) + else: + h.writelines( + ( + f"#define {self.width_name} {self.width}\n", + f"#define {self.height_name} {self.height}\n", + ) + ) + super().write_c_declaration(h) + + def get_h_includes(self): + return ("ultra64.h",) + + @reprlib.recursive_repr() + def __repr__(self): + return super().__repr__().removesuffix(")") + ( + f", fmt={self.fmt}, siz={self.siz}" + f", width={self.width}, height={self.height}" + f", elem_type={self.elem_type}" + f", resource_tlut={self.resource_tlut}, resources_ci_list={self.resources_ci_list}" + ")" + ) + + def __rich_repr__(self): + yield from super().__rich_repr__() + yield "fmt", self.fmt + yield "siz", self.siz + yield "width", self.width + yield "height", self.height + yield "elem_type", self.elem_type + yield "resource_tlut", self.resource_tlut + yield "resources_ci_list", self.resources_ci_list + + __rich_repr__.angular = True + + +class TLUTResource(TextureResource, can_size_be_unknown=True): + """ + Note this resource is only used for discovered TLUTs, not tluts from xmls + (TODO maybe change the xmls eventually) + Discovered TLUTs are different because their size is unknown + """ + + def __init__(self, file: File, range_start: int, name: str, fmt: G_IM_FMT): + assert fmt in {G_IM_FMT.RGBA, G_IM_FMT.IA} + + # just to make TextureResource.__init__ happy + # Note these values are picked so u64 elem_type is possible + fake_width = 4 + fake_height = 1 + + super().__init__( + file, range_start, name, fmt, G_IM_SIZ._16b, fake_width, fake_height + ) + + def tlut_get_count(self): + if self.range_end is None: + raise Exception("cannot tlut_get_count, unknown count yet") + return super().tlut_get_count() + + def resources_ci_list_append(self, resource_ci: "TextureResource"): + super().resources_ci_list_append(resource_ci) + + if resource_ci.file.data is None: + # Can't expand length, the user CI texture has no data attached + # TODO handle better? but idk + # maybe just a warning + return + + resource_ci_data = resource_ci.file.data[ + resource_ci.range_start : resource_ci.range_end + ] + + assert resource_ci.siz in {G_IM_SIZ._4b, G_IM_SIZ._8b} + + if resource_ci.siz == G_IM_SIZ._4b: + v_max = max(max((b >> 4) & 0xF, b & 0xF) for b in resource_ci_data) + assert v_max < 16 + + if resource_ci.siz == G_IM_SIZ._8b: + v_max = max(resource_ci_data) + assert v_max < 256 + + new_min_count = v_max + 1 + + assert self.height == 1 + if new_min_count > self.width: + # round width up to a multiple of 4, for elem_type=u64 + self.width = (new_min_count + 3) // 4 * 4 + + assert self.width <= 256 + + # TODO HACK this is hacky because not explicitly permitted, + # once set self.range_end is assumed to be fixed + # but surely it'll be fine (copium) + # In practice nothing should reference inside a tlut, + # so the resource has all the time to expand. + # A better implementation would be to give a "final warning" kind of signal + # to the resource on try_parse_data (add optional tryhard_parse_data ?) + assert self.siz == G_IM_SIZ._16b + self.range_end = self.range_start + self.width * self.height * 2 + + +class TextureSplitTlutResource(TextureResource): + + def __init__(self, file, range_start, name, fmt, siz, width, height, lo_half: bool): + assert fmt == G_IM_FMT.CI + assert siz == G_IM_SIZ._8b + super().__init__(file, range_start, name, fmt, siz, width, height) + self.lo_half = lo_half + + def get_filename_stem(self): + assert self.elem_type == "u64" + assert self.resource_tlut.elem_type == "u64" + + return f"{self.name}.ci8.split_{'lo' if self.lo_half else 'hi'}.tlut_{self.resource_tlut.name}" + + def write_extracted(self, memory_context): + data = self.file.data[self.range_start : self.range_end] + assert len(data) == self.range_end - self.range_start + + if self.lo_half: + assert all(_b < 128 for _b in data) + else: + assert all(_b >= 128 for _b in data) + data = bytes(_b - 128 for _b in data) + + tlut_data = self.resource_tlut.file.data[ + self.resource_tlut.range_start : self.resource_tlut.range_end + ] + + assert self.resource_tlut.tlut_get_count() == 128 + + write_n64_image_to_png_color_indexed( + self.extract_to_path, + self.width, + self.height, + self.fmt, + self.siz, + data, + tlut_data, + 128, + self.resource_tlut.fmt, + ) + + +def gfxdis( + *, + input_buffer: Union[bytes, memoryview], + output_callback: Optional[ + Callable[[bytes], None] # deviates a bit from gfxd, no count arg/return + ] = None, + enable_caps: set[pygfxd.GfxdCap] = { + pygfxd.GfxdCap.stop_on_end, + pygfxd.GfxdCap.emit_dec_color, + }, + target: pygfxd.gfx_ucode_t = pygfxd.gfxd_f3dex2, + vtx_callback: Optional[Callable[[int, int], int]] = None, + timg_callback: Optional[Callable[[int, int, int, int, int, int], int]] = None, + tlut_callback: Optional[Callable[[int, int, int], int]] = None, + mtx_callback: Optional[Callable[[int], int]] = None, + dl_callback: Optional[Callable[[int], int]] = None, + macro_fn: Optional[Callable[[], int]] = None, + arg_fn: Optional[Callable[[int], None]] = None, +): + for cap in ( + pygfxd.GfxdCap.stop_on_invalid, + pygfxd.GfxdCap.stop_on_end, + pygfxd.GfxdCap.emit_dec_color, + pygfxd.GfxdCap.emit_q_macro, + pygfxd.GfxdCap.emit_ext_macro, + ): + if cap in enable_caps: + pygfxd.gfxd_enable(cap) + else: + pygfxd.gfxd_disable(cap) + + pygfxd.gfxd_target(target) + + pygfxd.gfxd_input_buffer(bytes(input_buffer)) + + uncaught_exc_infos = [] + + # output_callback + + if output_callback: + + def output_callback_wrapper(buf, count): + try: + output_callback(buf) + except: + import sys + + exc_info = sys.exc_info() + uncaught_exc_infos.append(exc_info) + return count + + else: + + def output_callback_wrapper(buf, count): + return count + + pygfxd.gfxd_output_callback(output_callback_wrapper) + + # vtx_callback + + if vtx_callback: + + def vtx_callback_wrapper(vtx, num): + try: + ret = vtx_callback(vtx, num) + except: + import sys + + exc_info = sys.exc_info() + uncaught_exc_infos.append(exc_info) + + ret = 0 + return ret + + else: + + def vtx_callback_wrapper(vtx, num): + return 0 + + pygfxd.gfxd_vtx_callback(vtx_callback_wrapper) + + # timg_callback + + if timg_callback: + + def timg_callback_wrapper(timg, fmt, siz, width, height, pal): + try: + ret = timg_callback(timg, fmt, siz, width, height, pal) + assert isinstance(ret, int) + except: + import sys + + exc_info = sys.exc_info() + uncaught_exc_infos.append(exc_info) + + ret = 0 + return ret + + else: + + def timg_callback_wrapper(timg, fmt, siz, width, height, pal): + return 0 + + pygfxd.gfxd_timg_callback(timg_callback_wrapper) + + # tlut_callback + + if tlut_callback: + + def tlut_callback_wrapper(tlut, idx, count): + try: + ret = tlut_callback(tlut, idx, count) + except: + import sys + + exc_info = sys.exc_info() + uncaught_exc_infos.append(exc_info) + + ret = 0 + return ret + + else: + + def tlut_callback_wrapper(tlut, idx, count): + return 0 + + pygfxd.gfxd_tlut_callback(tlut_callback_wrapper) + + # mtx_callback + + if mtx_callback: + + def mtx_callback_wrapper(mtx): + try: + ret = mtx_callback(mtx) + except: + import sys + + exc_info = sys.exc_info() + uncaught_exc_infos.append(exc_info) + + ret = 0 + return ret + + else: + + def mtx_callback_wrapper(mtx): + return 0 + + pygfxd.gfxd_mtx_callback(mtx_callback_wrapper) + + # dl_callback + + if dl_callback: + + def dl_callback_wrapper(dl): + try: + ret = dl_callback(dl) + except: + import sys + + exc_info = sys.exc_info() + uncaught_exc_infos.append(exc_info) + + ret = 0 + return ret + + else: + + def dl_callback_wrapper(dl): + return 0 + + pygfxd.gfxd_dl_callback(dl_callback_wrapper) + + # macro_fn + + if macro_fn: + + def macro_fn_wrapper(): + try: + ret = macro_fn() + except: + import sys + + exc_info = sys.exc_info() + uncaught_exc_infos.append(exc_info) + + ret = 0 + + # TODO consider: + if uncaught_exc_infos: + pygfxd.gfxd_input_buffer( + b"" + ) # interrupt current execution TODO check if this is safe and if it works + ret = 1 + + return ret + + else: + + def macro_fn_wrapper(): + ret = pygfxd.gfxd_macro_dflt() + + # TODO consider: + if uncaught_exc_infos: + pygfxd.gfxd_input_buffer(b"") # TODO see same line above + ret = 1 + + return ret + + pygfxd.gfxd_macro_fn(macro_fn_wrapper) + + # arg_fn + + if arg_fn: + + def arg_fn_wrapper(arg_num): + try: + arg_fn(arg_num) + except: + import sys + + exc_info = sys.exc_info() + uncaught_exc_infos.append(exc_info) + + pygfxd.gfxd_arg_fn(arg_fn_wrapper) + else: + pygfxd.gfxd_arg_fn(None) + + # Execute + + pygfxd.gfxd_execute() + + # The offset is in bytes and indicates the last command, + # so add 8 (sizeof(Gfx)) + size = pygfxd.gfxd_macro_offset() + 8 + + if uncaught_exc_infos: + import traceback + + msg = "There were uncaught python errors in callbacks during gfxd execution." + + print() + print(msg) + print("vvv See below for a list of the traces of the uncaught errors:") + + for exc_info in uncaught_exc_infos: + import sys + + print() + traceback.print_exception(*exc_info, file=sys.stdout) + + print() + print(msg) + print("^^^ See above for a list of the traces of the uncaught errors.") + + raise Exception( + msg, + "See the standard output for a list of the traces of the uncaught errors.", + uncaught_exc_infos, + ) + + return size + + +class StringWrapper: + def __init__( + self, + data: Union[str, bytes], + max_line_length, + writer: Callable[[Union[str, bytes]], None], + ): + self.max_line_length = max_line_length + self.pending_data = data + self.writer = writer + self.newline_char = "\n" if isinstance(data, str) else b"\n" + self.space_char = " " if isinstance(data, str) else b" " + + def append(self, data: Union[str, bytes]): + self.pending_data += data + self.proc() + + def proc(self, flush=False): + while len(self.pending_data) > self.max_line_length or ( + flush and self.pending_data + ): + i = self.pending_data.find(self.newline_char, 0, self.max_line_length) + if i >= 0: + i += 1 + self.writer(self.pending_data[:i]) + self.pending_data = self.pending_data[i:] + continue + + i = self.pending_data.rfind(self.space_char, 1, self.max_line_length) + if i < 0: + i = self.pending_data.find(self.space_char, 1) + if i < 0: + if flush: + i = len(self.pending_data) + else: + # Avoid adding a line return in the middle of a word + return + self.writer(self.pending_data[:i]) + self.pending_data = self.pending_data[i:] + if not flush or self.pending_data: + self.writer(self.newline_char) + + def flush(self): + self.proc(flush=True) + + +class Ucode(enum.Enum): + f3dex = pygfxd.gfxd_f3dex + f3dex2 = pygfxd.gfxd_f3dex2 + + def __init__(self, gfxd_ucode: pygfxd.gfx_ucode_t): + self.gfxd_ucode = gfxd_ucode + + +# TODO probably need to split TLUTResource from TextureResource +# to achieve cleaner code, +# tluts behave very differently + + +# TODO maybe refactor this once it works tm +class ColorIndexedTexturesManager: + from dataclasses import dataclass + + @dataclass + class Tex: + timg: int + fmt: G_IM_FMT + siz: G_IM_SIZ + width: int + height: int + pal: int + + @dataclass + class Tlut: + tlut: int + idx: int + count: int + + @dataclass + class CIState: + tlut_mode: G_TT + tluts_count: int + tluts: dict[int, "ColorIndexedTexturesManager.Tlut"] + texs: list["ColorIndexedTexturesManager.Tex"] + + def __init__(self, *, HACK_late_SetTextureLUT=False): + self.cur_tlut_mode: G_TT = None + + self.cur_tluts_count: int = None + self.cur_tluts: dict[int, ColorIndexedTexturesManager.Tlut] = dict() + self.cur_texs: list[ColorIndexedTexturesManager.Tex] = [] + + self.ci_states: list[ColorIndexedTexturesManager.CIState] = [] + + # Rarely, + # gsDPSetTextureLUT comes after gsDPLoadTextureBlock and gsDPLoadTLUT, + # instead of before + self.HACK_late_SetTextureLUT = HACK_late_SetTextureLUT + + def ci_timg(self, timg, fmt: G_IM_FMT, siz: G_IM_SIZ, width, height, pal): + if VERBOSE_ColorIndexedTexturesManager: + print( + "ColorIndexedTexturesManager.ci_timg", + hex(timg), + fmt, + siz, + width, + height, + pal, + ) + assert fmt == G_IM_FMT.CI + if not self.HACK_late_SetTextureLUT: + assert self.cur_tlut_mode != G_TT.NONE + + self.cur_texs.append( + ColorIndexedTexturesManager.Tex(timg, fmt, siz, width, height, pal) + ) + + def tlut(self, tlut, idx, count): + if VERBOSE_ColorIndexedTexturesManager: + print("ColorIndexedTexturesManager.tlut", hex(tlut), idx, count) + if idx == -1: + # HACK idx==-1 may be a libgfxd bug? + assert count == 256 + idx = 0 + if not self.HACK_late_SetTextureLUT: + assert self.cur_tlut_mode != G_TT.NONE + if self.cur_tluts_count != count: + self.cur_tluts.clear() # TODO ? idk. (at worst it will cause errors) + self.cur_tluts_count = count + self.cur_tluts[idx] = ColorIndexedTexturesManager.Tlut(tlut, idx, count) + + def tlut_mode(self, tt: G_TT): + if VERBOSE_ColorIndexedTexturesManager: + print("ColorIndexedTexturesManager.tlut_mode", tt) + if self.cur_tlut_mode != tt: + if not self.HACK_late_SetTextureLUT: + self.cur_tluts.clear() # TODO ? idk. (at worst it will cause errors) + self.cur_tlut_mode = tt + + def commit_state(self): + if self.cur_tlut_mode == G_TT.NONE: + return + if not self.cur_texs: + return + assert self.cur_tluts + assert self.cur_tluts_count is not None + if self.cur_tlut_mode is None: + if BEST_EFFORT: + # Some dlists (eg gMegamiPiece2DL) inherit G_TT_RGBA16 + # since ia16 is uncommon if not unused, just default to that + self.cur_tlut_mode = G_TT.RGBA16 + assert self.cur_tlut_mode is not None + cur_state = ColorIndexedTexturesManager.CIState( + self.cur_tlut_mode, + self.cur_tluts_count, + self.cur_tluts.copy(), + self.cur_texs, + ) + self.cur_texs = [] + self.ci_states.append(cur_state) + if VERBOSE_ColorIndexedTexturesManager: + print( + "ColorIndexedTexturesManager.commit_state", + "cur_state =", + cur_state, + ) + + def report_states(self, reporter: Resource, memory_context: "MemoryContext"): + if VERBOSE_ColorIndexedTexturesManager: + print("ColorIndexedTexturesManager.report_states") + for ci_state in self.ci_states: + if VERBOSE_ColorIndexedTexturesManager: + print(" ci_state =", ci_state) + assert ci_state.tlut_mode != G_TT.NONE + for tex in ci_state.texs: + if VERBOSE_ColorIndexedTexturesManager: + print(" tex =", tex) + assert tex.fmt == G_IM_FMT.CI + + # HACK + if ( + reporter.file.name + in { + "jyasinzou_room_5", + "jyasinzou_room_25", + } + and ci_state.tluts_count == 256 + and tex.siz == G_IM_SIZ._4b + ): + # For some reason jyasinzou_room_5DL_008EC0 has this: + """ + gsDPLoadTextureBlock_4b(jyasinzou_sceneTex_019320, G_IM_FMT_CI, 64, 64, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR + | G_TX_WRAP, 6, 6, G_TX_NOLOD, G_TX_NOLOD), + gsDPLoadTLUT_pal16(0, jyasinzou_sceneTLUT_018000), + gsDPLoadTextureBlock(jyasinzou_room_5Tex_00DFC8, G_IM_FMT_CI, G_IM_SIZ_8b, 64, 32, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, 6, 5, G_TX_NOLOD, G_TX_NOLOD), + gsDPLoadTLUT_pal256(jyasinzou_sceneTLUT_017DE0), + """ + # (where the first texture & tlut loads are useless, overriden by the latter two) + + # -> Ignore the first texture (in `tex` at this point) + + # similar thing in jyasinzou_room_25DL_005050 + + # (note the condition to restrict this to the above cases is very broad, + # just checking reporter.file.name, so this may happen more in those files + # and not have been caught and documented here) + + continue + + # Not a proper hard requirement but if this fails + # something is probably wrong, look at details then + assert ( + ci_state.tluts_count + == { + G_IM_SIZ._4b: 16, + G_IM_SIZ._8b: 256, + }[tex.siz] + ), (reporter, ci_state, tex) + + if ci_state.tluts_count > 16: + assert ci_state.tluts.keys() == {0}, ci_state.tluts + + resource = memory_context.report_resource_at_segmented( + reporter, + tex.timg, + TextureResource, + lambda file, offset: TextureResource( + file, + offset, + f"{reporter.name}_{offset:08X}_CITex", + tex.fmt, + tex.siz, + tex.width, + tex.height, + ), + ) + + tlut = ci_state.tluts[tex.pal] + assert tlut.idx == tex.pal + assert tlut.count == ci_state.tluts_count + + resource_tlut = memory_context.report_resource_at_segmented( + reporter, + tlut.tlut, + # TLUTs declared in xmls use so are TextureResource, + # so we can only expects a TextureResource + # (TLUTResource is a subclass of TextureResource) + TextureResource, + lambda file, offset: TLUTResource( + file, + offset, + f"{reporter.name}_{offset:08X}_TLUT", + { + G_TT.RGBA16: G_IM_FMT.RGBA, + G_TT.IA16: G_IM_FMT.IA, + }[ci_state.tlut_mode], + ), + ) + + resource.set_tlut(resource_tlut) + + +class DListResource(Resource, can_size_be_unknown=True): + def __init__( + self, + file: File, + range_start: int, + name: str, + *, + target_ucode: Ucode = Ucode.f3dex2, + ): + super().__init__(file, range_start, None, name) + self.target_ucode = target_ucode + self.ignored_raw_pointers: set[int] = set() + + def try_parse_data(self, memory_context): + offset = self.range_start + + if VERBOSE2: + print(self.name, hex(offset)) + + def vtx_cb(vtx, num): + if vtx in self.ignored_raw_pointers: + return 0 + + # TODO be smarter about buffer merging + # (don't merge buffers from two different DLs, if they can be split cleanly) + # if that even happens + memory_context.mark_resource_buffer_at_segmented( + self, + VtxArrayResource, + f"{self.name}_{vtx:08X}_Vtx", + vtx, + vtx + num * VtxArrayResource.element_cdata_ext.size, + ) + return 0 + + ci_tex_manager = ColorIndexedTexturesManager( + # TODO + HACK_late_SetTextureLUT=(self.name in {"gEponaHeadLimb_0600AC20_DL"}) + ) + + def timg_cb(timg, fmt, siz, width, height, pal): + if timg in self.ignored_raw_pointers: + return 0 + + g_fmt = G_IM_FMT.by_i[fmt] + g_siz = G_IM_SIZ.by_i[siz] + + if g_fmt == G_IM_FMT.CI: + ci_tex_manager.ci_timg(timg, g_fmt, g_siz, width, height, pal) + else: + memory_context.report_resource_at_segmented( + self, + timg, + TextureResource, + lambda file, offset: TextureResource( + file, + offset, + f"{self.name}_{offset:08X}_Tex", + g_fmt, + g_siz, + width, + height, + ), + ) + return 0 + + def tlut_cb(tlut, idx, count): + if tlut in self.ignored_raw_pointers: + return 0 + + ci_tex_manager.tlut(tlut, idx, count) + return 0 + + def mtx_cb(mtx): + if mtx in self.ignored_raw_pointers: + return 0 + + memory_context.report_resource_at_segmented( + self, + mtx, + MtxResource, + lambda file, offset: MtxResource( + file, offset, f"{self.name}_{mtx:08X}_Mtx" + ), + ) + return 0 + + def dl_cb(dl): + if dl in self.ignored_raw_pointers: + return 0 + + memory_context.report_resource_at_segmented( + self, + dl, + DListResource, + lambda file, offset: DListResource( + file, + offset, + f"{self.name}_{dl:08X}_DL", + target_ucode=self.target_ucode, + ), + ) + return 0 + + def macro_fn(): + tt = pygfxd.gfxd_value_by_type(pygfxd.GfxdArgType.Tt, 0) + if tt is not None: + tt = tt[1] + else: + othermodehi = pygfxd.gfxd_value_by_type( + pygfxd.GfxdArgType.Othermodehi, 0 + ) + if othermodehi is not None: + othermodehi = othermodehi[1] + tt = othermodehi & (0b11 << G_MDSFT_TEXTLUT) + else: + tt = None + if tt is not None: + g_tt = G_TT.by_i[tt] + ci_tex_manager.tlut_mode(g_tt) + + macro_id = pygfxd.gfxd_macro_id() + if macro_id in { + pygfxd.GfxdMacroId.SP1Triangle, + pygfxd.GfxdMacroId.SP2Triangles, + }: + ci_tex_manager.commit_state() + + return pygfxd.gfxd_macro_dflt() + + size = gfxdis( + input_buffer=self.file.data[self.range_start :], + target=self.target_ucode.gfxd_ucode, + vtx_callback=vtx_cb, + timg_callback=timg_cb, + tlut_callback=tlut_cb, + mtx_callback=mtx_cb, + dl_callback=dl_cb, + macro_fn=macro_fn, + ) + + # Also commit state at the end of the display list. + # This handles "material" dlists that only load a texture, + # without drawing geometry. + ci_tex_manager.commit_state() + + ci_tex_manager.report_states(self, memory_context) + + self.range_end = self.range_start + size + + if VERBOSE2: + print(self.name, hex(offset), hex(self.range_end)) + + return RESOURCE_PARSE_SUCCESS + + def get_c_declaration_base(self): + if hasattr(self, "HACK_IS_STATIC_ON") or EXPLICIT_DL_AND_TEX_SIZES: + length = (self.range_end - self.range_start) // 8 + return f"Gfx {self.symbol_name}[{length}]" + return f"Gfx {self.symbol_name}[]" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return self.symbol_name + else: + raise ValueError() + + def write_extracted(self, memory_context): + def macro_fn(): + pygfxd.gfxd_puts(INDENT) + ret = pygfxd.gfxd_macro_dflt() + pygfxd.gfxd_puts(",\n") + return ret + + def arg_fn_handle_Dim(arg_num: int): + timg = pygfxd.gfxd_value_by_type(pygfxd.GfxdArgType.Timg, 0) + if timg is None: + return False + _, timg_segmented, _ = timg + dim_args_i = [] + for arg_i in range(pygfxd.gfxd_arg_count()): + if pygfxd.gfxd_arg_type(arg_i) == pygfxd.GfxdArgType.Dim: + dim_args_i.append(arg_i) + assert arg_num in dim_args_i + assert len(dim_args_i) <= 2 + if len(dim_args_i) != 2: + return False + width_arg_i, height_arg_i = dim_args_i + try: + timg_resolved = memory_context.resolve_segmented(timg_segmented) + except UnmappedAddressError: + # TODO store failed resolutions somewhere, for later printing + # (in general, it would be nice to fail less and *firmly* warn more instead, + # even if it means having compilation fail on purpose (#error)) + return False + try: + resolved_resource = timg_resolved.get_resource(TextureResource) + except UnexpectedResourceTypeError: + # TODO investigate. eg spot18 uses 0x0800_0000 as both a DL and Tex ? + return False + + assert isinstance(resolved_resource, TextureResource), ( + hex(timg_segmented), + resolved_resource, + resolved_resource.__class__, + ) + width_arg_value = pygfxd.gfxd_arg_value(width_arg_i)[1] + height_arg_value = pygfxd.gfxd_arg_value(height_arg_i)[1] + if (resolved_resource.width, resolved_resource.height) == ( + width_arg_value, + height_arg_value, + ): + if arg_num == width_arg_i: + if resolved_resource.width_name: + pygfxd.gfxd_puts(resolved_resource.width_name) + return True + else: + assert arg_num == height_arg_i + if resolved_resource.height_name: + pygfxd.gfxd_puts(resolved_resource.height_name) + return True + else: + HACK_no_warn_bad_dims_DLs = { + "sPresentedByNintendoDL", # uses gsDPLoadTextureTile, in which height is unused, so disassembled as 0 by gfxdis + "gMantUnusedMaterialDL", # DList bug + "gSunDL", # DList loads bigger chunks than the individual texture pieces (overlaps) + } + HACK_no_warn_bad_dims_Texs = { + "gPoeComposerFlatHeadDL_000060E0_Tex", # used as both rgba16 16x16 and rgba16 8x8 + "gDekuStickTex", # used as both i8 8x8 and i8 16x16 + "gHilite1Tex", # used as both rgba16 16x16 and rgba16 32x32 + "gHilite2Tex", # used as both rgba16 16x16 and rgba16 32x32 + "gUnknownCircle4Tex", # used as both i8 16x16 and rgba16 32x32 + "gLinkChildLowerBootTex", # used as both ci8 32x32 and ci8 16x16 + "gDecorativeFlameMaskTex", # used as both i4 32x128 and i4 32x64 + } + if ( + arg_num == width_arg_i + and self.name not in HACK_no_warn_bad_dims_DLs + and resolved_resource.name not in HACK_no_warn_bad_dims_Texs + ): + print( + "Unexpected texture dimensions used: in dlist =", + self, + "texture =", + resolved_resource, + "texture resource has WxH =", + (resolved_resource.width, resolved_resource.height), + "but dlist uses WxH =", + (width_arg_value, height_arg_value), + ) + pygfxd.gfxd_puts( + " /* ! Unexpected texture dimensions !" + f" DL={width_arg_value}x{height_arg_value}" + f" vs Tex={resolved_resource.width}x{resolved_resource.height} */ " + ) + return False + + arg_fn_handlers = { + pygfxd.GfxdArgType.Dim: arg_fn_handle_Dim, + } + + def arg_fn(arg_num: int): + arg_type = pygfxd.gfxd_arg_type(arg_num) + arg_handler = arg_fn_handlers.get(arg_type) + + if arg_handler is not None: + inhibit_default = arg_handler(arg_num) + else: + inhibit_default = False + + if not inhibit_default: + pygfxd.gfxd_arg_dflt(arg_num) + + def vtx_cb(vtx, num): + if vtx in self.ignored_raw_pointers: + return 0 + + pygfxd.gfxd_puts(memory_context.get_c_reference_at_segmented(vtx)) + return 1 + + def timg_cb(timg, fmt, siz, width, height, pal): + if timg in self.ignored_raw_pointers: + return 0 + + try: + timg_c_ref = memory_context.get_c_reference_at_segmented(timg) + # except NoSegmentBaseError: # TODO + # timg_c_ref = None + except ValueError: + if BEST_EFFORT: + # (turns out I needed this because of a mistake in a xml so it can be useful) + import traceback + + print("vvv /* BAD TIMG REF */ vvv") + traceback.print_exc() + pygfxd.gfxd_puts("/* BAD TIMG REF */") + return 0 + else: + raise + if timg_c_ref: + pygfxd.gfxd_puts(timg_c_ref) + return 1 + return 0 + + def tlut_cb(tlut, idx, count): + if tlut in self.ignored_raw_pointers: + return 0 + + tlut_c_ref = memory_context.get_c_reference_at_segmented(tlut) + pygfxd.gfxd_puts(tlut_c_ref) + return 1 + + def mtx_cb(mtx): + if mtx in self.ignored_raw_pointers: + return 0 + + mtx_c_ref = memory_context.get_c_reference_at_segmented(mtx) + pygfxd.gfxd_puts(mtx_c_ref) + return 1 + + def dl_cb(dl): + if dl in self.ignored_raw_pointers: + return 0 + + dl_c_ref = memory_context.get_c_reference_at_segmented(dl) + pygfxd.gfxd_puts(dl_c_ref) + return 1 + + with self.extract_to_path.open("wb") as f: + if not self.braces_in_source: + f.write(b"{\n") + + out_string_wrapper = StringWrapper(b"", 120, f.write) + + def output_cb(buf: bytes): + out_string_wrapper.append(buf) + + gfxdis( + input_buffer=self.file.data[self.range_start : self.range_end], + output_callback=output_cb, + enable_caps={pygfxd.GfxdCap.emit_dec_color}, + target=self.target_ucode.gfxd_ucode, + vtx_callback=vtx_cb, + timg_callback=timg_cb, + tlut_callback=tlut_cb, + mtx_callback=mtx_cb, + dl_callback=dl_cb, + macro_fn=macro_fn, + arg_fn=arg_fn, + ) + + out_string_wrapper.flush() + + if not self.braces_in_source: + f.write(b"}\n") + + def get_c_includes(self): + return ( + # TODO these are not always needed: + "sys_matrix.h", # for gIdentityMtx + ) + + def get_h_includes(self): + return ("ultra64.h",) + + +def report_gfx_segmented(resource: Resource, memory_context: "MemoryContext", v): + assert isinstance(v, int) + address = v + if address != 0: + memory_context.report_resource_at_segmented( + resource, + address, + DListResource, + lambda file, offset: DListResource( + file, + offset, + f"{resource.name}_{address:08X}_DL", + ), + ) + + +def write_gfx_segmented( + resource: Resource, + memory_context: "MemoryContext", + v, + wctx: CDataExtWriteContext, +): + assert isinstance(v, int) + address = v + wctx.f.write(wctx.line_prefix) + if address == 0: + wctx.f.write("NULL") + else: + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + return True + + +cdata_ext_gfx_segmented = ( + CDataExt_Value("I").set_report(report_gfx_segmented).set_write(write_gfx_segmented) +) + +VERBOSE2 = False diff --git a/tools/assets/extract/extase_oot64/misc_resources.py b/tools/assets/extract/extase_oot64/misc_resources.py new file mode 100644 index 0000000000..6f5f3a8265 --- /dev/null +++ b/tools/assets/extract/extase_oot64/misc_resources.py @@ -0,0 +1,63 @@ +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +import struct + +from ..extase import ( + RESOURCE_PARSE_SUCCESS, + File, + Resource, +) + +from tools import csdis + + +class CutsceneResource(Resource, can_size_be_unknown=True): + + def __init__(self, file: File, range_start: int, name: str): + super().__init__(file, range_start, None, name) + + def try_parse_data(self, memory_context): + assert self.range_start % 4 == 0 + data = self.file.data[self.range_start :] + num_bytes = len(data) + if num_bytes % 4 != 0: + data = data[: -(num_bytes % 4)] + data_words = [unpacked[0] for unpacked in struct.iter_unpack(">I", data)] + size_words, cs_source = csdis.disassemble_cutscene(data_words) + self.range_end = self.range_start + 4 * size_words + self.cs_source = cs_source + return RESOURCE_PARSE_SUCCESS + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return self.symbol_name + else: + raise ValueError + + extracted_path_suffix = ".inc.c" + + def get_filename_stem(self): + return f"{self.name}.csdata" + + def write_extracted(self, memory_context): + with self.extract_to_path.open("w") as f: + if not self.braces_in_source: + f.write("{\n") + f.write(self.cs_source) + if not self.braces_in_source: + f.write("}\n") + + def get_c_declaration_base(self): + return f"CutsceneData {self.symbol_name}[]" + + def get_c_includes(self): + return ( + "z64cutscene_commands.h", + # TODO these are not always needed: + "z64ocarina.h", # for OCARINA_ACTION_* + "z64player.h", # for PLAYER_CUEID_* + ) + + def get_h_includes(self): + return ("z64cutscene.h",) diff --git a/tools/assets/extract/extase_oot64/playeranim_resources.py b/tools/assets/extract/extase_oot64/playeranim_resources.py new file mode 100644 index 0000000000..b002f91ff9 --- /dev/null +++ b/tools/assets/extract/extase_oot64/playeranim_resources.py @@ -0,0 +1,102 @@ +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ..extase import MemoryContext + +from ..extase.cdata_resources import ( + CDataResource, + CDataArrayResource, + CDataExt_Struct, + CDataExt_Value, + CDataExtWriteContext, + fmt_hex_s, +) + + +class PlayerAnimationDataResource(CDataArrayResource): + elem_cdata_ext = CDataExt_Value("h").set_write_str_v(lambda v: fmt_hex_s(v)) + + def __init__(self, file, range_start, name): + super().__init__(file, range_start, name) + self.frame_count_name = f"FRAMECOUNT_{self.symbol_name}" + + def set_frame_count(self, frame_count: int): + self.set_length(frame_count * (22 * 3 + 1)) + self.frame_count = frame_count + + def write_c_declaration(self, h): + h.write(f"#define {self.frame_count_name} {self.frame_count}\n") + super().write_c_declaration(h) + + def get_c_declaration_base(self): + return f"s16 {self.symbol_name}[{self.frame_count_name} * (PLAYER_LIMB_MAX * 3 + 1)]" + + def get_h_includes(self): + return ("ultra64.h", "z64player.h") + + +class PlayerAnimationResource(CDataResource): + + def report(resource, memory_context: "MemoryContext", v): + assert isinstance(v, dict) + segment = v["segment"] + assert isinstance(segment, int) + player_animation_data_res = memory_context.report_resource_at_segmented( + resource, + segment, + PlayerAnimationDataResource, + lambda file, offset: PlayerAnimationDataResource( + file, offset, f"{resource.name}_{segment:08X}_PlayerAnimData" + ), + ) + player_animation_data_res.set_frame_count(v["common"]["frameCount"]) + + def write_frameCount( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + address = resource.cdata_unpacked["segment"] + assert isinstance(address, int) + wctx.f.write(wctx.line_prefix) + wctx.f.write( + memory_context.resolve_segmented(address) + .get_resource(PlayerAnimationDataResource) + .frame_count_name + ) + return True + + def write_segment( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + assert isinstance(v, int) + address = v + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + return True + + cdata_ext = CDataExt_Struct( + ( + ( + "common", + CDataExt_Struct( + (("frameCount", CDataExt_Value("h").set_write(write_frameCount)),) + ), + ), + ("pad2", CDataExt_Value.pad16), + ("segment", CDataExt_Value("I").set_write(write_segment)), + ) + ).set_report(report) + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return f"&{self.symbol_name}" + else: + raise ValueError() + + def get_c_declaration_base(self): + return f"LinkAnimationHeader {self.symbol_name}" + + def get_h_includes(self): + return ("z64animation.h",) diff --git a/tools/assets/extract/extase_oot64/room_shape_resources.py b/tools/assets/extract/extase_oot64/room_shape_resources.py new file mode 100644 index 0000000000..e6e43b30bf --- /dev/null +++ b/tools/assets/extract/extase_oot64/room_shape_resources.py @@ -0,0 +1,557 @@ +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +import enum +from typing import TYPE_CHECKING + +from .. import oot64_data + +if TYPE_CHECKING: + from ..extase.memorymap import MemoryContext + + +from ..extase import ( + Resource, + File, + RESOURCE_PARSE_SUCCESS, +) +from ..extase.cdata_resources import ( + CDataResource, + CDataArrayNamedLengthResource, + CDataExt_Struct, + CDataExt_Value, + CDataExtWriteContext, + cdata_ext_Vec3s, +) + +from . import dlist_resources + + +class RoomShapeType(enum.Enum): + ROOM_SHAPE_TYPE_NORMAL = 0 + ROOM_SHAPE_TYPE_IMAGE = enum.auto() + ROOM_SHAPE_TYPE_CULLABLE = enum.auto() + + +class RoomShapeImageAmountType(enum.Enum): + ROOM_SHAPE_IMAGE_AMOUNT_SINGLE = 1 + ROOM_SHAPE_IMAGE_AMOUNT_MULTI = enum.auto() + + +def report_room_shape_at_segmented( + reporter: Resource, memory_context: "MemoryContext", address: int, name_base: str +): + def new_resource_pointed_to(file: File, offset: int): + resource_type = get_room_shape_resource_type(file, offset) + name_suffix = resource_type.__name__.removesuffix("Resource") + return resource_type( + file, + offset, + f"{name_base}_{address:08X}_{name_suffix}", + ) + + memory_context.report_resource_at_segmented( + reporter, address, Resource, new_resource_pointed_to + ) + + +def get_room_shape_resource_type(file: File, offset: int): + room_shape_type_int = file.data[offset] + room_shape_type = RoomShapeType(room_shape_type_int) + + resource_type = None + + if room_shape_type == RoomShapeType.ROOM_SHAPE_TYPE_NORMAL: + resource_type = RoomShapeNormalResource + + if room_shape_type == RoomShapeType.ROOM_SHAPE_TYPE_IMAGE: + room_shape_image_amount_type_int = file.data[offset + 1] + room_shape_image_amount_type = RoomShapeImageAmountType( + room_shape_image_amount_type_int + ) + if ( + room_shape_image_amount_type + == RoomShapeImageAmountType.ROOM_SHAPE_IMAGE_AMOUNT_SINGLE + ): + resource_type = RoomShapeImageSingleResource + if ( + room_shape_image_amount_type + == RoomShapeImageAmountType.ROOM_SHAPE_IMAGE_AMOUNT_MULTI + ): + resource_type = RoomShapeImageMultiResource + + if room_shape_type == RoomShapeType.ROOM_SHAPE_TYPE_CULLABLE: + resource_type = RoomShapeCullableResource + + assert resource_type is not None + + return resource_type + + +cdata_ext_RoomShapeBase = CDataExt_Struct( + ( + ( + "type", + CDataExt_Value("B").set_write_str_v(oot64_data.get_room_shape_type_name), + ), + ) +) + +cdata_ext_RoomShapeDListsEntry = CDataExt_Struct( + ( + ("opa", dlist_resources.cdata_ext_gfx_segmented), + ("xlu", dlist_resources.cdata_ext_gfx_segmented), + ) +) + + +# TODO check if this even needs a named length +class RoomShapeNormalEntryArrayResource(CDataArrayNamedLengthResource): + elem_cdata_ext = cdata_ext_RoomShapeDListsEntry + + def get_c_declaration_base(self): + return f"RoomShapeDListsEntry {self.symbol_name}[{self.length_name}]" + + def get_h_includes(self): + return ("z64room.h",) + + +class RoomShapeNormalResource(CDataResource): + def write_numEntries( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + address = resource.cdata_unpacked["entries"] + assert isinstance(address, int) + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_expression_length_at_segmented(address)) + return True + + def report_entries(resource, memory_context: "MemoryContext", v): + assert isinstance(v, int) + address = v + entries_resource = memory_context.report_resource_at_segmented( + resource, + address, + RoomShapeNormalEntryArrayResource, + lambda file, offset: RoomShapeNormalEntryArrayResource( + file, offset, f"{resource.name}_{address:08X}_DListsEntries" + ), + ) + assert isinstance(entries_resource, RoomShapeNormalEntryArrayResource) + numEntries = resource.cdata_unpacked["numEntries"] + assert isinstance(numEntries, int) + entries_resource.set_length(numEntries) + + def write_entries( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + assert isinstance(v, int) + address = v + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + return True + + def write_entriesEnd( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + address = resource.cdata_unpacked["entries"] + assert isinstance(address, int) + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + wctx.f.write(" + ") + wctx.f.write(memory_context.get_c_expression_length_at_segmented(address)) + return True + + cdata_ext = CDataExt_Struct( + ( + ("base", cdata_ext_RoomShapeBase), + ("numEntries", CDataExt_Value("B").set_write(write_numEntries)), + ("pad2", CDataExt_Value.pad16), + ( + "entries", + CDataExt_Value("I").set_report(report_entries).set_write(write_entries), + ), + ( + "entriesEnd", + CDataExt_Value("I").set_write(write_entriesEnd), + ), + ) + ) + + def get_c_declaration_base(self): + return f"RoomShapeNormal {self.symbol_name}" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return f"&{self.symbol_name}" + else: + raise ValueError + + def get_c_includes(self): + return ("array_count.h",) + + def get_h_includes(self): + return ("z64room.h",) + + +class RoomShapeDListsEntryResource(CDataResource): + cdata_ext = cdata_ext_RoomShapeDListsEntry + + def get_c_declaration_base(self): + return f"RoomShapeDListsEntry {self.symbol_name}" + + def get_c_reference(self, resource_offset): + if resource_offset == 0: + return f"&{self.symbol_name}" + else: + raise ValueError + + def get_h_includes(self): + return ("z64room.h",) + + +def report_RoomShapeImageBase_entry(resource, memory_context: "MemoryContext", v): + assert isinstance(v, int) + address = v + memory_context.report_resource_at_segmented( + resource, + address, + RoomShapeDListsEntryResource, + lambda file, offset: RoomShapeDListsEntryResource( + file, offset, f"{resource.name}_{address:08X}_RoomShapeDListsEntry" + ), + ) + + +def write_RoomShapeImageBase_entry( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext +): + assert isinstance(v, int) + address = v + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + return True + + +cdata_ext_RoomShapeImageBase = CDataExt_Struct( + ( + ("base", cdata_ext_RoomShapeBase), + ( + "amountType", + CDataExt_Value("B").set_write_str_v( + oot64_data.get_room_shape_image_amount_type_name + ), + ), + ("pad2", CDataExt_Value.pad16), + ( + "entry", + ( + CDataExt_Value("I") + .set_report(report_RoomShapeImageBase_entry) + .set_write(write_RoomShapeImageBase_entry) + ), + ), # RoomShapeDListsEntry* + ) +) + + +class JFIFResource(Resource): + def __init__(self, file, range_start, name): + super().__init__(file, range_start, range_start + 320 * 240 * 2, name) + + def try_parse_data(self, memory_context): + return RESOURCE_PARSE_SUCCESS + + needs_build = True + extracted_path_suffix = "" + + def get_filename_stem(self): + return f"{self.name}.jpg" + + def write_extracted(self, memory_context): + # TODO trim zeros at the end of the data + self.extract_to_path.write_bytes( + self.file.data[self.range_start : self.range_end] + ) + + def get_c_declaration_base(self): + return f"u64 {self.symbol_name}[SCREEN_WIDTH * SCREEN_HEIGHT * G_IM_SIZ_16b_BYTES / sizeof(u64)]" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return f"&{self.symbol_name}" + else: + raise ValueError + + def get_h_includes(self): + return ( + "ultra64.h", + "gfx.h", # for SCREEN_WIDTH, SCREEN_HEIGHT + ) + + +class RoomShapeImageSingleResource(CDataResource): + def report_source(resource, memory_context: "MemoryContext", v): + assert isinstance(v, int) + address = v + memory_context.report_resource_at_segmented( + resource, + address, + JFIFResource, + lambda file, offset: JFIFResource( + file, + offset, + f"{resource.name}_{address:08X}_JFIF", + ), + ) + + def write_source( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + assert isinstance(v, int) + address = v + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + return True + + cdata_ext = CDataExt_Struct( + ( + ("base", cdata_ext_RoomShapeImageBase), + ( + "source", + CDataExt_Value("I").set_report(report_source).set_write(write_source), + ), + ("unk_0C", CDataExt_Value.u32), + ("tlut", CDataExt_Value.pointer), # TODO + ("width", CDataExt_Value.u16), + ("height", CDataExt_Value.u16), + ("fmt", CDataExt_Value.u8), # TODO + ("siz", CDataExt_Value.u8), # TODO + ("tlutMode", CDataExt_Value.u16), + ("tlutCount", CDataExt_Value.u16), + ("pad1E", CDataExt_Value.pad16), + ) + ) + + def get_c_declaration_base(self): + return f"RoomShapeImageSingle {self.symbol_name}" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return f"&{self.symbol_name}" + else: + raise ValueError + + def get_h_includes(self): + return ("z64room.h",) + + +class RoomShapeImageMultiBgEntryArrayResource(CDataArrayNamedLengthResource): + def report_source(resource, memory_context: "MemoryContext", v): + assert isinstance(v, int) + address = v + memory_context.report_resource_at_segmented( + resource, + address, + JFIFResource, + lambda file, offset: JFIFResource( + file, + offset, + f"{resource.name}_{address:08X}_JFIF", + ), + ) + + def write_source( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + assert isinstance(v, int) + address = v + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + return True + + elem_cdata_ext = CDataExt_Struct( + ( + ("unk_00", CDataExt_Value.u16), + ("bgCamIndex", CDataExt_Value.u8), + ("pad3", CDataExt_Value.pad8), + ( + "source", + CDataExt_Value("I").set_report(report_source).set_write(write_source), + ), + ("unk_0C", CDataExt_Value.u32), + ("tlut", CDataExt_Value.pointer), # TODO + ("width", CDataExt_Value.u16), + ("height", CDataExt_Value.u16), + ("fmt", CDataExt_Value.u8), # TODO + ("siz", CDataExt_Value.u8), # TODO + ("tlutMode", CDataExt_Value.u16), + ("tlutCount", CDataExt_Value.u16), + ("pad1A", CDataExt_Value.pad16), + ) + ) + + def get_c_declaration_base(self): + return f"RoomShapeImageMultiBgEntry {self.name}[{self.length_name}]" + + def get_h_includes(self): + return ("z64room.h",) + + +class RoomShapeImageMultiResource(CDataResource): + def write_numBackgrounds( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + address = resource.cdata_unpacked["backgrounds"] + assert isinstance(address, int) + backgrounds_resource = memory_context.resolve_segmented(address).get_resource( + RoomShapeImageMultiBgEntryArrayResource + ) + wctx.f.write(wctx.line_prefix) + wctx.f.write(backgrounds_resource.length_name) + return True + + def report_backgrounds(resource, memory_context: "MemoryContext", v): + assert isinstance(v, int) + address = v + backgrounds_resource = memory_context.report_resource_at_segmented( + resource, + address, + RoomShapeImageMultiBgEntryArrayResource, + lambda file, offset: RoomShapeImageMultiBgEntryArrayResource( + file, + offset, + f"{resource.name}_{address:08X}_RoomShapeImageMultiBgEntries", + ), + ) + backgrounds_resource.set_length(resource.cdata_unpacked["numBackgrounds"]) + + def write_backgrounds( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + assert isinstance(v, int) + address = v + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + return True + + cdata_ext = CDataExt_Struct( + ( + ("base", cdata_ext_RoomShapeImageBase), + ("numBackgrounds", CDataExt_Value("B").set_write(write_numBackgrounds)), + ("pad9", CDataExt_Value.pad8), + ("padA", CDataExt_Value.pad16), + ( + "backgrounds", + ( + CDataExt_Value("I") + .set_report(report_backgrounds) + .set_write(write_backgrounds) + ), + ), # RoomShapeImageMultiBgEntry* + ) + ) + + def get_c_declaration_base(self): + return f"RoomShapeImageMulti {self.symbol_name}" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return f"&{self.symbol_name}" + else: + raise ValueError + + def get_h_includes(self): + return ("z64room.h",) + + +class RoomShapeCullableEntryArrayResource(CDataArrayNamedLengthResource): + elem_cdata_ext = CDataExt_Struct( + ( + ("boundsSphereCenter", cdata_ext_Vec3s), + ("boundsSphereRadius", CDataExt_Value.s16), + ("opa", dlist_resources.cdata_ext_gfx_segmented), + ("xlu", dlist_resources.cdata_ext_gfx_segmented), + ) + ) + + def get_c_declaration_base(self): + return f"RoomShapeCullableEntry {self.symbol_name}[{self.length_name}]" + + def get_h_includes(self): + return ("z64room.h",) + + +class RoomShapeCullableResource(CDataResource): + def write_numEntries( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + address = resource.cdata_unpacked["entries"] + assert isinstance(address, int) + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_expression_length_at_segmented(address)) + return True + + def report_entries(resource, memory_context: "MemoryContext", v): + assert isinstance(v, int) + address = v + entries_resource = memory_context.report_resource_at_segmented( + resource, + address, + RoomShapeCullableEntryArrayResource, + lambda file, offset: RoomShapeCullableEntryArrayResource( + file, offset, f"{resource.name}_{address:08X}_CullableEntries" + ), + ) + assert isinstance(entries_resource, RoomShapeCullableEntryArrayResource) + numEntries = resource.cdata_unpacked["numEntries"] + assert isinstance(numEntries, int) + entries_resource.set_length(numEntries) + + def write_entries( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + assert isinstance(v, int) + address = v + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + return True + + def write_entriesEnd( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + address = resource.cdata_unpacked["entries"] + assert isinstance(address, int) + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + wctx.f.write(" + ") + wctx.f.write(memory_context.get_c_expression_length_at_segmented(address)) + return True + + cdata_ext = CDataExt_Struct( + ( + ("base", cdata_ext_RoomShapeBase), + ("numEntries", CDataExt_Value("B").set_write(write_numEntries)), + ("pad2", CDataExt_Value.pad16), + ( + "entries", + CDataExt_Value("I").set_report(report_entries).set_write(write_entries), + ), + ( + "entriesEnd", + CDataExt_Value("I").set_write(write_entriesEnd), + ), + ) + ) + + def get_c_declaration_base(self): + return f"RoomShapeCullable {self.symbol_name}" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return f"&{self.symbol_name}" + else: + raise ValueError + + def get_h_includes(self): + return ("z64room.h",) diff --git a/tools/assets/extract/extase_oot64/scene_commands_resource.py b/tools/assets/extract/extase_oot64/scene_commands_resource.py new file mode 100644 index 0000000000..1579fe1a48 --- /dev/null +++ b/tools/assets/extract/extase_oot64/scene_commands_resource.py @@ -0,0 +1,717 @@ +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +import enum +import struct +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ..extase.memorymap import MemoryContext + +from ..extase import ( + File, + Resource, + RESOURCE_PARSE_SUCCESS, + ResourceParseInProgress, + ResourceParseWaiting, +) +from ..extase.cdata_resources import ( + CDataArrayResource, + CDataExt_Value, + CDataExtWriteContext, +) + +from .. import oot64_data + +from . import scene_rooms_resources +from . import collision_resources +from . import room_shape_resources +from . import misc_resources + + +def _SHIFTR(v: int, s: int, w: int): + assert isinstance(v, int) + assert isinstance(s, int) + assert isinstance(w, int) + assert v >= 0 + assert s >= 0 + assert w >= 1 + return (v >> s) & ((1 << w) - 1) + + +VERBOSE_NOT_FULLY_PARSED_SCENECMD = False + + +class SceneCmdId(enum.Enum): + # keep the SCENE_CMD_ID_ prefix for grepability + SCENE_CMD_ID_SPAWN_LIST = 0 + SCENE_CMD_ID_ACTOR_LIST = enum.auto() + SCENE_CMD_ID_UNUSED_2 = enum.auto() + SCENE_CMD_ID_COLLISION_HEADER = enum.auto() + SCENE_CMD_ID_ROOM_LIST = enum.auto() + SCENE_CMD_ID_WIND_SETTINGS = enum.auto() + SCENE_CMD_ID_ENTRANCE_LIST = enum.auto() + SCENE_CMD_ID_SPECIAL_FILES = enum.auto() + SCENE_CMD_ID_ROOM_BEHAVIOR = enum.auto() + SCENE_CMD_ID_UNDEFINED_9 = enum.auto() + SCENE_CMD_ID_ROOM_SHAPE = enum.auto() + SCENE_CMD_ID_OBJECT_LIST = enum.auto() + SCENE_CMD_ID_LIGHT_LIST = enum.auto() + SCENE_CMD_ID_PATH_LIST = enum.auto() + SCENE_CMD_ID_TRANSITION_ACTOR_LIST = enum.auto() + SCENE_CMD_ID_LIGHT_SETTINGS_LIST = enum.auto() + SCENE_CMD_ID_TIME_SETTINGS = enum.auto() + SCENE_CMD_ID_SKYBOX_SETTINGS = enum.auto() + SCENE_CMD_ID_SKYBOX_DISABLES = enum.auto() + SCENE_CMD_ID_EXIT_LIST = enum.auto() + SCENE_CMD_ID_END = enum.auto() + SCENE_CMD_ID_SOUND_SETTINGS = enum.auto() + SCENE_CMD_ID_ECHO_SETTINGS = enum.auto() + SCENE_CMD_ID_CUTSCENE_DATA = enum.auto() + SCENE_CMD_ID_ALTERNATE_HEADER_LIST = enum.auto() + SCENE_CMD_ID_MISC_SETTINGS = enum.auto() + + +scene_cmd_macro_name_by_cmd_id = { + SceneCmdId.SCENE_CMD_ID_SPAWN_LIST: "SCENE_CMD_SPAWN_LIST", + SceneCmdId.SCENE_CMD_ID_ACTOR_LIST: "SCENE_CMD_ACTOR_LIST", + SceneCmdId.SCENE_CMD_ID_UNUSED_2: "SCENE_CMD_UNUSED_02", + SceneCmdId.SCENE_CMD_ID_COLLISION_HEADER: "SCENE_CMD_COL_HEADER", + SceneCmdId.SCENE_CMD_ID_ROOM_LIST: "SCENE_CMD_ROOM_LIST", + SceneCmdId.SCENE_CMD_ID_WIND_SETTINGS: "SCENE_CMD_WIND_SETTINGS", + SceneCmdId.SCENE_CMD_ID_ENTRANCE_LIST: "SCENE_CMD_ENTRANCE_LIST", + SceneCmdId.SCENE_CMD_ID_SPECIAL_FILES: "SCENE_CMD_SPECIAL_FILES", + SceneCmdId.SCENE_CMD_ID_ROOM_BEHAVIOR: "SCENE_CMD_ROOM_BEHAVIOR", + SceneCmdId.SCENE_CMD_ID_UNDEFINED_9: "SCENE_CMD_UNK_09", + SceneCmdId.SCENE_CMD_ID_ROOM_SHAPE: "SCENE_CMD_ROOM_SHAPE", + SceneCmdId.SCENE_CMD_ID_OBJECT_LIST: "SCENE_CMD_OBJECT_LIST", + SceneCmdId.SCENE_CMD_ID_LIGHT_LIST: "SCENE_CMD_LIGHT_LIST", + SceneCmdId.SCENE_CMD_ID_PATH_LIST: "SCENE_CMD_PATH_LIST", + SceneCmdId.SCENE_CMD_ID_TRANSITION_ACTOR_LIST: "SCENE_CMD_TRANSITION_ACTOR_LIST", + SceneCmdId.SCENE_CMD_ID_LIGHT_SETTINGS_LIST: "SCENE_CMD_ENV_LIGHT_SETTINGS", + SceneCmdId.SCENE_CMD_ID_TIME_SETTINGS: "SCENE_CMD_TIME_SETTINGS", + SceneCmdId.SCENE_CMD_ID_SKYBOX_SETTINGS: "SCENE_CMD_SKYBOX_SETTINGS", + SceneCmdId.SCENE_CMD_ID_SKYBOX_DISABLES: "SCENE_CMD_SKYBOX_DISABLES", + SceneCmdId.SCENE_CMD_ID_EXIT_LIST: "SCENE_CMD_EXIT_LIST", + SceneCmdId.SCENE_CMD_ID_END: "SCENE_CMD_END", + SceneCmdId.SCENE_CMD_ID_SOUND_SETTINGS: "SCENE_CMD_SOUND_SETTINGS", + SceneCmdId.SCENE_CMD_ID_ECHO_SETTINGS: "SCENE_CMD_ECHO_SETTINGS", + SceneCmdId.SCENE_CMD_ID_CUTSCENE_DATA: "SCENE_CMD_CUTSCENE_DATA", + SceneCmdId.SCENE_CMD_ID_ALTERNATE_HEADER_LIST: "SCENE_CMD_ALTERNATE_HEADER_LIST", + SceneCmdId.SCENE_CMD_ID_MISC_SETTINGS: "SCENE_CMD_MISC_SETTINGS", +} + + +class SceneCommandsResource(Resource, can_size_be_unknown=True): + def __init__(self, file: File, range_start: int, name: str): + super().__init__(file, range_start, None, name) + self.parsed_commands: set[SceneCmdId] = set() + self.player_entry_list_length = None + self.room_list_length = None + self.exit_list_length = None + + def try_parse_data(self, memory_context: "MemoryContext"): + data = self.file.data[self.range_start :] + + new_progress_done = [] + waiting_for = [] + + offset = 0 + cmd_id = None + end_offset = None + + found_commands: set[SceneCmdId] = set() + + while offset + 8 <= len(data): + (cmd_id_int, data1, pad2, data2_I) = struct.unpack_from( + ">BBHI", data, offset + ) + (_, data2_H0, data2_H1) = struct.unpack_from(">IHH", data, offset) + (_, data2_B0, data2_B1, data2_B2, data2_B3) = struct.unpack_from( + ">IBBBB", data, offset + ) + + offset += 8 + cmd_id = SceneCmdId(cmd_id_int) + assert pad2 == 0 + + found_commands.add(cmd_id) + + if cmd_id == SceneCmdId.SCENE_CMD_ID_END: + assert data1 == 0 + assert data2_I == 0 + end_offset = offset + self.parsed_commands.add(cmd_id) + break + + if cmd_id in self.parsed_commands: + continue + + if cmd_id == SceneCmdId.SCENE_CMD_ID_ACTOR_LIST: + resource = memory_context.report_resource_at_segmented( + self, + data2_I, + scene_rooms_resources.ActorEntryListResource, + lambda file, offset: scene_rooms_resources.ActorEntryListResource( + file, offset, f"{self.name}_{data2_I:08X}_ActorEntryList" + ), + ) + resource.set_length(data1) + self.parsed_commands.add(cmd_id) + new_progress_done.append(("reported ActorEntryListResource", cmd_id)) + + if cmd_id == SceneCmdId.SCENE_CMD_ID_OBJECT_LIST: + resource = memory_context.report_resource_at_segmented( + self, + data2_I, + scene_rooms_resources.ObjectListResource, + lambda file, offset: scene_rooms_resources.ObjectListResource( + file, offset, f"{self.name}_{data2_I:08X}_ObjectList" + ), + ) + resource.set_length(data1) + self.parsed_commands.add(cmd_id) + new_progress_done.append(("reported ObjectListResource", cmd_id)) + + if cmd_id == SceneCmdId.SCENE_CMD_ID_ROOM_SHAPE: + room_shape_resources.report_room_shape_at_segmented( + self, memory_context, data2_I, self.name + ) + self.parsed_commands.add(cmd_id) + new_progress_done.append(("reported room shape resource", cmd_id)) + + if cmd_id == SceneCmdId.SCENE_CMD_ID_ROOM_LIST: + self.room_list_length = data1 + resource = memory_context.report_resource_at_segmented( + self, + data2_I, + scene_rooms_resources.RoomListResource, + lambda file, offset: scene_rooms_resources.RoomListResource( + file, offset, f"{self.name}_{data2_I:08X}_RoomList" + ), + ) + resource.set_length(data1) + self.parsed_commands.add(cmd_id) + new_progress_done.append(("reported RoomListResource", cmd_id)) + + if cmd_id == SceneCmdId.SCENE_CMD_ID_COLLISION_HEADER: + assert data1 == 0 + resource = memory_context.report_resource_at_segmented( + self, + data2_I, + collision_resources.CollisionResource, + lambda file, offset: collision_resources.CollisionResource( + file, offset, f"{self.name}_{data2_I:08X}_Col" + ), + ) + new_progress_done.append(("reported CollisionResource", cmd_id)) + if resource.is_data_parsed: + self.exit_list_length = resource.length_exitList + self.parsed_commands.add(cmd_id) + new_progress_done.append( + ("set self.exit_list_length from CollisionResource", cmd_id) + ) + else: + waiting_for.append( + ( + "CollisionResource to be parsed to set self.exit_list_length", + cmd_id, + resource, + ) + ) + + if cmd_id == SceneCmdId.SCENE_CMD_ID_ENTRANCE_LIST: + assert data1 == 0 + resource = memory_context.report_resource_at_segmented( + self, + data2_I, + scene_rooms_resources.SpawnListResource, + lambda file, offset: scene_rooms_resources.SpawnListResource( + file, offset, f"{self.name}_{data2_I:08X}_SpawnList" + ), + ) + new_progress_done.append(("reported SpawnListResource", cmd_id)) + if ( + self.player_entry_list_length is not None + and self.room_list_length is not None + ): + resource.player_entry_list_length = self.player_entry_list_length + resource.room_list_length = self.room_list_length + self.parsed_commands.add(cmd_id) + new_progress_done.append( + ("passed lengths to SpawnListResource", cmd_id) + ) + else: + waiting_for.append( + ( + "self.player_entry_list_length and self.room_list_length" + " to pass to SpawnListResource", + cmd_id, + ) + ) + + if cmd_id == SceneCmdId.SCENE_CMD_ID_SPAWN_LIST: + self.player_entry_list_length = data1 + resource = memory_context.report_resource_at_segmented( + self, + data2_I, + scene_rooms_resources.ActorEntryListResource, + lambda file, offset: scene_rooms_resources.ActorEntryListResource( + file, offset, f"{self.name}_{data2_I:08X}_PlayerEntryList" + ), + ) + resource.set_length(data1) + self.parsed_commands.add(cmd_id) + new_progress_done.append(("reported ActorEntryListResource", cmd_id)) + + if cmd_id == SceneCmdId.SCENE_CMD_ID_EXIT_LIST: + # TODO length from collision + assert data1 == 0 + resource = memory_context.report_resource_at_segmented( + self, + data2_I, + scene_rooms_resources.ExitListResource, + lambda file, offset: scene_rooms_resources.ExitListResource( + file, offset, f"{self.name}_{data2_I:08X}_ExitList" + ), + ) + new_progress_done.append(("reported ExitListResource", cmd_id)) + if self.exit_list_length is not None: + # TODO this doesnt work very well, eg need to trim to avoid overlaps + length = self.exit_list_length + # blindly align length to 2 (could/should check for zeros) + length = max(2, (length + 1) // 2 * 2) + # trim based on overlaps + while True: + _, other_resource = resource.file.get_resource_at( + resource.range_start + + length * resource.elem_cdata_ext.size + - 1 + ) + if other_resource is resource: + break + length -= 2 + assert length > 0 + resource.set_length(length) + self.parsed_commands.add(cmd_id) + new_progress_done.append( + ("passed length to ExitListResource", cmd_id, resource) + ) + else: + waiting_for.append( + ( + "self.exit_list_length to (guess a length to) pass to ExitListResource", + cmd_id, + ) + ) + + if cmd_id == SceneCmdId.SCENE_CMD_ID_LIGHT_SETTINGS_LIST: + resource = memory_context.report_resource_at_segmented( + self, + data2_I, + scene_rooms_resources.EnvLightSettingsListResource, + lambda file, offset: scene_rooms_resources.EnvLightSettingsListResource( + file, offset, f"{self.name}_{data2_I:08X}_EnvLightSettingsList" + ), + ) + resource.set_length(data1) + self.parsed_commands.add(cmd_id) + new_progress_done.append( + ("reported EnvLightSettingsListResource", cmd_id) + ) + + if cmd_id == SceneCmdId.SCENE_CMD_ID_TRANSITION_ACTOR_LIST: + resource = memory_context.report_resource_at_segmented( + self, + data2_I, + scene_rooms_resources.TransitionActorEntryListResource, + lambda file, offset: scene_rooms_resources.TransitionActorEntryListResource( + file, + offset, + f"{self.name}_{data2_I:08X}_TransitionActorEntryList", + ), + ) + resource.set_length(data1) + self.parsed_commands.add(cmd_id) + new_progress_done.append( + ("reported TransitionActorEntryListResource", cmd_id) + ) + + if cmd_id == SceneCmdId.SCENE_CMD_ID_PATH_LIST: + assert data1 == 0 + memory_context.report_resource_at_segmented( + self, + data2_I, + scene_rooms_resources.PathListResource, + lambda file, offset: scene_rooms_resources.PathListResource( + file, offset, f"{self.name}_{data2_I:08X}_PathList" + ), + ) + self.parsed_commands.add(cmd_id) + new_progress_done.append(("reported PathListResource", cmd_id)) + + if cmd_id == SceneCmdId.SCENE_CMD_ID_ALTERNATE_HEADER_LIST: + assert data1 == 0 + memory_context.report_resource_at_segmented( + self, + data2_I, + AltHeadersResource, + lambda file, offset: AltHeadersResource( + file, offset, f"{self.name}_{data2_I:08X}_AltHeaders" + ), + ) + self.parsed_commands.add(cmd_id) + new_progress_done.append(("reported AltHeadersResource", cmd_id)) + + if cmd_id == SceneCmdId.SCENE_CMD_ID_CUTSCENE_DATA: + assert data1 == 0 + memory_context.report_resource_at_segmented( + self, + data2_I, + misc_resources.CutsceneResource, + lambda file, offset: misc_resources.CutsceneResource( + file, offset, f"{self.name}_{data2_I:08X}_Cs" + ), + ) + self.parsed_commands.add(cmd_id) + new_progress_done.append(("reported CutsceneResource", cmd_id)) + + if cmd_id != SceneCmdId.SCENE_CMD_ID_END: + raise Exception("reached end of data without encountering end marker") + assert end_offset is not None + + # Nothing to parse for these commands + found_commands.discard(SceneCmdId.SCENE_CMD_ID_SOUND_SETTINGS) + found_commands.discard(SceneCmdId.SCENE_CMD_ID_MISC_SETTINGS) + found_commands.discard(SceneCmdId.SCENE_CMD_ID_SPECIAL_FILES) + found_commands.discard(SceneCmdId.SCENE_CMD_ID_SKYBOX_SETTINGS) + found_commands.discard(SceneCmdId.SCENE_CMD_ID_TIME_SETTINGS) + found_commands.discard(SceneCmdId.SCENE_CMD_ID_ROOM_BEHAVIOR) + found_commands.discard(SceneCmdId.SCENE_CMD_ID_ECHO_SETTINGS) + found_commands.discard(SceneCmdId.SCENE_CMD_ID_SKYBOX_DISABLES) + found_commands.discard(SceneCmdId.SCENE_CMD_ID_UNDEFINED_9) + found_commands.discard(SceneCmdId.SCENE_CMD_ID_WIND_SETTINGS) + + self.range_end = self.range_start + end_offset + assert self.parsed_commands.issubset(found_commands) + + if found_commands - self.parsed_commands: + if VERBOSE_NOT_FULLY_PARSED_SCENECMD: + print( + "NOT FULLY PARSED:", + self, + "Found commands:", + found_commands, + "Parsed commands:", + self.parsed_commands, + "FOUND BUT NOT PARSED:", + found_commands - self.parsed_commands, + ) + + if waiting_for: + if new_progress_done: + raise ResourceParseInProgress( + new_progress_done=new_progress_done, waiting_for=waiting_for + ) + else: + raise ResourceParseWaiting(waiting_for=waiting_for) + + assert self.parsed_commands == found_commands + return RESOURCE_PARSE_SUCCESS + + def get_c_declaration_base(self): + return f"SceneCmd {self.symbol_name}[]" + + def write_extracted(self, memory_context): + data = self.file.data[self.range_start : self.range_end] + with self.extract_to_path.open("w") as f: + if not self.braces_in_source: + f.write("{\n") + for offset in range(0, len(data), 8): + (cmd_id_int, data1, pad2, data2_I) = struct.unpack_from( + ">BBHI", data, offset + ) + (_, data2_H0, data2_H1) = struct.unpack_from(">IHH", data, offset) + (_, data2_B0, data2_B1, data2_B2, data2_B3) = struct.unpack_from( + ">IBBBB", data, offset + ) + cmd_id = SceneCmdId(cmd_id_int) + f.write(" " * 4) + f.write(scene_cmd_macro_name_by_cmd_id[cmd_id]) + f.write("(") + if cmd_id == SceneCmdId.SCENE_CMD_ID_SPAWN_LIST: + address = data2_I + f.write( + memory_context.get_c_expression_length_at_segmented(address) + ) + f.write(", ") + f.write(memory_context.get_c_reference_at_segmented(address)) + if cmd_id == SceneCmdId.SCENE_CMD_ID_ACTOR_LIST: + address = data2_I + f.write( + memory_context.get_c_expression_length_at_segmented(address) + ) + f.write(", ") + f.write(memory_context.get_c_reference_at_segmented(address)) + if cmd_id == SceneCmdId.SCENE_CMD_ID_UNUSED_2: + raise NotImplementedError(cmd_id) + if cmd_id == SceneCmdId.SCENE_CMD_ID_COLLISION_HEADER: + assert data1 == 0 + address = data2_I + f.write(memory_context.get_c_reference_at_segmented(address)) + if cmd_id == SceneCmdId.SCENE_CMD_ID_ROOM_LIST: + address = data2_I + f.write( + memory_context.get_c_expression_length_at_segmented(address) + ) + f.write(", ") + f.write(memory_context.get_c_reference_at_segmented(address)) + if cmd_id == SceneCmdId.SCENE_CMD_ID_WIND_SETTINGS: + assert data1 == 0 + # TODO cast x,y,z to s8 + xDir = data2_B0 + yDir = data2_B1 + zDir = data2_B2 + strength = data2_B3 + f.write(f"{xDir}, {yDir}, {zDir}, {strength}") + if cmd_id == SceneCmdId.SCENE_CMD_ID_ENTRANCE_LIST: + assert data1 == 0 + address = data2_I + f.write(memory_context.get_c_reference_at_segmented(address)) + if cmd_id == SceneCmdId.SCENE_CMD_ID_SPECIAL_FILES: + naviQuestHintFileId = data1 + keepObjectId = data2_I + f.write( + f"{oot64_data.get_navi_quest_hint_file_id_name(naviQuestHintFileId)}, " + f"{oot64_data.get_object_id_name(keepObjectId)}" + ) + if cmd_id == SceneCmdId.SCENE_CMD_ID_ROOM_BEHAVIOR: + gpFlags1 = data1 + gpFlags2 = data2_I + behaviorType1 = gpFlags1 + behaviorType2 = _SHIFTR(gpFlags2, 0, 8) + lensMode = _SHIFTR(gpFlags2, 8, 1) + disableWarpSongs = _SHIFTR(gpFlags2, 10, 1) + behaviorType1_name = oot64_data.get_room_behavior_type1_name( + behaviorType1 + ) + behaviorType2_name = oot64_data.get_room_behavior_type2_name( + behaviorType2 + ) + lensMode_name = oot64_data.get_lens_mode_name(lensMode) + disableWarpSongs_name = ( + "true /* no warp songs */" + if disableWarpSongs + else "false /* warp songs enabled */" + ) + f.write( + f"{behaviorType1_name}, {behaviorType2_name}, {lensMode_name}, {disableWarpSongs_name}" + ) + if cmd_id == SceneCmdId.SCENE_CMD_ID_UNDEFINED_9: + assert data1 == 0 + assert data2_I == 0 + if cmd_id == SceneCmdId.SCENE_CMD_ID_ROOM_SHAPE: + assert data1 == 0 # TODO these asserts should be done on parse? + address = data2_I + f.write(memory_context.get_c_reference_at_segmented(address)) + if cmd_id == SceneCmdId.SCENE_CMD_ID_OBJECT_LIST: + address = data2_I + f.write( + memory_context.get_c_expression_length_at_segmented(address) + ) + f.write(", ") + f.write(memory_context.get_c_reference_at_segmented(address)) + if cmd_id == SceneCmdId.SCENE_CMD_ID_LIGHT_LIST: + raise NotImplementedError(cmd_id) + if cmd_id == SceneCmdId.SCENE_CMD_ID_PATH_LIST: + assert data1 == 0 + address = data2_I + f.write(memory_context.get_c_reference_at_segmented(address)) + if cmd_id == SceneCmdId.SCENE_CMD_ID_TRANSITION_ACTOR_LIST: + address = data2_I + f.write( + memory_context.get_c_expression_length_at_segmented(address) + ) + f.write(", ") + f.write(memory_context.get_c_reference_at_segmented(address)) + if cmd_id == SceneCmdId.SCENE_CMD_ID_LIGHT_SETTINGS_LIST: + address = data2_I + f.write( + memory_context.get_c_expression_length_at_segmented(address) + ) + f.write(", ") + f.write(memory_context.get_c_reference_at_segmented(address)) + if cmd_id == SceneCmdId.SCENE_CMD_ID_TIME_SETTINGS: + assert data1 == 0 + hour = data2_B0 + min_ = data2_B1 + timeSpeed = data2_B2 + assert data2_B3 == 0 + + hour_str = "0xFF" if hour == 0xFF else str(hour) + min_str = "0xFF" if min_ == 0xFF else str(min_) + timeSpeed_str = "0xFF" if timeSpeed == 0xFF else str(timeSpeed) + + if hour == 0xFF or min_ == 0xFF: + f.write("/* don't set time */ ") + f.write(f"{hour_str}, {min_str}, {timeSpeed_str}") + if timeSpeed == 0xFF or timeSpeed == 0: + f.write(" /* time doesn't move */") + if cmd_id == SceneCmdId.SCENE_CMD_ID_SKYBOX_SETTINGS: + assert data1 == 0 + skyboxId = data2_B0 + skyboxConfig = data2_B1 + envLightMode = data2_B2 + assert data2_B3 == 0 + f.write( + f"{oot64_data.get_skybox_id(skyboxId)}, " + f"{skyboxConfig}, " + f"{oot64_data.get_light_mode(envLightMode)}" + ) + if cmd_id == SceneCmdId.SCENE_CMD_ID_SKYBOX_DISABLES: + assert data1 == 0 + skyboxDisabled = data2_B0 + sunMoonDisabled = data2_B1 + assert data2_B2 == data2_B3 == 0 + skyboxDisabled_name = ( + "true /* no skybox */" + if skyboxDisabled + else "false /* skybox enabled */" + ) + sunMoonDisabled_name = ( + "true /* no sun/moon */" + if sunMoonDisabled + else "false /* sun/moon enabled */" + ) + f.write(f"{skyboxDisabled_name}, {sunMoonDisabled_name}") + if cmd_id == SceneCmdId.SCENE_CMD_ID_EXIT_LIST: + assert data1 == 0 + address = data2_I + f.write(memory_context.get_c_reference_at_segmented(address)) + if cmd_id == SceneCmdId.SCENE_CMD_ID_END: + assert data1 == 0 + assert data2_I == 0 + if cmd_id == SceneCmdId.SCENE_CMD_ID_SOUND_SETTINGS: + specId = data1 + assert data2_B0 == 0 + assert data2_B1 == 0 + natureAmbienceId = data2_B2 + seqId = data2_B3 + natureAmbienceId_name = oot64_data.get_nature_ambience_id_name( + natureAmbienceId + ) + seqId_name = oot64_data.get_sequence_id_name(seqId) + f.write(f"{specId}, {natureAmbienceId_name}, {seqId_name}") + if cmd_id == SceneCmdId.SCENE_CMD_ID_ECHO_SETTINGS: + assert data1 == 0 + assert data2_B0 == data2_B1 == data2_B2 == 0 + echo = data2_B3 + f.write(f"{echo}") + if cmd_id == SceneCmdId.SCENE_CMD_ID_CUTSCENE_DATA: + assert data1 == 0 + address = data2_I + f.write(memory_context.get_c_reference_at_segmented(address)) + if cmd_id == SceneCmdId.SCENE_CMD_ID_ALTERNATE_HEADER_LIST: + assert data1 == 0 + address = data2_I + f.write(memory_context.get_c_reference_at_segmented(address)) + if cmd_id == SceneCmdId.SCENE_CMD_ID_MISC_SETTINGS: + sceneCamType = data1 + worldMapLocation = data2_I + sceneCamType_name = oot64_data.get_scene_cam_type_name(sceneCamType) + f.write(f"{sceneCamType_name}, {worldMapLocation}") + + f.write("),\n") + + if not self.braces_in_source: + f.write("}\n") + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return self.symbol_name + else: + raise ValueError + + def get_c_includes(self): + return ( + "array_count.h", + "z64object.h", # for OBJECT_* + # TODO these are not always needed: + "sequence.h", # for NATURE_ID_* and NA_BGM_* + "z64skybox.h", # for SKYBOX_* + ) + + def get_h_includes(self): + return ("z64scene.h",) + + +class AltHeadersResource(CDataArrayResource): + def report_elem(resource, memory_context: "MemoryContext", v): + assert isinstance(v, int) + address = v + if address != 0: + memory_context.report_resource_at_segmented( + resource, + address, + SceneCommandsResource, + lambda file, offset: SceneCommandsResource( + file, offset, f"{resource.name}_{address:08X}_Cmds" + ), + ) + + def write_elem( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + assert isinstance(v, int) + address = v + wctx.f.write(wctx.line_prefix) + if address == 0: + wctx.f.write("NULL") + else: + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + return True + + elem_cdata_ext = ( + CDataExt_Value("I").set_report(report_elem).set_write(write_elem) + ) # SceneCmd* + + def try_parse_data(self, memory_context): + length = 0 + for i, (v,) in enumerate( + struct.iter_unpack(">I", self.file.data[self.range_start :]) + ): + if v == 0: + if i < 3: + length = i + 1 + continue + else: + break + + try: + resolve_result = memory_context.resolve_segmented(v) + except: + break + data_may_be_scenecmds = False + for j in range( + resolve_result.file_offset, len(resolve_result.file.data), 8 + ): + cmd_id_int = resolve_result.file.data[j] + try: + cmd_id = SceneCmdId(cmd_id_int) + except ValueError: + break + if cmd_id == SceneCmdId.SCENE_CMD_ID_END: + data_may_be_scenecmds = True + break + if not data_may_be_scenecmds: + break + length = i + 1 + assert length > 0 + self.set_length(length) + return super().try_parse_data(memory_context) + + def get_c_declaration_base(self): + return f"SceneCmd* {self.symbol_name}[]" + + def get_h_includes(self): + return ("z64scene.h",) diff --git a/tools/assets/extract/extase_oot64/scene_rooms_resources.py b/tools/assets/extract/extase_oot64/scene_rooms_resources.py new file mode 100644 index 0000000000..86baae7ae0 --- /dev/null +++ b/tools/assets/extract/extase_oot64/scene_rooms_resources.py @@ -0,0 +1,457 @@ +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ..extase.memorymap import MemoryContext + +from ..extase import ( + ResourceParseWaiting, +) + +from ..extase.cdata_resources import ( + CDataArrayResource, + CDataArrayNamedLengthResource, + CDataExt_Struct, + CDataExt_Array, + CDataExt_Value, + CDataExtWriteContext, + cdata_ext_Vec3s, + INDENT, + Vec3sArrayResource, + fmt_hex_s, +) + +from .. import oot64_data + + +VERBOSE_SPAWN_LIST_LENGTH_GUESSING = False + + +class ActorEntryListResource(CDataArrayNamedLengthResource): + def write_elem(resource, memory_context, v, wctx: CDataExtWriteContext): + assert isinstance(v, dict) + f = wctx.f + f.write(wctx.line_prefix) + f.write("{\n") + + f.write(wctx.line_prefix + INDENT) + f.write(oot64_data.get_actor_id_name(v["id"])) + f.write(",\n") + + f.write(wctx.line_prefix + INDENT) + f.write("{ ") + f.write(", ".join(f"{p:6}" for p in (v["pos"][axis] for axis in "xyz"))) + f.write(" }, // pos\n") + + f.write(wctx.line_prefix + INDENT) + f.write("{ ") + f.write(", ".join(fmt_hex_s(r, 4) for r in (v["rot"][axis] for axis in "xyz"))) + f.write(" }, // rot\n") + + f.write(wctx.line_prefix + INDENT) + params = v["params"] + f.write(fmt_hex_s(params, 4)) + if params < 0: + params_u16 = params + 0x1_0000 + f.write(f" /* 0x{params_u16:04X} */") + f.write(", // params\n") + + f.write(wctx.line_prefix) + f.write("}") + + return True + + elem_cdata_ext = CDataExt_Struct( + ( + ("id", CDataExt_Value.s16), + ("pos", cdata_ext_Vec3s), + ("rot", cdata_ext_Vec3s), + ("params", CDataExt_Value.s16), + ) + ).set_write(write_elem) + + def get_c_declaration_base(self): + return f"ActorEntry {self.symbol_name}[{self.length_name}]" + + def get_c_includes(self): + return ("z64actor.h",) + + def get_h_includes(self): + return ("z64scene.h",) + + +class ObjectListResource(CDataArrayNamedLengthResource): + elem_cdata_ext = CDataExt_Value("h").set_write_str_v( + lambda v: oot64_data.get_object_id_name(v) + ) + + def get_c_declaration_base(self): + return f"s16 {self.symbol_name}[{self.length_name}]" + + def get_c_includes(self): + return ("z64object.h",) + + def get_h_includes(self): + return ("ultra64.h",) + + +def write_RomFile( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext +): + assert isinstance(v, dict) + vromStart = v["vromStart"] + vromEnd = v["vromEnd"] + rom_file_name = memory_context.get_dmadata_table_rom_file_name_from_vrom( + vromStart, vromEnd + ) + wctx.f.write(wctx.line_prefix) + wctx.f.write(f"ROM_FILE({rom_file_name})") + return True + + +cdata_ext_RomFile = CDataExt_Struct( + ( + ("vromStart", CDataExt_Value.u32), + ("vromEnd", CDataExt_Value.u32), + ) +).set_write(write_RomFile) + + +class RoomListResource(CDataArrayNamedLengthResource): + elem_cdata_ext = cdata_ext_RomFile + + def get_c_declaration_base(self): + return f"RomFile {self.symbol_name}[{self.length_name}]" + + def get_c_includes(self): + # TODO use DECLARE_ROM_SEGMENT to declare rooms rom files + return ("segment_symbols.h",) + + def get_h_includes(self): + return ("romfile.h",) + + +class SpawnListResource(CDataArrayResource): + elem_cdata_ext = CDataExt_Struct( + ( + ("playerEntryIndex", CDataExt_Value.u8), + ("room", CDataExt_Value.u8), + ) + ) + + # (eventually) set by SceneCommandsResource + player_entry_list_length = None + room_list_length = None + + def try_parse_data(self, memory_context): + if self.player_entry_list_length is None or self.room_list_length is None: + raise ResourceParseWaiting( + waiting_for=[ + msg + for is_waiting, msg in ( + ( + self.player_entry_list_length is None, + "self.player_entry_list_length", + ), + ( + self.room_list_length is None, + "self.room_list_length", + ), + ) + if is_waiting + ] + ) + + # File.name comes from the Name attribute on a element, + # which is also used to make the path to the baserom file to read from. + # So File.name is the name of the baserom file. + # This may change in the future though ¯\_(ツ)_/¯ + rom_file_name = self.file.name + # This way we can get the scene ID of the file + scene_id = oot64_data.get_scene_id_from_rom_file_name(rom_file_name) + scene_id_name = oot64_data.get_scene_id_name(scene_id) + # Get all the spawns used by all entrances using the scene + entrance_ids = oot64_data.get_entrance_ids_from_scene_id_name(scene_id_name) + all_used_spawns = set() + for entrance_id in entrance_ids: + entrance_spawn = oot64_data.get_entrance_spawn(entrance_id) + all_used_spawns.add(entrance_spawn) + num_spawns = max(all_used_spawns) + 1 + + # Handle the cases where the entrance table references spawn outside the spawn list, + # by checking if the indices in the last spawn in the list make sense. + # This is required for a few scenes in practice, otherwise the spawn list and exit list overlap. + while True: + last_spawn_unpacked = self.elem_cdata_ext.unpack_from( + self.file.data, + self.range_start + (num_spawns - 1) * self.elem_cdata_ext.size, + ) + if ( + last_spawn_unpacked["playerEntryIndex"] < self.player_entry_list_length + and last_spawn_unpacked["room"] < self.room_list_length + ): + break + if VERBOSE_SPAWN_LIST_LENGTH_GUESSING: + print( + self, + "Removing one spawn because the last spawn of the list has bad indices", + last_spawn_unpacked, + num_spawns, + "->", + num_spawns - 1, + ) + num_spawns -= 1 + assert num_spawns > 0 + + # Handle the case where there may be an unused spawn, in the place of + # what would otherwise be padding. + if oot64_data.I_D_OMEGALUL: + assert self.elem_cdata_ext.size == 2 + if num_spawns % 2 == 1: + data_to_next_4align = self.file.data[ + self.range_start + num_spawns * 2 : + ][:2] + if data_to_next_4align != b"\x00\x00": + if VERBOSE_SPAWN_LIST_LENGTH_GUESSING: + print( + self, + "Adding one spawn because the next supposedly-padding" + " two bytes are not padding (not zero)", + bytes(data_to_next_4align), + num_spawns, + "->", + num_spawns + 1, + ) + num_spawns += 1 + + # Trim the list to avoid overlaps + # TODO this may be linked to headers for cutscene layers not having the spawns the entrance table expects + # for example spot00 hyrule field seems to always have a single 0,0 spawn for cutscene layers? + # (so the above approach using the entrance table does not generalize to cutscene layers) + # so it may be relevant to have the layer type when parsing the spawn list + # Alternatively, somehow trim the variable-length resources when overlapping + while True: + range_end = self.range_start + num_spawns * self.elem_cdata_ext.size + result, resource = self.file.get_resource_at(range_end - 1) + if resource is self: + break + if VERBOSE_SPAWN_LIST_LENGTH_GUESSING: + print( + self, + "Removing one spawn because the last spawn of the list overlaps with another resource", + resource, + num_spawns, + "->", + num_spawns - 1, + ) + num_spawns -= 1 + assert num_spawns > 0 + + self.set_length(num_spawns) + return super().try_parse_data(memory_context) + + def get_c_declaration_base(self): + return f"Spawn {self.symbol_name}[]" + + def get_h_includes(self): + return ("z64scene.h",) + + +class ExitListResource(CDataArrayResource): + elem_cdata_ext = CDataExt_Value("h").set_write_str_v( + lambda v: oot64_data.get_entrance_id_name(v) + ) + + # length set by SceneCommandsResource.try_parse_data + + def get_c_declaration_base(self): + return f"s16 {self.symbol_name}[]" + + def get_h_includes(self): + return ("ultra64.h",) + + +class EnvLightSettingsListResource(CDataArrayNamedLengthResource): + + def write_color(resource, memory_context, v, wctx: CDataExtWriteContext): + assert not wctx.inhibit_top_braces + wctx.f.write(wctx.line_prefix) + wctx.f.write("{ " + f"{v[0]:3}, {v[1]:3}, {v[2]:3}" + " }") + return True + + color_cdata_ext = CDataExt_Array(CDataExt_Value.u8, 3).set_write(write_color) + + def write_dir(resource, memory_context, v, wctx: CDataExtWriteContext): + assert not wctx.inhibit_top_braces + wctx.f.write(wctx.line_prefix) + wctx.f.write("{ " + f"{v[0]:4}, {v[1]:4}, {v[2]:4}" + " }") + return True + + dir_cdata_ext = CDataExt_Array(CDataExt_Value.s8, 3).set_write(write_dir) + + def write_blendRateAndFogNear(v): + blendRate = (v >> 10) * 4 + fogNear = v & 0x3FF + return f"(({blendRate} / 4) << 10) | {fogNear}" + + elem_cdata_ext = CDataExt_Struct( + ( + ("ambientColor", color_cdata_ext), + ("light1Dir", dir_cdata_ext), + ("light1Color", color_cdata_ext), + ("light2Dir", dir_cdata_ext), + ("light2Color", color_cdata_ext), + ("fogColor", color_cdata_ext), + ( + "blendRateAndFogNear", + CDataExt_Value("h").set_write_str_v(write_blendRateAndFogNear), + ), + ("zFar", CDataExt_Value.s16), + ) + ) + + def get_c_declaration_base(self): + return f"EnvLightSettings {self.symbol_name}[{self.length_name}]" + + def get_h_includes(self): + return ("z64environment.h",) + + +class TransitionActorEntryListResource(CDataArrayNamedLengthResource): + def write_elem(resource, memory_context, v, wctx: CDataExtWriteContext): + assert isinstance(v, dict) + f = wctx.f + f.write(wctx.line_prefix) + f.write("{\n") + + f.write(wctx.line_prefix + INDENT) + f.write("{\n") + f.write(wctx.line_prefix + 2 * INDENT) + f.write("// { room, bgCamIndex }\n") + for side_i in range(2): + side = v["sides"][side_i] + room = side["room"] + bgCamIndex = side["bgCamIndex"] + f.write(wctx.line_prefix + 2 * INDENT) + f.write("{ ") + f.write(f"{room}, {bgCamIndex}") + f.write(" },\n") + f.write(wctx.line_prefix + INDENT) + f.write("}, // sides\n") + + f.write(wctx.line_prefix + INDENT) + f.write(oot64_data.get_actor_id_name(v["id"])) + f.write(",\n") + + f.write(wctx.line_prefix + INDENT) + f.write("{ ") + f.write(", ".join(f"{p:6}" for p in (v["pos"][axis] for axis in "xyz"))) + f.write(" }, // pos\n") + + f.write(wctx.line_prefix + INDENT) + f.write(fmt_hex_s(v["rotY"], 4)) + f.write(", // rotY\n") + + f.write(wctx.line_prefix + INDENT) + params = v["params"] + f.write(fmt_hex_s(params, 4)) + if params < 0: + params_u16 = params + 0x1_0000 + f.write(f" /* 0x{params_u16:04X} */") + f.write(", // params\n") + + f.write(wctx.line_prefix) + f.write("}") + + return True + + elem_cdata_ext = CDataExt_Struct( + ( + ( + "sides", + CDataExt_Array( + CDataExt_Struct( + ( + ("room", CDataExt_Value.s8), + ("bgCamIndex", CDataExt_Value.s8), + ) + ), + 2, + ), + ), + ("id", CDataExt_Value.s16), + ("pos", cdata_ext_Vec3s), + ("rotY", CDataExt_Value.s16), + ("params", CDataExt_Value.s16), + ) + ).set_write(write_elem) + + def get_c_declaration_base(self): + return f"TransitionActorEntry {self.symbol_name}[{self.length_name}]" + + def get_c_includes(self): + return ("z64actor.h",) + + def get_h_includes(self): + return ("z64scene.h",) + + +class PathListResource(CDataArrayResource): + def report_elem(resource, memory_context: "MemoryContext", v): + assert isinstance(v, dict) + count = v["count"] + assert isinstance(count, int) + points = v["points"] + assert isinstance(points, int) + memory_context.report_resource_at_segmented( + resource, + points, + Vec3sArrayResource, + lambda file, offset: Vec3sArrayResource( + file, offset, f"{resource.name}_{points:08X}_Points", count + ), + ) + + def write_elem( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + assert isinstance(v, dict) + count = v["count"] + assert isinstance(count, int) + points = v["points"] + assert isinstance(points, int) + f = wctx.f + f.write(wctx.line_prefix) + f.write("{ ") + f.write(memory_context.get_c_expression_length_at_segmented(points)) + f.write(", ") + f.write(memory_context.get_c_reference_at_segmented(points)) + f.write(" }") + return True + + elem_cdata_ext = ( + CDataExt_Struct( + ( + ("count", CDataExt_Value.u8), + ("pad1", CDataExt_Value.pad8), + ("pad2", CDataExt_Value.pad16), + ("points", CDataExt_Value("I")), # Vec3s* + ) + ) + .set_report(report_elem) + .set_write(write_elem) + ) + + def try_parse_data(self, memory_context): + if self._length is None: + # TODO guess + self.set_length(1) + return super().try_parse_data(memory_context) + + def get_c_declaration_base(self): + return f"Path {self.symbol_name}[]" + + def get_h_includes(self): + return ("z64path.h",) diff --git a/tools/assets/extract/extase_oot64/skelanime_legacy_resources.py b/tools/assets/extract/extase_oot64/skelanime_legacy_resources.py new file mode 100644 index 0000000000..056e49762b --- /dev/null +++ b/tools/assets/extract/extase_oot64/skelanime_legacy_resources.py @@ -0,0 +1,218 @@ +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +from typing import TYPE_CHECKING + +from ..extase import RESOURCE_PARSE_SUCCESS + +if TYPE_CHECKING: + from ..extase.memorymap import MemoryContext + +from ..extase.cdata_resources import ( + CDataResource, + CDataArrayResource, + CDataExt_Struct, + CDataExtWriteContext, + cdata_ext_Vec3f, + cdata_ext_Vec3s, + CDataExt_Value, +) + +from . import animation_resources +from . import dlist_resources +from . import skeleton_resources + + +class LegacyLimbResource(CDataResource): + + def report_limb(resource, memory_context: "MemoryContext", v): + assert isinstance(v, int) + address = v + if address != 0: + memory_context.report_resource_at_segmented( + resource, + address, + LegacyLimbResource, + lambda file, offset: LegacyLimbResource( + file, + offset, + f"{resource.name}_{address:08X}_LegacyLimb", + ), + ) + + def write_limb( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + assert isinstance(v, int) + address = v + wctx.f.write(wctx.line_prefix) + if address == 0: + wctx.f.write("NULL") + else: + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + return True + + cdata_ext = CDataExt_Struct( + ( + ("dList", dlist_resources.cdata_ext_gfx_segmented), + ("trans", cdata_ext_Vec3f), + ("rot", cdata_ext_Vec3s), + ("pad16", CDataExt_Value.pad16), + ( + "sibling", + CDataExt_Value("I").set_report(report_limb).set_write(write_limb), + ), # LegacyLimb* + ( + "child", + CDataExt_Value("I").set_report(report_limb).set_write(write_limb), + ), # LegacyLimb* + ) + ) + + def get_c_declaration_base(self): + return f"LegacyLimb {self.symbol_name}" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return f"&{self.symbol_name}" + else: + raise ValueError() + + def get_h_includes(self): + return ("z64animation_legacy.h",) + + +class LegacyJointKeyArrayResource(CDataArrayResource): + elem_cdata_ext = CDataExt_Struct( + ( + ("xMax", CDataExt_Value.s16), + ("x", CDataExt_Value.s16), + ("yMax", CDataExt_Value.s16), + ("y", CDataExt_Value.s16), + ("zMax", CDataExt_Value.s16), + ("z", CDataExt_Value.s16), + ) + ) + + def get_c_declaration_base(self): + return f"LegacyJointKey {self.symbol_name}[]" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return f"{self.symbol_name}" + else: + raise ValueError() + + def get_h_includes(self): + return ("z64animation_legacy.h",) + + +class LegacyAnimationResource(CDataResource): + + def write_frameData( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + assert isinstance(v, int) + address = v + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + return True + + def write_jointKey( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + assert isinstance(v, int) + address = v + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + return True + + cdata_ext = CDataExt_Struct( + ( + ("frameCount", CDataExt_Value.s16), + ("limbCount", CDataExt_Value.s16), + ("frameData", CDataExt_Value("I").set_write(write_frameData)), # s16* + ( + "jointKey", + CDataExt_Value("I").set_write(write_jointKey), + ), # LegacyJointKey* + ) + ) + + def try_parse_data(self, memory_context): + super().try_parse_data(memory_context) + + address_frameData = self.cdata_unpacked["frameData"] + assert isinstance(address_frameData, int) + resource_frameData = memory_context.report_resource_at_segmented( + self, + address_frameData, + animation_resources.AnimationFrameDataResource, + lambda file, offset: animation_resources.AnimationFrameDataResource( + file, + offset, + f"{self.name}_{address_frameData:08X}_FrameData", + ), + ) + + address_jointKey = self.cdata_unpacked["jointKey"] + assert isinstance(address_jointKey, int) + resource_jointKey = memory_context.report_resource_at_segmented( + self, + address_jointKey, + LegacyJointKeyArrayResource, + lambda file, offset: LegacyJointKeyArrayResource( + file, + offset, + f"{self.name}_{address_jointKey:08X}_JointKeys", + ), + ) + resource_jointKey.set_length(self.cdata_unpacked["limbCount"] + 1) + + # The length of the frameData array is + # for now assumed to fill the space to the jointKey data, + # at the very least before subtracting the offsets check that + # the offsets belong to the same file + # TODO better idea for computing this data's size + + if not (resource_frameData.file == resource_jointKey.file): + raise NotImplementedError( + "Expected frameData and jointIndices to be in the same file", + self.cdata_unpacked, + resource_frameData.file, + resource_jointKey.file, + ) + + if resource_frameData.range_start < resource_jointKey.range_start: + resource_frameData.length = ( + resource_jointKey.range_start - resource_frameData.range_start + ) // animation_resources.AnimationFrameDataResource.elem_cdata_ext.size + else: + raise NotImplementedError( + "Expected offsets of frameData, jointKey to be in order", + self.cdata_unpacked, + hex(resource_frameData.range_start), + hex(resource_jointKey.range_start), + ) + + return RESOURCE_PARSE_SUCCESS + + def get_c_declaration_base(self): + return f"LegacyAnimationHeader {self.symbol_name}" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return f"&{self.symbol_name}" + else: + raise ValueError() + + def get_h_includes(self): + return ("z64animation_legacy.h",) + + +class LegacyLimbsArrayResource(skeleton_resources.LimbsArrayResourceABC): + limb_type = LegacyLimbResource + c_limb_type = "LegacyLimb" + + def get_h_includes(self): + return ("z64animation_legacy.h",) diff --git a/tools/assets/extract/extase_oot64/skelcurve_resources.py b/tools/assets/extract/extase_oot64/skelcurve_resources.py new file mode 100644 index 0000000000..4b140c2568 --- /dev/null +++ b/tools/assets/extract/extase_oot64/skelcurve_resources.py @@ -0,0 +1,378 @@ +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ..extase.memorymap import MemoryContext + +from ..extase import ( + File, + RESOURCE_PARSE_SUCCESS, + ResourceParseWaiting, +) +from ..extase.cdata_resources import ( + CDataResource, + CDataExt_Struct, + CDataExt_Value, + CDataExt_Array, + CDataExtWriteContext, +) + +from . import dlist_resources + + +class KnotCountsArrayResource(CDataResource, can_size_be_unknown=True): + elem_cdata_ext = CDataExt_Value.u8 + + def __init__(self, file: File, range_start: int, name: str): + super().__init__(file, range_start, name) + self.length = None + + def try_parse_data(self, memory_context: "MemoryContext"): + if self.length is not None: + self.cdata_ext = CDataExt_Array(self.elem_cdata_ext, self.length) + self.range_end = self.range_start + self.cdata_ext.size + return super().try_parse_data(memory_context) + else: + raise ResourceParseWaiting(waiting_for=["self.length"]) + + def get_c_declaration_base(self): + return f"u8 {self.symbol_name}[]" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return self.symbol_name + else: + raise ValueError() + + def get_h_includes(self): + return ("ultra64.h",) + + +class CurveInterpKnotArrayResource(CDataResource, can_size_be_unknown=True): + elem_cdata_ext = CDataExt_Struct( + ( + ("flags", CDataExt_Value.u16), + ("abscissa", CDataExt_Value.s16), + ("leftGradient", CDataExt_Value.s16), + ("rightGradient", CDataExt_Value.s16), + ("ordinate", CDataExt_Value.f32), + ) + ) + + def __init__(self, file: File, range_start: int, name: str): + super().__init__(file, range_start, name) + self.length = None + + def try_parse_data(self, memory_context: "MemoryContext"): + if self.length is not None: + self.cdata_ext = CDataExt_Array(self.elem_cdata_ext, self.length) + self.range_end = self.range_start + self.cdata_ext.size + return super().try_parse_data(memory_context) + else: + raise ResourceParseWaiting(waiting_for=["self.length"]) + + def get_c_declaration_base(self): + return f"CurveInterpKnot {self.symbol_name}[]" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return self.symbol_name + else: + raise ValueError() + + def get_h_includes(self): + return ("z64curve.h",) + + +class ConstantDataArrayResource(CDataResource, can_size_be_unknown=True): + elem_cdata_ext = CDataExt_Value.s16 + + def __init__(self, file: File, range_start: int, name: str): + super().__init__(file, range_start, name) + self.length = None + + def try_parse_data(self, memory_context: "MemoryContext"): + if self.length is not None: + self.cdata_ext = CDataExt_Array(self.elem_cdata_ext, self.length) + self.range_end = self.range_start + self.cdata_ext.size + return super().try_parse_data(memory_context) + else: + raise ResourceParseWaiting(waiting_for=["self.length"]) + + def get_c_declaration_base(self): + return f"s16 {self.symbol_name}[]" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return self.symbol_name + else: + raise ValueError() + + def get_h_includes(self): + return ("ultra64.h",) + + +class CurveAnimationHeaderResource(CDataResource): + def report_knotCounts(resource, memory_context: "MemoryContext", v): + assert isinstance(v, int) + address = v + memory_context.report_resource_at_segmented( + resource, + address, + KnotCountsArrayResource, + lambda file, offset: KnotCountsArrayResource( + file, offset, f"{resource.name}_{address:08X}_KnotCounts" + ), + ) + + def write_knotCounts( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + assert isinstance(v, int) + address = v + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + return True + + def report_interpolationData(resource, memory_context: "MemoryContext", v): + assert isinstance(v, int) + address = v + memory_context.report_resource_at_segmented( + resource, + address, + CurveInterpKnotArrayResource, + lambda file, offset: CurveInterpKnotArrayResource( + file, offset, f"{resource.name}_{address:08X}_InterpolationData" + ), + ) + + def write_interpolationData( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + assert isinstance(v, int) + address = v + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + return True + + def report_constantData(resource, memory_context: "MemoryContext", v): + assert isinstance(v, int) + address = v + memory_context.report_resource_at_segmented( + resource, + address, + ConstantDataArrayResource, + lambda file, offset: ConstantDataArrayResource( + file, offset, f"{resource.name}_{address:08X}_ConstantData" + ), + ) + + def write_constantData( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + assert isinstance(v, int) + address = v + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + return True + + cdata_ext = CDataExt_Struct( + ( + ( + "knotCounts", + CDataExt_Value("I") + .set_report(report_knotCounts) + .set_write(write_knotCounts), + ), # u8* + ( + "interpolationData", + CDataExt_Value("I") + .set_report(report_interpolationData) + .set_write(write_interpolationData), + ), # CurveInterpKnot* + ( + "constantData", + CDataExt_Value("I") + .set_report(report_constantData) + .set_write(write_constantData), + ), # s16* + ("unk_0C", CDataExt_Value.s16), + ("frameCount", CDataExt_Value.s16), + ) + ) + + def try_parse_data(self, memory_context): + super().try_parse_data(memory_context) + knotCounts = self.cdata_unpacked["knotCounts"] + interpolationData = self.cdata_unpacked["interpolationData"] + constantData = self.cdata_unpacked["constantData"] + resource_knotCounts = memory_context.resolve_segmented(knotCounts).get_resource( + KnotCountsArrayResource + ) + resource_interpolationData = memory_context.resolve_segmented( + interpolationData + ).get_resource(CurveInterpKnotArrayResource) + resource_constantData = memory_context.resolve_segmented( + constantData + ).get_resource(ConstantDataArrayResource) + if ( + resource_knotCounts.file + == resource_interpolationData.file + == resource_constantData.file + == self.file + ): + knotCounts_offset = resource_knotCounts.range_start + constantData_offset = resource_constantData.range_start + interpolationData_offset = resource_interpolationData.range_start + animHeader_offset = self.range_start + assert ( + knotCounts_offset + < constantData_offset + < interpolationData_offset + < animHeader_offset + ) + resource_knotCounts.length = ( + constantData_offset - knotCounts_offset + ) // resource_knotCounts.elem_cdata_ext.size + resource_constantData.length = ( + interpolationData_offset - constantData_offset + ) // resource_constantData.elem_cdata_ext.size + resource_interpolationData.length = ( + animHeader_offset - interpolationData_offset + ) // resource_interpolationData.elem_cdata_ext.size + + return RESOURCE_PARSE_SUCCESS + else: + raise NotImplementedError + + def get_c_declaration_base(self): + return f"CurveAnimationHeader {self.symbol_name}" + + def get_c_reference(self, resource_offset: int): + raise ValueError() + + def get_h_includes(self): + return ("z64curve.h",) + + +class SkelCurveLimbResource(CDataResource): + cdata_ext = CDataExt_Struct( + ( + ("child", CDataExt_Value.u8), + ("sibling", CDataExt_Value.u8), + ("pad2", CDataExt_Value.pad16), + ( + "dList", + CDataExt_Array( + dlist_resources.cdata_ext_gfx_segmented, # Gfx* + 2, + ), + ), + ) + ) + + def get_c_declaration_base(self): + return f"SkelCurveLimb {self.symbol_name}" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return f"&{self.symbol_name}" + else: + raise ValueError() + + def get_h_includes(self): + return ("z64curve.h",) + + +class SkelCurveLimbArrayResource(CDataResource): + def report_limb_element(resource, memory_context: "MemoryContext", v): + assert isinstance(v, int) + address = v + memory_context.report_resource_at_segmented( + resource, + address, + SkelCurveLimbResource, + lambda file, offset: SkelCurveLimbResource( + file, offset, f"{resource.name}_{address:08X}" + ), + ) + + def write_limb_element( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + assert isinstance(v, int) + address = v + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + return True + + elem_cdata_ext = ( + CDataExt_Value("I") + .set_report(report_limb_element) + .set_write(write_limb_element) + ) + + def __init__(self, file: File, range_start: int, name: str, length: int): + self.cdata_ext = CDataExt_Array(self.elem_cdata_ext, length) + super().__init__(file, range_start, name) + + def get_c_declaration_base(self): + return f"SkelCurveLimb* {self.symbol_name}[]" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return self.symbol_name + else: + raise ValueError() + + def get_h_includes(self): + return ("z64curve.h",) + + +class CurveSkeletonHeaderResource(CDataResource): + def report_limbs(resource, memory_context: "MemoryContext", v): + assert isinstance(v, int) + address = v + memory_context.report_resource_at_segmented( + resource, + address, + SkelCurveLimbArrayResource, + lambda file, offset: SkelCurveLimbArrayResource( + file, + offset, + f"{resource.name}_Limbs_", + resource.cdata_unpacked["limbCount"], + ), + ) + + def write_limbs( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + assert isinstance(v, int) + address = v + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + return True + + cdata_ext = CDataExt_Struct( + ( + ( + "limbs", + CDataExt_Value("I").set_report(report_limbs).set_write(write_limbs), + ), # SkelCurveLimb** + ("limbCount", CDataExt_Value.u8), + ("pad5", CDataExt_Value.pad8), + ("pad6", CDataExt_Value.pad16), + ) + ) + + def get_c_declaration_base(self): + return f"CurveSkeletonHeader {self.symbol_name}" + + def get_c_reference(self, resource_offset: int): + raise ValueError() + + def get_h_includes(self): + return ("z64curve.h",) diff --git a/tools/assets/extract/extase_oot64/skeleton_resources.py b/tools/assets/extract/extase_oot64/skeleton_resources.py new file mode 100644 index 0000000000..a3459d1172 --- /dev/null +++ b/tools/assets/extract/extase_oot64/skeleton_resources.py @@ -0,0 +1,356 @@ +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +import abc +from typing import TYPE_CHECKING + +from ..extase import ( + RESOURCE_PARSE_SUCCESS, + ResourceParseInProgress, + ResourceParseWaiting, +) + +if TYPE_CHECKING: + from ..extase.memorymap import MemoryContext + +from ..extase.cdata_resources import ( + CDataResource, + CDataArrayResource, + CDataExt_Value, + CDataExt_Struct, + CDataExt_Array, + CDataExtWriteContext, + cdata_ext_Vec3s, +) + +from . import dlist_resources + + +class StandardLimbResource(CDataResource): + def write_limb_index( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + assert isinstance(v, int) + f = wctx.f + f.write(wctx.line_prefix) + if resource.skeleton_resource is None: + f.write(f"{v}") + else: + f.write(f"/* {v} */ ") + if v == 0xFF: + f.write("LIMB_DONE") + else: + f.write( + resource.skeleton_resource.limbs_array_resource.limbs[ + v + ].enum_member_name + ) + f.write(" - 1") + return True + + cdata_ext = CDataExt_Struct( + ( + ("jointPos", cdata_ext_Vec3s), + ("child", CDataExt_Value("B").set_write(write_limb_index)), + ("sibling", CDataExt_Value("B").set_write(write_limb_index)), + ("dList", dlist_resources.cdata_ext_gfx_segmented), + ) + ) + + def __init__(self, file, range_start, name): + super().__init__(file, range_start, name) + self.enum_member_name = f"LIMB_{file.name.upper()}_{range_start:06X}" + self.skeleton_resource: "SkeletonResourceBaseABC | None" = None + + def set_enum_member_name(self, enum_member_name: str): + self.enum_member_name = enum_member_name + + def get_c_declaration_base(self): + return f"StandardLimb {self.symbol_name}" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return f"&{self.symbol_name}" + else: + raise ValueError() + + def get_h_includes(self): + return ("z64animation.h",) + + +class LODLimbResource(CDataResource): + cdata_ext = CDataExt_Struct( + ( + ("jointPos", cdata_ext_Vec3s), + ( + "child", + CDataExt_Value("B").set_write(StandardLimbResource.write_limb_index), + ), + ( + "sibling", + CDataExt_Value("B").set_write(StandardLimbResource.write_limb_index), + ), + ("dLists", CDataExt_Array(dlist_resources.cdata_ext_gfx_segmented, 2)), + ) + ) + + def __init__(self, file, range_start, name): + super().__init__(file, range_start, name) + self.enum_member_name = f"LIMB_{file.name.upper()}_{range_start:06X}" + + def set_enum_member_name(self, enum_member_name: str): + self.enum_member_name = enum_member_name + + def get_c_declaration_base(self): + return f"LodLimb {self.symbol_name}" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return f"&{self.symbol_name}" + else: + raise ValueError() + + def get_h_includes(self): + return ("z64animation.h",) + + +class LimbsArrayResourceABC(CDataArrayResource): + limb_type: type[CDataResource] + c_limb_type: str + + def write_limb_element( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + assert isinstance(v, int) + address = v + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + return True + + elem_cdata_ext = CDataExt_Value("I").set_write(write_limb_element) + + def __init__(self, file, range_start, name): + super().__init__(file, range_start, name) + self.limbs = None + + def try_parse_data(self, memory_context): + ret = super().try_parse_data(memory_context) + assert ret == RESOURCE_PARSE_SUCCESS + self.limbs: list[self.limb_type] = [] + for address in self.cdata_unpacked: + limb = memory_context.report_resource_at_segmented( + self, + address, + self.limb_type, + lambda file, offset: self.limb_type( + file, + offset, + f"{self.name}_{address:08X}_{self.c_limb_type}", + ), + ) + self.limbs.append(limb) + return RESOURCE_PARSE_SUCCESS + + def get_c_declaration_base(self): + return f"void* {self.symbol_name}[]" + + +class StandardLimbsArrayResource(LimbsArrayResourceABC): + limb_type = StandardLimbResource + c_limb_type = "StandardLimb" + + +class LODLimbsArrayResource(LimbsArrayResourceABC): + limb_type = LODLimbResource + c_limb_type = "LodLimb" + + +class SkeletonResourceBaseABC(CDataResource): + limbs_array_type: type[LimbsArrayResourceABC] + + def __init__(self, file, range_start, name): + super().__init__(file, range_start, name) + self.enum_name = f"{self.symbol_name}Limb" + self.enum_member_name_none = f"LIMB_{file.name.upper()}_{range_start:06X}_NONE" + self.enum_member_name_max = f"LIMB_{file.name.upper()}_{range_start:06X}_MAX" + self.limbs_array_resource = None + + def set_enum_name(self, enum_name: str): + self.enum_name = enum_name + + def set_enum_member_name_none(self, enum_member_name_none: str): + self.enum_member_name_none = enum_member_name_none + + def set_enum_member_name_max(self, enum_member_name_max: str): + self.enum_member_name_max = enum_member_name_max + + def try_parse_data(self, memory_context): + if self.limbs_array_resource is None: + ret = super().try_parse_data(memory_context) + assert ret == RESOURCE_PARSE_SUCCESS + data = self.get_skeleton_header_cdata_unpacked() + segment_resolve_result = memory_context.resolve_segmented(data["segment"]) + self.limbs_array_resource = segment_resolve_result.get_resource( + self.limbs_array_type + ) + if self.limbs_array_resource.limbs is None: + raise ResourceParseInProgress( + new_progress_done=["reported limbs array"], + waiting_for=["self.limbs_array_resource.limbs"], + ) + else: + if self.limbs_array_resource.limbs is None: + raise ResourceParseWaiting( + waiting_for=["self.limbs_array_resource.limbs"], + ) + for limb in self.limbs_array_resource.limbs: + limb.skeleton_resource = self + return RESOURCE_PARSE_SUCCESS + + def write_c_declaration(self, h): + h.write(f"typedef enum {self.enum_name} {{\n") + limb_enum_members = ( + self.enum_member_name_none, + *(limb.enum_member_name for limb in self.limbs_array_resource.limbs), + self.enum_member_name_max, + ) + h.write( + ",\n".join( + f" /* {i:2} */ {enum_member}" + for i, enum_member in enumerate(limb_enum_members) + ) + + "\n" + ) + h.write(f"}} {self.enum_name};\n") + super().write_c_declaration(h) + return True + + @abc.abstractmethod + def get_skeleton_header_cdata_unpacked(self) -> dict: ... + + +class SkeletonResourceABC(SkeletonResourceBaseABC): + + def report_segment(resource, memory_context: "MemoryContext", v): + assert isinstance(v, int) + address = v + resource_limbs = memory_context.report_resource_at_segmented( + resource, + address, + resource.limbs_array_type, + lambda file, offset: resource.limbs_array_type( + file, + offset, + f"{resource.name}_{address:08X}_Limbs", + ), + ) + resource_limbs.set_length( + resource.get_skeleton_header_cdata_unpacked()["limbCount"] + ) + + def write_segment( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + assert isinstance(v, int) + address = v + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + return True + + def write_limbCount( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + wctx.f.write(wctx.line_prefix) + wctx.f.write( + memory_context.get_c_expression_length_at_segmented( + resource.get_skeleton_header_cdata_unpacked()["segment"] + ) + ) + return True + + cdata_ext = CDataExt_Struct( + ( + ( + "segment", + CDataExt_Value("I").set_report(report_segment).set_write(write_segment), + ), + ( + "limbCount", + CDataExt_Value("B").set_write(write_limbCount), + ), + ("pad5", CDataExt_Value.pad8), + ("pad6", CDataExt_Value.pad16), + ) + ) + + def get_skeleton_header_cdata_unpacked(self): + return self.cdata_unpacked + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return f"&{self.symbol_name}" + else: + raise ValueError() + + def get_c_declaration_base(self): + return f"SkeletonHeader {self.symbol_name}" + + def get_c_includes(self): + return ("array_count.h",) + + def get_h_includes(self): + return ("z64animation.h",) + + +class SkeletonNormalResource(SkeletonResourceABC): + limbs_array_type = StandardLimbsArrayResource + + +class SkeletonNormalLODResource(SkeletonResourceABC): + limbs_array_type = LODLimbsArrayResource + + +class SkeletonFlexResourceABC(SkeletonResourceBaseABC): + skeleton_type: type[SkeletonResourceABC] + + # For SkeletonResourceABC.report_segment + @property + def limbs_array_type(self): + return self.skeleton_type.limbs_array_type + + def __init__(self, file, range_start, name): + self.cdata_ext = CDataExt_Struct( + ( + ("sh", self.skeleton_type.cdata_ext), + ("dListCount", CDataExt_Value.u8), + ("pad9", CDataExt_Value.pad8), + ("pad10", CDataExt_Value.pad16), + ) + ) + super().__init__(file, range_start, name) + + def get_skeleton_header_cdata_unpacked(self): + return self.cdata_unpacked["sh"] + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return f"&{self.symbol_name}" + else: + raise ValueError() + + def get_c_declaration_base(self): + return f"FlexSkeletonHeader {self.symbol_name}" + + def get_c_includes(self): + return ("array_count.h",) + + def get_h_includes(self): + return ("z64animation.h",) + + +class SkeletonFlexResource(SkeletonFlexResourceABC): + skeleton_type = SkeletonNormalResource + + +class SkeletonFlexLODResource(SkeletonFlexResourceABC): + skeleton_type = SkeletonNormalLODResource diff --git a/tools/assets/extract/extase_oot64/skeleton_skin_resources.py b/tools/assets/extract/extase_oot64/skeleton_skin_resources.py new file mode 100644 index 0000000000..b1ad1e5b3a --- /dev/null +++ b/tools/assets/extract/extase_oot64/skeleton_skin_resources.py @@ -0,0 +1,279 @@ +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +from typing import TYPE_CHECKING + +from ..oot64_data.misc_ids import SKIN_LIMB_TYPES + +if TYPE_CHECKING: + from ..extase.memorymap import MemoryContext + +from ..extase.cdata_resources import ( + CDataResource, + CDataArrayResource, + CDataExt_Value, + CDataExt_Struct, + CDataExtWriteContext, + cdata_ext_Vec3s, +) + +from . import dlist_resources +from . import skeleton_resources + + +class SkinVertexArrayResource(CDataArrayResource): + elem_cdata_ext = CDataExt_Struct( + ( + ("index", CDataExt_Value.u16), + ("s", CDataExt_Value.s16), + ("t", CDataExt_Value.s16), + ("normX", CDataExt_Value.s8), + ("normY", CDataExt_Value.s8), + ("normZ", CDataExt_Value.s8), + ("alpha", CDataExt_Value.u8), + ) + ) + + def get_c_declaration_base(self): + return f"SkinVertex {self.symbol_name}[]" + + def get_h_includes(self): + return ("z64skin.h",) + + +class SkinTransformationArrayResource(CDataArrayResource): + elem_cdata_ext = CDataExt_Struct( + ( + ("limbIndex", CDataExt_Value.u8), + ("pad1", CDataExt_Value.pad8), + ("x", CDataExt_Value.s16), + ("y", CDataExt_Value.s16), + ("z", CDataExt_Value.s16), + ("scale", CDataExt_Value.u8), + ("pad9", CDataExt_Value.pad8), + ) + ) + + def get_c_declaration_base(self): + return f"SkinTransformation {self.symbol_name}[]" + + def get_h_includes(self): + return ("z64skin.h",) + + +class SkinLimbModifArrayResource(CDataArrayResource): + def report_elem(resource, memory_context: "MemoryContext", v): + assert isinstance(v, dict) + + address = v["skinVertices"] + assert isinstance(address, int) + skin_vertices_res = memory_context.report_resource_at_segmented( + resource, + address, + SkinVertexArrayResource, + lambda file, offset: SkinVertexArrayResource( + file, + offset, + f"{resource.name}_{offset:08X}_SkinVertices", + ), + ) + skin_vertices_res.set_length(v["vtxCount"]) + + address = v["limbTransformations"] + assert isinstance(address, int) + skin_vertices_res = memory_context.report_resource_at_segmented( + resource, + address, + SkinTransformationArrayResource, + lambda file, offset: SkinTransformationArrayResource( + file, + offset, + f"{resource.name}_{offset:08X}_SkinTransforms", + ), + ) + skin_vertices_res.set_length(v["transformCount"]) + + def write_skinVertices( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + assert isinstance(v, int) + address = v + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + return True + + def write_limbTransformations( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + assert isinstance(v, int) + address = v + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + return True + + elem_cdata_ext = CDataExt_Struct( + ( + ("vtxCount", CDataExt_Value.u16), + ("transformCount", CDataExt_Value.u16), + ("unk_4", CDataExt_Value.u16), + ("pad6", CDataExt_Value.pad16), + ( + "skinVertices", + (CDataExt_Value("I").set_write(write_skinVertices)), + ), # SkinVertex* + ( + "limbTransformations", + (CDataExt_Value("I").set_write(write_limbTransformations)), + ), # SkinTransformation* + ) + ).set_report(report_elem) + + def get_c_declaration_base(self): + return f"SkinLimbModif {self.symbol_name}[]" + + def get_h_includes(self): + return ("z64skin.h",) + + +class SkinAnimatedLimbDataResource(CDataResource): + def report_limbModifications(resource, memory_context: "MemoryContext", v): + assert isinstance(v, int) + address = v + skin_vertices_res = memory_context.report_resource_at_segmented( + resource, + address, + SkinLimbModifArrayResource, + lambda file, offset: SkinLimbModifArrayResource( + file, + offset, + f"{resource.name}_{offset:08X}_SkinLimbModifs", + ), + ) + skin_vertices_res.set_length(resource.cdata_unpacked["limbModifCount"]) + + def write_limbModifications( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + assert isinstance(v, int) + address = v + wctx.f.write(wctx.line_prefix) + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + return True + + cdata_ext = CDataExt_Struct( + ( + ("totalVtxCount", CDataExt_Value.u16), + ("limbModifCount", CDataExt_Value.u16), + ( + "limbModifications", + ( + CDataExt_Value("I") + .set_report(report_limbModifications) + .set_write(write_limbModifications) + ), + ), # SkinLimbModif* + ("dlist", dlist_resources.cdata_ext_gfx_segmented), + ) + ) + + def get_c_declaration_base(self): + return f"SkinAnimatedLimbData {self.symbol_name}" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return f"&{self.symbol_name}" + else: + raise ValueError() + + def get_h_includes(self): + return ("z64skin.h",) + + +class SkinLimbResource(CDataResource): + def report_segment(resource, memory_context: "MemoryContext", v): + assert isinstance(v, int) + address = v + segmentType = resource.cdata_unpacked["segmentType"] + if segmentType == 4: # SKIN_LIMB_TYPE_ANIMATED + # segment is SkinAnimatedLimbData* + assert address != 0 + memory_context.report_resource_at_segmented( + resource, + address, + SkinAnimatedLimbDataResource, + lambda file, offset: SkinAnimatedLimbDataResource( + file, offset, f"{resource.name}_{address:08X}_SkinAnimatedLimbData" + ), + ) + elif segmentType == 11: # SKIN_LIMB_TYPE_NORMAL + # segment is Gfx* + assert address != 0 + dlist_resources.report_gfx_segmented(resource, memory_context, address) + + def write_segment( + resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext + ): + assert isinstance(v, int) + address = v + wctx.f.write(wctx.line_prefix) + if address == 0: + wctx.f.write("NULL") + else: + wctx.f.write(memory_context.get_c_reference_at_segmented(address)) + return True + + cdata_ext = CDataExt_Struct( + ( + ("jointPos", cdata_ext_Vec3s), + ( + "child", + CDataExt_Value("B").set_write( + skeleton_resources.StandardLimbResource.write_limb_index + ), + ), + ( + "sibling", + CDataExt_Value("B").set_write( + skeleton_resources.StandardLimbResource.write_limb_index + ), + ), + ( + "segmentType", + CDataExt_Value("i").set_write_str_v( + lambda v: SKIN_LIMB_TYPES.get(v, f"{v}") + ), + ), + ( + "segment", + CDataExt_Value("I").set_report(report_segment).set_write(write_segment), + ), + ) + ) + + def __init__(self, file, range_start, name): + super().__init__(file, range_start, name) + self.enum_member_name = f"LIMB_{file.name.upper()}_{range_start:06X}" + + def set_enum_member_name(self, enum_member_name: str): + self.enum_member_name = enum_member_name + + def get_c_declaration_base(self): + return f"SkinLimb {self.symbol_name}" + + def get_c_reference(self, resource_offset: int): + if resource_offset == 0: + return f"&{self.symbol_name}" + else: + raise ValueError() + + def get_h_includes(self): + return ("z64skin.h",) + + +class SkinLimbsArrayResource(skeleton_resources.LimbsArrayResourceABC): + limb_type = SkinLimbResource + c_limb_type = "SkinLimb" + + +class SkeletonSkinResource(skeleton_resources.SkeletonResourceABC): + limbs_array_type = SkinLimbsArrayResource diff --git a/tools/assets/extract/extract_xml_z64.py b/tools/assets/extract/extract_xml_z64.py new file mode 100644 index 0000000000..79756908fa --- /dev/null +++ b/tools/assets/extract/extract_xml_z64.py @@ -0,0 +1,517 @@ +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +import dataclasses +from pathlib import Path + +from ..descriptor.base import ( + BaseromFileBackingMemory, + get_resources_desc, + ResourceDesc, + ResourcesDescCollection, + ResourcesDescCollectionsPool, + SegmentStartAddress, + VRAMStartAddress, +) + +from .extase import File, Resource +from .extase.memorymap import MemoryContext + +from . import z64_resource_handlers + +try: + import rich + import rich.console + import rich.pretty +except ImportError: + USE_RICH = False +else: + USE_RICH = True + +# +# main +# + +VERBOSE1 = False +VERBOSE2 = False +VERBOSE3 = False + +# "options" +RM_SOURCE = True +WRITE_SOURCE = True +RM_EXTRACT = True +WRITE_EXTRACT = True +from ..conf import WRITE_HINTS, I_D_OMEGALUL + + +@dataclasses.dataclass +class ExtractionContext: + oot_version: str + version_memctx_base: MemoryContext + baserom_path: Path + build_path: Path + extracted_path: Path + write_source: set[str] + """Paths of source .c files to write""" + + def get_baserom_file_data(self, baserom_file_name: str): + return memoryview((self.baserom_path / baserom_file_name).read_bytes()) + + +def create_file_resources(rescoll: ResourcesDescCollection, file: File): + """Collect resources described by the collection into the file object. + + Does not do any processing of the data itself: no parsing, no discovering more resources. + """ + + file_resources_by_desc: dict[ResourceDesc, Resource] = dict() + + list_ResourceNeedsPostProcessWithPoolResourcesException: list[ + z64_resource_handlers.ResourceNeedsPostProcessWithPoolResourcesException + ] = [] + + for resource_desc in rescoll.resources: + + try: + resource = z64_resource_handlers.get_resource_from_desc(file, resource_desc) + except ( + z64_resource_handlers.ResourceNeedsPostProcessWithPoolResourcesException + ) as e: + resource = e.resource + list_ResourceNeedsPostProcessWithPoolResourcesException.append(e) + except Exception as e: + raise Exception( + "Error while creating resource from description:", resource_desc + ) from e + + # TODO nice hack right here. + # probably instead rework the "c declaration" system into a more opaque object + # not that this is really a required long term feature as it's only relevant + # for writing the source files (main .c/.h), not extracting + if file.name.startswith("ovl_") and file.name != "ovl_file_choose": + resource.HACK_IS_STATIC_ON = ... + + file.add_resource(resource) + + file_resources_by_desc[resource_desc] = resource + + if VERBOSE1: + print(file) + print(file.name, file._resources) + + # Check if described resources overlap + file.sort_resources() + file.check_overlapping_resources() + + return ( + file_resources_by_desc, + list_ResourceNeedsPostProcessWithPoolResourcesException, + ) + + +def process_pool( + extraction_ctx: ExtractionContext, pool_desc: ResourcesDescCollectionsPool +): + if VERBOSE1: + print("> process_pool") + colls_str = " + ".join(set(map(str, (_c.out_path for _c in pool_desc.collections)))) + if USE_RICH: + rich.print(f"[b]{colls_str}[/b]") + else: + print(colls_str) + + file_by_rescoll: dict[ResourcesDescCollection, File] = dict() + + # 1) Create File and Resource objects + + pool_resources_by_desc: dict[ResourceDesc, Resource] = dict() + list_all_ResourceNeedsPostProcessWithPoolResourcesException: list[ + z64_resource_handlers.ResourceNeedsPostProcessWithPoolResourcesException + ] = [] + for rescoll in pool_desc.collections: + if not isinstance(rescoll.backing_memory, BaseromFileBackingMemory): + raise NotImplementedError(rescoll.backing_memory) + data = extraction_ctx.get_baserom_file_data(rescoll.backing_memory.name) + if rescoll.backing_memory.range is not None: + range_start, range_end = rescoll.backing_memory.range + data = data[range_start:range_end] + + if isinstance(rescoll.start_address, VRAMStartAddress): + if rescoll.start_address.vram % 8 == 0: + alignment = 8 + elif rescoll.start_address.vram % 4 == 0: + alignment = 4 + else: + raise NotImplementedError( + f"alignment for {rescoll.start_address.vram=:#08X}" + ) + elif ( + isinstance(rescoll.start_address, SegmentStartAddress) + or rescoll.start_address is None + ): + alignment = 8 + else: + raise NotImplementedError(rescoll.start_address) + # TODO File.name + file = File(rescoll.backing_memory.name, data=data, alignment=alignment) + file_by_rescoll[rescoll] = file + + ( + file_resources_by_desc, + list_ResourceNeedsPostProcessWithPoolResourcesException, + ) = create_file_resources(rescoll, file) + pool_resources_by_desc |= file_resources_by_desc + list_all_ResourceNeedsPostProcessWithPoolResourcesException.extend( + list_ResourceNeedsPostProcessWithPoolResourcesException + ) + + for e in list_all_ResourceNeedsPostProcessWithPoolResourcesException: + e.callback(pool_resources_by_desc) + + # 2) Build a MemoryContext for each File + + memctx_base = extraction_ctx.version_memctx_base.copy() + memctx_by_file: dict[File, MemoryContext] = dict() + + for rescoll, file in file_by_rescoll.items(): + if VERBOSE2: + print("Building MemoryContext for", file.name) + files_by_segment: dict[int, list[File]] = dict() + file_memctx = memctx_base.copy() + + for rescoll_dep in (rescoll, *rescoll.depends): + file_dep = file_by_rescoll[rescoll_dep] + + if rescoll_dep.start_address is None: + pass + elif isinstance(rescoll_dep.start_address, SegmentStartAddress): + files_by_segment.setdefault( + rescoll_dep.start_address.segment, [] + ).append(file_dep) + elif isinstance(rescoll_dep.start_address, VRAMStartAddress): + file_memctx.set_direct_file(rescoll_dep.start_address.vram, file_dep) + if file_dep != file: + file.referenced_files.add(file_dep) + else: + raise NotImplementedError(rescoll_dep.start_address) + + disputed_segments = [] + + for segment, files in files_by_segment.items(): + if len(files) == 1: + file_memctx.set_segment_file(segment, files[0]) + if files[0] != file: + file.referenced_files.add(files[0]) + if VERBOSE2: + print("segment", segment, "set to", files[0].name) + else: + disputed_segments.append(segment) + + if VERBOSE2: + print(f"{disputed_segments=}") + + if ( + isinstance(rescoll.start_address, SegmentStartAddress) + and rescoll.start_address.segment in disputed_segments + ): + if VERBOSE2: + print( + "disputed segment", + rescoll.start_address.segment, + "set to own file for file's memctx", + file.name, + ) + file_memctx.set_segment_file(rescoll.start_address.segment, file) + memctx_by_file[file] = file_memctx + + # 3) parse: iteratively discover and parse data + # (discover = add resources, parse = make friendlier than binary) + + def parse_all_files(): + while True: + any_progress = False + for file, file_memctx in memctx_by_file.items(): + if VERBOSE3: + print(file.name, ".try_parse_resources_data()") + if file.try_parse_resources_data(file_memctx): + any_progress = True + if not any_progress: + break + + for file in memctx_by_file.keys(): + file.check_non_parsed_resources() + + if VERBOSE3: + print("parse_all_files() ...") + parse_all_files() + + for file in memctx_by_file.keys(): + file.commit_resource_buffers() + + if VERBOSE3: + print("parse new resources (resource buffers) ...") + parse_all_files() # parse new resources (resource buffers) + + for file in memctx_by_file.keys(): + file.sort_resources() + file.check_overlapping_resources() + + # 4) add dummy (binary) resources for the unaccounted gaps + + if VERBOSE3: + print("unaccounted...") + + for file in memctx_by_file.keys(): + file.add_unaccounted_resources(I_D_OMEGALUL=I_D_OMEGALUL) + + parse_all_files() # FIXME this is to set is_data_parsed=True on binary blob unaccounteds, handle better + + for file in memctx_by_file.keys(): + file.sort_resources() + assert not file.get_overlapping_resources() + + # At this point all files are completely mapped with resources + + # 5) + + for rescoll, file in file_by_rescoll.items(): + file.set_source_path( + extraction_ctx.extracted_path / "assets" / rescoll.out_path + ) + + file.set_resources_paths( + extraction_ctx.extracted_path, + extraction_ctx.build_path, + Path("assets") / rescoll.out_path, + ) + + for file, file_memctx in memctx_by_file.items(): + # write to extracted/ + if WRITE_EXTRACT: + file.write_resources_extracted(file_memctx) + + # "source" refers to the main .c and .h `#include`ing all the extracted resources + if WRITE_SOURCE and ( + str(file.source_c_path.relative_to(extraction_ctx.extracted_path)) + in extraction_ctx.write_source + ): + file.write_source() + + +def process_pool_wrapped(extraction_ctx, pd): + try: + process_pool(extraction_ctx, pd) + except Exception as e: + import traceback + import sys + + # Some exceptions can't be pickled for passing back to the main process + # so print them now as well as reraising + traceback.print_exc(file=sys.stdout) + raise Exception( + "ERROR with pool_desc collections:", + [str(rescoll.out_path) for rescoll in pd.collections], + ) from e + + +# Make interrupting jobs with ^C less jank +# https://stackoverflow.com/questions/72967793/keyboardinterrupt-with-python-multiprocessing-pool +def set_sigint_ignored(): + import signal + + signal.signal(signal.SIGINT, signal.SIG_IGN) + + +def main(): + import argparse + import json + import re + import time + + from tools import version_config + from tools import dmadata + + parser = argparse.ArgumentParser() + parser.add_argument( + "baserom_segments_dir", + type=Path, + help="Directory of uncompressed ROM segments", + ) + parser.add_argument( + "output_dir", + type=Path, + help="Output directory to place files in", + ) + parser.add_argument("-v", dest="oot_version", default="gc-eu-mq-dbg") + parser.add_argument("-j", dest="jobs", nargs="?", default=False, type=int) + parser.add_argument("-f", dest="force", action="store_true") + parser.add_argument("-s", dest="single", default=None) + parser.add_argument("-r", dest="single_is_regex", default=None, action="store_true") + args = parser.parse_args() + + vc = version_config.load_version_config(args.oot_version) + + dma_entries = dmadata.read_dmadata( + memoryview((args.baserom_segments_dir / "dmadata").read_bytes()), 0 + ) + dmadata_table_rom_file_name_by_vrom = dict() + for dma_entry, name in zip(dma_entries, vc.dmadata_segments.keys(), strict=True): + dmadata_table_rom_file_name_by_vrom[ + (dma_entry.vrom_start, dma_entry.vrom_end) + ] = name + + pools_desc = get_resources_desc(vc) + + last_extracts_json_p = args.output_dir / "last_extracts.json" + try: + with last_extracts_json_p.open("r") as f: + last_extracts = json.load(f) + except (OSError, json.decoder.JSONDecodeError): + last_extracts = dict() + + def is_pool_desc_modified(pool_desc: ResourcesDescCollectionsPool): + modified = False + for rdc in pool_desc.collections: + if isinstance(rdc.backing_memory, BaseromFileBackingMemory): + if rdc.last_modified_time > last_extracts.get( + f"{rdc.out_path} {rdc.backing_memory.name}", 0 + ): + modified = True + return modified + + def set_pool_desc_modified(pool_desc: ResourcesDescCollectionsPool): + for rdc in pool_desc.collections: + if isinstance(rdc.backing_memory, BaseromFileBackingMemory): + last_extracts[f"{rdc.out_path} {rdc.backing_memory.name}"] = ( + rdc.last_modified_time + ) + + version_memctx_base = MemoryContext(dmadata_table_rom_file_name_by_vrom) + + from .extase_oot64.dlist_resources import MtxResource, TextureResource + from ..n64 import G_IM_FMT, G_IM_SIZ + + file_gIdentityMtx = File("sys_matrix__gIdentityMtx", size=0x40) + file_gIdentityMtx.add_resource(MtxResource(file_gIdentityMtx, 0, "gIdentityMtx")) + version_memctx_base.set_direct_file(vc.variables["gIdentityMtx"], file_gIdentityMtx) + + file_sShadowTex = File("z_en_jsjutan__sShadowTex", size=0x800) + file_sShadowTex.add_resource( + TextureResource( + file_sShadowTex, 0, "sShadowTex", G_IM_FMT.I, G_IM_SIZ._8b, 32, 64 + ) + ) + version_memctx_base.set_direct_file(vc.variables["sShadowTex"], file_sShadowTex) + + extraction_ctx = ExtractionContext( + args.oot_version, + version_memctx_base, + args.baserom_segments_dir, + Path("build") / args.oot_version, + args.output_dir, + set((Path(__file__).parent / "write_source.txt").read_text().splitlines()), + ) + + z64_resource_handlers.register_resource_handlers() + + try: + if args.single is not None: + any_match = False + any_pool_processed = False + for pool_desc in pools_desc: + pool_matches = False + for coll in pool_desc.collections: + if isinstance(coll.backing_memory, BaseromFileBackingMemory): + if args.single_is_regex: + if re.fullmatch(args.single, coll.backing_memory.name): + pool_matches = True + else: + if coll.backing_memory.name == args.single: + pool_matches = True + if pool_matches: + any_match = True + if args.force or is_pool_desc_modified(pool_desc): + process_pool(extraction_ctx, pool_desc) + set_pool_desc_modified(pool_desc) + any_pool_processed = True + if any_pool_processed: + print("Done!") + elif not any_match: + print("Not found:", args.single) + else: + print("Nothing to do") + elif args.jobs is False: # everything on one process + any_pool_processed = False + for pool_desc in pools_desc: + if args.force or is_pool_desc_modified(pool_desc): + process_pool(extraction_ctx, pool_desc) + set_pool_desc_modified(pool_desc) + any_pool_processed = True + if any_pool_processed: + print("All done!") + else: + print("Nothing to do") + else: # multiprocessing + import multiprocessing + + if args.force: + pools_desc_to_extract = pools_desc + else: + pools_desc_modified = [ + pool_desc + for pool_desc in pools_desc + if is_pool_desc_modified(pool_desc) + ] + pools_desc_to_extract = pools_desc_modified + + if pools_desc_to_extract: + with multiprocessing.get_context("fork").Pool( + processes=args.jobs, initializer=set_sigint_ignored + ) as pool: + jobs = [ + ( + pd, + pool.apply_async( + process_pool_wrapped, (extraction_ctx, pd) + ), + ) + for pd in pools_desc_to_extract + ] + while jobs: + any_finished = False + still_waiting_for_jobs = [] + for pd, ar in jobs: + try: + ar.get(0) + except multiprocessing.TimeoutError: + still_waiting_for_jobs.append((pd, ar)) + else: + any_finished = True + set_pool_desc_modified(pd) + jobs = still_waiting_for_jobs + if not any_finished: + time.sleep(0.001) + print("All done!") + else: + print("Nothing to do") + except Exception as e: + import traceback + import sys + + if USE_RICH: + rich.console.Console().print_exception() + # TODO implement more __rich_repr__ + if e.__class__ in (Exception, AssertionError, NotImplementedError): + print("rich.pretty.pprint(e.args):") + rich.pretty.pprint(e.args, indent_guides=False) + else: + print("rich.pretty.pprint(e):") + rich.pretty.pprint(e, indent_guides=False) + else: + traceback.print_exc(file=sys.stdout) + print("Install rich for prettier output (`pip install rich`)") + + sys.exit(1) + finally: + with last_extracts_json_p.open("w") as f: + json.dump(last_extracts, f) diff --git a/tools/assets/extract/oot64_data/Makefile b/tools/assets/extract/oot64_data/Makefile new file mode 100644 index 0000000000..b36b6542f3 --- /dev/null +++ b/tools/assets/extract/oot64_data/Makefile @@ -0,0 +1,56 @@ +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +ROOT := ../../../../ + +DATA_FILES := actor_ids.py object_ids.py entrance_table_mini.py scene_table_mini.py + +default: + @echo 'Run `make all` or with the appropriate target to (re)build data files' + +all: $(DATA_FILES) + +distclean: + $(RM) $(DATA_FILES) + +.PHONY: default all distclean + +actor_ids.py: $(ROOT)/include/tables/actor_table.h + echo '# This file was generated from $<' > $@ + echo >> $@ + echo 'DATA = (' >> $@ + cpp -P \ + -D'DEFINE_ACTOR(_0,enumValue,_2,_3)=#enumValue,' \ + -D'DEFINE_ACTOR_UNSET(enumValue)=#enumValue,' \ + -D'DEFINE_ACTOR_INTERNAL=DEFINE_ACTOR' \ + $< >> $@ + echo ')' >> $@ + +object_ids.py: $(ROOT)/include/tables/object_table.h + echo '# This file was generated from $<' > $@ + echo >> $@ + echo 'DATA = (' >> $@ + cpp -P \ + -D'DEFINE_OBJECT(_0,enumValue)=#enumValue,' \ + -D'DEFINE_OBJECT_UNSET(enumValue)=#enumValue,' \ + -D'DEFINE_OBJECT_NULL(_0,enumValue)=#enumValue,' \ + $< >> $@ + echo ')' >> $@ + +entrance_table_mini.py: $(ROOT)/include/tables/entrance_table.h + echo '# This file was generated from $<' > $@ + echo >> $@ + echo 'DATA = (' >> $@ + cpp -P \ + -D'DEFINE_ENTRANCE(enumValue, sceneId, spawn, _3, _4, _5, _6)=(#enumValue, #sceneId, spawn),' \ + $< >> $@ + echo ')' >> $@ + +scene_table_mini.py: $(ROOT)/include/tables/scene_table.h + echo '# This file was generated from $<' > $@ + echo >> $@ + echo 'DATA = (' >> $@ + cpp -P \ + -D'DEFINE_SCENE(name, _1, enumValue, _3, _4, _5)=(#name, #enumValue),' \ + $< >> $@ + echo ')' >> $@ diff --git a/tools/assets/extract/oot64_data/__init__.py b/tools/assets/extract/oot64_data/__init__.py new file mode 100644 index 0000000000..8fac94032f --- /dev/null +++ b/tools/assets/extract/oot64_data/__init__.py @@ -0,0 +1,131 @@ +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +from typing import Sequence + + +I_D_OMEGALUL = True + + +from . import actor_ids + + +def get_actor_id_name(actor_id: int) -> str: + return actor_ids.DATA[actor_id] + + +from . import object_ids + + +def get_object_id_name(object_id: int) -> str: + return object_ids.DATA[object_id] + + +from . import entrance_table_mini +from . import entrance_ids_special + + +def get_entrance_id_name(entrance_id: int) -> str: + if entrance_id in entrance_ids_special.DATA: + return entrance_ids_special.DATA[entrance_id] + return entrance_table_mini.DATA[entrance_id][0] + + +def get_entrance_scene_id_name(entrance_id: int) -> str: + return entrance_table_mini.DATA[entrance_id][1] + + +def get_entrance_spawn(entrance_id: int) -> int: + return entrance_table_mini.DATA[entrance_id][2] + + +entrance_ids_by_scene_id_name: dict[str, list[int]] = dict() +for ( + entrance_id, + ( + entrance_id_name, + entrance_scene_id_name, + entrance_spawn, + ), +) in enumerate(entrance_table_mini.DATA): + entrance_ids_by_scene_id_name.setdefault(entrance_scene_id_name, []).append( + entrance_id + ) + + +def get_entrance_ids_from_scene_id_name(scene_id_name: str) -> Sequence[int]: + return entrance_ids_by_scene_id_name[scene_id_name] + + +from . import scene_table_mini + + +def get_scene_rom_file_name(scene_id: int) -> str: + return scene_table_mini.DATA[scene_id][0] + + +def get_scene_id_name(scene_id: int) -> str: + return scene_table_mini.DATA[scene_id][1] + + +scene_id_by_rom_file_name = { + rom_file_name: scene_id + for scene_id, (rom_file_name, scene_id_name) in enumerate(scene_table_mini.DATA) +} + + +def get_scene_id_from_rom_file_name(rom_file_name: str) -> int: + return scene_id_by_rom_file_name[rom_file_name] + + +from . import audio_ids + + +def get_sequence_id_name(sequence_id: int) -> str: + return audio_ids.SEQ_IDS[sequence_id] + + +def get_nature_ambience_id_name(nature_ambience_id: int) -> str: + return audio_ids.NATURE_AMBIENCE_IDS[nature_ambience_id] + + +from . import misc_ids + + +def get_scene_cam_type_name(scene_cam_type: int) -> str: + return misc_ids.SCENE_CAM_TYPES[scene_cam_type] + + +def get_room_behavior_type1_name(behavior_type1: int) -> str: + return misc_ids.ROOM_BEHAVIOR_TYPE1_NAMES[behavior_type1] + + +def get_room_behavior_type2_name(behavior_type2: int) -> str: + return misc_ids.ROOM_BEHAVIOR_TYPE2_NAMES[behavior_type2] + + +def get_lens_mode_name(lens_mode: int) -> str: + return misc_ids.LENS_MODES[lens_mode] + + +def get_camera_setting_type_name(camera_setting_type: int) -> str: + return misc_ids.CAMERA_SETTING_TYPES[camera_setting_type] + + +def get_room_shape_type_name(room_shape_type: int) -> str: + return misc_ids.ROOM_SHAPE_TYPE[room_shape_type] + + +def get_room_shape_image_amount_type_name(room_shape_image_amount_type: int) -> str: + return misc_ids.ROOM_SHAPE_IMAGE_AMOUNT_TYPE[room_shape_image_amount_type] + + +def get_skybox_id(skybox_id: int) -> str: + return misc_ids.SKYBOX_IDS[skybox_id] + + +def get_light_mode(light_mode: int) -> str: + return misc_ids.LIGHT_MODES[light_mode] + +def get_navi_quest_hint_file_id_name(navi_quest_hint_file_id: int) -> str: + return misc_ids.NAVI_QUEST_HINT_FILE_IDS[navi_quest_hint_file_id] diff --git a/tools/assets/extract/oot64_data/actor_ids.py b/tools/assets/extract/oot64_data/actor_ids.py new file mode 100644 index 0000000000..3654a9d2a2 --- /dev/null +++ b/tools/assets/extract/oot64_data/actor_ids.py @@ -0,0 +1,475 @@ +# This file was generated from ../../../..//include/tables/actor_table.h + +DATA = ( + "ACTOR_PLAYER", + "ACTOR_UNSET_1", + "ACTOR_EN_TEST", + "ACTOR_UNSET_3", + "ACTOR_EN_GIRLA", + "ACTOR_UNSET_5", + "ACTOR_UNSET_6", + "ACTOR_EN_PART", + "ACTOR_EN_LIGHT", + "ACTOR_EN_DOOR", + "ACTOR_EN_BOX", + "ACTOR_BG_DY_YOSEIZO", + "ACTOR_BG_HIDAN_FIREWALL", + "ACTOR_EN_POH", + "ACTOR_EN_OKUTA", + "ACTOR_BG_YDAN_SP", + "ACTOR_EN_BOM", + "ACTOR_EN_WALLMAS", + "ACTOR_EN_DODONGO", + "ACTOR_EN_FIREFLY", + "ACTOR_EN_HORSE", + "ACTOR_EN_ITEM00", + "ACTOR_EN_ARROW", + "ACTOR_UNSET_17", + "ACTOR_EN_ELF", + "ACTOR_EN_NIW", + "ACTOR_UNSET_1A", + "ACTOR_EN_TITE", + "ACTOR_EN_REEBA", + "ACTOR_EN_PEEHAT", + "ACTOR_EN_BUTTE", + "ACTOR_UNSET_1F", + "ACTOR_EN_INSECT", + "ACTOR_EN_FISH", + "ACTOR_UNSET_22", + "ACTOR_EN_HOLL", + "ACTOR_EN_SCENE_CHANGE", + "ACTOR_EN_ZF", + "ACTOR_EN_HATA", + "ACTOR_BOSS_DODONGO", + "ACTOR_BOSS_GOMA", + "ACTOR_EN_ZL1", + "ACTOR_EN_VIEWER", + "ACTOR_EN_GOMA", + "ACTOR_BG_PUSHBOX", + "ACTOR_EN_BUBBLE", + "ACTOR_DOOR_SHUTTER", + "ACTOR_EN_DODOJR", + "ACTOR_EN_BDFIRE", + "ACTOR_UNSET_31", + "ACTOR_EN_BOOM", + "ACTOR_EN_TORCH2", + "ACTOR_EN_BILI", + "ACTOR_EN_TP", + "ACTOR_UNSET_36", + "ACTOR_EN_ST", + "ACTOR_EN_BW", + "ACTOR_EN_A_OBJ", + "ACTOR_EN_EIYER", + "ACTOR_EN_RIVER_SOUND", + "ACTOR_EN_HORSE_NORMAL", + "ACTOR_EN_OSSAN", + "ACTOR_BG_TREEMOUTH", + "ACTOR_BG_DODOAGO", + "ACTOR_BG_HIDAN_DALM", + "ACTOR_BG_HIDAN_HROCK", + "ACTOR_EN_HORSE_GANON", + "ACTOR_BG_HIDAN_ROCK", + "ACTOR_BG_HIDAN_RSEKIZOU", + "ACTOR_BG_HIDAN_SEKIZOU", + "ACTOR_BG_HIDAN_SIMA", + "ACTOR_BG_HIDAN_SYOKU", + "ACTOR_EN_XC", + "ACTOR_BG_HIDAN_CURTAIN", + "ACTOR_BG_SPOT00_HANEBASI", + "ACTOR_EN_MB", + "ACTOR_EN_BOMBF", + "ACTOR_EN_ZL2", + "ACTOR_BG_HIDAN_FSLIFT", + "ACTOR_EN_OE2", + "ACTOR_BG_YDAN_HASI", + "ACTOR_BG_YDAN_MARUTA", + "ACTOR_BOSS_GANONDROF", + "ACTOR_UNSET_53", + "ACTOR_EN_AM", + "ACTOR_EN_DEKUBABA", + "ACTOR_EN_M_FIRE1", + "ACTOR_EN_M_THUNDER", + "ACTOR_BG_DDAN_JD", + "ACTOR_BG_BREAKWALL", + "ACTOR_EN_JJ", + "ACTOR_EN_HORSE_ZELDA", + "ACTOR_BG_DDAN_KD", + "ACTOR_DOOR_WARP1", + "ACTOR_OBJ_SYOKUDAI", + "ACTOR_ITEM_B_HEART", + "ACTOR_EN_DEKUNUTS", + "ACTOR_BG_MENKURI_KAITEN", + "ACTOR_BG_MENKURI_EYE", + "ACTOR_EN_VALI", + "ACTOR_BG_MIZU_MOVEBG", + "ACTOR_BG_MIZU_WATER", + "ACTOR_ARMS_HOOK", + "ACTOR_EN_FHG", + "ACTOR_BG_MORI_HINERI", + "ACTOR_EN_BB", + "ACTOR_BG_TOKI_HIKARI", + "ACTOR_EN_YUKABYUN", + "ACTOR_BG_TOKI_SWD", + "ACTOR_EN_FHG_FIRE", + "ACTOR_BG_MJIN", + "ACTOR_BG_HIDAN_KOUSI", + "ACTOR_DOOR_TOKI", + "ACTOR_BG_HIDAN_HAMSTEP", + "ACTOR_EN_BIRD", + "ACTOR_UNSET_73", + "ACTOR_UNSET_74", + "ACTOR_UNSET_75", + "ACTOR_UNSET_76", + "ACTOR_EN_WOOD02", + "ACTOR_UNSET_78", + "ACTOR_UNSET_79", + "ACTOR_UNSET_7A", + "ACTOR_UNSET_7B", + "ACTOR_EN_LIGHTBOX", + "ACTOR_EN_PU_BOX", + "ACTOR_UNSET_7E", + "ACTOR_UNSET_7F", + "ACTOR_EN_TRAP", + "ACTOR_EN_AROW_TRAP", + "ACTOR_EN_VASE", + "ACTOR_UNSET_83", + "ACTOR_EN_TA", + "ACTOR_EN_TK", + "ACTOR_BG_MORI_BIGST", + "ACTOR_BG_MORI_ELEVATOR", + "ACTOR_BG_MORI_KAITENKABE", + "ACTOR_BG_MORI_RAKKATENJO", + "ACTOR_EN_VM", + "ACTOR_DEMO_EFFECT", + "ACTOR_DEMO_KANKYO", + "ACTOR_BG_HIDAN_FWBIG", + "ACTOR_EN_FLOORMAS", + "ACTOR_EN_HEISHI1", + "ACTOR_EN_RD", + "ACTOR_EN_PO_SISTERS", + "ACTOR_BG_HEAVY_BLOCK", + "ACTOR_BG_PO_EVENT", + "ACTOR_OBJ_MURE", + "ACTOR_EN_SW", + "ACTOR_BOSS_FD", + "ACTOR_OBJECT_KANKYO", + "ACTOR_EN_DU", + "ACTOR_EN_FD", + "ACTOR_EN_HORSE_LINK_CHILD", + "ACTOR_DOOR_ANA", + "ACTOR_BG_SPOT02_OBJECTS", + "ACTOR_BG_HAKA", + "ACTOR_MAGIC_WIND", + "ACTOR_MAGIC_FIRE", + "ACTOR_UNSET_A0", + "ACTOR_EN_RU1", + "ACTOR_BOSS_FD2", + "ACTOR_EN_FD_FIRE", + "ACTOR_EN_DH", + "ACTOR_EN_DHA", + "ACTOR_EN_RL", + "ACTOR_EN_ENCOUNT1", + "ACTOR_DEMO_DU", + "ACTOR_DEMO_IM", + "ACTOR_DEMO_TRE_LGT", + "ACTOR_EN_FW", + "ACTOR_BG_VB_SIMA", + "ACTOR_EN_VB_BALL", + "ACTOR_BG_HAKA_MEGANE", + "ACTOR_BG_HAKA_MEGANEBG", + "ACTOR_BG_HAKA_SHIP", + "ACTOR_BG_HAKA_SGAMI", + "ACTOR_UNSET_B2", + "ACTOR_EN_HEISHI2", + "ACTOR_EN_ENCOUNT2", + "ACTOR_EN_FIRE_ROCK", + "ACTOR_EN_BROB", + "ACTOR_MIR_RAY", + "ACTOR_BG_SPOT09_OBJ", + "ACTOR_BG_SPOT18_OBJ", + "ACTOR_BOSS_VA", + "ACTOR_BG_HAKA_TUBO", + "ACTOR_BG_HAKA_TRAP", + "ACTOR_BG_HAKA_HUTA", + "ACTOR_BG_HAKA_ZOU", + "ACTOR_BG_SPOT17_FUNEN", + "ACTOR_EN_SYATEKI_ITM", + "ACTOR_EN_SYATEKI_MAN", + "ACTOR_EN_TANA", + "ACTOR_EN_NB", + "ACTOR_BOSS_MO", + "ACTOR_EN_SB", + "ACTOR_EN_BIGOKUTA", + "ACTOR_EN_KAREBABA", + "ACTOR_BG_BDAN_OBJECTS", + "ACTOR_DEMO_SA", + "ACTOR_DEMO_GO", + "ACTOR_EN_IN", + "ACTOR_EN_TR", + "ACTOR_BG_SPOT16_BOMBSTONE", + "ACTOR_UNSET_CE", + "ACTOR_BG_HIDAN_KOWARERUKABE", + "ACTOR_BG_BOMBWALL", + "ACTOR_BG_SPOT08_ICEBLOCK", + "ACTOR_EN_RU2", + "ACTOR_OBJ_DEKUJR", + "ACTOR_BG_MIZU_UZU", + "ACTOR_BG_SPOT06_OBJECTS", + "ACTOR_BG_ICE_OBJECTS", + "ACTOR_BG_HAKA_WATER", + "ACTOR_UNSET_D8", + "ACTOR_EN_MA2", + "ACTOR_EN_BOM_CHU", + "ACTOR_EN_HORSE_GAME_CHECK", + "ACTOR_BOSS_TW", + "ACTOR_EN_RR", + "ACTOR_EN_BA", + "ACTOR_EN_BX", + "ACTOR_EN_ANUBICE", + "ACTOR_EN_ANUBICE_FIRE", + "ACTOR_BG_MORI_HASHIGO", + "ACTOR_BG_MORI_HASHIRA4", + "ACTOR_BG_MORI_IDOMIZU", + "ACTOR_BG_SPOT16_DOUGHNUT", + "ACTOR_BG_BDAN_SWITCH", + "ACTOR_EN_MA1", + "ACTOR_BOSS_GANON", + "ACTOR_BOSS_SST", + "ACTOR_UNSET_EA", + "ACTOR_UNSET_EB", + "ACTOR_EN_NY", + "ACTOR_EN_FR", + "ACTOR_ITEM_SHIELD", + "ACTOR_BG_ICE_SHELTER", + "ACTOR_EN_ICE_HONO", + "ACTOR_ITEM_OCARINA", + "ACTOR_UNSET_F2", + "ACTOR_UNSET_F3", + "ACTOR_MAGIC_DARK", + "ACTOR_DEMO_6K", + "ACTOR_EN_ANUBICE_TAG", + "ACTOR_BG_HAKA_GATE", + "ACTOR_BG_SPOT15_SAKU", + "ACTOR_BG_JYA_GOROIWA", + "ACTOR_BG_JYA_ZURERUKABE", + "ACTOR_UNSET_FB", + "ACTOR_BG_JYA_COBRA", + "ACTOR_BG_JYA_KANAAMI", + "ACTOR_FISHING", + "ACTOR_OBJ_OSHIHIKI", + "ACTOR_BG_GATE_SHUTTER", + "ACTOR_EFF_DUST", + "ACTOR_BG_SPOT01_FUSYA", + "ACTOR_BG_SPOT01_IDOHASHIRA", + "ACTOR_BG_SPOT01_IDOMIZU", + "ACTOR_BG_PO_SYOKUDAI", + "ACTOR_BG_GANON_OTYUKA", + "ACTOR_BG_SPOT15_RRBOX", + "ACTOR_BG_UMAJUMP", + "ACTOR_UNSET_109", + "ACTOR_ARROW_FIRE", + "ACTOR_ARROW_ICE", + "ACTOR_ARROW_LIGHT", + "ACTOR_UNSET_10D", + "ACTOR_UNSET_10E", + "ACTOR_ITEM_ETCETERA", + "ACTOR_OBJ_KIBAKO", + "ACTOR_OBJ_TSUBO", + "ACTOR_EN_WONDER_ITEM", + "ACTOR_EN_IK", + "ACTOR_DEMO_IK", + "ACTOR_EN_SKJ", + "ACTOR_EN_SKJNEEDLE", + "ACTOR_EN_G_SWITCH", + "ACTOR_DEMO_EXT", + "ACTOR_DEMO_SHD", + "ACTOR_EN_DNS", + "ACTOR_ELF_MSG", + "ACTOR_EN_HONOTRAP", + "ACTOR_EN_TUBO_TRAP", + "ACTOR_OBJ_ICE_POLY", + "ACTOR_BG_SPOT03_TAKI", + "ACTOR_BG_SPOT07_TAKI", + "ACTOR_EN_FZ", + "ACTOR_EN_PO_RELAY", + "ACTOR_BG_RELAY_OBJECTS", + "ACTOR_EN_DIVING_GAME", + "ACTOR_EN_KUSA", + "ACTOR_OBJ_BEAN", + "ACTOR_OBJ_BOMBIWA", + "ACTOR_UNSET_128", + "ACTOR_UNSET_129", + "ACTOR_OBJ_SWITCH", + "ACTOR_OBJ_ELEVATOR", + "ACTOR_OBJ_LIFT", + "ACTOR_OBJ_HSBLOCK", + "ACTOR_EN_OKARINA_TAG", + "ACTOR_EN_YABUSAME_MARK", + "ACTOR_EN_GOROIWA", + "ACTOR_EN_EX_RUPPY", + "ACTOR_EN_TORYO", + "ACTOR_EN_DAIKU", + "ACTOR_UNSET_134", + "ACTOR_EN_NWC", + "ACTOR_EN_BLKOBJ", + "ACTOR_ITEM_INBOX", + "ACTOR_EN_GE1", + "ACTOR_OBJ_BLOCKSTOP", + "ACTOR_EN_SDA", + "ACTOR_EN_CLEAR_TAG", + "ACTOR_EN_NIW_LADY", + "ACTOR_EN_GM", + "ACTOR_EN_MS", + "ACTOR_EN_HS", + "ACTOR_BG_INGATE", + "ACTOR_EN_KANBAN", + "ACTOR_EN_HEISHI3", + "ACTOR_EN_SYATEKI_NIW", + "ACTOR_EN_ATTACK_NIW", + "ACTOR_BG_SPOT01_IDOSOKO", + "ACTOR_EN_SA", + "ACTOR_EN_WONDER_TALK", + "ACTOR_BG_GJYO_BRIDGE", + "ACTOR_EN_DS", + "ACTOR_EN_MK", + "ACTOR_EN_BOM_BOWL_MAN", + "ACTOR_EN_BOM_BOWL_PIT", + "ACTOR_EN_OWL", + "ACTOR_EN_ISHI", + "ACTOR_OBJ_HANA", + "ACTOR_OBJ_LIGHTSWITCH", + "ACTOR_OBJ_MURE2", + "ACTOR_EN_GO", + "ACTOR_EN_FU", + "ACTOR_UNSET_154", + "ACTOR_EN_CHANGER", + "ACTOR_BG_JYA_MEGAMI", + "ACTOR_BG_JYA_LIFT", + "ACTOR_BG_JYA_BIGMIRROR", + "ACTOR_BG_JYA_BOMBCHUIWA", + "ACTOR_BG_JYA_AMISHUTTER", + "ACTOR_BG_JYA_BOMBIWA", + "ACTOR_BG_SPOT18_BASKET", + "ACTOR_UNSET_15D", + "ACTOR_EN_GANON_ORGAN", + "ACTOR_EN_SIOFUKI", + "ACTOR_EN_STREAM", + "ACTOR_UNSET_161", + "ACTOR_EN_MM", + "ACTOR_EN_KO", + "ACTOR_EN_KZ", + "ACTOR_EN_WEATHER_TAG", + "ACTOR_BG_SST_FLOOR", + "ACTOR_EN_ANI", + "ACTOR_EN_EX_ITEM", + "ACTOR_BG_JYA_IRONOBJ", + "ACTOR_EN_JS", + "ACTOR_EN_JSJUTAN", + "ACTOR_EN_CS", + "ACTOR_EN_MD", + "ACTOR_EN_HY", + "ACTOR_EN_GANON_MANT", + "ACTOR_EN_OKARINA_EFFECT", + "ACTOR_EN_MAG", + "ACTOR_DOOR_GERUDO", + "ACTOR_ELF_MSG2", + "ACTOR_DEMO_GT", + "ACTOR_EN_PO_FIELD", + "ACTOR_EFC_ERUPC", + "ACTOR_BG_ZG", + "ACTOR_EN_HEISHI4", + "ACTOR_EN_ZL3", + "ACTOR_BOSS_GANON2", + "ACTOR_EN_KAKASI", + "ACTOR_EN_TAKARA_MAN", + "ACTOR_OBJ_MAKEOSHIHIKI", + "ACTOR_OCEFF_SPOT", + "ACTOR_END_TITLE", + "ACTOR_UNSET_180", + "ACTOR_EN_TORCH", + "ACTOR_DEMO_EC", + "ACTOR_SHOT_SUN", + "ACTOR_EN_DY_EXTRA", + "ACTOR_EN_WONDER_TALK2", + "ACTOR_EN_GE2", + "ACTOR_OBJ_ROOMTIMER", + "ACTOR_EN_SSH", + "ACTOR_EN_STH", + "ACTOR_OCEFF_WIPE", + "ACTOR_OCEFF_STORM", + "ACTOR_EN_WEIYER", + "ACTOR_BG_SPOT05_SOKO", + "ACTOR_BG_JYA_1FLIFT", + "ACTOR_BG_JYA_HAHENIRON", + "ACTOR_BG_SPOT12_GATE", + "ACTOR_BG_SPOT12_SAKU", + "ACTOR_EN_HINTNUTS", + "ACTOR_EN_NUTSBALL", + "ACTOR_BG_SPOT00_BREAK", + "ACTOR_EN_SHOPNUTS", + "ACTOR_EN_IT", + "ACTOR_EN_GELDB", + "ACTOR_OCEFF_WIPE2", + "ACTOR_OCEFF_WIPE3", + "ACTOR_EN_NIW_GIRL", + "ACTOR_EN_DOG", + "ACTOR_EN_SI", + "ACTOR_BG_SPOT01_OBJECTS2", + "ACTOR_OBJ_COMB", + "ACTOR_BG_SPOT11_BAKUDANKABE", + "ACTOR_OBJ_KIBAKO2", + "ACTOR_EN_DNT_DEMO", + "ACTOR_EN_DNT_JIJI", + "ACTOR_EN_DNT_NOMAL", + "ACTOR_EN_GUEST", + "ACTOR_BG_BOM_GUARD", + "ACTOR_EN_HS2", + "ACTOR_DEMO_KEKKAI", + "ACTOR_BG_SPOT08_BAKUDANKABE", + "ACTOR_BG_SPOT17_BAKUDANKABE", + "ACTOR_UNSET_1AA", + "ACTOR_OBJ_MURE3", + "ACTOR_EN_TG", + "ACTOR_EN_MU", + "ACTOR_EN_GO2", + "ACTOR_EN_WF", + "ACTOR_EN_SKB", + "ACTOR_DEMO_GJ", + "ACTOR_DEMO_GEFF", + "ACTOR_BG_GND_FIREMEIRO", + "ACTOR_BG_GND_DARKMEIRO", + "ACTOR_BG_GND_SOULMEIRO", + "ACTOR_BG_GND_NISEKABE", + "ACTOR_BG_GND_ICEBLOCK", + "ACTOR_EN_GB", + "ACTOR_EN_GS", + "ACTOR_BG_MIZU_BWALL", + "ACTOR_BG_MIZU_SHUTTER", + "ACTOR_EN_DAIKU_KAKARIKO", + "ACTOR_BG_BOWL_WALL", + "ACTOR_EN_WALL_TUBO", + "ACTOR_EN_PO_DESERT", + "ACTOR_EN_CROW", + "ACTOR_DOOR_KILLER", + "ACTOR_BG_SPOT11_OASIS", + "ACTOR_BG_SPOT18_FUTA", + "ACTOR_BG_SPOT18_SHUTTER", + "ACTOR_EN_MA3", + "ACTOR_EN_COW", + "ACTOR_BG_ICE_TURARA", + "ACTOR_BG_ICE_SHUTTER", + "ACTOR_EN_KAKASI2", + "ACTOR_EN_KAKASI3", + "ACTOR_OCEFF_WIPE4", + "ACTOR_EN_EG", + "ACTOR_BG_MENKURI_NISEKABE", + "ACTOR_EN_ZO", + "ACTOR_OBJ_MAKEKINSUTA", + "ACTOR_EN_GE3", + "ACTOR_OBJ_TIMEBLOCK", + "ACTOR_OBJ_HAMISHI", + "ACTOR_EN_ZL4", + "ACTOR_EN_MM2", + "ACTOR_BG_JYA_BLOCK", + "ACTOR_OBJ_WARP2BLOCK", +) diff --git a/tools/assets/extract/oot64_data/audio_ids.py b/tools/assets/extract/oot64_data/audio_ids.py new file mode 100644 index 0000000000..8bcf2b60b8 --- /dev/null +++ b/tools/assets/extract/oot64_data/audio_ids.py @@ -0,0 +1,141 @@ +# This file was made manually + +SEQ_IDS = { + 0x00: "NA_BGM_GENERAL_SFX", + 0x01: "NA_BGM_NATURE_AMBIENCE", + 0x02: "NA_BGM_FIELD_LOGIC", + 0x03: "NA_BGM_FIELD_INIT", + 0x04: "NA_BGM_FIELD_DEFAULT_1", + 0x05: "NA_BGM_FIELD_DEFAULT_2", + 0x06: "NA_BGM_FIELD_DEFAULT_3", + 0x07: "NA_BGM_FIELD_DEFAULT_4", + 0x08: "NA_BGM_FIELD_DEFAULT_5", + 0x09: "NA_BGM_FIELD_DEFAULT_6", + 0x0A: "NA_BGM_FIELD_DEFAULT_7", + 0x0B: "NA_BGM_FIELD_DEFAULT_8", + 0x0C: "NA_BGM_FIELD_DEFAULT_9", + 0x0D: "NA_BGM_FIELD_DEFAULT_A", + 0x0E: "NA_BGM_FIELD_DEFAULT_B", + 0x0F: "NA_BGM_FIELD_ENEMY_INIT", + 0x10: "NA_BGM_FIELD_ENEMY_1", + 0x11: "NA_BGM_FIELD_ENEMY_2", + 0x12: "NA_BGM_FIELD_ENEMY_3", + 0x13: "NA_BGM_FIELD_ENEMY_4", + 0x14: "NA_BGM_FIELD_STILL_1", + 0x15: "NA_BGM_FIELD_STILL_2", + 0x16: "NA_BGM_FIELD_STILL_3", + 0x17: "NA_BGM_FIELD_STILL_4", + 0x18: "NA_BGM_DUNGEON", + 0x19: "NA_BGM_KAKARIKO_ADULT", + 0x1A: "NA_BGM_ENEMY", + 0x1B: "NA_BGM_BOSS", + 0x1C: "NA_BGM_INSIDE_DEKU_TREE", + 0x1D: "NA_BGM_MARKET", + 0x1E: "NA_BGM_TITLE", + 0x1F: "NA_BGM_LINK_HOUSE", + 0x20: "NA_BGM_GAME_OVER", + 0x21: "NA_BGM_BOSS_CLEAR", + 0x22: "NA_BGM_ITEM_GET", + 0x23: "NA_BGM_OPENING_GANON", + 0x24: "NA_BGM_HEART_GET", + 0x25: "NA_BGM_OCA_LIGHT", + 0x26: "NA_BGM_JABU_JABU", + 0x27: "NA_BGM_KAKARIKO_KID", + 0x28: "NA_BGM_GREAT_FAIRY", + 0x29: "NA_BGM_ZELDA_THEME", + 0x2A: "NA_BGM_FIRE_TEMPLE", + 0x2B: "NA_BGM_OPEN_TRE_BOX", + 0x2C: "NA_BGM_FOREST_TEMPLE", + 0x2D: "NA_BGM_COURTYARD", + 0x2E: "NA_BGM_GANON_TOWER", + 0x2F: "NA_BGM_LONLON", + 0x30: "NA_BGM_GORON_CITY", + 0x31: "NA_BGM_FIELD_MORNING", + 0x32: "NA_BGM_SPIRITUAL_STONE", + 0x33: "NA_BGM_OCA_BOLERO", + 0x34: "NA_BGM_OCA_MINUET", + 0x35: "NA_BGM_OCA_SERENADE", + 0x36: "NA_BGM_OCA_REQUIEM", + 0x37: "NA_BGM_OCA_NOCTURNE", + 0x38: "NA_BGM_MINI_BOSS", + 0x39: "NA_BGM_SMALL_ITEM_GET", + 0x3A: "NA_BGM_TEMPLE_OF_TIME", + 0x3B: "NA_BGM_EVENT_CLEAR", + 0x3C: "NA_BGM_KOKIRI", + 0x3D: "NA_BGM_OCA_FAIRY_GET", + 0x3E: "NA_BGM_SARIA_THEME", + 0x3F: "NA_BGM_SPIRIT_TEMPLE", + 0x40: "NA_BGM_HORSE", + 0x41: "NA_BGM_HORSE_GOAL", + 0x42: "NA_BGM_INGO", + 0x43: "NA_BGM_MEDALLION_GET", + 0x44: "NA_BGM_OCA_SARIA", + 0x45: "NA_BGM_OCA_EPONA", + 0x46: "NA_BGM_OCA_ZELDA", + 0x47: "NA_BGM_OCA_SUNS", + 0x48: "NA_BGM_OCA_TIME", + 0x49: "NA_BGM_OCA_STORM", + 0x4A: "NA_BGM_NAVI_OPENING", + 0x4B: "NA_BGM_DEKU_TREE_CS", + 0x4C: "NA_BGM_WINDMILL", + 0x4D: "NA_BGM_HYRULE_CS", + 0x4E: "NA_BGM_MINI_GAME", + 0x4F: "NA_BGM_SHEIK", + 0x50: "NA_BGM_ZORA_DOMAIN", + 0x51: "NA_BGM_APPEAR", + 0x52: "NA_BGM_ADULT_LINK", + 0x53: "NA_BGM_MASTER_SWORD", + 0x54: "NA_BGM_INTRO_GANON", + 0x55: "NA_BGM_SHOP", + 0x56: "NA_BGM_CHAMBER_OF_SAGES", + 0x57: "NA_BGM_FILE_SELECT", + 0x58: "NA_BGM_ICE_CAVERN", + 0x59: "NA_BGM_DOOR_OF_TIME", + 0x5A: "NA_BGM_OWL", + 0x5B: "NA_BGM_SHADOW_TEMPLE", + 0x5C: "NA_BGM_WATER_TEMPLE", + 0x5D: "NA_BGM_BRIDGE_TO_GANONS", + 0x5E: "NA_BGM_OCARINA_OF_TIME", + 0x5F: "NA_BGM_GERUDO_VALLEY", + 0x60: "NA_BGM_POTION_SHOP", + 0x61: "NA_BGM_KOTAKE_KOUME", + 0x62: "NA_BGM_ESCAPE", + 0x63: "NA_BGM_UNDERGROUND", + 0x64: "NA_BGM_GANONDORF_BOSS", + 0x65: "NA_BGM_GANON_BOSS", + 0x66: "NA_BGM_END_DEMO", + 0x67: "NA_BGM_STAFF_1", + 0x68: "NA_BGM_STAFF_2", + 0x69: "NA_BGM_STAFF_3", + 0x6A: "NA_BGM_STAFF_4", + 0x6B: "NA_BGM_FIRE_BOSS", + 0x6C: "NA_BGM_TIMED_MINI_GAME", + 0x6D: "NA_BGM_CUTSCENE_EFFECTS", + 0x7F: "NA_BGM_NO_MUSIC", + 0x80: "NA_BGM_NATURE_SFX_RAIN", + 0xFFFF: "NA_BGM_DISABLED", +} + +NATURE_AMBIENCE_IDS = { + 0x00: "NATURE_ID_GENERAL_NIGHT", + 0x01: "NATURE_ID_MARKET_ENTRANCE", + 0x02: "NATURE_ID_KAKARIKO_REGION", + 0x03: "NATURE_ID_MARKET_RUINS", + 0x04: "NATURE_ID_KOKIRI_REGION", + 0x05: "NATURE_ID_MARKET_NIGHT", + 0x06: "NATURE_ID_06", + 0x07: "NATURE_ID_GANONS_LAIR", + 0x08: "NATURE_ID_08", + 0x09: "NATURE_ID_09", + 0x0A: "NATURE_ID_WASTELAND", + 0x0B: "NATURE_ID_COLOSSUS", + 0x0C: "NATURE_ID_DEATH_MOUNTAIN_TRAIL", + 0x0D: "NATURE_ID_0D", + 0x0E: "NATURE_ID_0E", + 0x0F: "NATURE_ID_0F", + 0x10: "NATURE_ID_10", + 0x11: "NATURE_ID_11", + 0x12: "NATURE_ID_12", + 0x13: "NATURE_ID_NONE", + 0xFF: "NATURE_ID_DISABLED", +} diff --git a/tools/assets/extract/oot64_data/entrance_ids_special.py b/tools/assets/extract/oot64_data/entrance_ids_special.py new file mode 100644 index 0000000000..48a798f253 --- /dev/null +++ b/tools/assets/extract/oot64_data/entrance_ids_special.py @@ -0,0 +1,11 @@ +# This file was made manually + +DATA = { + 0x7FF9: "ENTR_RETURN_GREAT_FAIRYS_FOUNTAIN_SPELLS", + 0x7FFA: "ENTR_RETURN_SHOOTING_GALLERY", + 0x7FFB: "ENTR_RETURN_2", + 0x7FFC: "ENTR_RETURN_BAZAAR", + 0x7FFD: "ENTR_RETURN_4", + 0x7FFE: "ENTR_RETURN_GREAT_FAIRYS_FOUNTAIN_MAGIC", + 0x7FFF: "ENTR_RETURN_GROTTO", +} diff --git a/tools/assets/extract/oot64_data/entrance_table_mini.py b/tools/assets/extract/oot64_data/entrance_table_mini.py new file mode 100644 index 0000000000..9b23c6135c --- /dev/null +++ b/tools/assets/extract/oot64_data/entrance_table_mini.py @@ -0,0 +1,1560 @@ +# This file was generated from ../../../..//include/tables/entrance_table.h + +DATA = ( + ("ENTR_DEKU_TREE_0", "SCENE_DEKU_TREE", 0), + ("ENTR_DEKU_TREE_0_1", "SCENE_DEKU_TREE", 0), + ("ENTR_DEKU_TREE_0_2", "SCENE_DEKU_TREE", 0), + ("ENTR_DEKU_TREE_0_3", "SCENE_DEKU_TREE", 0), + ("ENTR_DODONGOS_CAVERN_0", "SCENE_DODONGOS_CAVERN", 0), + ("ENTR_DODONGOS_CAVERN_0_1", "SCENE_DODONGOS_CAVERN", 0), + ("ENTR_DODONGOS_CAVERN_0_2", "SCENE_DODONGOS_CAVERN", 0), + ("ENTR_DODONGOS_CAVERN_0_3", "SCENE_DODONGOS_CAVERN", 0), + ("ENTR_GERUDO_TRAINING_GROUND_0", "SCENE_GERUDO_TRAINING_GROUND", 0), + ("ENTR_GERUDO_TRAINING_GROUND_0_1", "SCENE_GERUDO_TRAINING_GROUND", 0), + ("ENTR_GERUDO_TRAINING_GROUND_0_2", "SCENE_GERUDO_TRAINING_GROUND", 0), + ("ENTR_GERUDO_TRAINING_GROUND_0_3", "SCENE_GERUDO_TRAINING_GROUND", 0), + ("ENTR_FOREST_TEMPLE_BOSS_0", "SCENE_FOREST_TEMPLE_BOSS", 0), + ("ENTR_FOREST_TEMPLE_BOSS_0_1", "SCENE_FOREST_TEMPLE_BOSS", 0), + ("ENTR_FOREST_TEMPLE_BOSS_0_2", "SCENE_FOREST_TEMPLE_BOSS", 0), + ("ENTR_FOREST_TEMPLE_BOSS_0_3", "SCENE_FOREST_TEMPLE_BOSS", 0), + ("ENTR_WATER_TEMPLE_0", "SCENE_WATER_TEMPLE", 0), + ("ENTR_WATER_TEMPLE_0_1", "SCENE_WATER_TEMPLE", 0), + ("ENTR_WATER_TEMPLE_0_2", "SCENE_WATER_TEMPLE", 0), + ("ENTR_WATER_TEMPLE_0_3", "SCENE_WATER_TEMPLE", 0), + ("ENTR_UNUSED_6E", "SCENE_UNUSED_6E", 0), + ("ENTR_UNUSED_6E_1", "SCENE_UNUSED_6E", 0), + ("ENTR_UNUSED_6E_2", "SCENE_UNUSED_6E", 0), + ("ENTR_UNUSED_6E_3", "SCENE_UNUSED_6E", 0), + ("ENTR_SASATEST_0", "SCENE_SASATEST", 0), + ("ENTR_SASATEST_0_1", "SCENE_SASATEST", 0), + ("ENTR_SASATEST_0_2", "SCENE_SASATEST", 0), + ("ENTR_SASATEST_0_3", "SCENE_SASATEST", 0), + ("ENTR_SYOTES_0", "SCENE_SYOTES", 0), + ("ENTR_SYOTES_0_1", "SCENE_SYOTES", 0), + ("ENTR_SYOTES_0_2", "SCENE_SYOTES", 0), + ("ENTR_SYOTES_0_3", "SCENE_SYOTES", 0), + ("ENTR_SYOTES2_0", "SCENE_SYOTES2", 0), + ("ENTR_SYOTES2_0_1", "SCENE_SYOTES2", 0), + ("ENTR_SYOTES2_0_2", "SCENE_SYOTES2", 0), + ("ENTR_SYOTES2_0_3", "SCENE_SYOTES2", 0), + ("ENTR_TESTROOM_0", "SCENE_TESTROOM", 0), + ("ENTR_TESTROOM_0_1", "SCENE_TESTROOM", 0), + ("ENTR_TESTROOM_0_2", "SCENE_TESTROOM", 0), + ("ENTR_TESTROOM_0_3", "SCENE_TESTROOM", 0), + ("ENTR_JABU_JABU_0", "SCENE_JABU_JABU", 0), + ("ENTR_JABU_JABU_0_1", "SCENE_JABU_JABU", 0), + ("ENTR_JABU_JABU_0_2", "SCENE_JABU_JABU", 0), + ("ENTR_JABU_JABU_0_3", "SCENE_JABU_JABU", 0), + ("ENTR_JABU_JABU_0_4", "SCENE_JABU_JABU", 0), + ("ENTR_ROYAL_FAMILYS_TOMB_0", "SCENE_ROYAL_FAMILYS_TOMB", 0), + ("ENTR_ROYAL_FAMILYS_TOMB_0_1", "SCENE_ROYAL_FAMILYS_TOMB", 0), + ("ENTR_ROYAL_FAMILYS_TOMB_0_2", "SCENE_ROYAL_FAMILYS_TOMB", 0), + ("ENTR_ROYAL_FAMILYS_TOMB_0_3", "SCENE_ROYAL_FAMILYS_TOMB", 0), + ("ENTR_ROYAL_FAMILYS_TOMB_0_4", "SCENE_ROYAL_FAMILYS_TOMB", 0), + ("ENTR_ROYAL_FAMILYS_TOMB_0_5", "SCENE_ROYAL_FAMILYS_TOMB", 0), + ("ENTR_MARKET_ENTRANCE_DAY_0", "SCENE_MARKET_ENTRANCE_DAY", 0), + ("ENTR_MARKET_ENTRANCE_NIGHT_0_1", "SCENE_MARKET_ENTRANCE_NIGHT", 0), + ("ENTR_MARKET_ENTRANCE_RUINS_0_2", "SCENE_MARKET_ENTRANCE_RUINS", 0), + ("ENTR_MARKET_ENTRANCE_RUINS_0_3", "SCENE_MARKET_ENTRANCE_RUINS", 0), + ("ENTR_SHADOW_TEMPLE_0", "SCENE_SHADOW_TEMPLE", 0), + ("ENTR_SHADOW_TEMPLE_0_1", "SCENE_SHADOW_TEMPLE", 0), + ("ENTR_SHADOW_TEMPLE_0_2", "SCENE_SHADOW_TEMPLE", 0), + ("ENTR_SHADOW_TEMPLE_0_3", "SCENE_SHADOW_TEMPLE", 0), + ("ENTR_SHOOTING_GALLERY_0", "SCENE_SHOOTING_GALLERY", 0), + ("ENTR_SHOOTING_GALLERY_0_1", "SCENE_SHOOTING_GALLERY", 0), + ("ENTR_SHOOTING_GALLERY_0_2", "SCENE_SHOOTING_GALLERY", 0), + ("ENTR_SHOOTING_GALLERY_0_3", "SCENE_SHOOTING_GALLERY", 0), + ("ENTR_GROTTOS_0", "SCENE_GROTTOS", 0), + ("ENTR_GROTTOS_0_1", "SCENE_GROTTOS", 0), + ("ENTR_GROTTOS_0_2", "SCENE_GROTTOS", 0), + ("ENTR_GROTTOS_0_3", "SCENE_GROTTOS", 0), + ("ENTR_LAKESIDE_LABORATORY_0", "SCENE_LAKESIDE_LABORATORY", 0), + ("ENTR_LAKESIDE_LABORATORY_0_1", "SCENE_LAKESIDE_LABORATORY", 0), + ("ENTR_LAKESIDE_LABORATORY_0_2", "SCENE_LAKESIDE_LABORATORY", 0), + ("ENTR_LAKESIDE_LABORATORY_0_3", "SCENE_LAKESIDE_LABORATORY", 0), + ("ENTR_SUTARU_0", "SCENE_SUTARU", 0), + ("ENTR_SUTARU_0_1", "SCENE_SUTARU", 0), + ("ENTR_SUTARU_0_2", "SCENE_SUTARU", 0), + ("ENTR_SUTARU_0_3", "SCENE_SUTARU", 0), + ("ENTR_GRAVE_WITH_FAIRYS_FOUNTAIN_0", "SCENE_GRAVE_WITH_FAIRYS_FOUNTAIN", 0), + ("ENTR_GRAVE_WITH_FAIRYS_FOUNTAIN_0_1", "SCENE_GRAVE_WITH_FAIRYS_FOUNTAIN", 0), + ("ENTR_GRAVE_WITH_FAIRYS_FOUNTAIN_0_2", "SCENE_GRAVE_WITH_FAIRYS_FOUNTAIN", 0), + ("ENTR_GRAVE_WITH_FAIRYS_FOUNTAIN_0_3", "SCENE_GRAVE_WITH_FAIRYS_FOUNTAIN", 0), + ("ENTR_LON_LON_BUILDINGS_0", "SCENE_LON_LON_BUILDINGS", 0), + ("ENTR_LON_LON_BUILDINGS_0_1", "SCENE_LON_LON_BUILDINGS", 0), + ("ENTR_LON_LON_BUILDINGS_0_2", "SCENE_LON_LON_BUILDINGS", 0), + ("ENTR_LON_LON_BUILDINGS_0_3", "SCENE_LON_LON_BUILDINGS", 0), + ("ENTR_TEMPLE_OF_TIME_0", "SCENE_TEMPLE_OF_TIME", 0), + ("ENTR_TEMPLE_OF_TIME_0_1", "SCENE_TEMPLE_OF_TIME", 0), + ("ENTR_TEMPLE_OF_TIME_0_2", "SCENE_TEMPLE_OF_TIME", 0), + ("ENTR_TEMPLE_OF_TIME_0_3", "SCENE_TEMPLE_OF_TIME", 0), + ("ENTR_TEMPLE_OF_TIME_0_4", "SCENE_TEMPLE_OF_TIME", 0), + ("ENTR_TEMPLE_OF_TIME_0_5", "SCENE_TEMPLE_OF_TIME", 0), + ("ENTR_TEMPLE_OF_TIME_0_6", "SCENE_TEMPLE_OF_TIME", 0), + ("ENTR_TEMPLE_OF_TIME_0_7", "SCENE_TEMPLE_OF_TIME", 0), + ("ENTR_TEMPLE_OF_TIME_0_8", "SCENE_TEMPLE_OF_TIME", 0), + ("ENTR_TEMPLE_OF_TIME_0_9", "SCENE_TEMPLE_OF_TIME", 0), + ("ENTR_TEMPLE_OF_TIME_0_10", "SCENE_TEMPLE_OF_TIME", 0), + ("ENTR_TEMPLE_OF_TIME_0_11", "SCENE_TEMPLE_OF_TIME", 0), + ("ENTR_TEMPLE_OF_TIME_0_12", "SCENE_TEMPLE_OF_TIME", 0), + ("ENTR_TEMPLE_OF_TIME_0_13", "SCENE_TEMPLE_OF_TIME", 0), + ("ENTR_TEMPLE_OF_TIME_0_14", "SCENE_TEMPLE_OF_TIME", 0), + ("ENTR_TEMPLE_OF_TIME_0_15", "SCENE_TEMPLE_OF_TIME", 0), + ("ENTR_TREASURE_BOX_SHOP_0", "SCENE_TREASURE_BOX_SHOP", 0), + ("ENTR_TREASURE_BOX_SHOP_0_1", "SCENE_TREASURE_BOX_SHOP", 0), + ("ENTR_TREASURE_BOX_SHOP_0_2", "SCENE_TREASURE_BOX_SHOP", 0), + ("ENTR_TREASURE_BOX_SHOP_0_3", "SCENE_TREASURE_BOX_SHOP", 0), + ("ENTR_BACK_ALLEY_DAY_3", "SCENE_BACK_ALLEY_DAY", 3), + ("ENTR_BACK_ALLEY_NIGHT_3_1", "SCENE_BACK_ALLEY_NIGHT", 3), + ("ENTR_BACK_ALLEY_DAY_3_2", "SCENE_BACK_ALLEY_DAY", 3), + ("ENTR_BACK_ALLEY_NIGHT_3_3", "SCENE_BACK_ALLEY_NIGHT", 3), + ("ENTR_CHAMBER_OF_THE_SAGES_0", "SCENE_CHAMBER_OF_THE_SAGES", 0), + ("ENTR_CHAMBER_OF_THE_SAGES_0_1", "SCENE_CHAMBER_OF_THE_SAGES", 0), + ("ENTR_CHAMBER_OF_THE_SAGES_0_2", "SCENE_CHAMBER_OF_THE_SAGES", 0), + ("ENTR_CHAMBER_OF_THE_SAGES_0_3", "SCENE_CHAMBER_OF_THE_SAGES", 0), + ("ENTR_CHAMBER_OF_THE_SAGES_0_4", "SCENE_CHAMBER_OF_THE_SAGES", 0), + ("ENTR_CHAMBER_OF_THE_SAGES_0_5", "SCENE_CHAMBER_OF_THE_SAGES", 0), + ("ENTR_CHAMBER_OF_THE_SAGES_0_6", "SCENE_CHAMBER_OF_THE_SAGES", 0), + ("ENTR_POTION_SHOP_GRANNY_0", "SCENE_POTION_SHOP_GRANNY", 0), + ("ENTR_POTION_SHOP_GRANNY_0_1", "SCENE_POTION_SHOP_GRANNY", 0), + ("ENTR_POTION_SHOP_GRANNY_0_2", "SCENE_POTION_SHOP_GRANNY", 0), + ("ENTR_POTION_SHOP_GRANNY_0_3", "SCENE_POTION_SHOP_GRANNY", 0), + ("ENTR_HAIRAL_NIWA2_0", "SCENE_HAIRAL_NIWA2", 0), + ("ENTR_HAIRAL_NIWA2_0_1", "SCENE_HAIRAL_NIWA2", 0), + ("ENTR_HAIRAL_NIWA2_0_2", "SCENE_HAIRAL_NIWA2", 0), + ("ENTR_HAIRAL_NIWA2_0_3", "SCENE_HAIRAL_NIWA2", 0), + ("ENTR_CASTLE_COURTYARD_GUARDS_DAY_0", "SCENE_CASTLE_COURTYARD_GUARDS_DAY", 0), + ("ENTR_CASTLE_COURTYARD_GUARDS_NIGHT_0_1", "SCENE_CASTLE_COURTYARD_GUARDS_NIGHT", 0), + ("ENTR_CASTLE_COURTYARD_GUARDS_DAY_0_2", "SCENE_CASTLE_COURTYARD_GUARDS_DAY", 0), + ("ENTR_CASTLE_COURTYARD_GUARDS_NIGHT_0_3", "SCENE_CASTLE_COURTYARD_GUARDS_NIGHT", 0), + ("ENTR_MARKET_GUARD_HOUSE_0", "SCENE_MARKET_GUARD_HOUSE", 0), + ("ENTR_MARKET_GUARD_HOUSE_0_1", "SCENE_MARKET_GUARD_HOUSE", 0), + ("ENTR_MARKET_GUARD_HOUSE_0_2", "SCENE_MARKET_GUARD_HOUSE", 0), + ("ENTR_MARKET_GUARD_HOUSE_0_3", "SCENE_MARKET_GUARD_HOUSE", 0), + ("ENTR_SPIRIT_TEMPLE_0", "SCENE_SPIRIT_TEMPLE", 0), + ("ENTR_SPIRIT_TEMPLE_0_1", "SCENE_SPIRIT_TEMPLE", 0), + ("ENTR_SPIRIT_TEMPLE_0_2", "SCENE_SPIRIT_TEMPLE", 0), + ("ENTR_SPIRIT_TEMPLE_0_3", "SCENE_SPIRIT_TEMPLE", 0), + ("ENTR_SPIRIT_TEMPLE_0_4", "SCENE_SPIRIT_TEMPLE", 0), + ("ENTR_SPIRIT_TEMPLE_0_5", "SCENE_SPIRIT_TEMPLE", 0), + ("ENTR_ICE_CAVERN_0", "SCENE_ICE_CAVERN", 0), + ("ENTR_ICE_CAVERN_0_1", "SCENE_ICE_CAVERN", 0), + ("ENTR_ICE_CAVERN_0_2", "SCENE_ICE_CAVERN", 0), + ("ENTR_ICE_CAVERN_0_3", "SCENE_ICE_CAVERN", 0), + ("ENTR_ICE_CAVERN_0_4", "SCENE_ICE_CAVERN", 0), + ("ENTR_SPIRIT_TEMPLE_BOSS_0", "SCENE_SPIRIT_TEMPLE_BOSS", 0), + ("ENTR_SPIRIT_TEMPLE_BOSS_0_1", "SCENE_SPIRIT_TEMPLE_BOSS", 0), + ("ENTR_SPIRIT_TEMPLE_BOSS_0_2", "SCENE_SPIRIT_TEMPLE_BOSS", 0), + ("ENTR_SPIRIT_TEMPLE_BOSS_0_3", "SCENE_SPIRIT_TEMPLE_BOSS", 0), + ("ENTR_SPIRIT_TEMPLE_BOSS_0_4", "SCENE_SPIRIT_TEMPLE_BOSS", 0), + ("ENTR_SPIRIT_TEMPLE_BOSS_0_5", "SCENE_SPIRIT_TEMPLE_BOSS", 0), + ("ENTR_SPIRIT_TEMPLE_BOSS_0_6", "SCENE_SPIRIT_TEMPLE_BOSS", 0), + ("ENTR_TEST01_0", "SCENE_TEST01", 0), + ("ENTR_TEST01_0_1", "SCENE_TEST01", 0), + ("ENTR_TEST01_0_2", "SCENE_TEST01", 0), + ("ENTR_TEST01_0_3", "SCENE_TEST01", 0), + ("ENTR_BOTTOM_OF_THE_WELL_0", "SCENE_BOTTOM_OF_THE_WELL", 0), + ("ENTR_BOTTOM_OF_THE_WELL_0_1", "SCENE_BOTTOM_OF_THE_WELL", 0), + ("ENTR_BOTTOM_OF_THE_WELL_0_2", "SCENE_BOTTOM_OF_THE_WELL", 0), + ("ENTR_BOTTOM_OF_THE_WELL_0_3", "SCENE_BOTTOM_OF_THE_WELL", 0), + ("ENTR_TWINS_HOUSE_0", "SCENE_TWINS_HOUSE", 0), + ("ENTR_TWINS_HOUSE_0_1", "SCENE_TWINS_HOUSE", 0), + ("ENTR_TWINS_HOUSE_0_2", "SCENE_TWINS_HOUSE", 0), + ("ENTR_TWINS_HOUSE_0_3", "SCENE_TWINS_HOUSE", 0), + ("ENTR_CUTSCENE_MAP_0", "SCENE_CUTSCENE_MAP", 0), + ("ENTR_CUTSCENE_MAP_0_1", "SCENE_CUTSCENE_MAP", 0), + ("ENTR_CUTSCENE_MAP_0_2", "SCENE_CUTSCENE_MAP", 0), + ("ENTR_CUTSCENE_MAP_0_3", "SCENE_CUTSCENE_MAP", 0), + ("ENTR_CUTSCENE_MAP_0_4", "SCENE_CUTSCENE_MAP", 0), + ("ENTR_CUTSCENE_MAP_0_5", "SCENE_CUTSCENE_MAP", 0), + ("ENTR_CUTSCENE_MAP_0_6", "SCENE_CUTSCENE_MAP", 0), + ("ENTR_CUTSCENE_MAP_0_7", "SCENE_CUTSCENE_MAP", 0), + ("ENTR_CUTSCENE_MAP_0_8", "SCENE_CUTSCENE_MAP", 0), + ("ENTR_CUTSCENE_MAP_0_9", "SCENE_CUTSCENE_MAP", 0), + ("ENTR_CUTSCENE_MAP_0_10", "SCENE_CUTSCENE_MAP", 0), + ("ENTR_CUTSCENE_MAP_0_11", "SCENE_CUTSCENE_MAP", 0), + ("ENTR_CUTSCENE_MAP_0_12", "SCENE_CUTSCENE_MAP", 0), + ("ENTR_BACK_ALLEY_DAY_0", "SCENE_BACK_ALLEY_DAY", 0), + ("ENTR_BACK_ALLEY_NIGHT_0_1", "SCENE_BACK_ALLEY_NIGHT", 0), + ("ENTR_BACK_ALLEY_DAY_0_2", "SCENE_BACK_ALLEY_DAY", 0), + ("ENTR_BACK_ALLEY_NIGHT_0_3", "SCENE_BACK_ALLEY_NIGHT", 0), + ("ENTR_MARKET_DAY_0", "SCENE_MARKET_DAY", 0), + ("ENTR_MARKET_NIGHT_0_1", "SCENE_MARKET_NIGHT", 0), + ("ENTR_MARKET_RUINS_0_2", "SCENE_MARKET_RUINS", 0), + ("ENTR_MARKET_RUINS_0_3", "SCENE_MARKET_RUINS", 0), + ("ENTR_MARKET_DAY_0_4", "SCENE_MARKET_DAY", 0), + ("ENTR_DEPTH_TEST_0", "SCENE_DEPTH_TEST", 0), + ("ENTR_BAZAAR_0", "SCENE_BAZAAR", 0), + ("ENTR_BAZAAR_0_1", "SCENE_BAZAAR", 0), + ("ENTR_BAZAAR_0_2", "SCENE_BAZAAR", 0), + ("ENTR_BAZAAR_0_3", "SCENE_BAZAAR", 0), + ("ENTR_LINKS_HOUSE_0", "SCENE_LINKS_HOUSE", 0), + ("ENTR_LINKS_HOUSE_0_1", "SCENE_LINKS_HOUSE", 0), + ("ENTR_LINKS_HOUSE_0_2", "SCENE_LINKS_HOUSE", 0), + ("ENTR_LINKS_HOUSE_0_3", "SCENE_LINKS_HOUSE", 0), + ("ENTR_LINKS_HOUSE_0_4", "SCENE_LINKS_HOUSE", 0), + ("ENTR_LINKS_HOUSE_0_5", "SCENE_LINKS_HOUSE", 0), + ("ENTR_KOKIRI_SHOP_0", "SCENE_KOKIRI_SHOP", 0), + ("ENTR_KOKIRI_SHOP_0_1", "SCENE_KOKIRI_SHOP", 0), + ("ENTR_KOKIRI_SHOP_0_2", "SCENE_KOKIRI_SHOP", 0), + ("ENTR_KOKIRI_SHOP_0_3", "SCENE_KOKIRI_SHOP", 0), + ("ENTR_DODONGOS_CAVERN_1", "SCENE_DODONGOS_CAVERN", 1), + ("ENTR_DODONGOS_CAVERN_1_1", "SCENE_DODONGOS_CAVERN", 1), + ("ENTR_DODONGOS_CAVERN_1_2", "SCENE_DODONGOS_CAVERN", 1), + ("ENTR_DODONGOS_CAVERN_1_3", "SCENE_DODONGOS_CAVERN", 1), + ("ENTR_KNOW_IT_ALL_BROS_HOUSE_0", "SCENE_KNOW_IT_ALL_BROS_HOUSE", 0), + ("ENTR_KNOW_IT_ALL_BROS_HOUSE_0_1", "SCENE_KNOW_IT_ALL_BROS_HOUSE", 0), + ("ENTR_KNOW_IT_ALL_BROS_HOUSE_0_2", "SCENE_KNOW_IT_ALL_BROS_HOUSE", 0), + ("ENTR_KNOW_IT_ALL_BROS_HOUSE_0_3", "SCENE_KNOW_IT_ALL_BROS_HOUSE", 0), + ("ENTR_HYRULE_FIELD_0", "SCENE_HYRULE_FIELD", 0), + ("ENTR_HYRULE_FIELD_0_1", "SCENE_HYRULE_FIELD", 0), + ("ENTR_HYRULE_FIELD_0_2", "SCENE_HYRULE_FIELD", 0), + ("ENTR_HYRULE_FIELD_0_3", "SCENE_HYRULE_FIELD", 0), + ("ENTR_HYRULE_FIELD_0_4", "SCENE_HYRULE_FIELD", 0), + ("ENTR_HYRULE_FIELD_0_5", "SCENE_HYRULE_FIELD", 0), + ("ENTR_HYRULE_FIELD_0_6", "SCENE_HYRULE_FIELD", 0), + ("ENTR_HYRULE_FIELD_0_7", "SCENE_HYRULE_FIELD", 0), + ("ENTR_HYRULE_FIELD_0_8", "SCENE_HYRULE_FIELD", 0), + ("ENTR_HYRULE_FIELD_0_9", "SCENE_HYRULE_FIELD", 0), + ("ENTR_HYRULE_FIELD_0_10", "SCENE_HYRULE_FIELD", 0), + ("ENTR_HYRULE_FIELD_0_11", "SCENE_HYRULE_FIELD", 0), + ("ENTR_HYRULE_FIELD_0_12", "SCENE_HYRULE_FIELD", 0), + ("ENTR_HYRULE_FIELD_0_13", "SCENE_HYRULE_FIELD", 0), + ("ENTR_KAKARIKO_VILLAGE_0", "SCENE_KAKARIKO_VILLAGE", 0), + ("ENTR_KAKARIKO_VILLAGE_0_1", "SCENE_KAKARIKO_VILLAGE", 0), + ("ENTR_KAKARIKO_VILLAGE_0_2", "SCENE_KAKARIKO_VILLAGE", 0), + ("ENTR_KAKARIKO_VILLAGE_0_3", "SCENE_KAKARIKO_VILLAGE", 0), + ("ENTR_KAKARIKO_VILLAGE_0_4", "SCENE_KAKARIKO_VILLAGE", 0), + ("ENTR_KAKARIKO_VILLAGE_0_5", "SCENE_KAKARIKO_VILLAGE", 0), + ("ENTR_KAKARIKO_VILLAGE_0_6", "SCENE_KAKARIKO_VILLAGE", 0), + ("ENTR_KAKARIKO_VILLAGE_0_7", "SCENE_KAKARIKO_VILLAGE", 0), + ("ENTR_KAKARIKO_VILLAGE_0_8", "SCENE_KAKARIKO_VILLAGE", 0), + ("ENTR_GRAVEYARD_0", "SCENE_GRAVEYARD", 0), + ("ENTR_GRAVEYARD_0_1", "SCENE_GRAVEYARD", 0), + ("ENTR_GRAVEYARD_0_2", "SCENE_GRAVEYARD", 0), + ("ENTR_GRAVEYARD_0_3", "SCENE_GRAVEYARD", 0), + ("ENTR_GRAVEYARD_0_4", "SCENE_GRAVEYARD", 0), + ("ENTR_GRAVEYARD_0_5", "SCENE_GRAVEYARD", 0), + ("ENTR_ZORAS_RIVER_0", "SCENE_ZORAS_RIVER", 0), + ("ENTR_ZORAS_RIVER_0_1", "SCENE_ZORAS_RIVER", 0), + ("ENTR_ZORAS_RIVER_0_2", "SCENE_ZORAS_RIVER", 0), + ("ENTR_ZORAS_RIVER_0_3", "SCENE_ZORAS_RIVER", 0), + ("ENTR_KOKIRI_FOREST_0", "SCENE_KOKIRI_FOREST", 0), + ("ENTR_KOKIRI_FOREST_0_1", "SCENE_KOKIRI_FOREST", 0), + ("ENTR_KOKIRI_FOREST_0_2", "SCENE_KOKIRI_FOREST", 0), + ("ENTR_KOKIRI_FOREST_0_3", "SCENE_KOKIRI_FOREST", 0), + ("ENTR_KOKIRI_FOREST_0_4", "SCENE_KOKIRI_FOREST", 0), + ("ENTR_KOKIRI_FOREST_0_5", "SCENE_KOKIRI_FOREST", 0), + ("ENTR_KOKIRI_FOREST_0_6", "SCENE_KOKIRI_FOREST", 0), + ("ENTR_KOKIRI_FOREST_0_7", "SCENE_KOKIRI_FOREST", 0), + ("ENTR_KOKIRI_FOREST_0_8", "SCENE_KOKIRI_FOREST", 0), + ("ENTR_KOKIRI_FOREST_0_9", "SCENE_KOKIRI_FOREST", 0), + ("ENTR_KOKIRI_FOREST_0_10", "SCENE_KOKIRI_FOREST", 0), + ("ENTR_KOKIRI_FOREST_0_11", "SCENE_KOKIRI_FOREST", 0), + ("ENTR_KOKIRI_FOREST_0_12", "SCENE_KOKIRI_FOREST", 0), + ("ENTR_KOKIRI_FOREST_0_13", "SCENE_KOKIRI_FOREST", 0), + ("ENTR_SACRED_FOREST_MEADOW_0", "SCENE_SACRED_FOREST_MEADOW", 0), + ("ENTR_SACRED_FOREST_MEADOW_0_1", "SCENE_SACRED_FOREST_MEADOW", 0), + ("ENTR_SACRED_FOREST_MEADOW_0_2", "SCENE_SACRED_FOREST_MEADOW", 0), + ("ENTR_SACRED_FOREST_MEADOW_0_3", "SCENE_SACRED_FOREST_MEADOW", 0), + ("ENTR_SACRED_FOREST_MEADOW_0_4", "SCENE_SACRED_FOREST_MEADOW", 0), + ("ENTR_SACRED_FOREST_MEADOW_0_5", "SCENE_SACRED_FOREST_MEADOW", 0), + ("ENTR_LAKE_HYLIA_0", "SCENE_LAKE_HYLIA", 0), + ("ENTR_LAKE_HYLIA_0_1", "SCENE_LAKE_HYLIA", 0), + ("ENTR_LAKE_HYLIA_0_2", "SCENE_LAKE_HYLIA", 0), + ("ENTR_LAKE_HYLIA_0_3", "SCENE_LAKE_HYLIA", 0), + ("ENTR_LAKE_HYLIA_0_4", "SCENE_LAKE_HYLIA", 0), + ("ENTR_LAKE_HYLIA_0_5", "SCENE_LAKE_HYLIA", 0), + ("ENTR_ZORAS_DOMAIN_0", "SCENE_ZORAS_DOMAIN", 0), + ("ENTR_ZORAS_DOMAIN_0_1", "SCENE_ZORAS_DOMAIN", 0), + ("ENTR_ZORAS_DOMAIN_0_2", "SCENE_ZORAS_DOMAIN", 0), + ("ENTR_ZORAS_DOMAIN_0_3", "SCENE_ZORAS_DOMAIN", 0), + ("ENTR_ZORAS_DOMAIN_0_4", "SCENE_ZORAS_DOMAIN", 0), + ("ENTR_ZORAS_DOMAIN_0_5", "SCENE_ZORAS_DOMAIN", 0), + ("ENTR_ZORAS_FOUNTAIN_0", "SCENE_ZORAS_FOUNTAIN", 0), + ("ENTR_ZORAS_FOUNTAIN_0_1", "SCENE_ZORAS_FOUNTAIN", 0), + ("ENTR_ZORAS_FOUNTAIN_0_2", "SCENE_ZORAS_FOUNTAIN", 0), + ("ENTR_ZORAS_FOUNTAIN_0_3", "SCENE_ZORAS_FOUNTAIN", 0), + ("ENTR_ZORAS_FOUNTAIN_0_4", "SCENE_ZORAS_FOUNTAIN", 0), + ("ENTR_ZORAS_FOUNTAIN_0_5", "SCENE_ZORAS_FOUNTAIN", 0), + ("ENTR_ZORAS_FOUNTAIN_0_6", "SCENE_ZORAS_FOUNTAIN", 0), + ("ENTR_ZORAS_FOUNTAIN_0_7", "SCENE_ZORAS_FOUNTAIN", 0), + ("ENTR_ZORAS_FOUNTAIN_0_8", "SCENE_ZORAS_FOUNTAIN", 0), + ("ENTR_GERUDO_VALLEY_0", "SCENE_GERUDO_VALLEY", 0), + ("ENTR_GERUDO_VALLEY_0_1", "SCENE_GERUDO_VALLEY", 0), + ("ENTR_GERUDO_VALLEY_0_2", "SCENE_GERUDO_VALLEY", 0), + ("ENTR_GERUDO_VALLEY_0_3", "SCENE_GERUDO_VALLEY", 0), + ("ENTR_GERUDO_VALLEY_0_4", "SCENE_GERUDO_VALLEY", 0), + ("ENTR_GERUDO_VALLEY_0_5", "SCENE_GERUDO_VALLEY", 0), + ("ENTR_GERUDO_VALLEY_0_6", "SCENE_GERUDO_VALLEY", 0), + ("ENTR_LOST_WOODS_0", "SCENE_LOST_WOODS", 0), + ("ENTR_LOST_WOODS_0_1", "SCENE_LOST_WOODS", 0), + ("ENTR_LOST_WOODS_0_2", "SCENE_LOST_WOODS", 0), + ("ENTR_LOST_WOODS_0_3", "SCENE_LOST_WOODS", 0), + ("ENTR_LOST_WOODS_0_4", "SCENE_LOST_WOODS", 0), + ("ENTR_DESERT_COLOSSUS_0", "SCENE_DESERT_COLOSSUS", 0), + ("ENTR_DESERT_COLOSSUS_0_1", "SCENE_DESERT_COLOSSUS", 0), + ("ENTR_DESERT_COLOSSUS_0_2", "SCENE_DESERT_COLOSSUS", 0), + ("ENTR_DESERT_COLOSSUS_0_3", "SCENE_DESERT_COLOSSUS", 0), + ("ENTR_DESERT_COLOSSUS_0_4", "SCENE_DESERT_COLOSSUS", 0), + ("ENTR_DESERT_COLOSSUS_0_5", "SCENE_DESERT_COLOSSUS", 0), + ("ENTR_GERUDOS_FORTRESS_0", "SCENE_GERUDOS_FORTRESS", 0), + ("ENTR_GERUDOS_FORTRESS_0_1", "SCENE_GERUDOS_FORTRESS", 0), + ("ENTR_GERUDOS_FORTRESS_0_2", "SCENE_GERUDOS_FORTRESS", 0), + ("ENTR_GERUDOS_FORTRESS_0_3", "SCENE_GERUDOS_FORTRESS", 0), + ("ENTR_GERUDOS_FORTRESS_0_4", "SCENE_GERUDOS_FORTRESS", 0), + ("ENTR_GERUDOS_FORTRESS_0_5", "SCENE_GERUDOS_FORTRESS", 0), + ("ENTR_GERUDOS_FORTRESS_0_6", "SCENE_GERUDOS_FORTRESS", 0), + ("ENTR_HAUNTED_WASTELAND_0", "SCENE_HAUNTED_WASTELAND", 0), + ("ENTR_HAUNTED_WASTELAND_0_1", "SCENE_HAUNTED_WASTELAND", 0), + ("ENTR_HAUNTED_WASTELAND_0_2", "SCENE_HAUNTED_WASTELAND", 0), + ("ENTR_HAUNTED_WASTELAND_0_3", "SCENE_HAUNTED_WASTELAND", 0), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_1", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 1), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_1_1", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 1), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_1_2", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 1), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_1_3", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 1), + ("ENTR_HYRULE_CASTLE_0", "SCENE_HYRULE_CASTLE", 0), + ("ENTR_HYRULE_CASTLE_0_1", "SCENE_HYRULE_CASTLE", 0), + ("ENTR_OUTSIDE_GANONS_CASTLE_0_2", "SCENE_OUTSIDE_GANONS_CASTLE", 0), + ("ENTR_OUTSIDE_GANONS_CASTLE_0_3", "SCENE_OUTSIDE_GANONS_CASTLE", 0), + ("ENTR_OUTSIDE_GANONS_CASTLE_0_4", "SCENE_OUTSIDE_GANONS_CASTLE", 0), + ("ENTR_DEATH_MOUNTAIN_TRAIL_0", "SCENE_DEATH_MOUNTAIN_TRAIL", 0), + ("ENTR_DEATH_MOUNTAIN_TRAIL_0_1", "SCENE_DEATH_MOUNTAIN_TRAIL", 0), + ("ENTR_DEATH_MOUNTAIN_TRAIL_0_2", "SCENE_DEATH_MOUNTAIN_TRAIL", 0), + ("ENTR_DEATH_MOUNTAIN_TRAIL_0_3", "SCENE_DEATH_MOUNTAIN_TRAIL", 0), + ("ENTR_DEATH_MOUNTAIN_TRAIL_0_4", "SCENE_DEATH_MOUNTAIN_TRAIL", 0), + ("ENTR_DEATH_MOUNTAIN_TRAIL_0_5", "SCENE_DEATH_MOUNTAIN_TRAIL", 0), + ("ENTR_DEATH_MOUNTAIN_TRAIL_0_6", "SCENE_DEATH_MOUNTAIN_TRAIL", 0), + ("ENTR_DEATH_MOUNTAIN_TRAIL_0_7", "SCENE_DEATH_MOUNTAIN_TRAIL", 0), + ("ENTR_DEATH_MOUNTAIN_TRAIL_0_8", "SCENE_DEATH_MOUNTAIN_TRAIL", 0), + ("ENTR_DEATH_MOUNTAIN_TRAIL_0_9", "SCENE_DEATH_MOUNTAIN_TRAIL", 0), + ("ENTR_DEATH_MOUNTAIN_CRATER_0", "SCENE_DEATH_MOUNTAIN_CRATER", 0), + ("ENTR_DEATH_MOUNTAIN_CRATER_0_1", "SCENE_DEATH_MOUNTAIN_CRATER", 0), + ("ENTR_DEATH_MOUNTAIN_CRATER_0_2", "SCENE_DEATH_MOUNTAIN_CRATER", 0), + ("ENTR_DEATH_MOUNTAIN_CRATER_0_3", "SCENE_DEATH_MOUNTAIN_CRATER", 0), + ("ENTR_DEATH_MOUNTAIN_CRATER_0_4", "SCENE_DEATH_MOUNTAIN_CRATER", 0), + ("ENTR_DEATH_MOUNTAIN_CRATER_0_5", "SCENE_DEATH_MOUNTAIN_CRATER", 0), + ("ENTR_GORON_CITY_0", "SCENE_GORON_CITY", 0), + ("ENTR_GORON_CITY_0_1", "SCENE_GORON_CITY", 0), + ("ENTR_GORON_CITY_0_2", "SCENE_GORON_CITY", 0), + ("ENTR_GORON_CITY_0_3", "SCENE_GORON_CITY", 0), + ("ENTR_GORON_CITY_0_4", "SCENE_GORON_CITY", 0), + ("ENTR_GORON_CITY_0_5", "SCENE_GORON_CITY", 0), + ("ENTR_ZORAS_DOMAIN_3", "SCENE_ZORAS_DOMAIN", 3), + ("ENTR_ZORAS_DOMAIN_3_1", "SCENE_ZORAS_DOMAIN", 3), + ("ENTR_ZORAS_DOMAIN_3_2", "SCENE_ZORAS_DOMAIN", 3), + ("ENTR_ZORAS_DOMAIN_3_3", "SCENE_ZORAS_DOMAIN", 3), + ("ENTR_LON_LON_RANCH_0", "SCENE_LON_LON_RANCH", 0), + ("ENTR_LON_LON_RANCH_0_1", "SCENE_LON_LON_RANCH", 0), + ("ENTR_LON_LON_RANCH_0_2", "SCENE_LON_LON_RANCH", 0), + ("ENTR_LON_LON_RANCH_0_3", "SCENE_LON_LON_RANCH", 0), + ("ENTR_LON_LON_RANCH_0_4", "SCENE_LON_LON_RANCH", 0), + ("ENTR_LON_LON_RANCH_0_5", "SCENE_LON_LON_RANCH", 0), + ("ENTR_LON_LON_RANCH_0_6", "SCENE_LON_LON_RANCH", 0), + ("ENTR_LON_LON_RANCH_0_7", "SCENE_LON_LON_RANCH", 0), + ("ENTR_LON_LON_RANCH_0_8", "SCENE_LON_LON_RANCH", 0), + ("ENTR_LON_LON_RANCH_0_9", "SCENE_LON_LON_RANCH", 0), + ("ENTR_LON_LON_RANCH_0_10", "SCENE_LON_LON_RANCH", 0), + ("ENTR_LON_LON_RANCH_0_11", "SCENE_LON_LON_RANCH", 0), + ("ENTR_LON_LON_RANCH_0_12", "SCENE_LON_LON_RANCH", 0), + ("ENTR_LON_LON_RANCH_0_13", "SCENE_LON_LON_RANCH", 0), + ("ENTR_FIRE_TEMPLE_0", "SCENE_FIRE_TEMPLE", 0), + ("ENTR_FIRE_TEMPLE_0_1", "SCENE_FIRE_TEMPLE", 0), + ("ENTR_FIRE_TEMPLE_0_2", "SCENE_FIRE_TEMPLE", 0), + ("ENTR_FIRE_TEMPLE_0_3", "SCENE_FIRE_TEMPLE", 0), + ("ENTR_FOREST_TEMPLE_0", "SCENE_FOREST_TEMPLE", 0), + ("ENTR_FOREST_TEMPLE_0_1", "SCENE_FOREST_TEMPLE", 0), + ("ENTR_FOREST_TEMPLE_0_2", "SCENE_FOREST_TEMPLE", 0), + ("ENTR_FOREST_TEMPLE_0_3", "SCENE_FOREST_TEMPLE", 0), + ("ENTR_SHOOTING_GALLERY_1", "SCENE_SHOOTING_GALLERY", 1), + ("ENTR_SHOOTING_GALLERY_1_1", "SCENE_SHOOTING_GALLERY", 1), + ("ENTR_SHOOTING_GALLERY_1_2", "SCENE_SHOOTING_GALLERY", 1), + ("ENTR_SHOOTING_GALLERY_1_3", "SCENE_SHOOTING_GALLERY", 1), + ("ENTR_TEMPLE_OF_TIME_EXTERIOR_DAY_0", "SCENE_TEMPLE_OF_TIME_EXTERIOR_DAY", 0), + ("ENTR_TEMPLE_OF_TIME_EXTERIOR_NIGHT_0_1", "SCENE_TEMPLE_OF_TIME_EXTERIOR_NIGHT", 0), + ("ENTR_TEMPLE_OF_TIME_EXTERIOR_RUINS_0_2", "SCENE_TEMPLE_OF_TIME_EXTERIOR_RUINS", 0), + ("ENTR_TEMPLE_OF_TIME_EXTERIOR_RUINS_0_3", "SCENE_TEMPLE_OF_TIME_EXTERIOR_RUINS", 0), + ("ENTR_FIRE_TEMPLE_1", "SCENE_FIRE_TEMPLE", 1), + ("ENTR_FIRE_TEMPLE_1_1", "SCENE_FIRE_TEMPLE", 1), + ("ENTR_FIRE_TEMPLE_1_2", "SCENE_FIRE_TEMPLE", 1), + ("ENTR_FIRE_TEMPLE_1_3", "SCENE_FIRE_TEMPLE", 1), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_0", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 0), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_0_1", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 0), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_0_2", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 0), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_0_3", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 0), + ("ENTR_HYRULE_FIELD_1", "SCENE_HYRULE_FIELD", 1), + ("ENTR_HYRULE_FIELD_1_1", "SCENE_HYRULE_FIELD", 1), + ("ENTR_HYRULE_FIELD_1_2", "SCENE_HYRULE_FIELD", 1), + ("ENTR_HYRULE_FIELD_1_3", "SCENE_HYRULE_FIELD", 1), + ("ENTR_HYRULE_FIELD_2", "SCENE_HYRULE_FIELD", 2), + ("ENTR_HYRULE_FIELD_2_1", "SCENE_HYRULE_FIELD", 2), + ("ENTR_HYRULE_FIELD_2_2", "SCENE_HYRULE_FIELD", 2), + ("ENTR_HYRULE_FIELD_2_3", "SCENE_HYRULE_FIELD", 2), + ("ENTR_HYRULE_FIELD_3", "SCENE_HYRULE_FIELD", 3), + ("ENTR_HYRULE_FIELD_3_1", "SCENE_HYRULE_FIELD", 3), + ("ENTR_HYRULE_FIELD_3_2", "SCENE_HYRULE_FIELD", 3), + ("ENTR_HYRULE_FIELD_3_3", "SCENE_HYRULE_FIELD", 3), + ("ENTR_HYRULE_FIELD_4", "SCENE_HYRULE_FIELD", 4), + ("ENTR_HYRULE_FIELD_4_1", "SCENE_HYRULE_FIELD", 4), + ("ENTR_HYRULE_FIELD_4_2", "SCENE_HYRULE_FIELD", 4), + ("ENTR_HYRULE_FIELD_4_3", "SCENE_HYRULE_FIELD", 4), + ("ENTR_HYRULE_FIELD_5", "SCENE_HYRULE_FIELD", 5), + ("ENTR_HYRULE_FIELD_5_1", "SCENE_HYRULE_FIELD", 5), + ("ENTR_HYRULE_FIELD_5_2", "SCENE_HYRULE_FIELD", 5), + ("ENTR_HYRULE_FIELD_5_3", "SCENE_HYRULE_FIELD", 5), + ("ENTR_KAKARIKO_VILLAGE_1", "SCENE_KAKARIKO_VILLAGE", 1), + ("ENTR_KAKARIKO_VILLAGE_1_1", "SCENE_KAKARIKO_VILLAGE", 1), + ("ENTR_KAKARIKO_VILLAGE_1_2", "SCENE_KAKARIKO_VILLAGE", 1), + ("ENTR_KAKARIKO_VILLAGE_1_3", "SCENE_KAKARIKO_VILLAGE", 1), + ("ENTR_KAKARIKO_VILLAGE_2", "SCENE_KAKARIKO_VILLAGE", 2), + ("ENTR_KAKARIKO_VILLAGE_2_1", "SCENE_KAKARIKO_VILLAGE", 2), + ("ENTR_KAKARIKO_VILLAGE_2_2", "SCENE_KAKARIKO_VILLAGE", 2), + ("ENTR_KAKARIKO_VILLAGE_2_3", "SCENE_KAKARIKO_VILLAGE", 2), + ("ENTR_ZORAS_RIVER_1", "SCENE_ZORAS_RIVER", 1), + ("ENTR_ZORAS_RIVER_1_1", "SCENE_ZORAS_RIVER", 1), + ("ENTR_ZORAS_RIVER_1_2", "SCENE_ZORAS_RIVER", 1), + ("ENTR_ZORAS_RIVER_1_3", "SCENE_ZORAS_RIVER", 1), + ("ENTR_ZORAS_RIVER_2", "SCENE_ZORAS_RIVER", 2), + ("ENTR_ZORAS_RIVER_2_1", "SCENE_ZORAS_RIVER", 2), + ("ENTR_ZORAS_RIVER_2_2", "SCENE_ZORAS_RIVER", 2), + ("ENTR_ZORAS_RIVER_2_3", "SCENE_ZORAS_RIVER", 2), + ("ENTR_ZORAS_DOMAIN_1", "SCENE_ZORAS_DOMAIN", 1), + ("ENTR_ZORAS_DOMAIN_1_1", "SCENE_ZORAS_DOMAIN", 1), + ("ENTR_ZORAS_DOMAIN_1_2", "SCENE_ZORAS_DOMAIN", 1), + ("ENTR_ZORAS_DOMAIN_1_3", "SCENE_ZORAS_DOMAIN", 1), + ("ENTR_GERUDO_VALLEY_1", "SCENE_GERUDO_VALLEY", 1), + ("ENTR_GERUDO_VALLEY_1_1", "SCENE_GERUDO_VALLEY", 1), + ("ENTR_GERUDO_VALLEY_1_2", "SCENE_GERUDO_VALLEY", 1), + ("ENTR_GERUDO_VALLEY_1_3", "SCENE_GERUDO_VALLEY", 1), + ("ENTR_LOST_WOODS_1", "SCENE_LOST_WOODS", 1), + ("ENTR_LOST_WOODS_1_1", "SCENE_LOST_WOODS", 1), + ("ENTR_LOST_WOODS_1_2", "SCENE_LOST_WOODS", 1), + ("ENTR_LOST_WOODS_1_3", "SCENE_LOST_WOODS", 1), + ("ENTR_LOST_WOODS_2", "SCENE_LOST_WOODS", 2), + ("ENTR_LOST_WOODS_2_1", "SCENE_LOST_WOODS", 2), + ("ENTR_LOST_WOODS_2_2", "SCENE_LOST_WOODS", 2), + ("ENTR_LOST_WOODS_2_3", "SCENE_LOST_WOODS", 2), + ("ENTR_LOST_WOODS_3", "SCENE_LOST_WOODS", 3), + ("ENTR_LOST_WOODS_3_1", "SCENE_LOST_WOODS", 3), + ("ENTR_LOST_WOODS_3_2", "SCENE_LOST_WOODS", 3), + ("ENTR_LOST_WOODS_3_3", "SCENE_LOST_WOODS", 3), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_2", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 2), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_2_1", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 2), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_2_2", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 2), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_2_3", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 2), + ("ENTR_DEATH_MOUNTAIN_TRAIL_1", "SCENE_DEATH_MOUNTAIN_TRAIL", 1), + ("ENTR_DEATH_MOUNTAIN_TRAIL_1_1", "SCENE_DEATH_MOUNTAIN_TRAIL", 1), + ("ENTR_DEATH_MOUNTAIN_TRAIL_1_2", "SCENE_DEATH_MOUNTAIN_TRAIL", 1), + ("ENTR_DEATH_MOUNTAIN_TRAIL_1_3", "SCENE_DEATH_MOUNTAIN_TRAIL", 1), + ("ENTR_DEATH_MOUNTAIN_TRAIL_2", "SCENE_DEATH_MOUNTAIN_TRAIL", 2), + ("ENTR_DEATH_MOUNTAIN_TRAIL_2_1", "SCENE_DEATH_MOUNTAIN_TRAIL", 2), + ("ENTR_DEATH_MOUNTAIN_TRAIL_2_2", "SCENE_DEATH_MOUNTAIN_TRAIL", 2), + ("ENTR_DEATH_MOUNTAIN_TRAIL_2_3", "SCENE_DEATH_MOUNTAIN_TRAIL", 2), + ("ENTR_GORON_CITY_1", "SCENE_GORON_CITY", 1), + ("ENTR_GORON_CITY_1_1", "SCENE_GORON_CITY", 1), + ("ENTR_GORON_CITY_1_2", "SCENE_GORON_CITY", 1), + ("ENTR_GORON_CITY_1_3", "SCENE_GORON_CITY", 1), + ("ENTR_LAKESIDE_LABORATORY_1", "SCENE_LAKESIDE_LABORATORY", 1), + ("ENTR_LAKESIDE_LABORATORY_1_1", "SCENE_LAKESIDE_LABORATORY", 1), + ("ENTR_LAKESIDE_LABORATORY_1_2", "SCENE_LAKESIDE_LABORATORY", 1), + ("ENTR_LAKESIDE_LABORATORY_1_3", "SCENE_LAKESIDE_LABORATORY", 1), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_5", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 5), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_5_1", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 5), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_5_2", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 5), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_5_3", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 5), + ("ENTR_MARKET_DAY_8", "SCENE_MARKET_DAY", 8), + ("ENTR_MARKET_NIGHT_8_1", "SCENE_MARKET_NIGHT", 8), + ("ENTR_MARKET_RUINS_8_2", "SCENE_MARKET_RUINS", 8), + ("ENTR_MARKET_RUINS_8_3", "SCENE_MARKET_RUINS", 8), + ("ENTR_MARKET_DAY_9", "SCENE_MARKET_DAY", 9), + ("ENTR_MARKET_NIGHT_9_1", "SCENE_MARKET_NIGHT", 9), + ("ENTR_MARKET_RUINS_9_2", "SCENE_MARKET_RUINS", 9), + ("ENTR_MARKET_RUINS_9_3", "SCENE_MARKET_RUINS", 9), + ("ENTR_MARKET_DAY_10", "SCENE_MARKET_DAY", 10), + ("ENTR_MARKET_NIGHT_10_1", "SCENE_MARKET_NIGHT", 10), + ("ENTR_MARKET_RUINS_10_2", "SCENE_MARKET_RUINS", 10), + ("ENTR_MARKET_RUINS_10_3", "SCENE_MARKET_RUINS", 10), + ("ENTR_ZORAS_RIVER_3", "SCENE_ZORAS_RIVER", 3), + ("ENTR_ZORAS_RIVER_3_1", "SCENE_ZORAS_RIVER", 3), + ("ENTR_ZORAS_RIVER_3_2", "SCENE_ZORAS_RIVER", 3), + ("ENTR_ZORAS_RIVER_3_3", "SCENE_ZORAS_RIVER", 3), + ("ENTR_ZORAS_RIVER_4", "SCENE_ZORAS_RIVER", 4), + ("ENTR_ZORAS_RIVER_4_1", "SCENE_ZORAS_RIVER", 4), + ("ENTR_ZORAS_RIVER_4_2", "SCENE_ZORAS_RIVER", 4), + ("ENTR_ZORAS_RIVER_4_3", "SCENE_ZORAS_RIVER", 4), + ("ENTR_DESERT_COLOSSUS_1", "SCENE_DESERT_COLOSSUS", 1), + ("ENTR_DESERT_COLOSSUS_1_1", "SCENE_DESERT_COLOSSUS", 1), + ("ENTR_DESERT_COLOSSUS_1_2", "SCENE_DESERT_COLOSSUS", 1), + ("ENTR_DESERT_COLOSSUS_1_3", "SCENE_DESERT_COLOSSUS", 1), + ("ENTR_DESERT_COLOSSUS_2", "SCENE_DESERT_COLOSSUS", 2), + ("ENTR_DESERT_COLOSSUS_2_1", "SCENE_DESERT_COLOSSUS", 2), + ("ENTR_DESERT_COLOSSUS_2_2", "SCENE_DESERT_COLOSSUS", 2), + ("ENTR_DESERT_COLOSSUS_2_3", "SCENE_DESERT_COLOSSUS", 2), + ("ENTR_DESERT_COLOSSUS_3", "SCENE_DESERT_COLOSSUS", 3), + ("ENTR_DESERT_COLOSSUS_3_1", "SCENE_DESERT_COLOSSUS", 3), + ("ENTR_DESERT_COLOSSUS_3_2", "SCENE_DESERT_COLOSSUS", 3), + ("ENTR_DESERT_COLOSSUS_3_3", "SCENE_DESERT_COLOSSUS", 3), + ("ENTR_DESERT_COLOSSUS_4", "SCENE_DESERT_COLOSSUS", 4), + ("ENTR_DESERT_COLOSSUS_4_1", "SCENE_DESERT_COLOSSUS", 4), + ("ENTR_DESERT_COLOSSUS_4_2", "SCENE_DESERT_COLOSSUS", 4), + ("ENTR_DESERT_COLOSSUS_4_3", "SCENE_DESERT_COLOSSUS", 4), + ("ENTR_DESERT_COLOSSUS_5", "SCENE_DESERT_COLOSSUS", 5), + ("ENTR_DESERT_COLOSSUS_5_1", "SCENE_DESERT_COLOSSUS", 5), + ("ENTR_DESERT_COLOSSUS_5_2", "SCENE_DESERT_COLOSSUS", 5), + ("ENTR_DESERT_COLOSSUS_5_3", "SCENE_DESERT_COLOSSUS", 5), + ("ENTR_DESERT_COLOSSUS_6", "SCENE_DESERT_COLOSSUS", 6), + ("ENTR_DESERT_COLOSSUS_6_1", "SCENE_DESERT_COLOSSUS", 6), + ("ENTR_DESERT_COLOSSUS_6_2", "SCENE_DESERT_COLOSSUS", 6), + ("ENTR_DESERT_COLOSSUS_6_3", "SCENE_DESERT_COLOSSUS", 6), + ("ENTR_HYRULE_FIELD_6", "SCENE_HYRULE_FIELD", 6), + ("ENTR_HYRULE_FIELD_6_1", "SCENE_HYRULE_FIELD", 6), + ("ENTR_HYRULE_FIELD_6_2", "SCENE_HYRULE_FIELD", 6), + ("ENTR_HYRULE_FIELD_6_3", "SCENE_HYRULE_FIELD", 6), + ("ENTR_HYRULE_FIELD_7", "SCENE_HYRULE_FIELD", 7), + ("ENTR_HYRULE_FIELD_7_1", "SCENE_HYRULE_FIELD", 7), + ("ENTR_HYRULE_FIELD_7_2", "SCENE_HYRULE_FIELD", 7), + ("ENTR_HYRULE_FIELD_7_3", "SCENE_HYRULE_FIELD", 7), + ("ENTR_KAKARIKO_VILLAGE_3", "SCENE_KAKARIKO_VILLAGE", 3), + ("ENTR_KAKARIKO_VILLAGE_3_1", "SCENE_KAKARIKO_VILLAGE", 3), + ("ENTR_KAKARIKO_VILLAGE_3_2", "SCENE_KAKARIKO_VILLAGE", 3), + ("ENTR_KAKARIKO_VILLAGE_3_3", "SCENE_KAKARIKO_VILLAGE", 3), + ("ENTR_GRAVEYARD_1", "SCENE_GRAVEYARD", 1), + ("ENTR_GRAVEYARD_1_1", "SCENE_GRAVEYARD", 1), + ("ENTR_GRAVEYARD_1_2", "SCENE_GRAVEYARD", 1), + ("ENTR_GRAVEYARD_1_3", "SCENE_GRAVEYARD", 1), + ("ENTR_KOKIRI_FOREST_1", "SCENE_KOKIRI_FOREST", 1), + ("ENTR_KOKIRI_FOREST_1_1", "SCENE_KOKIRI_FOREST", 1), + ("ENTR_KOKIRI_FOREST_1_2", "SCENE_KOKIRI_FOREST", 1), + ("ENTR_KOKIRI_FOREST_1_3", "SCENE_KOKIRI_FOREST", 1), + ("ENTR_KOKIRI_FOREST_2", "SCENE_KOKIRI_FOREST", 2), + ("ENTR_KOKIRI_FOREST_2_1", "SCENE_KOKIRI_FOREST", 2), + ("ENTR_KOKIRI_FOREST_2_2", "SCENE_KOKIRI_FOREST", 2), + ("ENTR_KOKIRI_FOREST_2_3", "SCENE_KOKIRI_FOREST", 2), + ("ENTR_KOKIRI_FOREST_3", "SCENE_KOKIRI_FOREST", 3), + ("ENTR_KOKIRI_FOREST_3_1", "SCENE_KOKIRI_FOREST", 3), + ("ENTR_KOKIRI_FOREST_3_2", "SCENE_KOKIRI_FOREST", 3), + ("ENTR_KOKIRI_FOREST_3_3", "SCENE_KOKIRI_FOREST", 3), + ("ENTR_SACRED_FOREST_MEADOW_1", "SCENE_SACRED_FOREST_MEADOW", 1), + ("ENTR_SACRED_FOREST_MEADOW_1_1", "SCENE_SACRED_FOREST_MEADOW", 1), + ("ENTR_SACRED_FOREST_MEADOW_1_2", "SCENE_SACRED_FOREST_MEADOW", 1), + ("ENTR_SACRED_FOREST_MEADOW_1_3", "SCENE_SACRED_FOREST_MEADOW", 1), + ("ENTR_LAKE_HYLIA_1", "SCENE_LAKE_HYLIA", 1), + ("ENTR_LAKE_HYLIA_1_1", "SCENE_LAKE_HYLIA", 1), + ("ENTR_LAKE_HYLIA_1_2", "SCENE_LAKE_HYLIA", 1), + ("ENTR_LAKE_HYLIA_1_3", "SCENE_LAKE_HYLIA", 1), + ("ENTR_LAKE_HYLIA_2", "SCENE_LAKE_HYLIA", 2), + ("ENTR_LAKE_HYLIA_2_1", "SCENE_LAKE_HYLIA", 2), + ("ENTR_LAKE_HYLIA_2_2", "SCENE_LAKE_HYLIA", 2), + ("ENTR_LAKE_HYLIA_2_3", "SCENE_LAKE_HYLIA", 2), + ("ENTR_ZORAS_FOUNTAIN_1", "SCENE_ZORAS_FOUNTAIN", 1), + ("ENTR_ZORAS_FOUNTAIN_1_1", "SCENE_ZORAS_FOUNTAIN", 1), + ("ENTR_ZORAS_FOUNTAIN_1_2", "SCENE_ZORAS_FOUNTAIN", 1), + ("ENTR_ZORAS_FOUNTAIN_1_3", "SCENE_ZORAS_FOUNTAIN", 1), + ("ENTR_ZORAS_FOUNTAIN_2", "SCENE_ZORAS_FOUNTAIN", 2), + ("ENTR_ZORAS_FOUNTAIN_2_1", "SCENE_ZORAS_FOUNTAIN", 2), + ("ENTR_ZORAS_FOUNTAIN_2_2", "SCENE_ZORAS_FOUNTAIN", 2), + ("ENTR_ZORAS_FOUNTAIN_2_3", "SCENE_ZORAS_FOUNTAIN", 2), + ("ENTR_GERUDO_VALLEY_2", "SCENE_GERUDO_VALLEY", 2), + ("ENTR_GERUDO_VALLEY_2_1", "SCENE_GERUDO_VALLEY", 2), + ("ENTR_GERUDO_VALLEY_2_2", "SCENE_GERUDO_VALLEY", 2), + ("ENTR_GERUDO_VALLEY_2_3", "SCENE_GERUDO_VALLEY", 2), + ("ENTR_GERUDO_VALLEY_3", "SCENE_GERUDO_VALLEY", 3), + ("ENTR_GERUDO_VALLEY_3_1", "SCENE_GERUDO_VALLEY", 3), + ("ENTR_GERUDO_VALLEY_3_2", "SCENE_GERUDO_VALLEY", 3), + ("ENTR_GERUDO_VALLEY_3_3", "SCENE_GERUDO_VALLEY", 3), + ("ENTR_GERUDOS_FORTRESS_1", "SCENE_GERUDOS_FORTRESS", 1), + ("ENTR_GERUDOS_FORTRESS_1_1", "SCENE_GERUDOS_FORTRESS", 1), + ("ENTR_GERUDOS_FORTRESS_1_2", "SCENE_GERUDOS_FORTRESS", 1), + ("ENTR_GERUDOS_FORTRESS_1_3", "SCENE_GERUDOS_FORTRESS", 1), + ("ENTR_GERUDOS_FORTRESS_2", "SCENE_GERUDOS_FORTRESS", 2), + ("ENTR_GERUDOS_FORTRESS_2_1", "SCENE_GERUDOS_FORTRESS", 2), + ("ENTR_GERUDOS_FORTRESS_2_2", "SCENE_GERUDOS_FORTRESS", 2), + ("ENTR_GERUDOS_FORTRESS_2_3", "SCENE_GERUDOS_FORTRESS", 2), + ("ENTR_GERUDOS_FORTRESS_3", "SCENE_GERUDOS_FORTRESS", 3), + ("ENTR_GERUDOS_FORTRESS_3_1", "SCENE_GERUDOS_FORTRESS", 3), + ("ENTR_GERUDOS_FORTRESS_3_2", "SCENE_GERUDOS_FORTRESS", 3), + ("ENTR_GERUDOS_FORTRESS_3_3", "SCENE_GERUDOS_FORTRESS", 3), + ("ENTR_HYRULE_CASTLE_1", "SCENE_HYRULE_CASTLE", 1), + ("ENTR_HYRULE_CASTLE_1_1", "SCENE_HYRULE_CASTLE", 1), + ("ENTR_OUTSIDE_GANONS_CASTLE_1_2", "SCENE_OUTSIDE_GANONS_CASTLE", 1), + ("ENTR_OUTSIDE_GANONS_CASTLE_1_3", "SCENE_OUTSIDE_GANONS_CASTLE", 1), + ("ENTR_HYRULE_CASTLE_1_4", "SCENE_HYRULE_CASTLE", 1), + ("ENTR_DEATH_MOUNTAIN_TRAIL_3", "SCENE_DEATH_MOUNTAIN_TRAIL", 3), + ("ENTR_DEATH_MOUNTAIN_TRAIL_3_1", "SCENE_DEATH_MOUNTAIN_TRAIL", 3), + ("ENTR_DEATH_MOUNTAIN_TRAIL_3_2", "SCENE_DEATH_MOUNTAIN_TRAIL", 3), + ("ENTR_DEATH_MOUNTAIN_TRAIL_3_3", "SCENE_DEATH_MOUNTAIN_TRAIL", 3), + ("ENTR_DEATH_MOUNTAIN_CRATER_1", "SCENE_DEATH_MOUNTAIN_CRATER", 1), + ("ENTR_DEATH_MOUNTAIN_CRATER_1_1", "SCENE_DEATH_MOUNTAIN_CRATER", 1), + ("ENTR_DEATH_MOUNTAIN_CRATER_1_2", "SCENE_DEATH_MOUNTAIN_CRATER", 1), + ("ENTR_DEATH_MOUNTAIN_CRATER_1_3", "SCENE_DEATH_MOUNTAIN_CRATER", 1), + ("ENTR_DEATH_MOUNTAIN_CRATER_2", "SCENE_DEATH_MOUNTAIN_CRATER", 2), + ("ENTR_DEATH_MOUNTAIN_CRATER_2_1", "SCENE_DEATH_MOUNTAIN_CRATER", 2), + ("ENTR_DEATH_MOUNTAIN_CRATER_2_2", "SCENE_DEATH_MOUNTAIN_CRATER", 2), + ("ENTR_DEATH_MOUNTAIN_CRATER_2_3", "SCENE_DEATH_MOUNTAIN_CRATER", 2), + ("ENTR_FOREST_TEMPLE_1", "SCENE_FOREST_TEMPLE", 1), + ("ENTR_FOREST_TEMPLE_1_1", "SCENE_FOREST_TEMPLE", 1), + ("ENTR_FOREST_TEMPLE_1_2", "SCENE_FOREST_TEMPLE", 1), + ("ENTR_FOREST_TEMPLE_1_3", "SCENE_FOREST_TEMPLE", 1), + ("ENTR_DEKU_TREE_1", "SCENE_DEKU_TREE", 1), + ("ENTR_DEKU_TREE_1_1", "SCENE_DEKU_TREE", 1), + ("ENTR_DEKU_TREE_1_2", "SCENE_DEKU_TREE", 1), + ("ENTR_DEKU_TREE_1_3", "SCENE_DEKU_TREE", 1), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_3", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 3), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_3_1", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 3), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_3_2", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 3), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_3_3", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 3), + ("ENTR_MARKET_DAY_1", "SCENE_MARKET_DAY", 1), + ("ENTR_MARKET_NIGHT_1_1", "SCENE_MARKET_NIGHT", 1), + ("ENTR_MARKET_RUINS_1_2", "SCENE_MARKET_RUINS", 1), + ("ENTR_MARKET_RUINS_1_3", "SCENE_MARKET_RUINS", 1), + ("ENTR_MARKET_DAY_2", "SCENE_MARKET_DAY", 2), + ("ENTR_MARKET_NIGHT_2_1", "SCENE_MARKET_NIGHT", 2), + ("ENTR_MARKET_RUINS_2_2", "SCENE_MARKET_RUINS", 2), + ("ENTR_MARKET_RUINS_2_3", "SCENE_MARKET_RUINS", 2), + ("ENTR_MARKET_DAY_3", "SCENE_MARKET_DAY", 3), + ("ENTR_MARKET_NIGHT_3_1", "SCENE_MARKET_NIGHT", 3), + ("ENTR_MARKET_RUINS_3_2", "SCENE_MARKET_RUINS", 3), + ("ENTR_MARKET_RUINS_3_3", "SCENE_MARKET_RUINS", 3), + ("ENTR_KOKIRI_FOREST_4", "SCENE_KOKIRI_FOREST", 4), + ("ENTR_KOKIRI_FOREST_4_1", "SCENE_KOKIRI_FOREST", 4), + ("ENTR_KOKIRI_FOREST_4_2", "SCENE_KOKIRI_FOREST", 4), + ("ENTR_KOKIRI_FOREST_4_3", "SCENE_KOKIRI_FOREST", 4), + ("ENTR_KOKIRI_FOREST_5", "SCENE_KOKIRI_FOREST", 5), + ("ENTR_KOKIRI_FOREST_5_1", "SCENE_KOKIRI_FOREST", 5), + ("ENTR_KOKIRI_FOREST_5_2", "SCENE_KOKIRI_FOREST", 5), + ("ENTR_KOKIRI_FOREST_5_3", "SCENE_KOKIRI_FOREST", 5), + ("ENTR_MARKET_ENTRANCE_DAY_2", "SCENE_MARKET_ENTRANCE_DAY", 2), + ("ENTR_MARKET_ENTRANCE_NIGHT_2_1", "SCENE_MARKET_ENTRANCE_NIGHT", 2), + ("ENTR_MARKET_ENTRANCE_RUINS_2_2", "SCENE_MARKET_ENTRANCE_RUINS", 2), + ("ENTR_MARKET_ENTRANCE_RUINS_2_3", "SCENE_MARKET_ENTRANCE_RUINS", 2), + ("ENTR_LINKS_HOUSE_1", "SCENE_LINKS_HOUSE", 1), + ("ENTR_LINKS_HOUSE_1_1", "SCENE_LINKS_HOUSE", 1), + ("ENTR_LINKS_HOUSE_1_2", "SCENE_LINKS_HOUSE", 1), + ("ENTR_LINKS_HOUSE_1_3", "SCENE_LINKS_HOUSE", 1), + ("ENTR_MARKET_ENTRANCE_DAY_1", "SCENE_MARKET_ENTRANCE_DAY", 1), + ("ENTR_MARKET_ENTRANCE_NIGHT_1_1", "SCENE_MARKET_ENTRANCE_NIGHT", 1), + ("ENTR_MARKET_ENTRANCE_RUINS_1_2", "SCENE_MARKET_ENTRANCE_RUINS", 1), + ("ENTR_MARKET_ENTRANCE_RUINS_1_3", "SCENE_MARKET_ENTRANCE_RUINS", 1), + ("ENTR_HYRULE_FIELD_8", "SCENE_HYRULE_FIELD", 8), + ("ENTR_HYRULE_FIELD_8_1", "SCENE_HYRULE_FIELD", 8), + ("ENTR_HYRULE_FIELD_8_2", "SCENE_HYRULE_FIELD", 8), + ("ENTR_HYRULE_FIELD_8_3", "SCENE_HYRULE_FIELD", 8), + ("ENTR_HYRULE_FIELD_9", "SCENE_HYRULE_FIELD", 9), + ("ENTR_HYRULE_FIELD_9_1", "SCENE_HYRULE_FIELD", 9), + ("ENTR_HYRULE_FIELD_9_2", "SCENE_HYRULE_FIELD", 9), + ("ENTR_HYRULE_FIELD_9_3", "SCENE_HYRULE_FIELD", 9), + ("ENTR_HYRULE_FIELD_10", "SCENE_HYRULE_FIELD", 10), + ("ENTR_HYRULE_FIELD_10_1", "SCENE_HYRULE_FIELD", 10), + ("ENTR_HYRULE_FIELD_10_2", "SCENE_HYRULE_FIELD", 10), + ("ENTR_HYRULE_FIELD_10_3", "SCENE_HYRULE_FIELD", 10), + ("ENTR_KOKIRI_FOREST_6", "SCENE_KOKIRI_FOREST", 6), + ("ENTR_KOKIRI_FOREST_6_1", "SCENE_KOKIRI_FOREST", 6), + ("ENTR_KOKIRI_FOREST_6_2", "SCENE_KOKIRI_FOREST", 6), + ("ENTR_KOKIRI_FOREST_6_3", "SCENE_KOKIRI_FOREST", 6), + ("ENTR_HYRULE_FIELD_11", "SCENE_HYRULE_FIELD", 11), + ("ENTR_HYRULE_FIELD_11_1", "SCENE_HYRULE_FIELD", 11), + ("ENTR_HYRULE_FIELD_11_2", "SCENE_HYRULE_FIELD", 11), + ("ENTR_HYRULE_FIELD_11_3", "SCENE_HYRULE_FIELD", 11), + ("ENTR_HYRULE_FIELD_12", "SCENE_HYRULE_FIELD", 12), + ("ENTR_HYRULE_FIELD_12_1", "SCENE_HYRULE_FIELD", 12), + ("ENTR_HYRULE_FIELD_12_2", "SCENE_HYRULE_FIELD", 12), + ("ENTR_HYRULE_FIELD_12_3", "SCENE_HYRULE_FIELD", 12), + ("ENTR_HYRULE_FIELD_13", "SCENE_HYRULE_FIELD", 13), + ("ENTR_HYRULE_FIELD_13_1", "SCENE_HYRULE_FIELD", 13), + ("ENTR_HYRULE_FIELD_13_2", "SCENE_HYRULE_FIELD", 13), + ("ENTR_HYRULE_FIELD_13_3", "SCENE_HYRULE_FIELD", 13), + ("ENTR_CASTLE_COURTYARD_GUARDS_DAY_1", "SCENE_CASTLE_COURTYARD_GUARDS_DAY", 1), + ("ENTR_CASTLE_COURTYARD_GUARDS_NIGHT_1_1", "SCENE_CASTLE_COURTYARD_GUARDS_NIGHT", 1), + ("ENTR_CASTLE_COURTYARD_GUARDS_DAY_1_2", "SCENE_CASTLE_COURTYARD_GUARDS_DAY", 1), + ("ENTR_CASTLE_COURTYARD_GUARDS_NIGHT_1_3", "SCENE_CASTLE_COURTYARD_GUARDS_NIGHT", 1), + ("ENTR_BACK_ALLEY_DAY_1", "SCENE_BACK_ALLEY_DAY", 1), + ("ENTR_BACK_ALLEY_NIGHT_1_1", "SCENE_BACK_ALLEY_NIGHT", 1), + ("ENTR_BACK_ALLEY_DAY_1_2", "SCENE_BACK_ALLEY_DAY", 1), + ("ENTR_BACK_ALLEY_NIGHT_1_3", "SCENE_BACK_ALLEY_NIGHT", 1), + ("ENTR_MARKET_DAY_4", "SCENE_MARKET_DAY", 4), + ("ENTR_MARKET_NIGHT_4_1", "SCENE_MARKET_NIGHT", 4), + ("ENTR_MARKET_RUINS_4_2", "SCENE_MARKET_RUINS", 4), + ("ENTR_MARKET_RUINS_4_3", "SCENE_MARKET_RUINS", 4), + ("ENTR_MARKET_DAY_5", "SCENE_MARKET_DAY", 5), + ("ENTR_MARKET_NIGHT_5_1", "SCENE_MARKET_NIGHT", 5), + ("ENTR_MARKET_RUINS_5_2", "SCENE_MARKET_RUINS", 5), + ("ENTR_MARKET_RUINS_5_3", "SCENE_MARKET_RUINS", 5), + ("ENTR_KAKARIKO_VILLAGE_4", "SCENE_KAKARIKO_VILLAGE", 4), + ("ENTR_KAKARIKO_VILLAGE_4_1", "SCENE_KAKARIKO_VILLAGE", 4), + ("ENTR_KAKARIKO_VILLAGE_4_2", "SCENE_KAKARIKO_VILLAGE", 4), + ("ENTR_KAKARIKO_VILLAGE_4_3", "SCENE_KAKARIKO_VILLAGE", 4), + ("ENTR_GERUDOS_FORTRESS_4", "SCENE_GERUDOS_FORTRESS", 4), + ("ENTR_GERUDOS_FORTRESS_4_1", "SCENE_GERUDOS_FORTRESS", 4), + ("ENTR_GERUDOS_FORTRESS_4_2", "SCENE_GERUDOS_FORTRESS", 4), + ("ENTR_GERUDOS_FORTRESS_4_3", "SCENE_GERUDOS_FORTRESS", 4), + ("ENTR_LON_LON_RANCH_1", "SCENE_LON_LON_RANCH", 1), + ("ENTR_LON_LON_RANCH_1_1", "SCENE_LON_LON_RANCH", 1), + ("ENTR_LON_LON_RANCH_1_2", "SCENE_LON_LON_RANCH", 1), + ("ENTR_LON_LON_RANCH_1_3", "SCENE_LON_LON_RANCH", 1), + ("ENTR_SHADOW_TEMPLE_1", "SCENE_SHADOW_TEMPLE", 1), + ("ENTR_SHADOW_TEMPLE_1_1", "SCENE_SHADOW_TEMPLE", 1), + ("ENTR_SHADOW_TEMPLE_1_2", "SCENE_SHADOW_TEMPLE", 1), + ("ENTR_SHADOW_TEMPLE_1_3", "SCENE_SHADOW_TEMPLE", 1), + ("ENTR_SHADOW_TEMPLE_2", "SCENE_SHADOW_TEMPLE", 2), + ("ENTR_SHADOW_TEMPLE_2_1", "SCENE_SHADOW_TEMPLE", 2), + ("ENTR_SHADOW_TEMPLE_2_2", "SCENE_SHADOW_TEMPLE", 2), + ("ENTR_SHADOW_TEMPLE_2_3", "SCENE_SHADOW_TEMPLE", 2), + ("ENTR_GERUDOS_FORTRESS_5", "SCENE_GERUDOS_FORTRESS", 5), + ("ENTR_GERUDOS_FORTRESS_5_1", "SCENE_GERUDOS_FORTRESS", 5), + ("ENTR_GERUDOS_FORTRESS_5_2", "SCENE_GERUDOS_FORTRESS", 5), + ("ENTR_GERUDOS_FORTRESS_5_3", "SCENE_GERUDOS_FORTRESS", 5), + ("ENTR_GERUDOS_FORTRESS_6", "SCENE_GERUDOS_FORTRESS", 6), + ("ENTR_GERUDOS_FORTRESS_6_1", "SCENE_GERUDOS_FORTRESS", 6), + ("ENTR_GERUDOS_FORTRESS_6_2", "SCENE_GERUDOS_FORTRESS", 6), + ("ENTR_GERUDOS_FORTRESS_6_3", "SCENE_GERUDOS_FORTRESS", 6), + ("ENTR_GERUDOS_FORTRESS_7", "SCENE_GERUDOS_FORTRESS", 7), + ("ENTR_GERUDOS_FORTRESS_7_1", "SCENE_GERUDOS_FORTRESS", 7), + ("ENTR_GERUDOS_FORTRESS_7_2", "SCENE_GERUDOS_FORTRESS", 7), + ("ENTR_GERUDOS_FORTRESS_7_3", "SCENE_GERUDOS_FORTRESS", 7), + ("ENTR_GERUDOS_FORTRESS_8", "SCENE_GERUDOS_FORTRESS", 8), + ("ENTR_GERUDOS_FORTRESS_8_1", "SCENE_GERUDOS_FORTRESS", 8), + ("ENTR_GERUDOS_FORTRESS_8_2", "SCENE_GERUDOS_FORTRESS", 8), + ("ENTR_GERUDOS_FORTRESS_8_3", "SCENE_GERUDOS_FORTRESS", 8), + ("ENTR_TEMPLE_OF_TIME_2", "SCENE_TEMPLE_OF_TIME", 2), + ("ENTR_TEMPLE_OF_TIME_2_1", "SCENE_TEMPLE_OF_TIME", 2), + ("ENTR_TEMPLE_OF_TIME_2_2", "SCENE_TEMPLE_OF_TIME", 2), + ("ENTR_TEMPLE_OF_TIME_2_3", "SCENE_TEMPLE_OF_TIME", 2), + ("ENTR_CHAMBER_OF_THE_SAGES_1", "SCENE_CHAMBER_OF_THE_SAGES", 1), + ("ENTR_CHAMBER_OF_THE_SAGES_1_1", "SCENE_CHAMBER_OF_THE_SAGES", 1), + ("ENTR_CHAMBER_OF_THE_SAGES_1_2", "SCENE_CHAMBER_OF_THE_SAGES", 1), + ("ENTR_CHAMBER_OF_THE_SAGES_1_3", "SCENE_CHAMBER_OF_THE_SAGES", 1), + ("ENTR_GERUDOS_FORTRESS_9", "SCENE_GERUDOS_FORTRESS", 9), + ("ENTR_GERUDOS_FORTRESS_9_1", "SCENE_GERUDOS_FORTRESS", 9), + ("ENTR_GERUDOS_FORTRESS_9_2", "SCENE_GERUDOS_FORTRESS", 9), + ("ENTR_GERUDOS_FORTRESS_9_3", "SCENE_GERUDOS_FORTRESS", 9), + ("ENTR_GERUDOS_FORTRESS_10", "SCENE_GERUDOS_FORTRESS", 10), + ("ENTR_GERUDOS_FORTRESS_10_1", "SCENE_GERUDOS_FORTRESS", 10), + ("ENTR_GERUDOS_FORTRESS_10_2", "SCENE_GERUDOS_FORTRESS", 10), + ("ENTR_GERUDOS_FORTRESS_10_3", "SCENE_GERUDOS_FORTRESS", 10), + ("ENTR_GERUDOS_FORTRESS_11", "SCENE_GERUDOS_FORTRESS", 11), + ("ENTR_GERUDOS_FORTRESS_11_1", "SCENE_GERUDOS_FORTRESS", 11), + ("ENTR_GERUDOS_FORTRESS_11_2", "SCENE_GERUDOS_FORTRESS", 11), + ("ENTR_GERUDOS_FORTRESS_11_3", "SCENE_GERUDOS_FORTRESS", 11), + ("ENTR_GERUDOS_FORTRESS_12", "SCENE_GERUDOS_FORTRESS", 12), + ("ENTR_GERUDOS_FORTRESS_12_1", "SCENE_GERUDOS_FORTRESS", 12), + ("ENTR_GERUDOS_FORTRESS_12_2", "SCENE_GERUDOS_FORTRESS", 12), + ("ENTR_GERUDOS_FORTRESS_12_3", "SCENE_GERUDOS_FORTRESS", 12), + ("ENTR_LON_LON_RANCH_2", "SCENE_LON_LON_RANCH", 2), + ("ENTR_LON_LON_RANCH_2_1", "SCENE_LON_LON_RANCH", 2), + ("ENTR_LON_LON_RANCH_2_2", "SCENE_LON_LON_RANCH", 2), + ("ENTR_LON_LON_RANCH_2_3", "SCENE_LON_LON_RANCH", 2), + ("ENTR_LON_LON_RANCH_3", "SCENE_LON_LON_RANCH", 3), + ("ENTR_LON_LON_RANCH_3_1", "SCENE_LON_LON_RANCH", 3), + ("ENTR_LON_LON_RANCH_3_2", "SCENE_LON_LON_RANCH", 3), + ("ENTR_LON_LON_RANCH_3_3", "SCENE_LON_LON_RANCH", 3), + ("ENTR_TEST_SHOOTING_GALLERY_0", "SCENE_SHOOTING_GALLERY", 0), + ("ENTR_TEST_SHOOTING_GALLERY_0_1", "SCENE_SHOOTING_GALLERY", 0), + ("ENTR_TEST_SHOOTING_GALLERY_0_2", "SCENE_SHOOTING_GALLERY", 0), + ("ENTR_TEST_SHOOTING_GALLERY_0_3", "SCENE_SHOOTING_GALLERY", 0), + ("ENTR_TEST_SACRED_FOREST_MEADOW_0_4", "SCENE_SACRED_FOREST_MEADOW", 0), + ("ENTR_TEST_CUTSCENE_MAP_0_5", "SCENE_CUTSCENE_MAP", 0), + ("ENTR_TEST_SHOOTING_GALLERY_0_6", "SCENE_SHOOTING_GALLERY", 0), + ("ENTR_TEST_SHOOTING_GALLERY_0_7", "SCENE_SHOOTING_GALLERY", 0), + ("ENTR_TEST_SHOOTING_GALLERY_0_8", "SCENE_SHOOTING_GALLERY", 0), + ("ENTR_TEST_SHOOTING_GALLERY_0_9", "SCENE_SHOOTING_GALLERY", 0), + ("ENTR_TEST_SHOOTING_GALLERY_0_10", "SCENE_SHOOTING_GALLERY", 0), + ("ENTR_SPIRIT_TEMPLE_1", "SCENE_SPIRIT_TEMPLE", 1), + ("ENTR_SPIRIT_TEMPLE_1_1", "SCENE_SPIRIT_TEMPLE", 1), + ("ENTR_SPIRIT_TEMPLE_1_2", "SCENE_SPIRIT_TEMPLE", 1), + ("ENTR_SPIRIT_TEMPLE_1_3", "SCENE_SPIRIT_TEMPLE", 1), + ("ENTR_STABLE_0", "SCENE_STABLE", 0), + ("ENTR_STABLE_0_1", "SCENE_STABLE", 0), + ("ENTR_STABLE_0_2", "SCENE_STABLE", 0), + ("ENTR_STABLE_0_3", "SCENE_STABLE", 0), + ("ENTR_KAKARIKO_CENTER_GUEST_HOUSE_0", "SCENE_KAKARIKO_CENTER_GUEST_HOUSE", 0), + ("ENTR_KAKARIKO_CENTER_GUEST_HOUSE_0_1", "SCENE_KAKARIKO_CENTER_GUEST_HOUSE", 0), + ("ENTR_KAKARIKO_CENTER_GUEST_HOUSE_0_2", "SCENE_KAKARIKO_CENTER_GUEST_HOUSE", 0), + ("ENTR_KAKARIKO_CENTER_GUEST_HOUSE_0_3", "SCENE_KAKARIKO_CENTER_GUEST_HOUSE", 0), + ("ENTR_JABU_JABU_BOSS_0", "SCENE_JABU_JABU_BOSS", 0), + ("ENTR_JABU_JABU_BOSS_0_1", "SCENE_JABU_JABU_BOSS", 0), + ("ENTR_JABU_JABU_BOSS_0_2", "SCENE_JABU_JABU_BOSS", 0), + ("ENTR_JABU_JABU_BOSS_0_3", "SCENE_JABU_JABU_BOSS", 0), + ("ENTR_FIRE_TEMPLE_BOSS_0", "SCENE_FIRE_TEMPLE_BOSS", 0), + ("ENTR_FIRE_TEMPLE_BOSS_0_1", "SCENE_FIRE_TEMPLE_BOSS", 0), + ("ENTR_FIRE_TEMPLE_BOSS_0_2", "SCENE_FIRE_TEMPLE_BOSS", 0), + ("ENTR_FIRE_TEMPLE_BOSS_0_3", "SCENE_FIRE_TEMPLE_BOSS", 0), + ("ENTR_LAKE_HYLIA_6", "SCENE_LAKE_HYLIA", 6), + ("ENTR_LAKE_HYLIA_6_1", "SCENE_LAKE_HYLIA", 6), + ("ENTR_LAKE_HYLIA_6_2", "SCENE_LAKE_HYLIA", 6), + ("ENTR_LAKE_HYLIA_6_3", "SCENE_LAKE_HYLIA", 6), + ("ENTR_GRAVEKEEPERS_HUT_0", "SCENE_GRAVEKEEPERS_HUT", 0), + ("ENTR_GRAVEKEEPERS_HUT_0_1", "SCENE_GRAVEKEEPERS_HUT", 0), + ("ENTR_GRAVEKEEPERS_HUT_0_2", "SCENE_GRAVEKEEPERS_HUT", 0), + ("ENTR_GRAVEKEEPERS_HUT_0_3", "SCENE_GRAVEKEEPERS_HUT", 0), + ("ENTR_HYRULE_FIELD_14", "SCENE_HYRULE_FIELD", 14), + ("ENTR_HYRULE_FIELD_14_1", "SCENE_HYRULE_FIELD", 14), + ("ENTR_HYRULE_FIELD_14_2", "SCENE_HYRULE_FIELD", 14), + ("ENTR_HYRULE_FIELD_14_3", "SCENE_HYRULE_FIELD", 14), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_0", "SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC", 0), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_0_1", "SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC", 0), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_0_2", "SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC", 0), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_0_3", "SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC", 0), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_0_4", "SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC", 0), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_0_5", "SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC", 0), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_0_6", "SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC", 0), + ("ENTR_REDEAD_GRAVE_0", "SCENE_REDEAD_GRAVE", 0), + ("ENTR_REDEAD_GRAVE_0_1", "SCENE_REDEAD_GRAVE", 0), + ("ENTR_REDEAD_GRAVE_0_2", "SCENE_REDEAD_GRAVE", 0), + ("ENTR_REDEAD_GRAVE_0_3", "SCENE_REDEAD_GRAVE", 0), + ("ENTR_TEMPLE_OF_TIME_3", "SCENE_TEMPLE_OF_TIME", 3), + ("ENTR_TEMPLE_OF_TIME_3_1", "SCENE_TEMPLE_OF_TIME", 3), + ("ENTR_TEMPLE_OF_TIME_3_2", "SCENE_TEMPLE_OF_TIME", 3), + ("ENTR_TEMPLE_OF_TIME_3_3", "SCENE_TEMPLE_OF_TIME", 3), + ("ENTR_TEMPLE_OF_TIME_4", "SCENE_TEMPLE_OF_TIME", 4), + ("ENTR_TEMPLE_OF_TIME_4_1", "SCENE_TEMPLE_OF_TIME", 4), + ("ENTR_TEMPLE_OF_TIME_4_2", "SCENE_TEMPLE_OF_TIME", 4), + ("ENTR_TEMPLE_OF_TIME_4_3", "SCENE_TEMPLE_OF_TIME", 4), + ("ENTR_ZORAS_DOMAIN_4", "SCENE_ZORAS_DOMAIN", 4), + ("ENTR_ZORAS_DOMAIN_4_1", "SCENE_ZORAS_DOMAIN", 4), + ("ENTR_ZORAS_DOMAIN_4_2", "SCENE_ZORAS_DOMAIN", 4), + ("ENTR_ZORAS_DOMAIN_4_3", "SCENE_ZORAS_DOMAIN", 4), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_2", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 2), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_2_1", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 2), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_2_2", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 2), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_2_3", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 2), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_3", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 3), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_3_1", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 3), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_3_2", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 3), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_3_3", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 3), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_4", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 4), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_4_1", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 4), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_4_2", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 4), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_4_3", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 4), + ("ENTR_KOKIRI_FOREST_7", "SCENE_KOKIRI_FOREST", 7), + ("ENTR_KOKIRI_FOREST_7_1", "SCENE_KOKIRI_FOREST", 7), + ("ENTR_KOKIRI_FOREST_7_2", "SCENE_KOKIRI_FOREST", 7), + ("ENTR_KOKIRI_FOREST_7_3", "SCENE_KOKIRI_FOREST", 7), + ("ENTR_KOKIRI_FOREST_8", "SCENE_KOKIRI_FOREST", 8), + ("ENTR_KOKIRI_FOREST_8_1", "SCENE_KOKIRI_FOREST", 8), + ("ENTR_KOKIRI_FOREST_8_2", "SCENE_KOKIRI_FOREST", 8), + ("ENTR_KOKIRI_FOREST_8_3", "SCENE_KOKIRI_FOREST", 8), + ("ENTR_HYRULE_CASTLE_2", "SCENE_HYRULE_CASTLE", 2), + ("ENTR_HYRULE_CASTLE_2_1", "SCENE_HYRULE_CASTLE", 2), + ("ENTR_OUTSIDE_GANONS_CASTLE_2_2", "SCENE_OUTSIDE_GANONS_CASTLE", 2), + ("ENTR_OUTSIDE_GANONS_CASTLE_2_3", "SCENE_OUTSIDE_GANONS_CASTLE", 2), + ("ENTR_HYRULE_CASTLE_2_4", "SCENE_HYRULE_CASTLE", 2), + ("ENTR_KAKARIKO_VILLAGE_5", "SCENE_KAKARIKO_VILLAGE", 5), + ("ENTR_KAKARIKO_VILLAGE_5_1", "SCENE_KAKARIKO_VILLAGE", 5), + ("ENTR_KAKARIKO_VILLAGE_5_2", "SCENE_KAKARIKO_VILLAGE", 5), + ("ENTR_KAKARIKO_VILLAGE_5_3", "SCENE_KAKARIKO_VILLAGE", 5), + ("ENTR_KAKARIKO_VILLAGE_6", "SCENE_KAKARIKO_VILLAGE", 6), + ("ENTR_KAKARIKO_VILLAGE_6_1", "SCENE_KAKARIKO_VILLAGE", 6), + ("ENTR_KAKARIKO_VILLAGE_6_2", "SCENE_KAKARIKO_VILLAGE", 6), + ("ENTR_KAKARIKO_VILLAGE_6_3", "SCENE_KAKARIKO_VILLAGE", 6), + ("ENTR_KAKARIKO_VILLAGE_7", "SCENE_KAKARIKO_VILLAGE", 7), + ("ENTR_KAKARIKO_VILLAGE_7_1", "SCENE_KAKARIKO_VILLAGE", 7), + ("ENTR_KAKARIKO_VILLAGE_7_2", "SCENE_KAKARIKO_VILLAGE", 7), + ("ENTR_KAKARIKO_VILLAGE_7_3", "SCENE_KAKARIKO_VILLAGE", 7), + ("ENTR_KAKARIKO_VILLAGE_8", "SCENE_KAKARIKO_VILLAGE", 8), + ("ENTR_KAKARIKO_VILLAGE_8_1", "SCENE_KAKARIKO_VILLAGE", 8), + ("ENTR_KAKARIKO_VILLAGE_8_2", "SCENE_KAKARIKO_VILLAGE", 8), + ("ENTR_KAKARIKO_VILLAGE_8_3", "SCENE_KAKARIKO_VILLAGE", 8), + ("ENTR_GRAVEYARD_2", "SCENE_GRAVEYARD", 2), + ("ENTR_GRAVEYARD_2_1", "SCENE_GRAVEYARD", 2), + ("ENTR_GRAVEYARD_2_2", "SCENE_GRAVEYARD", 2), + ("ENTR_GRAVEYARD_2_3", "SCENE_GRAVEYARD", 2), + ("ENTR_GRAVEYARD_3", "SCENE_GRAVEYARD", 3), + ("ENTR_GRAVEYARD_3_1", "SCENE_GRAVEYARD", 3), + ("ENTR_GRAVEYARD_3_2", "SCENE_GRAVEYARD", 3), + ("ENTR_GRAVEYARD_3_3", "SCENE_GRAVEYARD", 3), + ("ENTR_GRAVEYARD_4", "SCENE_GRAVEYARD", 4), + ("ENTR_GRAVEYARD_4_1", "SCENE_GRAVEYARD", 4), + ("ENTR_GRAVEYARD_4_2", "SCENE_GRAVEYARD", 4), + ("ENTR_GRAVEYARD_4_3", "SCENE_GRAVEYARD", 4), + ("ENTR_GRAVEYARD_5", "SCENE_GRAVEYARD", 5), + ("ENTR_GRAVEYARD_5_1", "SCENE_GRAVEYARD", 5), + ("ENTR_GRAVEYARD_5_2", "SCENE_GRAVEYARD", 5), + ("ENTR_GRAVEYARD_5_3", "SCENE_GRAVEYARD", 5), + ("ENTR_HAUNTED_WASTELAND_1", "SCENE_HAUNTED_WASTELAND", 1), + ("ENTR_HAUNTED_WASTELAND_1_1", "SCENE_HAUNTED_WASTELAND", 1), + ("ENTR_HAUNTED_WASTELAND_1_2", "SCENE_HAUNTED_WASTELAND", 1), + ("ENTR_HAUNTED_WASTELAND_1_3", "SCENE_HAUNTED_WASTELAND", 1), + ("ENTR_HAUNTED_WASTELAND_2", "SCENE_HAUNTED_WASTELAND", 2), + ("ENTR_HAUNTED_WASTELAND_2_1", "SCENE_HAUNTED_WASTELAND", 2), + ("ENTR_HAUNTED_WASTELAND_2_2", "SCENE_HAUNTED_WASTELAND", 2), + ("ENTR_HAUNTED_WASTELAND_2_3", "SCENE_HAUNTED_WASTELAND", 2), + ("ENTR_FAIRYS_FOUNTAIN_0", "SCENE_FAIRYS_FOUNTAIN", 0), + ("ENTR_FAIRYS_FOUNTAIN_0_1", "SCENE_FAIRYS_FOUNTAIN", 0), + ("ENTR_FAIRYS_FOUNTAIN_0_2", "SCENE_FAIRYS_FOUNTAIN", 0), + ("ENTR_FAIRYS_FOUNTAIN_0_3", "SCENE_FAIRYS_FOUNTAIN", 0), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_0", "SCENE_GREAT_FAIRYS_FOUNTAIN_SPELLS", 0), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_0_1", "SCENE_GREAT_FAIRYS_FOUNTAIN_SPELLS", 0), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_0_2", "SCENE_GREAT_FAIRYS_FOUNTAIN_SPELLS", 0), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_0_3", "SCENE_GREAT_FAIRYS_FOUNTAIN_SPELLS", 0), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_0_4", "SCENE_GREAT_FAIRYS_FOUNTAIN_SPELLS", 0), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_0_5", "SCENE_GREAT_FAIRYS_FOUNTAIN_SPELLS", 0), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_0_6", "SCENE_GREAT_FAIRYS_FOUNTAIN_SPELLS", 0), + ("ENTR_LON_LON_RANCH_4", "SCENE_LON_LON_RANCH", 4), + ("ENTR_LON_LON_RANCH_4_1", "SCENE_LON_LON_RANCH", 4), + ("ENTR_LON_LON_RANCH_4_2", "SCENE_LON_LON_RANCH", 4), + ("ENTR_LON_LON_RANCH_4_3", "SCENE_LON_LON_RANCH", 4), + ("ENTR_GORON_SHOP_0", "SCENE_GORON_SHOP", 0), + ("ENTR_GORON_SHOP_0_1", "SCENE_GORON_SHOP", 0), + ("ENTR_GORON_SHOP_0_2", "SCENE_GORON_SHOP", 0), + ("ENTR_GORON_SHOP_0_3", "SCENE_GORON_SHOP", 0), + ("ENTR_ZORA_SHOP_0", "SCENE_ZORA_SHOP", 0), + ("ENTR_ZORA_SHOP_0_1", "SCENE_ZORA_SHOP", 0), + ("ENTR_ZORA_SHOP_0_2", "SCENE_ZORA_SHOP", 0), + ("ENTR_ZORA_SHOP_0_3", "SCENE_ZORA_SHOP", 0), + ("ENTR_POTION_SHOP_KAKARIKO_0", "SCENE_POTION_SHOP_KAKARIKO", 0), + ("ENTR_POTION_SHOP_KAKARIKO_0_1", "SCENE_POTION_SHOP_KAKARIKO", 0), + ("ENTR_POTION_SHOP_KAKARIKO_0_2", "SCENE_POTION_SHOP_KAKARIKO", 0), + ("ENTR_POTION_SHOP_KAKARIKO_0_3", "SCENE_POTION_SHOP_KAKARIKO", 0), + ("ENTR_POTION_SHOP_MARKET_0", "SCENE_POTION_SHOP_MARKET", 0), + ("ENTR_POTION_SHOP_MARKET_0_1", "SCENE_POTION_SHOP_MARKET", 0), + ("ENTR_POTION_SHOP_MARKET_0_2", "SCENE_POTION_SHOP_MARKET", 0), + ("ENTR_POTION_SHOP_MARKET_0_3", "SCENE_POTION_SHOP_MARKET", 0), + ("ENTR_BACK_ALLEY_DAY_4", "SCENE_BACK_ALLEY_DAY", 4), + ("ENTR_BACK_ALLEY_NIGHT_4_1", "SCENE_BACK_ALLEY_NIGHT", 4), + ("ENTR_BACK_ALLEY_DAY_4_2", "SCENE_BACK_ALLEY_DAY", 4), + ("ENTR_BACK_ALLEY_NIGHT_4_3", "SCENE_BACK_ALLEY_NIGHT", 4), + ("ENTR_BOMBCHU_SHOP_0", "SCENE_BOMBCHU_SHOP", 0), + ("ENTR_BOMBCHU_SHOP_0_1", "SCENE_BOMBCHU_SHOP", 0), + ("ENTR_BOMBCHU_SHOP_0_2", "SCENE_BOMBCHU_SHOP", 0), + ("ENTR_BOMBCHU_SHOP_0_3", "SCENE_BOMBCHU_SHOP", 0), + ("ENTR_ZORAS_FOUNTAIN_5", "SCENE_ZORAS_FOUNTAIN", 5), + ("ENTR_ZORAS_FOUNTAIN_5_1", "SCENE_ZORAS_FOUNTAIN", 5), + ("ENTR_ZORAS_FOUNTAIN_5_2", "SCENE_ZORAS_FOUNTAIN", 5), + ("ENTR_ZORAS_FOUNTAIN_5_3", "SCENE_ZORAS_FOUNTAIN", 5), + ("ENTR_DOG_LADY_HOUSE_0", "SCENE_DOG_LADY_HOUSE", 0), + ("ENTR_DOG_LADY_HOUSE_0_1", "SCENE_DOG_LADY_HOUSE", 0), + ("ENTR_DOG_LADY_HOUSE_0_2", "SCENE_DOG_LADY_HOUSE", 0), + ("ENTR_DOG_LADY_HOUSE_0_3", "SCENE_DOG_LADY_HOUSE", 0), + ("ENTR_IMPAS_HOUSE_0", "SCENE_IMPAS_HOUSE", 0), + ("ENTR_IMPAS_HOUSE_0_1", "SCENE_IMPAS_HOUSE", 0), + ("ENTR_IMPAS_HOUSE_0_2", "SCENE_IMPAS_HOUSE", 0), + ("ENTR_IMPAS_HOUSE_0_3", "SCENE_IMPAS_HOUSE", 0), + ("ENTR_CARPENTERS_TENT_0", "SCENE_CARPENTERS_TENT", 0), + ("ENTR_CARPENTERS_TENT_0_1", "SCENE_CARPENTERS_TENT", 0), + ("ENTR_CARPENTERS_TENT_0_2", "SCENE_CARPENTERS_TENT", 0), + ("ENTR_CARPENTERS_TENT_0_3", "SCENE_CARPENTERS_TENT", 0), + ("ENTR_GERUDOS_FORTRESS_13", "SCENE_GERUDOS_FORTRESS", 13), + ("ENTR_GERUDOS_FORTRESS_13_1", "SCENE_GERUDOS_FORTRESS", 13), + ("ENTR_GERUDOS_FORTRESS_13_2", "SCENE_GERUDOS_FORTRESS", 13), + ("ENTR_GERUDOS_FORTRESS_13_3", "SCENE_GERUDOS_FORTRESS", 13), + ("ENTR_GERUDOS_FORTRESS_14", "SCENE_GERUDOS_FORTRESS", 14), + ("ENTR_GERUDOS_FORTRESS_14_1", "SCENE_GERUDOS_FORTRESS", 14), + ("ENTR_GERUDOS_FORTRESS_14_2", "SCENE_GERUDOS_FORTRESS", 14), + ("ENTR_GERUDOS_FORTRESS_14_3", "SCENE_GERUDOS_FORTRESS", 14), + ("ENTR_GERUDOS_FORTRESS_15", "SCENE_GERUDOS_FORTRESS", 15), + ("ENTR_GERUDOS_FORTRESS_15_1", "SCENE_GERUDOS_FORTRESS", 15), + ("ENTR_GERUDOS_FORTRESS_15_2", "SCENE_GERUDOS_FORTRESS", 15), + ("ENTR_GERUDOS_FORTRESS_15_3", "SCENE_GERUDOS_FORTRESS", 15), + ("ENTR_GERUDOS_FORTRESS_16", "SCENE_GERUDOS_FORTRESS", 16), + ("ENTR_GERUDOS_FORTRESS_16_1", "SCENE_GERUDOS_FORTRESS", 16), + ("ENTR_GERUDOS_FORTRESS_16_2", "SCENE_GERUDOS_FORTRESS", 16), + ("ENTR_GERUDOS_FORTRESS_16_3", "SCENE_GERUDOS_FORTRESS", 16), + ("ENTR_GERUDOS_FORTRESS_17", "SCENE_GERUDOS_FORTRESS", 17), + ("ENTR_GERUDOS_FORTRESS_17_1", "SCENE_GERUDOS_FORTRESS", 17), + ("ENTR_GERUDOS_FORTRESS_17_2", "SCENE_GERUDOS_FORTRESS", 17), + ("ENTR_GERUDOS_FORTRESS_17_3", "SCENE_GERUDOS_FORTRESS", 17), + ("ENTR_MARKET_DAY_6", "SCENE_MARKET_DAY", 6), + ("ENTR_MARKET_NIGHT_6_1", "SCENE_MARKET_NIGHT", 6), + ("ENTR_MARKET_RUINS_6_2", "SCENE_MARKET_RUINS", 6), + ("ENTR_MARKET_RUINS_6_3", "SCENE_MARKET_RUINS", 6), + ("ENTR_MARKET_DAY_7", "SCENE_MARKET_DAY", 7), + ("ENTR_MARKET_NIGHT_7_1", "SCENE_MARKET_NIGHT", 7), + ("ENTR_MARKET_RUINS_7_2", "SCENE_MARKET_RUINS", 7), + ("ENTR_MARKET_RUINS_7_3", "SCENE_MARKET_RUINS", 7), + ("ENTR_BACK_ALLEY_DAY_2", "SCENE_BACK_ALLEY_DAY", 2), + ("ENTR_BACK_ALLEY_NIGHT_2_1", "SCENE_BACK_ALLEY_NIGHT", 2), + ("ENTR_BACK_ALLEY_DAY_2_2", "SCENE_BACK_ALLEY_DAY", 2), + ("ENTR_BACK_ALLEY_NIGHT_2_3", "SCENE_BACK_ALLEY_NIGHT", 2), + ("ENTR_ZORAS_DOMAIN_2", "SCENE_ZORAS_DOMAIN", 2), + ("ENTR_ZORAS_DOMAIN_2_1", "SCENE_ZORAS_DOMAIN", 2), + ("ENTR_ZORAS_DOMAIN_2_2", "SCENE_ZORAS_DOMAIN", 2), + ("ENTR_ZORAS_DOMAIN_2_3", "SCENE_ZORAS_DOMAIN", 2), + ("ENTR_LAKE_HYLIA_3", "SCENE_LAKE_HYLIA", 3), + ("ENTR_LAKE_HYLIA_3_1", "SCENE_LAKE_HYLIA", 3), + ("ENTR_LAKE_HYLIA_3_2", "SCENE_LAKE_HYLIA", 3), + ("ENTR_LAKE_HYLIA_3_3", "SCENE_LAKE_HYLIA", 3), + ("ENTR_LAKE_HYLIA_4", "SCENE_LAKE_HYLIA", 4), + ("ENTR_LAKE_HYLIA_4_1", "SCENE_LAKE_HYLIA", 4), + ("ENTR_LAKE_HYLIA_4_2", "SCENE_LAKE_HYLIA", 4), + ("ENTR_LAKE_HYLIA_4_3", "SCENE_LAKE_HYLIA", 4), + ("ENTR_GERUDO_VALLEY_4", "SCENE_GERUDO_VALLEY", 4), + ("ENTR_GERUDO_VALLEY_4_1", "SCENE_GERUDO_VALLEY", 4), + ("ENTR_GERUDO_VALLEY_4_2", "SCENE_GERUDO_VALLEY", 4), + ("ENTR_GERUDO_VALLEY_4_3", "SCENE_GERUDO_VALLEY", 4), + ("ENTR_ZORAS_FOUNTAIN_3", "SCENE_ZORAS_FOUNTAIN", 3), + ("ENTR_ZORAS_FOUNTAIN_3_1", "SCENE_ZORAS_FOUNTAIN", 3), + ("ENTR_ZORAS_FOUNTAIN_3_2", "SCENE_ZORAS_FOUNTAIN", 3), + ("ENTR_ZORAS_FOUNTAIN_3_3", "SCENE_ZORAS_FOUNTAIN", 3), + ("ENTR_ZORAS_FOUNTAIN_4", "SCENE_ZORAS_FOUNTAIN", 4), + ("ENTR_ZORAS_FOUNTAIN_4_1", "SCENE_ZORAS_FOUNTAIN", 4), + ("ENTR_ZORAS_FOUNTAIN_4_2", "SCENE_ZORAS_FOUNTAIN", 4), + ("ENTR_ZORAS_FOUNTAIN_4_3", "SCENE_ZORAS_FOUNTAIN", 4), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_4", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 4), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_4_1", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 4), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_4_2", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 4), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_4_3", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 4), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_5", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 5), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_5_1", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 5), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_5_2", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 5), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_5_3", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 5), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_6", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 6), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_6_1", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 6), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_6_2", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 6), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_6_3", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 6), + ("ENTR_POTION_SHOP_KAKARIKO_1", "SCENE_POTION_SHOP_KAKARIKO", 1), + ("ENTR_POTION_SHOP_KAKARIKO_1_1", "SCENE_POTION_SHOP_KAKARIKO", 1), + ("ENTR_POTION_SHOP_KAKARIKO_1_2", "SCENE_POTION_SHOP_KAKARIKO", 1), + ("ENTR_POTION_SHOP_KAKARIKO_1_3", "SCENE_POTION_SHOP_KAKARIKO", 1), + ("ENTR_POTION_SHOP_KAKARIKO_2", "SCENE_POTION_SHOP_KAKARIKO", 2), + ("ENTR_POTION_SHOP_KAKARIKO_2_1", "SCENE_POTION_SHOP_KAKARIKO", 2), + ("ENTR_POTION_SHOP_KAKARIKO_2_2", "SCENE_POTION_SHOP_KAKARIKO", 2), + ("ENTR_POTION_SHOP_KAKARIKO_2_3", "SCENE_POTION_SHOP_KAKARIKO", 2), + ("ENTR_SPIRIT_TEMPLE_2", "SCENE_SPIRIT_TEMPLE", 2), + ("ENTR_SPIRIT_TEMPLE_2_1", "SCENE_SPIRIT_TEMPLE", 2), + ("ENTR_SPIRIT_TEMPLE_2_2", "SCENE_SPIRIT_TEMPLE", 2), + ("ENTR_SPIRIT_TEMPLE_2_3", "SCENE_SPIRIT_TEMPLE", 2), + ("ENTR_SPIRIT_TEMPLE_3", "SCENE_SPIRIT_TEMPLE", 3), + ("ENTR_SPIRIT_TEMPLE_3_1", "SCENE_SPIRIT_TEMPLE", 3), + ("ENTR_SPIRIT_TEMPLE_3_2", "SCENE_SPIRIT_TEMPLE", 3), + ("ENTR_SPIRIT_TEMPLE_3_3", "SCENE_SPIRIT_TEMPLE", 3), + ("ENTR_SPIRIT_TEMPLE_4", "SCENE_SPIRIT_TEMPLE", 4), + ("ENTR_SPIRIT_TEMPLE_4_1", "SCENE_SPIRIT_TEMPLE", 4), + ("ENTR_SPIRIT_TEMPLE_4_2", "SCENE_SPIRIT_TEMPLE", 4), + ("ENTR_SPIRIT_TEMPLE_4_3", "SCENE_SPIRIT_TEMPLE", 4), + ("ENTR_GORON_CITY_2", "SCENE_GORON_CITY", 2), + ("ENTR_GORON_CITY_2_1", "SCENE_GORON_CITY", 2), + ("ENTR_GORON_CITY_2_2", "SCENE_GORON_CITY", 2), + ("ENTR_GORON_CITY_2_3", "SCENE_GORON_CITY", 2), + ("ENTR_CASTLE_COURTYARD_ZELDA_0", "SCENE_CASTLE_COURTYARD_ZELDA", 0), + ("ENTR_CASTLE_COURTYARD_ZELDA_0_1", "SCENE_CASTLE_COURTYARD_ZELDA", 0), + ("ENTR_CASTLE_COURTYARD_ZELDA_0_2", "SCENE_CASTLE_COURTYARD_ZELDA", 0), + ("ENTR_CASTLE_COURTYARD_ZELDA_0_3", "SCENE_CASTLE_COURTYARD_ZELDA", 0), + ("ENTR_CASTLE_COURTYARD_ZELDA_0_4", "SCENE_CASTLE_COURTYARD_ZELDA", 0), + ("ENTR_CASTLE_COURTYARD_ZELDA_0_5", "SCENE_CASTLE_COURTYARD_ZELDA", 0), + ("ENTR_CASTLE_COURTYARD_ZELDA_0_6", "SCENE_CASTLE_COURTYARD_ZELDA", 0), + ("ENTR_JABU_JABU_1", "SCENE_JABU_JABU", 1), + ("ENTR_JABU_JABU_1_1", "SCENE_JABU_JABU", 1), + ("ENTR_JABU_JABU_1_2", "SCENE_JABU_JABU", 1), + ("ENTR_JABU_JABU_1_3", "SCENE_JABU_JABU", 1), + ("ENTR_DODONGOS_CAVERN_BOSS_0", "SCENE_DODONGOS_CAVERN_BOSS", 0), + ("ENTR_DODONGOS_CAVERN_BOSS_0_1", "SCENE_DODONGOS_CAVERN_BOSS", 0), + ("ENTR_DODONGOS_CAVERN_BOSS_0_2", "SCENE_DODONGOS_CAVERN_BOSS", 0), + ("ENTR_DODONGOS_CAVERN_BOSS_0_3", "SCENE_DODONGOS_CAVERN_BOSS", 0), + ("ENTR_DEKU_TREE_BOSS_0", "SCENE_DEKU_TREE_BOSS", 0), + ("ENTR_DEKU_TREE_BOSS_0_1", "SCENE_DEKU_TREE_BOSS", 0), + ("ENTR_DEKU_TREE_BOSS_0_2", "SCENE_DEKU_TREE_BOSS", 0), + ("ENTR_DEKU_TREE_BOSS_0_3", "SCENE_DEKU_TREE_BOSS", 0), + ("ENTR_SHADOW_TEMPLE_BOSS_0", "SCENE_SHADOW_TEMPLE_BOSS", 0), + ("ENTR_SHADOW_TEMPLE_BOSS_0_1", "SCENE_SHADOW_TEMPLE_BOSS", 0), + ("ENTR_SHADOW_TEMPLE_BOSS_0_2", "SCENE_SHADOW_TEMPLE_BOSS", 0), + ("ENTR_SHADOW_TEMPLE_BOSS_0_3", "SCENE_SHADOW_TEMPLE_BOSS", 0), + ("ENTR_WATER_TEMPLE_BOSS_0", "SCENE_WATER_TEMPLE_BOSS", 0), + ("ENTR_WATER_TEMPLE_BOSS_0_1", "SCENE_WATER_TEMPLE_BOSS", 0), + ("ENTR_WATER_TEMPLE_BOSS_0_2", "SCENE_WATER_TEMPLE_BOSS", 0), + ("ENTR_WATER_TEMPLE_BOSS_0_3", "SCENE_WATER_TEMPLE_BOSS", 0), + ("ENTR_GANONS_TOWER_0", "SCENE_GANONS_TOWER", 0), + ("ENTR_GANONS_TOWER_0_1", "SCENE_GANONS_TOWER", 0), + ("ENTR_GANONS_TOWER_0_2", "SCENE_GANONS_TOWER", 0), + ("ENTR_GANONS_TOWER_0_3", "SCENE_GANONS_TOWER", 0), + ("ENTR_GANONDORF_BOSS_0", "SCENE_GANONDORF_BOSS", 0), + ("ENTR_GANONDORF_BOSS_0_1", "SCENE_GANONDORF_BOSS", 0), + ("ENTR_GANONDORF_BOSS_0_2", "SCENE_GANONDORF_BOSS", 0), + ("ENTR_GANONDORF_BOSS_0_3", "SCENE_GANONDORF_BOSS", 0), + ("ENTR_WATER_TEMPLE_1", "SCENE_WATER_TEMPLE", 1), + ("ENTR_WATER_TEMPLE_1_1", "SCENE_WATER_TEMPLE", 1), + ("ENTR_WATER_TEMPLE_1_2", "SCENE_WATER_TEMPLE", 1), + ("ENTR_WATER_TEMPLE_1_3", "SCENE_WATER_TEMPLE", 1), + ("ENTR_GANONS_TOWER_1", "SCENE_GANONS_TOWER", 1), + ("ENTR_GANONS_TOWER_1_1", "SCENE_GANONS_TOWER", 1), + ("ENTR_GANONS_TOWER_1_2", "SCENE_GANONS_TOWER", 1), + ("ENTR_GANONS_TOWER_1_3", "SCENE_GANONS_TOWER", 1), + ("ENTR_GANONS_TOWER_2", "SCENE_GANONS_TOWER", 2), + ("ENTR_GANONS_TOWER_2_1", "SCENE_GANONS_TOWER", 2), + ("ENTR_GANONS_TOWER_2_2", "SCENE_GANONS_TOWER", 2), + ("ENTR_GANONS_TOWER_2_3", "SCENE_GANONS_TOWER", 2), + ("ENTR_LON_LON_RANCH_5", "SCENE_LON_LON_RANCH", 5), + ("ENTR_LON_LON_RANCH_5_1", "SCENE_LON_LON_RANCH", 5), + ("ENTR_LON_LON_RANCH_5_2", "SCENE_LON_LON_RANCH", 5), + ("ENTR_LON_LON_RANCH_5_3", "SCENE_LON_LON_RANCH", 5), + ("ENTR_MIDOS_HOUSE_0", "SCENE_MIDOS_HOUSE", 0), + ("ENTR_MIDOS_HOUSE_0_1", "SCENE_MIDOS_HOUSE", 0), + ("ENTR_MIDOS_HOUSE_0_2", "SCENE_MIDOS_HOUSE", 0), + ("ENTR_MIDOS_HOUSE_0_3", "SCENE_MIDOS_HOUSE", 0), + ("ENTR_SARIAS_HOUSE_0", "SCENE_SARIAS_HOUSE", 0), + ("ENTR_SARIAS_HOUSE_0_1", "SCENE_SARIAS_HOUSE", 0), + ("ENTR_SARIAS_HOUSE_0_2", "SCENE_SARIAS_HOUSE", 0), + ("ENTR_SARIAS_HOUSE_0_3", "SCENE_SARIAS_HOUSE", 0), + ("ENTR_BACK_ALLEY_HOUSE_0", "SCENE_BACK_ALLEY_HOUSE", 0), + ("ENTR_BACK_ALLEY_HOUSE_0_1", "SCENE_BACK_ALLEY_HOUSE", 0), + ("ENTR_BACK_ALLEY_HOUSE_0_2", "SCENE_BACK_ALLEY_HOUSE", 0), + ("ENTR_BACK_ALLEY_HOUSE_0_3", "SCENE_BACK_ALLEY_HOUSE", 0), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_0", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 0), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_0_1", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 0), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_0_2", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 0), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_0_3", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 0), + ("ENTR_KOKIRI_FOREST_9", "SCENE_KOKIRI_FOREST", 9), + ("ENTR_KOKIRI_FOREST_9_1", "SCENE_KOKIRI_FOREST", 9), + ("ENTR_KOKIRI_FOREST_9_2", "SCENE_KOKIRI_FOREST", 9), + ("ENTR_KOKIRI_FOREST_9_3", "SCENE_KOKIRI_FOREST", 9), + ("ENTR_KOKIRI_FOREST_10", "SCENE_KOKIRI_FOREST", 10), + ("ENTR_KOKIRI_FOREST_10_1", "SCENE_KOKIRI_FOREST", 10), + ("ENTR_KOKIRI_FOREST_10_2", "SCENE_KOKIRI_FOREST", 10), + ("ENTR_KOKIRI_FOREST_10_3", "SCENE_KOKIRI_FOREST", 10), + ("ENTR_KAKARIKO_VILLAGE_9", "SCENE_KAKARIKO_VILLAGE", 9), + ("ENTR_KAKARIKO_VILLAGE_9_1", "SCENE_KAKARIKO_VILLAGE", 9), + ("ENTR_KAKARIKO_VILLAGE_9_2", "SCENE_KAKARIKO_VILLAGE", 9), + ("ENTR_KAKARIKO_VILLAGE_9_3", "SCENE_KAKARIKO_VILLAGE", 9), + ("ENTR_WINDMILL_AND_DAMPES_GRAVE_0", "SCENE_WINDMILL_AND_DAMPES_GRAVE", 0), + ("ENTR_WINDMILL_AND_DAMPES_GRAVE_0_1", "SCENE_WINDMILL_AND_DAMPES_GRAVE", 0), + ("ENTR_WINDMILL_AND_DAMPES_GRAVE_0_2", "SCENE_WINDMILL_AND_DAMPES_GRAVE", 0), + ("ENTR_WINDMILL_AND_DAMPES_GRAVE_0_3", "SCENE_WINDMILL_AND_DAMPES_GRAVE", 0), + ("ENTR_WINDMILL_AND_DAMPES_GRAVE_1", "SCENE_WINDMILL_AND_DAMPES_GRAVE", 1), + ("ENTR_WINDMILL_AND_DAMPES_GRAVE_1_1", "SCENE_WINDMILL_AND_DAMPES_GRAVE", 1), + ("ENTR_WINDMILL_AND_DAMPES_GRAVE_1_2", "SCENE_WINDMILL_AND_DAMPES_GRAVE", 1), + ("ENTR_WINDMILL_AND_DAMPES_GRAVE_1_3", "SCENE_WINDMILL_AND_DAMPES_GRAVE", 1), + ("ENTR_KOKIRI_FOREST_11", "SCENE_KOKIRI_FOREST", 11), + ("ENTR_KOKIRI_FOREST_11_1", "SCENE_KOKIRI_FOREST", 11), + ("ENTR_KOKIRI_FOREST_11_2", "SCENE_KOKIRI_FOREST", 11), + ("ENTR_KOKIRI_FOREST_11_3", "SCENE_KOKIRI_FOREST", 11), + ("ENTR_DEATH_MOUNTAIN_TRAIL_4", "SCENE_DEATH_MOUNTAIN_TRAIL", 4), + ("ENTR_DEATH_MOUNTAIN_TRAIL_4_1", "SCENE_DEATH_MOUNTAIN_TRAIL", 4), + ("ENTR_DEATH_MOUNTAIN_TRAIL_4_2", "SCENE_DEATH_MOUNTAIN_TRAIL", 4), + ("ENTR_DEATH_MOUNTAIN_TRAIL_4_3", "SCENE_DEATH_MOUNTAIN_TRAIL", 4), + ("ENTR_FISHING_POND_0", "SCENE_FISHING_POND", 0), + ("ENTR_FISHING_POND_0_1", "SCENE_FISHING_POND", 0), + ("ENTR_FISHING_POND_0_2", "SCENE_FISHING_POND", 0), + ("ENTR_FISHING_POND_0_3", "SCENE_FISHING_POND", 0), + ("ENTR_KAKARIKO_VILLAGE_10", "SCENE_KAKARIKO_VILLAGE", 10), + ("ENTR_KAKARIKO_VILLAGE_10_1", "SCENE_KAKARIKO_VILLAGE", 10), + ("ENTR_KAKARIKO_VILLAGE_10_2", "SCENE_KAKARIKO_VILLAGE", 10), + ("ENTR_KAKARIKO_VILLAGE_10_3", "SCENE_KAKARIKO_VILLAGE", 10), + ("ENTR_INSIDE_GANONS_CASTLE_0", "SCENE_INSIDE_GANONS_CASTLE", 0), + ("ENTR_INSIDE_GANONS_CASTLE_0_1", "SCENE_INSIDE_GANONS_CASTLE", 0), + ("ENTR_INSIDE_GANONS_CASTLE_0_2", "SCENE_INSIDE_GANONS_CASTLE", 0), + ("ENTR_INSIDE_GANONS_CASTLE_0_3", "SCENE_INSIDE_GANONS_CASTLE", 0), + ("ENTR_INSIDE_GANONS_CASTLE_0_4", "SCENE_INSIDE_GANONS_CASTLE", 0), + ("ENTR_INSIDE_GANONS_CASTLE_0_5", "SCENE_INSIDE_GANONS_CASTLE", 0), + ("ENTR_INSIDE_GANONS_CASTLE_0_6", "SCENE_INSIDE_GANONS_CASTLE", 0), + ("ENTR_INSIDE_GANONS_CASTLE_0_7", "SCENE_INSIDE_GANONS_CASTLE", 0), + ("ENTR_INSIDE_GANONS_CASTLE_0_8", "SCENE_INSIDE_GANONS_CASTLE", 0), + ("ENTR_INSIDE_GANONS_CASTLE_0_9", "SCENE_INSIDE_GANONS_CASTLE", 0), + ("ENTR_INSIDE_GANONS_CASTLE_0_10", "SCENE_INSIDE_GANONS_CASTLE", 0), + ("ENTR_TEMPLE_OF_TIME_EXTERIOR_DAY_1", "SCENE_TEMPLE_OF_TIME_EXTERIOR_DAY", 1), + ("ENTR_TEMPLE_OF_TIME_EXTERIOR_NIGHT_1_1", "SCENE_TEMPLE_OF_TIME_EXTERIOR_NIGHT", 1), + ("ENTR_TEMPLE_OF_TIME_EXTERIOR_RUINS_1_2", "SCENE_TEMPLE_OF_TIME_EXTERIOR_RUINS", 1), + ("ENTR_TEMPLE_OF_TIME_EXTERIOR_RUINS_1_3", "SCENE_TEMPLE_OF_TIME_EXTERIOR_RUINS", 1), + ("ENTR_HYRULE_FIELD_15", "SCENE_HYRULE_FIELD", 15), + ("ENTR_HYRULE_FIELD_15_1", "SCENE_HYRULE_FIELD", 15), + ("ENTR_HYRULE_FIELD_15_2", "SCENE_HYRULE_FIELD", 15), + ("ENTR_HYRULE_FIELD_15_3", "SCENE_HYRULE_FIELD", 15), + ("ENTR_DEATH_MOUNTAIN_TRAIL_5", "SCENE_DEATH_MOUNTAIN_TRAIL", 5), + ("ENTR_DEATH_MOUNTAIN_TRAIL_5_1", "SCENE_DEATH_MOUNTAIN_TRAIL", 5), + ("ENTR_DEATH_MOUNTAIN_TRAIL_5_2", "SCENE_DEATH_MOUNTAIN_TRAIL", 5), + ("ENTR_DEATH_MOUNTAIN_TRAIL_5_3", "SCENE_DEATH_MOUNTAIN_TRAIL", 5), + ("ENTR_HYRULE_CASTLE_4", "SCENE_HYRULE_CASTLE", 4), + ("ENTR_HYRULE_CASTLE_4_1", "SCENE_HYRULE_CASTLE", 4), + ("ENTR_OUTSIDE_GANONS_CASTLE_4_2", "SCENE_OUTSIDE_GANONS_CASTLE", 4), + ("ENTR_OUTSIDE_GANONS_CASTLE_4_3", "SCENE_OUTSIDE_GANONS_CASTLE", 4), + ("ENTR_DEATH_MOUNTAIN_CRATER_3", "SCENE_DEATH_MOUNTAIN_CRATER", 3), + ("ENTR_DEATH_MOUNTAIN_CRATER_3_1", "SCENE_DEATH_MOUNTAIN_CRATER", 3), + ("ENTR_DEATH_MOUNTAIN_CRATER_3_2", "SCENE_DEATH_MOUNTAIN_CRATER", 3), + ("ENTR_DEATH_MOUNTAIN_CRATER_3_3", "SCENE_DEATH_MOUNTAIN_CRATER", 3), + ("ENTR_THIEVES_HIDEOUT_0", "SCENE_THIEVES_HIDEOUT", 0), + ("ENTR_THIEVES_HIDEOUT_0_1", "SCENE_THIEVES_HIDEOUT", 0), + ("ENTR_THIEVES_HIDEOUT_0_2", "SCENE_THIEVES_HIDEOUT", 0), + ("ENTR_THIEVES_HIDEOUT_0_3", "SCENE_THIEVES_HIDEOUT", 0), + ("ENTR_THIEVES_HIDEOUT_1", "SCENE_THIEVES_HIDEOUT", 1), + ("ENTR_THIEVES_HIDEOUT_1_1", "SCENE_THIEVES_HIDEOUT", 1), + ("ENTR_THIEVES_HIDEOUT_1_2", "SCENE_THIEVES_HIDEOUT", 1), + ("ENTR_THIEVES_HIDEOUT_1_3", "SCENE_THIEVES_HIDEOUT", 1), + ("ENTR_THIEVES_HIDEOUT_2", "SCENE_THIEVES_HIDEOUT", 2), + ("ENTR_THIEVES_HIDEOUT_2_1", "SCENE_THIEVES_HIDEOUT", 2), + ("ENTR_THIEVES_HIDEOUT_2_2", "SCENE_THIEVES_HIDEOUT", 2), + ("ENTR_THIEVES_HIDEOUT_2_3", "SCENE_THIEVES_HIDEOUT", 2), + ("ENTR_THIEVES_HIDEOUT_3", "SCENE_THIEVES_HIDEOUT", 3), + ("ENTR_THIEVES_HIDEOUT_3_1", "SCENE_THIEVES_HIDEOUT", 3), + ("ENTR_THIEVES_HIDEOUT_3_2", "SCENE_THIEVES_HIDEOUT", 3), + ("ENTR_THIEVES_HIDEOUT_3_3", "SCENE_THIEVES_HIDEOUT", 3), + ("ENTR_THIEVES_HIDEOUT_4", "SCENE_THIEVES_HIDEOUT", 4), + ("ENTR_THIEVES_HIDEOUT_4_1", "SCENE_THIEVES_HIDEOUT", 4), + ("ENTR_THIEVES_HIDEOUT_4_2", "SCENE_THIEVES_HIDEOUT", 4), + ("ENTR_THIEVES_HIDEOUT_4_3", "SCENE_THIEVES_HIDEOUT", 4), + ("ENTR_THIEVES_HIDEOUT_5", "SCENE_THIEVES_HIDEOUT", 5), + ("ENTR_THIEVES_HIDEOUT_5_1", "SCENE_THIEVES_HIDEOUT", 5), + ("ENTR_THIEVES_HIDEOUT_5_2", "SCENE_THIEVES_HIDEOUT", 5), + ("ENTR_THIEVES_HIDEOUT_5_3", "SCENE_THIEVES_HIDEOUT", 5), + ("ENTR_THIEVES_HIDEOUT_6", "SCENE_THIEVES_HIDEOUT", 6), + ("ENTR_THIEVES_HIDEOUT_6_1", "SCENE_THIEVES_HIDEOUT", 6), + ("ENTR_THIEVES_HIDEOUT_6_2", "SCENE_THIEVES_HIDEOUT", 6), + ("ENTR_THIEVES_HIDEOUT_6_3", "SCENE_THIEVES_HIDEOUT", 6), + ("ENTR_THIEVES_HIDEOUT_7", "SCENE_THIEVES_HIDEOUT", 7), + ("ENTR_THIEVES_HIDEOUT_7_1", "SCENE_THIEVES_HIDEOUT", 7), + ("ENTR_THIEVES_HIDEOUT_7_2", "SCENE_THIEVES_HIDEOUT", 7), + ("ENTR_THIEVES_HIDEOUT_7_3", "SCENE_THIEVES_HIDEOUT", 7), + ("ENTR_THIEVES_HIDEOUT_8", "SCENE_THIEVES_HIDEOUT", 8), + ("ENTR_THIEVES_HIDEOUT_8_1", "SCENE_THIEVES_HIDEOUT", 8), + ("ENTR_THIEVES_HIDEOUT_8_2", "SCENE_THIEVES_HIDEOUT", 8), + ("ENTR_THIEVES_HIDEOUT_8_3", "SCENE_THIEVES_HIDEOUT", 8), + ("ENTR_THIEVES_HIDEOUT_9", "SCENE_THIEVES_HIDEOUT", 9), + ("ENTR_THIEVES_HIDEOUT_9_1", "SCENE_THIEVES_HIDEOUT", 9), + ("ENTR_THIEVES_HIDEOUT_9_2", "SCENE_THIEVES_HIDEOUT", 9), + ("ENTR_THIEVES_HIDEOUT_9_3", "SCENE_THIEVES_HIDEOUT", 9), + ("ENTR_THIEVES_HIDEOUT_10", "SCENE_THIEVES_HIDEOUT", 10), + ("ENTR_THIEVES_HIDEOUT_10_1", "SCENE_THIEVES_HIDEOUT", 10), + ("ENTR_THIEVES_HIDEOUT_10_2", "SCENE_THIEVES_HIDEOUT", 10), + ("ENTR_THIEVES_HIDEOUT_10_3", "SCENE_THIEVES_HIDEOUT", 10), + ("ENTR_THIEVES_HIDEOUT_11", "SCENE_THIEVES_HIDEOUT", 11), + ("ENTR_THIEVES_HIDEOUT_11_1", "SCENE_THIEVES_HIDEOUT", 11), + ("ENTR_THIEVES_HIDEOUT_11_2", "SCENE_THIEVES_HIDEOUT", 11), + ("ENTR_THIEVES_HIDEOUT_11_3", "SCENE_THIEVES_HIDEOUT", 11), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_7", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 7), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_7_1", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 7), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_7_2", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 7), + ("ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_7_3", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", 7), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_1", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 1), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_1_1", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 1), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_1_2", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 1), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_1_3", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 1), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_1", "SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC", 1), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_1_1", "SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC", 1), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_1_2", "SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC", 1), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_1_3", "SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC", 1), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_2", "SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC", 2), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_2_1", "SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC", 2), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_2_2", "SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC", 2), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_2_3", "SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC", 2), + ("ENTR_LOST_WOODS_4", "SCENE_LOST_WOODS", 4), + ("ENTR_LOST_WOODS_4_1", "SCENE_LOST_WOODS", 4), + ("ENTR_LOST_WOODS_4_2", "SCENE_LOST_WOODS", 4), + ("ENTR_LOST_WOODS_4_3", "SCENE_LOST_WOODS", 4), + ("ENTR_LON_LON_RANCH_6", "SCENE_LON_LON_RANCH", 6), + ("ENTR_LON_LON_RANCH_6_1", "SCENE_LON_LON_RANCH", 6), + ("ENTR_LON_LON_RANCH_6_2", "SCENE_LON_LON_RANCH", 6), + ("ENTR_LON_LON_RANCH_6_3", "SCENE_LON_LON_RANCH", 6), + ("ENTR_LON_LON_RANCH_7", "SCENE_LON_LON_RANCH", 7), + ("ENTR_LON_LON_RANCH_7_1", "SCENE_LON_LON_RANCH", 7), + ("ENTR_LON_LON_RANCH_7_2", "SCENE_LON_LON_RANCH", 7), + ("ENTR_LON_LON_RANCH_7_3", "SCENE_LON_LON_RANCH", 7), + ("ENTR_LOST_WOODS_5", "SCENE_LOST_WOODS", 5), + ("ENTR_LOST_WOODS_5_1", "SCENE_LOST_WOODS", 5), + ("ENTR_LOST_WOODS_5_2", "SCENE_LOST_WOODS", 5), + ("ENTR_LOST_WOODS_5_3", "SCENE_LOST_WOODS", 5), + ("ENTR_LOST_WOODS_6", "SCENE_LOST_WOODS", 6), + ("ENTR_LOST_WOODS_6_1", "SCENE_LOST_WOODS", 6), + ("ENTR_LOST_WOODS_6_2", "SCENE_LOST_WOODS", 6), + ("ENTR_LOST_WOODS_6_3", "SCENE_LOST_WOODS", 6), + ("ENTR_LOST_WOODS_7", "SCENE_LOST_WOODS", 7), + ("ENTR_LOST_WOODS_7_1", "SCENE_LOST_WOODS", 7), + ("ENTR_LOST_WOODS_7_2", "SCENE_LOST_WOODS", 7), + ("ENTR_LOST_WOODS_7_3", "SCENE_LOST_WOODS", 7), + ("ENTR_LOST_WOODS_8", "SCENE_LOST_WOODS", 8), + ("ENTR_LOST_WOODS_8_1", "SCENE_LOST_WOODS", 8), + ("ENTR_LOST_WOODS_8_2", "SCENE_LOST_WOODS", 8), + ("ENTR_LOST_WOODS_8_3", "SCENE_LOST_WOODS", 8), + ("ENTR_GORON_CITY_3", "SCENE_GORON_CITY", 3), + ("ENTR_GORON_CITY_3_1", "SCENE_GORON_CITY", 3), + ("ENTR_GORON_CITY_3_2", "SCENE_GORON_CITY", 3), + ("ENTR_GORON_CITY_3_3", "SCENE_GORON_CITY", 3), + ("ENTR_LAKE_HYLIA_5", "SCENE_LAKE_HYLIA", 5), + ("ENTR_LAKE_HYLIA_5_1", "SCENE_LAKE_HYLIA", 5), + ("ENTR_LAKE_HYLIA_5_2", "SCENE_LAKE_HYLIA", 5), + ("ENTR_LAKE_HYLIA_5_3", "SCENE_LAKE_HYLIA", 5), + ("ENTR_SHADOW_TEMPLE_3", "SCENE_SHADOW_TEMPLE", 3), + ("ENTR_SHADOW_TEMPLE_3_1", "SCENE_SHADOW_TEMPLE", 3), + ("ENTR_SHADOW_TEMPLE_3_2", "SCENE_SHADOW_TEMPLE", 3), + ("ENTR_SHADOW_TEMPLE_3_3", "SCENE_SHADOW_TEMPLE", 3), + ("ENTR_KAKARIKO_VILLAGE_11", "SCENE_KAKARIKO_VILLAGE", 11), + ("ENTR_KAKARIKO_VILLAGE_11_1", "SCENE_KAKARIKO_VILLAGE", 11), + ("ENTR_KAKARIKO_VILLAGE_11_2", "SCENE_KAKARIKO_VILLAGE", 11), + ("ENTR_KAKARIKO_VILLAGE_11_3", "SCENE_KAKARIKO_VILLAGE", 11), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_3", "SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC", 3), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_3_1", "SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC", 3), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_3_2", "SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC", 3), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_3_3", "SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC", 3), + ("ENTR_DEATH_MOUNTAIN_CRATER_4", "SCENE_DEATH_MOUNTAIN_CRATER", 4), + ("ENTR_DEATH_MOUNTAIN_CRATER_4_1", "SCENE_DEATH_MOUNTAIN_CRATER", 4), + ("ENTR_DEATH_MOUNTAIN_CRATER_4_2", "SCENE_DEATH_MOUNTAIN_CRATER", 4), + ("ENTR_DEATH_MOUNTAIN_CRATER_4_3", "SCENE_DEATH_MOUNTAIN_CRATER", 4), + ("ENTR_HYRULE_CASTLE_3", "SCENE_HYRULE_CASTLE", 3), + ("ENTR_HYRULE_CASTLE_3_1", "SCENE_HYRULE_CASTLE", 3), + ("ENTR_OUTSIDE_GANONS_CASTLE_3_2", "SCENE_OUTSIDE_GANONS_CASTLE", 3), + ("ENTR_OUTSIDE_GANONS_CASTLE_3_3", "SCENE_OUTSIDE_GANONS_CASTLE", 3), + ("ENTR_HYRULE_CASTLE_3_4", "SCENE_HYRULE_CASTLE", 3), + ("ENTR_KAKARIKO_VILLAGE_12", "SCENE_KAKARIKO_VILLAGE", 12), + ("ENTR_KAKARIKO_VILLAGE_12_1", "SCENE_KAKARIKO_VILLAGE", 12), + ("ENTR_KAKARIKO_VILLAGE_12_2", "SCENE_KAKARIKO_VILLAGE", 12), + ("ENTR_KAKARIKO_VILLAGE_12_3", "SCENE_KAKARIKO_VILLAGE", 12), + ("ENTR_WINDMILL_AND_DAMPES_GRAVE_2", "SCENE_WINDMILL_AND_DAMPES_GRAVE", 2), + ("ENTR_WINDMILL_AND_DAMPES_GRAVE_2_1", "SCENE_WINDMILL_AND_DAMPES_GRAVE", 2), + ("ENTR_WINDMILL_AND_DAMPES_GRAVE_2_2", "SCENE_WINDMILL_AND_DAMPES_GRAVE", 2), + ("ENTR_WINDMILL_AND_DAMPES_GRAVE_2_3", "SCENE_WINDMILL_AND_DAMPES_GRAVE", 2), + ("ENTR_BOMBCHU_BOWLING_ALLEY_0", "SCENE_BOMBCHU_BOWLING_ALLEY", 0), + ("ENTR_BOMBCHU_BOWLING_ALLEY_0_1", "SCENE_BOMBCHU_BOWLING_ALLEY", 0), + ("ENTR_BOMBCHU_BOWLING_ALLEY_0_2", "SCENE_BOMBCHU_BOWLING_ALLEY", 0), + ("ENTR_BOMBCHU_BOWLING_ALLEY_0_3", "SCENE_BOMBCHU_BOWLING_ALLEY", 0), + ("ENTR_GRAVEYARD_6", "SCENE_GRAVEYARD", 6), + ("ENTR_GRAVEYARD_6_1", "SCENE_GRAVEYARD", 6), + ("ENTR_GRAVEYARD_6_2", "SCENE_GRAVEYARD", 6), + ("ENTR_GRAVEYARD_6_3", "SCENE_GRAVEYARD", 6), + ("ENTR_HYRULE_FIELD_16", "SCENE_HYRULE_FIELD", 16), + ("ENTR_HYRULE_FIELD_16_1", "SCENE_HYRULE_FIELD", 16), + ("ENTR_HYRULE_FIELD_16_2", "SCENE_HYRULE_FIELD", 16), + ("ENTR_HYRULE_FIELD_16_3", "SCENE_HYRULE_FIELD", 16), + ("ENTR_KAKARIKO_VILLAGE_13", "SCENE_KAKARIKO_VILLAGE", 13), + ("ENTR_KAKARIKO_VILLAGE_13_1", "SCENE_KAKARIKO_VILLAGE", 13), + ("ENTR_KAKARIKO_VILLAGE_13_2", "SCENE_KAKARIKO_VILLAGE", 13), + ("ENTR_KAKARIKO_VILLAGE_13_3", "SCENE_KAKARIKO_VILLAGE", 13), + ("ENTR_GANON_BOSS_0", "SCENE_GANON_BOSS", 0), + ("ENTR_GANON_BOSS_0_1", "SCENE_GANON_BOSS", 0), + ("ENTR_GANON_BOSS_0_2", "SCENE_GANON_BOSS", 0), + ("ENTR_GANON_BOSS_0_3", "SCENE_GANON_BOSS", 0), + ("ENTR_GANON_BOSS_0_4", "SCENE_GANON_BOSS", 0), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_6", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 6), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_6_1", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 6), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_6_2", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 6), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_6_3", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 6), + ("ENTR_BESITU_0", "SCENE_BESITU", 0), + ("ENTR_BESITU_0_1", "SCENE_BESITU", 0), + ("ENTR_BESITU_0_2", "SCENE_BESITU", 0), + ("ENTR_BESITU_0_3", "SCENE_BESITU", 0), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_7", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 7), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_7_1", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 7), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_7_2", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 7), + ("ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_7_3", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", 7), + ("ENTR_BOMBCHU_SHOP_1", "SCENE_BOMBCHU_SHOP", 1), + ("ENTR_BOMBCHU_SHOP_1_1", "SCENE_BOMBCHU_SHOP", 1), + ("ENTR_BOMBCHU_SHOP_1_2", "SCENE_BOMBCHU_SHOP", 1), + ("ENTR_BOMBCHU_SHOP_1_3", "SCENE_BOMBCHU_SHOP", 1), + ("ENTR_BAZAAR_1", "SCENE_BAZAAR", 1), + ("ENTR_BAZAAR_1_1", "SCENE_BAZAAR", 1), + ("ENTR_BAZAAR_1_2", "SCENE_BAZAAR", 1), + ("ENTR_BAZAAR_1_3", "SCENE_BAZAAR", 1), + ("ENTR_HAPPY_MASK_SHOP_0", "SCENE_HAPPY_MASK_SHOP", 0), + ("ENTR_HAPPY_MASK_SHOP_0_1", "SCENE_HAPPY_MASK_SHOP", 0), + ("ENTR_HAPPY_MASK_SHOP_0_2", "SCENE_HAPPY_MASK_SHOP", 0), + ("ENTR_HAPPY_MASK_SHOP_0_3", "SCENE_HAPPY_MASK_SHOP", 0), + ("ENTR_INSIDE_GANONS_CASTLE_1", "SCENE_INSIDE_GANONS_CASTLE", 1), + ("ENTR_INSIDE_GANONS_CASTLE_1_1", "SCENE_INSIDE_GANONS_CASTLE", 1), + ("ENTR_INSIDE_GANONS_CASTLE_1_2", "SCENE_INSIDE_GANONS_CASTLE", 1), + ("ENTR_INSIDE_GANONS_CASTLE_1_3", "SCENE_INSIDE_GANONS_CASTLE", 1), + ("ENTR_INSIDE_GANONS_CASTLE_2", "SCENE_INSIDE_GANONS_CASTLE", 2), + ("ENTR_INSIDE_GANONS_CASTLE_2_1", "SCENE_INSIDE_GANONS_CASTLE", 2), + ("ENTR_INSIDE_GANONS_CASTLE_2_2", "SCENE_INSIDE_GANONS_CASTLE", 2), + ("ENTR_INSIDE_GANONS_CASTLE_2_3", "SCENE_INSIDE_GANONS_CASTLE", 2), + ("ENTR_INSIDE_GANONS_CASTLE_3", "SCENE_INSIDE_GANONS_CASTLE", 3), + ("ENTR_INSIDE_GANONS_CASTLE_3_1", "SCENE_INSIDE_GANONS_CASTLE", 3), + ("ENTR_INSIDE_GANONS_CASTLE_3_2", "SCENE_INSIDE_GANONS_CASTLE", 3), + ("ENTR_INSIDE_GANONS_CASTLE_3_3", "SCENE_INSIDE_GANONS_CASTLE", 3), + ("ENTR_INSIDE_GANONS_CASTLE_4", "SCENE_INSIDE_GANONS_CASTLE", 4), + ("ENTR_INSIDE_GANONS_CASTLE_4_1", "SCENE_INSIDE_GANONS_CASTLE", 4), + ("ENTR_INSIDE_GANONS_CASTLE_4_2", "SCENE_INSIDE_GANONS_CASTLE", 4), + ("ENTR_INSIDE_GANONS_CASTLE_4_3", "SCENE_INSIDE_GANONS_CASTLE", 4), + ("ENTR_INSIDE_GANONS_CASTLE_5", "SCENE_INSIDE_GANONS_CASTLE", 5), + ("ENTR_INSIDE_GANONS_CASTLE_5_1", "SCENE_INSIDE_GANONS_CASTLE", 5), + ("ENTR_INSIDE_GANONS_CASTLE_5_2", "SCENE_INSIDE_GANONS_CASTLE", 5), + ("ENTR_INSIDE_GANONS_CASTLE_5_3", "SCENE_INSIDE_GANONS_CASTLE", 5), + ("ENTR_INSIDE_GANONS_CASTLE_6", "SCENE_INSIDE_GANONS_CASTLE", 6), + ("ENTR_INSIDE_GANONS_CASTLE_6_1", "SCENE_INSIDE_GANONS_CASTLE", 6), + ("ENTR_INSIDE_GANONS_CASTLE_6_2", "SCENE_INSIDE_GANONS_CASTLE", 6), + ("ENTR_INSIDE_GANONS_CASTLE_6_3", "SCENE_INSIDE_GANONS_CASTLE", 6), + ("ENTR_INSIDE_GANONS_CASTLE_7", "SCENE_INSIDE_GANONS_CASTLE", 7), + ("ENTR_INSIDE_GANONS_CASTLE_7_1", "SCENE_INSIDE_GANONS_CASTLE", 7), + ("ENTR_INSIDE_GANONS_CASTLE_7_2", "SCENE_INSIDE_GANONS_CASTLE", 7), + ("ENTR_INSIDE_GANONS_CASTLE_7_3", "SCENE_INSIDE_GANONS_CASTLE", 7), + ("ENTR_HOUSE_OF_SKULLTULA_0", "SCENE_HOUSE_OF_SKULLTULA", 0), + ("ENTR_HOUSE_OF_SKULLTULA_0_1", "SCENE_HOUSE_OF_SKULLTULA", 0), + ("ENTR_HOUSE_OF_SKULLTULA_0_2", "SCENE_HOUSE_OF_SKULLTULA", 0), + ("ENTR_HOUSE_OF_SKULLTULA_0_3", "SCENE_HOUSE_OF_SKULLTULA", 0), + ("ENTR_KAKARIKO_VILLAGE_14", "SCENE_KAKARIKO_VILLAGE", 14), + ("ENTR_KAKARIKO_VILLAGE_14_1", "SCENE_KAKARIKO_VILLAGE", 14), + ("ENTR_KAKARIKO_VILLAGE_14_2", "SCENE_KAKARIKO_VILLAGE", 14), + ("ENTR_KAKARIKO_VILLAGE_14_3", "SCENE_KAKARIKO_VILLAGE", 14), + ("ENTR_LON_LON_RANCH_8", "SCENE_LON_LON_RANCH", 8), + ("ENTR_LON_LON_RANCH_8_1", "SCENE_LON_LON_RANCH", 8), + ("ENTR_LON_LON_RANCH_8_2", "SCENE_LON_LON_RANCH", 8), + ("ENTR_LON_LON_RANCH_8_3", "SCENE_LON_LON_RANCH", 8), + ("ENTR_LON_LON_RANCH_9", "SCENE_LON_LON_RANCH", 9), + ("ENTR_LON_LON_RANCH_9_1", "SCENE_LON_LON_RANCH", 9), + ("ENTR_LON_LON_RANCH_9_2", "SCENE_LON_LON_RANCH", 9), + ("ENTR_LON_LON_RANCH_9_3", "SCENE_LON_LON_RANCH", 9), + ("ENTR_LAKE_HYLIA_7", "SCENE_LAKE_HYLIA", 7), + ("ENTR_LAKE_HYLIA_7_1", "SCENE_LAKE_HYLIA", 7), + ("ENTR_LAKE_HYLIA_7_2", "SCENE_LAKE_HYLIA", 7), + ("ENTR_LAKE_HYLIA_7_3", "SCENE_LAKE_HYLIA", 7), + ("ENTR_DEATH_MOUNTAIN_CRATER_5", "SCENE_DEATH_MOUNTAIN_CRATER", 5), + ("ENTR_DEATH_MOUNTAIN_CRATER_5_1", "SCENE_DEATH_MOUNTAIN_CRATER", 5), + ("ENTR_DEATH_MOUNTAIN_CRATER_5_2", "SCENE_DEATH_MOUNTAIN_CRATER", 5), + ("ENTR_DEATH_MOUNTAIN_CRATER_5_3", "SCENE_DEATH_MOUNTAIN_CRATER", 5), + ("ENTR_GRAVEYARD_7", "SCENE_GRAVEYARD", 7), + ("ENTR_GRAVEYARD_7_1", "SCENE_GRAVEYARD", 7), + ("ENTR_GRAVEYARD_7_2", "SCENE_GRAVEYARD", 7), + ("ENTR_GRAVEYARD_7_3", "SCENE_GRAVEYARD", 7), + ("ENTR_INSIDE_GANONS_CASTLE_COLLAPSE_0", "SCENE_INSIDE_GANONS_CASTLE_COLLAPSE", 0), + ("ENTR_INSIDE_GANONS_CASTLE_COLLAPSE_0_1", "SCENE_INSIDE_GANONS_CASTLE_COLLAPSE", 0), + ("ENTR_INSIDE_GANONS_CASTLE_COLLAPSE_0_2", "SCENE_INSIDE_GANONS_CASTLE_COLLAPSE", 0), + ("ENTR_INSIDE_GANONS_CASTLE_COLLAPSE_0_3", "SCENE_INSIDE_GANONS_CASTLE_COLLAPSE", 0), + ("ENTR_THIEVES_HIDEOUT_12", "SCENE_THIEVES_HIDEOUT", 12), + ("ENTR_THIEVES_HIDEOUT_12_1", "SCENE_THIEVES_HIDEOUT", 12), + ("ENTR_THIEVES_HIDEOUT_12_2", "SCENE_THIEVES_HIDEOUT", 12), + ("ENTR_THIEVES_HIDEOUT_12_3", "SCENE_THIEVES_HIDEOUT", 12), + ("ENTR_ROYAL_FAMILYS_TOMB_1", "SCENE_ROYAL_FAMILYS_TOMB", 1), + ("ENTR_ROYAL_FAMILYS_TOMB_1_1", "SCENE_ROYAL_FAMILYS_TOMB", 1), + ("ENTR_ROYAL_FAMILYS_TOMB_1_2", "SCENE_ROYAL_FAMILYS_TOMB", 1), + ("ENTR_ROYAL_FAMILYS_TOMB_1_3", "SCENE_ROYAL_FAMILYS_TOMB", 1), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_1", "SCENE_GREAT_FAIRYS_FOUNTAIN_SPELLS", 1), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_1_1", "SCENE_GREAT_FAIRYS_FOUNTAIN_SPELLS", 1), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_1_2", "SCENE_GREAT_FAIRYS_FOUNTAIN_SPELLS", 1), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_1_3", "SCENE_GREAT_FAIRYS_FOUNTAIN_SPELLS", 1), + ("ENTR_DESERT_COLOSSUS_7", "SCENE_DESERT_COLOSSUS", 7), + ("ENTR_DESERT_COLOSSUS_7_1", "SCENE_DESERT_COLOSSUS", 7), + ("ENTR_DESERT_COLOSSUS_7_2", "SCENE_DESERT_COLOSSUS", 7), + ("ENTR_DESERT_COLOSSUS_7_3", "SCENE_DESERT_COLOSSUS", 7), + ("ENTR_GRAVEYARD_8", "SCENE_GRAVEYARD", 8), + ("ENTR_GRAVEYARD_8_1", "SCENE_GRAVEYARD", 8), + ("ENTR_GRAVEYARD_8_2", "SCENE_GRAVEYARD", 8), + ("ENTR_GRAVEYARD_8_3", "SCENE_GRAVEYARD", 8), + ("ENTR_FOREST_TEMPLE_2", "SCENE_FOREST_TEMPLE", 2), + ("ENTR_FOREST_TEMPLE_2_1", "SCENE_FOREST_TEMPLE", 2), + ("ENTR_FOREST_TEMPLE_2_2", "SCENE_FOREST_TEMPLE", 2), + ("ENTR_FOREST_TEMPLE_2_3", "SCENE_FOREST_TEMPLE", 2), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_2", "SCENE_GREAT_FAIRYS_FOUNTAIN_SPELLS", 2), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_2_1", "SCENE_GREAT_FAIRYS_FOUNTAIN_SPELLS", 2), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_2_2", "SCENE_GREAT_FAIRYS_FOUNTAIN_SPELLS", 2), + ("ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_2_3", "SCENE_GREAT_FAIRYS_FOUNTAIN_SPELLS", 2), + ("ENTR_TEMPLE_OF_TIME_5", "SCENE_TEMPLE_OF_TIME", 5), + ("ENTR_TEMPLE_OF_TIME_5_1", "SCENE_TEMPLE_OF_TIME", 5), + ("ENTR_TEMPLE_OF_TIME_5_2", "SCENE_TEMPLE_OF_TIME", 5), + ("ENTR_TEMPLE_OF_TIME_5_3", "SCENE_TEMPLE_OF_TIME", 5), + ("ENTR_TEMPLE_OF_TIME_6", "SCENE_TEMPLE_OF_TIME", 6), + ("ENTR_TEMPLE_OF_TIME_6_1", "SCENE_TEMPLE_OF_TIME", 6), + ("ENTR_TEMPLE_OF_TIME_6_2", "SCENE_TEMPLE_OF_TIME", 6), + ("ENTR_TEMPLE_OF_TIME_6_3", "SCENE_TEMPLE_OF_TIME", 6), + ("ENTR_HYRULE_FIELD_17", "SCENE_HYRULE_FIELD", 17), + ("ENTR_HYRULE_FIELD_17_1", "SCENE_HYRULE_FIELD", 17), + ("ENTR_HYRULE_FIELD_17_2", "SCENE_HYRULE_FIELD", 17), + ("ENTR_HYRULE_FIELD_17_3", "SCENE_HYRULE_FIELD", 17), + ("ENTR_GROTTOS_1", "SCENE_GROTTOS", 1), + ("ENTR_GROTTOS_1_1", "SCENE_GROTTOS", 1), + ("ENTR_GROTTOS_1_2", "SCENE_GROTTOS", 1), + ("ENTR_GROTTOS_1_3", "SCENE_GROTTOS", 1), + ("ENTR_GROTTOS_2", "SCENE_GROTTOS", 2), + ("ENTR_GROTTOS_2_1", "SCENE_GROTTOS", 2), + ("ENTR_GROTTOS_2_2", "SCENE_GROTTOS", 2), + ("ENTR_GROTTOS_2_3", "SCENE_GROTTOS", 2), + ("ENTR_GROTTOS_3", "SCENE_GROTTOS", 3), + ("ENTR_GROTTOS_3_1", "SCENE_GROTTOS", 3), + ("ENTR_GROTTOS_3_2", "SCENE_GROTTOS", 3), + ("ENTR_GROTTOS_3_3", "SCENE_GROTTOS", 3), + ("ENTR_GROTTOS_4", "SCENE_GROTTOS", 4), + ("ENTR_GROTTOS_4_1", "SCENE_GROTTOS", 4), + ("ENTR_GROTTOS_4_2", "SCENE_GROTTOS", 4), + ("ENTR_GROTTOS_4_3", "SCENE_GROTTOS", 4), + ("ENTR_GROTTOS_5", "SCENE_GROTTOS", 5), + ("ENTR_GROTTOS_5_1", "SCENE_GROTTOS", 5), + ("ENTR_GROTTOS_5_2", "SCENE_GROTTOS", 5), + ("ENTR_GROTTOS_5_3", "SCENE_GROTTOS", 5), + ("ENTR_GROTTOS_6", "SCENE_GROTTOS", 6), + ("ENTR_GROTTOS_6_1", "SCENE_GROTTOS", 6), + ("ENTR_GROTTOS_6_2", "SCENE_GROTTOS", 6), + ("ENTR_GROTTOS_6_3", "SCENE_GROTTOS", 6), + ("ENTR_GROTTOS_7", "SCENE_GROTTOS", 7), + ("ENTR_GROTTOS_7_1", "SCENE_GROTTOS", 7), + ("ENTR_GROTTOS_7_2", "SCENE_GROTTOS", 7), + ("ENTR_GROTTOS_7_3", "SCENE_GROTTOS", 7), + ("ENTR_GROTTOS_8", "SCENE_GROTTOS", 8), + ("ENTR_GROTTOS_8_1", "SCENE_GROTTOS", 8), + ("ENTR_GROTTOS_8_2", "SCENE_GROTTOS", 8), + ("ENTR_GROTTOS_8_3", "SCENE_GROTTOS", 8), + ("ENTR_GROTTOS_9", "SCENE_GROTTOS", 9), + ("ENTR_GROTTOS_9_1", "SCENE_GROTTOS", 9), + ("ENTR_GROTTOS_9_2", "SCENE_GROTTOS", 9), + ("ENTR_GROTTOS_9_3", "SCENE_GROTTOS", 9), + ("ENTR_GROTTOS_10", "SCENE_GROTTOS", 10), + ("ENTR_GROTTOS_10_1", "SCENE_GROTTOS", 10), + ("ENTR_GROTTOS_10_2", "SCENE_GROTTOS", 10), + ("ENTR_GROTTOS_10_3", "SCENE_GROTTOS", 10), + ("ENTR_GROTTOS_11", "SCENE_GROTTOS", 11), + ("ENTR_GROTTOS_11_1", "SCENE_GROTTOS", 11), + ("ENTR_GROTTOS_11_2", "SCENE_GROTTOS", 11), + ("ENTR_GROTTOS_11_3", "SCENE_GROTTOS", 11), + ("ENTR_GROTTOS_12", "SCENE_GROTTOS", 12), + ("ENTR_GROTTOS_12_1", "SCENE_GROTTOS", 12), + ("ENTR_GROTTOS_12_2", "SCENE_GROTTOS", 12), + ("ENTR_GROTTOS_12_3", "SCENE_GROTTOS", 12), + ("ENTR_IMPAS_HOUSE_1", "SCENE_IMPAS_HOUSE", 1), + ("ENTR_IMPAS_HOUSE_1_1", "SCENE_IMPAS_HOUSE", 1), + ("ENTR_IMPAS_HOUSE_1_2", "SCENE_IMPAS_HOUSE", 1), + ("ENTR_IMPAS_HOUSE_1_3", "SCENE_IMPAS_HOUSE", 1), + ("ENTR_BOTTOM_OF_THE_WELL_1", "SCENE_BOTTOM_OF_THE_WELL", 1), + ("ENTR_BOTTOM_OF_THE_WELL_1_1", "SCENE_BOTTOM_OF_THE_WELL", 1), + ("ENTR_BOTTOM_OF_THE_WELL_1_2", "SCENE_BOTTOM_OF_THE_WELL", 1), + ("ENTR_BOTTOM_OF_THE_WELL_1_3", "SCENE_BOTTOM_OF_THE_WELL", 1), + ("ENTR_LON_LON_BUILDINGS_1", "SCENE_LON_LON_BUILDINGS", 1), + ("ENTR_LON_LON_BUILDINGS_1_1", "SCENE_LON_LON_BUILDINGS", 1), + ("ENTR_LON_LON_BUILDINGS_1_2", "SCENE_LON_LON_BUILDINGS", 1), + ("ENTR_LON_LON_BUILDINGS_1_3", "SCENE_LON_LON_BUILDINGS", 1), + ("ENTR_LON_LON_RANCH_10", "SCENE_LON_LON_RANCH", 10), + ("ENTR_LON_LON_RANCH_10_1", "SCENE_LON_LON_RANCH", 10), + ("ENTR_LON_LON_RANCH_10_2", "SCENE_LON_LON_RANCH", 10), + ("ENTR_LON_LON_RANCH_10_3", "SCENE_LON_LON_RANCH", 10), + ("ENTR_ICE_CAVERN_1", "SCENE_ICE_CAVERN", 1), + ("ENTR_ICE_CAVERN_1_1", "SCENE_ICE_CAVERN", 1), + ("ENTR_ICE_CAVERN_1_2", "SCENE_ICE_CAVERN", 1), + ("ENTR_ICE_CAVERN_1_3", "SCENE_ICE_CAVERN", 1), + ("ENTR_KAKARIKO_VILLAGE_15", "SCENE_KAKARIKO_VILLAGE", 15), + ("ENTR_KAKARIKO_VILLAGE_15_1", "SCENE_KAKARIKO_VILLAGE", 15), + ("ENTR_KAKARIKO_VILLAGE_15_2", "SCENE_KAKARIKO_VILLAGE", 15), + ("ENTR_KAKARIKO_VILLAGE_15_3", "SCENE_KAKARIKO_VILLAGE", 15), + ("ENTR_LOST_WOODS_9", "SCENE_LOST_WOODS", 9), + ("ENTR_LOST_WOODS_9_1", "SCENE_LOST_WOODS", 9), + ("ENTR_LOST_WOODS_9_2", "SCENE_LOST_WOODS", 9), + ("ENTR_LOST_WOODS_9_3", "SCENE_LOST_WOODS", 9), + ("ENTR_LON_LON_BUILDINGS_2", "SCENE_LON_LON_BUILDINGS", 2), + ("ENTR_LON_LON_BUILDINGS_2_1", "SCENE_LON_LON_BUILDINGS", 2), + ("ENTR_LON_LON_BUILDINGS_2_2", "SCENE_LON_LON_BUILDINGS", 2), + ("ENTR_LON_LON_BUILDINGS_2_3", "SCENE_LON_LON_BUILDINGS", 2), + ("ENTR_KOKIRI_FOREST_12", "SCENE_KOKIRI_FOREST", 12), + ("ENTR_KOKIRI_FOREST_12_1", "SCENE_KOKIRI_FOREST", 12), + ("ENTR_KOKIRI_FOREST_12_2", "SCENE_KOKIRI_FOREST", 12), + ("ENTR_KOKIRI_FOREST_12_3", "SCENE_KOKIRI_FOREST", 12), + ("ENTR_SPIRIT_TEMPLE_BOSS_2", "SCENE_SPIRIT_TEMPLE_BOSS", 2), + ("ENTR_SPIRIT_TEMPLE_BOSS_2_1", "SCENE_SPIRIT_TEMPLE_BOSS", 2), + ("ENTR_SPIRIT_TEMPLE_BOSS_2_2", "SCENE_SPIRIT_TEMPLE_BOSS", 2), + ("ENTR_SPIRIT_TEMPLE_BOSS_2_3", "SCENE_SPIRIT_TEMPLE_BOSS", 2), + ("ENTR_CASTLE_COURTYARD_ZELDA_1", "SCENE_CASTLE_COURTYARD_ZELDA", 1), + ("ENTR_CASTLE_COURTYARD_ZELDA_1_1", "SCENE_CASTLE_COURTYARD_ZELDA", 1), + ("ENTR_CASTLE_COURTYARD_ZELDA_1_2", "SCENE_CASTLE_COURTYARD_ZELDA", 1), + ("ENTR_CASTLE_COURTYARD_ZELDA_1_3", "SCENE_CASTLE_COURTYARD_ZELDA", 1), + ("ENTR_TEMPLE_OF_TIME_7", "SCENE_TEMPLE_OF_TIME", 7), + ("ENTR_TEMPLE_OF_TIME_7_1", "SCENE_TEMPLE_OF_TIME", 7), + ("ENTR_TEMPLE_OF_TIME_7_2", "SCENE_TEMPLE_OF_TIME", 7), + ("ENTR_TEMPLE_OF_TIME_7_3", "SCENE_TEMPLE_OF_TIME", 7), + ("ENTR_GERUDOS_FORTRESS_18", "SCENE_GERUDOS_FORTRESS", 18), + ("ENTR_GERUDOS_FORTRESS_18_1", "SCENE_GERUDOS_FORTRESS", 18), + ("ENTR_GERUDOS_FORTRESS_18_2", "SCENE_GERUDOS_FORTRESS", 18), + ("ENTR_GERUDOS_FORTRESS_18_3", "SCENE_GERUDOS_FORTRESS", 18), + ("ENTR_GROTTOS_13", "SCENE_GROTTOS", 13), + ("ENTR_GROTTOS_13_1", "SCENE_GROTTOS", 13), + ("ENTR_GROTTOS_13_2", "SCENE_GROTTOS", 13), + ("ENTR_GROTTOS_13_3", "SCENE_GROTTOS", 13), + ("ENTR_SACRED_FOREST_MEADOW_2", "SCENE_SACRED_FOREST_MEADOW", 2), + ("ENTR_SACRED_FOREST_MEADOW_2_1", "SCENE_SACRED_FOREST_MEADOW", 2), + ("ENTR_SACRED_FOREST_MEADOW_2_2", "SCENE_SACRED_FOREST_MEADOW", 2), + ("ENTR_SACRED_FOREST_MEADOW_2_3", "SCENE_SACRED_FOREST_MEADOW", 2), + ("ENTR_LAKE_HYLIA_8", "SCENE_LAKE_HYLIA", 8), + ("ENTR_LAKE_HYLIA_8_1", "SCENE_LAKE_HYLIA", 8), + ("ENTR_LAKE_HYLIA_8_2", "SCENE_LAKE_HYLIA", 8), + ("ENTR_LAKE_HYLIA_8_3", "SCENE_LAKE_HYLIA", 8), + ("ENTR_SACRED_FOREST_MEADOW_3", "SCENE_SACRED_FOREST_MEADOW", 3), + ("ENTR_SACRED_FOREST_MEADOW_3_1", "SCENE_SACRED_FOREST_MEADOW", 3), + ("ENTR_SACRED_FOREST_MEADOW_3_2", "SCENE_SACRED_FOREST_MEADOW", 3), + ("ENTR_SACRED_FOREST_MEADOW_3_3", "SCENE_SACRED_FOREST_MEADOW", 3), + ("ENTR_LAKE_HYLIA_9", "SCENE_LAKE_HYLIA", 9), + ("ENTR_LAKE_HYLIA_9_1", "SCENE_LAKE_HYLIA", 9), + ("ENTR_LAKE_HYLIA_9_2", "SCENE_LAKE_HYLIA", 9), + ("ENTR_LAKE_HYLIA_9_3", "SCENE_LAKE_HYLIA", 9), + ("ENTR_DESERT_COLOSSUS_8", "SCENE_DESERT_COLOSSUS", 8), + ("ENTR_DESERT_COLOSSUS_8_1", "SCENE_DESERT_COLOSSUS", 8), + ("ENTR_DESERT_COLOSSUS_8_2", "SCENE_DESERT_COLOSSUS", 8), + ("ENTR_DESERT_COLOSSUS_8_3", "SCENE_DESERT_COLOSSUS", 8), +) diff --git a/tools/assets/extract/oot64_data/misc_ids.py b/tools/assets/extract/oot64_data/misc_ids.py new file mode 100644 index 0000000000..69c118ebe6 --- /dev/null +++ b/tools/assets/extract/oot64_data/misc_ids.py @@ -0,0 +1,235 @@ +# This file was made manually + +SCENE_CAM_TYPES = { + 0: "SCENE_CAM_TYPE_DEFAULT", + 0x10: "SCENE_CAM_TYPE_FIXED_SHOP_VIEWPOINT", + 0x20: "SCENE_CAM_TYPE_FIXED_TOGGLE_VIEWPOINT", + 0x30: "SCENE_CAM_TYPE_FIXED", + 0x40: "SCENE_CAM_TYPE_FIXED_MARKET", + 0x50: "SCENE_CAM_TYPE_SHOOTING_GALLERY", +} + +ROOM_BEHAVIOR_TYPE1_NAMES = { + 0: "ROOM_TYPE_NORMAL", + 1: "ROOM_TYPE_DUNGEON", + 2: "ROOM_TYPE_INDOORS", + 3: "ROOM_TYPE_3", + 4: "ROOM_TYPE_4", + 5: "ROOM_TYPE_BOSS", +} + +ROOM_BEHAVIOR_TYPE2_NAMES = { + 0: "ROOM_ENV_DEFAULT", + 1: "ROOM_ENV_COLD", + 2: "ROOM_ENV_WARM", + 3: "ROOM_ENV_HOT", + 4: "ROOM_ENV_UNK_STRETCH_1", + 5: "ROOM_ENV_UNK_STRETCH_2", + 6: "ROOM_ENV_UNK_STRETCH_3", +} + +LENS_MODES = { + 0: "LENS_MODE_SHOW_ACTORS", + 1: "LENS_MODE_HIDE_ACTORS", +} + +CAMERA_SETTING_TYPES = { + 0x00: "CAM_SET_NONE", + 0x01: "CAM_SET_NORMAL0", + 0x02: "CAM_SET_NORMAL1", + 0x03: "CAM_SET_DUNGEON0", + 0x04: "CAM_SET_DUNGEON1", + 0x05: "CAM_SET_NORMAL3", + 0x06: "CAM_SET_HORSE", + 0x07: "CAM_SET_BOSS_GOHMA", + 0x08: "CAM_SET_BOSS_DODONGO", + 0x09: "CAM_SET_BOSS_BARINADE", + 0x0A: "CAM_SET_BOSS_PHANTOM_GANON", + 0x0B: "CAM_SET_BOSS_VOLVAGIA", + 0x0C: "CAM_SET_BOSS_BONGO", + 0x0D: "CAM_SET_BOSS_MORPHA", + 0x0E: "CAM_SET_BOSS_TWINROVA_PLATFORM", + 0x0F: "CAM_SET_BOSS_TWINROVA_FLOOR", + 0x10: "CAM_SET_BOSS_GANONDORF", + 0x11: "CAM_SET_BOSS_GANON", + 0x12: "CAM_SET_TOWER_CLIMB", + 0x13: "CAM_SET_TOWER_UNUSED", + 0x14: "CAM_SET_MARKET_BALCONY", + 0x15: "CAM_SET_CHU_BOWLING", + 0x16: "CAM_SET_PIVOT_CRAWLSPACE", + 0x17: "CAM_SET_PIVOT_SHOP_BROWSING", + 0x18: "CAM_SET_PIVOT_IN_FRONT", + 0x19: "CAM_SET_PREREND_FIXED", + 0x1A: "CAM_SET_PREREND_PIVOT", + 0x1B: "CAM_SET_PREREND_SIDE_SCROLL", + 0x1C: "CAM_SET_DOOR0", + 0x1D: "CAM_SET_DOORC", + 0x1E: "CAM_SET_CRAWLSPACE", + 0x1F: "CAM_SET_START0", + 0x20: "CAM_SET_START1", + 0x21: "CAM_SET_FREE0", + 0x22: "CAM_SET_FREE2", + 0x23: "CAM_SET_PIVOT_CORNER", + 0x24: "CAM_SET_PIVOT_WATER_SURFACE", + 0x25: "CAM_SET_CS_0", + 0x26: "CAM_SET_CS_TWISTED_HALLWAY", + 0x27: "CAM_SET_FOREST_BIRDS_EYE", + 0x28: "CAM_SET_SLOW_CHEST_CS", + 0x29: "CAM_SET_ITEM_UNUSED", + 0x2A: "CAM_SET_CS_3", + 0x2B: "CAM_SET_CS_ATTENTION", + 0x2C: "CAM_SET_BEAN_GENERIC", + 0x2D: "CAM_SET_BEAN_LOST_WOODS", + 0x2E: "CAM_SET_SCENE_UNUSED", + 0x2F: "CAM_SET_SCENE_TRANSITION", + 0x30: "CAM_SET_ELEVATOR_PLATFORM", + 0x31: "CAM_SET_FIRE_STAIRCASE", + 0x32: "CAM_SET_FOREST_UNUSED", + 0x33: "CAM_SET_FOREST_DEFEAT_POE", + 0x34: "CAM_SET_BIG_OCTO", + 0x35: "CAM_SET_MEADOW_BIRDS_EYE", + 0x36: "CAM_SET_MEADOW_UNUSED", + 0x37: "CAM_SET_FIRE_BIRDS_EYE", + 0x38: "CAM_SET_TURN_AROUND", + 0x39: "CAM_SET_PIVOT_VERTICAL", + 0x3A: "CAM_SET_NORMAL2", + 0x3B: "CAM_SET_FISHING", + 0x3C: "CAM_SET_CS_C", + 0x3D: "CAM_SET_JABU_TENTACLE", + 0x3E: "CAM_SET_DUNGEON2", + 0x3F: "CAM_SET_DIRECTED_YAW", + 0x40: "CAM_SET_PIVOT_FROM_SIDE", + 0x41: "CAM_SET_NORMAL4", +} + +SKIN_LIMB_TYPES = { + 4: "SKIN_LIMB_TYPE_ANIMATED", + 11: "SKIN_LIMB_TYPE_NORMAL", +} + +ROOM_SHAPE_TYPE = { + 0: "ROOM_SHAPE_TYPE_NORMAL", + 1: "ROOM_SHAPE_TYPE_IMAGE", + 2: "ROOM_SHAPE_TYPE_CULLABLE", +} + +ROOM_SHAPE_IMAGE_AMOUNT_TYPE = { + 1: "ROOM_SHAPE_IMAGE_AMOUNT_SINGLE", + 2: "ROOM_SHAPE_IMAGE_AMOUNT_MULTI", +} + +SKYBOX_IDS = { + 0x00: "SKYBOX_NONE", + 0x01: "SKYBOX_NORMAL_SKY", + 0x02: "SKYBOX_BAZAAR", + 0x03: "SKYBOX_OVERCAST_SUNSET", + 0x04: "SKYBOX_MARKET_ADULT", + 0x05: "SKYBOX_CUTSCENE_MAP", + 0x07: "SKYBOX_HOUSE_LINK", + 0x09: "SKYBOX_MARKET_CHILD_DAY", + 0x0A: "SKYBOX_MARKET_CHILD_NIGHT", + 0x0B: "SKYBOX_HAPPY_MASK_SHOP", + 0x0C: "SKYBOX_HOUSE_KNOW_IT_ALL_BROTHERS", + 0x0E: "SKYBOX_HOUSE_OF_TWINS", + 0x0F: "SKYBOX_STABLES", + 0x10: "SKYBOX_HOUSE_KAKARIKO", + 0x11: "SKYBOX_KOKIRI_SHOP", + 0x13: "SKYBOX_GORON_SHOP", + 0x14: "SKYBOX_ZORA_SHOP", + 0x16: "SKYBOX_POTION_SHOP_KAKARIKO", + 0x17: "SKYBOX_POTION_SHOP_MARKET", + 0x18: "SKYBOX_BOMBCHU_SHOP", + 0x1A: "SKYBOX_HOUSE_RICHARD", + 0x1B: "SKYBOX_HOUSE_IMPA", + 0x1C: "SKYBOX_TENT", + 0x1D: "SKYBOX_UNSET_1D", + 0x20: "SKYBOX_HOUSE_MIDO", + 0x21: "SKYBOX_HOUSE_SARIA", + 0x22: "SKYBOX_HOUSE_ALLEY", + 0x27: "SKYBOX_UNSET_27", +} + +LIGHT_MODES = { + 0: "LIGHT_MODE_TIME", + 1: "LIGHT_MODE_SETTINGS", +} + +NAVI_QUEST_HINT_FILE_IDS = { + 0: "NAVI_QUEST_HINTS_NONE", + 1: "NAVI_QUEST_HINTS_OVERWORLD", + 2: "NAVI_QUEST_HINTS_DUNGEON", +} + +FLOOR_TYPES = { + 0: "FLOOR_TYPE_0", + 1: "FLOOR_TYPE_1", + 2: "FLOOR_TYPE_2", + 3: "FLOOR_TYPE_3", + 4: "FLOOR_TYPE_4", + 5: "FLOOR_TYPE_5", + 6: "FLOOR_TYPE_6", + 7: "FLOOR_TYPE_7", + 8: "FLOOR_TYPE_8", + 9: "FLOOR_TYPE_9", + 10: "FLOOR_TYPE_10", + 11: "FLOOR_TYPE_11", + 12: "FLOOR_TYPE_12", +} + +WALL_TYPES = { + 0: "WALL_TYPE_0", + 1: "WALL_TYPE_1", + 2: "WALL_TYPE_2", + 3: "WALL_TYPE_3", + 4: "WALL_TYPE_4", + 5: "WALL_TYPE_5", + 6: "WALL_TYPE_6", + 7: "WALL_TYPE_7", + 8: "WALL_TYPE_8", + 9: "WALL_TYPE_9", + 10: "WALL_TYPE_10", + 11: "WALL_TYPE_11", + 12: "WALL_TYPE_12", +} + +FLOOR_PROPERTIES = { + 0: "FLOOR_PROPERTY_0", + 5: "FLOOR_PROPERTY_5", + 6: "FLOOR_PROPERTY_6", + 7: "FLOOR_PROPERTY_7", + 8: "FLOOR_PROPERTY_8", + 9: "FLOOR_PROPERTY_9", + 11: "FLOOR_PROPERTY_11", + 12: "FLOOR_PROPERTY_12", +} + +SURFACE_MATERIALS = { + 0: "SURFACE_MATERIAL_DIRT", + 1: "SURFACE_MATERIAL_SAND", + 2: "SURFACE_MATERIAL_STONE", + 3: "SURFACE_MATERIAL_JABU", + 4: "SURFACE_MATERIAL_WATER_SHALLOW", + 5: "SURFACE_MATERIAL_WATER_DEEP", + 6: "SURFACE_MATERIAL_TALL_GRASS", + 7: "SURFACE_MATERIAL_LAVA", + 8: "SURFACE_MATERIAL_GRASS", + 9: "SURFACE_MATERIAL_BRIDGE", + 10: "SURFACE_MATERIAL_WOOD", + 11: "SURFACE_MATERIAL_DIRT_SOFT", + 12: "SURFACE_MATERIAL_ICE", + 13: "SURFACE_MATERIAL_CARPET", + 14: "SURFACE_MATERIAL_MAX", +} + +FLOOR_EFFECTS = { + 0: "FLOOR_EFFECT_0", + 1: "FLOOR_EFFECT_1", + 2: "FLOOR_EFFECT_2", +} + +CONVEYOR_SPEEDS = { + 0: "CONVEYOR_SPEED_DISABLED", + 1: "CONVEYOR_SPEED_SLOW", + 2: "CONVEYOR_SPEED_MEDIUM", + 3: "CONVEYOR_SPEED_FAST", +} diff --git a/tools/assets/extract/oot64_data/object_ids.py b/tools/assets/extract/oot64_data/object_ids.py new file mode 100644 index 0000000000..2db79aa5c1 --- /dev/null +++ b/tools/assets/extract/oot64_data/object_ids.py @@ -0,0 +1,406 @@ +# This file was generated from ../../../..//include/tables/object_table.h + +DATA = ( + "OBJECT_INVALID", + "OBJECT_GAMEPLAY_KEEP", + "OBJECT_GAMEPLAY_FIELD_KEEP", + "OBJECT_GAMEPLAY_DANGEON_KEEP", + "OBJECT_UNSET_4", + "OBJECT_UNSET_5", + "OBJECT_HUMAN", + "OBJECT_OKUTA", + "OBJECT_CROW", + "OBJECT_POH", + "OBJECT_DY_OBJ", + "OBJECT_WALLMASTER", + "OBJECT_DODONGO", + "OBJECT_FIREFLY", + "OBJECT_BOX", + "OBJECT_FIRE", + "OBJECT_UNSET_10", + "OBJECT_UNSET_11", + "OBJECT_BUBBLE", + "OBJECT_NIW", + "OBJECT_LINK_BOY", + "OBJECT_LINK_CHILD", + "OBJECT_TITE", + "OBJECT_REEBA", + "OBJECT_PEEHAT", + "OBJECT_KINGDODONGO", + "OBJECT_HORSE", + "OBJECT_ZF", + "OBJECT_GOMA", + "OBJECT_ZL1", + "OBJECT_GOL", + "OBJECT_DODOJR", + "OBJECT_TORCH2", + "OBJECT_BL", + "OBJECT_TP", + "OBJECT_OA1", + "OBJECT_ST", + "OBJECT_BW", + "OBJECT_EI", + "OBJECT_HORSE_NORMAL", + "OBJECT_OB1", + "OBJECT_O_ANIME", + "OBJECT_SPOT04_OBJECTS", + "OBJECT_DDAN_OBJECTS", + "OBJECT_HIDAN_OBJECTS", + "OBJECT_HORSE_GANON", + "OBJECT_OA2", + "OBJECT_SPOT00_OBJECTS", + "OBJECT_MB", + "OBJECT_BOMBF", + "OBJECT_SK2", + "OBJECT_OE1", + "OBJECT_OE_ANIME", + "OBJECT_OE2", + "OBJECT_YDAN_OBJECTS", + "OBJECT_GND", + "OBJECT_AM", + "OBJECT_DEKUBABA", + "OBJECT_UNSET_3A", + "OBJECT_OA3", + "OBJECT_OA4", + "OBJECT_OA5", + "OBJECT_OA6", + "OBJECT_OA7", + "OBJECT_JJ", + "OBJECT_OA8", + "OBJECT_OA9", + "OBJECT_OB2", + "OBJECT_OB3", + "OBJECT_OB4", + "OBJECT_HORSE_ZELDA", + "OBJECT_OPENING_DEMO1", + "OBJECT_WARP1", + "OBJECT_B_HEART", + "OBJECT_DEKUNUTS", + "OBJECT_OE3", + "OBJECT_OE4", + "OBJECT_MENKURI_OBJECTS", + "OBJECT_OE5", + "OBJECT_OE6", + "OBJECT_OE7", + "OBJECT_OE8", + "OBJECT_OE9", + "OBJECT_OE10", + "OBJECT_OE11", + "OBJECT_OE12", + "OBJECT_VALI", + "OBJECT_OA10", + "OBJECT_OA11", + "OBJECT_MIZU_OBJECTS", + "OBJECT_FHG", + "OBJECT_OSSAN", + "OBJECT_MORI_HINERI1", + "OBJECT_BB", + "OBJECT_TOKI_OBJECTS", + "OBJECT_YUKABYUN", + "OBJECT_ZL2", + "OBJECT_MJIN", + "OBJECT_MJIN_FLASH", + "OBJECT_MJIN_DARK", + "OBJECT_MJIN_FLAME", + "OBJECT_MJIN_ICE", + "OBJECT_MJIN_SOUL", + "OBJECT_MJIN_WIND", + "OBJECT_MJIN_OKA", + "OBJECT_HAKA_OBJECTS", + "OBJECT_SPOT06_OBJECTS", + "OBJECT_ICE_OBJECTS", + "OBJECT_RELAY_OBJECTS", + "OBJECT_PO_FIELD", + "OBJECT_PO_COMPOSER", + "OBJECT_MORI_HINERI1A", + "OBJECT_MORI_HINERI2", + "OBJECT_MORI_HINERI2A", + "OBJECT_MORI_OBJECTS", + "OBJECT_MORI_TEX", + "OBJECT_SPOT08_OBJ", + "OBJECT_WARP2", + "OBJECT_HATA", + "OBJECT_BIRD", + "OBJECT_UNSET_78", + "OBJECT_UNSET_79", + "OBJECT_UNSET_7A", + "OBJECT_UNSET_7B", + "OBJECT_WOOD02", + "OBJECT_UNSET_7D", + "OBJECT_UNSET_7E", + "OBJECT_UNSET_7F", + "OBJECT_UNSET_80", + "OBJECT_LIGHTBOX", + "OBJECT_PU_BOX", + "OBJECT_UNSET_83", + "OBJECT_UNSET_84", + "OBJECT_TRAP", + "OBJECT_VASE", + "OBJECT_IM", + "OBJECT_TA", + "OBJECT_TK", + "OBJECT_XC", + "OBJECT_VM", + "OBJECT_BV", + "OBJECT_HAKACH_OBJECTS", + "OBJECT_EFC_CRYSTAL_LIGHT", + "OBJECT_EFC_FIRE_BALL", + "OBJECT_EFC_FLASH", + "OBJECT_EFC_LGT_SHOWER", + "OBJECT_EFC_STAR_FIELD", + "OBJECT_GOD_LGT", + "OBJECT_LIGHT_RING", + "OBJECT_TRIFORCE_SPOT", + "OBJECT_BDAN_OBJECTS", + "OBJECT_SD", + "OBJECT_RD", + "OBJECT_PO_SISTERS", + "OBJECT_HEAVY_OBJECT", + "OBJECT_GNDD", + "OBJECT_FD", + "OBJECT_DU", + "OBJECT_FW", + "OBJECT_MEDAL", + "OBJECT_HORSE_LINK_CHILD", + "OBJECT_SPOT02_OBJECTS", + "OBJECT_HAKA", + "OBJECT_RU1", + "OBJECT_SYOKUDAI", + "OBJECT_FD2", + "OBJECT_DH", + "OBJECT_RL", + "OBJECT_EFC_TW", + "OBJECT_DEMO_TRE_LGT", + "OBJECT_GI_KEY", + "OBJECT_MIR_RAY", + "OBJECT_BROB", + "OBJECT_GI_JEWEL", + "OBJECT_SPOT09_OBJ", + "OBJECT_SPOT18_OBJ", + "OBJECT_BDOOR", + "OBJECT_SPOT17_OBJ", + "OBJECT_SHOP_DUNGEN", + "OBJECT_NB", + "OBJECT_MO", + "OBJECT_SB", + "OBJECT_GI_MELODY", + "OBJECT_GI_HEART", + "OBJECT_GI_COMPASS", + "OBJECT_GI_BOSSKEY", + "OBJECT_GI_MEDAL", + "OBJECT_GI_NUTS", + "OBJECT_SA", + "OBJECT_GI_HEARTS", + "OBJECT_GI_ARROWCASE", + "OBJECT_GI_BOMBPOUCH", + "OBJECT_IN", + "OBJECT_TR", + "OBJECT_SPOT16_OBJ", + "OBJECT_OE1S", + "OBJECT_OE4S", + "OBJECT_OS_ANIME", + "OBJECT_GI_BOTTLE", + "OBJECT_GI_STICK", + "OBJECT_GI_MAP", + "OBJECT_OF1D_MAP", + "OBJECT_RU2", + "OBJECT_GI_SHIELD_1", + "OBJECT_DEKUJR", + "OBJECT_GI_MAGICPOT", + "OBJECT_GI_BOMB_1", + "OBJECT_OF1S", + "OBJECT_MA2", + "OBJECT_GI_PURSE", + "OBJECT_HNI", + "OBJECT_TW", + "OBJECT_RR", + "OBJECT_BXA", + "OBJECT_ANUBICE", + "OBJECT_GI_GERUDO", + "OBJECT_GI_ARROW", + "OBJECT_GI_BOMB_2", + "OBJECT_GI_EGG", + "OBJECT_GI_SCALE", + "OBJECT_GI_SHIELD_2", + "OBJECT_GI_HOOKSHOT", + "OBJECT_GI_OCARINA", + "OBJECT_GI_MILK", + "OBJECT_MA1", + "OBJECT_GANON", + "OBJECT_SST", + "OBJECT_NY_UNUSED", + "OBJECT_UNSET_E4", + "OBJECT_NY", + "OBJECT_FR", + "OBJECT_GI_PACHINKO", + "OBJECT_GI_BOOMERANG", + "OBJECT_GI_BOW", + "OBJECT_GI_GLASSES", + "OBJECT_GI_LIQUID", + "OBJECT_ANI", + "OBJECT_DEMO_6K", + "OBJECT_GI_SHIELD_3", + "OBJECT_GI_LETTER", + "OBJECT_SPOT15_OBJ", + "OBJECT_JYA_OBJ", + "OBJECT_GI_CLOTHES", + "OBJECT_GI_BEAN", + "OBJECT_GI_FISH", + "OBJECT_GI_SAW", + "OBJECT_GI_HAMMER", + "OBJECT_GI_GRASS", + "OBJECT_GI_LONGSWORD", + "OBJECT_SPOT01_OBJECTS", + "OBJECT_MD_UNUSED", + "OBJECT_MD", + "OBJECT_KM1", + "OBJECT_KW1", + "OBJECT_ZO", + "OBJECT_KZ", + "OBJECT_UMAJUMP", + "OBJECT_MASTERKOKIRI", + "OBJECT_MASTERKOKIRIHEAD", + "OBJECT_MASTERGOLON", + "OBJECT_MASTERZOORA", + "OBJECT_AOB", + "OBJECT_IK", + "OBJECT_AHG", + "OBJECT_CNE", + "OBJECT_GI_NIWATORI", + "OBJECT_SKJ", + "OBJECT_GI_BOTTLE_LETTER", + "OBJECT_BJI", + "OBJECT_BBA", + "OBJECT_GI_OCARINA_0", + "OBJECT_DS", + "OBJECT_ANE", + "OBJECT_BOJ", + "OBJECT_SPOT03_OBJECT", + "OBJECT_SPOT07_OBJECT", + "OBJECT_FZ", + "OBJECT_BOB", + "OBJECT_GE1", + "OBJECT_YABUSAME_POINT", + "OBJECT_GI_BOOTS_2", + "OBJECT_GI_SEED", + "OBJECT_GND_MAGIC", + "OBJECT_D_ELEVATOR", + "OBJECT_D_HSBLOCK", + "OBJECT_D_LIFT", + "OBJECT_MAMENOKI", + "OBJECT_GOROIWA", + "OBJECT_UNSET_120", + "OBJECT_TORYO", + "OBJECT_DAIKU", + "OBJECT_UNSET_123", + "OBJECT_NWC", + "OBJECT_BLKOBJ", + "OBJECT_GM", + "OBJECT_MS", + "OBJECT_HS", + "OBJECT_INGATE", + "OBJECT_LIGHTSWITCH", + "OBJECT_KUSA", + "OBJECT_TSUBO", + "OBJECT_GI_GLOVES", + "OBJECT_GI_COIN", + "OBJECT_KANBAN", + "OBJECT_GJYO_OBJECTS", + "OBJECT_OWL", + "OBJECT_MK", + "OBJECT_FU", + "OBJECT_GI_KI_TAN_MASK", + "OBJECT_GI_REDEAD_MASK", + "OBJECT_GI_SKJ_MASK", + "OBJECT_GI_RABIT_MASK", + "OBJECT_GI_TRUTH_MASK", + "OBJECT_GANON_OBJECTS", + "OBJECT_SIOFUKI", + "OBJECT_STREAM", + "OBJECT_MM", + "OBJECT_FA", + "OBJECT_OS", + "OBJECT_GI_EYE_LOTION", + "OBJECT_GI_POWDER", + "OBJECT_GI_MUSHROOM", + "OBJECT_GI_TICKETSTONE", + "OBJECT_GI_BROKENSWORD", + "OBJECT_JS", + "OBJECT_CS", + "OBJECT_GI_PRESCRIPTION", + "OBJECT_GI_BRACELET", + "OBJECT_GI_SOLDOUT", + "OBJECT_GI_FROG", + "OBJECT_MAG", + "OBJECT_DOOR_GERUDO", + "OBJECT_GT", + "OBJECT_EFC_ERUPC", + "OBJECT_ZL2_ANIME1", + "OBJECT_ZL2_ANIME2", + "OBJECT_GI_GOLONMASK", + "OBJECT_GI_ZORAMASK", + "OBJECT_GI_GERUDOMASK", + "OBJECT_GANON2", + "OBJECT_KA", + "OBJECT_TS", + "OBJECT_ZG", + "OBJECT_GI_HOVERBOOTS", + "OBJECT_GI_M_ARROW", + "OBJECT_DS2", + "OBJECT_EC", + "OBJECT_FISH", + "OBJECT_GI_SUTARU", + "OBJECT_GI_GODDESS", + "OBJECT_SSH", + "OBJECT_BIGOKUTA", + "OBJECT_BG", + "OBJECT_SPOT05_OBJECTS", + "OBJECT_SPOT12_OBJ", + "OBJECT_BOMBIWA", + "OBJECT_HINTNUTS", + "OBJECT_RS", + "OBJECT_SPOT00_BREAK", + "OBJECT_GLA", + "OBJECT_SHOPNUTS", + "OBJECT_GELDB", + "OBJECT_GR", + "OBJECT_DOG", + "OBJECT_JYA_IRON", + "OBJECT_JYA_DOOR", + "OBJECT_UNSET_16E", + "OBJECT_SPOT11_OBJ", + "OBJECT_KIBAKO2", + "OBJECT_DNS", + "OBJECT_DNK", + "OBJECT_GI_FIRE", + "OBJECT_GI_INSECT", + "OBJECT_GI_BUTTERFLY", + "OBJECT_GI_GHOST", + "OBJECT_GI_SOUL", + "OBJECT_BOWL", + "OBJECT_DEMO_KEKKAI", + "OBJECT_EFC_DOUGHNUT", + "OBJECT_GI_DEKUPOUCH", + "OBJECT_GANON_ANIME1", + "OBJECT_GANON_ANIME2", + "OBJECT_GANON_ANIME3", + "OBJECT_GI_RUPY", + "OBJECT_SPOT01_MATOYA", + "OBJECT_SPOT01_MATOYAB", + "OBJECT_MU", + "OBJECT_WF", + "OBJECT_SKB", + "OBJECT_GJ", + "OBJECT_GEFF", + "OBJECT_HAKA_DOOR", + "OBJECT_GS", + "OBJECT_PS", + "OBJECT_BWALL", + "OBJECT_COW", + "OBJECT_COB", + "OBJECT_GI_SWORD_1", + "OBJECT_DOOR_KILLER", + "OBJECT_OUKE_HAKA", + "OBJECT_TIMEBLOCK", + "OBJECT_ZL4", +) diff --git a/tools/assets/extract/oot64_data/scene_table_mini.py b/tools/assets/extract/oot64_data/scene_table_mini.py new file mode 100644 index 0000000000..682ee8fd38 --- /dev/null +++ b/tools/assets/extract/oot64_data/scene_table_mini.py @@ -0,0 +1,114 @@ +# This file was generated from ../../../..//include/tables/scene_table.h + +DATA = ( + ("ydan_scene", "SCENE_DEKU_TREE"), + ("ddan_scene", "SCENE_DODONGOS_CAVERN"), + ("bdan_scene", "SCENE_JABU_JABU"), + ("Bmori1_scene", "SCENE_FOREST_TEMPLE"), + ("HIDAN_scene", "SCENE_FIRE_TEMPLE"), + ("MIZUsin_scene", "SCENE_WATER_TEMPLE"), + ("jyasinzou_scene", "SCENE_SPIRIT_TEMPLE"), + ("HAKAdan_scene", "SCENE_SHADOW_TEMPLE"), + ("HAKAdanCH_scene", "SCENE_BOTTOM_OF_THE_WELL"), + ("ice_doukutu_scene", "SCENE_ICE_CAVERN"), + ("ganon_scene", "SCENE_GANONS_TOWER"), + ("men_scene", "SCENE_GERUDO_TRAINING_GROUND"), + ("gerudoway_scene", "SCENE_THIEVES_HIDEOUT"), + ("ganontika_scene", "SCENE_INSIDE_GANONS_CASTLE"), + ("ganon_sonogo_scene", "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR"), + ("ganontikasonogo_scene", "SCENE_INSIDE_GANONS_CASTLE_COLLAPSE"), + ("takaraya_scene", "SCENE_TREASURE_BOX_SHOP"), + ("ydan_boss_scene", "SCENE_DEKU_TREE_BOSS"), + ("ddan_boss_scene", "SCENE_DODONGOS_CAVERN_BOSS"), + ("bdan_boss_scene", "SCENE_JABU_JABU_BOSS"), + ("moribossroom_scene", "SCENE_FOREST_TEMPLE_BOSS"), + ("FIRE_bs_scene", "SCENE_FIRE_TEMPLE_BOSS"), + ("MIZUsin_bs_scene", "SCENE_WATER_TEMPLE_BOSS"), + ("jyasinboss_scene", "SCENE_SPIRIT_TEMPLE_BOSS"), + ("HAKAdan_bs_scene", "SCENE_SHADOW_TEMPLE_BOSS"), + ("ganon_boss_scene", "SCENE_GANONDORF_BOSS"), + ("ganon_final_scene", "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR"), + ("entra_scene", "SCENE_MARKET_ENTRANCE_DAY"), + ("entra_n_scene", "SCENE_MARKET_ENTRANCE_NIGHT"), + ("enrui_scene", "SCENE_MARKET_ENTRANCE_RUINS"), + ("market_alley_scene", "SCENE_BACK_ALLEY_DAY"), + ("market_alley_n_scene", "SCENE_BACK_ALLEY_NIGHT"), + ("market_day_scene", "SCENE_MARKET_DAY"), + ("market_night_scene", "SCENE_MARKET_NIGHT"), + ("market_ruins_scene", "SCENE_MARKET_RUINS"), + ("shrine_scene", "SCENE_TEMPLE_OF_TIME_EXTERIOR_DAY"), + ("shrine_n_scene", "SCENE_TEMPLE_OF_TIME_EXTERIOR_NIGHT"), + ("shrine_r_scene", "SCENE_TEMPLE_OF_TIME_EXTERIOR_RUINS"), + ("kokiri_home_scene", "SCENE_KNOW_IT_ALL_BROS_HOUSE"), + ("kokiri_home3_scene", "SCENE_TWINS_HOUSE"), + ("kokiri_home4_scene", "SCENE_MIDOS_HOUSE"), + ("kokiri_home5_scene", "SCENE_SARIAS_HOUSE"), + ("kakariko_scene", "SCENE_KAKARIKO_CENTER_GUEST_HOUSE"), + ("kakariko3_scene", "SCENE_BACK_ALLEY_HOUSE"), + ("shop1_scene", "SCENE_BAZAAR"), + ("kokiri_shop_scene", "SCENE_KOKIRI_SHOP"), + ("golon_scene", "SCENE_GORON_SHOP"), + ("zoora_scene", "SCENE_ZORA_SHOP"), + ("drag_scene", "SCENE_POTION_SHOP_KAKARIKO"), + ("alley_shop_scene", "SCENE_POTION_SHOP_MARKET"), + ("night_shop_scene", "SCENE_BOMBCHU_SHOP"), + ("face_shop_scene", "SCENE_HAPPY_MASK_SHOP"), + ("link_home_scene", "SCENE_LINKS_HOUSE"), + ("impa_scene", "SCENE_DOG_LADY_HOUSE"), + ("malon_stable_scene", "SCENE_STABLE"), + ("labo_scene", "SCENE_IMPAS_HOUSE"), + ("hylia_labo_scene", "SCENE_LAKESIDE_LABORATORY"), + ("tent_scene", "SCENE_CARPENTERS_TENT"), + ("hut_scene", "SCENE_GRAVEKEEPERS_HUT"), + ("daiyousei_izumi_scene", "SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC"), + ("yousei_izumi_tate_scene", "SCENE_FAIRYS_FOUNTAIN"), + ("yousei_izumi_yoko_scene", "SCENE_GREAT_FAIRYS_FOUNTAIN_SPELLS"), + ("kakusiana_scene", "SCENE_GROTTOS"), + ("hakaana_scene", "SCENE_REDEAD_GRAVE"), + ("hakaana2_scene", "SCENE_GRAVE_WITH_FAIRYS_FOUNTAIN"), + ("hakaana_ouke_scene", "SCENE_ROYAL_FAMILYS_TOMB"), + ("syatekijyou_scene", "SCENE_SHOOTING_GALLERY"), + ("tokinoma_scene", "SCENE_TEMPLE_OF_TIME"), + ("kenjyanoma_scene", "SCENE_CHAMBER_OF_THE_SAGES"), + ("hairal_niwa_scene", "SCENE_CASTLE_COURTYARD_GUARDS_DAY"), + ("hairal_niwa_n_scene", "SCENE_CASTLE_COURTYARD_GUARDS_NIGHT"), + ("hiral_demo_scene", "SCENE_CUTSCENE_MAP"), + ("hakasitarelay_scene", "SCENE_WINDMILL_AND_DAMPES_GRAVE"), + ("turibori_scene", "SCENE_FISHING_POND"), + ("nakaniwa_scene", "SCENE_CASTLE_COURTYARD_ZELDA"), + ("bowling_scene", "SCENE_BOMBCHU_BOWLING_ALLEY"), + ("souko_scene", "SCENE_LON_LON_BUILDINGS"), + ("miharigoya_scene", "SCENE_MARKET_GUARD_HOUSE"), + ("mahouya_scene", "SCENE_POTION_SHOP_GRANNY"), + ("ganon_demo_scene", "SCENE_GANON_BOSS"), + ("kinsuta_scene", "SCENE_HOUSE_OF_SKULLTULA"), + ("spot00_scene", "SCENE_HYRULE_FIELD"), + ("spot01_scene", "SCENE_KAKARIKO_VILLAGE"), + ("spot02_scene", "SCENE_GRAVEYARD"), + ("spot03_scene", "SCENE_ZORAS_RIVER"), + ("spot04_scene", "SCENE_KOKIRI_FOREST"), + ("spot05_scene", "SCENE_SACRED_FOREST_MEADOW"), + ("spot06_scene", "SCENE_LAKE_HYLIA"), + ("spot07_scene", "SCENE_ZORAS_DOMAIN"), + ("spot08_scene", "SCENE_ZORAS_FOUNTAIN"), + ("spot09_scene", "SCENE_GERUDO_VALLEY"), + ("spot10_scene", "SCENE_LOST_WOODS"), + ("spot11_scene", "SCENE_DESERT_COLOSSUS"), + ("spot12_scene", "SCENE_GERUDOS_FORTRESS"), + ("spot13_scene", "SCENE_HAUNTED_WASTELAND"), + ("spot15_scene", "SCENE_HYRULE_CASTLE"), + ("spot16_scene", "SCENE_DEATH_MOUNTAIN_TRAIL"), + ("spot17_scene", "SCENE_DEATH_MOUNTAIN_CRATER"), + ("spot18_scene", "SCENE_GORON_CITY"), + ("spot20_scene", "SCENE_LON_LON_RANCH"), + ("ganon_tou_scene", "SCENE_OUTSIDE_GANONS_CASTLE"), + ("test01_scene", "SCENE_TEST01"), + ("besitu_scene", "SCENE_BESITU"), + ("depth_test_scene", "SCENE_DEPTH_TEST"), + ("syotes_scene", "SCENE_SYOTES"), + ("syotes2_scene", "SCENE_SYOTES2"), + ("sutaru_scene", "SCENE_SUTARU"), + ("hairal_niwa2_scene", "SCENE_HAIRAL_NIWA2"), + ("sasatest_scene", "SCENE_SASATEST"), + ("testroom_scene", "SCENE_TESTROOM"), +) diff --git a/tools/assets/extract/write_source.txt b/tools/assets/extract/write_source.txt new file mode 100644 index 0000000000..e0573366a2 --- /dev/null +++ b/tools/assets/extract/write_source.txt @@ -0,0 +1,1076 @@ +assets/code/fbdemo_circle/code.c +assets/code/fbdemo_triforce/code.c +assets/code/fbdemo_wipe1/code.c +assets/misc/link_animetion/link_animetion.c +assets/misc/z_select_static/z_select_static.c +assets/objects/gameplay_dangeon_keep/gameplay_dangeon_keep.c +assets/objects/gameplay_field_keep/gameplay_field_keep.c +assets/objects/gameplay_keep/gameplay_keep.c +assets/objects/object_ahg/object_ahg.c +assets/objects/object_am/object_am.c +assets/objects/object_ane/object_ane.c +assets/objects/object_ani/object_ani.c +assets/objects/object_anubice/object_anubice.c +assets/objects/object_aob/object_aob.c +assets/objects/object_bba/object_bba.c +assets/objects/object_Bb/object_Bb.c +assets/objects/object_bdan_objects/object_bdan_objects.c +assets/objects/object_bdoor/object_bdoor.c +assets/objects/object_bg/object_bg.c +assets/objects/object_b_heart/object_b_heart.c +assets/objects/object_bigokuta/object_bigokuta.c +assets/objects/object_bird/object_bird.c +assets/objects/object_bji/object_bji.c +assets/objects/object_blkobj/object_blkobj.c +assets/objects/object_bl/object_bl.c +assets/objects/object_bob/object_bob.c +assets/objects/object_boj/object_boj.c +assets/objects/object_bombf/object_bombf.c +assets/objects/object_bombiwa/object_bombiwa.c +assets/objects/object_bowl/object_bowl.c +assets/objects/object_box/object_box.c +assets/objects/object_brob/object_brob.c +assets/objects/object_bubble/object_bubble.c +assets/objects/object_bv/object_bv.c +assets/objects/object_bwall/object_bwall.c +assets/objects/object_bw/object_bw.c +assets/objects/object_bxa/object_bxa.c +assets/objects/object_cne/object_cne.c +assets/objects/object_cob/object_cob.c +assets/objects/object_cow/object_cow.c +assets/objects/object_crow/object_crow.c +assets/objects/object_cs/object_cs.c +assets/objects/object_daiku/object_daiku.c +assets/objects/object_ddan_objects/object_ddan_objects.c +assets/objects/object_dekubaba/object_dekubaba.c +assets/objects/object_dekujr/object_dekujr.c +assets/objects/object_dekunuts/object_dekunuts.c +assets/objects/object_d_elevator/object_d_elevator.c +assets/objects/object_demo_6k/object_demo_6k.c +assets/objects/object_demo_kekkai/object_demo_kekkai.c +assets/objects/object_demo_tre_lgt/object_demo_tre_lgt.c +assets/objects/object_dh/object_dh.c +assets/objects/object_d_hsblock/object_d_hsblock.c +assets/objects/object_d_lift/object_d_lift.c +assets/objects/object_dnk/object_dnk.c +assets/objects/object_dns/object_dns.c +assets/objects/object_dodojr/object_dodojr.c +assets/objects/object_dodongo/object_dodongo.c +assets/objects/object_dog/object_dog.c +assets/objects/object_door_gerudo/object_door_gerudo.c +assets/objects/object_door_killer/object_door_killer.c +assets/objects/object_ds2/object_ds2.c +assets/objects/object_ds/object_ds.c +assets/objects/object_du/object_du.c +assets/objects/object_dy_obj/object_dy_obj.c +assets/objects/object_ec/object_ec.c +assets/objects/object_efc_crystal_light/object_efc_crystal_light.c +assets/objects/object_efc_doughnut/object_efc_doughnut.c +assets/objects/object_efc_erupc/object_efc_erupc.c +assets/objects/object_efc_fire_ball/object_efc_fire_ball.c +assets/objects/object_efc_flash/object_efc_flash.c +assets/objects/object_efc_lgt_shower/object_efc_lgt_shower.c +assets/objects/object_efc_star_field/object_efc_star_field.c +assets/objects/object_efc_tw/object_efc_tw.c +assets/objects/object_ei/object_ei.c +assets/objects/object_fa/object_fa.c +assets/objects/object_fd2/object_fd2.c +assets/objects/object_fd/object_fd.c +assets/objects/object_fhg/object_fhg.c +assets/objects/object_firefly/object_firefly.c +assets/objects/object_fire/object_fire.c +assets/objects/object_fish/object_fish.c +assets/objects/object_fr/object_fr.c +assets/objects/object_fu/object_fu.c +assets/objects/object_fw/object_fw.c +assets/objects/object_fz/object_fz.c +assets/objects/object_ganon2/object_ganon2.c +assets/objects/object_ganon_anime1/object_ganon_anime1.c +assets/objects/object_ganon_anime2/object_ganon_anime2.c +assets/objects/object_ganon_anime3/object_ganon_anime3.c +assets/objects/object_ganon/object_ganon.c +assets/objects/object_ganon_objects/object_ganon_objects.c +assets/objects/object_ge1/object_ge1.c +assets/objects/object_geff/object_geff.c +assets/objects/object_geldb/object_geldb.c +assets/objects/object_gi_arrowcase/object_gi_arrowcase.c +assets/objects/object_gi_arrow/object_gi_arrow.c +assets/objects/object_gi_bean/object_gi_bean.c +assets/objects/object_gi_bomb_1/object_gi_bomb_1.c +assets/objects/object_gi_bomb_2/object_gi_bomb_2.c +assets/objects/object_gi_bombpouch/object_gi_bombpouch.c +assets/objects/object_gi_boomerang/object_gi_boomerang.c +assets/objects/object_gi_boots_2/object_gi_boots_2.c +assets/objects/object_gi_bosskey/object_gi_bosskey.c +assets/objects/object_gi_bottle_letter/object_gi_bottle_letter.c +assets/objects/object_gi_bottle/object_gi_bottle.c +assets/objects/object_gi_bow/object_gi_bow.c +assets/objects/object_gi_bracelet/object_gi_bracelet.c +assets/objects/object_gi_brokensword/object_gi_brokensword.c +assets/objects/object_gi_butterfly/object_gi_butterfly.c +assets/objects/object_gi_clothes/object_gi_clothes.c +assets/objects/object_gi_coin/object_gi_coin.c +assets/objects/object_gi_compass/object_gi_compass.c +assets/objects/object_gi_dekupouch/object_gi_dekupouch.c +assets/objects/object_gi_egg/object_gi_egg.c +assets/objects/object_gi_eye_lotion/object_gi_eye_lotion.c +assets/objects/object_gi_fire/object_gi_fire.c +assets/objects/object_gi_fish/object_gi_fish.c +assets/objects/object_gi_frog/object_gi_frog.c +assets/objects/object_gi_gerudomask/object_gi_gerudomask.c +assets/objects/object_gi_gerudo/object_gi_gerudo.c +assets/objects/object_gi_ghost/object_gi_ghost.c +assets/objects/object_gi_glasses/object_gi_glasses.c +assets/objects/object_gi_gloves/object_gi_gloves.c +assets/objects/object_gi_goddess/object_gi_goddess.c +assets/objects/object_gi_golonmask/object_gi_golonmask.c +assets/objects/object_gi_grass/object_gi_grass.c +assets/objects/object_gi_hammer/object_gi_hammer.c +assets/objects/object_gi_heart/object_gi_heart.c +assets/objects/object_gi_hearts/object_gi_hearts.c +assets/objects/object_gi_hookshot/object_gi_hookshot.c +assets/objects/object_gi_hoverboots/object_gi_hoverboots.c +assets/objects/object_gi_insect/object_gi_insect.c +assets/objects/object_gi_jewel/object_gi_jewel.c +assets/objects/object_gi_key/object_gi_key.c +assets/objects/object_gi_ki_tan_mask/object_gi_ki_tan_mask.c +assets/objects/object_gi_letter/object_gi_letter.c +assets/objects/object_gi_liquid/object_gi_liquid.c +assets/objects/object_gi_longsword/object_gi_longsword.c +assets/objects/object_gi_magicpot/object_gi_magicpot.c +assets/objects/object_gi_map/object_gi_map.c +assets/objects/object_gi_m_arrow/object_gi_m_arrow.c +assets/objects/object_gi_medal/object_gi_medal.c +assets/objects/object_gi_melody/object_gi_melody.c +assets/objects/object_gi_milk/object_gi_milk.c +assets/objects/object_gi_mushroom/object_gi_mushroom.c +assets/objects/object_gi_niwatori/object_gi_niwatori.c +assets/objects/object_gi_nuts/object_gi_nuts.c +assets/objects/object_gi_ocarina_0/object_gi_ocarina_0.c +assets/objects/object_gi_ocarina/object_gi_ocarina.c +assets/objects/object_gi_pachinko/object_gi_pachinko.c +assets/objects/object_gi_powder/object_gi_powder.c +assets/objects/object_gi_prescription/object_gi_prescription.c +assets/objects/object_gi_purse/object_gi_purse.c +assets/objects/object_gi_rabit_mask/object_gi_rabit_mask.c +assets/objects/object_gi_redead_mask/object_gi_redead_mask.c +assets/objects/object_gi_rupy/object_gi_rupy.c +assets/objects/object_gi_saw/object_gi_saw.c +assets/objects/object_gi_scale/object_gi_scale.c +assets/objects/object_gi_seed/object_gi_seed.c +assets/objects/object_gi_shield_1/object_gi_shield_1.c +assets/objects/object_gi_shield_2/object_gi_shield_2.c +assets/objects/object_gi_shield_3/object_gi_shield_3.c +assets/objects/object_gi_skj_mask/object_gi_skj_mask.c +assets/objects/object_gi_soldout/object_gi_soldout.c +assets/objects/object_gi_soul/object_gi_soul.c +assets/objects/object_gi_stick/object_gi_stick.c +assets/objects/object_gi_sutaru/object_gi_sutaru.c +assets/objects/object_gi_sword_1/object_gi_sword_1.c +assets/objects/object_gi_ticketstone/object_gi_ticketstone.c +assets/objects/object_gi_truth_mask/object_gi_truth_mask.c +assets/objects/object_gi_zoramask/object_gi_zoramask.c +assets/objects/object_gj/object_gj.c +assets/objects/object_gjyo_objects/object_gjyo_objects.c +assets/objects/object_gla/object_gla.c +assets/objects/object_gm/object_gm.c +assets/objects/object_gndd/object_gndd.c +assets/objects/object_gnd_magic/object_gnd_magic.c +assets/objects/object_gnd/object_gnd.c +assets/objects/object_god_lgt/object_god_lgt.c +assets/objects/object_gol/object_gol.c +assets/objects/object_goma/object_goma.c +assets/objects/object_goroiwa/object_goroiwa.c +assets/objects/object_gr/object_gr.c +assets/objects/object_gs/object_gs.c +assets/objects/object_gt/object_gt.c +assets/objects/object_hakach_objects/object_hakach_objects.c +assets/objects/object_haka_door/object_haka_door.c +assets/objects/object_haka/object_haka.c +assets/objects/object_haka_objects/object_haka_objects.c +assets/objects/object_hata/object_hata.c +assets/objects/object_heavy_object/object_heavy_object.c +assets/objects/object_hidan_objects/object_hidan_objects.c +assets/objects/object_hintnuts/object_hintnuts.c +assets/objects/object_hni/object_hni.c +assets/objects/object_horse_ganon/object_horse_ganon.c +assets/objects/object_horse_link_child/object_horse_link_child.c +assets/objects/object_horse_normal/object_horse_normal.c +assets/objects/object_horse/object_horse.c +assets/objects/object_horse_zelda/object_horse_zelda.c +assets/objects/object_hs/object_hs.c +assets/objects/object_human/object_human.c +assets/objects/object_ice_objects/object_ice_objects.c +assets/objects/object_ik/object_ik.c +assets/objects/object_im/object_im.c +assets/objects/object_ingate/object_ingate.c +assets/objects/object_in/object_in.c +assets/objects/object_jj/object_jj.c +assets/objects/object_js/object_js.c +assets/objects/object_jya_door/object_jya_door.c +assets/objects/object_jya_iron/object_jya_iron.c +assets/objects/object_jya_obj/object_jya_obj.c +assets/objects/object_kanban/object_kanban.c +assets/objects/object_ka/object_ka.c +assets/objects/object_kibako2/object_kibako2.c +assets/objects/object_kingdodongo/object_kingdodongo.c +assets/objects/object_km1/object_km1.c +assets/objects/object_kusa/object_kusa.c +assets/objects/object_kw1/object_kw1.c +assets/objects/object_kz/object_kz.c +assets/objects/object_lightbox/object_lightbox.c +assets/objects/object_light_ring/object_light_ring.c +assets/objects/object_lightswitch/object_lightswitch.c +assets/objects/object_link_boy/object_link_boy.c +assets/objects/object_link_child/object_link_child.c +assets/objects/object_ma1/object_ma1.c +assets/objects/object_ma2/object_ma2.c +assets/objects/object_mag/object_mag.c +assets/objects/object_mamenoki/object_mamenoki.c +assets/objects/object_mastergolon/object_mastergolon.c +assets/objects/object_masterkokirihead/object_masterkokirihead.c +assets/objects/object_masterkokiri/object_masterkokiri.c +assets/objects/object_masterzoora/object_masterzoora.c +assets/objects/object_mb/object_mb.c +assets/objects/object_md/object_md.c +assets/objects/object_medal/object_medal.c +assets/objects/object_menkuri_objects/object_menkuri_objects.c +assets/objects/object_mir_ray/object_mir_ray.c +assets/objects/object_mizu_objects/object_mizu_objects.c +assets/objects/object_mjin_dark/object_mjin_dark.c +assets/objects/object_mjin_flame/object_mjin_flame.c +assets/objects/object_mjin_flash/object_mjin_flash.c +assets/objects/object_mjin_ice/object_mjin_ice.c +assets/objects/object_mjin/object_mjin.c +assets/objects/object_mjin_oka/object_mjin_oka.c +assets/objects/object_mjin_soul/object_mjin_soul.c +assets/objects/object_mjin_wind/object_mjin_wind.c +assets/objects/object_mk/object_mk.c +assets/objects/object_mm/object_mm.c +assets/objects/object_mo/object_mo.c +assets/objects/object_mori_hineri1a/object_mori_hineri1a.c +assets/objects/object_mori_hineri1/object_mori_hineri1.c +assets/objects/object_mori_hineri2a/object_mori_hineri2a.c +assets/objects/object_mori_hineri2/object_mori_hineri2.c +assets/objects/object_mori_objects/object_mori_objects.c +assets/objects/object_mori_tex/object_mori_tex.c +assets/objects/object_ms/object_ms.c +assets/objects/object_mu/object_mu.c +assets/objects/object_nb/object_nb.c +assets/objects/object_niw/object_niw.c +assets/objects/object_nwc/object_nwc.c +assets/objects/object_ny/object_ny.c +assets/objects/object_oA10/object_oA10.c +assets/objects/object_oA11/object_oA11.c +assets/objects/object_oA1/object_oA1.c +assets/objects/object_oA2/object_oA2.c +assets/objects/object_oA3/object_oA3.c +assets/objects/object_oA4/object_oA4.c +assets/objects/object_oA5/object_oA5.c +assets/objects/object_oA6/object_oA6.c +assets/objects/object_oA7/object_oA7.c +assets/objects/object_oA8/object_oA8.c +assets/objects/object_oA9/object_oA9.c +assets/objects/object_o_anime/object_o_anime.c +assets/objects/object_oB1/object_oB1.c +assets/objects/object_oB2/object_oB2.c +assets/objects/object_oB3/object_oB3.c +assets/objects/object_oB4/object_oB4.c +assets/objects/object_oE10/object_oE10.c +assets/objects/object_oE11/object_oE11.c +assets/objects/object_oE12/object_oE12.c +assets/objects/object_oE1/object_oE1.c +assets/objects/object_oE1s/object_oE1s.c +assets/objects/object_oE2/object_oE2.c +assets/objects/object_oE3/object_oE3.c +assets/objects/object_oE4/object_oE4.c +assets/objects/object_oE4s/object_oE4s.c +assets/objects/object_oE5/object_oE5.c +assets/objects/object_oE6/object_oE6.c +assets/objects/object_oE7/object_oE7.c +assets/objects/object_oE8/object_oE8.c +assets/objects/object_oE9/object_oE9.c +assets/objects/object_oE_anime/object_oE_anime.c +assets/objects/object_oF1d_map/object_oF1d_map.c +assets/objects/object_oF1s/object_oF1s.c +assets/objects/object_okuta/object_okuta.c +assets/objects/object_opening_demo1/object_opening_demo1.c +assets/objects/object_os_anime/object_os_anime.c +assets/objects/object_os/object_os.c +assets/objects/object_ossan/object_ossan.c +assets/objects/object_ouke_haka/object_ouke_haka.c +assets/objects/object_owl/object_owl.c +assets/objects/object_peehat/object_peehat.c +assets/objects/object_po_composer/object_po_composer.c +assets/objects/object_po_field/object_po_field.c +assets/objects/object_poh/object_poh.c +assets/objects/object_po_sisters/object_po_sisters.c +assets/objects/object_ps/object_ps.c +assets/objects/object_pu_box/object_pu_box.c +assets/objects/object_rd/object_rd.c +assets/objects/object_reeba/object_reeba.c +assets/objects/object_relay_objects/object_relay_objects.c +assets/objects/object_rl/object_rl.c +assets/objects/object_rr/object_rr.c +assets/objects/object_rs/object_rs.c +assets/objects/object_ru1/object_ru1.c +assets/objects/object_ru2/object_ru2.c +assets/objects/object_sa/object_sa.c +assets/objects/object_sb/object_sb.c +assets/objects/object_sd/object_sd.c +assets/objects/object_shop_dungen/object_shop_dungen.c +assets/objects/object_shopnuts/object_shopnuts.c +assets/objects/object_siofuki/object_siofuki.c +assets/objects/object_sk2/object_sk2.c +assets/objects/object_skb/object_skb.c +assets/objects/object_skj/object_skj.c +assets/objects/object_spot00_break/object_spot00_break.c +assets/objects/object_spot00_objects/object_spot00_objects.c +assets/objects/object_spot01_matoyab/object_spot01_matoyab.c +assets/objects/object_spot01_matoya/object_spot01_matoya.c +assets/objects/object_spot01_objects2/object_spot01_objects2.c +assets/objects/object_spot01_objects/object_spot01_objects.c +assets/objects/object_spot02_objects/object_spot02_objects.c +assets/objects/object_spot03_object/object_spot03_object.c +assets/objects/object_spot04_objects/object_spot04_objects.c +assets/objects/object_spot05_objects/object_spot05_objects.c +assets/objects/object_spot06_objects/object_spot06_objects.c +assets/objects/object_spot07_object/object_spot07_object.c +assets/objects/object_spot08_obj/object_spot08_obj.c +assets/objects/object_spot09_obj/object_spot09_obj.c +assets/objects/object_spot11_obj/object_spot11_obj.c +assets/objects/object_spot12_obj/object_spot12_obj.c +assets/objects/object_spot15_obj/object_spot15_obj.c +assets/objects/object_spot16_obj/object_spot16_obj.c +assets/objects/object_spot17_obj/object_spot17_obj.c +assets/objects/object_spot18_obj/object_spot18_obj.c +assets/objects/object_ssh/object_ssh.c +assets/objects/object_sst/object_sst.c +assets/objects/object_st/object_st.c +assets/objects/object_stream/object_stream.c +assets/objects/object_syokudai/object_syokudai.c +assets/objects/object_ta/object_ta.c +assets/objects/object_timeblock/object_timeblock.c +assets/objects/object_tite/object_tite.c +assets/objects/object_tk/object_tk.c +assets/objects/object_toki_objects/object_toki_objects.c +assets/objects/object_torch2/object_torch2.c +assets/objects/object_toryo/object_toryo.c +assets/objects/object_tp/object_tp.c +assets/objects/object_trap/object_trap.c +assets/objects/object_triforce_spot/object_triforce_spot.c +assets/objects/object_tr/object_tr.c +assets/objects/object_ts/object_ts.c +assets/objects/object_tsubo/object_tsubo.c +assets/objects/object_tw/object_tw.c +assets/objects/object_umajump/object_umajump.c +assets/objects/object_vali/object_vali.c +assets/objects/object_vase/object_vase.c +assets/objects/object_vm/object_vm.c +assets/objects/object_wallmaster/object_wallmaster.c +assets/objects/object_warp1/object_warp1.c +assets/objects/object_warp2/object_warp2.c +assets/objects/object_wf/object_wf.c +assets/objects/object_wood02/object_wood02.c +assets/objects/object_xc/object_xc.c +assets/objects/object_yabusame_point/object_yabusame_point.c +assets/objects/object_ydan_objects/object_ydan_objects.c +assets/objects/object_yukabyun/object_yukabyun.c +assets/objects/object_zf/object_zf.c +assets/objects/object_zg/object_zg.c +assets/objects/object_zl1/object_zl1.c +assets/objects/object_zl2_anime1/object_zl2_anime1.c +assets/objects/object_zl2_anime2/object_zl2_anime2.c +assets/objects/object_zl2/object_zl2.c +assets/objects/object_zl4/object_zl4.c +assets/objects/object_zo/object_zo.c +assets/overlays/ovl_Arrow_Fire/ovl_Arrow_Fire.c +assets/overlays/ovl_Arrow_Ice/ovl_Arrow_Ice.c +assets/overlays/ovl_Arrow_Light/ovl_Arrow_Light.c +assets/overlays/ovl_Bg_Ganon_Otyuka/ovl_Bg_Ganon_Otyuka.c +assets/overlays/ovl_Bg_Jya_Cobra/ovl_Bg_Jya_Cobra.c +assets/overlays/ovl_Boss_Dodongo/ovl_Boss_Dodongo.c +assets/overlays/ovl_Boss_Ganon2/ovl_Boss_Ganon2.c +assets/overlays/ovl_Boss_Ganon/ovl_Boss_Ganon.c +assets/overlays/ovl_Boss_Sst/ovl_Boss_Sst.c +assets/overlays/ovl_Demo_Shd/ovl_Demo_Shd.c +assets/overlays/ovl_Effect_Ss_Fhg_Flash/ovl_Effect_Ss_Fhg_Flash.c +assets/overlays/ovl_Elf_Msg2/ovl_Elf_Msg2.c +assets/overlays/ovl_Elf_Msg/ovl_Elf_Msg.c +assets/overlays/ovl_En_Bili/ovl_En_Bili.c +assets/overlays/ovl_En_Clear_Tag/ovl_En_Clear_Tag.c +assets/overlays/ovl_End_Title/ovl_End_Title.c +assets/overlays/ovl_En_Ganon_Mant/ovl_En_Ganon_Mant.c +assets/overlays/ovl_En_Ganon_Organ/ovl_En_Ganon_Organ.c +assets/overlays/ovl_En_Holl/ovl_En_Holl.c +assets/overlays/ovl_En_Jsjutan/ovl_En_Jsjutan.c +assets/overlays/ovl_En_Kanban/ovl_En_Kanban.c +assets/overlays/ovl_En_Mag/ovl_En_Mag.c +assets/overlays/ovl_En_Sda/ovl_En_Sda.c +assets/overlays/ovl_En_Ssh/ovl_En_Ssh.c +assets/overlays/ovl_En_Sth/ovl_En_Sth.c +assets/overlays/ovl_En_St/ovl_En_St.c +assets/overlays/ovl_file_choose/ovl_file_choose.c +assets/overlays/ovl_Magic_Dark/ovl_Magic_Dark.c +assets/overlays/ovl_Magic_Fire/ovl_Magic_Fire.c +assets/overlays/ovl_Magic_Wind/ovl_Magic_Wind.c +assets/overlays/ovl_Oceff_Spot/ovl_Oceff_Spot.c +assets/overlays/ovl_Oceff_Storm/ovl_Oceff_Storm.c +assets/overlays/ovl_Oceff_Wipe2/ovl_Oceff_Wipe2.c +assets/overlays/ovl_Oceff_Wipe3/ovl_Oceff_Wipe3.c +assets/overlays/ovl_Oceff_Wipe4/ovl_Oceff_Wipe4.c +assets/overlays/ovl_Oceff_Wipe/ovl_Oceff_Wipe.c +assets/scenes/dungeons/bdan/bdan_room_0.c +assets/scenes/dungeons/bdan/bdan_room_10.c +assets/scenes/dungeons/bdan/bdan_room_11.c +assets/scenes/dungeons/bdan/bdan_room_12.c +assets/scenes/dungeons/bdan/bdan_room_13.c +assets/scenes/dungeons/bdan/bdan_room_14.c +assets/scenes/dungeons/bdan/bdan_room_15.c +assets/scenes/dungeons/bdan/bdan_room_1.c +assets/scenes/dungeons/bdan/bdan_room_2.c +assets/scenes/dungeons/bdan/bdan_room_3.c +assets/scenes/dungeons/bdan/bdan_room_4.c +assets/scenes/dungeons/bdan/bdan_room_5.c +assets/scenes/dungeons/bdan/bdan_room_6.c +assets/scenes/dungeons/bdan/bdan_room_7.c +assets/scenes/dungeons/bdan/bdan_room_8.c +assets/scenes/dungeons/bdan/bdan_room_9.c +assets/scenes/dungeons/bdan/bdan_scene.c +assets/scenes/dungeons/bdan_boss/bdan_boss_room_0.c +assets/scenes/dungeons/bdan_boss/bdan_boss_room_1.c +assets/scenes/dungeons/bdan_boss/bdan_boss_scene.c +assets/scenes/dungeons/Bmori1/Bmori1_room_0.c +assets/scenes/dungeons/Bmori1/Bmori1_room_10.c +assets/scenes/dungeons/Bmori1/Bmori1_room_11.c +assets/scenes/dungeons/Bmori1/Bmori1_room_12.c +assets/scenes/dungeons/Bmori1/Bmori1_room_13.c +assets/scenes/dungeons/Bmori1/Bmori1_room_14.c +assets/scenes/dungeons/Bmori1/Bmori1_room_15.c +assets/scenes/dungeons/Bmori1/Bmori1_room_16.c +assets/scenes/dungeons/Bmori1/Bmori1_room_17.c +assets/scenes/dungeons/Bmori1/Bmori1_room_18.c +assets/scenes/dungeons/Bmori1/Bmori1_room_19.c +assets/scenes/dungeons/Bmori1/Bmori1_room_1.c +assets/scenes/dungeons/Bmori1/Bmori1_room_20.c +assets/scenes/dungeons/Bmori1/Bmori1_room_21.c +assets/scenes/dungeons/Bmori1/Bmori1_room_22.c +assets/scenes/dungeons/Bmori1/Bmori1_room_2.c +assets/scenes/dungeons/Bmori1/Bmori1_room_3.c +assets/scenes/dungeons/Bmori1/Bmori1_room_4.c +assets/scenes/dungeons/Bmori1/Bmori1_room_5.c +assets/scenes/dungeons/Bmori1/Bmori1_room_6.c +assets/scenes/dungeons/Bmori1/Bmori1_room_7.c +assets/scenes/dungeons/Bmori1/Bmori1_room_8.c +assets/scenes/dungeons/Bmori1/Bmori1_room_9.c +assets/scenes/dungeons/Bmori1/Bmori1_scene.c +assets/scenes/dungeons/ddan_boss/ddan_boss_room_0.c +assets/scenes/dungeons/ddan_boss/ddan_boss_room_1.c +assets/scenes/dungeons/ddan_boss/ddan_boss_scene.c +assets/scenes/dungeons/ddan/ddan_room_0.c +assets/scenes/dungeons/ddan/ddan_room_10.c +assets/scenes/dungeons/ddan/ddan_room_11.c +assets/scenes/dungeons/ddan/ddan_room_12.c +assets/scenes/dungeons/ddan/ddan_room_13.c +assets/scenes/dungeons/ddan/ddan_room_14.c +assets/scenes/dungeons/ddan/ddan_room_15.c +assets/scenes/dungeons/ddan/ddan_room_16.c +assets/scenes/dungeons/ddan/ddan_room_1.c +assets/scenes/dungeons/ddan/ddan_room_2.c +assets/scenes/dungeons/ddan/ddan_room_3.c +assets/scenes/dungeons/ddan/ddan_room_4.c +assets/scenes/dungeons/ddan/ddan_room_5.c +assets/scenes/dungeons/ddan/ddan_room_6.c +assets/scenes/dungeons/ddan/ddan_room_7.c +assets/scenes/dungeons/ddan/ddan_room_8.c +assets/scenes/dungeons/ddan/ddan_room_9.c +assets/scenes/dungeons/ddan/ddan_scene.c +assets/scenes/dungeons/FIRE_bs/FIRE_bs_room_0.c +assets/scenes/dungeons/FIRE_bs/FIRE_bs_room_1.c +assets/scenes/dungeons/FIRE_bs/FIRE_bs_scene.c +assets/scenes/dungeons/ganon_boss/ganon_boss_room_0.c +assets/scenes/dungeons/ganon_boss/ganon_boss_scene.c +assets/scenes/dungeons/ganon_demo/ganon_demo_room_0.c +assets/scenes/dungeons/ganon_demo/ganon_demo_scene.c +assets/scenes/dungeons/ganon_final/ganon_final_room_0.c +assets/scenes/dungeons/ganon_final/ganon_final_scene.c +assets/scenes/dungeons/ganon/ganon_room_0.c +assets/scenes/dungeons/ganon/ganon_room_1.c +assets/scenes/dungeons/ganon/ganon_room_2.c +assets/scenes/dungeons/ganon/ganon_room_3.c +assets/scenes/dungeons/ganon/ganon_room_4.c +assets/scenes/dungeons/ganon/ganon_room_5.c +assets/scenes/dungeons/ganon/ganon_room_6.c +assets/scenes/dungeons/ganon/ganon_room_7.c +assets/scenes/dungeons/ganon/ganon_room_8.c +assets/scenes/dungeons/ganon/ganon_room_9.c +assets/scenes/dungeons/ganon/ganon_scene.c +assets/scenes/dungeons/ganon_sonogo/ganon_sonogo_room_0.c +assets/scenes/dungeons/ganon_sonogo/ganon_sonogo_room_1.c +assets/scenes/dungeons/ganon_sonogo/ganon_sonogo_room_2.c +assets/scenes/dungeons/ganon_sonogo/ganon_sonogo_room_3.c +assets/scenes/dungeons/ganon_sonogo/ganon_sonogo_room_4.c +assets/scenes/dungeons/ganon_sonogo/ganon_sonogo_scene.c +assets/scenes/dungeons/ganontika/ganontika_room_0.c +assets/scenes/dungeons/ganontika/ganontika_room_10.c +assets/scenes/dungeons/ganontika/ganontika_room_11.c +assets/scenes/dungeons/ganontika/ganontika_room_12.c +assets/scenes/dungeons/ganontika/ganontika_room_13.c +assets/scenes/dungeons/ganontika/ganontika_room_14.c +assets/scenes/dungeons/ganontika/ganontika_room_15.c +assets/scenes/dungeons/ganontika/ganontika_room_16.c +assets/scenes/dungeons/ganontika/ganontika_room_17.c +assets/scenes/dungeons/ganontika/ganontika_room_18.c +assets/scenes/dungeons/ganontika/ganontika_room_19.c +assets/scenes/dungeons/ganontika/ganontika_room_1.c +assets/scenes/dungeons/ganontika/ganontika_room_2.c +assets/scenes/dungeons/ganontika/ganontika_room_3.c +assets/scenes/dungeons/ganontika/ganontika_room_4.c +assets/scenes/dungeons/ganontika/ganontika_room_5.c +assets/scenes/dungeons/ganontika/ganontika_room_6.c +assets/scenes/dungeons/ganontika/ganontika_room_7.c +assets/scenes/dungeons/ganontika/ganontika_room_8.c +assets/scenes/dungeons/ganontika/ganontika_room_9.c +assets/scenes/dungeons/ganontika/ganontika_scene.c +assets/scenes/dungeons/ganontikasonogo/ganontikasonogo_room_0.c +assets/scenes/dungeons/ganontikasonogo/ganontikasonogo_room_1.c +assets/scenes/dungeons/ganontikasonogo/ganontikasonogo_scene.c +assets/scenes/dungeons/gerudoway/gerudoway_room_0.c +assets/scenes/dungeons/gerudoway/gerudoway_room_1.c +assets/scenes/dungeons/gerudoway/gerudoway_room_2.c +assets/scenes/dungeons/gerudoway/gerudoway_room_3.c +assets/scenes/dungeons/gerudoway/gerudoway_room_4.c +assets/scenes/dungeons/gerudoway/gerudoway_room_5.c +assets/scenes/dungeons/gerudoway/gerudoway_scene.c +assets/scenes/dungeons/HAKAdan_bs/HAKAdan_bs_room_0.c +assets/scenes/dungeons/HAKAdan_bs/HAKAdan_bs_room_1.c +assets/scenes/dungeons/HAKAdan_bs/HAKAdan_bs_scene.c +assets/scenes/dungeons/HAKAdanCH/HAKAdanCH_room_0.c +assets/scenes/dungeons/HAKAdanCH/HAKAdanCH_room_1.c +assets/scenes/dungeons/HAKAdanCH/HAKAdanCH_room_2.c +assets/scenes/dungeons/HAKAdanCH/HAKAdanCH_room_3.c +assets/scenes/dungeons/HAKAdanCH/HAKAdanCH_room_4.c +assets/scenes/dungeons/HAKAdanCH/HAKAdanCH_room_5.c +assets/scenes/dungeons/HAKAdanCH/HAKAdanCH_room_6.c +assets/scenes/dungeons/HAKAdanCH/HAKAdanCH_scene.c +assets/scenes/dungeons/HAKAdan/HAKAdan_room_0.c +assets/scenes/dungeons/HAKAdan/HAKAdan_room_10.c +assets/scenes/dungeons/HAKAdan/HAKAdan_room_11.c +assets/scenes/dungeons/HAKAdan/HAKAdan_room_12.c +assets/scenes/dungeons/HAKAdan/HAKAdan_room_13.c +assets/scenes/dungeons/HAKAdan/HAKAdan_room_14.c +assets/scenes/dungeons/HAKAdan/HAKAdan_room_15.c +assets/scenes/dungeons/HAKAdan/HAKAdan_room_16.c +assets/scenes/dungeons/HAKAdan/HAKAdan_room_17.c +assets/scenes/dungeons/HAKAdan/HAKAdan_room_18.c +assets/scenes/dungeons/HAKAdan/HAKAdan_room_19.c +assets/scenes/dungeons/HAKAdan/HAKAdan_room_1.c +assets/scenes/dungeons/HAKAdan/HAKAdan_room_20.c +assets/scenes/dungeons/HAKAdan/HAKAdan_room_21.c +assets/scenes/dungeons/HAKAdan/HAKAdan_room_22.c +assets/scenes/dungeons/HAKAdan/HAKAdan_room_2.c +assets/scenes/dungeons/HAKAdan/HAKAdan_room_3.c +assets/scenes/dungeons/HAKAdan/HAKAdan_room_4.c +assets/scenes/dungeons/HAKAdan/HAKAdan_room_5.c +assets/scenes/dungeons/HAKAdan/HAKAdan_room_6.c +assets/scenes/dungeons/HAKAdan/HAKAdan_room_7.c +assets/scenes/dungeons/HAKAdan/HAKAdan_room_8.c +assets/scenes/dungeons/HAKAdan/HAKAdan_room_9.c +assets/scenes/dungeons/HAKAdan/HAKAdan_scene.c +assets/scenes/dungeons/HIDAN/HIDAN_room_0.c +assets/scenes/dungeons/HIDAN/HIDAN_room_10.c +assets/scenes/dungeons/HIDAN/HIDAN_room_11.c +assets/scenes/dungeons/HIDAN/HIDAN_room_12.c +assets/scenes/dungeons/HIDAN/HIDAN_room_13.c +assets/scenes/dungeons/HIDAN/HIDAN_room_14.c +assets/scenes/dungeons/HIDAN/HIDAN_room_15.c +assets/scenes/dungeons/HIDAN/HIDAN_room_16.c +assets/scenes/dungeons/HIDAN/HIDAN_room_17.c +assets/scenes/dungeons/HIDAN/HIDAN_room_18.c +assets/scenes/dungeons/HIDAN/HIDAN_room_19.c +assets/scenes/dungeons/HIDAN/HIDAN_room_1.c +assets/scenes/dungeons/HIDAN/HIDAN_room_20.c +assets/scenes/dungeons/HIDAN/HIDAN_room_21.c +assets/scenes/dungeons/HIDAN/HIDAN_room_22.c +assets/scenes/dungeons/HIDAN/HIDAN_room_23.c +assets/scenes/dungeons/HIDAN/HIDAN_room_24.c +assets/scenes/dungeons/HIDAN/HIDAN_room_25.c +assets/scenes/dungeons/HIDAN/HIDAN_room_26.c +assets/scenes/dungeons/HIDAN/HIDAN_room_2.c +assets/scenes/dungeons/HIDAN/HIDAN_room_3.c +assets/scenes/dungeons/HIDAN/HIDAN_room_4.c +assets/scenes/dungeons/HIDAN/HIDAN_room_5.c +assets/scenes/dungeons/HIDAN/HIDAN_room_6.c +assets/scenes/dungeons/HIDAN/HIDAN_room_7.c +assets/scenes/dungeons/HIDAN/HIDAN_room_8.c +assets/scenes/dungeons/HIDAN/HIDAN_room_9.c +assets/scenes/dungeons/HIDAN/HIDAN_scene.c +assets/scenes/dungeons/ice_doukutu/ice_doukutu_room_0.c +assets/scenes/dungeons/ice_doukutu/ice_doukutu_room_10.c +assets/scenes/dungeons/ice_doukutu/ice_doukutu_room_11.c +assets/scenes/dungeons/ice_doukutu/ice_doukutu_room_1.c +assets/scenes/dungeons/ice_doukutu/ice_doukutu_room_2.c +assets/scenes/dungeons/ice_doukutu/ice_doukutu_room_3.c +assets/scenes/dungeons/ice_doukutu/ice_doukutu_room_4.c +assets/scenes/dungeons/ice_doukutu/ice_doukutu_room_5.c +assets/scenes/dungeons/ice_doukutu/ice_doukutu_room_6.c +assets/scenes/dungeons/ice_doukutu/ice_doukutu_room_7.c +assets/scenes/dungeons/ice_doukutu/ice_doukutu_room_8.c +assets/scenes/dungeons/ice_doukutu/ice_doukutu_room_9.c +assets/scenes/dungeons/ice_doukutu/ice_doukutu_scene.c +assets/scenes/dungeons/jyasinboss/jyasinboss_room_0.c +assets/scenes/dungeons/jyasinboss/jyasinboss_room_1.c +assets/scenes/dungeons/jyasinboss/jyasinboss_room_2.c +assets/scenes/dungeons/jyasinboss/jyasinboss_room_3.c +assets/scenes/dungeons/jyasinboss/jyasinboss_scene.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_0.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_10.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_11.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_12.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_13.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_14.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_15.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_16.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_17.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_18.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_19.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_1.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_20.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_21.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_22.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_23.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_24.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_25.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_26.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_27.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_28.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_2.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_3.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_4.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_5.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_6.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_7.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_8.c +assets/scenes/dungeons/jyasinzou/jyasinzou_room_9.c +assets/scenes/dungeons/jyasinzou/jyasinzou_scene.c +assets/scenes/dungeons/men/men_room_0.c +assets/scenes/dungeons/men/men_room_10.c +assets/scenes/dungeons/men/men_room_1.c +assets/scenes/dungeons/men/men_room_2.c +assets/scenes/dungeons/men/men_room_3.c +assets/scenes/dungeons/men/men_room_4.c +assets/scenes/dungeons/men/men_room_5.c +assets/scenes/dungeons/men/men_room_6.c +assets/scenes/dungeons/men/men_room_7.c +assets/scenes/dungeons/men/men_room_8.c +assets/scenes/dungeons/men/men_room_9.c +assets/scenes/dungeons/men/men_scene.c +assets/scenes/dungeons/MIZUsin_bs/MIZUsin_bs_room_0.c +assets/scenes/dungeons/MIZUsin_bs/MIZUsin_bs_room_1.c +assets/scenes/dungeons/MIZUsin_bs/MIZUsin_bs_scene.c +assets/scenes/dungeons/MIZUsin/MIZUsin_room_0.c +assets/scenes/dungeons/MIZUsin/MIZUsin_room_10.c +assets/scenes/dungeons/MIZUsin/MIZUsin_room_11.c +assets/scenes/dungeons/MIZUsin/MIZUsin_room_12.c +assets/scenes/dungeons/MIZUsin/MIZUsin_room_13.c +assets/scenes/dungeons/MIZUsin/MIZUsin_room_14.c +assets/scenes/dungeons/MIZUsin/MIZUsin_room_15.c +assets/scenes/dungeons/MIZUsin/MIZUsin_room_16.c +assets/scenes/dungeons/MIZUsin/MIZUsin_room_17.c +assets/scenes/dungeons/MIZUsin/MIZUsin_room_18.c +assets/scenes/dungeons/MIZUsin/MIZUsin_room_19.c +assets/scenes/dungeons/MIZUsin/MIZUsin_room_1.c +assets/scenes/dungeons/MIZUsin/MIZUsin_room_20.c +assets/scenes/dungeons/MIZUsin/MIZUsin_room_21.c +assets/scenes/dungeons/MIZUsin/MIZUsin_room_22.c +assets/scenes/dungeons/MIZUsin/MIZUsin_room_2.c +assets/scenes/dungeons/MIZUsin/MIZUsin_room_3.c +assets/scenes/dungeons/MIZUsin/MIZUsin_room_4.c +assets/scenes/dungeons/MIZUsin/MIZUsin_room_5.c +assets/scenes/dungeons/MIZUsin/MIZUsin_room_6.c +assets/scenes/dungeons/MIZUsin/MIZUsin_room_7.c +assets/scenes/dungeons/MIZUsin/MIZUsin_room_8.c +assets/scenes/dungeons/MIZUsin/MIZUsin_room_9.c +assets/scenes/dungeons/MIZUsin/MIZUsin_scene.c +assets/scenes/dungeons/moribossroom/moribossroom_room_0.c +assets/scenes/dungeons/moribossroom/moribossroom_room_1.c +assets/scenes/dungeons/moribossroom/moribossroom_scene.c +assets/scenes/dungeons/ydan_boss/ydan_boss_room_0.c +assets/scenes/dungeons/ydan_boss/ydan_boss_room_1.c +assets/scenes/dungeons/ydan_boss/ydan_boss_scene.c +assets/scenes/dungeons/ydan/ydan_room_0.c +assets/scenes/dungeons/ydan/ydan_room_10.c +assets/scenes/dungeons/ydan/ydan_room_11.c +assets/scenes/dungeons/ydan/ydan_room_1.c +assets/scenes/dungeons/ydan/ydan_room_2.c +assets/scenes/dungeons/ydan/ydan_room_3.c +assets/scenes/dungeons/ydan/ydan_room_4.c +assets/scenes/dungeons/ydan/ydan_room_5.c +assets/scenes/dungeons/ydan/ydan_room_6.c +assets/scenes/dungeons/ydan/ydan_room_7.c +assets/scenes/dungeons/ydan/ydan_room_8.c +assets/scenes/dungeons/ydan/ydan_room_9.c +assets/scenes/dungeons/ydan/ydan_scene.c +assets/scenes/indoors/bowling/bowling_room_0.c +assets/scenes/indoors/bowling/bowling_scene.c +assets/scenes/indoors/daiyousei_izumi/daiyousei_izumi_room_0.c +assets/scenes/indoors/daiyousei_izumi/daiyousei_izumi_scene.c +assets/scenes/indoors/hairal_niwa2/hairal_niwa2_room_0.c +assets/scenes/indoors/hairal_niwa2/hairal_niwa2_scene.c +assets/scenes/indoors/hairal_niwa/hairal_niwa_room_0.c +assets/scenes/indoors/hairal_niwa/hairal_niwa_scene.c +assets/scenes/indoors/hairal_niwa_n/hairal_niwa_n_room_0.c +assets/scenes/indoors/hairal_niwa_n/hairal_niwa_n_scene.c +assets/scenes/indoors/hakasitarelay/hakasitarelay_room_0.c +assets/scenes/indoors/hakasitarelay/hakasitarelay_room_1.c +assets/scenes/indoors/hakasitarelay/hakasitarelay_room_2.c +assets/scenes/indoors/hakasitarelay/hakasitarelay_room_3.c +assets/scenes/indoors/hakasitarelay/hakasitarelay_room_4.c +assets/scenes/indoors/hakasitarelay/hakasitarelay_room_5.c +assets/scenes/indoors/hakasitarelay/hakasitarelay_room_6.c +assets/scenes/indoors/hakasitarelay/hakasitarelay_scene.c +assets/scenes/indoors/hut/hut_room_0.c +assets/scenes/indoors/hut/hut_scene.c +assets/scenes/indoors/hylia_labo/hylia_labo_room_0.c +assets/scenes/indoors/hylia_labo/hylia_labo_scene.c +assets/scenes/indoors/impa/impa_room_0.c +assets/scenes/indoors/impa/impa_scene.c +assets/scenes/indoors/kakariko/kakariko_room_0.c +assets/scenes/indoors/kakariko/kakariko_scene.c +assets/scenes/indoors/kenjyanoma/kenjyanoma_room_0.c +assets/scenes/indoors/kenjyanoma/kenjyanoma_scene.c +assets/scenes/indoors/kokiri_home3/kokiri_home3_room_0.c +assets/scenes/indoors/kokiri_home3/kokiri_home3_scene.c +assets/scenes/indoors/kokiri_home4/kokiri_home4_room_0.c +assets/scenes/indoors/kokiri_home4/kokiri_home4_scene.c +assets/scenes/indoors/kokiri_home5/kokiri_home5_room_0.c +assets/scenes/indoors/kokiri_home5/kokiri_home5_scene.c +assets/scenes/indoors/kokiri_home/kokiri_home_room_0.c +assets/scenes/indoors/kokiri_home/kokiri_home_scene.c +assets/scenes/indoors/labo/labo_room_0.c +assets/scenes/indoors/labo/labo_scene.c +assets/scenes/indoors/link_home/link_home_room_0.c +assets/scenes/indoors/link_home/link_home_scene.c +assets/scenes/indoors/mahouya/mahouya_room_0.c +assets/scenes/indoors/mahouya/mahouya_scene.c +assets/scenes/indoors/malon_stable/malon_stable_room_0.c +assets/scenes/indoors/malon_stable/malon_stable_scene.c +assets/scenes/indoors/miharigoya/miharigoya_room_0.c +assets/scenes/indoors/miharigoya/miharigoya_scene.c +assets/scenes/indoors/nakaniwa/nakaniwa_room_0.c +assets/scenes/indoors/nakaniwa/nakaniwa_scene.c +assets/scenes/indoors/souko/souko_room_0.c +assets/scenes/indoors/souko/souko_room_1.c +assets/scenes/indoors/souko/souko_room_2.c +assets/scenes/indoors/souko/souko_scene.c +assets/scenes/indoors/syatekijyou/syatekijyou_room_0.c +assets/scenes/indoors/syatekijyou/syatekijyou_scene.c +assets/scenes/indoors/takaraya/takaraya_room_0.c +assets/scenes/indoors/takaraya/takaraya_room_1.c +assets/scenes/indoors/takaraya/takaraya_room_2.c +assets/scenes/indoors/takaraya/takaraya_room_3.c +assets/scenes/indoors/takaraya/takaraya_room_4.c +assets/scenes/indoors/takaraya/takaraya_room_5.c +assets/scenes/indoors/takaraya/takaraya_room_6.c +assets/scenes/indoors/takaraya/takaraya_scene.c +assets/scenes/indoors/tent/tent_room_0.c +assets/scenes/indoors/tent/tent_scene.c +assets/scenes/indoors/tokinoma/tokinoma_room_0.c +assets/scenes/indoors/tokinoma/tokinoma_room_1.c +assets/scenes/indoors/tokinoma/tokinoma_scene.c +assets/scenes/indoors/yousei_izumi_tate/yousei_izumi_tate_room_0.c +assets/scenes/indoors/yousei_izumi_tate/yousei_izumi_tate_scene.c +assets/scenes/indoors/yousei_izumi_yoko/yousei_izumi_yoko_room_0.c +assets/scenes/indoors/yousei_izumi_yoko/yousei_izumi_yoko_scene.c +assets/scenes/misc/enrui/enrui_room_0.c +assets/scenes/misc/enrui/enrui_scene.c +assets/scenes/misc/entra/entra_room_0.c +assets/scenes/misc/entra/entra_scene.c +assets/scenes/misc/entra_n/entra_n_room_0.c +assets/scenes/misc/entra_n/entra_n_scene.c +assets/scenes/misc/hakaana2/hakaana2_room_0.c +assets/scenes/misc/hakaana2/hakaana2_scene.c +assets/scenes/misc/hakaana/hakaana_room_0.c +assets/scenes/misc/hakaana/hakaana_scene.c +assets/scenes/misc/hakaana_ouke/hakaana_ouke_room_0.c +assets/scenes/misc/hakaana_ouke/hakaana_ouke_room_1.c +assets/scenes/misc/hakaana_ouke/hakaana_ouke_room_2.c +assets/scenes/misc/hakaana_ouke/hakaana_ouke_scene.c +assets/scenes/misc/hiral_demo/hiral_demo_room_0.c +assets/scenes/misc/hiral_demo/hiral_demo_scene.c +assets/scenes/misc/kakariko3/kakariko3_room_0.c +assets/scenes/misc/kakariko3/kakariko3_scene.c +assets/scenes/misc/kakusiana/kakusiana_room_0.c +assets/scenes/misc/kakusiana/kakusiana_room_10.c +assets/scenes/misc/kakusiana/kakusiana_room_11.c +assets/scenes/misc/kakusiana/kakusiana_room_12.c +assets/scenes/misc/kakusiana/kakusiana_room_13.c +assets/scenes/misc/kakusiana/kakusiana_room_1.c +assets/scenes/misc/kakusiana/kakusiana_room_2.c +assets/scenes/misc/kakusiana/kakusiana_room_3.c +assets/scenes/misc/kakusiana/kakusiana_room_4.c +assets/scenes/misc/kakusiana/kakusiana_room_5.c +assets/scenes/misc/kakusiana/kakusiana_room_6.c +assets/scenes/misc/kakusiana/kakusiana_room_7.c +assets/scenes/misc/kakusiana/kakusiana_room_8.c +assets/scenes/misc/kakusiana/kakusiana_room_9.c +assets/scenes/misc/kakusiana/kakusiana_scene.c +assets/scenes/misc/kinsuta/kinsuta_room_0.c +assets/scenes/misc/kinsuta/kinsuta_scene.c +assets/scenes/misc/market_alley/market_alley_room_0.c +assets/scenes/misc/market_alley/market_alley_scene.c +assets/scenes/misc/market_alley_n/market_alley_n_room_0.c +assets/scenes/misc/market_alley_n/market_alley_n_scene.c +assets/scenes/misc/market_day/market_day_room_0.c +assets/scenes/misc/market_day/market_day_scene.c +assets/scenes/misc/market_night/market_night_room_0.c +assets/scenes/misc/market_night/market_night_scene.c +assets/scenes/misc/market_ruins/market_ruins_room_0.c +assets/scenes/misc/market_ruins/market_ruins_scene.c +assets/scenes/misc/shrine_n/shrine_n_room_0.c +assets/scenes/misc/shrine_n/shrine_n_scene.c +assets/scenes/misc/shrine_r/shrine_r_room_0.c +assets/scenes/misc/shrine_r/shrine_r_scene.c +assets/scenes/misc/shrine/shrine_room_0.c +assets/scenes/misc/shrine/shrine_scene.c +assets/scenes/misc/turibori/turibori_room_0.c +assets/scenes/misc/turibori/turibori_scene.c +assets/scenes/overworld/ganon_tou/ganon_tou_room_0.c +assets/scenes/overworld/ganon_tou/ganon_tou_scene.c +assets/scenes/overworld/spot00/spot00_room_0.c +assets/scenes/overworld/spot00/spot00_scene.c +assets/scenes/overworld/spot01/spot01_room_0.c +assets/scenes/overworld/spot01/spot01_scene.c +assets/scenes/overworld/spot02/spot02_room_0.c +assets/scenes/overworld/spot02/spot02_room_1.c +assets/scenes/overworld/spot02/spot02_scene.c +assets/scenes/overworld/spot03/spot03_room_0.c +assets/scenes/overworld/spot03/spot03_room_1.c +assets/scenes/overworld/spot03/spot03_scene.c +assets/scenes/overworld/spot04/spot04_room_0.c +assets/scenes/overworld/spot04/spot04_room_1.c +assets/scenes/overworld/spot04/spot04_room_2.c +assets/scenes/overworld/spot04/spot04_scene.c +assets/scenes/overworld/spot05/spot05_room_0.c +assets/scenes/overworld/spot05/spot05_scene.c +assets/scenes/overworld/spot06/spot06_room_0.c +assets/scenes/overworld/spot06/spot06_scene.c +assets/scenes/overworld/spot07/spot07_room_0.c +assets/scenes/overworld/spot07/spot07_room_1.c +assets/scenes/overworld/spot07/spot07_scene.c +assets/scenes/overworld/spot08/spot08_room_0.c +assets/scenes/overworld/spot08/spot08_scene.c +assets/scenes/overworld/spot09/spot09_room_0.c +assets/scenes/overworld/spot09/spot09_scene.c +assets/scenes/overworld/spot10/spot10_room_0.c +assets/scenes/overworld/spot10/spot10_room_1.c +assets/scenes/overworld/spot10/spot10_room_2.c +assets/scenes/overworld/spot10/spot10_room_3.c +assets/scenes/overworld/spot10/spot10_room_4.c +assets/scenes/overworld/spot10/spot10_room_5.c +assets/scenes/overworld/spot10/spot10_room_6.c +assets/scenes/overworld/spot10/spot10_room_7.c +assets/scenes/overworld/spot10/spot10_room_8.c +assets/scenes/overworld/spot10/spot10_room_9.c +assets/scenes/overworld/spot10/spot10_scene.c +assets/scenes/overworld/spot11/spot11_room_0.c +assets/scenes/overworld/spot11/spot11_scene.c +assets/scenes/overworld/spot12/spot12_room_0.c +assets/scenes/overworld/spot12/spot12_room_1.c +assets/scenes/overworld/spot12/spot12_scene.c +assets/scenes/overworld/spot13/spot13_room_0.c +assets/scenes/overworld/spot13/spot13_room_1.c +assets/scenes/overworld/spot13/spot13_scene.c +assets/scenes/overworld/spot15/spot15_room_0.c +assets/scenes/overworld/spot15/spot15_scene.c +assets/scenes/overworld/spot16/spot16_room_0.c +assets/scenes/overworld/spot16/spot16_scene.c +assets/scenes/overworld/spot17/spot17_room_0.c +assets/scenes/overworld/spot17/spot17_room_1.c +assets/scenes/overworld/spot17/spot17_scene.c +assets/scenes/overworld/spot18/spot18_room_0.c +assets/scenes/overworld/spot18/spot18_room_1.c +assets/scenes/overworld/spot18/spot18_room_2.c +assets/scenes/overworld/spot18/spot18_room_3.c +assets/scenes/overworld/spot18/spot18_scene.c +assets/scenes/overworld/spot20/spot20_room_0.c +assets/scenes/overworld/spot20/spot20_scene.c +assets/scenes/shops/alley_shop/alley_shop_room_0.c +assets/scenes/shops/alley_shop/alley_shop_scene.c +assets/scenes/shops/drag/drag_room_0.c +assets/scenes/shops/drag/drag_scene.c +assets/scenes/shops/face_shop/face_shop_room_0.c +assets/scenes/shops/face_shop/face_shop_scene.c +assets/scenes/shops/golon/golon_room_0.c +assets/scenes/shops/golon/golon_scene.c +assets/scenes/shops/kokiri_shop/kokiri_shop_room_0.c +assets/scenes/shops/kokiri_shop/kokiri_shop_scene.c +assets/scenes/shops/night_shop/night_shop_room_0.c +assets/scenes/shops/night_shop/night_shop_scene.c +assets/scenes/shops/shop1/shop1_room_0.c +assets/scenes/shops/shop1/shop1_scene.c +assets/scenes/shops/zoora/zoora_room_0.c +assets/scenes/shops/zoora/zoora_scene.c +assets/scenes/test_levels/besitu/besitu_room_0.c +assets/scenes/test_levels/besitu/besitu_scene.c +assets/scenes/test_levels/depth_test/depth_test_room_0.c +assets/scenes/test_levels/depth_test/depth_test_scene.c +assets/scenes/test_levels/sasatest/sasatest_room_0.c +assets/scenes/test_levels/sasatest/sasatest_scene.c +assets/scenes/test_levels/sutaru/sutaru_room_0.c +assets/scenes/test_levels/sutaru/sutaru_scene.c +assets/scenes/test_levels/syotes2/syotes2_room_0.c +assets/scenes/test_levels/syotes2/syotes2_scene.c +assets/scenes/test_levels/syotes/syotes_room_0.c +assets/scenes/test_levels/syotes/syotes_scene.c +assets/scenes/test_levels/test01/test01_room_0.c +assets/scenes/test_levels/test01/test01_scene.c +assets/scenes/test_levels/testroom/testroom_room_0.c +assets/scenes/test_levels/testroom/testroom_room_1.c +assets/scenes/test_levels/testroom/testroom_room_2.c +assets/scenes/test_levels/testroom/testroom_room_3.c +assets/scenes/test_levels/testroom/testroom_room_4.c +assets/scenes/test_levels/testroom/testroom_scene.c +assets/textures/backgrounds/vr_ALVR_pal_static.c +assets/textures/backgrounds/vr_ALVR_static.c +assets/textures/backgrounds/vr_DGVR_pal_static.c +assets/textures/backgrounds/vr_DGVR_static.c +assets/textures/backgrounds/vr_FCVR_pal_static.c +assets/textures/backgrounds/vr_FCVR_static.c +assets/textures/backgrounds/vr_GLVR_pal_static.c +assets/textures/backgrounds/vr_GLVR_static.c +assets/textures/backgrounds/vr_IPVR_pal_static.c +assets/textures/backgrounds/vr_IPVR_static.c +assets/textures/backgrounds/vr_K3VR_pal_static.c +assets/textures/backgrounds/vr_K3VR_static.c +assets/textures/backgrounds/vr_K4VR_pal_static.c +assets/textures/backgrounds/vr_K4VR_static.c +assets/textures/backgrounds/vr_K5VR_pal_static.c +assets/textures/backgrounds/vr_K5VR_static.c +assets/textures/backgrounds/vr_KHVR_pal_static.c +assets/textures/backgrounds/vr_KHVR_static.c +assets/textures/backgrounds/vr_KKRVR_pal_static.c +assets/textures/backgrounds/vr_KKRVR_static.c +assets/textures/backgrounds/vr_KR3VR_pal_static.c +assets/textures/backgrounds/vr_KR3VR_static.c +assets/textures/backgrounds/vr_KSVR_pal_static.c +assets/textures/backgrounds/vr_KSVR_static.c +assets/textures/backgrounds/vr_LBVR_pal_static.c +assets/textures/backgrounds/vr_LBVR_static.c +assets/textures/backgrounds/vr_LHVR_pal_static.c +assets/textures/backgrounds/vr_LHVR_static.c +assets/textures/backgrounds/vr_MDVR_pal_static.c +assets/textures/backgrounds/vr_MDVR_static.c +assets/textures/backgrounds/vr_MLVR_pal_static.c +assets/textures/backgrounds/vr_MLVR_static.c +assets/textures/backgrounds/vr_MNVR_pal_static.c +assets/textures/backgrounds/vr_MNVR_static.c +assets/textures/backgrounds/vr_NSVR_pal_static.c +assets/textures/backgrounds/vr_NSVR_static.c +assets/textures/backgrounds/vr_RUVR_pal_static.c +assets/textures/backgrounds/vr_RUVR_static.c +assets/textures/backgrounds/vr_SP1a_pal_static.c +assets/textures/backgrounds/vr_SP1a_static.c +assets/textures/backgrounds/vr_TTVR_pal_static.c +assets/textures/backgrounds/vr_TTVR_static.c +assets/textures/backgrounds/vr_ZRVR_pal_static.c +assets/textures/backgrounds/vr_ZRVR_static.c +assets/textures/do_action_static/do_action_static.c +assets/textures/icon_item_24_static/icon_item_24_static.c +assets/textures/icon_item_dungeon_static/icon_item_dungeon_static.c +assets/textures/icon_item_field_static/icon_item_field_static.c +assets/textures/icon_item_fra_static/icon_item_fra_static.c +assets/textures/icon_item_gameover_static/icon_item_gameover_static.c +assets/textures/icon_item_ger_static/icon_item_ger_static.c +assets/textures/icon_item_jpn_static/icon_item_jpn_static.c +assets/textures/icon_item_nes_static/icon_item_nes_static.c +assets/textures/icon_item_static/icon_item_static.c +assets/textures/item_name_static/item_name_static.c +assets/textures/kanji/kanji.c +assets/textures/map_48x85_static/map_48x85_static.c +assets/textures/map_grand_static/map_grand_static.c +assets/textures/map_i_static/map_i_static.c +assets/textures/map_name_static/map_name_static.c +assets/textures/message_static/message_static.c +assets/textures/message_texture_static/message_texture_static.c +assets/textures/nes_font_static/nes_font_static.c +assets/textures/nintendo_rogo_static/nintendo_rogo_static.c +assets/textures/parameter_static/parameter_static.c +assets/textures/place_title_cards/g_pn_01.c +assets/textures/place_title_cards/g_pn_02.c +assets/textures/place_title_cards/g_pn_03.c +assets/textures/place_title_cards/g_pn_04.c +assets/textures/place_title_cards/g_pn_05.c +assets/textures/place_title_cards/g_pn_06.c +assets/textures/place_title_cards/g_pn_07.c +assets/textures/place_title_cards/g_pn_08.c +assets/textures/place_title_cards/g_pn_09.c +assets/textures/place_title_cards/g_pn_10.c +assets/textures/place_title_cards/g_pn_11.c +assets/textures/place_title_cards/g_pn_12.c +assets/textures/place_title_cards/g_pn_13.c +assets/textures/place_title_cards/g_pn_14.c +assets/textures/place_title_cards/g_pn_15.c +assets/textures/place_title_cards/g_pn_16.c +assets/textures/place_title_cards/g_pn_17.c +assets/textures/place_title_cards/g_pn_18.c +assets/textures/place_title_cards/g_pn_19.c +assets/textures/place_title_cards/g_pn_20.c +assets/textures/place_title_cards/g_pn_21.c +assets/textures/place_title_cards/g_pn_22.c +assets/textures/place_title_cards/g_pn_23.c +assets/textures/place_title_cards/g_pn_24.c +assets/textures/place_title_cards/g_pn_25.c +assets/textures/place_title_cards/g_pn_26.c +assets/textures/place_title_cards/g_pn_27.c +assets/textures/place_title_cards/g_pn_28.c +assets/textures/place_title_cards/g_pn_29.c +assets/textures/place_title_cards/g_pn_30.c +assets/textures/place_title_cards/g_pn_31.c +assets/textures/place_title_cards/g_pn_32.c +assets/textures/place_title_cards/g_pn_33.c +assets/textures/place_title_cards/g_pn_34.c +assets/textures/place_title_cards/g_pn_35.c +assets/textures/place_title_cards/g_pn_36.c +assets/textures/place_title_cards/g_pn_37.c +assets/textures/place_title_cards/g_pn_38.c +assets/textures/place_title_cards/g_pn_39.c +assets/textures/place_title_cards/g_pn_40.c +assets/textures/place_title_cards/g_pn_41.c +assets/textures/place_title_cards/g_pn_42.c +assets/textures/place_title_cards/g_pn_43.c +assets/textures/place_title_cards/g_pn_44.c +assets/textures/place_title_cards/g_pn_45.c +assets/textures/place_title_cards/g_pn_46.c +assets/textures/place_title_cards/g_pn_47.c +assets/textures/place_title_cards/g_pn_48.c +assets/textures/place_title_cards/g_pn_49.c +assets/textures/place_title_cards/g_pn_50.c +assets/textures/place_title_cards/g_pn_51.c +assets/textures/place_title_cards/g_pn_52.c +assets/textures/place_title_cards/g_pn_53.c +assets/textures/place_title_cards/g_pn_54.c +assets/textures/place_title_cards/g_pn_55.c +assets/textures/place_title_cards/g_pn_56.c +assets/textures/place_title_cards/g_pn_57.c +assets/textures/skyboxes/vr_cloud0_pal_static.c +assets/textures/skyboxes/vr_cloud0_static.c +assets/textures/skyboxes/vr_cloud1_pal_static.c +assets/textures/skyboxes/vr_cloud1_static.c +assets/textures/skyboxes/vr_cloud2_pal_static.c +assets/textures/skyboxes/vr_cloud2_static.c +assets/textures/skyboxes/vr_cloud3_pal_static.c +assets/textures/skyboxes/vr_cloud3_static.c +assets/textures/skyboxes/vr_fine0_pal_static.c +assets/textures/skyboxes/vr_fine0_static.c +assets/textures/skyboxes/vr_fine1_pal_static.c +assets/textures/skyboxes/vr_fine1_static.c +assets/textures/skyboxes/vr_fine2_pal_static.c +assets/textures/skyboxes/vr_fine2_static.c +assets/textures/skyboxes/vr_fine3_pal_static.c +assets/textures/skyboxes/vr_fine3_static.c +assets/textures/skyboxes/vr_holy0_pal_static.c +assets/textures/skyboxes/vr_holy0_static.c +assets/textures/skyboxes/vr_holy1_pal_static.c +assets/textures/skyboxes/vr_holy1_static.c +assets/textures/title_static/title_static.c diff --git a/tools/assets/extract/z64_resource_handlers.py b/tools/assets/extract/z64_resource_handlers.py new file mode 100644 index 0000000000..d0b6c2067a --- /dev/null +++ b/tools/assets/extract/z64_resource_handlers.py @@ -0,0 +1,469 @@ +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +from typing import Callable + +from ..descriptor.base import ResourceDesc +from ..descriptor import n64resources +from ..descriptor import z64resources + +from .extase import ( + File, + Resource, + BinaryBlobResource, +) +from .extase.cdata_resources import Vec3sArrayResource, S16ArrayResource + +from .extase_oot64 import ( + skeleton_resources, + skeleton_skin_resources, + animation_resources, + collision_resources, + dlist_resources, + playeranim_resources, + skelcurve_resources, + misc_resources, + scene_rooms_resources, + scene_commands_resource, + skelanime_legacy_resources, + room_shape_resources, +) + + +# +# resource handlers +# + + +class ResourceHandlerException(Exception): ... + + +class ResourceNeedsPostProcessWithPoolResourcesException(ResourceHandlerException): + def __init__( + self, + *args, + resource: Resource, + callback: Callable[[dict[ResourceDesc, Resource]], None], + ): + super().__init__(*args) + self.resource = resource + self.callback = callback + + def __repr__(self) -> str: + return ( + super().__repr__().removesuffix(")") + + f", resource={self.resource!r}" + + f", callback={self.callback!r})" + ) + + +ResourceHandler = Callable[[File, ResourceDesc], Resource] + + +def register_resource_handlers(): + + def skeleton_resource_handler( + file: File, + resource_desc: z64resources.SkeletonResourceDesc, + ): + offset = resource_desc.offset + if resource_desc.limb_type == z64resources.LimbType.STANDARD: + if resource_desc.type == z64resources.SkeletonType.NORMAL: + res = skeleton_resources.SkeletonNormalResource( + file, + offset, + resource_desc.symbol_name, + ) + elif resource_desc.type == z64resources.SkeletonType.FLEX: + res = skeleton_resources.SkeletonFlexResource( + file, + offset, + resource_desc.symbol_name, + ) + else: + raise NotImplementedError( + "unimplemented SkeletonType", + resource_desc.type, + ) + elif resource_desc.limb_type == z64resources.LimbType.LOD: + if resource_desc.type == z64resources.SkeletonType.NORMAL: + res = skeleton_resources.SkeletonNormalLODResource( + file, offset, resource_desc.symbol_name + ) + elif resource_desc.type == z64resources.SkeletonType.FLEX: + res = skeleton_resources.SkeletonFlexLODResource( + file, offset, resource_desc.symbol_name + ) + else: + raise NotImplementedError( + "LimbType=LOD", + "unimplemented SkeletonType", + resource_desc.type, + ) + elif resource_desc.limb_type == z64resources.LimbType.SKIN: + assert resource_desc.type == z64resources.SkeletonType.NORMAL + res = skeleton_skin_resources.SkeletonSkinResource( + file, offset, resource_desc.symbol_name + ) + elif resource_desc.limb_type == z64resources.LimbType.CURVE: + assert resource_desc.type == z64resources.SkeletonType.CURVE + res = skelcurve_resources.CurveSkeletonHeaderResource( + file, offset, resource_desc.symbol_name + ) + else: + raise NotImplementedError( + "unimplemented Skeleton LimbType", + resource_desc.limb_type, + ) + # TODO check is this works for SkeletonSkinResource + # TODO implement for CurveSkeletonHeaderResource + if resource_desc.limb_enum_name is not None: + res.set_enum_name(resource_desc.limb_enum_name) + if resource_desc.limb_enum_none_member_name is not None: + res.set_enum_member_name_none(resource_desc.limb_enum_none_member_name) + if resource_desc.limb_enum_max_member_name is not None: + res.set_enum_member_name_max(resource_desc.limb_enum_max_member_name) + return res + + def limb_resource_handler( + file: File, + resource_desc: z64resources.LimbResourceDesc, + ): + offset = resource_desc.offset + if resource_desc.limb_type == z64resources.LimbType.STANDARD: + res = skeleton_resources.StandardLimbResource( + file, + offset, + resource_desc.symbol_name, + ) + elif resource_desc.limb_type == z64resources.LimbType.SKIN: + res = skeleton_skin_resources.SkinLimbResource( + file, offset, resource_desc.symbol_name + ) + elif resource_desc.limb_type == z64resources.LimbType.LOD: + res = skeleton_resources.LODLimbResource( + file, offset, resource_desc.symbol_name + ) + elif resource_desc.limb_type == z64resources.LimbType.LEGACY: + return skelanime_legacy_resources.LegacyLimbResource( + file, offset, resource_desc.symbol_name + ) + elif resource_desc.limb_type == z64resources.LimbType.CURVE: + res = skelcurve_resources.SkelCurveLimbResource( + file, offset, resource_desc.symbol_name + ) + else: + raise NotImplementedError( + "unimplemented LimbType", + resource_desc.limb_type, + ) + # TODO check this works for SkinLimbResource + # TODO implement for SkelCurveLimbResource + if resource_desc.limb_enum_member_name is not None: + res.set_enum_member_name(resource_desc.limb_enum_member_name) + return res + + def limb_table_handler( + file: File, + resource_desc: z64resources.LimbTableResourceDesc, + ): + if resource_desc.limb_type == z64resources.LimbType.STANDARD: + resource = skeleton_resources.StandardLimbsArrayResource( + file, resource_desc.offset, resource_desc.symbol_name + ) + resource.set_length(resource_desc.count) + return resource + elif resource_desc.limb_type == z64resources.LimbType.SKIN: + resource = skeleton_skin_resources.SkinLimbsArrayResource( + file, resource_desc.offset, resource_desc.symbol_name + ) + resource.set_length(resource_desc.count) + return resource + elif resource_desc.limb_type == z64resources.LimbType.LOD: + resource = skeleton_resources.LODLimbsArrayResource( + file, resource_desc.offset, resource_desc.symbol_name + ) + resource.set_length(resource_desc.count) + return resource + elif resource_desc.limb_type == z64resources.LimbType.LEGACY: + resource = skelanime_legacy_resources.LegacyLimbsArrayResource( + file, + resource_desc.offset, + resource_desc.symbol_name, + ) + resource.set_length(resource_desc.count) + return resource + else: + raise NotImplementedError("LimbTable of limb type", resource_desc.limb_type) + + def animation_resource_handler( + file: File, + resource_desc: z64resources.AnimationResourceDesc, + ): + return animation_resources.AnimationResource( + file, + resource_desc.offset, + resource_desc.symbol_name, + ) + + def collision_resource_handler( + file: File, + resource_desc: z64resources.CollisionResourceDesc, + ): + return collision_resources.CollisionResource( + file, + resource_desc.offset, + resource_desc.symbol_name, + ) + + def dlist_resource_handler( + file: File, + resource_desc: n64resources.DListResourceDesc, + ): + res = dlist_resources.DListResource( + file, + resource_desc.offset, + resource_desc.symbol_name, + target_ucode={ + n64resources.GfxMicroCode.F3DEX: dlist_resources.Ucode.f3dex, + n64resources.GfxMicroCode.F3DEX2: dlist_resources.Ucode.f3dex2, + }[resource_desc.ucode], + ) + res.ignored_raw_pointers |= resource_desc.raw_pointers + return res + + def texture_resource_handler( + file: File, resource_desc: n64resources.TextureResourceDesc + ): + res = dlist_resources.TextureResource( + file, + resource_desc.offset, + resource_desc.symbol_name, + resource_desc.format.fmt, + resource_desc.format.siz, + resource_desc.width, + resource_desc.height, + ) + if "hackmode_ignore_orphaned_tlut" in resource_desc.hack_modes: + res.HACK_ignore_orphaned_tlut = True + return res + + def ci_texture_resource_handler( + file: File, resource_desc: n64resources.CITextureResourceDesc + ): + if ( + "hackmode_split_tlut_true" in resource_desc.hack_modes + or "hackmode_split_tlut_false" in resource_desc.hack_modes + ): + resource = dlist_resources.TextureSplitTlutResource( + file, + resource_desc.offset, + resource_desc.symbol_name, + resource_desc.format.fmt, + resource_desc.format.siz, + resource_desc.width, + resource_desc.height, + "hackmode_split_tlut_false" in resource_desc.hack_modes, + ) + else: + resource = dlist_resources.TextureResource( + file, + resource_desc.offset, + resource_desc.symbol_name, + resource_desc.format.fmt, + resource_desc.format.siz, + resource_desc.width, + resource_desc.height, + ) + + def callback_set_tlut(pool_resources_by_desc): + resource_tlut_desc = resource_desc.tlut + resource_tlut = pool_resources_by_desc[resource_tlut_desc] + resource.set_tlut(resource_tlut) + + raise ResourceNeedsPostProcessWithPoolResourcesException( + resource=resource, callback=callback_set_tlut + ) + + def PlayerAnimationData_handler( + file: File, + resource_desc: z64resources.PlayerAnimationDataResourceDesc, + ): + res = playeranim_resources.PlayerAnimationDataResource( + file, + resource_desc.offset, + resource_desc.symbol_name, + ) + res.set_frame_count(resource_desc.frame_count) + return res + + def PlayerAnimation_handler( + file: File, + resource_desc: z64resources.PlayerAnimationResourceDesc, + ): + return playeranim_resources.PlayerAnimationResource( + file, + resource_desc.offset, + resource_desc.symbol_name, + ) + + def vec3s_array_resource_handler( + file: File, + resource_desc: n64resources.Vec3sArrayResourceDesc, + ): + return Vec3sArrayResource( + file, + resource_desc.offset, + resource_desc.symbol_name, + resource_desc.count, + ) + + def s16_array_resource_handler( + file: File, + resource_desc: n64resources.S16ArrayResourceDesc, + ): + return S16ArrayResource( + file, + resource_desc.offset, + resource_desc.symbol_name, + resource_desc.count, + ) + + def vtx_array_resource_handler( + file: File, + resource_desc: n64resources.VtxArrayResourceDesc, + ): + return dlist_resources.VtxArrayResource( + file, + resource_desc.offset, + ( + resource_desc.offset + + ( + resource_desc.count + * dlist_resources.VtxArrayResource.element_cdata_ext.size + ) + ), + resource_desc.symbol_name, + ) + + def binary_blob_resource_handler( + file: File, + resource_desc: n64resources.BlobResourceDesc, + ): + return BinaryBlobResource( + file, + resource_desc.offset, + resource_desc.offset + resource_desc.size, + resource_desc.symbol_name, + ) + + def CurveAnimation_handler( + file: File, + resource_desc: z64resources.CurveAnimationResourceDesc, + ): + # TODO use resource_desc.skeleton + return skelcurve_resources.CurveAnimationHeaderResource( + file, resource_desc.offset, resource_desc.symbol_name + ) + + def Mtx_handler( + file: File, + resource_desc: n64resources.MtxResourceDesc, + ): + return dlist_resources.MtxResource( + file, resource_desc.offset, resource_desc.symbol_name + ) + + def cutscene_resource_handler( + file: File, + resource_desc: z64resources.CutsceneResourceDesc, + ): + return misc_resources.CutsceneResource( + file, resource_desc.offset, resource_desc.symbol_name + ) + + def scene_resource_handler( + file: File, + resource_desc: z64resources.SceneResourceDesc, + ): + return scene_commands_resource.SceneCommandsResource( + file, resource_desc.offset, resource_desc.symbol_name + ) + + def room_resource_handler( + file: File, + resource_desc: z64resources.RoomResourceDesc, + ): + if "hackmode_syotes_room" in resource_desc.hack_modes: + return room_shape_resources.RoomShapeNormalResource( + file, + resource_desc.offset, + resource_desc.symbol_name, + ) + return scene_commands_resource.SceneCommandsResource( + file, resource_desc.offset, resource_desc.symbol_name + ) + + def path_list_resource_handler( + file: File, + resource_desc: z64resources.PathListResourceDesc, + ): + resource = scene_rooms_resources.PathListResource( + file, resource_desc.offset, resource_desc.symbol_name + ) + resource.set_length(resource_desc.num_paths) + return resource + + def legacy_animation_handler( + file: File, + resource_desc: z64resources.LegacyAnimationResourceDesc, + ): + return skelanime_legacy_resources.LegacyAnimationResource( + file, resource_desc.offset, resource_desc.symbol_name + ) + + RESOURCE_HANDLERS.update( + { + z64resources.SkeletonResourceDesc: skeleton_resource_handler, + z64resources.LimbResourceDesc: limb_resource_handler, + z64resources.AnimationResourceDesc: animation_resource_handler, + z64resources.CollisionResourceDesc: collision_resource_handler, + n64resources.DListResourceDesc: dlist_resource_handler, + n64resources.TextureResourceDesc: texture_resource_handler, + n64resources.CITextureResourceDesc: ci_texture_resource_handler, + z64resources.PlayerAnimationDataResourceDesc: PlayerAnimationData_handler, + n64resources.Vec3sArrayResourceDesc: vec3s_array_resource_handler, + n64resources.S16ArrayResourceDesc: s16_array_resource_handler, + n64resources.VtxArrayResourceDesc: vtx_array_resource_handler, + z64resources.PlayerAnimationResourceDesc: PlayerAnimation_handler, + n64resources.BlobResourceDesc: binary_blob_resource_handler, + n64resources.MtxResourceDesc: Mtx_handler, + z64resources.LegacyAnimationResourceDesc: legacy_animation_handler, + z64resources.LimbTableResourceDesc: limb_table_handler, + z64resources.CurveAnimationResourceDesc: CurveAnimation_handler, + z64resources.SceneResourceDesc: scene_resource_handler, + z64resources.RoomResourceDesc: room_resource_handler, + z64resources.PathListResourceDesc: path_list_resource_handler, + z64resources.CutsceneResourceDesc: cutscene_resource_handler, + } + ) + + +RESOURCE_HANDLERS: dict[str, ResourceHandler] = {} + + +def get_resource_from_desc( + file: File, + resource_desc: ResourceDesc, +) -> Resource: + resource_handler = RESOURCE_HANDLERS.get(type(resource_desc)) + + if resource_handler is None: + raise Exception("Unknown resource descriptor type", resource_desc) + + try: + resource = resource_handler(file, resource_desc) + except ResourceHandlerException: + raise + + return resource diff --git a/tools/assets/n64.py b/tools/assets/n64.py new file mode 100644 index 0000000000..e3ebf70528 --- /dev/null +++ b/tools/assets/n64.py @@ -0,0 +1,53 @@ +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +import enum + + +class G_IM_FMT(enum.Enum): + RGBA = 0 + YUV = 1 + CI = 2 + IA = 3 + I = 4 + + def __init__(self, i: int): + self.i = i + + by_i: dict[int, "G_IM_FMT"] + + +G_IM_FMT.by_i = {fmt.i: fmt for fmt in G_IM_FMT} + + +class G_IM_SIZ(enum.Enum): + _4b = (0, 4) + _8b = (1, 8) + _16b = (2, 16) + _32b = (3, 32) + + def __init__(self, i: int, bpp: int): + self.i = i + self.bpp = bpp + + by_i: dict[int, "G_IM_SIZ"] + + +G_IM_SIZ.by_i = {siz.i: siz for siz in G_IM_SIZ} + + +G_MDSFT_TEXTLUT = 14 + + +class G_TT(enum.Enum): + NONE = 0b00 << G_MDSFT_TEXTLUT + RGBA16 = 0b10 << G_MDSFT_TEXTLUT + IA16 = 0b11 << G_MDSFT_TEXTLUT + + def __init__(self, i: int): + self.i = i + + by_i: dict[int, "G_TT"] + + +G_TT.by_i = {tt.i: tt for tt in G_TT} diff --git a/tools/assets/n64texconv/.clang-format b/tools/assets/n64texconv/.clang-format new file mode 100644 index 0000000000..20dda610d7 --- /dev/null +++ b/tools/assets/n64texconv/.clang-format @@ -0,0 +1,29 @@ +IndentWidth: 4 +Language: Cpp +UseTab: Never +ColumnLimit: 120 +PointerAlignment: Right +BreakBeforeBraces: Linux +AlwaysBreakAfterReturnType: TopLevel +AlignArrayOfStructures: Left +SpaceAfterCStyleCast: false +SpaceBeforeParens: ControlStatementsExceptControlMacros +Cpp11BracedListStyle: false +IndentCaseLabels: true +BinPackArguments: true +BinPackParameters: true +AlignAfterOpenBracket: Align +AlignOperands: true +BreakBeforeTernaryOperators: true +BreakBeforeBinaryOperators: None +AllowShortBlocksOnASingleLine: true +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: false +AllowShortEnumsOnASingleLine: false +AlignEscapedNewlines: Left +AlignTrailingComments: true +SortIncludes: false +AlignConsecutiveMacros: Consecutive +ForEachMacros: ['LL_FOREACH'] diff --git a/tools/assets/n64texconv/.gitignore b/tools/assets/n64texconv/.gitignore new file mode 100644 index 0000000000..084dd7fab5 --- /dev/null +++ b/tools/assets/n64texconv/.gitignore @@ -0,0 +1,10 @@ +build/ + +libn64texconv.a +libn64texconv.dll +libn64texconv.so +n64texconv + +# Tests +*.png +*.bin diff --git a/tools/assets/n64texconv/LICENSE b/tools/assets/n64texconv/LICENSE new file mode 100644 index 0000000000..77c1ae07c8 --- /dev/null +++ b/tools/assets/n64texconv/LICENSE @@ -0,0 +1,627 @@ + +N64 texture converter (n64texconv). + +The library is under the MIT license (see src/LICENSE), but the app +links statically with libimagequant which is under the GPL. + +Copyright (C) 2025 ZeldaRET + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. diff --git a/tools/assets/n64texconv/Makefile b/tools/assets/n64texconv/Makefile new file mode 100644 index 0000000000..fbe0300d77 --- /dev/null +++ b/tools/assets/n64texconv/Makefile @@ -0,0 +1,77 @@ +BUILD_DIR := build + +# Targets +LIB := libn64texconv.a +SOLIB := libn64texconv.so +APP := n64texconv + +INC := -Ilib/spng -Ilib/libimagequant + +CC := gcc + +WFLAGS := -Wall -Wextra -Wshadow + +ifeq ($(shell $(CC) --version | grep clang),) + ARCHFLAGS := -march=native -mtune=native + OMPFLAGS := -fopenmp +else + ARCHFLAGS := + OMPFLAGS := + WFLAGS += -Wno-unknown-pragmas +endif + +CFLAGS := $(WFLAGS) $(ARCHFLAGS) -MD -MMD -std=gnu11 -fPIC -ffunction-sections -fdata-sections $(INC) +OPTFLAGS := -O3 +LDFLAGS := +LDLIBS := $(OMPFLAGS) -lz -lm +AR := ar +ARFLAGS := rcs + +SRC_DIRS := $(shell find src -type d -not -path src/app) +LIB_DIRS := $(shell find lib -type d) +APP_SRC_DIRS := $(shell find src/app -type d) + +C_FILES := $(foreach dir,$(SRC_DIRS) $(LIB_DIRS),$(wildcard $(dir)/*.c)) +O_FILES := $(foreach f,$(C_FILES:.c=.o),$(BUILD_DIR)/$f) +DEP_FILES := $(foreach f,$(O_FILES:.o=.d),$f) + +APP_C_FILES := $(foreach dir,$(APP_SRC_DIRS),$(wildcard $(dir)/*.c)) +APP_O_FILES := $(foreach f,$(APP_C_FILES:.c=.o),$(BUILD_DIR)/$f) +APP_DEP_FILES := $(foreach f,$(APP_O_FILES:.o=.d),$f) + +FMT_C_FILES := $(foreach dir,$(SRC_DIRS) $(APP_SRC_DIRS),$(wildcard $(dir)/*.c)) +FMT_H_FILES := $(foreach dir,$(SRC_DIRS) $(APP_SRC_DIRS),$(wildcard $(dir)/*.h)) +FMT_FILES := $(FMT_C_FILES) $(FMT_H_FILES) + +CLANG_FORMAT := clang-format-14 +FORMAT_ARGS := -i -style=file + +$(shell mkdir -p $(BUILD_DIR) $(foreach dir,$(SRC_DIRS) $(LIB_DIRS) $(APP_SRC_DIRS),$(BUILD_DIR)/$(dir))) + +$(BUILD_DIR)/lib/libimagequant/%.o: CFLAGS += $(OMPFLAGS) -Wno-sign-compare -Wno-unused-parameter -Wno-shadow + +.PHONY: all clean distclean format + +all: $(LIB) $(SOLIB) $(APP) + +clean: + $(RM) -r $(LIB) $(SOLIB) $(APP) $(BUILD_DIR) + +distclean: clean + +format: + $(CLANG_FORMAT) $(FORMAT_ARGS) $(FMT_FILES) + +$(LIB): $(O_FILES) + $(AR) $(ARFLAGS) $@ $^ + +$(SOLIB): $(O_FILES) + $(CC) -shared $^ $(LDLIBS) -o $@ + +$(APP): $(APP_O_FILES) $(LIB) + $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@ + +$(BUILD_DIR)/%.o: %.c + $(CC) $(CFLAGS) $(OPTFLAGS) -c $< -o $@ + +-include $(DEP_FILES) $(APP_DEP_FILES) diff --git a/tools/assets/n64texconv/__init__.py b/tools/assets/n64texconv/__init__.py new file mode 100644 index 0000000000..3952b19c8e --- /dev/null +++ b/tools/assets/n64texconv/__init__.py @@ -0,0 +1,472 @@ +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: MIT + +import os, sys +from ctypes import CDLL, Structure, POINTER, string_at, byref, cast +from ctypes import c_void_p, c_char_p, c_uint8, c_uint, c_bool, c_int, c_size_t +from typing import Optional + +def ctypes_buffer_to_string(buffer) -> str: + return buffer.value.decode('utf-8') + +def ctypes_pointer_to_bytes(ptr : c_void_p, size : int) -> bytes: + return string_at(ptr, size) + +def deref(ptr): + if ptr: + return ptr.contents + return None + +ln64texconv = CDLL(os.path.join(os.path.dirname(__file__), "libn64texconv.so")) + +class RefCounter: + def __init__(self) -> None: + self.ref_counts = {} + + def add_ref(self, ptr): + if not isinstance(ptr, POINTER(N64Palette)): + ptr = cast(ptr, POINTER(N64Palette)) + if not ptr: + return + key = int.from_bytes(ptr, byteorder=sys.byteorder, signed=False) + if key not in self.ref_counts: + self.ref_counts[key] = 1 + else: + self.ref_counts[key] += 1 + + def num_refs(self, ptr): + if not isinstance(ptr, POINTER(N64Palette)): + ptr = cast(ptr, POINTER(N64Palette)) + if not ptr: + return 0 + key = int.from_bytes(ptr, byteorder=sys.byteorder, signed=False) + if key not in self.ref_counts: + return 0 + return self.ref_counts[key] + + def rm_ref(self, ptr, free_func): + if not isinstance(ptr, POINTER(N64Palette)): + ptr = cast(ptr, POINTER(N64Palette)) + if not ptr: + return + key = int.from_bytes(ptr, byteorder=sys.byteorder, signed=False) + assert key in self.ref_counts + count = self.ref_counts.pop(key) + count -= 1 + if count == 0: + free_func(ptr) + else: + self.ref_counts[key] = count + +# Simple reference counter for C allocations +_object_refcount = RefCounter() + +# +# Private +# + +# void n64texconv_free(void *p); +ln64texconv.n64texconv_free.argtypes = [c_void_p] +ln64texconv.n64texconv_free.restype = None + +# +# bin2c.h +# + +def bin2c(data : bytes | memoryview, pad_to_size : int = 0, byte_width : int = 8) -> Optional[str]: + if byte_width not in (1, 2, 4, 8): + raise ValueError("Invalid byte width, must be 1, 2, 4 or 8") + buffer = (c_uint8 * len(data)).from_buffer_copy(data) + ptr = c_char_p(None) + size = c_size_t(0) + if ln64texconv.bin2c(byref(ptr), byref(size), buffer, len(data), pad_to_size, byte_width) != 0: + return None + s = ctypes_buffer_to_string(ptr) + ln64texconv.n64texconv_free(ptr) + return s + +def bin2c_file(out_path : str, data : bytes | memoryview, pad_to_size : int = 0, byte_width : int = 8) -> bool: + if byte_width not in (1, 2, 4, 8): + raise ValueError("Invalid byte width, must be 1, 2, 4 or 8") + buffer = (c_uint8 * len(data)).from_buffer_copy(data) + return ln64texconv.bin2c_file(out_path.encode("utf-8"), buffer, len(data), pad_to_size, byte_width) == 0 + +# int bin2c(char **out, size_t *size_out, void *bin, size_t size, size_t pad_to_size, unsigned int byte_width); +ln64texconv.bin2c.argtypes = [POINTER(c_char_p), POINTER(c_size_t), c_void_p, c_size_t, c_size_t, c_uint] +ln64texconv.bin2c.restype = c_int + +# int bin2c_file(const char *out_path, void *bin, size_t size, size_t pad_to_size, unsigned int byte_width); +ln64texconv.bin2c_file.argtypes = [c_char_p, c_void_p, c_size_t, c_size_t, c_uint] +ln64texconv.bin2c_file.restype = c_int + +# +# jfif.h +# + +# struct JFIF +class JFIF(Structure): + _fields_ = [ + ("data", c_void_p), + ("data_size", c_size_t), + ] + + # JFIF_BUFFER_SIZE + BUFFER_SIZE = 320 * 240 * 2 + + @staticmethod + def fromfile(path : str, max_size : int = BUFFER_SIZE) -> Optional["JFIF"]: + if not os.path.isfile(path): + raise ValueError(f"Cannot open \"{path}\", is not a file") + return deref(ln64texconv.jfif_fromfile(path.encode("utf-8"), max_size)) + + def to_c(self, pad_to_size : int = BUFFER_SIZE) -> Optional[str]: + ptr = c_char_p(None) + size = c_size_t(0) + if ln64texconv.jfif_to_c(byref(ptr), byref(size), byref(self), pad_to_size) != 0: + return None + s = ctypes_buffer_to_string(ptr) + ln64texconv.n64texconv_free(ptr) + return s + + def to_c_file(self, out_path : str, pad_to_size : int = BUFFER_SIZE) -> bool: + return ln64texconv.jfif_to_c_file(out_path.encode("utf-8"), byref(self), pad_to_size) == 0 + + def __del__(self): + ln64texconv.jfif_free(byref(self)) + +# struct JFIF *jfif_fromfile(const char *path, size_t max_size); +ln64texconv.jfif_fromfile.argtypes = [c_char_p, c_size_t] +ln64texconv.jfif_fromfile.restype = POINTER(JFIF) + +# void jfif_free(struct JFIF *jfif); +ln64texconv.jfif_free.argtypes = [POINTER(JFIF)] +ln64texconv.jfif_free.restype = None + +# int jfif_to_c(char **out, size_t *size_out, struct JFIF *jfif, size_t pad_to_size) +ln64texconv.jfif_to_c.argtypes = [POINTER(c_char_p), POINTER(c_size_t), POINTER(JFIF), c_size_t] +ln64texconv.jfif_to_c.restype = c_int + +# int jfif_to_c_file(const char *out_path, struct JFIF *jfif, size_t pad_to_size); +ln64texconv.jfif_to_c_file.argtypes = [c_char_p, POINTER(JFIF), c_size_t] +ln64texconv.jfif_to_c_file.restype = c_int + +# +# n64texconv.h +# + +FMT_NONE = -1 +FMT_MAX = 5 +G_IM_FMT_RGBA = 0 +G_IM_FMT_YUV = 1 +G_IM_FMT_CI = 2 +G_IM_FMT_IA = 3 +G_IM_FMT_I = 4 + +SIZ_NONE = -1 +SIZ_MAX = 4 +G_IM_SIZ_4b = 0 +G_IM_SIZ_8b = 1 +G_IM_SIZ_16b = 2 +G_IM_SIZ_32b = 3 + +def fmt_name(fmt : int): + return { + G_IM_FMT_RGBA : "G_IM_FMT_RGBA", + G_IM_FMT_YUV : "G_IM_FMT_YUV", + G_IM_FMT_CI : "G_IM_FMT_CI", + G_IM_FMT_IA : "G_IM_FMT_IA", + G_IM_FMT_I : "G_IM_FMT_I", + }.get(fmt, str(fmt)) + +def siz_name(siz : int): + return { + G_IM_SIZ_4b : "G_IM_SIZ_4b", + G_IM_SIZ_8b : "G_IM_SIZ_8b", + G_IM_SIZ_16b : "G_IM_SIZ_16b", + G_IM_SIZ_32b : "G_IM_SIZ_32b", + }.get(siz, str(siz)) + +VALID_FORMAT_COMBINATIONS = ( + (G_IM_FMT_RGBA, G_IM_SIZ_16b), + (G_IM_FMT_RGBA, G_IM_SIZ_32b), + (G_IM_FMT_CI, G_IM_SIZ_4b), + (G_IM_FMT_CI, G_IM_SIZ_8b), + (G_IM_FMT_IA, G_IM_SIZ_4b), + (G_IM_FMT_IA, G_IM_SIZ_8b), + (G_IM_FMT_IA, G_IM_SIZ_16b), + (G_IM_FMT_I, G_IM_SIZ_4b), + (G_IM_FMT_I, G_IM_SIZ_8b), +) + +# struct color +class Color(Structure): + _fields_ = [ + ("r", c_uint8), + ("g", c_uint8), + ("b", c_uint8), + ("a", c_uint8), + ] + +# static inline size_t texel_size_bytes(size_t ntexels, int siz) +def texel_size_bytes(ntexels : int, siz : int): + return (ntexels // 2) if (siz == G_IM_SIZ_4b) else (ntexels * ((1 << siz) >> 1)) + +# struct n64_palette +class N64Palette(Structure): + _fields_ = [ + ("texels", POINTER(Color)), + ("fmt", c_int), + ("count", c_size_t), + ] + + @staticmethod + def new(count : int, fmt : int) -> Optional["N64Palette"]: + if fmt not in (G_IM_FMT_RGBA, G_IM_FMT_IA): + raise ValueError("Palette format must be either G_IM_FMT_RGBA or G_IM_FMT_IA") + if count > 256: + raise ValueError("The largest possible palette size is 256") + pal = ln64texconv.n64texconv_palette_new(count, fmt) + _object_refcount.add_ref(pal) + return deref(pal) + + def __del__(self): + # Free the underlying palette structure only if the refcount is 0 + _object_refcount.rm_ref(byref(self), ln64texconv.n64texconv_palette_free) + + def copy(self) -> Optional["N64Palette"]: + pal = ln64texconv.n64texconv_palette_copy(byref(self)) + _object_refcount.add_ref(pal) + return deref(pal) + + def reformat(self, fmt : int) -> Optional["N64Palette"]: + if fmt not in (G_IM_FMT_RGBA, G_IM_FMT_IA): + raise ValueError("Palette format must be either G_IM_FMT_RGBA or G_IM_FMT_IA") + pal = ln64texconv.n64texconv_palette_reformat(byref(self), fmt) + _object_refcount.add_ref(pal) + return deref(pal) + + @staticmethod + def from_png(path : str, fmt : int) -> Optional["N64Palette"]: + if fmt not in (G_IM_FMT_RGBA, G_IM_FMT_IA): + raise ValueError("Palette format must be either G_IM_FMT_RGBA or G_IM_FMT_IA") + if not os.path.isfile(path): + raise ValueError(f"Cannot open \"{path}\", is not a file") + pal = ln64texconv.n64texconv_palette_from_png(path.encode("utf-8"), fmt) + _object_refcount.add_ref(pal) + return deref(pal) + + @staticmethod + def from_bin(data : bytes | memoryview, fmt : int) -> Optional["N64Palette"]: + if fmt not in (G_IM_FMT_RGBA, G_IM_FMT_IA): + raise ValueError("Palette format must be either G_IM_FMT_RGBA or G_IM_FMT_IA") + buffer = (c_uint8 * len(data)).from_buffer_copy(data) + pal = ln64texconv.n64texconv_palette_from_bin(buffer, len(data) // 2, fmt) + _object_refcount.add_ref(pal) + return deref(pal) + + def to_png(self, outpath : str) -> bool: + return ln64texconv.n64texconv_palette_to_png(outpath.encode("utf-8"), byref(self)) == 0 + + def to_bin(self, pad_to_8b : bool) -> Optional[bytes]: + nbytes = texel_size_bytes(self.count, G_IM_SIZ_16b) + if pad_to_8b: + nbytes = (nbytes + 7) & ~7 + ptr = ln64texconv.n64texconv_palette_to_bin(byref(self), pad_to_8b) + if not ptr: + return None + data = ctypes_pointer_to_bytes(ptr, nbytes) + ln64texconv.n64texconv_free(ptr) + return data + + def to_c(self, pad_to_8b : bool, byte_width : int) -> Optional[str]: + ptr = c_char_p(None) + size = c_size_t(0) + if ln64texconv.n64texconv_palette_to_c(byref(ptr), byref(size), byref(self), pad_to_8b, byte_width) != 0: + return None + s = ctypes_buffer_to_string(ptr) + ln64texconv.n64texconv_free(ptr) + return s + + def to_c_file(self, out_path : str, pad_to_8b : bool, byte_width : int) -> bool: + return ln64texconv.n64texconv_palette_to_c_file(out_path.encode("utf-8"), byref(self), pad_to_8b, byte_width) == 0 + +# struct n64_palette *n64texconv_palette_new(size_t count, int fmt); +ln64texconv.n64texconv_palette_new.argtypes = [c_size_t, c_int] +ln64texconv.n64texconv_palette_new.restype = POINTER(N64Palette) + +# void n64texconv_palette_free(struct n64_palette *pal); +ln64texconv.n64texconv_palette_free.argtypes = [POINTER(N64Palette)] +ln64texconv.n64texconv_palette_free.restype = None + +# struct n64_palette *n64texconv_palette_copy(struct n64_palette *pal); +ln64texconv.n64texconv_palette_copy.argtypes = [POINTER(N64Palette)] +ln64texconv.n64texconv_palette_copy.restype = POINTER(N64Palette) + +# struct n64_palette *n64texconv_palette_reformat(struct n64_palette *pal, int fmt); +ln64texconv.n64texconv_palette_reformat.argtypes = [POINTER(N64Palette), c_int] +ln64texconv.n64texconv_palette_reformat.restype = POINTER(N64Palette) + +# struct n64_palette *n64texconv_palette_from_png(const char *path, int fmt); +ln64texconv.n64texconv_palette_from_png.argtypes = [c_char_p, c_int] +ln64texconv.n64texconv_palette_from_png.restype = POINTER(N64Palette) + +# struct n64_palette *n64texconv_palette_from_bin(void *data, size_t count, int fmt); +ln64texconv.n64texconv_palette_from_bin.argtypes = [c_void_p, c_size_t, c_int] +ln64texconv.n64texconv_palette_from_bin.restype = POINTER(N64Palette) + +# int n64texconv_palette_to_png(const char *outpath, struct n64_palette *pal); +ln64texconv.n64texconv_palette_to_png.argtypes = [c_char_p, POINTER(N64Palette)] +ln64texconv.n64texconv_palette_to_png.restype = c_int + +# void *n64texconv_palette_to_bin(struct n64_palette *pal, bool pad_to_8b); +ln64texconv.n64texconv_palette_to_bin.argtypes = [POINTER(N64Palette), c_bool] +ln64texconv.n64texconv_palette_to_bin.restype = c_void_p + +# int n64texconv_palette_to_c(char **out, size_t *size_out, struct n64_palette *pal, bool pad_to_8b, unsigned int byte_width); +ln64texconv.n64texconv_palette_to_c.argtypes = [POINTER(c_char_p), POINTER(c_size_t), POINTER(N64Palette), c_bool, c_uint] +ln64texconv.n64texconv_palette_to_c.restype = c_int + +# int n64texconv_palette_to_c_file(const char *out_path, struct n64_palette *pal, bool pad_to_8b, unsigned int byte_width); +ln64texconv.n64texconv_palette_to_c_file.argtypes = [c_char_p, POINTER(N64Palette), c_bool, c_uint] +ln64texconv.n64texconv_palette_to_c_file.restype = c_int + +# struct n64_image +class N64Image(Structure): + _fields_ = [ + ("width", c_size_t), + ("height", c_size_t), + ("fmt", c_int), + ("siz", c_int), + ("pal", POINTER(N64Palette)), + ("texels", POINTER(Color)), + ("color_indices", POINTER(c_uint8)), + ] + + def get_palette(self) -> Optional[N64Palette]: + return deref(self.pal) + + @staticmethod + def new(width : int, height : int, fmt : int, siz : int, pal : N64Palette = None) -> Optional["N64Image"]: + if not any((fmt, siz) == fmtsiz for fmtsiz in VALID_FORMAT_COMBINATIONS): + raise ValueError(f"Invalid fmt/siz combination ({fmt_name(fmt)}, {siz_name(siz)})") + if pal is not None: + _object_refcount.add_ref(byref(pal)) + return deref(ln64texconv.n64texconv_image_new(width, height, fmt, siz, pal)) + + def __del__(self): + # Also free the palette if the reference count drops to 0 + _object_refcount.rm_ref(self.pal, ln64texconv.n64texconv_palette_free) + ln64texconv.n64texconv_image_free(byref(self)) + + def copy(self) -> Optional["N64Image"]: + _object_refcount.add_ref(self.pal) + return deref(ln64texconv.n64texconv_image_copy(byref(self))) + + @staticmethod + def from_png(path : str, fmt : int, siz : int, pal_fmt : int = FMT_NONE) -> Optional["N64Image"]: + if not os.path.isfile(path): + raise ValueError(f"Cannot open \"{path}\", is not a file") + if not any((fmt, siz) == fmtsiz for fmtsiz in VALID_FORMAT_COMBINATIONS): + raise ValueError(f"Invalid fmt/siz combination ({fmt_name(fmt)}, {siz_name(siz)})") + if fmt == G_IM_FMT_CI and pal_fmt not in (G_IM_FMT_RGBA, G_IM_FMT_IA): + raise ValueError(f"Invalid palette format {fmt_name(pal_fmt)}, must be either G_IM_FMT_RGBA or G_IM_FMT_IA") + img = deref(ln64texconv.n64texconv_image_from_png(path.encode("utf-8"), fmt, siz, pal_fmt)) + _object_refcount.add_ref(img.pal) + return img + + @staticmethod + def from_bin(data : bytes | memoryview, width : int, height : int, fmt : int, siz : int, pal : Optional[N64Palette] = None, + preswapped : bool = False) -> Optional["N64Image"]: + if not any((fmt, siz) == fmtsiz for fmtsiz in VALID_FORMAT_COMBINATIONS): + raise ValueError(f"Invalid fmt/siz combination ({fmt_name(fmt)}, {siz_name(siz)})") + expected_size = texel_size_bytes(width * height, siz) + if len(data) < expected_size: + raise ValueError(f"Not enough data to extract the specified image. " + + f"Expected at least 0x{expected_size:X} bytes but only got 0x{len(data):X} bytes") + buffer = (c_uint8 * len(data)).from_buffer_copy(data) + if pal: + pal = byref(pal) + _object_refcount.add_ref(pal) + img = ln64texconv.n64texconv_image_from_bin(buffer, width, height, fmt, siz, pal, preswapped) + return deref(img) + + def reformat(self, fmt : int, siz : int, pal : Optional[N64Palette] = None) -> Optional["N64Image"]: + if not any((fmt, siz) == fmtsiz for fmtsiz in VALID_FORMAT_COMBINATIONS): + raise ValueError(f"Invalid fmt/siz combination ({fmt_name(fmt)}, {siz_name(siz)})") + if pal: + pal = byref(pal) + _object_refcount.add_ref(pal) + return deref(ln64texconv.n64texconv_image_reformat(byref(self), fmt, siz, pal)) + + def to_png(self, outpath : str, intensity_alpha : bool) -> bool: + return ln64texconv.n64texconv_image_to_png(outpath.encode("utf-8"), byref(self), intensity_alpha) == 0 + + def to_bin(self, pad_to_8b : bool, preswap : bool) -> Optional[bytes]: + nbytes = texel_size_bytes(self.width * self.height, self.siz) + if pad_to_8b: + nbytes = (nbytes + 7) & ~7 + ptr = ln64texconv.n64texconv_image_to_bin(byref(self), pad_to_8b, preswap) + if not ptr: + return None + data = ctypes_pointer_to_bytes(ptr, nbytes) + ln64texconv.n64texconv_free(ptr) + return data + + def to_c(self, pad_to_8b : bool, preswap : bool, byte_width : int) -> Optional[str]: + ptr = c_char_p(None) + size = c_size_t(0) + if ln64texconv.n64texconv_image_to_c(byref(ptr), byref(size), byref(self), pad_to_8b, preswap, byte_width) != 0: + return None + s = ctypes_buffer_to_string(ptr) + ln64texconv.n64texconv_free(ptr) + return s + + def to_c_file(self, out_path : str, pad_to_8b : bool, preswap : bool, byte_width : int) -> bool: + return ln64texconv.n64texconv_image_to_c_file(out_path.encode("utf-8"), byref(self), pad_to_8b, preswap, byte_width) == 0 + + def png_extension(self) -> str: + return ln64texconv.n64texconv_png_extension(byref(self)).decode("utf-8") + +# struct n64_image *n64texconv_image_new(size_t width, size_t height, int fmt, int siz, struct n64_palette *pal); +ln64texconv.n64texconv_image_new.argtypes = [c_size_t, c_size_t, c_int, c_int, POINTER(N64Palette)] +ln64texconv.n64texconv_image_new.restype = POINTER(N64Image) + +# void n64texconv_image_free(struct n64_image *img); +ln64texconv.n64texconv_image_free.argtypes = [POINTER(N64Image)] +ln64texconv.n64texconv_image_free.restype = None + +# struct n64_image *n64texconv_image_copy(struct n64_image *img); +ln64texconv.n64texconv_image_copy.argtypes = [POINTER(N64Image)] +ln64texconv.n64texconv_image_copy.restype = POINTER(N64Image) + +# struct n64_image *n64texconv_image_from_png(const char *path, int fmt, int siz, int pal_fmt); +ln64texconv.n64texconv_image_from_png.argtypes = [c_char_p, c_int, c_int, c_int] +ln64texconv.n64texconv_image_from_png.restype = POINTER(N64Image) + +# struct n64_image *n64texconv_image_from_bin(void *data, size_t width, size_t height, int fmt, int siz, struct n64_palette *pal, bool preswapped); +ln64texconv.n64texconv_image_from_bin.argtypes = [c_void_p, c_size_t, c_size_t, c_int, c_int, POINTER(N64Palette), c_bool] +ln64texconv.n64texconv_image_from_bin.restype = POINTER(N64Image) + +# struct n64_image *n64texconv_image_reformat(struct n64_image *img, int fmt, int siz, struct n64_palette *pal); +ln64texconv.n64texconv_image_reformat.argtypes = [POINTER(N64Image), c_int, c_int, POINTER(N64Palette)] +ln64texconv.n64texconv_image_reformat.restype = POINTER(N64Image) + +# int n64texconv_image_to_png(const char *outpath, struct n64_image *img, bool intensity_alpha); +ln64texconv.n64texconv_image_to_png.argtypes = [c_char_p, POINTER(N64Image), c_bool] +ln64texconv.n64texconv_image_to_png.restype = c_int + +# void *n64texconv_image_to_bin(struct n64_image *img, bool pad_to_8b, bool preswap); +ln64texconv.n64texconv_image_to_bin.argtypes = [POINTER(N64Image), c_bool, c_bool] +ln64texconv.n64texconv_image_to_bin.restype = c_void_p + +# int n64texconv_image_to_c(char **out, size_t *size_out, struct n64_image *img, bool pad_to_8b, bool preswap, unsigned int byte_width); +ln64texconv.n64texconv_image_to_c.argtypes = [POINTER(c_char_p), POINTER(c_size_t), POINTER(N64Image), c_bool, c_bool, c_uint] +ln64texconv.n64texconv_image_to_c.restype = c_int + +# int n64texconv_image_to_c_file(const char *out_path, struct n64_image *img, bool pad_to_8b, bool preswap, unsigned int byte_width); +ln64texconv.n64texconv_image_to_c_file.argtypes = [c_char_p, POINTER(N64Image), c_bool, c_bool, c_uint] +ln64texconv.n64texconv_image_to_c_file.restype = c_int + +# const char *n64texconv_png_extension(struct n64_image *img); +ln64texconv.n64texconv_png_extension.argtypes = [POINTER(N64Image)] +ln64texconv.n64texconv_png_extension.restype = c_char_p diff --git a/tools/assets/n64texconv/lib/libimagequant/COPYRIGHT b/tools/assets/n64texconv/lib/libimagequant/COPYRIGHT new file mode 100644 index 0000000000..4297b943e7 --- /dev/null +++ b/tools/assets/n64texconv/lib/libimagequant/COPYRIGHT @@ -0,0 +1,641 @@ + +libimagequant is derived from code by Jef Poskanzer and Greg Roelofs +licensed under pngquant's original license (at the end of this file), +and contains extensive changes and additions by Kornel Lesiński +licensed under GPL v3 or later. + +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +libimagequant © 2009-2018 by Kornel Lesiński. + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + +- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +© 1989, 1991 by Jef Poskanzer. +© 1997, 2000, 2002 by Greg Roelofs. + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided +that the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. This software is provided "as is" without express or +implied warranty. diff --git a/tools/assets/n64texconv/lib/libimagequant/blur.c b/tools/assets/n64texconv/lib/libimagequant/blur.c new file mode 100644 index 0000000000..7f0a71672c --- /dev/null +++ b/tools/assets/n64texconv/lib/libimagequant/blur.c @@ -0,0 +1,132 @@ +/* +© 2011-2015 by Kornel Lesiński. + +This file is part of libimagequant. + +libimagequant is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +libimagequant is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with libimagequant. If not, see . +*/ + +#include "libimagequant.h" +#include "pam.h" +#include "blur.h" + +/* + Blurs image horizontally (width 2*size+1) and writes it transposed to dst (called twice gives 2d blur) + */ +static void transposing_1d_blur(unsigned char *restrict src, unsigned char *restrict dst, unsigned int width, unsigned int height, const unsigned int size) +{ + assert(size > 0); + + for(unsigned int j=0; j < height; j++) { + unsigned char *restrict row = src + j*width; + + // accumulate sum for pixels outside line + unsigned int sum; + sum = row[0]*size; + for(unsigned int i=0; i < size; i++) { + sum += row[i]; + } + + // blur with left side outside line + for(unsigned int i=0; i < size; i++) { + sum -= row[0]; + sum += row[i+size]; + + dst[i*height + j] = sum / (size*2); + } + + for(unsigned int i=size; i < width-size; i++) { + sum -= row[i-size]; + sum += row[i+size]; + + dst[i*height + j] = sum / (size*2); + } + + // blur with right side outside line + for(unsigned int i=width-size; i < width; i++) { + sum -= row[i-size]; + sum += row[width-1]; + + dst[i*height + j] = sum / (size*2); + } + } +} + +/** + * Picks maximum of neighboring pixels (blur + lighten) + */ +LIQ_PRIVATE void liq_max3(unsigned char *src, unsigned char *dst, unsigned int width, unsigned int height) +{ + for(unsigned int j=0; j < height; j++) { + const unsigned char *row = src + j*width, + *prevrow = src + (j > 1 ? j-1 : 0)*width, + *nextrow = src + MIN(height-1,j+1)*width; + + unsigned char prev,curr=row[0],next=row[0]; + + for(unsigned int i=0; i < width-1; i++) { + prev=curr; + curr=next; + next=row[i+1]; + + unsigned char t1 = MAX(prev,next); + unsigned char t2 = MAX(nextrow[i],prevrow[i]); + *dst++ = MAX(curr,MAX(t1,t2)); + } + unsigned char t1 = MAX(curr,next); + unsigned char t2 = MAX(nextrow[width-1],prevrow[width-1]); + *dst++ = MAX(t1,t2); + } +} + +/** + * Picks minimum of neighboring pixels (blur + darken) + */ +LIQ_PRIVATE void liq_min3(unsigned char *src, unsigned char *dst, unsigned int width, unsigned int height) +{ + for(unsigned int j=0; j < height; j++) { + const unsigned char *row = src + j*width, + *prevrow = src + (j > 1 ? j-1 : 0)*width, + *nextrow = src + MIN(height-1,j+1)*width; + + unsigned char prev,curr=row[0],next=row[0]; + + for(unsigned int i=0; i < width-1; i++) { + prev=curr; + curr=next; + next=row[i+1]; + + unsigned char t1 = MIN(prev,next); + unsigned char t2 = MIN(nextrow[i],prevrow[i]); + *dst++ = MIN(curr,MIN(t1,t2)); + } + unsigned char t1 = MIN(curr,next); + unsigned char t2 = MIN(nextrow[width-1],prevrow[width-1]); + *dst++ = MIN(t1,t2); + } +} + +/* + Filters src image and saves it to dst, overwriting tmp in the process. + Image must be width*height pixels high. Size controls radius of box blur. + */ +LIQ_PRIVATE void liq_blur(unsigned char *src, unsigned char *tmp, unsigned char *dst, unsigned int width, unsigned int height, unsigned int size) +{ + assert(size > 0); + if (width < 2*size+1 || height < 2*size+1) { + return; + } + transposing_1d_blur(src, tmp, width, height, size); + transposing_1d_blur(tmp, dst, height, width, size); +} diff --git a/tools/assets/n64texconv/lib/libimagequant/blur.h b/tools/assets/n64texconv/lib/libimagequant/blur.h new file mode 100644 index 0000000000..1e7781920b --- /dev/null +++ b/tools/assets/n64texconv/lib/libimagequant/blur.h @@ -0,0 +1,8 @@ +#ifndef BLUR_H +#define BLUR_H + +LIQ_PRIVATE void liq_blur(unsigned char *src, unsigned char *tmp, unsigned char *dst, unsigned int width, unsigned int height, unsigned int size); +LIQ_PRIVATE void liq_max3(unsigned char *src, unsigned char *dst, unsigned int width, unsigned int height); +LIQ_PRIVATE void liq_min3(unsigned char *src, unsigned char *dst, unsigned int width, unsigned int height); + +#endif diff --git a/tools/assets/n64texconv/lib/libimagequant/kmeans.c b/tools/assets/n64texconv/lib/libimagequant/kmeans.c new file mode 100644 index 0000000000..6d1a122879 --- /dev/null +++ b/tools/assets/n64texconv/lib/libimagequant/kmeans.c @@ -0,0 +1,119 @@ +/* +** © 2011-2016 by Kornel Lesiński. +** See COPYRIGHT file for license. +*/ + +#include "libimagequant.h" +#include "pam.h" +#include "kmeans.h" +#include "nearest.h" +#include +#include + +#ifdef _OPENMP +#include +#else +#define omp_get_max_threads() 1 +#define omp_get_thread_num() 0 +#endif + +/* + * K-Means iteration: new palette color is computed from weighted average of colors that map to that palette entry. + */ +LIQ_PRIVATE void kmeans_init(const colormap *map, const unsigned int max_threads, kmeans_state average_color[]) +{ + memset(average_color, 0, sizeof(average_color[0])*(KMEANS_CACHE_LINE_GAP+map->colors)*max_threads); +} + +LIQ_PRIVATE void kmeans_update_color(const f_pixel acolor, const float value, const colormap *map, unsigned int match, const unsigned int thread, kmeans_state average_color[]) +{ + match += thread * (KMEANS_CACHE_LINE_GAP+map->colors); + average_color[match].a += acolor.a * value; + average_color[match].r += acolor.r * value; + average_color[match].g += acolor.g * value; + average_color[match].b += acolor.b * value; + average_color[match].total += value; +} + +LIQ_PRIVATE void kmeans_finalize(colormap *map, const unsigned int max_threads, const kmeans_state average_color[]) +{ + for (unsigned int i=0; i < map->colors; i++) { + double a=0, r=0, g=0, b=0, total=0; + + // Aggregate results from all threads + for(unsigned int t=0; t < max_threads; t++) { + const unsigned int offset = (KMEANS_CACHE_LINE_GAP+map->colors) * t + i; + + a += average_color[offset].a; + r += average_color[offset].r; + g += average_color[offset].g; + b += average_color[offset].b; + total += average_color[offset].total; + } + + if (!map->palette[i].fixed) { + map->palette[i].popularity = total; + if (total) { + map->palette[i].acolor = (f_pixel){ + .a = a / total, + .r = r / total, + .g = g / total, + .b = b / total, + }; + } else { + // if a color is useless, make a new one + // (it was supposed to be random, but Android NDK has problematic stdlib headers) + map->palette[i].acolor.a = map->palette[(i+1)%map->colors].acolor.a; + map->palette[i].acolor.r = map->palette[(i+2)%map->colors].acolor.r; + map->palette[i].acolor.g = map->palette[(i+3)%map->colors].acolor.g; + map->palette[i].acolor.b = map->palette[(i+4)%map->colors].acolor.b; + } + } + } +} + +LIQ_PRIVATE double kmeans_do_iteration(histogram *hist, colormap *const map, kmeans_callback callback, unsigned int max_threads) +{ + LIQ_ARRAY(kmeans_state, average_color, (KMEANS_CACHE_LINE_GAP+map->colors) * max_threads); + kmeans_init(map, max_threads, average_color); + struct nearest_map *const n = nearest_init(map); + hist_item *const achv = hist->achv; + const int hist_size = hist->size; + + double total_diff=0; +#if __GNUC__ >= 9 || __clang__ + #pragma omp parallel for if (hist_size > 2000) \ + schedule(static) default(none) shared(achv,average_color,callback,hist_size,map,n) reduction(+:total_diff) +#else + #pragma omp parallel for if (hist_size > 2000) \ + schedule(static) default(none) shared(average_color,callback) reduction(+:total_diff) +#endif + for(int j=0; j < hist_size; j++) { + float diff; + const f_pixel px = achv[j].acolor; + const unsigned int match = nearest_search(n, &px, achv[j].tmp.likely_colormap_index, &diff); + achv[j].tmp.likely_colormap_index = match; + + if (callback) { + // Check how average diff would look like if there was dithering + const f_pixel remapped = map->palette[match].acolor; + nearest_search(n, &(f_pixel){ + .a = px.a + px.a - remapped.a, + .r = px.r + px.r - remapped.r, + .g = px.g + px.g - remapped.g, + .b = px.b + px.b - remapped.b, + }, match, &diff); + + callback(&achv[j], diff); + } + + total_diff += diff * achv[j].perceptual_weight; + + kmeans_update_color(px, achv[j].adjusted_weight, map, match, omp_get_thread_num(), average_color); + } + + nearest_free(n); + kmeans_finalize(map, max_threads, average_color); + + return total_diff / hist->total_perceptual_weight; +} diff --git a/tools/assets/n64texconv/lib/libimagequant/kmeans.h b/tools/assets/n64texconv/lib/libimagequant/kmeans.h new file mode 100644 index 0000000000..78db4ccde4 --- /dev/null +++ b/tools/assets/n64texconv/lib/libimagequant/kmeans.h @@ -0,0 +1,18 @@ +#ifndef KMEANS_H +#define KMEANS_H + +// Spread memory touched by different threads at least 64B apart which I assume is the cache line size. This should avoid memory write contention. +#define KMEANS_CACHE_LINE_GAP ((64+sizeof(kmeans_state)-1)/sizeof(kmeans_state)) + +typedef struct { + double a, r, g, b, total; +} kmeans_state; + +typedef void (*kmeans_callback)(hist_item *item, float diff); + +LIQ_PRIVATE void kmeans_init(const colormap *map, const unsigned int max_threads, kmeans_state state[]); +LIQ_PRIVATE void kmeans_update_color(const f_pixel acolor, const float value, const colormap *map, unsigned int match, const unsigned int thread, kmeans_state average_color[]); +LIQ_PRIVATE void kmeans_finalize(colormap *map, const unsigned int max_threads, const kmeans_state state[]); +LIQ_PRIVATE double kmeans_do_iteration(histogram *hist, colormap *const map, kmeans_callback callback, const unsigned int max_threads); + +#endif diff --git a/tools/assets/n64texconv/lib/libimagequant/libimagequant.c b/tools/assets/n64texconv/lib/libimagequant/libimagequant.c new file mode 100644 index 0000000000..632c242771 --- /dev/null +++ b/tools/assets/n64texconv/lib/libimagequant/libimagequant.c @@ -0,0 +1,1814 @@ +/* +** © 2009-2018 by Kornel Lesiński. +** © 1989, 1991 by Jef Poskanzer. +** © 1997, 2000, 2002 by Greg Roelofs; based on an idea by Stefan Schneider. +** +** See COPYRIGHT file for license. +*/ + +#include +#include +#include +#include +#include +#include +#include + +#if !(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199900L) && !(defined(_MSC_VER) && _MSC_VER >= 1800) +#error "This program requires C99, e.g. -std=c99 switch in GCC or it requires MSVC 18.0 or higher." +#error "Ignore torrent of syntax errors that may follow. It's only because compiler is set to use too old C version." +#endif + +#include "libimagequant.h" + +#include "pam.h" +#include "libimagequant_private.h" +#include "mediancut.h" +#include "blur.h" +#include "kmeans.h" +#include "remap.h" + +#define LIQ_HIGH_MEMORY_LIMIT (1<<26) /* avoid allocating buffers larger than 64MB */ + +// each structure has a pointer as a unique identifier that allows type checking at run time +static const char liq_attr_magic[] = "liq_attr"; +static const char liq_image_magic[] = "liq_image"; +static const char liq_result_magic[] = "liq_result"; +static const char liq_histogram_magic[] = "liq_histogram"; +static const char liq_remapping_result_magic[] = "liq_remapping_result"; +static const char liq_freed_magic[] = "free"; +#define CHECK_STRUCT_TYPE(attr, kind) liq_crash_if_invalid_handle_pointer_given((const liq_attr*)attr, kind ## _magic) +#define CHECK_USER_POINTER(ptr) liq_crash_if_invalid_pointer_given(ptr) + +struct liq_attr { + const char *magic_header; + void* (*malloc)(size_t); + void (*free)(void*); + + double target_mse, max_mse, kmeans_iteration_limit; + unsigned int max_colors, max_histogram_entries; + unsigned int min_posterization_output /* user setting */, min_posterization_input /* speed setting */; + unsigned int kmeans_iterations, feedback_loop_trials; + bool last_index_transparent, use_contrast_maps; + unsigned char use_dither_map; + unsigned char speed; + + unsigned char progress_stage1, progress_stage2, progress_stage3; + liq_progress_callback_function *progress_callback; + void *progress_callback_user_info; + + liq_log_callback_function *log_callback; + void *log_callback_user_info; + liq_log_flush_callback_function *log_flush_callback; + void *log_flush_callback_user_info; +}; + +struct liq_result { + const char *magic_header; + void* (*malloc)(size_t); + void (*free)(void*); + + liq_remapping_result *remapping; + colormap *palette; + liq_progress_callback_function *progress_callback; + void *progress_callback_user_info; + + liq_palette int_palette; + float dither_level; + double gamma, palette_error; + int min_posterization_output; + unsigned char use_dither_map; +}; + +struct liq_histogram { + const char *magic_header; + void* (*malloc)(size_t); + void (*free)(void*); + + struct acolorhash_table *acht; + double gamma; + f_pixel fixed_colors[256]; + unsigned short fixed_colors_count; + unsigned short ignorebits; + bool had_image_added; +}; + +static void contrast_maps(liq_image *image) LIQ_NONNULL; +static liq_error finalize_histogram(liq_histogram *input_hist, liq_attr *options, histogram **hist_output) LIQ_NONNULL; +static const liq_color *liq_image_get_row_rgba(liq_image *input_image, unsigned int row) LIQ_NONNULL; +static void liq_remapping_result_destroy(liq_remapping_result *result) LIQ_NONNULL; +static liq_error pngquant_quantize(histogram *hist, const liq_attr *options, const int fixed_colors_count, const f_pixel fixed_colors[], const double gamma, bool fixed_result_colors, liq_result **) LIQ_NONNULL; +static liq_error liq_histogram_quantize_internal(liq_histogram *input_hist, liq_attr *attr, bool fixed_result_colors, liq_result **result_output) LIQ_NONNULL; + +LIQ_NONNULL static void liq_verbose_printf(const liq_attr *context, const char *fmt, ...) +{ + if (context->log_callback) { + va_list va; + va_start(va, fmt); + int required_space = vsnprintf(NULL, 0, fmt, va)+1; // +\0 + va_end(va); + + LIQ_ARRAY(char, buf, required_space); + va_start(va, fmt); + vsnprintf(buf, required_space, fmt, va); + va_end(va); + + context->log_callback(context, buf, context->log_callback_user_info); + } +} + +LIQ_NONNULL inline static void verbose_print(const liq_attr *attr, const char *msg) +{ + if (attr->log_callback) { + attr->log_callback(attr, msg, attr->log_callback_user_info); + } +} + +LIQ_NONNULL static void liq_verbose_printf_flush(liq_attr *attr) +{ + if (attr->log_flush_callback) { + attr->log_flush_callback(attr, attr->log_flush_callback_user_info); + } +} + +LIQ_NONNULL static bool liq_progress(const liq_attr *attr, const float percent) +{ + return attr->progress_callback && !attr->progress_callback(percent, attr->progress_callback_user_info); +} + +LIQ_PRIVATE LIQ_NONNULL bool liq_remap_progress(const liq_remapping_result *quant, const float percent) +{ + return quant->progress_callback && !quant->progress_callback(percent, quant->progress_callback_user_info); +} + +#if USE_SSE +inline static bool is_sse_available() +{ +#if (defined(__x86_64__) || defined(__amd64) || defined(_WIN64)) + return true; +#elif _MSC_VER + int info[4]; + __cpuid(info, 1); + /* bool is implemented as a built-in type of size 1 in MSVC */ + return info[3] & (1<<26) ? true : false; +#else + int a,b,c,d; + cpuid(1, a, b, c, d); + return d & (1<<25); // edx bit 25 is set when SSE is present +#endif +} +#endif + +/* make it clear in backtrace when user-supplied handle points to invalid memory */ +NEVER_INLINE LIQ_EXPORT bool liq_crash_if_invalid_handle_pointer_given(const liq_attr *user_supplied_pointer, const char *const expected_magic_header); +LIQ_EXPORT bool liq_crash_if_invalid_handle_pointer_given(const liq_attr *user_supplied_pointer, const char *const expected_magic_header) +{ + if (!user_supplied_pointer) { + return false; + } + + if (user_supplied_pointer->magic_header == liq_freed_magic) { + fprintf(stderr, "%s used after being freed", expected_magic_header); + // this is not normal error handling, this is programmer error that should crash the program. + // program cannot safely continue if memory has been used after it's been freed. + // abort() is nasty, but security vulnerability may be worse. + abort(); + } + + return user_supplied_pointer->magic_header == expected_magic_header; +} + +NEVER_INLINE LIQ_EXPORT bool liq_crash_if_invalid_pointer_given(const void *pointer); +LIQ_EXPORT bool liq_crash_if_invalid_pointer_given(const void *pointer) +{ + if (!pointer) { + return false; + } + // Force a read from the given (potentially invalid) memory location in order to check early whether this crashes the program or not. + // It doesn't matter what value is read, the code here is just to shut the compiler up about unused read. + char test_access = *((volatile char *)pointer); + return test_access || true; +} + +LIQ_NONNULL static void liq_log_error(const liq_attr *attr, const char *msg) +{ + if (!CHECK_STRUCT_TYPE(attr, liq_attr)) return; + liq_verbose_printf(attr, " error: %s", msg); +} + +static double quality_to_mse(long quality) +{ + if (quality == 0) { + return MAX_DIFF; + } + if (quality == 100) { + return 0; + } + + // curve fudged to be roughly similar to quality of libjpeg + // except lowest 10 for really low number of colors + const double extra_low_quality_fudge = MAX(0,0.016/(0.001+quality) - 0.001); + // LIQ_WEIGHT_MSE is a fudge factor - reminder that colors are not in 0..1 range any more + return LIQ_WEIGHT_MSE * (extra_low_quality_fudge + 2.5/pow(210.0 + quality, 1.2) * (100.1-quality)/100.0); +} + +static unsigned int mse_to_quality(double mse) +{ + for(int i=100; i > 0; i--) { + if (mse <= quality_to_mse(i) + 0.000001) { // + epsilon for floating point errors + return i; + } + } + return 0; +} + +/** internally MSE is a sum of all channels with pixels 0..1 range, + but other software gives per-RGB-channel MSE for 0..255 range */ +static double mse_to_standard_mse(double mse) { + return (mse * 65536.0/6.0) / LIQ_WEIGHT_MSE; +} + +LIQ_EXPORT LIQ_NONNULL liq_error liq_set_quality(liq_attr* attr, int minimum, int target) +{ + if (!CHECK_STRUCT_TYPE(attr, liq_attr)) return LIQ_INVALID_POINTER; + if (target < 0 || target > 100 || target < minimum || minimum < 0) return LIQ_VALUE_OUT_OF_RANGE; + + attr->target_mse = quality_to_mse(target); + attr->max_mse = quality_to_mse(minimum); + return LIQ_OK; +} + +LIQ_EXPORT LIQ_NONNULL int liq_get_min_quality(const liq_attr *attr) +{ + if (!CHECK_STRUCT_TYPE(attr, liq_attr)) return -1; + return mse_to_quality(attr->max_mse); +} + +LIQ_EXPORT LIQ_NONNULL int liq_get_max_quality(const liq_attr *attr) +{ + if (!CHECK_STRUCT_TYPE(attr, liq_attr)) return -1; + return mse_to_quality(attr->target_mse); +} + + +LIQ_EXPORT LIQ_NONNULL liq_error liq_set_max_colors(liq_attr* attr, int colors) +{ + if (!CHECK_STRUCT_TYPE(attr, liq_attr)) return LIQ_INVALID_POINTER; + if (colors < 2 || colors > 256) return LIQ_VALUE_OUT_OF_RANGE; + + attr->max_colors = colors; + return LIQ_OK; +} + +LIQ_EXPORT LIQ_NONNULL int liq_get_max_colors(const liq_attr *attr) +{ + if (!CHECK_STRUCT_TYPE(attr, liq_attr)) return -1; + + return attr->max_colors; +} + +LIQ_EXPORT LIQ_NONNULL liq_error liq_set_min_posterization(liq_attr *attr, int bits) +{ + if (!CHECK_STRUCT_TYPE(attr, liq_attr)) return LIQ_INVALID_POINTER; + if (bits < 0 || bits > 4) return LIQ_VALUE_OUT_OF_RANGE; + + attr->min_posterization_output = bits; + return LIQ_OK; +} + +LIQ_EXPORT LIQ_NONNULL int liq_get_min_posterization(const liq_attr *attr) +{ + if (!CHECK_STRUCT_TYPE(attr, liq_attr)) return -1; + + return attr->min_posterization_output; +} + +LIQ_EXPORT LIQ_NONNULL liq_error liq_set_speed(liq_attr* attr, int speed) +{ + if (!CHECK_STRUCT_TYPE(attr, liq_attr)) return LIQ_INVALID_POINTER; + if (speed < 1 || speed > 10) return LIQ_VALUE_OUT_OF_RANGE; + + unsigned int iterations = MAX(8-speed, 0); + iterations += iterations * iterations/2; + attr->kmeans_iterations = iterations; + attr->kmeans_iteration_limit = 1.0/(double)(1<<(23-speed)); + attr->feedback_loop_trials = MAX(56-9*speed, 0); + + attr->max_histogram_entries = (1<<17) + (1<<18)*(10-speed); + attr->min_posterization_input = (speed >= 8) ? 1 : 0; + attr->use_dither_map = (speed <= (omp_get_max_threads() > 1 ? 7 : 5)); // parallelized dither map might speed up floyd remapping + if (attr->use_dither_map && speed < 3) { + attr->use_dither_map = 2; // always + } + attr->use_contrast_maps = (speed <= 7) || attr->use_dither_map; + attr->speed = speed; + + attr->progress_stage1 = attr->use_contrast_maps ? 20 : 8; + if (attr->feedback_loop_trials < 2) { + attr->progress_stage1 += 30; + } + attr->progress_stage3 = 50 / (1+speed); + attr->progress_stage2 = 100 - attr->progress_stage1 - attr->progress_stage3; + return LIQ_OK; +} + +LIQ_EXPORT LIQ_NONNULL int liq_get_speed(const liq_attr *attr) +{ + if (!CHECK_STRUCT_TYPE(attr, liq_attr)) return -1; + + return attr->speed; +} + +LIQ_EXPORT LIQ_NONNULL liq_error liq_set_output_gamma(liq_result* res, double gamma) +{ + if (!CHECK_STRUCT_TYPE(res, liq_result)) return LIQ_INVALID_POINTER; + if (gamma <= 0 || gamma >= 1.0) return LIQ_VALUE_OUT_OF_RANGE; + + if (res->remapping) { + liq_remapping_result_destroy(res->remapping); + res->remapping = NULL; + } + + res->gamma = gamma; + return LIQ_OK; +} + +LIQ_EXPORT LIQ_NONNULL liq_error liq_set_min_opacity(liq_attr* attr, int min) +{ + return LIQ_OK; +} + +LIQ_EXPORT LIQ_NONNULL int liq_get_min_opacity(const liq_attr *attr) +{ + return 0; +} + +LIQ_EXPORT LIQ_NONNULL void liq_set_last_index_transparent(liq_attr* attr, int is_last) +{ + if (!CHECK_STRUCT_TYPE(attr, liq_attr)) return; + + attr->last_index_transparent = !!is_last; +} + +LIQ_EXPORT void liq_attr_set_progress_callback(liq_attr *attr, liq_progress_callback_function *callback, void *user_info) +{ + if (!CHECK_STRUCT_TYPE(attr, liq_attr)) return; + + attr->progress_callback = callback; + attr->progress_callback_user_info = user_info; +} + +LIQ_EXPORT void liq_result_set_progress_callback(liq_result *result, liq_progress_callback_function *callback, void *user_info) +{ + if (!CHECK_STRUCT_TYPE(result, liq_result)) return; + + result->progress_callback = callback; + result->progress_callback_user_info = user_info; +} + +LIQ_EXPORT void liq_set_log_callback(liq_attr *attr, liq_log_callback_function *callback, void* user_info) +{ + if (!CHECK_STRUCT_TYPE(attr, liq_attr)) return; + + liq_verbose_printf_flush(attr); + attr->log_callback = callback; + attr->log_callback_user_info = user_info; +} + +LIQ_EXPORT void liq_set_log_flush_callback(liq_attr *attr, liq_log_flush_callback_function *callback, void* user_info) +{ + if (!CHECK_STRUCT_TYPE(attr, liq_attr)) return; + + attr->log_flush_callback = callback; + attr->log_flush_callback_user_info = user_info; +} + +LIQ_EXPORT liq_attr* liq_attr_create() +{ + return liq_attr_create_with_allocator(NULL, NULL); +} + +LIQ_EXPORT LIQ_NONNULL void liq_attr_destroy(liq_attr *attr) +{ + if (!CHECK_STRUCT_TYPE(attr, liq_attr)) { + return; + } + + liq_verbose_printf_flush(attr); + + attr->magic_header = liq_freed_magic; + attr->free(attr); +} + +LIQ_EXPORT LIQ_NONNULL liq_attr* liq_attr_copy(const liq_attr *orig) +{ + if (!CHECK_STRUCT_TYPE(orig, liq_attr)) { + return NULL; + } + + liq_attr *attr = orig->malloc(sizeof(liq_attr)); + if (!attr) return NULL; + *attr = *orig; + return attr; +} + +static void *liq_aligned_malloc(size_t size) +{ + unsigned char *ptr = malloc(size + 16); + if (!ptr) { + return NULL; + } + + uintptr_t offset = 16 - ((uintptr_t)ptr & 15); // also reserves 1 byte for ptr[-1] + ptr += offset; + assert(0 == (((uintptr_t)ptr) & 15)); + ptr[-1] = offset ^ 0x59; // store how much pointer was shifted to get the original for free() + return ptr; +} + +LIQ_NONNULL static void liq_aligned_free(void *inptr) +{ + unsigned char *ptr = inptr; + size_t offset = ptr[-1] ^ 0x59; + assert(offset > 0 && offset <= 16); + free(ptr - offset); +} + +LIQ_EXPORT liq_attr* liq_attr_create_with_allocator(void* (*custom_malloc)(size_t), void (*custom_free)(void*)) +{ +#if USE_SSE + if (!is_sse_available()) { + return NULL; + } +#endif + if (!custom_malloc && !custom_free) { + custom_malloc = liq_aligned_malloc; + custom_free = liq_aligned_free; + } else if (!custom_malloc != !custom_free) { + return NULL; // either specify both or none + } + + liq_attr *attr = custom_malloc(sizeof(liq_attr)); + if (!attr) return NULL; + *attr = (liq_attr) { + .magic_header = liq_attr_magic, + .malloc = custom_malloc, + .free = custom_free, + .max_colors = 256, + .last_index_transparent = false, // puts transparent color at last index. This is workaround for blu-ray subtitles. + .target_mse = 0, + .max_mse = MAX_DIFF, + }; + liq_set_speed(attr, 4); + return attr; +} + +LIQ_EXPORT LIQ_NONNULL liq_error liq_image_add_fixed_color(liq_image *img, liq_color color) +{ + if (!CHECK_STRUCT_TYPE(img, liq_image)) return LIQ_INVALID_POINTER; + if (img->fixed_colors_count > 255) return LIQ_UNSUPPORTED; + + float gamma_lut[256]; + to_f_set_gamma(gamma_lut, img->gamma); + img->fixed_colors[img->fixed_colors_count++] = rgba_to_f(gamma_lut, (liq_color){ + .r = color.r, + .g = color.g, + .b = color.b, + .a = color.a, + }); + return LIQ_OK; +} + +LIQ_NONNULL static liq_error liq_histogram_add_fixed_color_f(liq_histogram *hist, f_pixel color) +{ + if (hist->fixed_colors_count > 255) return LIQ_UNSUPPORTED; + + hist->fixed_colors[hist->fixed_colors_count++] = color; + return LIQ_OK; +} + +LIQ_EXPORT LIQ_NONNULL liq_error liq_histogram_add_fixed_color(liq_histogram *hist, liq_color color, double gamma) +{ + if (!CHECK_STRUCT_TYPE(hist, liq_histogram)) return LIQ_INVALID_POINTER; + + float gamma_lut[256]; + to_f_set_gamma(gamma_lut, gamma ? gamma : 0.45455); + const f_pixel px = rgba_to_f(gamma_lut, (liq_color){ + .r = color.r, + .g = color.g, + .b = color.b, + .a = color.a, + }); + return liq_histogram_add_fixed_color_f(hist, px); +} + +LIQ_NONNULL static bool liq_image_use_low_memory(liq_image *img) +{ + if (img->temp_f_row) { + img->free(img->temp_f_row); + } + img->temp_f_row = img->malloc(sizeof(img->f_pixels[0]) * LIQ_TEMP_ROW_WIDTH(img->width) * omp_get_max_threads()); + return img->temp_f_row != NULL; +} + +LIQ_NONNULL static bool liq_image_should_use_low_memory(liq_image *img, const bool low_memory_hint) +{ + return (size_t)img->width * (size_t)img->height > (low_memory_hint ? LIQ_HIGH_MEMORY_LIMIT/8 : LIQ_HIGH_MEMORY_LIMIT) / sizeof(f_pixel); // Watch out for integer overflow +} + +static liq_image *liq_image_create_internal(const liq_attr *attr, liq_color* rows[], liq_image_get_rgba_row_callback *row_callback, void *row_callback_user_info, int width, int height, double gamma) +{ + if (gamma < 0 || gamma > 1.0) { + liq_log_error(attr, "gamma must be >= 0 and <= 1 (try 1/gamma instead)"); + return NULL; + } + + if (!rows && !row_callback) { + liq_log_error(attr, "missing row data"); + return NULL; + } + + liq_image *img = attr->malloc(sizeof(liq_image)); + if (!img) return NULL; + *img = (liq_image){ + .magic_header = liq_image_magic, + .malloc = attr->malloc, + .free = attr->free, + .width = width, .height = height, + .gamma = gamma ? gamma : 0.45455, + .rows = rows, + .row_callback = row_callback, + .row_callback_user_info = row_callback_user_info, + }; + + if (!rows) { + img->temp_row = attr->malloc(sizeof(img->temp_row[0]) * LIQ_TEMP_ROW_WIDTH(width) * omp_get_max_threads()); + if (!img->temp_row) return NULL; + } + + // if image is huge or converted pixels are not likely to be reused then don't cache converted pixels + if (liq_image_should_use_low_memory(img, !img->temp_row && !attr->use_contrast_maps && !attr->use_dither_map)) { + verbose_print(attr, " conserving memory"); + if (!liq_image_use_low_memory(img)) return NULL; + } + + return img; +} + +LIQ_EXPORT LIQ_NONNULL liq_error liq_image_set_memory_ownership(liq_image *img, int ownership_flags) +{ + if (!CHECK_STRUCT_TYPE(img, liq_image)) return LIQ_INVALID_POINTER; + if (!img->rows || !ownership_flags || (ownership_flags & ~(LIQ_OWN_ROWS|LIQ_OWN_PIXELS))) { + return LIQ_VALUE_OUT_OF_RANGE; + } + + if (ownership_flags & LIQ_OWN_ROWS) { + if (img->free_rows_internal) return LIQ_VALUE_OUT_OF_RANGE; + img->free_rows = true; + } + + if (ownership_flags & LIQ_OWN_PIXELS) { + img->free_pixels = true; + if (!img->pixels) { + // for simplicity of this API there's no explicit bitmap argument, + // so the row with the lowest address is assumed to be at the start of the bitmap + img->pixels = img->rows[0]; + for(unsigned int i=1; i < img->height; i++) { + img->pixels = MIN(img->pixels, img->rows[i]); + } + } + } + + return LIQ_OK; +} + +LIQ_NONNULL static void liq_image_free_maps(liq_image *input_image); +LIQ_NONNULL static void liq_image_free_dither_map(liq_image *input_image); +LIQ_NONNULL static void liq_image_free_importance_map(liq_image *input_image); + +LIQ_EXPORT LIQ_NONNULL liq_error liq_image_set_importance_map(liq_image *img, unsigned char importance_map[], size_t buffer_size, enum liq_ownership ownership) { + if (!CHECK_STRUCT_TYPE(img, liq_image)) return LIQ_INVALID_POINTER; + if (!CHECK_USER_POINTER(importance_map)) return LIQ_INVALID_POINTER; + + const size_t required_size = (size_t)img->width * (size_t)img->height; + if (buffer_size < required_size) { + return LIQ_BUFFER_TOO_SMALL; + } + + if (ownership == LIQ_COPY_PIXELS) { + unsigned char *tmp = img->malloc(required_size); + if (!tmp) { + return LIQ_OUT_OF_MEMORY; + } + memcpy(tmp, importance_map, required_size); + importance_map = tmp; + } else if (ownership != LIQ_OWN_PIXELS) { + return LIQ_UNSUPPORTED; + } + + liq_image_free_importance_map(img); + img->importance_map = importance_map; + + return LIQ_OK; +} + +LIQ_EXPORT LIQ_NONNULL liq_error liq_image_set_background(liq_image *img, liq_image *background) +{ + if (!CHECK_STRUCT_TYPE(img, liq_image)) return LIQ_INVALID_POINTER; + if (!CHECK_STRUCT_TYPE(background, liq_image)) return LIQ_INVALID_POINTER; + + if (background->background) { + return LIQ_UNSUPPORTED; + } + if (img->width != background->width || img->height != background->height) { + return LIQ_BUFFER_TOO_SMALL; + } + + if (img->background) { + liq_image_destroy(img->background); + } + + img->background = background; + liq_image_free_dither_map(img); // Force it to be re-analyzed with the background + + return LIQ_OK; +} + +LIQ_NONNULL static bool check_image_size(const liq_attr *attr, const int width, const int height) +{ + if (!CHECK_STRUCT_TYPE(attr, liq_attr)) { + return false; + } + + if (width <= 0 || height <= 0) { + liq_log_error(attr, "width and height must be > 0"); + return false; + } + + if (width > INT_MAX/sizeof(liq_color)/height || width > INT_MAX/16/sizeof(f_pixel) || height > INT_MAX/sizeof(size_t)) { + liq_log_error(attr, "image too large"); + return false; + } + return true; +} + +LIQ_EXPORT liq_image *liq_image_create_custom(const liq_attr *attr, liq_image_get_rgba_row_callback *row_callback, void* user_info, int width, int height, double gamma) +{ + if (!check_image_size(attr, width, height)) { + return NULL; + } + return liq_image_create_internal(attr, NULL, row_callback, user_info, width, height, gamma); +} + +LIQ_EXPORT liq_image *liq_image_create_rgba_rows(const liq_attr *attr, void *const rows[], int width, int height, double gamma) +{ + if (!check_image_size(attr, width, height)) { + return NULL; + } + + for(int i=0; i < height; i++) { + if (!CHECK_USER_POINTER(rows+i) || !CHECK_USER_POINTER(rows[i])) { + liq_log_error(attr, "invalid row pointers"); + return NULL; + } + } + return liq_image_create_internal(attr, (liq_color**)rows, NULL, NULL, width, height, gamma); +} + +LIQ_EXPORT LIQ_NONNULL liq_image *liq_image_create_rgba(const liq_attr *attr, const void* bitmap, int width, int height, double gamma) +{ + if (!check_image_size(attr, width, height)) { + return NULL; + } + if (!CHECK_USER_POINTER(bitmap)) { + liq_log_error(attr, "invalid bitmap pointer"); + return NULL; + } + + liq_color *const pixels = (liq_color *const)bitmap; + liq_color **rows = attr->malloc(sizeof(rows[0])*height); + if (!rows) return NULL; + + for(int i=0; i < height; i++) { + rows[i] = pixels + width * i; + } + + liq_image *image = liq_image_create_internal(attr, rows, NULL, NULL, width, height, gamma); + if (!image) { + attr->free(rows); + return NULL; + } + image->free_rows = true; + image->free_rows_internal = true; + return image; +} + +NEVER_INLINE LIQ_EXPORT void liq_executing_user_callback(liq_image_get_rgba_row_callback *callback, liq_color *temp_row, int row, int width, void *user_info); +LIQ_EXPORT void liq_executing_user_callback(liq_image_get_rgba_row_callback *callback, liq_color *temp_row, int row, int width, void *user_info) +{ + assert(callback); + assert(temp_row); + callback(temp_row, row, width, user_info); +} + +LIQ_NONNULL inline static bool liq_image_has_rgba_pixels(const liq_image *img) +{ + if (!CHECK_STRUCT_TYPE(img, liq_image)) { + return false; + } + return img->rows || (img->temp_row && img->row_callback); +} + +LIQ_NONNULL inline static bool liq_image_can_use_rgba_rows(const liq_image *img) +{ + assert(liq_image_has_rgba_pixels(img)); + return img->rows; +} + +LIQ_NONNULL static const liq_color *liq_image_get_row_rgba(liq_image *img, unsigned int row) +{ + if (liq_image_can_use_rgba_rows(img)) { + return img->rows[row]; + } + + assert(img->temp_row); + liq_color *temp_row = img->temp_row + LIQ_TEMP_ROW_WIDTH(img->width) * omp_get_thread_num(); + if (img->rows) { + memcpy(temp_row, img->rows[row], img->width * sizeof(temp_row[0])); + } else { + liq_executing_user_callback(img->row_callback, (liq_color*)temp_row, row, img->width, img->row_callback_user_info); + } + + return temp_row; +} + +LIQ_NONNULL static void convert_row_to_f(liq_image *img, f_pixel *row_f_pixels, const unsigned int row, const float gamma_lut[]) +{ + assert(row_f_pixels); + assert(!USE_SSE || 0 == ((uintptr_t)row_f_pixels & 15)); + + const liq_color *const row_pixels = liq_image_get_row_rgba(img, row); + + for(unsigned int col=0; col < img->width; col++) { + row_f_pixels[col] = rgba_to_f(gamma_lut, row_pixels[col]); + } +} + +LIQ_PRIVATE LIQ_NONNULL bool liq_image_get_row_f_init(liq_image *img) +{ + assert(omp_get_thread_num() == 0); + if (img->f_pixels) { + return true; + } + if (!liq_image_should_use_low_memory(img, false)) { + img->f_pixels = img->malloc(sizeof(img->f_pixels[0]) * img->width * img->height); + } + if (!img->f_pixels) { + return liq_image_use_low_memory(img); + } + + if (!liq_image_has_rgba_pixels(img)) { + return false; + } + + float gamma_lut[256]; + to_f_set_gamma(gamma_lut, img->gamma); + for(unsigned int i=0; i < img->height; i++) { + convert_row_to_f(img, &img->f_pixels[i*img->width], i, gamma_lut); + } + return true; +} + +LIQ_PRIVATE LIQ_NONNULL const f_pixel *liq_image_get_row_f(liq_image *img, unsigned int row) +{ + if (!img->f_pixels) { + assert(img->temp_f_row); // init should have done that + float gamma_lut[256]; + to_f_set_gamma(gamma_lut, img->gamma); + f_pixel *row_for_thread = img->temp_f_row + LIQ_TEMP_ROW_WIDTH(img->width) * omp_get_thread_num(); + convert_row_to_f(img, row_for_thread, row, gamma_lut); + return row_for_thread; + } + return img->f_pixels + img->width * row; +} + +LIQ_EXPORT LIQ_NONNULL int liq_image_get_width(const liq_image *input_image) +{ + if (!CHECK_STRUCT_TYPE(input_image, liq_image)) return -1; + return input_image->width; +} + +LIQ_EXPORT LIQ_NONNULL int liq_image_get_height(const liq_image *input_image) +{ + if (!CHECK_STRUCT_TYPE(input_image, liq_image)) return -1; + return input_image->height; +} + +typedef void free_func(void*); + +LIQ_NONNULL static free_func *get_default_image_free_func(liq_image *img) +{ + // When default allocator is used then user-supplied pointers must be freed with free() + if (img->free != liq_aligned_free) { + return img->free; + } + return free; +} + +LIQ_NONNULL static free_func *get_default_rows_free_func(liq_image *img) +{ + // When default allocator is used then user-supplied pointers must be freed with free() + if (img->free_rows_internal || img->free != liq_aligned_free) { + return img->free; + } + return free; +} + +LIQ_NONNULL static void liq_image_free_rgba_source(liq_image *input_image) +{ + if (input_image->free_pixels && input_image->pixels) { + get_default_image_free_func(input_image)(input_image->pixels); + input_image->pixels = NULL; + } + + if (input_image->free_rows && input_image->rows) { + get_default_rows_free_func(input_image)(input_image->rows); + input_image->rows = NULL; + } +} + +LIQ_NONNULL static void liq_image_free_importance_map(liq_image *input_image) { + if (input_image->importance_map) { + input_image->free(input_image->importance_map); + input_image->importance_map = NULL; + } +} + +LIQ_NONNULL static void liq_image_free_maps(liq_image *input_image) { + liq_image_free_importance_map(input_image); + + if (input_image->edges) { + input_image->free(input_image->edges); + input_image->edges = NULL; + } + liq_image_free_dither_map(input_image); +} + +LIQ_NONNULL static void liq_image_free_dither_map(liq_image *input_image) { + if (input_image->dither_map) { + input_image->free(input_image->dither_map); + input_image->dither_map = NULL; + } +} + +LIQ_EXPORT LIQ_NONNULL void liq_image_destroy(liq_image *input_image) +{ + if (!CHECK_STRUCT_TYPE(input_image, liq_image)) return; + + liq_image_free_rgba_source(input_image); + + liq_image_free_maps(input_image); + + if (input_image->f_pixels) { + input_image->free(input_image->f_pixels); + } + + if (input_image->temp_row) { + input_image->free(input_image->temp_row); + } + + if (input_image->temp_f_row) { + input_image->free(input_image->temp_f_row); + } + + if (input_image->background) { + liq_image_destroy(input_image->background); + } + + input_image->magic_header = liq_freed_magic; + input_image->free(input_image); +} + +LIQ_EXPORT liq_histogram* liq_histogram_create(const liq_attr* attr) +{ + if (!CHECK_STRUCT_TYPE(attr, liq_attr)) { + return NULL; + } + + liq_histogram *hist = attr->malloc(sizeof(liq_histogram)); + if (!hist) return NULL; + *hist = (liq_histogram) { + .magic_header = liq_histogram_magic, + .malloc = attr->malloc, + .free = attr->free, + + .ignorebits = MAX(attr->min_posterization_output, attr->min_posterization_input), + }; + return hist; +} + +LIQ_EXPORT LIQ_NONNULL void liq_histogram_destroy(liq_histogram *hist) +{ + if (!CHECK_STRUCT_TYPE(hist, liq_histogram)) return; + hist->magic_header = liq_freed_magic; + + pam_freeacolorhash(hist->acht); + hist->free(hist); +} + +LIQ_EXPORT LIQ_NONNULL liq_result *liq_quantize_image(liq_attr *attr, liq_image *img) +{ + liq_result *res; + if (LIQ_OK != liq_image_quantize(img, attr, &res)) { + return NULL; + } + return res; +} + +LIQ_EXPORT LIQ_NONNULL liq_error liq_image_quantize(liq_image *const img, liq_attr *const attr, liq_result **result_output) +{ + if (!CHECK_STRUCT_TYPE(attr, liq_attr)) return LIQ_INVALID_POINTER; + if (!liq_image_has_rgba_pixels(img)) { + return LIQ_UNSUPPORTED; + } + + liq_histogram *hist = liq_histogram_create(attr); + if (!hist) { + return LIQ_OUT_OF_MEMORY; + } + liq_error err = liq_histogram_add_image(hist, attr, img); + if (LIQ_OK != err) { + liq_histogram_destroy(hist); + return err; + } + + err = liq_histogram_quantize_internal(hist, attr, false, result_output); + liq_histogram_destroy(hist); + + return err; +} + +LIQ_EXPORT LIQ_NONNULL liq_error liq_histogram_quantize(liq_histogram *input_hist, liq_attr *attr, liq_result **result_output) { + return liq_histogram_quantize_internal(input_hist, attr, true, result_output); +} + +LIQ_NONNULL static liq_error liq_histogram_quantize_internal(liq_histogram *input_hist, liq_attr *attr, bool fixed_result_colors, liq_result **result_output) +{ + if (!CHECK_USER_POINTER(result_output)) return LIQ_INVALID_POINTER; + *result_output = NULL; + + if (!CHECK_STRUCT_TYPE(attr, liq_attr)) return LIQ_INVALID_POINTER; + if (!CHECK_STRUCT_TYPE(input_hist, liq_histogram)) return LIQ_INVALID_POINTER; + + if (liq_progress(attr, 0)) return LIQ_ABORTED; + + histogram *hist; + liq_error err = finalize_histogram(input_hist, attr, &hist); + if (err != LIQ_OK) { + return err; + } + + err = pngquant_quantize(hist, attr, input_hist->fixed_colors_count, input_hist->fixed_colors, input_hist->gamma, fixed_result_colors, result_output); + pam_freeacolorhist(hist); + + return err; +} + +LIQ_EXPORT LIQ_NONNULL liq_error liq_set_dithering_level(liq_result *res, float dither_level) +{ + if (!CHECK_STRUCT_TYPE(res, liq_result)) return LIQ_INVALID_POINTER; + + if (res->remapping) { + liq_remapping_result_destroy(res->remapping); + res->remapping = NULL; + } + + if (dither_level < 0 || dither_level > 1.0f) return LIQ_VALUE_OUT_OF_RANGE; + res->dither_level = dither_level; + return LIQ_OK; +} + +LIQ_NONNULL static liq_remapping_result *liq_remapping_result_create(liq_result *result) +{ + if (!CHECK_STRUCT_TYPE(result, liq_result)) { + return NULL; + } + + liq_remapping_result *res = result->malloc(sizeof(liq_remapping_result)); + if (!res) return NULL; + *res = (liq_remapping_result) { + .magic_header = liq_remapping_result_magic, + .malloc = result->malloc, + .free = result->free, + .dither_level = result->dither_level, + .use_dither_map = result->use_dither_map, + .palette_error = result->palette_error, + .gamma = result->gamma, + .palette = pam_duplicate_colormap(result->palette), + .progress_callback = result->progress_callback, + .progress_callback_user_info = result->progress_callback_user_info, + .progress_stage1 = result->use_dither_map ? 20 : 0, + }; + return res; +} + +LIQ_EXPORT LIQ_NONNULL double liq_get_output_gamma(const liq_result *result) +{ + if (!CHECK_STRUCT_TYPE(result, liq_result)) return -1; + + return result->gamma; +} + +LIQ_NONNULL static void liq_remapping_result_destroy(liq_remapping_result *result) +{ + if (!CHECK_STRUCT_TYPE(result, liq_remapping_result)) return; + + if (result->palette) pam_freecolormap(result->palette); + if (result->pixels) result->free(result->pixels); + + result->magic_header = liq_freed_magic; + result->free(result); +} + +LIQ_EXPORT LIQ_NONNULL void liq_result_destroy(liq_result *res) +{ + if (!CHECK_STRUCT_TYPE(res, liq_result)) return; + + memset(&res->int_palette, 0, sizeof(liq_palette)); + + if (res->remapping) { + memset(&res->remapping->int_palette, 0, sizeof(liq_palette)); + liq_remapping_result_destroy(res->remapping); + } + + pam_freecolormap(res->palette); + + res->magic_header = liq_freed_magic; + res->free(res); +} + + +LIQ_EXPORT LIQ_NONNULL double liq_get_quantization_error(const liq_result *result) { + if (!CHECK_STRUCT_TYPE(result, liq_result)) return -1; + + if (result->palette_error >= 0) { + return mse_to_standard_mse(result->palette_error); + } + + return -1; +} + +LIQ_EXPORT LIQ_NONNULL double liq_get_remapping_error(const liq_result *result) { + if (!CHECK_STRUCT_TYPE(result, liq_result)) return -1; + + if (result->remapping && result->remapping->palette_error >= 0) { + return mse_to_standard_mse(result->remapping->palette_error); + } + + return -1; +} + +LIQ_EXPORT LIQ_NONNULL int liq_get_quantization_quality(const liq_result *result) { + if (!CHECK_STRUCT_TYPE(result, liq_result)) return -1; + + if (result->palette_error >= 0) { + return mse_to_quality(result->palette_error); + } + + return -1; +} + +LIQ_EXPORT LIQ_NONNULL int liq_get_remapping_quality(const liq_result *result) { + if (!CHECK_STRUCT_TYPE(result, liq_result)) return -1; + + if (result->remapping && result->remapping->palette_error >= 0) { + return mse_to_quality(result->remapping->palette_error); + } + + return -1; +} + +LIQ_NONNULL static int compare_popularity(const void *ch1, const void *ch2) +{ + const float v1 = ((const colormap_item*)ch1)->popularity; + const float v2 = ((const colormap_item*)ch2)->popularity; + return v1 > v2 ? -1 : 1; +} + +LIQ_NONNULL static void sort_palette_qsort(colormap *map, int start, int nelem) +{ + if (!nelem) return; + qsort(map->palette + start, nelem, sizeof(map->palette[0]), compare_popularity); +} + +#define SWAP_PALETTE(map, a,b) { \ + const colormap_item tmp = (map)->palette[(a)]; \ + (map)->palette[(a)] = (map)->palette[(b)]; \ + (map)->palette[(b)] = tmp; } + +LIQ_NONNULL static void sort_palette(colormap *map, const liq_attr *options) +{ + /* + ** Step 3.5 [GRR]: remap the palette colors so that all entries with + ** the maximal alpha value (i.e., fully opaque) are at the end and can + ** therefore be omitted from the tRNS chunk. + */ + if (options->last_index_transparent) { + for(unsigned int i=0; i < map->colors; i++) { + if (map->palette[i].acolor.a < MIN_OPAQUE_A) { + const unsigned int old = i, transparent_dest = map->colors-1; + + SWAP_PALETTE(map, transparent_dest, old); + + /* colors sorted by popularity make pngs slightly more compressible */ + sort_palette_qsort(map, 0, map->colors-1); + return; + } + } + } + + unsigned int non_fixed_colors = 0; + for(unsigned int i = 0; i < map->colors; i++) { + if (map->palette[i].fixed) { + break; + } + non_fixed_colors++; + } + + /* move transparent colors to the beginning to shrink trns chunk */ + unsigned int num_transparent = 0; + for(unsigned int i = 0; i < non_fixed_colors; i++) { + if (map->palette[i].acolor.a < 255.f/256.f * LIQ_WEIGHT_A) { + // current transparent color is swapped with earlier opaque one + if (i != num_transparent) { + SWAP_PALETTE(map, num_transparent, i); + i--; + } + num_transparent++; + } + } + + liq_verbose_printf(options, " eliminated opaque tRNS-chunk entries...%d entr%s transparent", num_transparent, (num_transparent == 1)? "y" : "ies"); + + /* colors sorted by popularity make pngs slightly more compressible + * opaque and transparent are sorted separately + */ + sort_palette_qsort(map, 0, num_transparent); + sort_palette_qsort(map, num_transparent, non_fixed_colors - num_transparent); + + if (non_fixed_colors > 9 && map->colors > 16) { + SWAP_PALETTE(map, 7, 1); // slightly improves compression + SWAP_PALETTE(map, 8, 2); + SWAP_PALETTE(map, 9, 3); + } +} + +inline static unsigned int posterize_channel(unsigned int color, unsigned int bits) +{ + return (color & ~((1<> (8-bits)); +} + +LIQ_NONNULL static void set_rounded_palette(liq_palette *const dest, colormap *const map, const double gamma, unsigned int posterize) +{ + float gamma_lut[256]; + to_f_set_gamma(gamma_lut, gamma); + + dest->count = map->colors; + for(unsigned int x = 0; x < map->colors; ++x) { + liq_color px = f_to_rgb(gamma, map->palette[x].acolor); + + px.r = posterize_channel(px.r, posterize); + px.g = posterize_channel(px.g, posterize); + px.b = posterize_channel(px.b, posterize); + px.a = posterize_channel(px.a, posterize); + + map->palette[x].acolor = rgba_to_f(gamma_lut, px); /* saves rounding error introduced by to_rgb, which makes remapping & dithering more accurate */ + + if (!px.a && !map->palette[x].fixed) { + px.r = 71; px.g = 112; px.b = 76; + } + + dest->entries[x] = (liq_color){.r=px.r,.g=px.g,.b=px.b,.a=px.a}; + } +} + +LIQ_EXPORT LIQ_NONNULL const liq_palette *liq_get_palette(liq_result *result) +{ + if (!CHECK_STRUCT_TYPE(result, liq_result)) return NULL; + + if (result->remapping && result->remapping->int_palette.count) { + return &result->remapping->int_palette; + } + + if (!result->int_palette.count) { + set_rounded_palette(&result->int_palette, result->palette, result->gamma, result->min_posterization_output); + } + return &result->int_palette; +} + +LIQ_EXPORT LIQ_NONNULL liq_error liq_histogram_add_colors(liq_histogram *input_hist, const liq_attr *options, const liq_histogram_entry entries[], int num_entries, double gamma) +{ + if (!CHECK_STRUCT_TYPE(options, liq_attr)) return LIQ_INVALID_POINTER; + if (!CHECK_STRUCT_TYPE(input_hist, liq_histogram)) return LIQ_INVALID_POINTER; + if (!CHECK_USER_POINTER(entries)) return LIQ_INVALID_POINTER; + if (gamma < 0 || gamma >= 1.0) return LIQ_VALUE_OUT_OF_RANGE; + if (num_entries <= 0 || num_entries > 1<<30) return LIQ_VALUE_OUT_OF_RANGE; + + if (input_hist->ignorebits > 0 && input_hist->had_image_added) { + return LIQ_UNSUPPORTED; + } + input_hist->ignorebits = 0; + + input_hist->had_image_added = true; + input_hist->gamma = gamma ? gamma : 0.45455; + + if (!input_hist->acht) { + input_hist->acht = pam_allocacolorhash(~0, num_entries*num_entries, 0, options->malloc, options->free); + if (!input_hist->acht) { + return LIQ_OUT_OF_MEMORY; + } + } + // Fake image size. It's only for hash size estimates. + if (!input_hist->acht->cols) { + input_hist->acht->cols = num_entries; + } + input_hist->acht->rows += num_entries; + + const unsigned int hash_size = input_hist->acht->hash_size; + for(int i=0; i < num_entries; i++) { + const liq_color rgba = { + .r = entries[i].color.r, + .g = entries[i].color.g, + .b = entries[i].color.b, + .a = entries[i].color.a, + }; + union rgba_as_int px = {rgba}; + unsigned int hash; + if (px.rgba.a) { + hash = px.l % hash_size; + } else { + hash=0; px.l=0; + } + if (!pam_add_to_hash(input_hist->acht, hash, entries[i].count, px, i, num_entries)) { + return LIQ_OUT_OF_MEMORY; + } + } + + return LIQ_OK; +} + +LIQ_EXPORT LIQ_NONNULL liq_error liq_histogram_add_image(liq_histogram *input_hist, const liq_attr *options, liq_image *input_image) +{ + if (!CHECK_STRUCT_TYPE(options, liq_attr)) return LIQ_INVALID_POINTER; + if (!CHECK_STRUCT_TYPE(input_hist, liq_histogram)) return LIQ_INVALID_POINTER; + if (!CHECK_STRUCT_TYPE(input_image, liq_image)) return LIQ_INVALID_POINTER; + + const unsigned int cols = input_image->width, rows = input_image->height; + + if (!input_image->importance_map && options->use_contrast_maps) { + contrast_maps(input_image); + } + + input_hist->gamma = input_image->gamma; + + for(int i = 0; i < input_image->fixed_colors_count; i++) { + liq_error res = liq_histogram_add_fixed_color_f(input_hist, input_image->fixed_colors[i]); + if (res != LIQ_OK) { + return res; + } + } + + /* + ** Step 2: attempt to make a histogram of the colors, unclustered. + ** If at first we don't succeed, increase ignorebits to increase color + ** coherence and try again. + */ + + if (liq_progress(options, options->progress_stage1 * 0.4f)) { + return LIQ_ABORTED; + } + + const bool all_rows_at_once = liq_image_can_use_rgba_rows(input_image); + + // Usual solution is to start from scratch when limit is exceeded, but that's not possible if it's not + // the first image added + const unsigned int max_histogram_entries = input_hist->had_image_added ? ~0 : options->max_histogram_entries; + do { + if (!input_hist->acht) { + input_hist->acht = pam_allocacolorhash(max_histogram_entries, rows*cols, input_hist->ignorebits, options->malloc, options->free); + } + if (!input_hist->acht) return LIQ_OUT_OF_MEMORY; + + // histogram uses noise contrast map for importance. Color accuracy in noisy areas is not very important. + // noise map does not include edges to avoid ruining anti-aliasing + for(unsigned int row=0; row < rows; row++) { + bool added_ok; + if (all_rows_at_once) { + added_ok = pam_computeacolorhash(input_hist->acht, (const liq_color *const *)input_image->rows, cols, rows, input_image->importance_map); + if (added_ok) break; + } else { + const liq_color* rows_p[1] = { liq_image_get_row_rgba(input_image, row) }; + added_ok = pam_computeacolorhash(input_hist->acht, rows_p, cols, 1, input_image->importance_map ? &input_image->importance_map[row * cols] : NULL); + } + if (!added_ok) { + input_hist->ignorebits++; + liq_verbose_printf(options, " too many colors! Scaling colors to improve clustering... %d", input_hist->ignorebits); + pam_freeacolorhash(input_hist->acht); + input_hist->acht = NULL; + if (liq_progress(options, options->progress_stage1 * 0.6f)) return LIQ_ABORTED; + break; + } + } + } while(!input_hist->acht); + + input_hist->had_image_added = true; + + liq_image_free_importance_map(input_image); + + if (input_image->free_pixels && input_image->f_pixels) { + liq_image_free_rgba_source(input_image); // bow can free the RGBA source if copy has been made in f_pixels + } + + return LIQ_OK; +} + +LIQ_NONNULL static liq_error finalize_histogram(liq_histogram *input_hist, liq_attr *options, histogram **hist_output) +{ + if (liq_progress(options, options->progress_stage1 * 0.9f)) { + return LIQ_ABORTED; + } + + if (!input_hist->acht) { + return LIQ_BITMAP_NOT_AVAILABLE; + } + + histogram *hist = pam_acolorhashtoacolorhist(input_hist->acht, input_hist->gamma, options->malloc, options->free); + pam_freeacolorhash(input_hist->acht); + input_hist->acht = NULL; + + if (!hist) { + return LIQ_OUT_OF_MEMORY; + } + liq_verbose_printf(options, " made histogram...%d colors found", hist->size); + remove_fixed_colors_from_histogram(hist, input_hist->fixed_colors_count, input_hist->fixed_colors, options->target_mse); + + *hist_output = hist; + return LIQ_OK; +} + +/** + Builds two maps: + importance_map - approximation of areas with high-frequency noise, except straight edges. 1=flat, 0=noisy. + edges - noise map including all edges + */ +LIQ_NONNULL static void contrast_maps(liq_image *image) +{ + const unsigned int cols = image->width, rows = image->height; + if (cols < 4 || rows < 4 || (3*cols*rows) > LIQ_HIGH_MEMORY_LIMIT) { + return; + } + + unsigned char *restrict noise = image->importance_map ? image->importance_map : image->malloc(cols*rows); + image->importance_map = NULL; + unsigned char *restrict edges = image->edges ? image->edges : image->malloc(cols*rows); + image->edges = NULL; + + unsigned char *restrict tmp = image->malloc(cols*rows); + + if (!noise || !edges || !tmp || !liq_image_get_row_f_init(image)) { + image->free(noise); + image->free(edges); + image->free(tmp); + return; + } + + const f_pixel *curr_row, *prev_row, *next_row; + curr_row = prev_row = next_row = liq_image_get_row_f(image, 0); + + for (unsigned int j=0; j < rows; j++) { + prev_row = curr_row; + curr_row = next_row; + next_row = liq_image_get_row_f(image, MIN(rows-1,j+1)); + + f_pixel prev, curr = curr_row[0], next=curr; + for (unsigned int i=0; i < cols; i++) { + prev=curr; + curr=next; + next = curr_row[MIN(cols-1,i+1)]; + + // contrast is difference between pixels neighbouring horizontally and vertically + const float a = fabsf(prev.a+next.a - curr.a*2.f), + r = fabsf(prev.r+next.r - curr.r*2.f), + g = fabsf(prev.g+next.g - curr.g*2.f), + b = fabsf(prev.b+next.b - curr.b*2.f); + + const f_pixel prevl = prev_row[i]; + const f_pixel nextl = next_row[i]; + + const float a1 = fabsf(prevl.a+nextl.a - curr.a*2.f), + r1 = fabsf(prevl.r+nextl.r - curr.r*2.f), + g1 = fabsf(prevl.g+nextl.g - curr.g*2.f), + b1 = fabsf(prevl.b+nextl.b - curr.b*2.f); + + const float horiz = MAX(MAX(a,r),MAX(g,b)); + const float vert = MAX(MAX(a1,r1),MAX(g1,b1)); + const float edge = MAX(horiz,vert); + float z = edge - fabsf(horiz-vert)*.5f; + z = 1.f - MAX(z,MIN(horiz,vert)); + z *= z; // noise is amplified + z *= z; + // 85 is about 1/3rd of weight (not 0, because noisy pixels still need to be included, just not as precisely). + const unsigned int z_int = 80 + (unsigned int)(z * 176.f); + noise[j*cols+i] = MIN(z_int, 255); + const int e_int = 255 - (int)(edge * 256.f); + edges[j*cols+i] = e_int > 0 ? MIN(e_int, 255) : 0; + } + } + + // noise areas are shrunk and then expanded to remove thin edges from the map + liq_max3(noise, tmp, cols, rows); + liq_max3(tmp, noise, cols, rows); + + liq_blur(noise, tmp, noise, cols, rows, 3); + + liq_max3(noise, tmp, cols, rows); + + liq_min3(tmp, noise, cols, rows); + liq_min3(noise, tmp, cols, rows); + liq_min3(tmp, noise, cols, rows); + + liq_min3(edges, tmp, cols, rows); + liq_max3(tmp, edges, cols, rows); + for(unsigned int i=0; i < cols*rows; i++) edges[i] = MIN(noise[i], edges[i]); + + image->free(tmp); + + image->importance_map = noise; + image->edges = edges; +} + +/** + * Builds map of neighbor pixels mapped to the same palette entry + * + * For efficiency/simplicity it mainly looks for same consecutive pixels horizontally + * and peeks 1 pixel above/below. Full 2d algorithm doesn't improve it significantly. + * Correct flood fill doesn't have visually good properties. + */ +LIQ_NONNULL static void update_dither_map(liq_image *input_image, unsigned char *const *const row_pointers, colormap *map) +{ + const unsigned int width = input_image->width; + const unsigned int height = input_image->height; + unsigned char *const edges = input_image->edges; + + for(unsigned int row=0; row < height; row++) { + unsigned char lastpixel = row_pointers[row][0]; + unsigned int lastcol=0; + + for(unsigned int col=1; col < width; col++) { + const unsigned char px = row_pointers[row][col]; + if (input_image->background && map->palette[px].acolor.a < MIN_OPAQUE_A) { + // Transparency may or may not create an edge. When there's an explicit background set, assume no edge. + continue; + } + + if (px != lastpixel || col == width-1) { + int neighbor_count = 10 * (col-lastcol); + + unsigned int i=lastcol; + while(i < col) { + if (row > 0) { + unsigned char pixelabove = row_pointers[row-1][i]; + if (pixelabove == lastpixel) neighbor_count += 15; + } + if (row < height-1) { + unsigned char pixelbelow = row_pointers[row+1][i]; + if (pixelbelow == lastpixel) neighbor_count += 15; + } + i++; + } + + while(lastcol <= col) { + int e = edges[row*width + lastcol]; + edges[row*width + lastcol++] = (e+128) * (255.f/(255+128)) * (1.f - 20.f / (20 + neighbor_count)); + } + lastpixel = px; + } + } + } + input_image->dither_map = input_image->edges; + input_image->edges = NULL; +} + +/** + * Palette can be NULL, in which case it creates a new palette from scratch. + */ +static colormap *add_fixed_colors_to_palette(colormap *palette, const int max_colors, const f_pixel fixed_colors[], const int fixed_colors_count, void* (*malloc)(size_t), void (*free)(void*)) +{ + if (!fixed_colors_count) return palette; + + colormap *newpal = pam_colormap(MIN(max_colors, (palette ? palette->colors : 0) + fixed_colors_count), malloc, free); + unsigned int i=0; + if (palette && fixed_colors_count < max_colors) { + unsigned int palette_max = MIN(palette->colors, max_colors - fixed_colors_count); + for(; i < palette_max; i++) { + newpal->palette[i] = palette->palette[i]; + } + } + for(int j=0; j < MIN(max_colors, fixed_colors_count); j++) { + newpal->palette[i++] = (colormap_item){ + .acolor = fixed_colors[j], + .fixed = true, + }; + } + if (palette) pam_freecolormap(palette); + return newpal; +} + +LIQ_NONNULL static void adjust_histogram_callback(hist_item *item, float diff) +{ + item->adjusted_weight = (item->perceptual_weight + 2.f * item->adjusted_weight) * (0.5f + diff); +} + +/** + Repeats mediancut with different histogram weights to find palette with minimum error. + + feedback_loop_trials controls how long the search will take. < 0 skips the iteration. + */ +static colormap *find_best_palette(histogram *hist, const liq_attr *options, const double max_mse, const f_pixel fixed_colors[], const unsigned int fixed_colors_count, double *palette_error_p) +{ + unsigned int max_colors = options->max_colors; + + // if output is posterized it doesn't make sense to aim for perfrect colors, so increase target_mse + // at this point actual gamma is not set, so very conservative posterization estimate is used + const double target_mse = MIN(max_mse, MAX(options->target_mse, pow((1<min_posterization_output)/1024.0, 2))); + int feedback_loop_trials = options->feedback_loop_trials; + if (hist->size > 5000) {feedback_loop_trials = (feedback_loop_trials*3 + 3)/4;} + if (hist->size > 25000) {feedback_loop_trials = (feedback_loop_trials*3 + 3)/4;} + if (hist->size > 50000) {feedback_loop_trials = (feedback_loop_trials*3 + 3)/4;} + if (hist->size > 100000) {feedback_loop_trials = (feedback_loop_trials*3 + 3)/4;} + colormap *acolormap = NULL; + double least_error = MAX_DIFF; + double target_mse_overshoot = feedback_loop_trials>0 ? 1.05 : 1.0; + const float total_trials = (float)(feedback_loop_trials>0?feedback_loop_trials:1); + int fails_in_a_row=0; + + do { + colormap *newmap; + if (hist->size && fixed_colors_count < max_colors) { + newmap = mediancut(hist, max_colors-fixed_colors_count, target_mse * target_mse_overshoot, MAX(MAX(45.0/65536.0, target_mse), least_error)*1.2, + options->malloc, options->free); + } else { + feedback_loop_trials = 0; + newmap = NULL; + } + newmap = add_fixed_colors_to_palette(newmap, max_colors, fixed_colors, fixed_colors_count, options->malloc, options->free); + if (!newmap) { + return NULL; + } + + if (feedback_loop_trials <= 0) { + return newmap; + } + + // after palette has been created, total error (MSE) is calculated to keep the best palette + // at the same time K-Means iteration is done to improve the palette + // and histogram weights are adjusted based on remapping error to give more weight to poorly matched colors + + const bool first_run_of_target_mse = !acolormap && target_mse > 0; + double total_error = kmeans_do_iteration(hist, newmap, first_run_of_target_mse ? NULL : adjust_histogram_callback, omp_get_max_threads()); + + // goal is to increase quality or to reduce number of colors used if quality is good enough + if (!acolormap || total_error < least_error || (total_error <= target_mse && newmap->colors < max_colors)) { + if (acolormap) pam_freecolormap(acolormap); + acolormap = newmap; + + if (total_error < target_mse && total_error > 0) { + // K-Means iteration improves quality above what mediancut aims for + // this compensates for it, making mediancut aim for worse + target_mse_overshoot = MIN(target_mse_overshoot*1.25, target_mse/total_error); + } + + least_error = total_error; + + // if number of colors could be reduced, try to keep it that way + // but allow extra color as a bit of wiggle room in case quality can be improved too + max_colors = MIN(newmap->colors+1, max_colors); + + feedback_loop_trials -= 1; // asymptotic improvement could make it go on forever + fails_in_a_row = 0; + } else { + fails_in_a_row++; + target_mse_overshoot = 1.0; + + // if error is really bad, it's unlikely to improve, so end sooner + feedback_loop_trials -= 5 + fails_in_a_row; + pam_freecolormap(newmap); + } + + float fraction_done = 1.f-MAX(0.f, feedback_loop_trials/total_trials); + if (liq_progress(options, options->progress_stage1 + fraction_done * options->progress_stage2)) break; + liq_verbose_printf(options, " selecting colors...%d%%", (int)(100.f * fraction_done)); + } + while(feedback_loop_trials > 0); + + *palette_error_p = least_error; + return acolormap; +} + +LIQ_NONNULL static liq_error pngquant_quantize(histogram *hist, const liq_attr *options, const int fixed_colors_count, const f_pixel fixed_colors[], const double gamma, bool fixed_result_colors, liq_result **result_output) +{ + colormap *acolormap; + double palette_error = -1; + + assert((verbose_print(options, "SLOW debug checks enabled. Recompile with NDEBUG for normal operation."),1)); + + const bool few_input_colors = hist->size+fixed_colors_count <= options->max_colors; + + if (liq_progress(options, options->progress_stage1)) return LIQ_ABORTED; + + // If image has few colors to begin with (and no quality degradation is required) + // then it's possible to skip quantization entirely + if (few_input_colors && options->target_mse == 0) { + colormap *hist_pal = histogram_to_palette(hist, options->malloc, options->free); + acolormap = add_fixed_colors_to_palette(hist_pal, options->max_colors, fixed_colors, fixed_colors_count, options->malloc, options->free); + palette_error = 0; + } else { + const double max_mse = options->max_mse * (few_input_colors ? 0.33 : 1.0); // when degrading image that's already paletted, require much higher improvement, since pal2pal often looks bad and there's little gain + acolormap = find_best_palette(hist, options, max_mse, fixed_colors, fixed_colors_count, &palette_error); + if (!acolormap) { + return LIQ_VALUE_OUT_OF_RANGE; + } + + // K-Means iteration approaches local minimum for the palette + double iteration_limit = options->kmeans_iteration_limit; + unsigned int iterations = options->kmeans_iterations; + + if (!iterations && palette_error < 0 && max_mse < MAX_DIFF) iterations = 1; // otherwise total error is never calculated and MSE limit won't work + + if (iterations) { + // likely_colormap_index (used and set in kmeans_do_iteration) can't point to index outside colormap + hist_reset_colors(hist, acolormap->colors); + + if (hist->size > 5000) {iterations = (iterations*3 + 3)/4;} + if (hist->size > 25000) {iterations = (iterations*3 + 3)/4;} + if (hist->size > 50000) {iterations = (iterations*3 + 3)/4;} + if (hist->size > 100000) {iterations = (iterations*3 + 3)/4; iteration_limit *= 2;} + + verbose_print(options, " moving colormap towards local minimum"); + + double previous_palette_error = MAX_DIFF; + + for(unsigned int i=0; i < iterations; i++) { + palette_error = kmeans_do_iteration(hist, acolormap, NULL, omp_get_max_threads()); + + if (liq_progress(options, options->progress_stage1 + options->progress_stage2 + (i * options->progress_stage3 * 0.9f) / iterations)) { + break; + } + + if (fabs(previous_palette_error-palette_error) < iteration_limit) { + break; + } + + if (palette_error > max_mse*1.5) { // probably hopeless + if (palette_error > max_mse*3.0) break; // definitely hopeless + i++; + } + + previous_palette_error = palette_error; + } + } + + if (palette_error > max_mse) { + liq_verbose_printf(options, " image degradation MSE=%.3f (Q=%d) exceeded limit of %.3f (%d)", + mse_to_standard_mse(palette_error), mse_to_quality(palette_error), + mse_to_standard_mse(max_mse), mse_to_quality(max_mse)); + pam_freecolormap(acolormap); + return LIQ_QUALITY_TOO_LOW; + } + } + + if (liq_progress(options, options->progress_stage1 + options->progress_stage2 + options->progress_stage3 * 0.95f)) { + pam_freecolormap(acolormap); + return LIQ_ABORTED; + } + + sort_palette(acolormap, options); + + // If palette was created from a multi-image histogram, + // then it shouldn't be optimized for one image during remapping + if (fixed_result_colors) { + for(unsigned int i=0; i < acolormap->colors; i++) { + acolormap->palette[i].fixed = true; + } + } + + liq_result *result = options->malloc(sizeof(liq_result)); + if (!result) return LIQ_OUT_OF_MEMORY; + *result = (liq_result){ + .magic_header = liq_result_magic, + .malloc = options->malloc, + .free = options->free, + .palette = acolormap, + .palette_error = palette_error, + .use_dither_map = options->use_dither_map, + .gamma = gamma, + .min_posterization_output = options->min_posterization_output, + }; + *result_output = result; + return LIQ_OK; +} + +LIQ_EXPORT LIQ_NONNULL liq_error liq_write_remapped_image(liq_result *result, liq_image *input_image, void *buffer, size_t buffer_size) +{ + if (!CHECK_STRUCT_TYPE(result, liq_result)) { + return LIQ_INVALID_POINTER; + } + if (!CHECK_STRUCT_TYPE(input_image, liq_image)) { + return LIQ_INVALID_POINTER; + } + if (!CHECK_USER_POINTER(buffer)) { + return LIQ_INVALID_POINTER; + } + + const size_t required_size = (size_t)input_image->width * (size_t)input_image->height; + if (buffer_size < required_size) { + return LIQ_BUFFER_TOO_SMALL; + } + + unsigned char **rows = input_image->malloc(input_image->height * sizeof(unsigned char *)); + unsigned char *buffer_bytes = buffer; + for(unsigned int i=0; i < input_image->height; i++) { + rows[i] = &buffer_bytes[input_image->width * i]; + } + + liq_error err = liq_write_remapped_image_rows(result, input_image, rows); + input_image->free(rows); + return err; +} + +LIQ_EXPORT LIQ_NONNULL liq_error liq_write_remapped_image_rows(liq_result *quant, liq_image *input_image, unsigned char **row_pointers) +{ + if (!CHECK_STRUCT_TYPE(quant, liq_result)) return LIQ_INVALID_POINTER; + if (!CHECK_STRUCT_TYPE(input_image, liq_image)) return LIQ_INVALID_POINTER; + for(unsigned int i=0; i < input_image->height; i++) { + if (!CHECK_USER_POINTER(row_pointers+i) || !CHECK_USER_POINTER(row_pointers[i])) return LIQ_INVALID_POINTER; + } + + if (quant->remapping) { + liq_remapping_result_destroy(quant->remapping); + } + liq_remapping_result *const result = quant->remapping = liq_remapping_result_create(quant); + if (!result) return LIQ_OUT_OF_MEMORY; + + if (!input_image->edges && !input_image->dither_map && quant->use_dither_map) { + contrast_maps(input_image); + } + + if (liq_remap_progress(result, result->progress_stage1 * 0.25f)) { + return LIQ_ABORTED; + } + + /* + ** Step 4: map the colors in the image to their closest match in the + ** new colormap, and write 'em out. + */ + + float remapping_error = result->palette_error; + if (result->dither_level == 0) { + set_rounded_palette(&result->int_palette, result->palette, result->gamma, quant->min_posterization_output); + remapping_error = remap_to_palette(input_image, row_pointers, result->palette); + } else { + const bool is_image_huge = (input_image->width * input_image->height) > 2000 * 2000; + const bool allow_dither_map = result->use_dither_map == 2 || (!is_image_huge && result->use_dither_map); + const bool generate_dither_map = allow_dither_map && (input_image->edges && !input_image->dither_map); + if (generate_dither_map) { + // If dithering (with dither map) is required, this image is used to find areas that require dithering + remapping_error = remap_to_palette(input_image, row_pointers, result->palette); + update_dither_map(input_image, row_pointers, result->palette); + } + + if (liq_remap_progress(result, result->progress_stage1 * 0.5f)) { + return LIQ_ABORTED; + } + + // remapping above was the last chance to do K-Means iteration, hence the final palette is set after remapping + set_rounded_palette(&result->int_palette, result->palette, result->gamma, quant->min_posterization_output); + + if (!remap_to_palette_floyd(input_image, row_pointers, result, MAX(remapping_error*2.4f, 8.f/256.f), generate_dither_map)) { + return LIQ_ABORTED; + } + } + + // remapping error from dithered image is absurd, so always non-dithered value is used + // palette_error includes some perceptual weighting from histogram which is closer correlated with dssim + // so that should be used when possible. + if (result->palette_error < 0) { + result->palette_error = remapping_error; + } + + return LIQ_OK; +} + +LIQ_EXPORT int liq_version() { + return LIQ_VERSION; +} diff --git a/tools/assets/n64texconv/lib/libimagequant/libimagequant.h b/tools/assets/n64texconv/lib/libimagequant/libimagequant.h new file mode 100644 index 0000000000..e4763ab38a --- /dev/null +++ b/tools/assets/n64texconv/lib/libimagequant/libimagequant.h @@ -0,0 +1,151 @@ +/* + * https://pngquant.org + */ + +#ifndef LIBIMAGEQUANT_H +#define LIBIMAGEQUANT_H + +#ifdef IMAGEQUANT_EXPORTS +#define LIQ_EXPORT __declspec(dllexport) +#endif + +#ifndef LIQ_EXPORT +#define LIQ_EXPORT extern +#endif + +#define LIQ_VERSION 21800 +#define LIQ_VERSION_STRING "2.18.0" + +#ifndef LIQ_PRIVATE +#if defined(__GNUC__) || defined (__llvm__) +#define LIQ_PRIVATE __attribute__((visibility("hidden"))) +#define LIQ_NONNULL __attribute__((nonnull)) +#define LIQ_USERESULT __attribute__((warn_unused_result)) +#else +#define LIQ_PRIVATE +#define LIQ_NONNULL +#define LIQ_USERESULT +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +typedef struct liq_attr liq_attr; +typedef struct liq_image liq_image; +typedef struct liq_result liq_result; +typedef struct liq_histogram liq_histogram; + +typedef struct liq_color { + unsigned char r, g, b, a; +} liq_color; + +typedef struct liq_palette { + unsigned int count; + liq_color entries[256]; +} liq_palette; + +typedef enum liq_error { + LIQ_OK = 0, + LIQ_QUALITY_TOO_LOW = 99, + LIQ_VALUE_OUT_OF_RANGE = 100, + LIQ_OUT_OF_MEMORY, + LIQ_ABORTED, + LIQ_BITMAP_NOT_AVAILABLE, + LIQ_BUFFER_TOO_SMALL, + LIQ_INVALID_POINTER, + LIQ_UNSUPPORTED, +} liq_error; + +enum liq_ownership { + LIQ_OWN_ROWS=4, + LIQ_OWN_PIXELS=8, + LIQ_COPY_PIXELS=16, +}; + +typedef struct liq_histogram_entry { + liq_color color; + unsigned int count; +} liq_histogram_entry; + +LIQ_EXPORT LIQ_USERESULT liq_attr* liq_attr_create(void); +LIQ_EXPORT LIQ_USERESULT liq_attr* liq_attr_create_with_allocator(void* (*malloc)(size_t), void (*free)(void*)); +LIQ_EXPORT LIQ_USERESULT liq_attr* liq_attr_copy(const liq_attr *orig) LIQ_NONNULL; +LIQ_EXPORT void liq_attr_destroy(liq_attr *attr) LIQ_NONNULL; + +LIQ_EXPORT LIQ_USERESULT liq_histogram* liq_histogram_create(const liq_attr* attr); +LIQ_EXPORT liq_error liq_histogram_add_image(liq_histogram *hist, const liq_attr *attr, liq_image* image) LIQ_NONNULL; +LIQ_EXPORT liq_error liq_histogram_add_colors(liq_histogram *hist, const liq_attr *attr, const liq_histogram_entry entries[], int num_entries, double gamma) LIQ_NONNULL; +LIQ_EXPORT liq_error liq_histogram_add_fixed_color(liq_histogram *hist, liq_color color, double gamma) LIQ_NONNULL; +LIQ_EXPORT void liq_histogram_destroy(liq_histogram *hist) LIQ_NONNULL; + +LIQ_EXPORT liq_error liq_set_max_colors(liq_attr* attr, int colors) LIQ_NONNULL; +LIQ_EXPORT LIQ_USERESULT int liq_get_max_colors(const liq_attr* attr) LIQ_NONNULL; +LIQ_EXPORT liq_error liq_set_speed(liq_attr* attr, int speed) LIQ_NONNULL; +LIQ_EXPORT LIQ_USERESULT int liq_get_speed(const liq_attr* attr) LIQ_NONNULL; +LIQ_EXPORT liq_error liq_set_min_opacity(liq_attr* attr, int min) LIQ_NONNULL; +LIQ_EXPORT LIQ_USERESULT int liq_get_min_opacity(const liq_attr* attr) LIQ_NONNULL; +LIQ_EXPORT liq_error liq_set_min_posterization(liq_attr* attr, int bits) LIQ_NONNULL; +LIQ_EXPORT LIQ_USERESULT int liq_get_min_posterization(const liq_attr* attr) LIQ_NONNULL; +LIQ_EXPORT liq_error liq_set_quality(liq_attr* attr, int minimum, int maximum) LIQ_NONNULL; +LIQ_EXPORT LIQ_USERESULT int liq_get_min_quality(const liq_attr* attr) LIQ_NONNULL; +LIQ_EXPORT LIQ_USERESULT int liq_get_max_quality(const liq_attr* attr) LIQ_NONNULL; +LIQ_EXPORT void liq_set_last_index_transparent(liq_attr* attr, int is_last) LIQ_NONNULL; + +typedef void liq_log_callback_function(const liq_attr*, const char *message, void* user_info); +typedef void liq_log_flush_callback_function(const liq_attr*, void* user_info); +LIQ_EXPORT void liq_set_log_callback(liq_attr*, liq_log_callback_function*, void* user_info); +LIQ_EXPORT void liq_set_log_flush_callback(liq_attr*, liq_log_flush_callback_function*, void* user_info); + +typedef int liq_progress_callback_function(float progress_percent, void* user_info); +LIQ_EXPORT void liq_attr_set_progress_callback(liq_attr*, liq_progress_callback_function*, void* user_info); +LIQ_EXPORT void liq_result_set_progress_callback(liq_result*, liq_progress_callback_function*, void* user_info); + +// The rows and their data are not modified. The type of `rows` is non-const only due to a bug in C's typesystem design. +LIQ_EXPORT LIQ_USERESULT liq_image *liq_image_create_rgba_rows(const liq_attr *attr, void *const rows[], int width, int height, double gamma) LIQ_NONNULL; +LIQ_EXPORT LIQ_USERESULT liq_image *liq_image_create_rgba(const liq_attr *attr, const void *bitmap, int width, int height, double gamma) LIQ_NONNULL; + +typedef void liq_image_get_rgba_row_callback(liq_color row_out[], int row, int width, void* user_info); +LIQ_EXPORT LIQ_USERESULT liq_image *liq_image_create_custom(const liq_attr *attr, liq_image_get_rgba_row_callback *row_callback, void* user_info, int width, int height, double gamma); + +LIQ_EXPORT liq_error liq_image_set_memory_ownership(liq_image *image, int ownership_flags) LIQ_NONNULL; +LIQ_EXPORT liq_error liq_image_set_background(liq_image *img, liq_image *background_image) LIQ_NONNULL; +LIQ_EXPORT liq_error liq_image_set_importance_map(liq_image *img, unsigned char buffer[], size_t buffer_size, enum liq_ownership memory_handling) LIQ_NONNULL; +LIQ_EXPORT liq_error liq_image_add_fixed_color(liq_image *img, liq_color color) LIQ_NONNULL; +LIQ_EXPORT LIQ_USERESULT int liq_image_get_width(const liq_image *img) LIQ_NONNULL; +LIQ_EXPORT LIQ_USERESULT int liq_image_get_height(const liq_image *img) LIQ_NONNULL; +LIQ_EXPORT void liq_image_destroy(liq_image *img) LIQ_NONNULL; + +LIQ_EXPORT LIQ_USERESULT liq_error liq_histogram_quantize(liq_histogram *const input_hist, liq_attr *const options, liq_result **result_output) LIQ_NONNULL; +LIQ_EXPORT LIQ_USERESULT liq_error liq_image_quantize(liq_image *const input_image, liq_attr *const options, liq_result **result_output) LIQ_NONNULL; + +LIQ_EXPORT liq_error liq_set_dithering_level(liq_result *res, float dither_level) LIQ_NONNULL; +LIQ_EXPORT liq_error liq_set_output_gamma(liq_result* res, double gamma) LIQ_NONNULL; +LIQ_EXPORT LIQ_USERESULT double liq_get_output_gamma(const liq_result *result) LIQ_NONNULL; + +LIQ_EXPORT LIQ_USERESULT const liq_palette *liq_get_palette(liq_result *result) LIQ_NONNULL; + +LIQ_EXPORT liq_error liq_write_remapped_image(liq_result *result, liq_image *input_image, void *buffer, size_t buffer_size) LIQ_NONNULL; +LIQ_EXPORT liq_error liq_write_remapped_image_rows(liq_result *result, liq_image *input_image, unsigned char **row_pointers) LIQ_NONNULL; + +LIQ_EXPORT double liq_get_quantization_error(const liq_result *result) LIQ_NONNULL; +LIQ_EXPORT int liq_get_quantization_quality(const liq_result *result) LIQ_NONNULL; +LIQ_EXPORT double liq_get_remapping_error(const liq_result *result) LIQ_NONNULL; +LIQ_EXPORT int liq_get_remapping_quality(const liq_result *result) LIQ_NONNULL; + +LIQ_EXPORT void liq_result_destroy(liq_result *) LIQ_NONNULL; + +LIQ_EXPORT int liq_version(void); + + +// Deprecated +LIQ_EXPORT LIQ_USERESULT liq_result *liq_quantize_image(liq_attr *options, liq_image *input_image) LIQ_NONNULL; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/tools/assets/n64texconv/lib/libimagequant/libimagequant_private.h b/tools/assets/n64texconv/lib/libimagequant/libimagequant_private.h new file mode 100644 index 0000000000..50e2c18a33 --- /dev/null +++ b/tools/assets/n64texconv/lib/libimagequant/libimagequant_private.h @@ -0,0 +1,50 @@ +#ifdef _OPENMP +#include +#define LIQ_TEMP_ROW_WIDTH(img_width) (((img_width) | 15) + 1) /* keep alignment & leave space between rows to avoid cache line contention */ +#else +#define LIQ_TEMP_ROW_WIDTH(img_width) (img_width) +#define omp_get_max_threads() 1 +#define omp_get_thread_num() 0 +#endif + +struct liq_image { + const char *magic_header; + void* (*malloc)(size_t); + void (*free)(void*); + + f_pixel *f_pixels; + liq_color **rows; + double gamma; + unsigned int width, height; + unsigned char *importance_map, *edges, *dither_map; + liq_color *pixels, *temp_row; + f_pixel *temp_f_row; + liq_image_get_rgba_row_callback *row_callback; + void *row_callback_user_info; + liq_image *background; + f_pixel fixed_colors[256]; + unsigned short fixed_colors_count; + bool free_pixels, free_rows, free_rows_internal; +}; + +typedef struct liq_remapping_result { + const char *magic_header; + void* (*malloc)(size_t); + void (*free)(void*); + + unsigned char *pixels; + colormap *palette; + liq_progress_callback_function *progress_callback; + void *progress_callback_user_info; + + liq_palette int_palette; + double gamma, palette_error; + float dither_level; + unsigned char use_dither_map; + unsigned char progress_stage1; +} liq_remapping_result; + + +LIQ_PRIVATE bool liq_image_get_row_f_init(liq_image *img) LIQ_NONNULL; +LIQ_PRIVATE const f_pixel *liq_image_get_row_f(liq_image *input_image, unsigned int row) LIQ_NONNULL; +LIQ_PRIVATE bool liq_remap_progress(const liq_remapping_result *quant, const float percent) LIQ_NONNULL; diff --git a/tools/assets/n64texconv/lib/libimagequant/mediancut.c b/tools/assets/n64texconv/lib/libimagequant/mediancut.c new file mode 100644 index 0000000000..cc241b8582 --- /dev/null +++ b/tools/assets/n64texconv/lib/libimagequant/mediancut.c @@ -0,0 +1,476 @@ +/* +** © 2009-2018 by Kornel Lesiński. +** © 1989, 1991 by Jef Poskanzer. +** © 1997, 2000, 2002 by Greg Roelofs; based on an idea by Stefan Schneider. +** +** See COPYRIGHT file for license. +*/ + +#include +#include + +#include "libimagequant.h" +#include "pam.h" +#include "mediancut.h" + +#define index_of_channel(ch) (offsetof(f_pixel,ch)/sizeof(float)) + +static f_pixel averagepixels(unsigned int clrs, const hist_item achv[]); + +struct box { + f_pixel color; + f_pixel variance; + double sum, total_error, max_error; + unsigned int ind; + unsigned int colors; +}; + +/** Weighted per-channel variance of the box. It's used to decide which channel to split by */ +static f_pixel box_variance(const hist_item achv[], const struct box *box) +{ + const f_pixel mean = box->color; + double variancea=0, variancer=0, varianceg=0, varianceb=0; + + for(unsigned int i = 0; i < box->colors; ++i) { + const f_pixel px = achv[box->ind + i].acolor; + double weight = achv[box->ind + i].adjusted_weight; + variancea += (mean.a - px.a)*(mean.a - px.a)*weight; + variancer += (mean.r - px.r)*(mean.r - px.r)*weight; + varianceg += (mean.g - px.g)*(mean.g - px.g)*weight; + varianceb += (mean.b - px.b)*(mean.b - px.b)*weight; + } + + return (f_pixel){ + .a = variancea, + .r = variancer, + .g = varianceg, + .b = varianceb, + }; +} + +static double box_max_error(const hist_item achv[], const struct box *box) +{ + f_pixel mean = box->color; + double max_error = 0; + + for(unsigned int i = 0; i < box->colors; ++i) { + const double diff = colordifference(mean, achv[box->ind + i].acolor); + if (diff > max_error) { + max_error = diff; + } + } + return max_error; +} + +ALWAYS_INLINE static double color_weight(f_pixel median, hist_item h); + +static inline void hist_item_swap(hist_item *l, hist_item *r) +{ + if (l != r) { + hist_item t = *l; + *l = *r; + *r = t; + } +} + +ALWAYS_INLINE static unsigned int qsort_pivot(const hist_item *const base, const unsigned int len); +inline static unsigned int qsort_pivot(const hist_item *const base, const unsigned int len) +{ + if (len < 32) { + return len/2; + } + + const unsigned int aidx=8, bidx=len/2, cidx=len-1; + const unsigned int a=base[aidx].tmp.sort_value, b=base[bidx].tmp.sort_value, c=base[cidx].tmp.sort_value; + return (a < b) ? ((b < c) ? bidx : ((a < c) ? cidx : aidx )) + : ((b > c) ? bidx : ((a < c) ? aidx : cidx )); +} + +ALWAYS_INLINE static unsigned int qsort_partition(hist_item *const base, const unsigned int len); +inline static unsigned int qsort_partition(hist_item *const base, const unsigned int len) +{ + unsigned int l = 1, r = len; + if (len >= 8) { + hist_item_swap(&base[0], &base[qsort_pivot(base,len)]); + } + + const unsigned int pivot_value = base[0].tmp.sort_value; + while (l < r) { + if (base[l].tmp.sort_value >= pivot_value) { + l++; + } else { + while(l < --r && base[r].tmp.sort_value <= pivot_value) {} + hist_item_swap(&base[l], &base[r]); + } + } + l--; + hist_item_swap(&base[0], &base[l]); + + return l; +} + +/** quick select algorithm */ +static void hist_item_sort_range(hist_item base[], unsigned int len, unsigned int sort_start) +{ + for(;;) { + const unsigned int l = qsort_partition(base, len), r = l+1; + + if (l > 0 && sort_start < l) { + len = l; + } + else if (r < len && sort_start > r) { + base += r; len -= r; sort_start -= r; + } + else break; + } +} + +/** sorts array to make sum of weights lower than halfvar one side, returns index of the edge between halfvar parts of the set */ +static unsigned int hist_item_sort_halfvar(hist_item base[], unsigned int len, double halfvar) +{ + unsigned int base_idx = 0; // track base-index + do { + const unsigned int l = qsort_partition(base, len), r = l+1; + + // check if sum of left side is smaller than half, + // if it is, then it doesn't need to be sorted + double tmpsum = 0.; + for(unsigned int t = 0; t <= l && tmpsum < halfvar; ++t) tmpsum += base[t].color_weight; + + // the split is on the left part + if (tmpsum >= halfvar) { + if (l > 0) { + len = l; + continue; + } else { + // reached the end of left part + return base_idx; + } + } + // process the right part + halfvar -= tmpsum; + if (len > r) { + base += r; + base_idx += r; + len -= r; // tail-recursive "call" + } else { + // reached the end of the right part + return base_idx + len; + } + } while(1); +} + +static f_pixel get_median(const struct box *b, hist_item achv[]); + +typedef struct { + unsigned int chan; float variance; +} channelvariance; + +static int comparevariance(const void *ch1, const void *ch2) +{ + return ((const channelvariance*)ch1)->variance > ((const channelvariance*)ch2)->variance ? -1 : + (((const channelvariance*)ch1)->variance < ((const channelvariance*)ch2)->variance ? 1 : 0); +} + +/** Finds which channels need to be sorted first and preproceses achv for fast sort */ +static double prepare_sort(struct box *b, hist_item achv[]) +{ + /* + ** Sort dimensions by their variance, and then sort colors first by dimension with highest variance + */ + channelvariance channels[4] = { + {index_of_channel(a), b->variance.a}, + {index_of_channel(r), b->variance.r}, + {index_of_channel(g), b->variance.g}, + {index_of_channel(b), b->variance.b}, + }; + + qsort(channels, 4, sizeof(channels[0]), comparevariance); + + const unsigned int ind1 = b->ind; + const unsigned int colors = b->colors; +#if __GNUC__ >= 9 || __clang__ + #pragma omp parallel for if (colors > 25000) \ + schedule(static) default(none) shared(achv, channels, colors, ind1) +#else + #pragma omp parallel for if (colors > 25000) \ + schedule(static) default(none) shared(achv, channels) +#endif + for(unsigned int i=0; i < colors; i++) { + const float *chans = (const float *)&achv[ind1 + i].acolor; + // Only the first channel really matters. When trying median cut many times + // with different histogram weights, I don't want sort randomness to influence outcome. + achv[ind1 + i].tmp.sort_value = ((unsigned int)(chans[channels[0].chan]*65535.0)<<16) | + (unsigned int)((chans[channels[2].chan] + chans[channels[1].chan]/2.0 + chans[channels[3].chan]/4.0)*65535.0); + } + + const f_pixel median = get_median(b, achv); + + // box will be split to make color_weight of each side even + const unsigned int ind = b->ind, end = ind+b->colors; + double totalvar = 0; + #pragma omp parallel for if (end - ind > 15000) \ + schedule(static) default(shared) reduction(+:totalvar) + for(unsigned int j=ind; j < end; j++) totalvar += (achv[j].color_weight = color_weight(median, achv[j])); + return totalvar / 2.0; +} + +/** finds median in unsorted set by sorting only minimum required */ +static f_pixel get_median(const struct box *b, hist_item achv[]) +{ + const unsigned int median_start = (b->colors-1)/2; + + hist_item_sort_range(&(achv[b->ind]), b->colors, + median_start); + + if (b->colors&1) return achv[b->ind + median_start].acolor; + + // technically the second color is not guaranteed to be sorted correctly + // but most of the time it is good enough to be useful + return averagepixels(2, &achv[b->ind + median_start]); +} + +/* + ** Find the best splittable box. -1 if no boxes are splittable. + */ +static int best_splittable_box(struct box bv[], unsigned int boxes, const double max_mse) +{ + int bi=-1; double maxsum=0; + for(unsigned int i=0; i < boxes; i++) { + if (bv[i].colors < 2) { + continue; + } + + // looks only at max variance, because it's only going to split by it + const double cv = MAX(bv[i].variance.r, MAX(bv[i].variance.g,bv[i].variance.b)); + double thissum = bv[i].sum * MAX(bv[i].variance.a, cv); + + if (bv[i].max_error > max_mse) { + thissum = thissum* bv[i].max_error/max_mse; + } + + if (thissum > maxsum) { + maxsum = thissum; + bi = i; + } + } + return bi; +} + +inline static double color_weight(f_pixel median, hist_item h) +{ + float diff = colordifference(median, h.acolor); + return sqrt(diff) * (sqrt(1.0+h.adjusted_weight)-1.0); +} + +static void set_colormap_from_boxes(colormap *map, struct box bv[], unsigned int boxes, hist_item *achv); +static void adjust_histogram(hist_item *achv, const struct box bv[], unsigned int boxes); + +static double box_error(const struct box *box, const hist_item achv[]) +{ + f_pixel avg = box->color; + + double total_error=0; + for (unsigned int i = 0; i < box->colors; ++i) { + total_error += colordifference(avg, achv[box->ind + i].acolor) * achv[box->ind + i].perceptual_weight; + } + + return total_error; +} + + +static bool total_box_error_below_target(double target_mse, struct box bv[], unsigned int boxes, const histogram *hist) +{ + target_mse *= hist->total_perceptual_weight; + double total_error=0; + + for(unsigned int i=0; i < boxes; i++) { + // error is (re)calculated lazily + if (bv[i].total_error >= 0) { + total_error += bv[i].total_error; + } + if (total_error > target_mse) return false; + } + + for(unsigned int i=0; i < boxes; i++) { + if (bv[i].total_error < 0) { + bv[i].total_error = box_error(&bv[i], hist->achv); + total_error += bv[i].total_error; + } + if (total_error > target_mse) return false; + } + + return true; +} + +static void box_init(struct box *box, const hist_item *achv, const unsigned int ind, const unsigned int colors, const double sum) { + assert(colors > 0); + assert(sum > 0); + + box->ind = ind; + box->colors = colors; + box->sum = sum; + box->total_error = -1; + + box->color = averagepixels(colors, &achv[ind]); + box->variance = box_variance(achv, box); + box->max_error = box_max_error(achv, box); +} + +/* + ** Here is the fun part, the median-cut colormap generator. This is based + ** on Paul Heckbert's paper, "Color Image Quantization for Frame Buffer + ** Display," SIGGRAPH 1982 Proceedings, page 297. + */ +LIQ_PRIVATE colormap *mediancut(histogram *hist, unsigned int newcolors, const double target_mse, const double max_mse, void* (*malloc)(size_t), void (*free)(void*)) +{ + hist_item *achv = hist->achv; + struct box bv[newcolors+16]; + + assert(hist->boxes[0].begin == 0); + assert(hist->boxes[LIQ_MAXCLUSTER-1].end == hist->size); + + unsigned int boxes = 0; + for(int b=0; b < LIQ_MAXCLUSTER; b++) { + int begin = hist->boxes[b].begin; + int end = hist->boxes[b].end; + if (begin == end) { + continue; + } + + if (boxes >= newcolors/3) { + boxes = 0; + begin = 0; + end = hist->boxes[LIQ_MAXCLUSTER-1].end; + b = LIQ_MAXCLUSTER; + } + + double sum = 0; + for(int i=begin; i < end; i++) { + sum += achv[i].adjusted_weight; + } + box_init(&bv[boxes], achv, begin, end-begin, sum); + boxes++; + } + + assert(boxes < newcolors); + + + /* + ** Main loop: split boxes until we have enough. + */ + while (boxes < newcolors) { + + // first splits boxes that exceed quality limit (to have colors for things like odd green pixel), + // later raises the limit to allow large smooth areas/gradients get colors. + const double current_max_mse = max_mse + (boxes/(double)newcolors)*16.0*max_mse; + const int bi = best_splittable_box(bv, boxes, current_max_mse); + if (bi < 0) { + break; /* ran out of colors! */ + } + + unsigned int indx = bv[bi].ind; + unsigned int clrs = bv[bi].colors; + + /* + Classic implementation tries to get even number of colors or pixels in each subdivision. + + Here, instead of popularity I use (sqrt(popularity)*variance) metric. + Each subdivision balances number of pixels (popular colors) and low variance - + boxes can be large if they have similar colors. Later boxes with high variance + will be more likely to be split. + + Median used as expected value gives much better results than mean. + */ + + const double halfvar = prepare_sort(&bv[bi], achv); + + // hist_item_sort_halfvar sorts and sums lowervar at the same time + // returns item to break at …minus one, which does smell like an off-by-one error. + unsigned int break_at = hist_item_sort_halfvar(&achv[indx], clrs, halfvar); + break_at = MIN(clrs-1, break_at + 1); + + /* + ** Split the box. + */ + double sm = bv[bi].sum; + double lowersum = 0; + for(unsigned int i=0; i < break_at; i++) lowersum += achv[indx + i].adjusted_weight; + + box_init(&bv[bi], achv, indx, break_at, lowersum); + box_init(&bv[boxes], achv, indx + break_at, clrs - break_at, sm - lowersum); + + ++boxes; + + if (total_box_error_below_target(target_mse, bv, boxes, hist)) { + break; + } + } + + colormap *map = pam_colormap(boxes, malloc, free); + set_colormap_from_boxes(map, bv, boxes, achv); + + adjust_histogram(achv, bv, boxes); + + return map; +} + +static void set_colormap_from_boxes(colormap *map, struct box* bv, unsigned int boxes, hist_item *achv) +{ + /* + ** Ok, we've got enough boxes. Now choose a representative color for + ** each box. There are a number of possible ways to make this choice. + ** One would be to choose the center of the box; this ignores any structure + ** within the boxes. Another method would be to average all the colors in + ** the box - this is the method specified in Heckbert's paper. + */ + + for(unsigned int bi = 0; bi < boxes; ++bi) { + map->palette[bi].acolor = bv[bi].color; + + /* store total color popularity (perceptual_weight is approximation of it) */ + map->palette[bi].popularity = 0; + for(unsigned int i=bv[bi].ind; i < bv[bi].ind+bv[bi].colors; i++) { + map->palette[bi].popularity += achv[i].perceptual_weight; + } + } +} + +/* increase histogram popularity by difference from the final color (this is used as part of feedback loop) */ +static void adjust_histogram(hist_item *achv, const struct box* bv, unsigned int boxes) +{ + for(unsigned int bi = 0; bi < boxes; ++bi) { + for(unsigned int i=bv[bi].ind; i < bv[bi].ind+bv[bi].colors; i++) { + achv[i].tmp.likely_colormap_index = bi; + } + } +} + +static f_pixel averagepixels(unsigned int clrs, const hist_item achv[]) +{ + double r = 0, g = 0, b = 0, a = 0, sum = 0; + + #pragma omp parallel for if (clrs > 25000) \ + schedule(static) default(shared) reduction(+:a) reduction(+:r) reduction(+:g) reduction(+:b) reduction(+:sum) + for(unsigned int i = 0; i < clrs; i++) { + const f_pixel px = achv[i].acolor; + const double weight = achv[i].adjusted_weight; + + sum += weight; + a += px.a * weight; + r += px.r * weight; + g += px.g * weight; + b += px.b * weight; + } + + if (sum) { + a /= sum; + r /= sum; + g /= sum; + b /= sum; + } + + assert(!isnan(r) && !isnan(g) && !isnan(b) && !isnan(a)); + + return (f_pixel){.r=r, .g=g, .b=b, .a=a}; +} diff --git a/tools/assets/n64texconv/lib/libimagequant/mediancut.h b/tools/assets/n64texconv/lib/libimagequant/mediancut.h new file mode 100644 index 0000000000..9a4cb534b5 --- /dev/null +++ b/tools/assets/n64texconv/lib/libimagequant/mediancut.h @@ -0,0 +1,6 @@ +#ifndef MEDIANCUT_H +#define MEDIANCUT_H + +LIQ_PRIVATE colormap *mediancut(histogram *hist, unsigned int newcolors, const double target_mse, const double max_mse, void* (*malloc)(size_t), void (*free)(void*)); + +#endif diff --git a/tools/assets/n64texconv/lib/libimagequant/mempool.c b/tools/assets/n64texconv/lib/libimagequant/mempool.c new file mode 100644 index 0000000000..cd49f59a24 --- /dev/null +++ b/tools/assets/n64texconv/lib/libimagequant/mempool.c @@ -0,0 +1,70 @@ +/* +** © 2009-2017 by Kornel Lesiński. +** © 1989, 1991 by Jef Poskanzer. +** © 1997, 2000, 2002 by Greg Roelofs; based on an idea by Stefan Schneider. +** +** See COPYRIGHT file for license. +*/ + +#include "libimagequant.h" +#include "mempool.h" +#include +#include +#include + +#define ALIGN_MASK 15UL +#define MEMPOOL_RESERVED ((sizeof(struct mempool)+ALIGN_MASK) & ~ALIGN_MASK) + +struct mempool { + unsigned int used, size; + void* (*malloc)(size_t); + void (*free)(void*); + struct mempool *next; +}; +LIQ_PRIVATE void* mempool_create(mempoolptr *mptr, const unsigned int size, unsigned int max_size, void* (*malloc)(size_t), void (*free)(void*)) +{ + if (*mptr && ((*mptr)->used+size) <= (*mptr)->size) { + unsigned int prevused = (*mptr)->used; + (*mptr)->used += (size+15UL) & ~0xFUL; + return ((char*)(*mptr)) + prevused; + } + + mempoolptr old = *mptr; + if (!max_size) max_size = (1<<17); + max_size = size+ALIGN_MASK > max_size ? size+ALIGN_MASK : max_size; + + *mptr = malloc(MEMPOOL_RESERVED + max_size); + if (!*mptr) return NULL; + **mptr = (struct mempool){ + .malloc = malloc, + .free = free, + .size = MEMPOOL_RESERVED + max_size, + .used = sizeof(struct mempool), + .next = old, + }; + uintptr_t mptr_used_start = (uintptr_t)(*mptr) + (*mptr)->used; + (*mptr)->used += (ALIGN_MASK + 1 - (mptr_used_start & ALIGN_MASK)) & ALIGN_MASK; // reserve bytes required to make subsequent allocations aligned + assert(!(((uintptr_t)(*mptr) + (*mptr)->used) & ALIGN_MASK)); + + return mempool_alloc(mptr, size, size); +} + +LIQ_PRIVATE void* mempool_alloc(mempoolptr *mptr, const unsigned int size, const unsigned int max_size) +{ + if (((*mptr)->used+size) <= (*mptr)->size) { + unsigned int prevused = (*mptr)->used; + (*mptr)->used += (size + ALIGN_MASK) & ~ALIGN_MASK; + return ((char*)(*mptr)) + prevused; + } + + return mempool_create(mptr, size, max_size, (*mptr)->malloc, (*mptr)->free); +} + +LIQ_PRIVATE void mempool_destroy(mempoolptr m) +{ + while (m) { + mempoolptr next = m->next; + m->free(m); + m = next; + } +} diff --git a/tools/assets/n64texconv/lib/libimagequant/mempool.h b/tools/assets/n64texconv/lib/libimagequant/mempool.h new file mode 100644 index 0000000000..9b7333b117 --- /dev/null +++ b/tools/assets/n64texconv/lib/libimagequant/mempool.h @@ -0,0 +1,13 @@ +#ifndef MEMPOOL_H +#define MEMPOOL_H + +#include + +struct mempool; +typedef struct mempool *mempoolptr; + +LIQ_PRIVATE void* mempool_create(mempoolptr *mptr, const unsigned int size, unsigned int capacity, void* (*malloc)(size_t), void (*free)(void*)); +LIQ_PRIVATE void* mempool_alloc(mempoolptr *mptr, const unsigned int size, const unsigned int capacity); +LIQ_PRIVATE void mempool_destroy(mempoolptr m); + +#endif diff --git a/tools/assets/n64texconv/lib/libimagequant/nearest.c b/tools/assets/n64texconv/lib/libimagequant/nearest.c new file mode 100644 index 0000000000..7c8ee6af0a --- /dev/null +++ b/tools/assets/n64texconv/lib/libimagequant/nearest.c @@ -0,0 +1,230 @@ +/* +** © 2009-2015 by Kornel Lesiński. +** © 1989, 1991 by Jef Poskanzer. +** © 1997, 2000, 2002 by Greg Roelofs; based on an idea by Stefan Schneider. +** +** See COPYRIGHT file for license. +*/ + +#include "libimagequant.h" +#include "pam.h" +#include "nearest.h" +#include "mempool.h" +#include + +typedef struct vp_sort_tmp { + float distance_squared; + unsigned int idx; +} vp_sort_tmp; + +typedef struct vp_search_tmp { + float distance; + float distance_squared; + unsigned int idx; + int exclude; +} vp_search_tmp; + +struct leaf { + f_pixel color; + unsigned int idx; +}; + +typedef struct vp_node { + struct vp_node *near, *far; + f_pixel vantage_point; + float radius, radius_squared; + struct leaf *rest; + unsigned short idx; + unsigned short restcount; +} vp_node; + +struct nearest_map { + vp_node *root; + const colormap_item *palette; + float nearest_other_color_dist[256]; + mempoolptr mempool; +}; + +static void vp_search_node(const vp_node *node, const f_pixel *const needle, vp_search_tmp *const best_candidate); + +static int vp_compare_distance(const void *ap, const void *bp) { + float a = ((const vp_sort_tmp*)ap)->distance_squared; + float b = ((const vp_sort_tmp*)bp)->distance_squared; + return a > b ? 1 : -1; +} + +static void vp_sort_indexes_by_distance(const f_pixel vantage_point, vp_sort_tmp indexes[], int num_indexes, const colormap_item items[]) { + for(int i=0; i < num_indexes; i++) { + indexes[i].distance_squared = colordifference(vantage_point, items[indexes[i].idx].acolor); + } + qsort(indexes, num_indexes, sizeof(indexes[0]), vp_compare_distance); +} + +/* + * Usually it should pick farthest point, but picking most popular point seems to make search quicker anyway + */ +static int vp_find_best_vantage_point_index(vp_sort_tmp indexes[], int num_indexes, const colormap_item items[]) { + int best = 0; + float best_popularity = items[indexes[0].idx].popularity; + for(int i = 1; i < num_indexes; i++) { + if (items[indexes[i].idx].popularity > best_popularity) { + best_popularity = items[indexes[i].idx].popularity; + best = i; + } + } + return best; +} + +static vp_node *vp_create_node(mempoolptr *m, vp_sort_tmp indexes[], int num_indexes, const colormap_item items[]) { + if (num_indexes <= 0) { + return NULL; + } + + vp_node *node = mempool_alloc(m, sizeof(node[0]), 0); + + if (num_indexes == 1) { + *node = (vp_node){ + .vantage_point = items[indexes[0].idx].acolor, + .idx = indexes[0].idx, + .radius = MAX_DIFF, + .radius_squared = MAX_DIFF, + }; + return node; + } + + const int ref = vp_find_best_vantage_point_index(indexes, num_indexes, items); + const int ref_idx = indexes[ref].idx; + + // Removes the `ref_idx` item from remaining items, because it's included in the current node + num_indexes -= 1; + indexes[ref] = indexes[num_indexes]; + + vp_sort_indexes_by_distance(items[ref_idx].acolor, indexes, num_indexes, items); + + // Remaining items are split by the median distance + const int half_idx = num_indexes/2; + + *node = (vp_node){ + .vantage_point = items[ref_idx].acolor, + .idx = ref_idx, + .radius = sqrtf(indexes[half_idx].distance_squared), + .radius_squared = indexes[half_idx].distance_squared, + }; + if (num_indexes < 7) { + node->rest = mempool_alloc(m, sizeof(node->rest[0]) * num_indexes, 0); + node->restcount = num_indexes; + for(int i=0; i < num_indexes; i++) { + node->rest[i].idx = indexes[i].idx; + node->rest[i].color = items[indexes[i].idx].acolor; + } + } else { + node->near = vp_create_node(m, indexes, half_idx, items); + node->far = vp_create_node(m, &indexes[half_idx], num_indexes - half_idx, items); + } + + return node; +} + +LIQ_PRIVATE struct nearest_map *nearest_init(const colormap *map) { + mempoolptr m = NULL; + struct nearest_map *handle = mempool_create(&m, sizeof(handle[0]), sizeof(handle[0]) + sizeof(vp_node)*map->colors+16, map->malloc, map->free); + + LIQ_ARRAY(vp_sort_tmp, indexes, map->colors); + + for(unsigned int i=0; i < map->colors; i++) { + indexes[i].idx = i; + } + + vp_node *root = vp_create_node(&m, indexes, map->colors, map->palette); + *handle = (struct nearest_map){ + .root = root, + .palette = map->palette, + .mempool = m, + }; + + for(unsigned int i=0; i < map->colors; i++) { + vp_search_tmp best = { + .distance = MAX_DIFF, + .distance_squared = MAX_DIFF, + .exclude = i, + }; + vp_search_node(root, &map->palette[i].acolor, &best); + handle->nearest_other_color_dist[i] = best.distance * best.distance / 4.f; // half of squared distance + } + + return handle; +} + +static void vp_search_node(const vp_node *node, const f_pixel *const needle, vp_search_tmp *const best_candidate) { + do { + const float distance_squared = colordifference(node->vantage_point, *needle); + const float distance = sqrtf(distance_squared); + + if (distance_squared < best_candidate->distance_squared && best_candidate->exclude != node->idx) { + best_candidate->distance = distance; + best_candidate->distance_squared = distance_squared; + best_candidate->idx = node->idx; + } + + if (node->restcount) { + for(int i=0; i < node->restcount; i++) { + const float distance_squared = colordifference(node->rest[i].color, *needle); + if (distance_squared < best_candidate->distance_squared && best_candidate->exclude != node->rest[i].idx) { + best_candidate->distance = sqrtf(distance_squared); + best_candidate->distance_squared = distance_squared; + best_candidate->idx = node->rest[i].idx; + } + } + return; + } + + // Recurse towards most likely candidate first to narrow best candidate's distance as soon as possible + if (distance_squared < node->radius_squared) { + if (node->near) { + vp_search_node(node->near, needle, best_candidate); + } + // The best node (final answer) may be just ouside the radius, but not farther than + // the best distance we know so far. The vp_search_node above should have narrowed + // best_candidate->distance, so this path is rarely taken. + if (node->far && distance >= node->radius - best_candidate->distance) { + node = node->far; // Fast tail recursion + } else { + return; + } + } else { + if (node->far) { + vp_search_node(node->far, needle, best_candidate); + } + if (node->near && distance <= node->radius + best_candidate->distance) { + node = node->near; // Fast tail recursion + } else { + return; + } + } + } while(true); +} + +LIQ_PRIVATE unsigned int nearest_search(const struct nearest_map *handle, const f_pixel *px, const int likely_colormap_index, float *diff) { + const float guess_diff = colordifference(handle->palette[likely_colormap_index].acolor, *px); + if (guess_diff < handle->nearest_other_color_dist[likely_colormap_index]) { + if (diff) *diff = guess_diff; + return likely_colormap_index; + } + + vp_search_tmp best_candidate = { + .distance = sqrtf(guess_diff), + .distance_squared = guess_diff, + .idx = likely_colormap_index, + .exclude = -1, + }; + vp_search_node(handle->root, px, &best_candidate); + if (diff) { + *diff = best_candidate.distance * best_candidate.distance; + } + return best_candidate.idx; +} + +LIQ_PRIVATE void nearest_free(struct nearest_map *centroids) +{ + mempool_destroy(centroids->mempool); +} diff --git a/tools/assets/n64texconv/lib/libimagequant/nearest.h b/tools/assets/n64texconv/lib/libimagequant/nearest.h new file mode 100644 index 0000000000..10a0a2c1b9 --- /dev/null +++ b/tools/assets/n64texconv/lib/libimagequant/nearest.h @@ -0,0 +1,14 @@ +// +// nearest.h +// pngquant +// + +#ifndef NEAREST_H +#define NEAREST_H + +struct nearest_map; +LIQ_PRIVATE struct nearest_map *nearest_init(const colormap *palette); +LIQ_PRIVATE unsigned int nearest_search(const struct nearest_map *map, const f_pixel *px, const int palette_index_guess, float *diff); +LIQ_PRIVATE void nearest_free(struct nearest_map *map); + +#endif diff --git a/tools/assets/n64texconv/lib/libimagequant/pam.c b/tools/assets/n64texconv/lib/libimagequant/pam.c new file mode 100644 index 0000000000..5d955e1eb1 --- /dev/null +++ b/tools/assets/n64texconv/lib/libimagequant/pam.c @@ -0,0 +1,351 @@ +/* pam.c - pam (portable alpha map) utility library +** +** © 2009-2017 by Kornel Lesiński. +** © 1989, 1991 by Jef Poskanzer. +** © 1997, 2000, 2002 by Greg Roelofs; based on an idea by Stefan Schneider. +** +** See COPYRIGHT file for license. +*/ + +#include +#include + +#include "libimagequant.h" +#include "pam.h" +#include "mempool.h" + +LIQ_PRIVATE bool pam_computeacolorhash(struct acolorhash_table *acht, const liq_color *const pixels[], unsigned int cols, unsigned int rows, const unsigned char *importance_map) +{ + const unsigned int ignorebits = acht->ignorebits; + const unsigned int channel_mask = 255U>>ignorebits<>ignorebits) ^ 0xFFU; + const unsigned int posterize_mask = channel_mask << 24 | channel_mask << 16 | channel_mask << 8 | channel_mask; + const unsigned int posterize_high_mask = channel_hmask << 24 | channel_hmask << 16 | channel_hmask << 8 | channel_hmask; + + const unsigned int hash_size = acht->hash_size; + + /* Go through the entire image, building a hash table of colors. */ + for(unsigned int row = 0; row < rows; ++row) { + + for(unsigned int col = 0; col < cols; ++col) { + unsigned int boost; + + // RGBA color is casted to long for easier hasing/comparisons + union rgba_as_int px = {pixels[row][col]}; + unsigned int hash; + if (px.rgba.a) { + // mask posterizes all 4 channels in one go + px.l = (px.l & posterize_mask) | ((px.l & posterize_high_mask) >> (8-ignorebits)); + // fancier hashing algorithms didn't improve much + hash = px.l % hash_size; + + if (importance_map) { + boost = *importance_map++; + } else { + boost = 255; + } + } else { + // "dirty alpha" has different RGBA values that end up being the same fully transparent color + px.l=0; hash=0; + + boost = 2000; + if (importance_map) { + importance_map++; + } + } + + if (!pam_add_to_hash(acht, hash, boost, px, row, rows)) { + return false; + } + } + } + acht->cols = cols; + acht->rows += rows; + return true; +} + +LIQ_PRIVATE bool pam_add_to_hash(struct acolorhash_table *acht, unsigned int hash, unsigned int boost, union rgba_as_int px, unsigned int row, unsigned int rows) +{ + /* head of the hash function stores first 2 colors inline (achl->used = 1..2), + to reduce number of allocations of achl->other_items. + */ + struct acolorhist_arr_head *achl = &acht->buckets[hash]; + if (achl->inline1.color.l == px.l && achl->used) { + achl->inline1.perceptual_weight += boost; + return true; + } + if (achl->used) { + if (achl->used > 1) { + if (achl->inline2.color.l == px.l) { + achl->inline2.perceptual_weight += boost; + return true; + } + // other items are stored as an array (which gets reallocated if needed) + struct acolorhist_arr_item *other_items = achl->other_items; + unsigned int i = 0; + for (; i < achl->used-2; i++) { + if (other_items[i].color.l == px.l) { + other_items[i].perceptual_weight += boost; + return true; + } + } + + // the array was allocated with spare items + if (i < achl->capacity) { + other_items[i] = (struct acolorhist_arr_item){ + .color = px, + .perceptual_weight = boost, + }; + achl->used++; + ++acht->colors; + return true; + } + + if (++acht->colors > acht->maxcolors) { + return false; + } + + struct acolorhist_arr_item *new_items; + unsigned int capacity; + if (!other_items) { // there was no array previously, alloc "small" array + capacity = 8; + if (acht->freestackp <= 0) { + // estimate how many colors are going to be + headroom + const size_t mempool_size = ((acht->rows + rows-row) * 2 * acht->colors / (acht->rows + row + 1) + 1024) * sizeof(struct acolorhist_arr_item); + new_items = mempool_alloc(&acht->mempool, sizeof(struct acolorhist_arr_item)*capacity, mempool_size); + } else { + // freestack stores previously freed (reallocated) arrays that can be reused + // (all pesimistically assumed to be capacity = 8) + new_items = acht->freestack[--acht->freestackp]; + } + } else { + const unsigned int stacksize = sizeof(acht->freestack)/sizeof(acht->freestack[0]); + + // simply reallocs and copies array to larger capacity + capacity = achl->capacity*2 + 16; + if (acht->freestackp < stacksize-1) { + acht->freestack[acht->freestackp++] = other_items; + } + const size_t mempool_size = ((acht->rows + rows-row) * 2 * acht->colors / (acht->rows + row + 1) + 32*capacity) * sizeof(struct acolorhist_arr_item); + new_items = mempool_alloc(&acht->mempool, sizeof(struct acolorhist_arr_item)*capacity, mempool_size); + if (!new_items) return false; + memcpy(new_items, other_items, sizeof(other_items[0])*achl->capacity); + } + + achl->other_items = new_items; + achl->capacity = capacity; + new_items[i] = (struct acolorhist_arr_item){ + .color = px, + .perceptual_weight = boost, + }; + achl->used++; + } else { + // these are elses for first checks whether first and second inline-stored colors are used + achl->inline2.color.l = px.l; + achl->inline2.perceptual_weight = boost; + achl->used = 2; + ++acht->colors; + } + } else { + achl->inline1.color.l = px.l; + achl->inline1.perceptual_weight = boost; + achl->used = 1; + ++acht->colors; + } + return true; +} + +LIQ_PRIVATE struct acolorhash_table *pam_allocacolorhash(unsigned int maxcolors, unsigned int surface, unsigned int ignorebits, void* (*malloc)(size_t), void (*free)(void*)) +{ + const size_t estimated_colors = MIN(maxcolors, surface/(ignorebits + (surface > 512*512 ? 6 : 5))); + const size_t hash_size = estimated_colors < 66000 ? 6673 : (estimated_colors < 200000 ? 12011 : 24019); + + mempoolptr m = NULL; + const size_t buckets_size = hash_size * sizeof(struct acolorhist_arr_head); + const size_t mempool_size = sizeof(struct acolorhash_table) + buckets_size + estimated_colors * sizeof(struct acolorhist_arr_item); + struct acolorhash_table *t = mempool_create(&m, sizeof(*t) + buckets_size, mempool_size, malloc, free); + if (!t) return NULL; + *t = (struct acolorhash_table){ + .mempool = m, + .hash_size = hash_size, + .maxcolors = maxcolors, + .ignorebits = ignorebits, + }; + memset(t->buckets, 0, buckets_size); + return t; +} + +ALWAYS_INLINE static float pam_add_to_hist(struct temp_hist_item achv[], unsigned int *j, const struct acolorhist_arr_item *entry, const float max_perceptual_weight, int counts[]) +{ + if (entry->perceptual_weight == 0 && *j > 0) { + return 0; + } + const liq_color px = entry->color.rgba; + achv[*j].color = px; + const short cluster = ((px.r>>7)<<3) | ((px.g>>7)<<2) | ((px.b>>7)<<1) | (px.a>>7); + counts[cluster]++; + achv[*j].cluster = cluster; + const float w = MIN(entry->perceptual_weight/170.f, max_perceptual_weight); + achv[*j].weight = w; + *j += 1; + return w; +} + +LIQ_PRIVATE histogram *pam_acolorhashtoacolorhist(const struct acolorhash_table *acht, const double gamma, void* (*malloc)(size_t), void (*free)(void*)) +{ + histogram *hist = malloc(sizeof(hist[0])); + if (!hist || !acht) return NULL; + *hist = (histogram){ + .achv = malloc(MAX(1,acht->colors) * sizeof(hist->achv[0])), + .size = acht->colors, + .free = free, + .ignorebits = acht->ignorebits, + }; + if (!hist->achv) return NULL; + + /// Clusters form initial boxes for quantization, to ensure extreme colors are better represented + int counts[LIQ_MAXCLUSTER] = {}; + struct temp_hist_item *temp = malloc(MAX(1, acht->colors) * sizeof(temp[0])); + + /* Limit perceptual weight to 1/10th of the image surface area to prevent + a single color from dominating all others. */ + float max_perceptual_weight = 0.1f * acht->cols * acht->rows; + double total_weight = 0; + + unsigned int j=0; + for(unsigned int i=0; i < acht->hash_size; ++i) { + const struct acolorhist_arr_head *const achl = &acht->buckets[i]; + if (achl->used) { + total_weight += pam_add_to_hist(temp, &j, &achl->inline1, max_perceptual_weight, counts); + + if (achl->used > 1) { + total_weight += pam_add_to_hist(temp, &j, &achl->inline2, max_perceptual_weight, counts); + + for(unsigned int k=0; k < achl->used-2; k++) { + total_weight += pam_add_to_hist(temp, &j, &achl->other_items[k], max_perceptual_weight, counts); + } + } + } + } + hist->total_perceptual_weight = total_weight; + + int begin = 0; + for(int i=0; i < LIQ_MAXCLUSTER; i++) { + hist->boxes[i].begin = begin; + hist->boxes[i].end = begin; + begin = begin + counts[i]; + } + + hist->size = j; + hist->total_perceptual_weight = total_weight; + for(unsigned int k=0; k < hist->size; k++) { + hist->achv[k].tmp.likely_colormap_index = 0; + } + if (!j) { + free(temp); + pam_freeacolorhist(hist); + return NULL; + } + + float gamma_lut[256]; + to_f_set_gamma(gamma_lut, gamma); + for(int i=0; i < hist->size; i++) { + int j = hist->boxes[temp[i].cluster].end++; + hist->achv[j].acolor = rgba_to_f(gamma_lut, temp[i].color); + hist->achv[j].perceptual_weight = temp[i].weight; + hist->achv[j].adjusted_weight = temp[i].weight; + } + free(temp); + + return hist; +} + + +LIQ_PRIVATE void pam_freeacolorhash(struct acolorhash_table *acht) +{ + if (acht) { + mempool_destroy(acht->mempool); + } +} + +LIQ_PRIVATE void pam_freeacolorhist(histogram *hist) +{ + hist->free(hist->achv); + hist->free(hist); +} + +LIQ_PRIVATE LIQ_NONNULL colormap *pam_colormap(unsigned int colors, void* (*malloc)(size_t), void (*free)(void*)) +{ + assert(colors > 0 && colors < 65536); + + colormap *map; + const size_t colors_size = colors * sizeof(map->palette[0]); + map = malloc(sizeof(colormap) + colors_size); + if (!map) return NULL; + *map = (colormap){ + .malloc = malloc, + .free = free, + .colors = colors, + }; + memset(map->palette, 0, colors_size); + return map; +} + +LIQ_PRIVATE colormap *pam_duplicate_colormap(colormap *map) +{ + colormap *dupe = pam_colormap(map->colors, map->malloc, map->free); + for(unsigned int i=0; i < map->colors; i++) { + dupe->palette[i] = map->palette[i]; + } + return dupe; +} + +LIQ_PRIVATE void pam_freecolormap(colormap *c) +{ + c->free(c); +} + +LIQ_PRIVATE void to_f_set_gamma(float gamma_lut[], const double gamma) +{ + for(int i=0; i < 256; i++) { + gamma_lut[i] = pow((double)i/255.0, internal_gamma/gamma); + } +} + + +/* fixed colors are always included in the palette, so it would be wasteful to duplicate them in palette from histogram */ +LIQ_PRIVATE LIQ_NONNULL void remove_fixed_colors_from_histogram(histogram *hist, const int fixed_colors_count, const f_pixel fixed_colors[], const float target_mse) +{ + const float max_difference = MAX(target_mse/2.f, 2.f/256.f/256.f); + if (fixed_colors_count) { + for(int j=0; j < hist->size; j++) { + for(unsigned int i=0; i < fixed_colors_count; i++) { + if (colordifference(hist->achv[j].acolor, fixed_colors[i]) < max_difference) { + hist->achv[j] = hist->achv[--hist->size]; // remove color from histogram by overwriting with the last entry + j--; break; // continue searching histogram + } + } + } + } +} + +LIQ_PRIVATE LIQ_NONNULL colormap *histogram_to_palette(const histogram *hist, void* (*malloc)(size_t), void (*free)(void*)) { + if (!hist->size) { + return NULL; + } + colormap *acolormap = pam_colormap(hist->size, malloc, free); + for(unsigned int i=0; i < hist->size; i++) { + acolormap->palette[i].acolor = hist->achv[i].acolor; + acolormap->palette[i].popularity = hist->achv[i].perceptual_weight; + } + return acolormap; +} + +LIQ_PRIVATE LIQ_NONNULL void hist_reset_colors(const histogram *hist, const unsigned int colors) { + // likely_colormap_index (used and set in kmeans_do_iteration) can't point to index outside colormap + if (colors < 256) for(unsigned int j=0; j < hist->size; j++) { + if (hist->achv[j].tmp.likely_colormap_index >= colors) { + hist->achv[j].tmp.likely_colormap_index = 0; // actual value doesn't matter, as the guess is out of date anyway + } + } +} diff --git a/tools/assets/n64texconv/lib/libimagequant/pam.h b/tools/assets/n64texconv/lib/libimagequant/pam.h new file mode 100644 index 0000000000..4ab4e0de21 --- /dev/null +++ b/tools/assets/n64texconv/lib/libimagequant/pam.h @@ -0,0 +1,312 @@ +/* pam.h - pam (portable alpha map) utility library + ** + ** Colormap routines. + ** + ** Copyright (C) 1989, 1991 by Jef Poskanzer. + ** Copyright (C) 1997 by Greg Roelofs. + ** + ** Permission to use, copy, modify, and distribute this software and its + ** documentation for any purpose and without fee is hereby granted, provided + ** that the above copyright notice appear in all copies and that both that + ** copyright notice and this permission notice appear in supporting + ** documentation. This software is provided "as is" without express or + ** implied warranty. + */ + +#ifndef PAM_H +#define PAM_H + +// accidental debug assertions make color search much slower, +// so force assertions off if there's no explicit setting +#if !defined(NDEBUG) && !defined(DEBUG) +#define NDEBUG +#endif + +#include +#include +#include +#include + +#ifndef MAX +# define MAX(a,b) ((a) > (b)? (a) : (b)) +# define MIN(a,b) ((a) < (b)? (a) : (b)) +#endif + +#define MAX_DIFF 1e20 + +#ifndef USE_SSE +# if defined(__SSE__) && (defined(__amd64__) || defined(__X86_64__) || defined(_WIN64) || defined(WIN32) || defined(__WIN32__)) +# define USE_SSE 1 +# else +# define USE_SSE 0 +# endif +#endif + +#if USE_SSE +# include +# ifdef _MSC_VER +# include +# define SSE_ALIGN +# else +# define SSE_ALIGN __attribute__ ((aligned (16))) +# if defined(__i386__) && defined(__PIC__) +# define cpuid(func,ax,bx,cx,dx)\ + __asm__ __volatile__ ( \ + "push %%ebx\n" \ + "cpuid\n" \ + "mov %%ebx, %1\n" \ + "pop %%ebx\n" \ + : "=a" (ax), "=r" (bx), "=c" (cx), "=d" (dx) \ + : "a" (func)); +# else +# define cpuid(func,ax,bx,cx,dx)\ + __asm__ __volatile__ ("cpuid":\ + "=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx) : "a" (func)); +# endif +#endif +#else +# define SSE_ALIGN +#endif + +#ifndef _MSC_VER +#define LIQ_ARRAY(type, var, count) type var[count] +#else +#define LIQ_ARRAY(type, var, count) type* var = (type*)_alloca(sizeof(type)*(count)) +#endif + +#if defined(__GNUC__) || defined (__llvm__) +#define ALWAYS_INLINE __attribute__((always_inline)) inline +#define NEVER_INLINE __attribute__ ((noinline)) +#elif defined(_MSC_VER) +#define inline __inline +#define restrict __restrict +#define ALWAYS_INLINE __forceinline +#define NEVER_INLINE __declspec(noinline) +#else +#define ALWAYS_INLINE inline +#define NEVER_INLINE +#endif + +/* from pam.h */ + +typedef struct { + float a, r, g, b; +} SSE_ALIGN f_pixel; + +static const float internal_gamma = 0.57f; + +LIQ_PRIVATE void to_f_set_gamma(float gamma_lut[], const double gamma); + +#define MIN_OPAQUE_A (1.f / 256.f * LIQ_WEIGHT_A) + +#define LIQ_WEIGHT_A 0.625f +#define LIQ_WEIGHT_R 0.5f +#define LIQ_WEIGHT_G 1.0f +#define LIQ_WEIGHT_B 0.45f +#define LIQ_WEIGHT_MSE 0.45 // fudge factor for compensating that colors aren't 0..1 range + +/** + Converts 8-bit color to internal gamma and premultiplied alpha. + (premultiplied color space is much better for blending of semitransparent colors) + */ +ALWAYS_INLINE static f_pixel rgba_to_f(const float gamma_lut[], const liq_color px); +inline static f_pixel rgba_to_f(const float gamma_lut[], const liq_color px) +{ + float a = px.a/255.f; + + return (f_pixel) { + .a = a * LIQ_WEIGHT_A, + .r = gamma_lut[px.r] * LIQ_WEIGHT_R * a, + .g = gamma_lut[px.g] * LIQ_WEIGHT_G * a, + .b = gamma_lut[px.b] * LIQ_WEIGHT_B * a, + }; +} + +inline static liq_color f_to_rgb(const float gamma, const f_pixel px) +{ + if (px.a < MIN_OPAQUE_A) { + return (liq_color){0,0,0,0}; + } + + float r = (LIQ_WEIGHT_A / LIQ_WEIGHT_R) * px.r / px.a, + g = (LIQ_WEIGHT_A / LIQ_WEIGHT_G) * px.g / px.a, + b = (LIQ_WEIGHT_A / LIQ_WEIGHT_B) * px.b / px.a; + + r = powf(r, gamma/internal_gamma); + g = powf(g, gamma/internal_gamma); + b = powf(b, gamma/internal_gamma); + + // 256, because numbers are in range 1..255.9999… rounded down + r *= 256.f; + g *= 256.f; + b *= 256.f; + float a = (256.f / LIQ_WEIGHT_A) * px.a; + + return (liq_color){ + .r = r>=255.f ? 255 : r, + .g = g>=255.f ? 255 : g, + .b = b>=255.f ? 255 : b, + .a = a>=255.f ? 255 : a, + }; +} + +ALWAYS_INLINE static float colordifference_ch(const float x, const float y, const float alphas); +inline static float colordifference_ch(const float x, const float y, const float alphas) +{ + // maximum of channel blended on white, and blended on black + // premultiplied alpha and backgrounds 0/1 shorten the formula + const float black = x-y, white = black+alphas; + return MAX(black*black, white*white); +} + +ALWAYS_INLINE static float colordifference_stdc(const f_pixel px, const f_pixel py); +inline static float colordifference_stdc(const f_pixel px, const f_pixel py) +{ + // px_b.rgb = px.rgb + 0*(1-px.a) // blend px on black + // px_b.a = px.a + 1*(1-px.a) + // px_w.rgb = px.rgb + 1*(1-px.a) // blend px on white + // px_w.a = px.a + 1*(1-px.a) + + // px_b.rgb = px.rgb // difference same as in opaque RGB + // px_b.a = 1 + // px_w.rgb = px.rgb - px.a // difference simplifies to formula below + // px_w.a = 1 + + // (px.rgb - px.a) - (py.rgb - py.a) + // (px.rgb - py.rgb) + (py.a - px.a) + + const float alphas = py.a-px.a; + return colordifference_ch(px.r, py.r, alphas) + + colordifference_ch(px.g, py.g, alphas) + + colordifference_ch(px.b, py.b, alphas); +} + +ALWAYS_INLINE static float colordifference(f_pixel px, f_pixel py); +inline static float colordifference(f_pixel px, f_pixel py) +{ +#if USE_SSE +#ifdef _MSC_VER + /* In MSVC we cannot use the align attribute in parameters. + * This is used a lot, so we just use an unaligned load. + * Also the compiler incorrectly inlines vpx and vpy without + * the volatile when optimization is applied for x86_64. */ + const volatile __m128 vpx = _mm_loadu_ps((const float*)&px); + const volatile __m128 vpy = _mm_loadu_ps((const float*)&py); +#else + const __m128 vpx = _mm_load_ps((const float*)&px); + const __m128 vpy = _mm_load_ps((const float*)&py); +#endif + + // y.a - x.a + __m128 alphas = _mm_sub_ss(vpy, vpx); + alphas = _mm_shuffle_ps(alphas,alphas,0); // copy first to all four + + __m128 onblack = _mm_sub_ps(vpx, vpy); // x - y + __m128 onwhite = _mm_add_ps(onblack, alphas); // x - y + (y.a - x.a) + + onblack = _mm_mul_ps(onblack, onblack); + onwhite = _mm_mul_ps(onwhite, onwhite); + const __m128 max = _mm_max_ps(onwhite, onblack); + + // add rgb, not a + const __m128 maxhl = _mm_movehl_ps(max, max); + const __m128 tmp = _mm_add_ps(max, maxhl); + const __m128 sum = _mm_add_ss(maxhl, _mm_shuffle_ps(tmp, tmp, 1)); + + const float res = _mm_cvtss_f32(sum); + assert(fabs(res - colordifference_stdc(px,py)) < 0.001); + return res; +#else + return colordifference_stdc(px,py); +#endif +} + +/* from pamcmap.h */ +union rgba_as_int { + liq_color rgba; + unsigned int l; +}; + +typedef struct { + f_pixel acolor; + float adjusted_weight, // perceptual weight changed to tweak how mediancut selects colors + perceptual_weight; // number of pixels weighted by importance of different areas of the picture + + float color_weight; // these two change every time histogram subset is sorted + union { + unsigned int sort_value; + unsigned char likely_colormap_index; + } tmp; +} hist_item; + +#define LIQ_MAXCLUSTER 16 + +struct temp_hist_item { + liq_color color; + float weight; + short cluster; +}; + +struct histogram_box { + int begin, end; +}; + +typedef struct { + hist_item *achv; + void (*free)(void*); + double total_perceptual_weight; + unsigned int size; + unsigned int ignorebits; + struct histogram_box boxes[LIQ_MAXCLUSTER]; +} histogram; + +typedef struct { + f_pixel acolor; + float popularity; + bool fixed; // if true it's user-supplied and must not be changed (e.g in K-Means iteration) +} colormap_item; + +typedef struct colormap { + unsigned int colors; + void* (*malloc)(size_t); + void (*free)(void*); + colormap_item palette[]; +} colormap; + +struct acolorhist_arr_item { + union rgba_as_int color; + unsigned int perceptual_weight; +}; + +struct acolorhist_arr_head { + struct acolorhist_arr_item inline1, inline2; + unsigned int used, capacity; + struct acolorhist_arr_item *other_items; +}; + +struct acolorhash_table { + struct mempool *mempool; + unsigned int ignorebits, maxcolors, colors, cols, rows; + unsigned int hash_size; + unsigned int freestackp; + struct acolorhist_arr_item *freestack[512]; + struct acolorhist_arr_head buckets[]; +}; + +LIQ_PRIVATE void pam_freeacolorhash(struct acolorhash_table *acht); +LIQ_PRIVATE struct acolorhash_table *pam_allocacolorhash(unsigned int maxcolors, unsigned int surface, unsigned int ignorebits, void* (*malloc)(size_t), void (*free)(void*)); +LIQ_PRIVATE histogram *pam_acolorhashtoacolorhist(const struct acolorhash_table *acht, const double gamma, void* (*malloc)(size_t), void (*free)(void*)); +LIQ_PRIVATE bool pam_computeacolorhash(struct acolorhash_table *acht, const liq_color *const pixels[], unsigned int cols, unsigned int rows, const unsigned char *importance_map); +LIQ_PRIVATE bool pam_add_to_hash(struct acolorhash_table *acht, unsigned int hash, unsigned int boost, union rgba_as_int px, unsigned int row, unsigned int rows); + +LIQ_PRIVATE void pam_freeacolorhist(histogram *h); + +LIQ_PRIVATE colormap *pam_colormap(unsigned int colors, void* (*malloc)(size_t), void (*free)(void*)) LIQ_NONNULL; +LIQ_PRIVATE colormap *pam_duplicate_colormap(colormap *map) LIQ_NONNULL; +LIQ_PRIVATE void pam_freecolormap(colormap *c); + +LIQ_PRIVATE void remove_fixed_colors_from_histogram(histogram *hist, const int fixed_colors_count, const f_pixel fixed_colors[], const float target_mse) LIQ_NONNULL; +LIQ_PRIVATE colormap *histogram_to_palette(const histogram *hist, void* (*malloc)(size_t), void (*free)(void*)) LIQ_NONNULL; +LIQ_PRIVATE void hist_reset_colors(const histogram *hist, const unsigned int colors) LIQ_NONNULL; + +#endif diff --git a/tools/assets/n64texconv/lib/libimagequant/remap.c b/tools/assets/n64texconv/lib/libimagequant/remap.c new file mode 100644 index 0000000000..4495810132 --- /dev/null +++ b/tools/assets/n64texconv/lib/libimagequant/remap.c @@ -0,0 +1,300 @@ +#include +#include + +#include "libimagequant.h" +#include "pam.h" +#include "libimagequant_private.h" + +#include "nearest.h" +#include "kmeans.h" + +LIQ_PRIVATE LIQ_NONNULL float remap_to_palette(liq_image *const input_image, unsigned char *const *const output_pixels, colormap *const map) +{ + const int rows = input_image->height; + const unsigned int cols = input_image->width; + double remapping_error=0; + + if (!liq_image_get_row_f_init(input_image)) { + return -1; + } + if (input_image->background && !liq_image_get_row_f_init(input_image->background)) { + return -1; + } + + const colormap_item *acolormap = map->palette; + + struct nearest_map *const n = nearest_init(map); + liq_image *background = input_image->background; + const int transparent_index = background ? nearest_search(n, &(f_pixel){0,0,0,0}, 0, NULL) : -1; + if (background && acolormap[transparent_index].acolor.a > 1.f/256.f) { + // palette unsuitable for using the bg + background = NULL; + } + + + const unsigned int max_threads = omp_get_max_threads(); + LIQ_ARRAY(kmeans_state, average_color, (KMEANS_CACHE_LINE_GAP+map->colors) * max_threads); + kmeans_init(map, max_threads, average_color); + +#if __GNUC__ >= 9 || __clang__ + #pragma omp parallel for if (rows*cols > 3000) \ + schedule(static) default(none) shared(background,acolormap,average_color,cols,input_image,map,n,output_pixels,rows,transparent_index) reduction(+:remapping_error) +#endif + for(int row = 0; row < rows; ++row) { + const f_pixel *const row_pixels = liq_image_get_row_f(input_image, row); + const f_pixel *const bg_pixels = background && acolormap[transparent_index].acolor.a < MIN_OPAQUE_A ? liq_image_get_row_f(background, row) : NULL; + + unsigned int last_match=0; + for(unsigned int col = 0; col < cols; ++col) { + float diff; + last_match = nearest_search(n, &row_pixels[col], last_match, &diff); + if (bg_pixels) { + float bg_diff = colordifference(bg_pixels[col], acolormap[last_match].acolor); + if (bg_diff <= diff) { + diff = bg_diff; + last_match = transparent_index; + } + } + output_pixels[row][col] = last_match; + + remapping_error += diff; + if (last_match != transparent_index) { + kmeans_update_color(row_pixels[col], 1.0, map, last_match, omp_get_thread_num(), average_color); + } + } + } + + kmeans_finalize(map, max_threads, average_color); + + nearest_free(n); + + return remapping_error / (input_image->width * input_image->height); +} + +inline static f_pixel get_dithered_pixel(const float dither_level, const float max_dither_error, const f_pixel thiserr, const f_pixel px) +{ + /* Use Floyd-Steinberg errors to adjust actual color. */ + const float sr = thiserr.r * dither_level, + sg = thiserr.g * dither_level, + sb = thiserr.b * dither_level, + sa = thiserr.a * dither_level; + + float ratio = 1.0; + const float max_overflow = 1.1f; + const float max_underflow = -0.1f; + + // allowing some overflow prevents undithered bands caused by clamping of all channels + if (px.r + sr > max_overflow) ratio = MIN(ratio, (max_overflow -px.r)/sr); + else { if (px.r + sr < max_underflow) ratio = MIN(ratio, (max_underflow-px.r)/sr); } + if (px.g + sg > max_overflow) ratio = MIN(ratio, (max_overflow -px.g)/sg); + else { if (px.g + sg < max_underflow) ratio = MIN(ratio, (max_underflow-px.g)/sg); } + if (px.b + sb > max_overflow) ratio = MIN(ratio, (max_overflow -px.b)/sb); + else { if (px.b + sb < max_underflow) ratio = MIN(ratio, (max_underflow-px.b)/sb); } + + float a = px.a + sa; + if (a > 1.f) { a = 1.f; } + else if (a < 0) { a = 0; } + + // If dithering error is crazy high, don't propagate it that much + // This prevents crazy geen pixels popping out of the blue (or red or black! ;) + const float dither_error = sr*sr + sg*sg + sb*sb + sa*sa; + if (dither_error > max_dither_error) { + ratio *= 0.8f; + } else if (dither_error < 2.f/256.f/256.f) { + // don't dither areas that don't have noticeable error — makes file smaller + return px; + } + + return (f_pixel) { + .r=px.r + sr * ratio, + .g=px.g + sg * ratio, + .b=px.b + sb * ratio, + .a=a, + }; +} + +/** + Uses edge/noise map to apply dithering only to flat areas. Dithering on edges creates jagged lines, and noisy areas are "naturally" dithered. + + If output_image_is_remapped is true, only pixels noticeably changed by error diffusion will be written to output image. + */ +LIQ_PRIVATE LIQ_NONNULL bool remap_to_palette_floyd(liq_image *input_image, unsigned char *const output_pixels[], liq_remapping_result *quant, const float max_dither_error, const bool output_image_is_remapped) +{ + const int rows = input_image->height, cols = input_image->width; + const unsigned char *dither_map = quant->use_dither_map ? (input_image->dither_map ? input_image->dither_map : input_image->edges) : NULL; + + const colormap *map = quant->palette; + const colormap_item *acolormap = map->palette; + + if (!liq_image_get_row_f_init(input_image)) { + return false; + } + if (input_image->background && !liq_image_get_row_f_init(input_image->background)) { + return false; + } + + /* Initialize Floyd-Steinberg error vectors. */ + const size_t errwidth = cols+2; + f_pixel *restrict thiserr = input_image->malloc(errwidth * sizeof(thiserr[0]) * 2); // +2 saves from checking out of bounds access + if (!thiserr) return false; + f_pixel *restrict nexterr = thiserr + errwidth; + memset(thiserr, 0, errwidth * sizeof(thiserr[0])); + + bool ok = true; + struct nearest_map *const n = nearest_init(map); + liq_image *background = input_image->background; + const int transparent_index = background ? nearest_search(n, &(f_pixel){0,0,0,0}, 0, NULL) : -1; + if (background && acolormap[transparent_index].acolor.a > 1.f/256.f) { + // palette unsuitable for using the bg + background = NULL; + } + + // response to this value is non-linear and without it any value < 0.8 would give almost no dithering + float base_dithering_level = quant->dither_level; + base_dithering_level = 1.f - (1.f-base_dithering_level)*(1.f-base_dithering_level); + + if (dither_map) { + base_dithering_level *= 1.f/255.f; // convert byte to float + } + base_dithering_level *= 15.f/16.f; // prevent small errors from accumulating + + int fs_direction = 1; + unsigned int last_match=0; + for (int row = 0; row < rows; ++row) { + if (liq_remap_progress(quant, quant->progress_stage1 + row * (100.f - quant->progress_stage1) / rows)) { + ok = false; + break; + } + + memset(nexterr, 0, errwidth * sizeof(nexterr[0])); + + int col = (fs_direction > 0) ? 0 : (cols - 1); + const f_pixel *const row_pixels = liq_image_get_row_f(input_image, row); + const f_pixel *const bg_pixels = background && acolormap[transparent_index].acolor.a < MIN_OPAQUE_A ? liq_image_get_row_f(background, row) : NULL; + int undithered_bg_used = 0; + + do { + float dither_level = base_dithering_level; + if (dither_map) { + dither_level *= dither_map[row*cols + col]; + } + + const f_pixel spx = get_dithered_pixel(dither_level, max_dither_error, thiserr[col + 1], row_pixels[col]); + + const unsigned int guessed_match = output_image_is_remapped ? output_pixels[row][col] : last_match; + float dither_diff; + last_match = nearest_search(n, &spx, guessed_match, &dither_diff); + f_pixel output_px = acolormap[last_match].acolor; + // this is for animgifs + if (bg_pixels) { + // if the background makes better match *with* dithering, it's a definitive win + float bg_for_dither_diff = colordifference(spx, bg_pixels[col]); + if (bg_for_dither_diff <= dither_diff) { + output_px = bg_pixels[col]; + last_match = transparent_index; + } else if (undithered_bg_used > 1) { + // the undithered fallback can cause artifacts when too many undithered pixels accumulate a big dithering error + // so periodically ignore undithered fallback to prevent that + undithered_bg_used = 0; + } else { + // if dithering is not applied, there's a high risk of creating artifacts (flat areas, error accumulating badly), + // OTOH poor dithering disturbs static backgrounds and creates oscilalting frames that break backgrounds + // back and forth in two differently bad ways + float max_diff = colordifference(row_pixels[col], bg_pixels[col]); + float dithered_diff = colordifference(row_pixels[col], output_px); + // if dithering is worse than natural difference between frames + // (this rule dithers moving areas, but does not dither static areas) + if (dithered_diff > max_diff) { + // then see if an undithered color is closer to the ideal + float undithered_diff = colordifference(row_pixels[col], acolormap[guessed_match].acolor); + if (undithered_diff < max_diff) { + undithered_bg_used++; + output_px = acolormap[guessed_match].acolor; + last_match = guessed_match; + } + } + } + } + + output_pixels[row][col] = last_match; + + f_pixel err = { + .r = (spx.r - output_px.r), + .g = (spx.g - output_px.g), + .b = (spx.b - output_px.b), + .a = (spx.a - output_px.a), + }; + + // If dithering error is crazy high, don't propagate it that much + // This prevents crazy geen pixels popping out of the blue (or red or black! ;) + if (err.r*err.r + err.g*err.g + err.b*err.b + err.a*err.a > max_dither_error) { + err.r *= 0.75f; + err.g *= 0.75f; + err.b *= 0.75f; + err.a *= 0.75f; + } + + /* Propagate Floyd-Steinberg error terms. */ + if (fs_direction > 0) { + thiserr[col + 2].a += err.a * (7.f/16.f); + thiserr[col + 2].r += err.r * (7.f/16.f); + thiserr[col + 2].g += err.g * (7.f/16.f); + thiserr[col + 2].b += err.b * (7.f/16.f); + + nexterr[col + 2].a = err.a * (1.f/16.f); + nexterr[col + 2].r = err.r * (1.f/16.f); + nexterr[col + 2].g = err.g * (1.f/16.f); + nexterr[col + 2].b = err.b * (1.f/16.f); + + nexterr[col + 1].a += err.a * (5.f/16.f); + nexterr[col + 1].r += err.r * (5.f/16.f); + nexterr[col + 1].g += err.g * (5.f/16.f); + nexterr[col + 1].b += err.b * (5.f/16.f); + + nexterr[col ].a += err.a * (3.f/16.f); + nexterr[col ].r += err.r * (3.f/16.f); + nexterr[col ].g += err.g * (3.f/16.f); + nexterr[col ].b += err.b * (3.f/16.f); + + } else { + thiserr[col ].a += err.a * (7.f/16.f); + thiserr[col ].r += err.r * (7.f/16.f); + thiserr[col ].g += err.g * (7.f/16.f); + thiserr[col ].b += err.b * (7.f/16.f); + + nexterr[col ].a = err.a * (1.f/16.f); + nexterr[col ].r = err.r * (1.f/16.f); + nexterr[col ].g = err.g * (1.f/16.f); + nexterr[col ].b = err.b * (1.f/16.f); + + nexterr[col + 1].a += err.a * (5.f/16.f); + nexterr[col + 1].r += err.r * (5.f/16.f); + nexterr[col + 1].g += err.g * (5.f/16.f); + nexterr[col + 1].b += err.b * (5.f/16.f); + + nexterr[col + 2].a += err.a * (3.f/16.f); + nexterr[col + 2].r += err.r * (3.f/16.f); + nexterr[col + 2].g += err.g * (3.f/16.f); + nexterr[col + 2].b += err.b * (3.f/16.f); + } + + // remapping is done in zig-zag + col += fs_direction; + if (fs_direction > 0) { + if (col >= cols) break; + } else { + if (col < 0) break; + } + } while(1); + + f_pixel *const temperr = thiserr; + thiserr = nexterr; + nexterr = temperr; + fs_direction = -fs_direction; + } + + input_image->free(MIN(thiserr, nexterr)); // MIN because pointers were swapped + nearest_free(n); + + return ok; +} diff --git a/tools/assets/n64texconv/lib/libimagequant/remap.h b/tools/assets/n64texconv/lib/libimagequant/remap.h new file mode 100644 index 0000000000..59d509b7a2 --- /dev/null +++ b/tools/assets/n64texconv/lib/libimagequant/remap.h @@ -0,0 +1,7 @@ +#ifndef REMAP_H +#define REMAP_H + +LIQ_PRIVATE float remap_to_palette(liq_image *const input_image, unsigned char *const *const output_pixels, colormap *const map) LIQ_NONNULL; +LIQ_PRIVATE bool remap_to_palette_floyd(liq_image *input_image, unsigned char *const output_pixels[], liq_remapping_result *quant, const float max_dither_error, const bool output_image_is_remapped) LIQ_NONNULL; + +#endif diff --git a/tools/assets/n64texconv/lib/spng/LICENSE b/tools/assets/n64texconv/lib/spng/LICENSE new file mode 100644 index 0000000000..05234f0ea3 --- /dev/null +++ b/tools/assets/n64texconv/lib/spng/LICENSE @@ -0,0 +1,25 @@ +BSD 2-Clause License + +Copyright (c) 2018-2023, Randy +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/tools/assets/n64texconv/lib/spng/spng.c b/tools/assets/n64texconv/lib/spng/spng.c new file mode 100644 index 0000000000..b22b7110a1 --- /dev/null +++ b/tools/assets/n64texconv/lib/spng/spng.c @@ -0,0 +1,6980 @@ +/* SPDX-License-Identifier: (BSD-2-Clause AND libpng-2.0) */ + +#define SPNG__BUILD + +#include "spng.h" + +#include +#include +#include +#include + +#define ZLIB_CONST + +#ifdef __FRAMAC__ + #define SPNG_DISABLE_OPT + #include "tests/framac_stubs.h" +#else + #ifdef SPNG_USE_MINIZ + #include + #else + #include + #endif +#endif + +#ifdef SPNG_MULTITHREADING + #include +#endif + +/* Not build options, edit at your own risk! */ +#define SPNG_READ_SIZE (8192) +#define SPNG_WRITE_SIZE SPNG_READ_SIZE +#define SPNG_MAX_CHUNK_COUNT (1000) + +#define SPNG_TARGET_CLONES(x) + +#ifndef SPNG_DISABLE_OPT + + #if defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64) + #define SPNG_X86 + + #if defined(__x86_64__) || defined(_M_X64) + #define SPNG_X86_64 + #endif + + #elif defined(__aarch64__) || defined(_M_ARM64) /* || defined(__ARM_NEON) */ + #define SPNG_ARM /* NOTE: only arm64 builds are tested! */ + #else + #pragma message "disabling SIMD optimizations for unknown target" + #define SPNG_DISABLE_OPT + #endif + + #if defined(SPNG_X86_64) && defined(SPNG_ENABLE_TARGET_CLONES) + #undef SPNG_TARGET_CLONES + #define SPNG_TARGET_CLONES(x) __attribute__((target_clones(x))) + #else + #define SPNG_TARGET_CLONES(x) + #endif + + #ifndef SPNG_DISABLE_OPT + static void defilter_sub3(size_t rowbytes, unsigned char *row); + static void defilter_sub4(size_t rowbytes, unsigned char *row); + static void defilter_avg3(size_t rowbytes, unsigned char *row, const unsigned char *prev); + static void defilter_avg4(size_t rowbytes, unsigned char *row, const unsigned char *prev); + static void defilter_paeth3(size_t rowbytes, unsigned char *row, const unsigned char *prev); + static void defilter_paeth4(size_t rowbytes, unsigned char *row, const unsigned char *prev); + + #if defined(SPNG_ARM) + static uint32_t expand_palette_rgba8_neon(unsigned char *row, const unsigned char *scanline, const unsigned char *plte, uint32_t width); + static uint32_t expand_palette_rgb8_neon(unsigned char *row, const unsigned char *scanline, const unsigned char *plte, uint32_t width); + #endif + #endif +#endif + +#if defined(_MSC_VER) + #pragma warning(push) + #pragma warning(disable: 4244) +#endif + +#if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) || defined(__BIG_ENDIAN__) + #define SPNG_BIG_ENDIAN +#else + #define SPNG_LITTLE_ENDIAN +#endif + +enum spng_state +{ + SPNG_STATE_INVALID = 0, + SPNG_STATE_INIT = 1, /* No PNG buffer/stream is set */ + SPNG_STATE_INPUT, /* Decoder input PNG was set */ + SPNG_STATE_OUTPUT = SPNG_STATE_INPUT, /* Encoder output was set */ + SPNG_STATE_IHDR, /* IHDR was read/written */ + SPNG_STATE_FIRST_IDAT, /* Encoded up to / reached first IDAT */ + SPNG_STATE_DECODE_INIT, /* Decoder is ready for progressive reads */ + SPNG_STATE_ENCODE_INIT = SPNG_STATE_DECODE_INIT, + SPNG_STATE_EOI, /* Reached the last scanline/row */ + SPNG_STATE_LAST_IDAT, /* Reached last IDAT, set at end of decode_image() */ + SPNG_STATE_AFTER_IDAT, /* */ + SPNG_STATE_IEND, /* Reached IEND */ +}; + +enum spng__internal +{ + SPNG__IO_SIGNAL = 1 << 9, + SPNG__CTX_FLAGS_ALL = (SPNG_CTX_IGNORE_ADLER32 | SPNG_CTX_ENCODER) +}; + +#define SPNG_STR(x) _SPNG_STR(x) +#define _SPNG_STR(x) #x + +#define SPNG_VERSION_STRING SPNG_STR(SPNG_VERSION_MAJOR) "." \ + SPNG_STR(SPNG_VERSION_MINOR) "." \ + SPNG_STR(SPNG_VERSION_PATCH) + +#define SPNG_GET_CHUNK_BOILERPLATE(chunk) \ + if(ctx == NULL) return 1; \ + int ret = read_chunks(ctx, 0); \ + if(ret) return ret; \ + if(!ctx->stored.chunk) return SPNG_ECHUNKAVAIL; \ + if(chunk == NULL) return 1 + +#define SPNG_SET_CHUNK_BOILERPLATE(chunk) \ + if(ctx == NULL || chunk == NULL) return 1; \ + if(ctx->data == NULL && !ctx->encode_only) return SPNG_ENOSRC; \ + int ret = read_chunks(ctx, 0); \ + if(ret) return ret + +/* Determine if the spng_option can be overriden/optimized */ +#define spng__optimize(option) (ctx->optimize_option & (1 << option)) + +struct spng_subimage +{ + uint32_t width; + uint32_t height; + size_t out_width; /* byte width based on output format */ + size_t scanline_width; +}; + +struct spng_text2 +{ + int type; + char *keyword; + char *text; + + size_t text_length; + + uint8_t compression_flag; /* iTXt only */ + char *language_tag; /* iTXt only */ + char *translated_keyword; /* iTXt only */ + + size_t cache_usage; + char user_keyword_storage[80]; +}; + +struct decode_flags +{ + unsigned apply_trns: 1; + unsigned apply_gamma: 1; + unsigned use_sbit: 1; + unsigned indexed: 1; + unsigned do_scaling: 1; + unsigned interlaced: 1; + unsigned same_layout: 1; + unsigned zerocopy: 1; + unsigned unpack: 1; +}; + +struct encode_flags +{ + unsigned interlace: 1; + unsigned same_layout: 1; + unsigned to_bigendian: 1; + unsigned progressive: 1; + unsigned finalize: 1; + + enum spng_filter_choice filter_choice; +}; + +struct spng_chunk_bitfield +{ + unsigned ihdr: 1; + unsigned plte: 1; + unsigned chrm: 1; + unsigned iccp: 1; + unsigned gama: 1; + unsigned sbit: 1; + unsigned srgb: 1; + unsigned text: 1; + unsigned bkgd: 1; + unsigned hist: 1; + unsigned trns: 1; + unsigned phys: 1; + unsigned splt: 1; + unsigned time: 1; + unsigned offs: 1; + unsigned exif: 1; + unsigned unknown: 1; +}; + +/* Packed sample iterator */ +struct spng__iter +{ + const uint8_t mask; + unsigned shift_amount; + const unsigned initial_shift, bit_depth; + const unsigned char *samples; +}; + +union spng__decode_plte +{ + struct spng_plte_entry rgba[256]; + unsigned char rgb[256 * 3]; + unsigned char raw[256 * 4]; + uint32_t align_this; +}; + +struct spng__zlib_options +{ + int compression_level; + int window_bits; + int mem_level; + int strategy; + int data_type; +}; + +typedef void spng__undo(spng_ctx *ctx); + +struct spng_ctx +{ + size_t data_size; + size_t bytes_read; + size_t stream_buf_size; + unsigned char *stream_buf; + const unsigned char *data; + + /* User-defined pointers for streaming */ + spng_read_fn *read_fn; + spng_write_fn *write_fn; + void *stream_user_ptr; + + /* Used for buffer reads */ + const unsigned char *png_base; + size_t bytes_left; + size_t last_read_size; + + /* Used for encoding */ + int user_owns_out_png; + unsigned char *out_png; + unsigned char *write_ptr; + size_t out_png_size; + size_t bytes_encoded; + + /* These are updated by read/write_header()/read_chunk_bytes() */ + struct spng_chunk current_chunk; + uint32_t cur_chunk_bytes_left; + uint32_t cur_actual_crc; + + struct spng_alloc alloc; + + enum spng_ctx_flags flags; + enum spng_format fmt; + + enum spng_state state; + + unsigned streaming: 1; + unsigned internal_buffer: 1; /* encoding to internal buffer */ + + unsigned inflate: 1; + unsigned deflate: 1; + unsigned encode_only: 1; + unsigned strict: 1; + unsigned discard: 1; + unsigned skip_crc: 1; + unsigned keep_unknown: 1; + unsigned prev_was_idat: 1; + + struct spng__zlib_options image_options; + struct spng__zlib_options text_options; + + spng__undo *undo; + + /* input file contains this chunk */ + struct spng_chunk_bitfield file; + + /* chunk was stored with spng_set_*() */ + struct spng_chunk_bitfield user; + + /* chunk was stored by reading or with spng_set_*() */ + struct spng_chunk_bitfield stored; + + /* used to reset the above in case of an error */ + struct spng_chunk_bitfield prev_stored; + + struct spng_chunk first_idat, last_idat; + + uint32_t max_width, max_height; + + size_t max_chunk_size; + size_t chunk_cache_limit; + size_t chunk_cache_usage; + uint32_t chunk_count_limit; + uint32_t chunk_count_total; + + int crc_action_critical; + int crc_action_ancillary; + + uint32_t optimize_option; + + struct spng_ihdr ihdr; + + struct spng_plte plte; + + struct spng_chrm_int chrm_int; + struct spng_iccp iccp; + + uint32_t gama; + + struct spng_sbit sbit; + + uint8_t srgb_rendering_intent; + + uint32_t n_text; + struct spng_text2 *text_list; + + struct spng_bkgd bkgd; + struct spng_hist hist; + struct spng_trns trns; + struct spng_phys phys; + + uint32_t n_splt; + struct spng_splt *splt_list; + + struct spng_time time; + struct spng_offs offs; + struct spng_exif exif; + + uint32_t n_chunks; + struct spng_unknown_chunk *chunk_list; + + struct spng_subimage subimage[7]; + + z_stream zstream; + unsigned char *scanline_buf, *prev_scanline_buf, *row_buf, *filtered_scanline_buf; + unsigned char *scanline, *prev_scanline, *row, *filtered_scanline; + + /* based on fmt */ + size_t image_size; /* may be zero */ + size_t image_width; + + unsigned bytes_per_pixel; /* derived from ihdr */ + unsigned pixel_size; /* derived from spng_format+ihdr */ + int widest_pass; + int last_pass; /* last non-empty pass */ + + uint16_t *gamma_lut; /* points to either _lut8 or _lut16 */ + uint16_t *gamma_lut16; + uint16_t gamma_lut8[256]; + unsigned char trns_px[8]; + union spng__decode_plte decode_plte; + struct spng_sbit decode_sb; + struct decode_flags decode_flags; + struct spng_row_info row_info; + + struct encode_flags encode_flags; +}; + +static const uint32_t spng_u32max = INT32_MAX; + +static const uint32_t adam7_x_start[7] = { 0, 4, 0, 2, 0, 1, 0 }; +static const uint32_t adam7_y_start[7] = { 0, 0, 4, 0, 2, 0, 1 }; +static const uint32_t adam7_x_delta[7] = { 8, 8, 4, 4, 2, 2, 1 }; +static const uint32_t adam7_y_delta[7] = { 8, 8, 8, 4, 4, 2, 2 }; + +static const uint8_t spng_signature[8] = { 137, 80, 78, 71, 13, 10, 26, 10 }; + +static const uint8_t type_ihdr[4] = { 73, 72, 68, 82 }; +static const uint8_t type_plte[4] = { 80, 76, 84, 69 }; +static const uint8_t type_idat[4] = { 73, 68, 65, 84 }; +static const uint8_t type_iend[4] = { 73, 69, 78, 68 }; + +static const uint8_t type_trns[4] = { 116, 82, 78, 83 }; +static const uint8_t type_chrm[4] = { 99, 72, 82, 77 }; +static const uint8_t type_gama[4] = { 103, 65, 77, 65 }; +static const uint8_t type_iccp[4] = { 105, 67, 67, 80 }; +static const uint8_t type_sbit[4] = { 115, 66, 73, 84 }; +static const uint8_t type_srgb[4] = { 115, 82, 71, 66 }; +static const uint8_t type_text[4] = { 116, 69, 88, 116 }; +static const uint8_t type_ztxt[4] = { 122, 84, 88, 116 }; +static const uint8_t type_itxt[4] = { 105, 84, 88, 116 }; +static const uint8_t type_bkgd[4] = { 98, 75, 71, 68 }; +static const uint8_t type_hist[4] = { 104, 73, 83, 84 }; +static const uint8_t type_phys[4] = { 112, 72, 89, 115 }; +static const uint8_t type_splt[4] = { 115, 80, 76, 84 }; +static const uint8_t type_time[4] = { 116, 73, 77, 69 }; + +static const uint8_t type_offs[4] = { 111, 70, 70, 115 }; +static const uint8_t type_exif[4] = { 101, 88, 73, 102 }; + +static inline void *spng__malloc(spng_ctx *ctx, size_t size) +{ + return ctx->alloc.malloc_fn(size); +} + +static inline void *spng__calloc(spng_ctx *ctx, size_t nmemb, size_t size) +{ + return ctx->alloc.calloc_fn(nmemb, size); +} + +static inline void *spng__realloc(spng_ctx *ctx, void *ptr, size_t size) +{ + return ctx->alloc.realloc_fn(ptr, size); +} + +static inline void spng__free(spng_ctx *ctx, void *ptr) +{ + ctx->alloc.free_fn(ptr); +} + +#if defined(SPNG_USE_MINIZ) +static void *spng__zalloc(void *opaque, size_t items, size_t size) +#else +static void *spng__zalloc(void *opaque, uInt items, uInt size) +#endif +{ + spng_ctx *ctx = opaque; + + if(size > SIZE_MAX / items) return NULL; + + size_t len = (size_t)items * size; + + return spng__malloc(ctx, len); +} + +static void spng__zfree(void *opqaue, void *ptr) +{ + spng_ctx *ctx = opqaue; + spng__free(ctx, ptr); +} + +static inline uint16_t read_u16(const void *src) +{ + const unsigned char *data = src; + + return (data[0] & 0xFFU) << 8 | (data[1] & 0xFFU); +} + +static inline uint32_t read_u32(const void *src) +{ + const unsigned char *data = src; + + return (data[0] & 0xFFUL) << 24 | (data[1] & 0xFFUL) << 16 | + (data[2] & 0xFFUL) << 8 | (data[3] & 0xFFUL); +} + +static inline int32_t read_s32(const void *src) +{ + int32_t ret = (int32_t)read_u32(src); + + return ret; +} + +static inline void write_u16(void *dest, uint16_t x) +{ + unsigned char *data = dest; + + data[0] = x >> 8; + data[1] = x & 0xFF; +} + +static inline void write_u32(void *dest, uint32_t x) +{ + unsigned char *data = dest; + + data[0] = (x >> 24); + data[1] = (x >> 16) & 0xFF; + data[2] = (x >> 8) & 0xFF; + data[3] = x & 0xFF; +} + +static inline void write_s32(void *dest, int32_t x) +{ + uint32_t n = x; + write_u32(dest, n); +} + +/* Returns an iterator for 1,2,4,8-bit samples */ +static struct spng__iter spng__iter_init(unsigned bit_depth, const unsigned char *samples) +{ + struct spng__iter iter = + { + .mask = (uint32_t)(1 << bit_depth) - 1, + .shift_amount = 8 - bit_depth, + .initial_shift = 8 - bit_depth, + .bit_depth = bit_depth, + .samples = samples + }; + + return iter; +} + +/* Returns the current sample unpacked, iterates to the next one */ +static inline uint8_t get_sample(struct spng__iter *iter) +{ + uint8_t x = (iter->samples[0] >> iter->shift_amount) & iter->mask; + + iter->shift_amount -= iter->bit_depth; + + if(iter->shift_amount > 7) + { + iter->shift_amount = iter->initial_shift; + iter->samples++; + } + + return x; +} + +static void u16_row_to_host(void *row, size_t size) +{ + uint16_t *px = row; + size_t i, n = size / 2; + + for(i=0; i < n; i++) + { + px[i] = read_u16(&px[i]); + } +} + +static void u16_row_to_bigendian(void *row, size_t size) +{ + uint16_t *px = (uint16_t*)row; + size_t i, n = size / 2; + + for(i=0; i < n; i++) + { + write_u16(&px[i], px[i]); + } +} + +static void rgb8_row_to_rgba8(const unsigned char *row, unsigned char *out, uint32_t n) +{ + uint32_t i; + for(i=0; i < n; i++) + { + memcpy(out + i * 4, row + i * 3, 3); + out[i*4+3] = 255; + } +} + +static unsigned num_channels(const struct spng_ihdr *ihdr) +{ + switch(ihdr->color_type) + { + case SPNG_COLOR_TYPE_TRUECOLOR: return 3; + case SPNG_COLOR_TYPE_GRAYSCALE_ALPHA: return 2; + case SPNG_COLOR_TYPE_TRUECOLOR_ALPHA: return 4; + case SPNG_COLOR_TYPE_GRAYSCALE: + case SPNG_COLOR_TYPE_INDEXED: + return 1; + default: return 0; + } +} + +/* Calculate scanline width in bits, round up to the nearest byte */ +static int calculate_scanline_width(const struct spng_ihdr *ihdr, uint32_t width, size_t *scanline_width) +{ + if(ihdr == NULL || !width) return SPNG_EINTERNAL; + + size_t res = num_channels(ihdr) * ihdr->bit_depth; + + if(res > SIZE_MAX / width) return SPNG_EOVERFLOW; + res = res * width; + + res += 15; /* Filter byte + 7 for rounding */ + + if(res < 15) return SPNG_EOVERFLOW; + + res /= 8; + + if(res > UINT32_MAX) return SPNG_EOVERFLOW; + + *scanline_width = res; + + return 0; +} + +static int calculate_subimages(struct spng_ctx *ctx) +{ + if(ctx == NULL) return SPNG_EINTERNAL; + + struct spng_ihdr *ihdr = &ctx->ihdr; + struct spng_subimage *sub = ctx->subimage; + + if(ihdr->interlace_method == 1) + { + sub[0].width = (ihdr->width + 7) >> 3; + sub[0].height = (ihdr->height + 7) >> 3; + sub[1].width = (ihdr->width + 3) >> 3; + sub[1].height = (ihdr->height + 7) >> 3; + sub[2].width = (ihdr->width + 3) >> 2; + sub[2].height = (ihdr->height + 3) >> 3; + sub[3].width = (ihdr->width + 1) >> 2; + sub[3].height = (ihdr->height + 3) >> 2; + sub[4].width = (ihdr->width + 1) >> 1; + sub[4].height = (ihdr->height + 1) >> 2; + sub[5].width = ihdr->width >> 1; + sub[5].height = (ihdr->height + 1) >> 1; + sub[6].width = ihdr->width; + sub[6].height = ihdr->height >> 1; + } + else + { + sub[0].width = ihdr->width; + sub[0].height = ihdr->height; + } + + int i; + for(i=0; i < 7; i++) + { + if(sub[i].width == 0 || sub[i].height == 0) continue; + + int ret = calculate_scanline_width(ihdr, sub[i].width, &sub[i].scanline_width); + if(ret) return ret; + + if(sub[ctx->widest_pass].scanline_width < sub[i].scanline_width) ctx->widest_pass = i; + + ctx->last_pass = i; + } + + return 0; +} + +static int check_decode_fmt(const struct spng_ihdr *ihdr, const int fmt) +{ + switch(fmt) + { + case SPNG_FMT_RGBA8: + case SPNG_FMT_RGBA16: + case SPNG_FMT_RGB8: + case SPNG_FMT_PNG: + case SPNG_FMT_RAW: + return 0; + case SPNG_FMT_G8: + case SPNG_FMT_GA8: + if(ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE && ihdr->bit_depth <= 8) return 0; + else return SPNG_EFMT; + case SPNG_FMT_GA16: + if(ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE && ihdr->bit_depth == 16) return 0; + else return SPNG_EFMT; + default: return SPNG_EFMT; + } +} + +static int calculate_image_width(const struct spng_ihdr *ihdr, int fmt, size_t *len) +{ + if(ihdr == NULL || len == NULL) return SPNG_EINTERNAL; + + size_t res = ihdr->width; + unsigned bytes_per_pixel; + + switch(fmt) + { + case SPNG_FMT_RGBA8: + case SPNG_FMT_GA16: + bytes_per_pixel = 4; + break; + case SPNG_FMT_RGBA16: + bytes_per_pixel = 8; + break; + case SPNG_FMT_RGB8: + bytes_per_pixel = 3; + break; + case SPNG_FMT_PNG: + case SPNG_FMT_RAW: + { + int ret = calculate_scanline_width(ihdr, ihdr->width, &res); + if(ret) return ret; + + res -= 1; /* exclude filter byte */ + bytes_per_pixel = 1; + break; + } + case SPNG_FMT_G8: + bytes_per_pixel = 1; + break; + case SPNG_FMT_GA8: + bytes_per_pixel = 2; + break; + default: return SPNG_EINTERNAL; + } + + if(res > SIZE_MAX / bytes_per_pixel) return SPNG_EOVERFLOW; + res = res * bytes_per_pixel; + + *len = res; + + return 0; +} + +static int calculate_image_size(const struct spng_ihdr *ihdr, int fmt, size_t *len) +{ + if(ihdr == NULL || len == NULL) return SPNG_EINTERNAL; + + size_t res = 0; + + int ret = calculate_image_width(ihdr, fmt, &res); + if(ret) return ret; + + if(res > SIZE_MAX / ihdr->height) return SPNG_EOVERFLOW; + res = res * ihdr->height; + + *len = res; + + return 0; +} + +static int increase_cache_usage(spng_ctx *ctx, size_t bytes, int new_chunk) +{ + if(ctx == NULL || !bytes) return SPNG_EINTERNAL; + + if(new_chunk) + { + ctx->chunk_count_total++; + if(ctx->chunk_count_total < 1) return SPNG_EOVERFLOW; + + if(ctx->chunk_count_total > ctx->chunk_count_limit) return SPNG_ECHUNK_LIMITS; + } + + size_t new_usage = ctx->chunk_cache_usage + bytes; + + if(new_usage < ctx->chunk_cache_usage) return SPNG_EOVERFLOW; + + if(new_usage > ctx->chunk_cache_limit) return SPNG_ECHUNK_LIMITS; + + ctx->chunk_cache_usage = new_usage; + + return 0; +} + +static int decrease_cache_usage(spng_ctx *ctx, size_t usage) +{ + if(ctx == NULL || !usage) return SPNG_EINTERNAL; + if(usage > ctx->chunk_cache_usage) return SPNG_EINTERNAL; + + ctx->chunk_cache_usage -= usage; + + return 0; +} + +static int is_critical_chunk(struct spng_chunk *chunk) +{ + if(chunk == NULL) return 0; + if((chunk->type[0] & (1 << 5)) == 0) return 1; + + return 0; +} + +static int decode_err(spng_ctx *ctx, int err) +{ + ctx->state = SPNG_STATE_INVALID; + + return err; +} + +static int encode_err(spng_ctx *ctx, int err) +{ + ctx->state = SPNG_STATE_INVALID; + + return err; +} + +static inline int read_data(spng_ctx *ctx, size_t bytes) +{ + if(ctx == NULL) return SPNG_EINTERNAL; + if(!bytes) return 0; + + if(ctx->streaming && (bytes > SPNG_READ_SIZE)) return SPNG_EINTERNAL; + + int ret = ctx->read_fn(ctx, ctx->stream_user_ptr, ctx->stream_buf, bytes); + + if(ret) + { + if(ret > 0 || ret < SPNG_IO_ERROR) ret = SPNG_IO_ERROR; + + return ret; + } + + ctx->bytes_read += bytes; + if(ctx->bytes_read < bytes) return SPNG_EOVERFLOW; + + return 0; +} + +/* Ensure there is enough space for encoding starting at ctx->write_ptr */ +static int require_bytes(spng_ctx *ctx, size_t bytes) +{ + if(ctx == NULL) return SPNG_EINTERNAL; + + if(ctx->streaming) + { + if(bytes > ctx->stream_buf_size) + { + size_t new_size = ctx->stream_buf_size; + + /* Start at default IDAT size + header + crc */ + if(new_size < (SPNG_WRITE_SIZE + 12)) new_size = SPNG_WRITE_SIZE + 12; + + if(new_size < bytes) new_size = bytes; + + void *temp = spng__realloc(ctx, ctx->stream_buf, new_size); + + if(temp == NULL) return encode_err(ctx, SPNG_EMEM); + + ctx->stream_buf = temp; + ctx->stream_buf_size = bytes; + ctx->write_ptr = ctx->stream_buf; + } + + return 0; + } + + if(!ctx->internal_buffer) return SPNG_ENODST; + + size_t required = ctx->bytes_encoded + bytes; + if(required < bytes) return SPNG_EOVERFLOW; + + if(required > ctx->out_png_size) + { + size_t new_size = ctx->out_png_size; + + /* Start with a size that doesn't require a realloc() 100% of the time */ + if(new_size < (SPNG_WRITE_SIZE * 2)) new_size = SPNG_WRITE_SIZE * 2; + + /* Prefer the next power of two over the requested size */ + while(new_size < required) + { + if(new_size / SIZE_MAX > 2) return encode_err(ctx, SPNG_EOVERFLOW); + + new_size *= 2; + } + + void *temp = spng__realloc(ctx, ctx->out_png, new_size); + + if(temp == NULL) return encode_err(ctx, SPNG_EMEM); + + ctx->out_png = temp; + ctx->out_png_size = new_size; + ctx->write_ptr = ctx->out_png + ctx->bytes_encoded; + } + + return 0; +} + +static int write_data(spng_ctx *ctx, const void *data, size_t bytes) +{ + if(ctx == NULL) return SPNG_EINTERNAL; + if(!bytes) return 0; + + if(ctx->streaming) + { + if(bytes > SPNG_WRITE_SIZE) return SPNG_EINTERNAL; + + int ret = ctx->write_fn(ctx, ctx->stream_user_ptr, (void*)data, bytes); + + if(ret) + { + if(ret > 0 || ret < SPNG_IO_ERROR) ret = SPNG_IO_ERROR; + + return encode_err(ctx, ret); + } + } + else + { + int ret = require_bytes(ctx, bytes); + if(ret) return encode_err(ctx, ret); + + memcpy(ctx->write_ptr, data, bytes); + + ctx->write_ptr += bytes; + } + + ctx->bytes_encoded += bytes; + if(ctx->bytes_encoded < bytes) return SPNG_EOVERFLOW; + + return 0; +} + +static int write_header(spng_ctx *ctx, const uint8_t chunk_type[4], size_t chunk_length, unsigned char **data) +{ + if(ctx == NULL || chunk_type == NULL) return SPNG_EINTERNAL; + if(chunk_length > spng_u32max) return SPNG_EINTERNAL; + + size_t total = chunk_length + 12; + + int ret = require_bytes(ctx, total); + if(ret) return ret; + + uint32_t crc = crc32(0, NULL, 0); + ctx->current_chunk.crc = crc32(crc, chunk_type, 4); + + memcpy(&ctx->current_chunk.type, chunk_type, 4); + ctx->current_chunk.length = (uint32_t)chunk_length; + + if(!data) return SPNG_EINTERNAL; + + if(ctx->streaming) *data = ctx->stream_buf + 8; + else *data = ctx->write_ptr + 8; + + return 0; +} + +static int trim_chunk(spng_ctx *ctx, uint32_t length) +{ + if(length > spng_u32max) return SPNG_EINTERNAL; + if(length > ctx->current_chunk.length) return SPNG_EINTERNAL; + + ctx->current_chunk.length = length; + + return 0; +} + +static int finish_chunk(spng_ctx *ctx) +{ + if(ctx == NULL) return SPNG_EINTERNAL; + + struct spng_chunk *chunk = &ctx->current_chunk; + + unsigned char *header; + unsigned char *chunk_data; + + if(ctx->streaming) + { + chunk_data = ctx->stream_buf + 8; + header = ctx->stream_buf; + } + else + { + chunk_data = ctx->write_ptr + 8; + header = ctx->write_ptr; + } + + write_u32(header, chunk->length); + memcpy(header + 4, chunk->type, 4); + + chunk->crc = crc32(chunk->crc, chunk_data, chunk->length); + + write_u32(chunk_data + chunk->length, chunk->crc); + + if(ctx->streaming) + { + const unsigned char *ptr = ctx->stream_buf; + uint32_t bytes_left = chunk->length + 12; + uint32_t len = 0; + + while(bytes_left) + { + ptr += len; + len = SPNG_WRITE_SIZE; + + if(len > bytes_left) len = bytes_left; + + int ret = write_data(ctx, ptr, len); + if(ret) return ret; + + bytes_left -= len; + } + } + else + { + ctx->bytes_encoded += chunk->length; + if(ctx->bytes_encoded < chunk->length) return SPNG_EOVERFLOW; + + ctx->bytes_encoded += 12; + if(ctx->bytes_encoded < 12) return SPNG_EOVERFLOW; + + ctx->write_ptr += chunk->length + 12; + } + + return 0; +} + +static int write_chunk(spng_ctx *ctx, const uint8_t type[4], const void *data, size_t length) +{ + if(ctx == NULL || type == NULL) return SPNG_EINTERNAL; + if(length && data == NULL) return SPNG_EINTERNAL; + + unsigned char *write_ptr; + + int ret = write_header(ctx, type, length, &write_ptr); + if(ret) return ret; + + if(length) memcpy(write_ptr, data, length); + + return finish_chunk(ctx); +} + +static int write_iend(spng_ctx *ctx) +{ + unsigned char iend_chunk[12] = { 0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130 }; + return write_data(ctx, iend_chunk, 12); +} + +static int write_unknown_chunks(spng_ctx *ctx, enum spng_location location) +{ + if(!ctx->stored.unknown) return 0; + + const struct spng_unknown_chunk *chunk = ctx->chunk_list; + + uint32_t i; + for(i=0; i < ctx->n_chunks; i++, chunk++) + { + if(chunk->location != location) continue; + + int ret = write_chunk(ctx, chunk->type, chunk->data, chunk->length); + if(ret) return ret; + } + + return 0; +} + +/* Read and check the current chunk's crc, + returns -SPNG_CRC_DISCARD if the chunk should be discarded */ +static inline int read_and_check_crc(spng_ctx *ctx) +{ + if(ctx == NULL) return SPNG_EINTERNAL; + + int ret; + ret = read_data(ctx, 4); + if(ret) return ret; + + ctx->current_chunk.crc = read_u32(ctx->data); + + if(ctx->skip_crc) return 0; + + if(ctx->cur_actual_crc != ctx->current_chunk.crc) + { + if(is_critical_chunk(&ctx->current_chunk)) + { + if(ctx->crc_action_critical == SPNG_CRC_USE) return 0; + } + else + { + if(ctx->crc_action_ancillary == SPNG_CRC_USE) return 0; + if(ctx->crc_action_ancillary == SPNG_CRC_DISCARD) return -SPNG_CRC_DISCARD; + } + + return SPNG_ECHUNK_CRC; + } + + return 0; +} + +/* Read and validate the current chunk's crc and the next chunk header */ +static inline int read_header(spng_ctx *ctx) +{ + if(ctx == NULL) return SPNG_EINTERNAL; + + int ret; + struct spng_chunk chunk = { 0 }; + + ret = read_and_check_crc(ctx); + if(ret) + { + if(ret == -SPNG_CRC_DISCARD) + { + ctx->discard = 1; + } + else return ret; + } + + ret = read_data(ctx, 8); + if(ret) return ret; + + chunk.offset = ctx->bytes_read - 8; + + chunk.length = read_u32(ctx->data); + + memcpy(&chunk.type, ctx->data + 4, 4); + + if(chunk.length > spng_u32max) return SPNG_ECHUNK_STDLEN; + + ctx->cur_chunk_bytes_left = chunk.length; + + if(is_critical_chunk(&chunk) && ctx->crc_action_critical == SPNG_CRC_USE) ctx->skip_crc = 1; + else if(ctx->crc_action_ancillary == SPNG_CRC_USE) ctx->skip_crc = 1; + else ctx->skip_crc = 0; + + if(!ctx->skip_crc) + { + ctx->cur_actual_crc = crc32(0, NULL, 0); + ctx->cur_actual_crc = crc32(ctx->cur_actual_crc, chunk.type, 4); + } + + ctx->current_chunk = chunk; + + return 0; +} + +/* Read chunk bytes and update crc */ +static int read_chunk_bytes(spng_ctx *ctx, uint32_t bytes) +{ + if(ctx == NULL) return SPNG_EINTERNAL; + if(!ctx->cur_chunk_bytes_left || !bytes) return SPNG_EINTERNAL; + if(bytes > ctx->cur_chunk_bytes_left) return SPNG_EINTERNAL; /* XXX: more specific error? */ + + int ret; + + ret = read_data(ctx, bytes); + if(ret) return ret; + + if(!ctx->skip_crc) ctx->cur_actual_crc = crc32(ctx->cur_actual_crc, ctx->data, bytes); + + ctx->cur_chunk_bytes_left -= bytes; + + return ret; +} + +/* read_chunk_bytes() + read_data() with custom output buffer */ +static int read_chunk_bytes2(spng_ctx *ctx, void *out, uint32_t bytes) +{ + if(ctx == NULL) return SPNG_EINTERNAL; + if(!ctx->cur_chunk_bytes_left || !bytes) return SPNG_EINTERNAL; + if(bytes > ctx->cur_chunk_bytes_left) return SPNG_EINTERNAL; /* XXX: more specific error? */ + + int ret; + uint32_t len = bytes; + + if(ctx->streaming && len > SPNG_READ_SIZE) len = SPNG_READ_SIZE; + + while(bytes) + { + if(len > bytes) len = bytes; + + ret = ctx->read_fn(ctx, ctx->stream_user_ptr, out, len); + if(ret) return ret; + + if(!ctx->streaming) memcpy(out, ctx->data, len); + + ctx->bytes_read += len; + if(ctx->bytes_read < len) return SPNG_EOVERFLOW; + + if(!ctx->skip_crc) ctx->cur_actual_crc = crc32(ctx->cur_actual_crc, out, len); + + ctx->cur_chunk_bytes_left -= len; + + out = (char*)out + len; + bytes -= len; + len = SPNG_READ_SIZE; + } + + return 0; +} + +static int discard_chunk_bytes(spng_ctx *ctx, uint32_t bytes) +{ + if(ctx == NULL) return SPNG_EINTERNAL; + if(!bytes) return 0; + + int ret; + + if(ctx->streaming) /* Do small, consecutive reads */ + { + while(bytes) + { + uint32_t len = SPNG_READ_SIZE; + + if(len > bytes) len = bytes; + + ret = read_chunk_bytes(ctx, len); + if(ret) return ret; + + bytes -= len; + } + } + else + { + ret = read_chunk_bytes(ctx, bytes); + if(ret) return ret; + } + + return 0; +} + +static int spng__inflate_init(spng_ctx *ctx, int window_bits) +{ + if(ctx->zstream.state) inflateEnd(&ctx->zstream); + + ctx->inflate = 1; + + ctx->zstream.zalloc = spng__zalloc; + ctx->zstream.zfree = spng__zfree; + ctx->zstream.opaque = ctx; + + if(inflateInit2(&ctx->zstream, window_bits) != Z_OK) return SPNG_EZLIB_INIT; + +#if ZLIB_VERNUM >= 0x1290 && !defined(SPNG_USE_MINIZ) + + int validate = 1; + + if(ctx->flags & SPNG_CTX_IGNORE_ADLER32) validate = 0; + + if(is_critical_chunk(&ctx->current_chunk)) + { + if(ctx->crc_action_critical == SPNG_CRC_USE) validate = 0; + } + else /* ancillary */ + { + if(ctx->crc_action_ancillary == SPNG_CRC_USE) validate = 0; + } + + if(inflateValidate(&ctx->zstream, validate)) return SPNG_EZLIB_INIT; + +#else /* This requires zlib >= 1.2.11 */ + #pragma message ("inflateValidate() not available, SPNG_CTX_IGNORE_ADLER32 will be ignored") +#endif + + return 0; +} + +static int spng__deflate_init(spng_ctx *ctx, struct spng__zlib_options *options) +{ + if(ctx->zstream.state) deflateEnd(&ctx->zstream); + + ctx->deflate = 1; + + z_stream *zstream = &ctx->zstream; + zstream->zalloc = spng__zalloc; + zstream->zfree = spng__zfree; + zstream->opaque = ctx; + zstream->data_type = options->data_type; + + int ret = deflateInit2(zstream, options->compression_level, Z_DEFLATED, options->window_bits, options->mem_level, options->strategy); + + if(ret != Z_OK) return SPNG_EZLIB_INIT; + + return 0; +} + +/* Inflate a zlib stream starting with start_buf if non-NULL, + continuing from the datastream till an end marker, + allocating and writing the inflated stream to *out, + leaving "extra" bytes at the end, final buffer length is *len. + + Takes into account the chunk size and cache limits. +*/ +static int spng__inflate_stream(spng_ctx *ctx, char **out, size_t *len, size_t extra, const void *start_buf, size_t start_len) +{ + int ret = spng__inflate_init(ctx, 15); + if(ret) return ret; + + size_t max = ctx->chunk_cache_limit - ctx->chunk_cache_usage; + + if(ctx->max_chunk_size < max) max = ctx->max_chunk_size; + + if(extra > max) return SPNG_ECHUNK_LIMITS; + max -= extra; + + uint32_t read_size; + size_t size = 8 * 1024; + void *t, *buf = spng__malloc(ctx, size); + + if(buf == NULL) return SPNG_EMEM; + + z_stream *stream = &ctx->zstream; + + if(start_buf != NULL && start_len) + { + stream->avail_in = (uInt)start_len; + stream->next_in = start_buf; + } + else + { + stream->avail_in = 0; + stream->next_in = NULL; + } + + stream->avail_out = (uInt)size; + stream->next_out = buf; + + while(ret != Z_STREAM_END) + { + ret = inflate(stream, Z_NO_FLUSH); + + if(ret == Z_STREAM_END) break; + + if(ret != Z_OK && ret != Z_BUF_ERROR) + { + ret = SPNG_EZLIB; + goto err; + } + + if(!stream->avail_out) /* Resize buffer */ + { + /* overflow or reached chunk/cache limit */ + if( (2 > SIZE_MAX / size) || (size > max / 2) ) + { + ret = SPNG_ECHUNK_LIMITS; + goto err; + } + + size *= 2; + + t = spng__realloc(ctx, buf, size); + if(t == NULL) goto mem; + + buf = t; + + stream->avail_out = (uInt)size / 2; + stream->next_out = (unsigned char*)buf + size / 2; + } + else if(!stream->avail_in) /* Read more chunk bytes */ + { + read_size = ctx->cur_chunk_bytes_left; + if(ctx->streaming && read_size > SPNG_READ_SIZE) read_size = SPNG_READ_SIZE; + + ret = read_chunk_bytes(ctx, read_size); + + if(ret) + { + if(!read_size) ret = SPNG_EZLIB; + + goto err; + } + + stream->avail_in = read_size; + stream->next_in = ctx->data; + } + } + + size = stream->total_out; + + if(!size) + { + ret = SPNG_EZLIB; + goto err; + } + + size += extra; + if(size < extra) goto mem; + + t = spng__realloc(ctx, buf, size); + if(t == NULL) goto mem; + + buf = t; + + (void)increase_cache_usage(ctx, size, 0); + + *out = buf; + *len = size; + + return 0; + +mem: + ret = SPNG_EMEM; +err: + spng__free(ctx, buf); + return ret; +} + +/* Read at least one byte from the IDAT stream */ +static int read_idat_bytes(spng_ctx *ctx, uint32_t *bytes_read) +{ + if(ctx == NULL || bytes_read == NULL) return SPNG_EINTERNAL; + if(memcmp(ctx->current_chunk.type, type_idat, 4)) return SPNG_EIDAT_TOO_SHORT; + + int ret; + uint32_t len; + + while(!ctx->cur_chunk_bytes_left) + { + ret = read_header(ctx); + if(ret) return ret; + + if(memcmp(ctx->current_chunk.type, type_idat, 4)) return SPNG_EIDAT_TOO_SHORT; + } + + if(ctx->streaming) + {/* TODO: estimate bytes to read for progressive reads */ + len = SPNG_READ_SIZE; + if(len > ctx->cur_chunk_bytes_left) len = ctx->cur_chunk_bytes_left; + } + else len = ctx->current_chunk.length; + + ret = read_chunk_bytes(ctx, len); + + *bytes_read = len; + + return ret; +} + +static int read_scanline_bytes(spng_ctx *ctx, unsigned char *dest, size_t len) +{ + if(ctx == NULL || dest == NULL) return SPNG_EINTERNAL; + + int ret = Z_OK; + uint32_t bytes_read; + + z_stream *zstream = &ctx->zstream; + + zstream->avail_out = (uInt)len; + zstream->next_out = dest; + + while(zstream->avail_out != 0) + { + ret = inflate(zstream, Z_NO_FLUSH); + + if(ret == Z_OK) continue; + + if(ret == Z_STREAM_END) /* Reached an end-marker */ + { + if(zstream->avail_out != 0) return SPNG_EIDAT_TOO_SHORT; + } + else if(ret == Z_BUF_ERROR) /* Read more IDAT bytes */ + { + ret = read_idat_bytes(ctx, &bytes_read); + if(ret) return ret; + + zstream->avail_in = bytes_read; + zstream->next_in = ctx->data; + } + else return SPNG_EIDAT_STREAM; + } + + return 0; +} + +static uint8_t paeth(uint8_t a, uint8_t b, uint8_t c) +{ + int16_t p = a + b - c; + int16_t pa = abs(p - a); + int16_t pb = abs(p - b); + int16_t pc = abs(p - c); + + if(pa <= pb && pa <= pc) return a; + else if(pb <= pc) return b; + + return c; +} + +SPNG_TARGET_CLONES("default,avx2") +static void defilter_up(size_t bytes, unsigned char *row, const unsigned char *prev) +{ + size_t i; + for(i=0; i < bytes; i++) + { + row[i] += prev[i]; + } +} + +/* Defilter *scanline in-place. + *prev_scanline and *scanline should point to the first pixel, + scanline_width is the width of the scanline including the filter byte. +*/ +static int defilter_scanline(const unsigned char *prev_scanline, unsigned char *scanline, + size_t scanline_width, unsigned bytes_per_pixel, unsigned filter) +{ + if(prev_scanline == NULL || scanline == NULL || !scanline_width) return SPNG_EINTERNAL; + + size_t i; + scanline_width--; + + if(filter == 0) return 0; + +#ifndef SPNG_DISABLE_OPT + if(filter == SPNG_FILTER_UP) goto no_opt; + + if(bytes_per_pixel == 4) + { + if(filter == SPNG_FILTER_SUB) + defilter_sub4(scanline_width, scanline); + else if(filter == SPNG_FILTER_AVERAGE) + defilter_avg4(scanline_width, scanline, prev_scanline); + else if(filter == SPNG_FILTER_PAETH) + defilter_paeth4(scanline_width, scanline, prev_scanline); + else return SPNG_EFILTER; + + return 0; + } + else if(bytes_per_pixel == 3) + { + if(filter == SPNG_FILTER_SUB) + defilter_sub3(scanline_width, scanline); + else if(filter == SPNG_FILTER_AVERAGE) + defilter_avg3(scanline_width, scanline, prev_scanline); + else if(filter == SPNG_FILTER_PAETH) + defilter_paeth3(scanline_width, scanline, prev_scanline); + else return SPNG_EFILTER; + + return 0; + } +no_opt: +#endif + + if(filter == SPNG_FILTER_UP) + { + defilter_up(scanline_width, scanline, prev_scanline); + return 0; + } + + for(i=0; i < scanline_width; i++) + { + uint8_t x, a, b, c; + + if(i >= bytes_per_pixel) + { + a = scanline[i - bytes_per_pixel]; + b = prev_scanline[i]; + c = prev_scanline[i - bytes_per_pixel]; + } + else /* First pixel in row */ + { + a = 0; + b = prev_scanline[i]; + c = 0; + } + + x = scanline[i]; + + switch(filter) + { + case SPNG_FILTER_SUB: + { + x = x + a; + break; + } + case SPNG_FILTER_AVERAGE: + { + uint16_t avg = (a + b) / 2; + x = x + avg; + break; + } + case SPNG_FILTER_PAETH: + { + x = x + paeth(a,b,c); + break; + } + } + + scanline[i] = x; + } + + return 0; +} + +static int filter_scanline(unsigned char *filtered, const unsigned char *prev_scanline, const unsigned char *scanline, + size_t scanline_width, unsigned bytes_per_pixel, const unsigned filter) +{ + if(prev_scanline == NULL || scanline == NULL || scanline_width <= 1) return SPNG_EINTERNAL; + + if(filter > 4) return SPNG_EFILTER; + if(filter == 0) return 0; + + scanline_width--; + + uint32_t i; + for(i=0; i < scanline_width; i++) + { + uint8_t x, a, b, c; + + if(i >= bytes_per_pixel) + { + a = scanline[i - bytes_per_pixel]; + b = prev_scanline[i]; + c = prev_scanline[i - bytes_per_pixel]; + } + else /* first pixel in row */ + { + a = 0; + b = prev_scanline[i]; + c = 0; + } + + x = scanline[i]; + + switch(filter) + { + case SPNG_FILTER_SUB: + { + x = x - a; + break; + } + case SPNG_FILTER_UP: + { + x = x - b; + break; + } + case SPNG_FILTER_AVERAGE: + { + uint16_t avg = (a + b) / 2; + x = x - avg; + break; + } + case SPNG_FILTER_PAETH: + { + x = x - paeth(a,b,c); + break; + } + } + + filtered[i] = x; + } + + return 0; +} + +static int32_t filter_sum(const unsigned char *prev_scanline, const unsigned char *scanline, + size_t size, unsigned bytes_per_pixel, const unsigned filter) +{ + /* prevent potential over/underflow, bails out at a width of ~8M pixels for RGBA8 */ + if(size > (INT32_MAX / 128)) return INT32_MAX; + + uint32_t i; + int32_t sum = 0; + uint8_t x, a, b, c; + + for(i=0; i < size; i++) + { + if(i >= bytes_per_pixel) + { + a = scanline[i - bytes_per_pixel]; + b = prev_scanline[i]; + c = prev_scanline[i - bytes_per_pixel]; + } + else /* first pixel in row */ + { + a = 0; + b = prev_scanline[i]; + c = 0; + } + + x = scanline[i]; + + switch(filter) + { + case SPNG_FILTER_NONE: + { + break; + } + case SPNG_FILTER_SUB: + { + x = x - a; + break; + } + case SPNG_FILTER_UP: + { + x = x - b; + break; + } + case SPNG_FILTER_AVERAGE: + { + uint16_t avg = (a + b) / 2; + x = x - avg; + break; + } + case SPNG_FILTER_PAETH: + { + x = x - paeth(a,b,c); + break; + } + } + + sum += 128 - abs((int)x - 128); + } + + return sum; +} + +static unsigned get_best_filter(const unsigned char *prev_scanline, const unsigned char *scanline, + size_t scanline_width, unsigned bytes_per_pixel, const int choices) +{ + if(!choices) return SPNG_FILTER_NONE; + + scanline_width--; + + int i; + unsigned int best_filter = 0; + enum spng_filter_choice flag; + int32_t sum, best_score = INT32_MAX; + int32_t filter_scores[5] = { INT32_MAX, INT32_MAX, INT32_MAX, INT32_MAX, INT32_MAX }; + + if( !(choices & (choices - 1)) ) + {/* only one choice/bit is set */ + for(i=0; i < 5; i++) + { + if(choices == 1 << (i + 3)) return i; + } + } + + for(i=0; i < 5; i++) + { + flag = 1 << (i + 3); + + if(choices & flag) sum = filter_sum(prev_scanline, scanline, scanline_width, bytes_per_pixel, i); + else continue; + + filter_scores[i] = abs(sum); + + if(filter_scores[i] < best_score) + { + best_score = filter_scores[i]; + best_filter = i; + } + } + + return best_filter; +} + +/* Scale "sbits" significant bits in "sample" from "bit_depth" to "target" + + "bit_depth" must be a valid PNG depth + "sbits" must be less than or equal to "bit_depth" + "target" must be between 1 and 16 +*/ +static uint16_t sample_to_target(uint16_t sample, unsigned bit_depth, unsigned sbits, unsigned target) +{ + if(bit_depth == sbits) + { + if(target == sbits) return sample; /* No scaling */ + }/* bit_depth > sbits */ + else sample = sample >> (bit_depth - sbits); /* Shift significant bits to bottom */ + + /* Downscale */ + if(target < sbits) return sample >> (sbits - target); + + /* Upscale using left bit replication */ + int8_t shift_amount = target - sbits; + uint16_t sample_bits = sample; + sample = 0; + + while(shift_amount >= 0) + { + sample = sample | (sample_bits << shift_amount); + shift_amount -= sbits; + } + + int8_t partial = shift_amount + (int8_t)sbits; + + if(partial != 0) sample = sample | (sample_bits >> abs(shift_amount)); + + return sample; +} + +static inline void gamma_correct_row(unsigned char *row, uint32_t pixels, int fmt, const uint16_t *gamma_lut) +{ + uint32_t i; + + if(fmt == SPNG_FMT_RGBA8) + { + unsigned char *px; + for(i=0; i < pixels; i++) + { + px = row + i * 4; + + px[0] = gamma_lut[px[0]]; + px[1] = gamma_lut[px[1]]; + px[2] = gamma_lut[px[2]]; + } + } + else if(fmt == SPNG_FMT_RGBA16) + { + for(i=0; i < pixels; i++) + { + uint16_t px[4]; + memcpy(px, row + i * 8, 8); + + px[0] = gamma_lut[px[0]]; + px[1] = gamma_lut[px[1]]; + px[2] = gamma_lut[px[2]]; + + memcpy(row + i * 8, px, 8); + } + } + else if(fmt == SPNG_FMT_RGB8) + { + unsigned char *px; + for(i=0; i < pixels; i++) + { + px = row + i * 3; + + px[0] = gamma_lut[px[0]]; + px[1] = gamma_lut[px[1]]; + px[2] = gamma_lut[px[2]]; + } + } +} + +/* Apply transparency to output row */ +static inline void trns_row(unsigned char *row, + const unsigned char *scanline, + const unsigned char *trns, + unsigned scanline_stride, + struct spng_ihdr *ihdr, + uint32_t pixels, + int fmt) +{ + uint32_t i; + unsigned row_stride; + unsigned depth = ihdr->bit_depth; + + if(fmt == SPNG_FMT_RGBA8) + { + if(ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE) return; /* already applied in the decoding loop */ + + row_stride = 4; + for(i=0; i < pixels; i++, scanline+=scanline_stride, row+=row_stride) + { + if(!memcmp(scanline, trns, scanline_stride)) row[3] = 0; + } + } + else if(fmt == SPNG_FMT_RGBA16) + { + if(ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE) return; /* already applied in the decoding loop */ + + row_stride = 8; + for(i=0; i < pixels; i++, scanline+=scanline_stride, row+=row_stride) + { + if(!memcmp(scanline, trns, scanline_stride)) memset(row + 6, 0, 2); + } + } + else if(fmt == SPNG_FMT_GA8) + { + row_stride = 2; + + if(depth == 16) + { + for(i=0; i < pixels; i++, scanline+=scanline_stride, row+=row_stride) + { + if(!memcmp(scanline, trns, scanline_stride)) memset(row + 1, 0, 1); + } + } + else /* depth <= 8 */ + { + struct spng__iter iter = spng__iter_init(depth, scanline); + + for(i=0; i < pixels; i++, row+=row_stride) + { + if(trns[0] == get_sample(&iter)) row[1] = 0; + } + } + } + else if(fmt == SPNG_FMT_GA16) + { + row_stride = 4; + + if(depth == 16) + { + for(i=0; i< pixels; i++, scanline+=scanline_stride, row+=row_stride) + { + if(!memcmp(scanline, trns, 2)) memset(row + 2, 0, 2); + } + } + else + { + struct spng__iter iter = spng__iter_init(depth, scanline); + + for(i=0; i< pixels; i++, row+=row_stride) + { + if(trns[0] == get_sample(&iter)) memset(row + 2, 0, 2); + } + } + } + else return; +} + +static inline void scale_row(unsigned char *row, uint32_t pixels, int fmt, unsigned depth, const struct spng_sbit *sbit) +{ + uint32_t i; + + if(fmt == SPNG_FMT_RGBA8) + { + unsigned char px[4]; + for(i=0; i < pixels; i++) + { + memcpy(px, row + i * 4, 4); + + px[0] = sample_to_target(px[0], depth, sbit->red_bits, 8); + px[1] = sample_to_target(px[1], depth, sbit->green_bits, 8); + px[2] = sample_to_target(px[2], depth, sbit->blue_bits, 8); + px[3] = sample_to_target(px[3], depth, sbit->alpha_bits, 8); + + memcpy(row + i * 4, px, 4); + } + } + else if(fmt == SPNG_FMT_RGBA16) + { + uint16_t px[4]; + for(i=0; i < pixels; i++) + { + memcpy(px, row + i * 8, 8); + + px[0] = sample_to_target(px[0], depth, sbit->red_bits, 16); + px[1] = sample_to_target(px[1], depth, sbit->green_bits, 16); + px[2] = sample_to_target(px[2], depth, sbit->blue_bits, 16); + px[3] = sample_to_target(px[3], depth, sbit->alpha_bits, 16); + + memcpy(row + i * 8, px, 8); + } + } + else if(fmt == SPNG_FMT_RGB8) + { + unsigned char px[4]; + for(i=0; i < pixels; i++) + { + memcpy(px, row + i * 3, 3); + + px[0] = sample_to_target(px[0], depth, sbit->red_bits, 8); + px[1] = sample_to_target(px[1], depth, sbit->green_bits, 8); + px[2] = sample_to_target(px[2], depth, sbit->blue_bits, 8); + + memcpy(row + i * 3, px, 3); + } + } + else if(fmt == SPNG_FMT_G8) + { + for(i=0; i < pixels; i++) + { + row[i] = sample_to_target(row[i], depth, sbit->grayscale_bits, 8); + } + } + else if(fmt == SPNG_FMT_GA8) + { + for(i=0; i < pixels; i++) + { + row[i*2] = sample_to_target(row[i*2], depth, sbit->grayscale_bits, 8); + } + } +} + +/* Expand to *row using 8-bit palette indices from *scanline */ +static void expand_row(unsigned char *row, + const unsigned char *scanline, + const union spng__decode_plte *decode_plte, + uint32_t width, + int fmt) +{ + uint32_t i = 0; + unsigned char *px; + unsigned char entry; + const struct spng_plte_entry *plte = decode_plte->rgba; + +#if defined(SPNG_ARM) + if(fmt == SPNG_FMT_RGBA8) i = expand_palette_rgba8_neon(row, scanline, decode_plte->raw, width); + else if(fmt == SPNG_FMT_RGB8) + { + i = expand_palette_rgb8_neon(row, scanline, decode_plte->raw, width); + + for(; i < width; i++) + {/* In this case the LUT is 3 bytes packed */ + px = row + i * 3; + entry = scanline[i]; + px[0] = decode_plte->raw[entry * 3 + 0]; + px[1] = decode_plte->raw[entry * 3 + 1]; + px[2] = decode_plte->raw[entry * 3 + 2]; + } + return; + } +#endif + + if(fmt == SPNG_FMT_RGBA8) + { + for(; i < width; i++) + { + px = row + i * 4; + entry = scanline[i]; + px[0] = plte[entry].red; + px[1] = plte[entry].green; + px[2] = plte[entry].blue; + px[3] = plte[entry].alpha; + } + } + else if(fmt == SPNG_FMT_RGB8) + { + for(; i < width; i++) + { + px = row + i * 3; + entry = scanline[i]; + px[0] = plte[entry].red; + px[1] = plte[entry].green; + px[2] = plte[entry].blue; + } + } +} + +/* Unpack 1/2/4/8-bit samples to G8/GA8/GA16 or G16 -> GA16 */ +static void unpack_scanline(unsigned char *out, const unsigned char *scanline, uint32_t width, unsigned bit_depth, int fmt) +{ + struct spng__iter iter = spng__iter_init(bit_depth, scanline); + uint32_t i; + uint16_t sample, alpha = 65535; + + + if(fmt == SPNG_FMT_GA8) goto ga8; + else if(fmt == SPNG_FMT_GA16) goto ga16; + + /* 1/2/4-bit -> 8-bit */ + for(i=0; i < width; i++) out[i] = get_sample(&iter); + + return; + +ga8: + /* 1/2/4/8-bit -> GA8 */ + for(i=0; i < width; i++) + { + out[i*2] = get_sample(&iter); + out[i*2 + 1] = 255; + } + + return; + +ga16: + + /* 16 -> GA16 */ + if(bit_depth == 16) + { + for(i=0; i < width; i++) + { + memcpy(out + i * 4, scanline + i * 2, 2); + memcpy(out + i * 4 + 2, &alpha, 2); + } + return; + } + + /* 1/2/4/8-bit -> GA16 */ + for(i=0; i < width; i++) + { + sample = get_sample(&iter); + memcpy(out + i * 4, &sample, 2); + memcpy(out + i * 4 + 2, &alpha, 2); + } +} + +static int check_ihdr(const struct spng_ihdr *ihdr, uint32_t max_width, uint32_t max_height) +{ + if(ihdr->width > spng_u32max || !ihdr->width) return SPNG_EWIDTH; + if(ihdr->height > spng_u32max || !ihdr->height) return SPNG_EHEIGHT; + + if(ihdr->width > max_width) return SPNG_EUSER_WIDTH; + if(ihdr->height > max_height) return SPNG_EUSER_HEIGHT; + + switch(ihdr->color_type) + { + case SPNG_COLOR_TYPE_GRAYSCALE: + { + if( !(ihdr->bit_depth == 1 || ihdr->bit_depth == 2 || + ihdr->bit_depth == 4 || ihdr->bit_depth == 8 || + ihdr->bit_depth == 16) ) + return SPNG_EBIT_DEPTH; + + break; + } + case SPNG_COLOR_TYPE_TRUECOLOR: + case SPNG_COLOR_TYPE_GRAYSCALE_ALPHA: + case SPNG_COLOR_TYPE_TRUECOLOR_ALPHA: + { + if( !(ihdr->bit_depth == 8 || ihdr->bit_depth == 16) ) + return SPNG_EBIT_DEPTH; + + break; + } + case SPNG_COLOR_TYPE_INDEXED: + { + if( !(ihdr->bit_depth == 1 || ihdr->bit_depth == 2 || + ihdr->bit_depth == 4 || ihdr->bit_depth == 8) ) + return SPNG_EBIT_DEPTH; + + break; + } + default: return SPNG_ECOLOR_TYPE; + } + + if(ihdr->compression_method) return SPNG_ECOMPRESSION_METHOD; + if(ihdr->filter_method) return SPNG_EFILTER_METHOD; + + if(ihdr->interlace_method > 1) return SPNG_EINTERLACE_METHOD; + + return 0; +} + +static int check_plte(const struct spng_plte *plte, const struct spng_ihdr *ihdr) +{ + if(plte == NULL || ihdr == NULL) return 1; + + if(plte->n_entries == 0) return 1; + if(plte->n_entries > 256) return 1; + + if(ihdr->color_type == SPNG_COLOR_TYPE_INDEXED) + { + if(plte->n_entries > (1U << ihdr->bit_depth)) return 1; + } + + return 0; +} + +static int check_sbit(const struct spng_sbit *sbit, const struct spng_ihdr *ihdr) +{ + if(sbit == NULL || ihdr == NULL) return 1; + + if(ihdr->color_type == 0) + { + if(sbit->grayscale_bits == 0) return SPNG_ESBIT; + if(sbit->grayscale_bits > ihdr->bit_depth) return SPNG_ESBIT; + } + else if(ihdr->color_type == 2 || ihdr->color_type == 3) + { + if(sbit->red_bits == 0) return SPNG_ESBIT; + if(sbit->green_bits == 0) return SPNG_ESBIT; + if(sbit->blue_bits == 0) return SPNG_ESBIT; + + uint8_t bit_depth; + if(ihdr->color_type == 3) bit_depth = 8; + else bit_depth = ihdr->bit_depth; + + if(sbit->red_bits > bit_depth) return SPNG_ESBIT; + if(sbit->green_bits > bit_depth) return SPNG_ESBIT; + if(sbit->blue_bits > bit_depth) return SPNG_ESBIT; + } + else if(ihdr->color_type == 4) + { + if(sbit->grayscale_bits == 0) return SPNG_ESBIT; + if(sbit->alpha_bits == 0) return SPNG_ESBIT; + + if(sbit->grayscale_bits > ihdr->bit_depth) return SPNG_ESBIT; + if(sbit->alpha_bits > ihdr->bit_depth) return SPNG_ESBIT; + } + else if(ihdr->color_type == 6) + { + if(sbit->red_bits == 0) return SPNG_ESBIT; + if(sbit->green_bits == 0) return SPNG_ESBIT; + if(sbit->blue_bits == 0) return SPNG_ESBIT; + if(sbit->alpha_bits == 0) return SPNG_ESBIT; + + if(sbit->red_bits > ihdr->bit_depth) return SPNG_ESBIT; + if(sbit->green_bits > ihdr->bit_depth) return SPNG_ESBIT; + if(sbit->blue_bits > ihdr->bit_depth) return SPNG_ESBIT; + if(sbit->alpha_bits > ihdr->bit_depth) return SPNG_ESBIT; + } + + return 0; +} + +static int check_chrm_int(const struct spng_chrm_int *chrm_int) +{ + if(chrm_int == NULL) return 1; + + if(chrm_int->white_point_x > spng_u32max || + chrm_int->white_point_y > spng_u32max || + chrm_int->red_x > spng_u32max || + chrm_int->red_y > spng_u32max || + chrm_int->green_x > spng_u32max || + chrm_int->green_y > spng_u32max || + chrm_int->blue_x > spng_u32max || + chrm_int->blue_y > spng_u32max) return SPNG_ECHRM; + + return 0; +} + +static int check_phys(const struct spng_phys *phys) +{ + if(phys == NULL) return 1; + + if(phys->unit_specifier > 1) return SPNG_EPHYS; + + if(phys->ppu_x > spng_u32max) return SPNG_EPHYS; + if(phys->ppu_y > spng_u32max) return SPNG_EPHYS; + + return 0; +} + +static int check_time(const struct spng_time *time) +{ + if(time == NULL) return 1; + + if(time->month == 0 || time->month > 12) return 1; + if(time->day == 0 || time->day > 31) return 1; + if(time->hour > 23) return 1; + if(time->minute > 59) return 1; + if(time->second > 60) return 1; + + return 0; +} + +static int check_offs(const struct spng_offs *offs) +{ + if(offs == NULL) return 1; + + if(offs->unit_specifier > 1) return 1; + + return 0; +} + +static int check_exif(const struct spng_exif *exif) +{ + if(exif == NULL) return 1; + if(exif->data == NULL) return 1; + + if(exif->length < 4) return SPNG_ECHUNK_SIZE; + if(exif->length > spng_u32max) return SPNG_ECHUNK_STDLEN; + + const uint8_t exif_le[4] = { 73, 73, 42, 0 }; + const uint8_t exif_be[4] = { 77, 77, 0, 42 }; + + if(memcmp(exif->data, exif_le, 4) && memcmp(exif->data, exif_be, 4)) return 1; + + return 0; +} + +/* Validate PNG keyword */ +static int check_png_keyword(const char *str) +{ + if(str == NULL) return 1; + size_t len = strlen(str); + const char *end = str + len; + + if(!len) return 1; + if(len > 79) return 1; + if(str[0] == ' ') return 1; /* Leading space */ + if(end[-1] == ' ') return 1; /* Trailing space */ + if(strstr(str, " ") != NULL) return 1; /* Consecutive spaces */ + + uint8_t c; + while(str != end) + { + memcpy(&c, str, 1); + + if( (c >= 32 && c <= 126) || (c >= 161) ) str++; + else return 1; /* Invalid character */ + } + + return 0; +} + +/* Validate PNG text *str up to 'len' bytes */ +static int check_png_text(const char *str, size_t len) +{/* XXX: are consecutive newlines permitted? */ + if(str == NULL || len == 0) return 1; + + uint8_t c; + size_t i = 0; + while(i < len) + { + memcpy(&c, str + i, 1); + + if( (c >= 32 && c <= 126) || (c >= 161) || c == 10) i++; + else return 1; /* Invalid character */ + } + + return 0; +} + +/* Returns non-zero for standard chunks which are stored without allocating memory */ +static int is_small_chunk(uint8_t type[4]) +{ + if(!memcmp(type, type_plte, 4)) return 1; + else if(!memcmp(type, type_chrm, 4)) return 1; + else if(!memcmp(type, type_gama, 4)) return 1; + else if(!memcmp(type, type_sbit, 4)) return 1; + else if(!memcmp(type, type_srgb, 4)) return 1; + else if(!memcmp(type, type_bkgd, 4)) return 1; + else if(!memcmp(type, type_trns, 4)) return 1; + else if(!memcmp(type, type_hist, 4)) return 1; + else if(!memcmp(type, type_phys, 4)) return 1; + else if(!memcmp(type, type_time, 4)) return 1; + else if(!memcmp(type, type_offs, 4)) return 1; + else return 0; +} + +static int read_ihdr(spng_ctx *ctx) +{ + int ret; + struct spng_chunk *chunk = &ctx->current_chunk; + const unsigned char *data; + + chunk->offset = 8; + chunk->length = 13; + size_t sizeof_sig_ihdr = 29; + + ret = read_data(ctx, sizeof_sig_ihdr); + if(ret) return ret; + + data = ctx->data; + + if(memcmp(data, spng_signature, sizeof(spng_signature))) return SPNG_ESIGNATURE; + + chunk->length = read_u32(data + 8); + memcpy(&chunk->type, data + 12, 4); + + if(chunk->length != 13) return SPNG_EIHDR_SIZE; + if(memcmp(chunk->type, type_ihdr, 4)) return SPNG_ENOIHDR; + + ctx->cur_actual_crc = crc32(0, NULL, 0); + ctx->cur_actual_crc = crc32(ctx->cur_actual_crc, data + 12, 17); + + ctx->ihdr.width = read_u32(data + 16); + ctx->ihdr.height = read_u32(data + 20); + ctx->ihdr.bit_depth = data[24]; + ctx->ihdr.color_type = data[25]; + ctx->ihdr.compression_method = data[26]; + ctx->ihdr.filter_method = data[27]; + ctx->ihdr.interlace_method = data[28]; + + ret = check_ihdr(&ctx->ihdr, ctx->max_width, ctx->max_height); + if(ret) return ret; + + ctx->file.ihdr = 1; + ctx->stored.ihdr = 1; + + if(ctx->ihdr.bit_depth < 8) ctx->bytes_per_pixel = 1; + else ctx->bytes_per_pixel = num_channels(&ctx->ihdr) * (ctx->ihdr.bit_depth / 8); + + ret = calculate_subimages(ctx); + if(ret) return ret; + + return 0; +} + +static void splt_undo(spng_ctx *ctx) +{ + struct spng_splt *splt = &ctx->splt_list[ctx->n_splt - 1]; + + spng__free(ctx, splt->entries); + + decrease_cache_usage(ctx, sizeof(struct spng_splt)); + decrease_cache_usage(ctx, splt->n_entries * sizeof(struct spng_splt_entry)); + + splt->entries = NULL; + + ctx->n_splt--; +} + +static void text_undo(spng_ctx *ctx) +{ + struct spng_text2 *text = &ctx->text_list[ctx->n_text - 1]; + + spng__free(ctx, text->keyword); + if(text->compression_flag) spng__free(ctx, text->text); + + decrease_cache_usage(ctx, text->cache_usage); + decrease_cache_usage(ctx, sizeof(struct spng_text2)); + + text->keyword = NULL; + text->text = NULL; + + ctx->n_text--; +} + +static void chunk_undo(spng_ctx *ctx) +{ + struct spng_unknown_chunk *chunk = &ctx->chunk_list[ctx->n_chunks - 1]; + + spng__free(ctx, chunk->data); + + decrease_cache_usage(ctx, chunk->length); + decrease_cache_usage(ctx, sizeof(struct spng_unknown_chunk)); + + chunk->data = NULL; + + ctx->n_chunks--; +} + +static int read_non_idat_chunks(spng_ctx *ctx) +{ + int ret; + struct spng_chunk chunk; + const unsigned char *data; + + ctx->discard = 0; + ctx->undo = NULL; + ctx->prev_stored = ctx->stored; + + while( !(ret = read_header(ctx))) + { + if(ctx->discard) + { + if(ctx->undo) ctx->undo(ctx); + + ctx->stored = ctx->prev_stored; + } + + ctx->discard = 0; + ctx->undo = NULL; + + ctx->prev_stored = ctx->stored; + chunk = ctx->current_chunk; + + if(!memcmp(chunk.type, type_idat, 4)) + { + if(ctx->state < SPNG_STATE_FIRST_IDAT) + { + if(ctx->ihdr.color_type == 3 && !ctx->stored.plte) return SPNG_ENOPLTE; + + ctx->first_idat = chunk; + return 0; + } + + if(ctx->prev_was_idat) + { + /* Ignore extra IDAT's */ + ret = discard_chunk_bytes(ctx, chunk.length); + if(ret) return ret; + + continue; + } + else return SPNG_ECHUNK_POS; /* IDAT chunk not at the end of the IDAT sequence */ + } + + ctx->prev_was_idat = 0; + + if(is_small_chunk(chunk.type)) + { + /* None of the known chunks can be zero length */ + if(!chunk.length) return SPNG_ECHUNK_SIZE; + + /* The largest of these chunks is PLTE with 256 entries */ + ret = read_chunk_bytes(ctx, chunk.length > 768 ? 768 : chunk.length); + if(ret) return ret; + } + + data = ctx->data; + + if(is_critical_chunk(&chunk)) + { + if(!memcmp(chunk.type, type_plte, 4)) + { + if(ctx->file.trns || ctx->file.hist || ctx->file.bkgd) return SPNG_ECHUNK_POS; + if(chunk.length % 3 != 0) return SPNG_ECHUNK_SIZE; + + ctx->plte.n_entries = chunk.length / 3; + + if(check_plte(&ctx->plte, &ctx->ihdr)) return SPNG_ECHUNK_SIZE; /* XXX: EPLTE? */ + + size_t i; + for(i=0; i < ctx->plte.n_entries; i++) + { + ctx->plte.entries[i].red = data[i * 3]; + ctx->plte.entries[i].green = data[i * 3 + 1]; + ctx->plte.entries[i].blue = data[i * 3 + 2]; + } + + ctx->file.plte = 1; + ctx->stored.plte = 1; + } + else if(!memcmp(chunk.type, type_iend, 4)) + { + if(ctx->state == SPNG_STATE_AFTER_IDAT) + { + if(chunk.length) return SPNG_ECHUNK_SIZE; + + ret = read_and_check_crc(ctx); + if(ret == -SPNG_CRC_DISCARD) ret = 0; + + return ret; + } + else return SPNG_ECHUNK_POS; + } + else if(!memcmp(chunk.type, type_ihdr, 4)) return SPNG_ECHUNK_POS; + else return SPNG_ECHUNK_UNKNOWN_CRITICAL; + } + else if(!memcmp(chunk.type, type_chrm, 4)) /* Ancillary chunks */ + { + if(ctx->file.plte) return SPNG_ECHUNK_POS; + if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS; + if(ctx->file.chrm) return SPNG_EDUP_CHRM; + + if(chunk.length != 32) return SPNG_ECHUNK_SIZE; + + ctx->chrm_int.white_point_x = read_u32(data); + ctx->chrm_int.white_point_y = read_u32(data + 4); + ctx->chrm_int.red_x = read_u32(data + 8); + ctx->chrm_int.red_y = read_u32(data + 12); + ctx->chrm_int.green_x = read_u32(data + 16); + ctx->chrm_int.green_y = read_u32(data + 20); + ctx->chrm_int.blue_x = read_u32(data + 24); + ctx->chrm_int.blue_y = read_u32(data + 28); + + if(check_chrm_int(&ctx->chrm_int)) return SPNG_ECHRM; + + ctx->file.chrm = 1; + ctx->stored.chrm = 1; + } + else if(!memcmp(chunk.type, type_gama, 4)) + { + if(ctx->file.plte) return SPNG_ECHUNK_POS; + if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS; + if(ctx->file.gama) return SPNG_EDUP_GAMA; + + if(chunk.length != 4) return SPNG_ECHUNK_SIZE; + + ctx->gama = read_u32(data); + + if(!ctx->gama) return SPNG_EGAMA; + if(ctx->gama > spng_u32max) return SPNG_EGAMA; + + ctx->file.gama = 1; + ctx->stored.gama = 1; + } + else if(!memcmp(chunk.type, type_sbit, 4)) + { + if(ctx->file.plte) return SPNG_ECHUNK_POS; + if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS; + if(ctx->file.sbit) return SPNG_EDUP_SBIT; + + if(ctx->ihdr.color_type == 0) + { + if(chunk.length != 1) return SPNG_ECHUNK_SIZE; + + ctx->sbit.grayscale_bits = data[0]; + } + else if(ctx->ihdr.color_type == 2 || ctx->ihdr.color_type == 3) + { + if(chunk.length != 3) return SPNG_ECHUNK_SIZE; + + ctx->sbit.red_bits = data[0]; + ctx->sbit.green_bits = data[1]; + ctx->sbit.blue_bits = data[2]; + } + else if(ctx->ihdr.color_type == 4) + { + if(chunk.length != 2) return SPNG_ECHUNK_SIZE; + + ctx->sbit.grayscale_bits = data[0]; + ctx->sbit.alpha_bits = data[1]; + } + else if(ctx->ihdr.color_type == 6) + { + if(chunk.length != 4) return SPNG_ECHUNK_SIZE; + + ctx->sbit.red_bits = data[0]; + ctx->sbit.green_bits = data[1]; + ctx->sbit.blue_bits = data[2]; + ctx->sbit.alpha_bits = data[3]; + } + + if(check_sbit(&ctx->sbit, &ctx->ihdr)) return SPNG_ESBIT; + + ctx->file.sbit = 1; + ctx->stored.sbit = 1; + } + else if(!memcmp(chunk.type, type_srgb, 4)) + { + if(ctx->file.plte) return SPNG_ECHUNK_POS; + if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS; + if(ctx->file.srgb) return SPNG_EDUP_SRGB; + + if(chunk.length != 1) return SPNG_ECHUNK_SIZE; + + ctx->srgb_rendering_intent = data[0]; + + if(ctx->srgb_rendering_intent > 3) return SPNG_ESRGB; + + ctx->file.srgb = 1; + ctx->stored.srgb = 1; + } + else if(!memcmp(chunk.type, type_bkgd, 4)) + { + if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS; + if(ctx->file.bkgd) return SPNG_EDUP_BKGD; + + if(ctx->ihdr.color_type == 0 || ctx->ihdr.color_type == 4) + { + if(chunk.length != 2) return SPNG_ECHUNK_SIZE; + + ctx->bkgd.gray = read_u16(data); + } + else if(ctx->ihdr.color_type == 2 || ctx->ihdr.color_type == 6) + { + if(chunk.length != 6) return SPNG_ECHUNK_SIZE; + + ctx->bkgd.red = read_u16(data); + ctx->bkgd.green = read_u16(data + 2); + ctx->bkgd.blue = read_u16(data + 4); + } + else if(ctx->ihdr.color_type == 3) + { + if(chunk.length != 1) return SPNG_ECHUNK_SIZE; + if(!ctx->file.plte) return SPNG_EBKGD_NO_PLTE; + + ctx->bkgd.plte_index = data[0]; + if(ctx->bkgd.plte_index >= ctx->plte.n_entries) return SPNG_EBKGD_PLTE_IDX; + } + + ctx->file.bkgd = 1; + ctx->stored.bkgd = 1; + } + else if(!memcmp(chunk.type, type_trns, 4)) + { + if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS; + if(ctx->file.trns) return SPNG_EDUP_TRNS; + if(!chunk.length) return SPNG_ECHUNK_SIZE; + + if(ctx->ihdr.color_type == 0) + { + if(chunk.length != 2) return SPNG_ECHUNK_SIZE; + + ctx->trns.gray = read_u16(data); + } + else if(ctx->ihdr.color_type == 2) + { + if(chunk.length != 6) return SPNG_ECHUNK_SIZE; + + ctx->trns.red = read_u16(data); + ctx->trns.green = read_u16(data + 2); + ctx->trns.blue = read_u16(data + 4); + } + else if(ctx->ihdr.color_type == 3) + { + if(chunk.length > ctx->plte.n_entries) return SPNG_ECHUNK_SIZE; + if(!ctx->file.plte) return SPNG_ETRNS_NO_PLTE; + + memcpy(ctx->trns.type3_alpha, data, chunk.length); + ctx->trns.n_type3_entries = chunk.length; + } + + if(ctx->ihdr.color_type == 4 || ctx->ihdr.color_type == 6) return SPNG_ETRNS_COLOR_TYPE; + + ctx->file.trns = 1; + ctx->stored.trns = 1; + } + else if(!memcmp(chunk.type, type_hist, 4)) + { + if(!ctx->file.plte) return SPNG_EHIST_NO_PLTE; + if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS; + if(ctx->file.hist) return SPNG_EDUP_HIST; + + if( (chunk.length / 2) != (ctx->plte.n_entries) ) return SPNG_ECHUNK_SIZE; + + size_t k; + for(k=0; k < (chunk.length / 2); k++) + { + ctx->hist.frequency[k] = read_u16(data + k*2); + } + + ctx->file.hist = 1; + ctx->stored.hist = 1; + } + else if(!memcmp(chunk.type, type_phys, 4)) + { + if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS; + if(ctx->file.phys) return SPNG_EDUP_PHYS; + + if(chunk.length != 9) return SPNG_ECHUNK_SIZE; + + ctx->phys.ppu_x = read_u32(data); + ctx->phys.ppu_y = read_u32(data + 4); + ctx->phys.unit_specifier = data[8]; + + if(check_phys(&ctx->phys)) return SPNG_EPHYS; + + ctx->file.phys = 1; + ctx->stored.phys = 1; + } + else if(!memcmp(chunk.type, type_time, 4)) + { + if(ctx->file.time) return SPNG_EDUP_TIME; + + if(chunk.length != 7) return SPNG_ECHUNK_SIZE; + + struct spng_time time; + + time.year = read_u16(data); + time.month = data[2]; + time.day = data[3]; + time.hour = data[4]; + time.minute = data[5]; + time.second = data[6]; + + if(check_time(&time)) return SPNG_ETIME; + + ctx->file.time = 1; + + if(!ctx->user.time) ctx->time = time; + + ctx->stored.time = 1; + } + else if(!memcmp(chunk.type, type_offs, 4)) + { + if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS; + if(ctx->file.offs) return SPNG_EDUP_OFFS; + + if(chunk.length != 9) return SPNG_ECHUNK_SIZE; + + ctx->offs.x = read_s32(data); + ctx->offs.y = read_s32(data + 4); + ctx->offs.unit_specifier = data[8]; + + if(check_offs(&ctx->offs)) return SPNG_EOFFS; + + ctx->file.offs = 1; + ctx->stored.offs = 1; + } + else /* Arbitrary-length chunk */ + { + + if(!memcmp(chunk.type, type_exif, 4)) + { + if(ctx->file.exif) return SPNG_EDUP_EXIF; + if(!chunk.length) return SPNG_EEXIF; + + ctx->file.exif = 1; + + if(ctx->user.exif) goto discard; + + if(increase_cache_usage(ctx, chunk.length, 1)) return SPNG_ECHUNK_LIMITS; + + struct spng_exif exif; + + exif.length = chunk.length; + + exif.data = spng__malloc(ctx, chunk.length); + if(exif.data == NULL) return SPNG_EMEM; + + ret = read_chunk_bytes2(ctx, exif.data, chunk.length); + if(ret) + { + spng__free(ctx, exif.data); + return ret; + } + + if(check_exif(&exif)) + { + spng__free(ctx, exif.data); + return SPNG_EEXIF; + } + + ctx->exif = exif; + + ctx->stored.exif = 1; + } + else if(!memcmp(chunk.type, type_iccp, 4)) + {/* TODO: add test file with color profile */ + if(ctx->file.plte) return SPNG_ECHUNK_POS; + if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS; + if(ctx->file.iccp) return SPNG_EDUP_ICCP; + if(!chunk.length) return SPNG_ECHUNK_SIZE; + + ctx->file.iccp = 1; + + uint32_t peek_bytes = 81 > chunk.length ? chunk.length : 81; + + ret = read_chunk_bytes(ctx, peek_bytes); + if(ret) return ret; + + unsigned char *keyword_nul = memchr(ctx->data, '\0', peek_bytes); + if(keyword_nul == NULL) return SPNG_EICCP_NAME; + + uint32_t keyword_len = keyword_nul - ctx->data; + + if(keyword_len > 79) return SPNG_EICCP_NAME; + + memcpy(ctx->iccp.profile_name, ctx->data, keyword_len); + + if(check_png_keyword(ctx->iccp.profile_name)) return SPNG_EICCP_NAME; + + if(chunk.length < (keyword_len + 2)) return SPNG_ECHUNK_SIZE; + + if(ctx->data[keyword_len + 1] != 0) return SPNG_EICCP_COMPRESSION_METHOD; + + ret = spng__inflate_stream(ctx, &ctx->iccp.profile, &ctx->iccp.profile_len, 0, ctx->data + keyword_len + 2, peek_bytes - (keyword_len + 2)); + + if(ret) return ret; + + ctx->stored.iccp = 1; + } + else if(!memcmp(chunk.type, type_text, 4) || + !memcmp(chunk.type, type_ztxt, 4) || + !memcmp(chunk.type, type_itxt, 4)) + { + if(!chunk.length) return SPNG_ECHUNK_SIZE; + + ctx->file.text = 1; + + if(ctx->user.text) goto discard; + + if(increase_cache_usage(ctx, sizeof(struct spng_text2), 1)) return SPNG_ECHUNK_LIMITS; + + ctx->n_text++; + if(ctx->n_text < 1) return SPNG_EOVERFLOW; + if(sizeof(struct spng_text2) > SIZE_MAX / ctx->n_text) return SPNG_EOVERFLOW; + + void *buf = spng__realloc(ctx, ctx->text_list, ctx->n_text * sizeof(struct spng_text2)); + if(buf == NULL) return SPNG_EMEM; + ctx->text_list = buf; + + struct spng_text2 *text = &ctx->text_list[ctx->n_text - 1]; + memset(text, 0, sizeof(struct spng_text2)); + + ctx->undo = text_undo; + + uint32_t text_offset = 0, language_tag_offset = 0, translated_keyword_offset = 0; + uint32_t peek_bytes = 256; /* enough for 3 80-byte keywords and some text bytes */ + uint32_t keyword_len; + + if(peek_bytes > chunk.length) peek_bytes = chunk.length; + + ret = read_chunk_bytes(ctx, peek_bytes); + if(ret) return ret; + + data = ctx->data; + + const unsigned char *zlib_stream = NULL; + const unsigned char *peek_end = data + peek_bytes; + const unsigned char *keyword_nul = memchr(data, 0, chunk.length > 80 ? 80 : chunk.length); + + if(keyword_nul == NULL) return SPNG_ETEXT_KEYWORD; + + keyword_len = keyword_nul - data; + + if(!memcmp(chunk.type, type_text, 4)) + { + text->type = SPNG_TEXT; + + text->text_length = chunk.length - keyword_len - 1; + + text_offset = keyword_len; + + /* increment past nul if there is a text field */ + if(text->text_length) text_offset++; + } + else if(!memcmp(chunk.type, type_ztxt, 4)) + { + text->type = SPNG_ZTXT; + + if((peek_bytes - keyword_len) <= 2) return SPNG_EZTXT; + + if(keyword_nul[1]) return SPNG_EZTXT_COMPRESSION_METHOD; + + text->compression_flag = 1; + + text_offset = keyword_len + 2; + } + else if(!memcmp(chunk.type, type_itxt, 4)) + { + text->type = SPNG_ITXT; + + /* at least two 1-byte fields, two >=0 length strings, and one byte of (compressed) text */ + if((peek_bytes - keyword_len) < 5) return SPNG_EITXT; + + text->compression_flag = keyword_nul[1]; + + if(text->compression_flag > 1) return SPNG_EITXT_COMPRESSION_FLAG; + + if(keyword_nul[2]) return SPNG_EITXT_COMPRESSION_METHOD; + + language_tag_offset = keyword_len + 3; + + const unsigned char *term; + term = memchr(data + language_tag_offset, 0, peek_bytes - language_tag_offset); + if(term == NULL) return SPNG_EITXT_LANG_TAG; + + if((peek_end - term) < 2) return SPNG_EITXT; + + translated_keyword_offset = term - data + 1; + + zlib_stream = memchr(data + translated_keyword_offset, 0, peek_bytes - translated_keyword_offset); + if(zlib_stream == NULL) return SPNG_EITXT; + if(zlib_stream == peek_end) return SPNG_EITXT; + + text_offset = zlib_stream - data + 1; + text->text_length = chunk.length - text_offset; + } + else return SPNG_EINTERNAL; + + + if(text->compression_flag) + { + /* cache usage = peek_bytes + decompressed text size + nul */ + if(increase_cache_usage(ctx, peek_bytes, 0)) return SPNG_ECHUNK_LIMITS; + + text->keyword = spng__calloc(ctx, 1, peek_bytes); + if(text->keyword == NULL) return SPNG_EMEM; + + memcpy(text->keyword, data, peek_bytes); + + zlib_stream = ctx->data + text_offset; + + ret = spng__inflate_stream(ctx, &text->text, &text->text_length, 1, zlib_stream, peek_bytes - text_offset); + + if(ret) return ret; + + text->text[text->text_length - 1] = '\0'; + text->cache_usage = text->text_length + peek_bytes; + } + else + { + if(increase_cache_usage(ctx, chunk.length + 1, 0)) return SPNG_ECHUNK_LIMITS; + + text->keyword = spng__malloc(ctx, chunk.length + 1); + if(text->keyword == NULL) return SPNG_EMEM; + + memcpy(text->keyword, data, peek_bytes); + + if(chunk.length > peek_bytes) + { + ret = read_chunk_bytes2(ctx, text->keyword + peek_bytes, chunk.length - peek_bytes); + if(ret) return ret; + } + + text->text = text->keyword + text_offset; + + text->text_length = chunk.length - text_offset; + + text->text[text->text_length] = '\0'; + text->cache_usage = chunk.length + 1; + } + + if(check_png_keyword(text->keyword)) return SPNG_ETEXT_KEYWORD; + + text->text_length = strlen(text->text); + + if(text->type != SPNG_ITXT) + { + language_tag_offset = keyword_len; + translated_keyword_offset = keyword_len; + + if(ctx->strict && check_png_text(text->text, text->text_length)) + { + if(text->type == SPNG_ZTXT) return SPNG_EZTXT; + else return SPNG_ETEXT; + } + } + + text->language_tag = text->keyword + language_tag_offset; + text->translated_keyword = text->keyword + translated_keyword_offset; + + ctx->stored.text = 1; + } + else if(!memcmp(chunk.type, type_splt, 4)) + { + if(ctx->state == SPNG_STATE_AFTER_IDAT) return SPNG_ECHUNK_POS; + if(ctx->user.splt) goto discard; /* XXX: could check profile names for uniqueness */ + if(!chunk.length) return SPNG_ECHUNK_SIZE; + + ctx->file.splt = 1; + + /* chunk.length + sizeof(struct spng_splt) + splt->n_entries * sizeof(struct spng_splt_entry) */ + if(increase_cache_usage(ctx, chunk.length + sizeof(struct spng_splt), 1)) return SPNG_ECHUNK_LIMITS; + + ctx->n_splt++; + if(ctx->n_splt < 1) return SPNG_EOVERFLOW; + if(sizeof(struct spng_splt) > SIZE_MAX / ctx->n_splt) return SPNG_EOVERFLOW; + + void *buf = spng__realloc(ctx, ctx->splt_list, ctx->n_splt * sizeof(struct spng_splt)); + if(buf == NULL) return SPNG_EMEM; + ctx->splt_list = buf; + + struct spng_splt *splt = &ctx->splt_list[ctx->n_splt - 1]; + + memset(splt, 0, sizeof(struct spng_splt)); + + ctx->undo = splt_undo; + + void *t = spng__malloc(ctx, chunk.length); + if(t == NULL) return SPNG_EMEM; + + splt->entries = t; /* simplifies error handling */ + data = t; + + ret = read_chunk_bytes2(ctx, t, chunk.length); + if(ret) return ret; + + uint32_t keyword_len = chunk.length < 80 ? chunk.length : 80; + + const unsigned char *keyword_nul = memchr(data, 0, keyword_len); + if(keyword_nul == NULL) return SPNG_ESPLT_NAME; + + keyword_len = keyword_nul - data; + + memcpy(splt->name, data, keyword_len); + + if(check_png_keyword(splt->name)) return SPNG_ESPLT_NAME; + + uint32_t j; + for(j=0; j < (ctx->n_splt - 1); j++) + { + if(!strcmp(ctx->splt_list[j].name, splt->name)) return SPNG_ESPLT_DUP_NAME; + } + + if( (chunk.length - keyword_len) <= 2) return SPNG_ECHUNK_SIZE; + + splt->sample_depth = data[keyword_len + 1]; + + uint32_t entries_len = chunk.length - keyword_len - 2; + if(!entries_len) return SPNG_ECHUNK_SIZE; + + if(splt->sample_depth == 16) + { + if(entries_len % 10 != 0) return SPNG_ECHUNK_SIZE; + splt->n_entries = entries_len / 10; + } + else if(splt->sample_depth == 8) + { + if(entries_len % 6 != 0) return SPNG_ECHUNK_SIZE; + splt->n_entries = entries_len / 6; + } + else return SPNG_ESPLT_DEPTH; + + if(!splt->n_entries) return SPNG_ECHUNK_SIZE; + + size_t list_size = splt->n_entries; + + if(list_size > SIZE_MAX / sizeof(struct spng_splt_entry)) return SPNG_EOVERFLOW; + + list_size *= sizeof(struct spng_splt_entry); + + if(increase_cache_usage(ctx, list_size, 0)) return SPNG_ECHUNK_LIMITS; + + splt->entries = spng__malloc(ctx, list_size); + if(splt->entries == NULL) + { + spng__free(ctx, t); + return SPNG_EMEM; + } + + data = (unsigned char*)t + keyword_len + 2; + + uint32_t k; + if(splt->sample_depth == 16) + { + for(k=0; k < splt->n_entries; k++) + { + splt->entries[k].red = read_u16(data + k * 10); + splt->entries[k].green = read_u16(data + k * 10 + 2); + splt->entries[k].blue = read_u16(data + k * 10 + 4); + splt->entries[k].alpha = read_u16(data + k * 10 + 6); + splt->entries[k].frequency = read_u16(data + k * 10 + 8); + } + } + else if(splt->sample_depth == 8) + { + for(k=0; k < splt->n_entries; k++) + { + splt->entries[k].red = data[k * 6]; + splt->entries[k].green = data[k * 6 + 1]; + splt->entries[k].blue = data[k * 6 + 2]; + splt->entries[k].alpha = data[k * 6 + 3]; + splt->entries[k].frequency = read_u16(data + k * 6 + 4); + } + } + + spng__free(ctx, t); + decrease_cache_usage(ctx, chunk.length); + + ctx->stored.splt = 1; + } + else /* Unknown chunk */ + { + ctx->file.unknown = 1; + + if(!ctx->keep_unknown) goto discard; + if(ctx->user.unknown) goto discard; + + if(increase_cache_usage(ctx, chunk.length + sizeof(struct spng_unknown_chunk), 1)) return SPNG_ECHUNK_LIMITS; + + ctx->n_chunks++; + if(ctx->n_chunks < 1) return SPNG_EOVERFLOW; + if(sizeof(struct spng_unknown_chunk) > SIZE_MAX / ctx->n_chunks) return SPNG_EOVERFLOW; + + void *buf = spng__realloc(ctx, ctx->chunk_list, ctx->n_chunks * sizeof(struct spng_unknown_chunk)); + if(buf == NULL) return SPNG_EMEM; + ctx->chunk_list = buf; + + struct spng_unknown_chunk *chunkp = &ctx->chunk_list[ctx->n_chunks - 1]; + + memset(chunkp, 0, sizeof(struct spng_unknown_chunk)); + + ctx->undo = chunk_undo; + + memcpy(chunkp->type, chunk.type, 4); + + if(ctx->state < SPNG_STATE_FIRST_IDAT) + { + if(ctx->file.plte) chunkp->location = SPNG_AFTER_PLTE; + else chunkp->location = SPNG_AFTER_IHDR; + } + else if(ctx->state >= SPNG_STATE_AFTER_IDAT) chunkp->location = SPNG_AFTER_IDAT; + + if(chunk.length > 0) + { + void *t = spng__malloc(ctx, chunk.length); + if(t == NULL) return SPNG_EMEM; + + ret = read_chunk_bytes2(ctx, t, chunk.length); + if(ret) + { + spng__free(ctx, t); + return ret; + } + + chunkp->length = chunk.length; + chunkp->data = t; + } + + ctx->stored.unknown = 1; + } + +discard: + ret = discard_chunk_bytes(ctx, ctx->cur_chunk_bytes_left); + if(ret) return ret; + } + + } + + return ret; +} + +/* Read chunks before or after the IDAT chunks depending on state */ +static int read_chunks(spng_ctx *ctx, int only_ihdr) +{ + if(ctx == NULL) return SPNG_EINTERNAL; + if(!ctx->state) return SPNG_EBADSTATE; + if(ctx->data == NULL) + { + if(ctx->encode_only) return 0; + else return SPNG_EINTERNAL; + } + + int ret = 0; + + if(ctx->state == SPNG_STATE_INPUT) + { + ret = read_ihdr(ctx); + + if(ret) return decode_err(ctx, ret); + + ctx->state = SPNG_STATE_IHDR; + } + + if(only_ihdr) return 0; + + if(ctx->state == SPNG_STATE_EOI) + { + ctx->state = SPNG_STATE_AFTER_IDAT; + ctx->prev_was_idat = 1; + } + + while(ctx->state < SPNG_STATE_FIRST_IDAT || ctx->state == SPNG_STATE_AFTER_IDAT) + { + ret = read_non_idat_chunks(ctx); + + if(!ret) + { + if(ctx->state < SPNG_STATE_FIRST_IDAT) ctx->state = SPNG_STATE_FIRST_IDAT; + else if(ctx->state == SPNG_STATE_AFTER_IDAT) ctx->state = SPNG_STATE_IEND; + } + else + { + switch(ret) + { + case SPNG_ECHUNK_POS: + case SPNG_ECHUNK_SIZE: /* size != expected size, SPNG_ECHUNK_STDLEN = invalid size */ + case SPNG_EDUP_PLTE: + case SPNG_EDUP_CHRM: + case SPNG_EDUP_GAMA: + case SPNG_EDUP_ICCP: + case SPNG_EDUP_SBIT: + case SPNG_EDUP_SRGB: + case SPNG_EDUP_BKGD: + case SPNG_EDUP_HIST: + case SPNG_EDUP_TRNS: + case SPNG_EDUP_PHYS: + case SPNG_EDUP_TIME: + case SPNG_EDUP_OFFS: + case SPNG_EDUP_EXIF: + case SPNG_ECHRM: + case SPNG_ETRNS_COLOR_TYPE: + case SPNG_ETRNS_NO_PLTE: + case SPNG_EGAMA: + case SPNG_EICCP_NAME: + case SPNG_EICCP_COMPRESSION_METHOD: + case SPNG_ESBIT: + case SPNG_ESRGB: + case SPNG_ETEXT: + case SPNG_ETEXT_KEYWORD: + case SPNG_EZTXT: + case SPNG_EZTXT_COMPRESSION_METHOD: + case SPNG_EITXT: + case SPNG_EITXT_COMPRESSION_FLAG: + case SPNG_EITXT_COMPRESSION_METHOD: + case SPNG_EITXT_LANG_TAG: + case SPNG_EITXT_TRANSLATED_KEY: + case SPNG_EBKGD_NO_PLTE: + case SPNG_EBKGD_PLTE_IDX: + case SPNG_EHIST_NO_PLTE: + case SPNG_EPHYS: + case SPNG_ESPLT_NAME: + case SPNG_ESPLT_DUP_NAME: + case SPNG_ESPLT_DEPTH: + case SPNG_ETIME: + case SPNG_EOFFS: + case SPNG_EEXIF: + case SPNG_EZLIB: + { + if(!ctx->strict && !is_critical_chunk(&ctx->current_chunk)) + { + ret = discard_chunk_bytes(ctx, ctx->cur_chunk_bytes_left); + if(ret) return decode_err(ctx, ret); + + if(ctx->undo) ctx->undo(ctx); + + ctx->stored = ctx->prev_stored; + + ctx->discard = 0; + ctx->undo = NULL; + + continue; + } + else return decode_err(ctx, ret); + + break; + } + default: return decode_err(ctx, ret); + } + } + } + + return ret; +} + +static int read_scanline(spng_ctx *ctx) +{ + int ret, pass = ctx->row_info.pass; + struct spng_row_info *ri = &ctx->row_info; + const struct spng_subimage *sub = ctx->subimage; + size_t scanline_width = sub[pass].scanline_width; + uint32_t scanline_idx = ri->scanline_idx; + + uint8_t next_filter = 0; + + if(scanline_idx == (sub[pass].height - 1) && ri->pass == ctx->last_pass) + { + ret = read_scanline_bytes(ctx, ctx->scanline, scanline_width - 1); + } + else + { + ret = read_scanline_bytes(ctx, ctx->scanline, scanline_width); + if(ret) return ret; + + next_filter = ctx->scanline[scanline_width - 1]; + if(next_filter > 4) ret = SPNG_EFILTER; + } + + if(ret) return ret; + + if(!scanline_idx && ri->filter > 1) + { + /* prev_scanline is all zeros for the first scanline */ + memset(ctx->prev_scanline, 0, scanline_width); + } + + if(ctx->ihdr.bit_depth == 16 && ctx->fmt != SPNG_FMT_RAW) u16_row_to_host(ctx->scanline, scanline_width - 1); + + ret = defilter_scanline(ctx->prev_scanline, ctx->scanline, scanline_width, ctx->bytes_per_pixel, ri->filter); + if(ret) return ret; + + ri->filter = next_filter; + + return 0; +} + +static int update_row_info(spng_ctx *ctx) +{ + int interlacing = ctx->ihdr.interlace_method; + struct spng_row_info *ri = &ctx->row_info; + const struct spng_subimage *sub = ctx->subimage; + + if(ri->scanline_idx == (sub[ri->pass].height - 1)) /* Last scanline */ + { + if(ri->pass == ctx->last_pass) + { + ctx->state = SPNG_STATE_EOI; + + return SPNG_EOI; + } + + ri->scanline_idx = 0; + ri->pass++; + + /* Skip empty passes */ + while( (!sub[ri->pass].width || !sub[ri->pass].height) && (ri->pass < ctx->last_pass)) ri->pass++; + } + else + { + ri->row_num++; + ri->scanline_idx++; + } + + if(interlacing) ri->row_num = adam7_y_start[ri->pass] + ri->scanline_idx * adam7_y_delta[ri->pass]; + + return 0; +} + +int spng_decode_scanline(spng_ctx *ctx, void *out, size_t len) +{ + if(ctx == NULL || out == NULL) return 1; + + if(ctx->state >= SPNG_STATE_EOI) return SPNG_EOI; + + struct decode_flags f = ctx->decode_flags; + + struct spng_row_info *ri = &ctx->row_info; + const struct spng_subimage *sub = ctx->subimage; + + const struct spng_ihdr *ihdr = &ctx->ihdr; + const uint16_t *gamma_lut = ctx->gamma_lut; + unsigned char *trns_px = ctx->trns_px; + const struct spng_sbit *sb = &ctx->decode_sb; + const struct spng_plte_entry *plte = ctx->decode_plte.rgba; + struct spng__iter iter = spng__iter_init(ihdr->bit_depth, ctx->scanline); + + const unsigned char *scanline; + + const int pass = ri->pass; + const int fmt = ctx->fmt; + const size_t scanline_width = sub[pass].scanline_width; + const uint32_t width = sub[pass].width; + uint32_t k; + uint8_t r_8, g_8, b_8, a_8, gray_8; + uint16_t r_16, g_16, b_16, a_16, gray_16; + r_8=0; g_8=0; b_8=0; a_8=0; gray_8=0; + r_16=0; g_16=0; b_16=0; a_16=0; gray_16=0; + size_t pixel_size = 4; /* SPNG_FMT_RGBA8 */ + size_t pixel_offset = 0; + unsigned char *pixel; + unsigned processing_depth = ihdr->bit_depth; + + if(f.indexed) processing_depth = 8; + + if(fmt == SPNG_FMT_RGBA16) pixel_size = 8; + else if(fmt == SPNG_FMT_RGB8) pixel_size = 3; + + if(len < sub[pass].out_width) return SPNG_EBUFSIZ; + + int ret = read_scanline(ctx); + + if(ret) return decode_err(ctx, ret); + + scanline = ctx->scanline; + + for(k=0; k < width; k++) + { + pixel = (unsigned char*)out + pixel_offset; + pixel_offset += pixel_size; + + if(f.same_layout) + { + if(f.zerocopy) break; + + memcpy(out, scanline, scanline_width - 1); + break; + } + + if(f.unpack) + { + unpack_scanline(out, scanline, width, ihdr->bit_depth, fmt); + break; + } + + if(ihdr->color_type == SPNG_COLOR_TYPE_TRUECOLOR) + { + if(ihdr->bit_depth == 16) + { + memcpy(&r_16, scanline + (k * 6), 2); + memcpy(&g_16, scanline + (k * 6) + 2, 2); + memcpy(&b_16, scanline + (k * 6) + 4, 2); + + a_16 = 65535; + } + else /* == 8 */ + { + if(fmt == SPNG_FMT_RGBA8) + { + rgb8_row_to_rgba8(scanline, out, width); + break; + } + + r_8 = scanline[k * 3]; + g_8 = scanline[k * 3 + 1]; + b_8 = scanline[k * 3 + 2]; + + a_8 = 255; + } + } + else if(ihdr->color_type == SPNG_COLOR_TYPE_INDEXED) + { + uint8_t entry = 0; + + if(ihdr->bit_depth == 8) + { + if(fmt & (SPNG_FMT_RGBA8 | SPNG_FMT_RGB8)) + { + expand_row(out, scanline, &ctx->decode_plte, width, fmt); + break; + } + + entry = scanline[k]; + } + else /* < 8 */ + { + entry = get_sample(&iter); + } + + if(fmt & (SPNG_FMT_RGBA8 | SPNG_FMT_RGB8)) + { + pixel[0] = plte[entry].red; + pixel[1] = plte[entry].green; + pixel[2] = plte[entry].blue; + if(fmt == SPNG_FMT_RGBA8) pixel[3] = plte[entry].alpha; + + continue; + } + else /* RGBA16 */ + { + r_16 = plte[entry].red; + g_16 = plte[entry].green; + b_16 = plte[entry].blue; + a_16 = plte[entry].alpha; + + r_16 = (r_16 << 8) | r_16; + g_16 = (g_16 << 8) | g_16; + b_16 = (b_16 << 8) | b_16; + a_16 = (a_16 << 8) | a_16; + + memcpy(pixel, &r_16, 2); + memcpy(pixel + 2, &g_16, 2); + memcpy(pixel + 4, &b_16, 2); + memcpy(pixel + 6, &a_16, 2); + + continue; + } + } + else if(ihdr->color_type == SPNG_COLOR_TYPE_TRUECOLOR_ALPHA) + { + if(ihdr->bit_depth == 16) + { + memcpy(&r_16, scanline + (k * 8), 2); + memcpy(&g_16, scanline + (k * 8) + 2, 2); + memcpy(&b_16, scanline + (k * 8) + 4, 2); + memcpy(&a_16, scanline + (k * 8) + 6, 2); + } + else /* == 8 */ + { + r_8 = scanline[k * 4]; + g_8 = scanline[k * 4 + 1]; + b_8 = scanline[k * 4 + 2]; + a_8 = scanline[k * 4 + 3]; + } + } + else if(ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE) + { + if(ihdr->bit_depth == 16) + { + memcpy(&gray_16, scanline + k * 2, 2); + + if(f.apply_trns && ctx->trns.gray == gray_16) a_16 = 0; + else a_16 = 65535; + + r_16 = gray_16; + g_16 = gray_16; + b_16 = gray_16; + } + else /* <= 8 */ + { + gray_8 = get_sample(&iter); + + if(f.apply_trns && ctx->trns.gray == gray_8) a_8 = 0; + else a_8 = 255; + + r_8 = gray_8; g_8 = gray_8; b_8 = gray_8; + } + } + else if(ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE_ALPHA) + { + if(ihdr->bit_depth == 16) + { + memcpy(&gray_16, scanline + (k * 4), 2); + memcpy(&a_16, scanline + (k * 4) + 2, 2); + + r_16 = gray_16; + g_16 = gray_16; + b_16 = gray_16; + } + else /* == 8 */ + { + gray_8 = scanline[k * 2]; + a_8 = scanline[k * 2 + 1]; + + r_8 = gray_8; + g_8 = gray_8; + b_8 = gray_8; + } + } + + + if(fmt & (SPNG_FMT_RGBA8 | SPNG_FMT_RGB8)) + { + if(ihdr->bit_depth == 16) + { + r_8 = r_16 >> 8; + g_8 = g_16 >> 8; + b_8 = b_16 >> 8; + a_8 = a_16 >> 8; + } + + pixel[0] = r_8; + pixel[1] = g_8; + pixel[2] = b_8; + + if(fmt == SPNG_FMT_RGBA8) pixel[3] = a_8; + } + else if(fmt == SPNG_FMT_RGBA16) + { + if(ihdr->bit_depth != 16) + { + r_16 = r_8; + g_16 = g_8; + b_16 = b_8; + a_16 = a_8; + } + + memcpy(pixel, &r_16, 2); + memcpy(pixel + 2, &g_16, 2); + memcpy(pixel + 4, &b_16, 2); + memcpy(pixel + 6, &a_16, 2); + } + }/* for(k=0; k < width; k++) */ + + if(f.apply_trns) trns_row(out, scanline, trns_px, ctx->bytes_per_pixel, &ctx->ihdr, width, fmt); + + if(f.do_scaling) scale_row(out, width, fmt, processing_depth, sb); + + if(f.apply_gamma) gamma_correct_row(out, width, fmt, gamma_lut); + + /* The previous scanline is always defiltered */ + void *t = ctx->prev_scanline; + ctx->prev_scanline = ctx->scanline; + ctx->scanline = t; + + ret = update_row_info(ctx); + + if(ret == SPNG_EOI) + { + if(ctx->cur_chunk_bytes_left) /* zlib stream ended before an IDAT chunk boundary */ + {/* Discard the rest of the chunk */ + int error = discard_chunk_bytes(ctx, ctx->cur_chunk_bytes_left); + if(error) return decode_err(ctx, error); + } + + ctx->last_idat = ctx->current_chunk; + } + + return ret; +} + +int spng_decode_row(spng_ctx *ctx, void *out, size_t len) +{ + if(ctx == NULL || out == NULL) return 1; + if(ctx->state >= SPNG_STATE_EOI) return SPNG_EOI; + if(len < ctx->image_width) return SPNG_EBUFSIZ; + + const struct spng_ihdr *ihdr = &ctx->ihdr; + int ret, pass = ctx->row_info.pass; + unsigned char *outptr = out; + + if(!ihdr->interlace_method || pass == 6) return spng_decode_scanline(ctx, out, len); + + ret = spng_decode_scanline(ctx, ctx->row, ctx->image_width); + if(ret && ret != SPNG_EOI) return ret; + + uint32_t k; + unsigned pixel_size = 4; /* RGBA8 */ + if(ctx->fmt == SPNG_FMT_RGBA16) pixel_size = 8; + else if(ctx->fmt == SPNG_FMT_RGB8) pixel_size = 3; + else if(ctx->fmt == SPNG_FMT_G8) pixel_size = 1; + else if(ctx->fmt == SPNG_FMT_GA8) pixel_size = 2; + else if(ctx->fmt & (SPNG_FMT_PNG | SPNG_FMT_RAW)) + { + if(ihdr->bit_depth < 8) + { + struct spng__iter iter = spng__iter_init(ihdr->bit_depth, ctx->row); + const uint8_t samples_per_byte = 8 / ihdr->bit_depth; + uint8_t sample; + + for(k=0; k < ctx->subimage[pass].width; k++) + { + sample = get_sample(&iter); + + size_t ioffset = adam7_x_start[pass] + k * adam7_x_delta[pass]; + + sample = sample << (iter.initial_shift - ioffset * ihdr->bit_depth % 8); + + ioffset /= samples_per_byte; + + outptr[ioffset] |= sample; + } + + return 0; + } + else pixel_size = ctx->bytes_per_pixel; + } + + for(k=0; k < ctx->subimage[pass].width; k++) + { + size_t ioffset = (adam7_x_start[pass] + (size_t) k * adam7_x_delta[pass]) * pixel_size; + + memcpy(outptr + ioffset, ctx->row + k * pixel_size, pixel_size); + } + + return 0; +} + +int spng_decode_chunks(spng_ctx *ctx) +{ + if(ctx == NULL) return 1; + if(ctx->encode_only) return SPNG_ECTXTYPE; + if(ctx->state < SPNG_STATE_INPUT) return SPNG_ENOSRC; + if(ctx->state == SPNG_STATE_IEND) return 0; + + return read_chunks(ctx, 0); +} + +int spng_decode_image(spng_ctx *ctx, void *out, size_t len, int fmt, int flags) +{ + if(ctx == NULL) return 1; + if(ctx->encode_only) return SPNG_ECTXTYPE; + if(ctx->state >= SPNG_STATE_EOI) return SPNG_EOI; + + const struct spng_ihdr *ihdr = &ctx->ihdr; + + int ret = read_chunks(ctx, 0); + if(ret) return decode_err(ctx, ret); + + ret = check_decode_fmt(ihdr, fmt); + if(ret) return ret; + + ret = calculate_image_width(ihdr, fmt, &ctx->image_width); + if(ret) return decode_err(ctx, ret); + + if(ctx->image_width > SIZE_MAX / ihdr->height) ctx->image_size = 0; /* overflow */ + else ctx->image_size = ctx->image_width * ihdr->height; + + if( !(flags & SPNG_DECODE_PROGRESSIVE) ) + { + if(out == NULL) return 1; + if(!ctx->image_size) return SPNG_EOVERFLOW; + if(len < ctx->image_size) return SPNG_EBUFSIZ; + } + + uint32_t bytes_read = 0; + + ret = read_idat_bytes(ctx, &bytes_read); + if(ret) return decode_err(ctx, ret); + + if(bytes_read > 1) + { + int valid = read_u16(ctx->data) % 31 ? 0 : 1; + + unsigned flg = ctx->data[1]; + unsigned flevel = flg >> 6; + int compression_level = Z_DEFAULT_COMPRESSION; + + if(flevel == 0) compression_level = 0; /* fastest */ + else if(flevel == 1) compression_level = 1; /* fast */ + else if(flevel == 2) compression_level = 6; /* default */ + else if(flevel == 3) compression_level = 9; /* slowest, max compression */ + + if(valid) ctx->image_options.compression_level = compression_level; + } + + ret = spng__inflate_init(ctx, ctx->image_options.window_bits); + if(ret) return decode_err(ctx, ret); + + ctx->zstream.avail_in = bytes_read; + ctx->zstream.next_in = ctx->data; + + size_t scanline_buf_size = ctx->subimage[ctx->widest_pass].scanline_width; + + scanline_buf_size += 32; + + if(scanline_buf_size < 32) return SPNG_EOVERFLOW; + + ctx->scanline_buf = spng__malloc(ctx, scanline_buf_size); + ctx->prev_scanline_buf = spng__malloc(ctx, scanline_buf_size); + + ctx->scanline = ctx->scanline_buf; + ctx->prev_scanline = ctx->prev_scanline_buf; + + struct decode_flags f = {0}; + + ctx->fmt = fmt; + + if(ihdr->color_type == SPNG_COLOR_TYPE_INDEXED) f.indexed = 1; + + unsigned processing_depth = ihdr->bit_depth; + + if(f.indexed) processing_depth = 8; + + if(ihdr->interlace_method) + { + f.interlaced = 1; + ctx->row_buf = spng__malloc(ctx, ctx->image_width); + ctx->row = ctx->row_buf; + + if(ctx->row == NULL) return decode_err(ctx, SPNG_EMEM); + } + + if(ctx->scanline == NULL || ctx->prev_scanline == NULL) + { + return decode_err(ctx, SPNG_EMEM); + } + + f.do_scaling = 1; + if(f.indexed) f.do_scaling = 0; + + unsigned depth_target = 8; /* FMT_RGBA8, G8 */ + if(fmt == SPNG_FMT_RGBA16) depth_target = 16; + + if(flags & SPNG_DECODE_TRNS && ctx->stored.trns) f.apply_trns = 1; + else flags &= ~SPNG_DECODE_TRNS; + + if(ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE_ALPHA || + ihdr->color_type == SPNG_COLOR_TYPE_TRUECOLOR_ALPHA) flags &= ~SPNG_DECODE_TRNS; + + if(flags & SPNG_DECODE_GAMMA && ctx->stored.gama) f.apply_gamma = 1; + else flags &= ~SPNG_DECODE_GAMMA; + + if(flags & SPNG_DECODE_USE_SBIT && ctx->stored.sbit) f.use_sbit = 1; + else flags &= ~SPNG_DECODE_USE_SBIT; + + if(fmt & (SPNG_FMT_RGBA8 | SPNG_FMT_RGBA16)) + { + if(ihdr->color_type == SPNG_COLOR_TYPE_TRUECOLOR_ALPHA && + ihdr->bit_depth == depth_target) f.same_layout = 1; + } + else if(fmt == SPNG_FMT_RGB8) + { + if(ihdr->color_type == SPNG_COLOR_TYPE_TRUECOLOR && + ihdr->bit_depth == depth_target) f.same_layout = 1; + + f.apply_trns = 0; /* not applicable */ + } + else if(fmt & (SPNG_FMT_PNG | SPNG_FMT_RAW)) + { + f.same_layout = 1; + f.do_scaling = 0; + f.apply_gamma = 0; /* for now */ + f.apply_trns = 0; + } + else if(fmt == SPNG_FMT_G8 && ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE && ihdr->bit_depth <= 8) + { + if(ihdr->bit_depth == depth_target) f.same_layout = 1; + else if(ihdr->bit_depth < 8) f.unpack = 1; + + f.apply_trns = 0; + } + else if(fmt == SPNG_FMT_GA8 && ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE && ihdr->bit_depth <= 8) + { + if(ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE_ALPHA && + ihdr->bit_depth == depth_target) f.same_layout = 1; + else if(ihdr->bit_depth <= 8) f.unpack = 1; + } + else if(fmt == SPNG_FMT_GA16 && ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE && ihdr->bit_depth == 16) + { + if(ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE_ALPHA && + ihdr->bit_depth == depth_target) f.same_layout = 1; + else if(ihdr->bit_depth == 16) f.unpack = 1; + } + + /*if(f.same_layout && !flags && !f.interlaced) f.zerocopy = 1;*/ + + uint16_t *gamma_lut = NULL; + + if(f.apply_gamma) + { + float file_gamma = (float)ctx->gama / 100000.0f; + float max; + + unsigned lut_entries; + + if(fmt & (SPNG_FMT_RGBA8 | SPNG_FMT_RGB8)) + { + lut_entries = 256; + max = 255.0f; + + gamma_lut = ctx->gamma_lut8; + ctx->gamma_lut = ctx->gamma_lut8; + } + else /* SPNG_FMT_RGBA16 */ + { + lut_entries = 65536; + max = 65535.0f; + + ctx->gamma_lut16 = spng__malloc(ctx, lut_entries * sizeof(uint16_t)); + if(ctx->gamma_lut16 == NULL) return decode_err(ctx, SPNG_EMEM); + + gamma_lut = ctx->gamma_lut16; + ctx->gamma_lut = ctx->gamma_lut16; + } + + float screen_gamma = 2.2f; + float exponent = file_gamma * screen_gamma; + + if(FP_ZERO == fpclassify(exponent)) return decode_err(ctx, SPNG_EGAMA); + + exponent = 1.0f / exponent; + + unsigned i; + for(i=0; i < lut_entries; i++) + { + float c = pow((float)i / max, exponent) * max; + if(c > max) c = max; + + gamma_lut[i] = (uint16_t)c; + } + } + + struct spng_sbit *sb = &ctx->decode_sb; + + sb->red_bits = processing_depth; + sb->green_bits = processing_depth; + sb->blue_bits = processing_depth; + sb->alpha_bits = processing_depth; + sb->grayscale_bits = processing_depth; + + if(f.use_sbit) + { + if(ihdr->color_type == 0) + { + sb->grayscale_bits = ctx->sbit.grayscale_bits; + sb->alpha_bits = ihdr->bit_depth; + } + else if(ihdr->color_type == 2 || ihdr->color_type == 3) + { + sb->red_bits = ctx->sbit.red_bits; + sb->green_bits = ctx->sbit.green_bits; + sb->blue_bits = ctx->sbit.blue_bits; + sb->alpha_bits = ihdr->bit_depth; + } + else if(ihdr->color_type == 4) + { + sb->grayscale_bits = ctx->sbit.grayscale_bits; + sb->alpha_bits = ctx->sbit.alpha_bits; + } + else /* == 6 */ + { + sb->red_bits = ctx->sbit.red_bits; + sb->green_bits = ctx->sbit.green_bits; + sb->blue_bits = ctx->sbit.blue_bits; + sb->alpha_bits = ctx->sbit.alpha_bits; + } + } + + if(ihdr->bit_depth == 16 && fmt & (SPNG_FMT_RGBA8 | SPNG_FMT_RGB8)) + {/* samples are scaled down by 8 bits in the decode loop */ + sb->red_bits -= 8; + sb->green_bits -= 8; + sb->blue_bits -= 8; + sb->alpha_bits -= 8; + sb->grayscale_bits -= 8; + + processing_depth = 8; + } + + /* Prevent infinite loops in sample_to_target() */ + if(!depth_target || depth_target > 16 || + !processing_depth || processing_depth > 16 || + !sb->grayscale_bits || sb->grayscale_bits > processing_depth || + !sb->alpha_bits || sb->alpha_bits > processing_depth || + !sb->red_bits || sb->red_bits > processing_depth || + !sb->green_bits || sb->green_bits > processing_depth || + !sb->blue_bits || sb->blue_bits > processing_depth) + { + return decode_err(ctx, SPNG_ESBIT); + } + + if(sb->red_bits == sb->green_bits && + sb->green_bits == sb->blue_bits && + sb->blue_bits == sb->alpha_bits && + sb->alpha_bits == processing_depth && + processing_depth == depth_target) f.do_scaling = 0; + + struct spng_plte_entry *plte = ctx->decode_plte.rgba; + + /* Pre-process palette entries */ + if(f.indexed) + { + uint8_t red, green, blue, alpha; + + uint32_t i; + for(i=0; i < 256; i++) + { + if(f.apply_trns && i < ctx->trns.n_type3_entries) + ctx->plte.entries[i].alpha = ctx->trns.type3_alpha[i]; + else + ctx->plte.entries[i].alpha = 255; + + red = sample_to_target(ctx->plte.entries[i].red, 8, sb->red_bits, 8); + green = sample_to_target(ctx->plte.entries[i].green, 8, sb->green_bits, 8); + blue = sample_to_target(ctx->plte.entries[i].blue, 8, sb->blue_bits, 8); + alpha = sample_to_target(ctx->plte.entries[i].alpha, 8, sb->alpha_bits, 8); + +#if defined(SPNG_ARM) + if(fmt == SPNG_FMT_RGB8 && ihdr->bit_depth == 8) + {/* Working with 3 bytes at a time is more of an ARM thing */ + ctx->decode_plte.rgb[i * 3 + 0] = red; + ctx->decode_plte.rgb[i * 3 + 1] = green; + ctx->decode_plte.rgb[i * 3 + 2] = blue; + continue; + } +#endif + plte[i].red = red; + plte[i].green = green; + plte[i].blue = blue; + plte[i].alpha = alpha; + } + + f.apply_trns = 0; + } + + unsigned char *trns_px = ctx->trns_px; + + if(f.apply_trns) + { + uint16_t mask = ~0; + if(ctx->ihdr.bit_depth < 16) mask = (1 << ctx->ihdr.bit_depth) - 1; + + if(fmt & (SPNG_FMT_RGBA8 | SPNG_FMT_RGBA16)) + { + if(ihdr->color_type == SPNG_COLOR_TYPE_TRUECOLOR) + { + if(ihdr->bit_depth == 16) + { + memcpy(trns_px, &ctx->trns.red, 2); + memcpy(trns_px + 2, &ctx->trns.green, 2); + memcpy(trns_px + 4, &ctx->trns.blue, 2); + } + else + { + trns_px[0] = ctx->trns.red & mask; + trns_px[1] = ctx->trns.green & mask; + trns_px[2] = ctx->trns.blue & mask; + } + } + } + else if(ihdr->color_type == SPNG_COLOR_TYPE_GRAYSCALE) // fmt == SPNG_FMT_GA8 && + { + if(ihdr->bit_depth == 16) + { + memcpy(trns_px, &ctx->trns.gray, 2); + } + else + { + trns_px[0] = ctx->trns.gray & mask; + } + } + } + + ctx->decode_flags = f; + + ctx->state = SPNG_STATE_DECODE_INIT; + + struct spng_row_info *ri = &ctx->row_info; + struct spng_subimage *sub = ctx->subimage; + + while(!sub[ri->pass].width || !sub[ri->pass].height) ri->pass++; + + if(f.interlaced) ri->row_num = adam7_y_start[ri->pass]; + + unsigned pixel_size = 4; /* SPNG_FMT_RGBA8 */ + + if(fmt == SPNG_FMT_RGBA16) pixel_size = 8; + else if(fmt == SPNG_FMT_RGB8) pixel_size = 3; + else if(fmt == SPNG_FMT_G8) pixel_size = 1; + else if(fmt == SPNG_FMT_GA8) pixel_size = 2; + + int i; + for(i=ri->pass; i <= ctx->last_pass; i++) + { + if(!sub[i].scanline_width) continue; + + if(fmt & (SPNG_FMT_PNG | SPNG_FMT_RAW)) sub[i].out_width = sub[i].scanline_width - 1; + else sub[i].out_width = (size_t)sub[i].width * pixel_size; + + if(sub[i].out_width > UINT32_MAX) return decode_err(ctx, SPNG_EOVERFLOW); + } + + /* Read the first filter byte, offsetting all reads by 1 byte. + The scanlines will be aligned with the start of the array with + the next scanline's filter byte at the end, + the last scanline will end up being 1 byte "shorter". */ + ret = read_scanline_bytes(ctx, &ri->filter, 1); + if(ret) return decode_err(ctx, ret); + + if(ri->filter > 4) return decode_err(ctx, SPNG_EFILTER); + + if(flags & SPNG_DECODE_PROGRESSIVE) + { + return 0; + } + + do + { + size_t ioffset = ri->row_num * ctx->image_width; + + ret = spng_decode_row(ctx, (unsigned char*)out + ioffset, ctx->image_width); + }while(!ret); + + if(ret != SPNG_EOI) return decode_err(ctx, ret); + + return 0; +} + +int spng_get_row_info(spng_ctx *ctx, struct spng_row_info *row_info) +{ + if(ctx == NULL || row_info == NULL || ctx->state < SPNG_STATE_DECODE_INIT) return 1; + + if(ctx->state >= SPNG_STATE_EOI) return SPNG_EOI; + + *row_info = ctx->row_info; + + return 0; +} + +static int write_chunks_before_idat(spng_ctx *ctx) +{ + if(ctx == NULL) return SPNG_EINTERNAL; + if(!ctx->encode_only) return SPNG_EINTERNAL; + if(!ctx->stored.ihdr) return SPNG_EINTERNAL; + + int ret; + uint32_t i; + size_t length; + const struct spng_ihdr *ihdr = &ctx->ihdr; + unsigned char *data = ctx->decode_plte.raw; + + ret = write_data(ctx, spng_signature, 8); + if(ret) return ret; + + write_u32(data, ihdr->width); + write_u32(data + 4, ihdr->height); + data[8] = ihdr->bit_depth; + data[9] = ihdr->color_type; + data[10] = ihdr->compression_method; + data[11] = ihdr->filter_method; + data[12] = ihdr->interlace_method; + + ret = write_chunk(ctx, type_ihdr, data, 13); + if(ret) return ret; + + if(ctx->stored.chrm) + { + write_u32(data, ctx->chrm_int.white_point_x); + write_u32(data + 4, ctx->chrm_int.white_point_y); + write_u32(data + 8, ctx->chrm_int.red_x); + write_u32(data + 12, ctx->chrm_int.red_y); + write_u32(data + 16, ctx->chrm_int.green_x); + write_u32(data + 20, ctx->chrm_int.green_y); + write_u32(data + 24, ctx->chrm_int.blue_x); + write_u32(data + 28, ctx->chrm_int.blue_y); + + ret = write_chunk(ctx, type_chrm, data, 32); + if(ret) return ret; + } + + if(ctx->stored.gama) + { + write_u32(data, ctx->gama); + + ret = write_chunk(ctx, type_gama, data, 4); + if(ret) return ret; + } + + if(ctx->stored.iccp) + { + uLongf dest_len = compressBound((uLong)ctx->iccp.profile_len); + + Bytef *buf = spng__malloc(ctx, dest_len); + if(buf == NULL) return SPNG_EMEM; + + ret = compress2(buf, &dest_len, (void*)ctx->iccp.profile, (uLong)ctx->iccp.profile_len, Z_DEFAULT_COMPRESSION); + + if(ret != Z_OK) + { + spng__free(ctx, buf); + return SPNG_EZLIB; + } + + size_t name_len = strlen(ctx->iccp.profile_name); + + length = name_len + 2; + length += dest_len; + + if(dest_len > length) return SPNG_EOVERFLOW; + + unsigned char *cdata = NULL; + + ret = write_header(ctx, type_iccp, length, &cdata); + + if(ret) + { + spng__free(ctx, buf); + return ret; + } + + memcpy(cdata, ctx->iccp.profile_name, name_len + 1); + cdata[name_len + 1] = 0; /* compression method */ + memcpy(cdata + name_len + 2, buf, dest_len); + + spng__free(ctx, buf); + + ret = finish_chunk(ctx); + if(ret) return ret; + } + + if(ctx->stored.sbit) + { + switch(ctx->ihdr.color_type) + { + case SPNG_COLOR_TYPE_GRAYSCALE: + { + length = 1; + + data[0] = ctx->sbit.grayscale_bits; + + break; + } + case SPNG_COLOR_TYPE_TRUECOLOR: + case SPNG_COLOR_TYPE_INDEXED: + { + length = 3; + + data[0] = ctx->sbit.red_bits; + data[1] = ctx->sbit.green_bits; + data[2] = ctx->sbit.blue_bits; + + break; + } + case SPNG_COLOR_TYPE_GRAYSCALE_ALPHA: + { + length = 2; + + data[0] = ctx->sbit.grayscale_bits; + data[1] = ctx->sbit.alpha_bits; + + break; + } + case SPNG_COLOR_TYPE_TRUECOLOR_ALPHA: + { + length = 4; + + data[0] = ctx->sbit.red_bits; + data[1] = ctx->sbit.green_bits; + data[2] = ctx->sbit.blue_bits; + data[3] = ctx->sbit.alpha_bits; + + break; + } + default: return SPNG_EINTERNAL; + } + + ret = write_chunk(ctx, type_sbit, data, length); + if(ret) return ret; + } + + if(ctx->stored.srgb) + { + ret = write_chunk(ctx, type_srgb, &ctx->srgb_rendering_intent, 1); + if(ret) return ret; + } + + ret = write_unknown_chunks(ctx, SPNG_AFTER_IHDR); + if(ret) return ret; + + if(ctx->stored.plte) + { + for(i=0; i < ctx->plte.n_entries; i++) + { + data[i * 3 + 0] = ctx->plte.entries[i].red; + data[i * 3 + 1] = ctx->plte.entries[i].green; + data[i * 3 + 2] = ctx->plte.entries[i].blue; + } + + ret = write_chunk(ctx, type_plte, data, ctx->plte.n_entries * 3); + if(ret) return ret; + } + + if(ctx->stored.bkgd) + { + switch(ctx->ihdr.color_type) + { + case SPNG_COLOR_TYPE_GRAYSCALE: + case SPNG_COLOR_TYPE_GRAYSCALE_ALPHA: + { + length = 2; + + write_u16(data, ctx->bkgd.gray); + + break; + } + case SPNG_COLOR_TYPE_TRUECOLOR: + case SPNG_COLOR_TYPE_TRUECOLOR_ALPHA: + { + length = 6; + + write_u16(data, ctx->bkgd.red); + write_u16(data + 2, ctx->bkgd.green); + write_u16(data + 4, ctx->bkgd.blue); + + break; + } + case SPNG_COLOR_TYPE_INDEXED: + { + length = 1; + + data[0] = ctx->bkgd.plte_index; + + break; + } + default: return SPNG_EINTERNAL; + } + + ret = write_chunk(ctx, type_bkgd, data, length); + if(ret) return ret; + } + + if(ctx->stored.hist) + { + length = ctx->plte.n_entries * 2; + + for(i=0; i < ctx->plte.n_entries; i++) + { + write_u16(data + i * 2, ctx->hist.frequency[i]); + } + + ret = write_chunk(ctx, type_hist, data, length); + if(ret) return ret; + } + + if(ctx->stored.trns) + { + if(ctx->ihdr.color_type == SPNG_COLOR_TYPE_GRAYSCALE) + { + write_u16(data, ctx->trns.gray); + + ret = write_chunk(ctx, type_trns, data, 2); + } + else if(ctx->ihdr.color_type == SPNG_COLOR_TYPE_TRUECOLOR) + { + write_u16(data, ctx->trns.red); + write_u16(data + 2, ctx->trns.green); + write_u16(data + 4, ctx->trns.blue); + + ret = write_chunk(ctx, type_trns, data, 6); + } + else if(ctx->ihdr.color_type == SPNG_COLOR_TYPE_INDEXED) + { + ret = write_chunk(ctx, type_trns, ctx->trns.type3_alpha, ctx->trns.n_type3_entries); + } + + if(ret) return ret; + } + + if(ctx->stored.phys) + { + write_u32(data, ctx->phys.ppu_x); + write_u32(data + 4, ctx->phys.ppu_y); + data[8] = ctx->phys.unit_specifier; + + ret = write_chunk(ctx, type_phys, data, 9); + if(ret) return ret; + } + + if(ctx->stored.splt) + { + const struct spng_splt *splt; + unsigned char *cdata = NULL; + + uint32_t k; + for(i=0; i < ctx->n_splt; i++) + { + splt = &ctx->splt_list[i]; + + size_t name_len = strlen(splt->name); + length = name_len + 1; + + if(splt->sample_depth == 8) length += splt->n_entries * 6 + 1; + else if(splt->sample_depth == 16) length += splt->n_entries * 10 + 1; + + ret = write_header(ctx, type_splt, length, &cdata); + if(ret) return ret; + + memcpy(cdata, splt->name, name_len + 1); + cdata += name_len + 2; + cdata[-1] = splt->sample_depth; + + if(splt->sample_depth == 8) + { + for(k=0; k < splt->n_entries; k++) + { + cdata[k * 6 + 0] = splt->entries[k].red; + cdata[k * 6 + 1] = splt->entries[k].green; + cdata[k * 6 + 2] = splt->entries[k].blue; + cdata[k * 6 + 3] = splt->entries[k].alpha; + write_u16(cdata + k * 6 + 4, splt->entries[k].frequency); + } + } + else if(splt->sample_depth == 16) + { + for(k=0; k < splt->n_entries; k++) + { + write_u16(cdata + k * 10 + 0, splt->entries[k].red); + write_u16(cdata + k * 10 + 2, splt->entries[k].green); + write_u16(cdata + k * 10 + 4, splt->entries[k].blue); + write_u16(cdata + k * 10 + 6, splt->entries[k].alpha); + write_u16(cdata + k * 10 + 8, splt->entries[k].frequency); + } + } + + ret = finish_chunk(ctx); + if(ret) return ret; + } + } + + if(ctx->stored.time) + { + write_u16(data, ctx->time.year); + data[2] = ctx->time.month; + data[3] = ctx->time.day; + data[4] = ctx->time.hour; + data[5] = ctx->time.minute; + data[6] = ctx->time.second; + + ret = write_chunk(ctx, type_time, data, 7); + if(ret) return ret; + } + + if(ctx->stored.text) + { + unsigned char *cdata = NULL; + const struct spng_text2 *text; + const uint8_t *text_type_array[4] = { 0, type_text, type_ztxt, type_itxt }; + + for(i=0; i < ctx->n_text; i++) + { + text = &ctx->text_list[i]; + + const uint8_t *text_chunk_type = text_type_array[text->type]; + Bytef *compressed_text = NULL; + size_t keyword_len = 0; + size_t language_tag_len = 0; + size_t translated_keyword_len = 0; + size_t compressed_length = 0; + size_t text_length = 0; + + keyword_len = strlen(text->keyword); + text_length = strlen(text->text); + + length = keyword_len + 1; + + if(text->type == SPNG_ZTXT) + { + length += 1; /* compression method */ + } + else if(text->type == SPNG_ITXT) + { + if(!text->language_tag || !text->translated_keyword) return SPNG_EINTERNAL; + + language_tag_len = strlen(text->language_tag); + translated_keyword_len = strlen(text->translated_keyword); + + length += language_tag_len; + if(length < language_tag_len) return SPNG_EOVERFLOW; + + length += translated_keyword_len; + if(length < translated_keyword_len) return SPNG_EOVERFLOW; + + length += 4; /* compression flag + method + nul for the two strings */ + if(length < 4) return SPNG_EOVERFLOW; + } + + if(text->compression_flag) + { + ret = spng__deflate_init(ctx, &ctx->text_options); + if(ret) return ret; + + z_stream *zstream = &ctx->zstream; + uLongf dest_len = deflateBound(zstream, (uLong)text_length); + + compressed_text = spng__malloc(ctx, dest_len); + + if(compressed_text == NULL) return SPNG_EMEM; + + zstream->next_in = (void*)text->text; + zstream->avail_in = (uInt)text_length; + + zstream->next_out = compressed_text; + zstream->avail_out = dest_len; + + ret = deflate(zstream, Z_FINISH); + + if(ret != Z_STREAM_END) + { + spng__free(ctx, compressed_text); + return SPNG_EZLIB; + } + + compressed_length = zstream->total_out; + + length += compressed_length; + if(length < compressed_length) return SPNG_EOVERFLOW; + } + else + { + text_length = strlen(text->text); + + length += text_length; + if(length < text_length) return SPNG_EOVERFLOW; + } + + ret = write_header(ctx, text_chunk_type, length, &cdata); + if(ret) + { + spng__free(ctx, compressed_text); + return ret; + } + + memcpy(cdata, text->keyword, keyword_len + 1); + cdata += keyword_len + 1; + + if(text->type == SPNG_ITXT) + { + cdata[0] = text->compression_flag; + cdata[1] = 0; /* compression method */ + cdata += 2; + + memcpy(cdata, text->language_tag, language_tag_len + 1); + cdata += language_tag_len + 1; + + memcpy(cdata, text->translated_keyword, translated_keyword_len + 1); + cdata += translated_keyword_len + 1; + } + else if(text->type == SPNG_ZTXT) + { + cdata[0] = 0; /* compression method */ + cdata++; + } + + if(text->compression_flag) memcpy(cdata, compressed_text, compressed_length); + else memcpy(cdata, text->text, text_length); + + spng__free(ctx, compressed_text); + + ret = finish_chunk(ctx); + if(ret) return ret; + } + } + + if(ctx->stored.offs) + { + write_s32(data, ctx->offs.x); + write_s32(data + 4, ctx->offs.y); + data[8] = ctx->offs.unit_specifier; + + ret = write_chunk(ctx, type_offs, data, 9); + if(ret) return ret; + } + + if(ctx->stored.exif) + { + ret = write_chunk(ctx, type_exif, ctx->exif.data, ctx->exif.length); + if(ret) return ret; + } + + ret = write_unknown_chunks(ctx, SPNG_AFTER_PLTE); + if(ret) return ret; + + return 0; +} + +static int write_chunks_after_idat(spng_ctx *ctx) +{ + if(ctx == NULL) return SPNG_EINTERNAL; + + int ret = write_unknown_chunks(ctx, SPNG_AFTER_IDAT); + if(ret) return ret; + + return write_iend(ctx); +} + +/* Compress and write scanline to IDAT stream */ +static int write_idat_bytes(spng_ctx *ctx, const void *scanline, size_t len, int flush) +{ + if(ctx == NULL || scanline == NULL) return SPNG_EINTERNAL; + if(len > UINT_MAX) return SPNG_EINTERNAL; + + int ret = 0; + unsigned char *data = NULL; + z_stream *zstream = &ctx->zstream; + uint32_t idat_length = SPNG_WRITE_SIZE; + + zstream->next_in = scanline; + zstream->avail_in = (uInt)len; + + do + { + ret = deflate(zstream, flush); + + if(zstream->avail_out == 0) + { + ret = finish_chunk(ctx); + if(ret) return encode_err(ctx, ret); + + ret = write_header(ctx, type_idat, idat_length, &data); + if(ret) return encode_err(ctx, ret); + + zstream->next_out = data; + zstream->avail_out = idat_length; + } + + }while(zstream->avail_in); + + if(ret != Z_OK) return SPNG_EZLIB; + + return 0; +} + +static int finish_idat(spng_ctx *ctx) +{ + int ret = 0; + unsigned char *data = NULL; + z_stream *zstream = &ctx->zstream; + uint32_t idat_length = SPNG_WRITE_SIZE; + + while(ret != Z_STREAM_END) + { + ret = deflate(zstream, Z_FINISH); + + if(ret) + { + if(ret == Z_STREAM_END) break; + + if(ret != Z_BUF_ERROR) return SPNG_EZLIB; + } + + if(zstream->avail_out == 0) + { + ret = finish_chunk(ctx); + if(ret) return encode_err(ctx, ret); + + ret = write_header(ctx, type_idat, idat_length, &data); + if(ret) return encode_err(ctx, ret); + + zstream->next_out = data; + zstream->avail_out = idat_length; + } + } + + uint32_t trimmed_length = idat_length - zstream->avail_out; + + ret = trim_chunk(ctx, trimmed_length); + if(ret) return ret; + + return finish_chunk(ctx); +} + +static int encode_scanline(spng_ctx *ctx, const void *scanline, size_t len) +{ + if(ctx == NULL || scanline == NULL) return SPNG_EINTERNAL; + + int ret, pass = ctx->row_info.pass; + uint8_t filter = 0; + struct spng_row_info *ri = &ctx->row_info; + const struct spng_subimage *sub = ctx->subimage; + struct encode_flags f = ctx->encode_flags; + unsigned char *filtered_scanline = ctx->filtered_scanline; + size_t scanline_width = sub[pass].scanline_width; + + if(len < scanline_width - 1) return SPNG_EINTERNAL; + + /* encode_row() interlaces directly to ctx->scanline */ + if(scanline != ctx->scanline) memcpy(ctx->scanline, scanline, scanline_width - 1); + + if(f.to_bigendian) u16_row_to_bigendian(ctx->scanline, scanline_width - 1); + const int requires_previous = f.filter_choice & (SPNG_FILTER_CHOICE_UP | SPNG_FILTER_CHOICE_AVG | SPNG_FILTER_CHOICE_PAETH); + + /* XXX: exclude 'requires_previous' filters by default for first scanline? */ + if(!ri->scanline_idx && requires_previous) + { + /* prev_scanline is all zeros for the first scanline */ + memset(ctx->prev_scanline, 0, scanline_width); + } + + filter = get_best_filter(ctx->prev_scanline, ctx->scanline, scanline_width, ctx->bytes_per_pixel, f.filter_choice); + + if(!filter) filtered_scanline = ctx->scanline; + + filtered_scanline[-1] = filter; + + if(filter) + { + ret = filter_scanline(filtered_scanline, ctx->prev_scanline, ctx->scanline, scanline_width, ctx->bytes_per_pixel, filter); + if(ret) return encode_err(ctx, ret); + } + + ret = write_idat_bytes(ctx, filtered_scanline - 1, scanline_width, Z_NO_FLUSH); + if(ret) return encode_err(ctx, ret); + + /* The previous scanline is always unfiltered */ + void *t = ctx->prev_scanline; + ctx->prev_scanline = ctx->scanline; + ctx->scanline = t; + + ret = update_row_info(ctx); + + if(ret == SPNG_EOI) + { + int error = finish_idat(ctx); + if(error) encode_err(ctx, error); + + if(f.finalize) + { + error = spng_encode_chunks(ctx); + if(error) return encode_err(ctx, error); + } + } + + return ret; +} + +static int encode_row(spng_ctx *ctx, const void *row, size_t len) +{ + if(ctx == NULL || row == NULL) return SPNG_EINTERNAL; + + const int pass = ctx->row_info.pass; + + if(!ctx->ihdr.interlace_method || pass == 6) return encode_scanline(ctx, row, len); + + uint32_t k; + const unsigned pixel_size = ctx->pixel_size; + const unsigned bit_depth = ctx->ihdr.bit_depth; + + if(bit_depth < 8) + { + const unsigned samples_per_byte = 8 / bit_depth; + const uint8_t mask = (1 << bit_depth) - 1; + const unsigned initial_shift = 8 - bit_depth; + unsigned shift_amount = initial_shift; + + unsigned char *scanline = ctx->scanline; + const unsigned char *row_uc = row; + uint8_t sample; + + memset(scanline, 0, ctx->subimage[pass].scanline_width); + + for(k=0; k < ctx->subimage[pass].width; k++) + { + size_t ioffset = adam7_x_start[pass] + k * adam7_x_delta[pass]; + + sample = row_uc[ioffset / samples_per_byte]; + + sample = sample >> (initial_shift - ioffset * bit_depth % 8); + sample = sample & mask; + sample = sample << shift_amount; + + scanline[0] |= sample; + + shift_amount -= bit_depth; + + if(shift_amount > 7) + { + shift_amount = initial_shift; + scanline++; + } + } + + return encode_scanline(ctx, ctx->scanline, len); + } + + for(k=0; k < ctx->subimage[pass].width; k++) + { + size_t ioffset = (adam7_x_start[pass] + (size_t) k * adam7_x_delta[pass]) * pixel_size; + + memcpy(ctx->scanline + k * pixel_size, (unsigned char*)row + ioffset, pixel_size); + } + + return encode_scanline(ctx, ctx->scanline, len); +} + +int spng_encode_scanline(spng_ctx *ctx, const void *scanline, size_t len) +{ + if(ctx == NULL || scanline == NULL) return SPNG_EINVAL; + if(ctx->state >= SPNG_STATE_EOI) return SPNG_EOI; + if(len < (ctx->subimage[ctx->row_info.pass].scanline_width -1) ) return SPNG_EBUFSIZ; + + return encode_scanline(ctx, scanline, len); +} + +int spng_encode_row(spng_ctx *ctx, const void *row, size_t len) +{ + if(ctx == NULL || row == NULL) return SPNG_EINVAL; + if(ctx->state >= SPNG_STATE_EOI) return SPNG_EOI; + if(len < ctx->image_width) return SPNG_EBUFSIZ; + + return encode_row(ctx, row, len); +} + +int spng_encode_chunks(spng_ctx *ctx) +{ + if(ctx == NULL) return 1; + if(!ctx->state) return SPNG_EBADSTATE; + if(ctx->state < SPNG_STATE_OUTPUT) return SPNG_ENODST; + if(!ctx->encode_only) return SPNG_ECTXTYPE; + + int ret = 0; + + if(ctx->state < SPNG_STATE_FIRST_IDAT) + { + if(!ctx->stored.ihdr) return SPNG_ENOIHDR; + + ret = write_chunks_before_idat(ctx); + if(ret) return encode_err(ctx, ret); + + ctx->state = SPNG_STATE_FIRST_IDAT; + } + else if(ctx->state == SPNG_STATE_FIRST_IDAT) + { + return 0; + } + else if(ctx->state == SPNG_STATE_EOI) + { + ret = write_chunks_after_idat(ctx); + if(ret) return encode_err(ctx, ret); + + ctx->state = SPNG_STATE_IEND; + } + else return SPNG_EOPSTATE; + + return 0; +} + +int spng_encode_image(spng_ctx *ctx, const void *img, size_t len, int fmt, int flags) +{ + if(ctx == NULL) return 1; + if(!ctx->state) return SPNG_EBADSTATE; + if(!ctx->encode_only) return SPNG_ECTXTYPE; + if(!ctx->stored.ihdr) return SPNG_ENOIHDR; + if( !(fmt == SPNG_FMT_PNG || fmt == SPNG_FMT_RAW) ) return SPNG_EFMT; + + int ret = 0; + const struct spng_ihdr *ihdr = &ctx->ihdr; + struct encode_flags *encode_flags = &ctx->encode_flags; + + if(ihdr->color_type == SPNG_COLOR_TYPE_INDEXED && !ctx->stored.plte) return SPNG_ENOPLTE; + + ret = calculate_image_width(ihdr, fmt, &ctx->image_width); + if(ret) return encode_err(ctx, ret); + + if(ctx->image_width > SIZE_MAX / ihdr->height) ctx->image_size = 0; /* overflow */ + else ctx->image_size = ctx->image_width * ihdr->height; + + if( !(flags & SPNG_ENCODE_PROGRESSIVE) ) + { + if(img == NULL) return 1; + if(!ctx->image_size) return SPNG_EOVERFLOW; + if(len != ctx->image_size) return SPNG_EBUFSIZ; + } + + ret = spng_encode_chunks(ctx); + if(ret) return encode_err(ctx, ret); + + ret = calculate_subimages(ctx); + if(ret) return encode_err(ctx, ret); + + if(ihdr->bit_depth < 8) ctx->bytes_per_pixel = 1; + else ctx->bytes_per_pixel = num_channels(ihdr) * (ihdr->bit_depth / 8); + + if(spng__optimize(SPNG_FILTER_CHOICE)) + { + /* Filtering would make no difference */ + if(!ctx->image_options.compression_level) + { + encode_flags->filter_choice = SPNG_DISABLE_FILTERING; + } + + /* Palette indices and low bit-depth images do not benefit from filtering */ + if(ihdr->color_type == SPNG_COLOR_TYPE_INDEXED || ihdr->bit_depth < 8) + { + encode_flags->filter_choice = SPNG_DISABLE_FILTERING; + } + } + + /* This is technically the same as disabling filtering */ + if(encode_flags->filter_choice == SPNG_FILTER_CHOICE_NONE) + { + encode_flags->filter_choice = SPNG_DISABLE_FILTERING; + } + + if(!encode_flags->filter_choice && spng__optimize(SPNG_IMG_COMPRESSION_STRATEGY)) + { + ctx->image_options.strategy = Z_DEFAULT_STRATEGY; + } + + ret = spng__deflate_init(ctx, &ctx->image_options); + if(ret) return encode_err(ctx, ret); + + size_t scanline_buf_size = ctx->subimage[ctx->widest_pass].scanline_width; + + scanline_buf_size += 32; + + if(scanline_buf_size < 32) return SPNG_EOVERFLOW; + + ctx->scanline_buf = spng__malloc(ctx, scanline_buf_size); + ctx->prev_scanline_buf = spng__malloc(ctx, scanline_buf_size); + + if(ctx->scanline_buf == NULL || ctx->prev_scanline_buf == NULL) return encode_err(ctx, SPNG_EMEM); + + /* Maintain alignment for pixels, filter at [-1] */ + ctx->scanline = ctx->scanline_buf + 16; + ctx->prev_scanline = ctx->prev_scanline_buf + 16; + + if(encode_flags->filter_choice) + { + ctx->filtered_scanline_buf = spng__malloc(ctx, scanline_buf_size); + if(ctx->filtered_scanline_buf == NULL) return encode_err(ctx, SPNG_EMEM); + + ctx->filtered_scanline = ctx->filtered_scanline_buf + 16; + } + + struct spng_subimage *sub = ctx->subimage; + struct spng_row_info *ri = &ctx->row_info; + + ctx->fmt = fmt; + + z_stream *zstream = &ctx->zstream; + zstream->avail_out = SPNG_WRITE_SIZE; + + ret = write_header(ctx, type_idat, zstream->avail_out, &zstream->next_out); + if(ret) return encode_err(ctx, ret); + + if(ihdr->interlace_method) encode_flags->interlace = 1; + + if(fmt & (SPNG_FMT_PNG | SPNG_FMT_RAW) ) encode_flags->same_layout = 1; + + if(ihdr->bit_depth == 16 && fmt != SPNG_FMT_RAW) encode_flags->to_bigendian = 1; + + if(flags & SPNG_ENCODE_FINALIZE) encode_flags->finalize = 1; + + while(!sub[ri->pass].width || !sub[ri->pass].height) ri->pass++; + + if(encode_flags->interlace) ri->row_num = adam7_y_start[ri->pass]; + + ctx->pixel_size = 4; /* SPNG_FMT_RGBA8 */ + + if(fmt == SPNG_FMT_RGBA16) ctx->pixel_size = 8; + else if(fmt == SPNG_FMT_RGB8) ctx->pixel_size = 3; + else if(fmt == SPNG_FMT_G8) ctx->pixel_size = 1; + else if(fmt == SPNG_FMT_GA8) ctx->pixel_size = 2; + else if(fmt & (SPNG_FMT_PNG | SPNG_FMT_RAW)) ctx->pixel_size = ctx->bytes_per_pixel; + + ctx->state = SPNG_STATE_ENCODE_INIT; + + if(flags & SPNG_ENCODE_PROGRESSIVE) + { + encode_flags->progressive = 1; + + return 0; + } + + do + { + size_t ioffset = ri->row_num * ctx->image_width; + + ret = encode_row(ctx, (unsigned char*)img + ioffset, ctx->image_width); + + }while(!ret); + + if(ret != SPNG_EOI) return encode_err(ctx, ret); + + return 0; +} + +spng_ctx *spng_ctx_new(int flags) +{ + struct spng_alloc alloc = + { + .malloc_fn = malloc, + .realloc_fn = realloc, + .calloc_fn = calloc, + .free_fn = free + }; + + return spng_ctx_new2(&alloc, flags); +} + +spng_ctx *spng_ctx_new2(struct spng_alloc *alloc, int flags) +{ + if(alloc == NULL) return NULL; + if(flags != (flags & SPNG__CTX_FLAGS_ALL)) return NULL; + + if(alloc->malloc_fn == NULL) return NULL; + if(alloc->realloc_fn == NULL) return NULL; + if(alloc->calloc_fn == NULL) return NULL; + if(alloc->free_fn == NULL) return NULL; + + spng_ctx *ctx = alloc->calloc_fn(1, sizeof(spng_ctx)); + if(ctx == NULL) return NULL; + + ctx->alloc = *alloc; + + ctx->max_width = spng_u32max; + ctx->max_height = spng_u32max; + + ctx->max_chunk_size = spng_u32max; + ctx->chunk_cache_limit = SIZE_MAX; + ctx->chunk_count_limit = SPNG_MAX_CHUNK_COUNT; + + ctx->state = SPNG_STATE_INIT; + + ctx->crc_action_critical = SPNG_CRC_ERROR; + ctx->crc_action_ancillary = SPNG_CRC_DISCARD; + + const struct spng__zlib_options image_defaults = + { + .compression_level = Z_DEFAULT_COMPRESSION, + .window_bits = 15, + .mem_level = 8, + .strategy = Z_FILTERED, + .data_type = 0 /* Z_BINARY */ + }; + + const struct spng__zlib_options text_defaults = + { + .compression_level = Z_DEFAULT_COMPRESSION, + .window_bits = 15, + .mem_level = 8, + .strategy = Z_DEFAULT_STRATEGY, + .data_type = 1 /* Z_TEXT */ + }; + + ctx->image_options = image_defaults; + ctx->text_options = text_defaults; + + ctx->optimize_option = ~0; + ctx->encode_flags.filter_choice = SPNG_FILTER_CHOICE_ALL; + + ctx->flags = flags; + + if(flags & SPNG_CTX_ENCODER) ctx->encode_only = 1; + + return ctx; +} + +void spng_ctx_free(spng_ctx *ctx) +{ + if(ctx == NULL) return; + + if(ctx->streaming && ctx->stream_buf != NULL) spng__free(ctx, ctx->stream_buf); + + if(!ctx->user.exif) spng__free(ctx, ctx->exif.data); + + if(!ctx->user.iccp) spng__free(ctx, ctx->iccp.profile); + + uint32_t i; + + if(ctx->splt_list != NULL && !ctx->user.splt) + { + for(i=0; i < ctx->n_splt; i++) + { + spng__free(ctx, ctx->splt_list[i].entries); + } + spng__free(ctx, ctx->splt_list); + } + + if(ctx->text_list != NULL) + { + for(i=0; i< ctx->n_text; i++) + { + if(ctx->user.text) break; + + spng__free(ctx, ctx->text_list[i].keyword); + if(ctx->text_list[i].compression_flag) spng__free(ctx, ctx->text_list[i].text); + } + spng__free(ctx, ctx->text_list); + } + + if(ctx->chunk_list != NULL && !ctx->user.unknown) + { + for(i=0; i< ctx->n_chunks; i++) + { + spng__free(ctx, ctx->chunk_list[i].data); + } + spng__free(ctx, ctx->chunk_list); + } + + if(ctx->deflate) deflateEnd(&ctx->zstream); + else inflateEnd(&ctx->zstream); + + if(!ctx->user_owns_out_png) spng__free(ctx, ctx->out_png); + + spng__free(ctx, ctx->gamma_lut16); + + spng__free(ctx, ctx->row_buf); + spng__free(ctx, ctx->scanline_buf); + spng__free(ctx, ctx->prev_scanline_buf); + spng__free(ctx, ctx->filtered_scanline_buf); + + spng_free_fn *free_fn = ctx->alloc.free_fn; + + memset(ctx, 0, sizeof(spng_ctx)); + + free_fn(ctx); +} + +static int buffer_read_fn(spng_ctx *ctx, void *user, void *data, size_t n) +{ + if(n > ctx->bytes_left) return SPNG_IO_EOF; + + (void)user; + (void)data; + ctx->data = ctx->data + ctx->last_read_size; + + ctx->last_read_size = n; + ctx->bytes_left -= n; + + return 0; +} + +static int file_read_fn(spng_ctx *ctx, void *user, void *data, size_t n) +{ + FILE *file = user; + (void)ctx; + + if(fread(data, n, 1, file) != 1) + { + if(feof(file)) return SPNG_IO_EOF; + else return SPNG_IO_ERROR; + } + + return 0; +} + +static int file_write_fn(spng_ctx *ctx, void *user, void *data, size_t n) +{ + FILE *file = user; + (void)ctx; + + if(fwrite(data, n, 1, file) != 1) return SPNG_IO_ERROR; + + return 0; +} + +int spng_set_png_buffer(spng_ctx *ctx, const void *buf, size_t size) +{ + if(ctx == NULL || buf == NULL) return 1; + if(!ctx->state) return SPNG_EBADSTATE; + if(ctx->encode_only) return SPNG_ECTXTYPE; /* not supported */ + + if(ctx->data != NULL) return SPNG_EBUF_SET; + + ctx->data = buf; + ctx->png_base = buf; + ctx->data_size = size; + ctx->bytes_left = size; + + ctx->read_fn = buffer_read_fn; + + ctx->state = SPNG_STATE_INPUT; + + return 0; +} + +int spng_set_png_stream(spng_ctx *ctx, spng_rw_fn *rw_func, void *user) +{ + if(ctx == NULL || rw_func == NULL) return 1; + if(!ctx->state) return SPNG_EBADSTATE; + + /* SPNG_STATE_OUTPUT shares the same value */ + if(ctx->state >= SPNG_STATE_INPUT) return SPNG_EBUF_SET; + + if(ctx->encode_only) + { + if(ctx->out_png != NULL) return SPNG_EBUF_SET; + + ctx->write_fn = rw_func; + ctx->write_ptr = ctx->stream_buf; + + ctx->state = SPNG_STATE_OUTPUT; + } + else + { + ctx->stream_buf = spng__malloc(ctx, SPNG_READ_SIZE); + if(ctx->stream_buf == NULL) return SPNG_EMEM; + + ctx->read_fn = rw_func; + ctx->data = ctx->stream_buf; + ctx->data_size = SPNG_READ_SIZE; + + ctx->state = SPNG_STATE_INPUT; + } + + ctx->stream_user_ptr = user; + + ctx->streaming = 1; + + return 0; +} + +int spng_set_png_file(spng_ctx *ctx, FILE *file) +{ + if(file == NULL) return 1; + + if(ctx->encode_only) return spng_set_png_stream(ctx, file_write_fn, file); + + return spng_set_png_stream(ctx, file_read_fn, file); +} + +void *spng_get_png_buffer(spng_ctx *ctx, size_t *len, int *error) +{ + int tmp = 0; + error = error ? error : &tmp; + *error = 0; + + if(ctx == NULL || !len) *error = SPNG_EINVAL; + + if(*error) return NULL; + + if(!ctx->encode_only) *error = SPNG_ECTXTYPE; + else if(!ctx->state) *error = SPNG_EBADSTATE; + else if(!ctx->internal_buffer) *error = SPNG_EOPSTATE; + else if(ctx->state < SPNG_STATE_EOI) *error = SPNG_EOPSTATE; + else if(ctx->state != SPNG_STATE_IEND) *error = SPNG_ENOTFINAL; + + if(*error) return NULL; + + ctx->user_owns_out_png = 1; + + *len = ctx->bytes_encoded; + + return ctx->out_png; +} + +int spng_set_image_limits(spng_ctx *ctx, uint32_t width, uint32_t height) +{ + if(ctx == NULL) return 1; + + if(width > spng_u32max || height > spng_u32max) return 1; + + ctx->max_width = width; + ctx->max_height = height; + + return 0; +} + +int spng_get_image_limits(spng_ctx *ctx, uint32_t *width, uint32_t *height) +{ + if(ctx == NULL || width == NULL || height == NULL) return 1; + + *width = ctx->max_width; + *height = ctx->max_height; + + return 0; +} + +int spng_set_chunk_limits(spng_ctx *ctx, size_t chunk_size, size_t cache_limit) +{ + if(ctx == NULL || chunk_size > spng_u32max || chunk_size > cache_limit) return 1; + + ctx->max_chunk_size = chunk_size; + + ctx->chunk_cache_limit = cache_limit; + + return 0; +} + +int spng_get_chunk_limits(spng_ctx *ctx, size_t *chunk_size, size_t *cache_limit) +{ + if(ctx == NULL || chunk_size == NULL || cache_limit == NULL) return 1; + + *chunk_size = ctx->max_chunk_size; + + *cache_limit = ctx->chunk_cache_limit; + + return 0; +} + +int spng_set_crc_action(spng_ctx *ctx, int critical, int ancillary) +{ + if(ctx == NULL) return 1; + if(ctx->encode_only) return SPNG_ECTXTYPE; + + if(critical > 2 || critical < 0) return 1; + if(ancillary > 2 || ancillary < 0) return 1; + + if(critical == SPNG_CRC_DISCARD) return 1; + + ctx->crc_action_critical = critical; + ctx->crc_action_ancillary = ancillary; + + return 0; +} + +int spng_set_option(spng_ctx *ctx, enum spng_option option, int value) +{ + if(ctx == NULL) return 1; + if(!ctx->state) return SPNG_EBADSTATE; + + switch(option) + { + case SPNG_KEEP_UNKNOWN_CHUNKS: + { + ctx->keep_unknown = value ? 1 : 0; + break; + } + case SPNG_IMG_COMPRESSION_LEVEL: + { + ctx->image_options.compression_level = value; + break; + } + case SPNG_IMG_WINDOW_BITS: + { + ctx->image_options.window_bits = value; + break; + } + case SPNG_IMG_MEM_LEVEL: + { + ctx->image_options.mem_level = value; + break; + } + case SPNG_IMG_COMPRESSION_STRATEGY: + { + ctx->image_options.strategy = value; + break; + } + case SPNG_TEXT_COMPRESSION_LEVEL: + { + ctx->text_options.compression_level = value; + break; + } + case SPNG_TEXT_WINDOW_BITS: + { + ctx->text_options.window_bits = value; + break; + } + case SPNG_TEXT_MEM_LEVEL: + { + ctx->text_options.mem_level = value; + break; + } + case SPNG_TEXT_COMPRESSION_STRATEGY: + { + ctx->text_options.strategy = value; + break; + } + case SPNG_FILTER_CHOICE: + { + if(value & ~SPNG_FILTER_CHOICE_ALL) return 1; + ctx->encode_flags.filter_choice = value; + break; + } + case SPNG_CHUNK_COUNT_LIMIT: + { + if(value < 0) return 1; + if(value > (int)ctx->chunk_count_total) return 1; + ctx->chunk_count_limit = value; + break; + } + case SPNG_ENCODE_TO_BUFFER: + { + if(value < 0) return 1; + if(!ctx->encode_only) return SPNG_ECTXTYPE; + if(ctx->state >= SPNG_STATE_OUTPUT) return SPNG_EOPSTATE; + + if(!value) break; + + ctx->internal_buffer = 1; + ctx->state = SPNG_STATE_OUTPUT; + + break; + } + default: return 1; + } + + /* Option can no longer be overriden by the library */ + if(option < 32) ctx->optimize_option &= ~(1 << option); + + return 0; +} + +int spng_get_option(spng_ctx *ctx, enum spng_option option, int *value) +{ + if(ctx == NULL || value == NULL) return 1; + if(!ctx->state) return SPNG_EBADSTATE; + + switch(option) + { + case SPNG_KEEP_UNKNOWN_CHUNKS: + { + *value = ctx->keep_unknown; + break; + } + case SPNG_IMG_COMPRESSION_LEVEL: + { + *value = ctx->image_options.compression_level; + break; + } + case SPNG_IMG_WINDOW_BITS: + { + *value = ctx->image_options.window_bits; + break; + } + case SPNG_IMG_MEM_LEVEL: + { + *value = ctx->image_options.mem_level; + break; + } + case SPNG_IMG_COMPRESSION_STRATEGY: + { + *value = ctx->image_options.strategy; + break; + } + case SPNG_TEXT_COMPRESSION_LEVEL: + { + *value = ctx->text_options.compression_level; + break; + } + case SPNG_TEXT_WINDOW_BITS: + { + *value = ctx->text_options.window_bits; + break; + } + case SPNG_TEXT_MEM_LEVEL: + { + *value = ctx->text_options.mem_level; + break; + } + case SPNG_TEXT_COMPRESSION_STRATEGY: + { + *value = ctx->text_options.strategy; + break; + } + case SPNG_FILTER_CHOICE: + { + *value = ctx->encode_flags.filter_choice; + break; + } + case SPNG_CHUNK_COUNT_LIMIT: + { + *value = ctx->chunk_count_limit; + break; + } + case SPNG_ENCODE_TO_BUFFER: + { + if(ctx->internal_buffer) *value = 1; + else *value = 0; + + break; + } + default: return 1; + } + + return 0; +} + +int spng_decoded_image_size(spng_ctx *ctx, int fmt, size_t *len) +{ + if(ctx == NULL || len == NULL) return 1; + + int ret = read_chunks(ctx, 1); + if(ret) return ret; + + ret = check_decode_fmt(&ctx->ihdr, fmt); + if(ret) return ret; + + return calculate_image_size(&ctx->ihdr, fmt, len); +} + +int spng_get_ihdr(spng_ctx *ctx, struct spng_ihdr *ihdr) +{ + if(ctx == NULL) return 1; + int ret = read_chunks(ctx, 1); + if(ret) return ret; + if(ihdr == NULL) return 1; + + *ihdr = ctx->ihdr; + + return 0; +} + +int spng_get_plte(spng_ctx *ctx, struct spng_plte *plte) +{ + SPNG_GET_CHUNK_BOILERPLATE(plte); + + *plte = ctx->plte; + + return 0; +} + +int spng_get_trns(spng_ctx *ctx, struct spng_trns *trns) +{ + SPNG_GET_CHUNK_BOILERPLATE(trns); + + *trns = ctx->trns; + + return 0; +} + +int spng_get_chrm(spng_ctx *ctx, struct spng_chrm *chrm) +{ + SPNG_GET_CHUNK_BOILERPLATE(chrm); + + chrm->white_point_x = (double)ctx->chrm_int.white_point_x / 100000.0; + chrm->white_point_y = (double)ctx->chrm_int.white_point_y / 100000.0; + chrm->red_x = (double)ctx->chrm_int.red_x / 100000.0; + chrm->red_y = (double)ctx->chrm_int.red_y / 100000.0; + chrm->blue_y = (double)ctx->chrm_int.blue_y / 100000.0; + chrm->blue_x = (double)ctx->chrm_int.blue_x / 100000.0; + chrm->green_x = (double)ctx->chrm_int.green_x / 100000.0; + chrm->green_y = (double)ctx->chrm_int.green_y / 100000.0; + + return 0; +} + +int spng_get_chrm_int(spng_ctx *ctx, struct spng_chrm_int *chrm) +{ + SPNG_GET_CHUNK_BOILERPLATE(chrm); + + *chrm = ctx->chrm_int; + + return 0; +} + +int spng_get_gama(spng_ctx *ctx, double *gamma) +{ + double *gama = gamma; + SPNG_GET_CHUNK_BOILERPLATE(gama); + + *gama = (double)ctx->gama / 100000.0; + + return 0; +} + +int spng_get_gama_int(spng_ctx *ctx, uint32_t *gama_int) +{ + uint32_t *gama = gama_int; + SPNG_GET_CHUNK_BOILERPLATE(gama); + + *gama_int = ctx->gama; + + return 0; +} + +int spng_get_iccp(spng_ctx *ctx, struct spng_iccp *iccp) +{ + SPNG_GET_CHUNK_BOILERPLATE(iccp); + + *iccp = ctx->iccp; + + return 0; +} + +int spng_get_sbit(spng_ctx *ctx, struct spng_sbit *sbit) +{ + SPNG_GET_CHUNK_BOILERPLATE(sbit); + + *sbit = ctx->sbit; + + return 0; +} + +int spng_get_srgb(spng_ctx *ctx, uint8_t *rendering_intent) +{ + uint8_t *srgb = rendering_intent; + SPNG_GET_CHUNK_BOILERPLATE(srgb); + + *srgb = ctx->srgb_rendering_intent; + + return 0; +} + +int spng_get_text(spng_ctx *ctx, struct spng_text *text, uint32_t *n_text) +{ + if(ctx == NULL) return 1; + int ret = read_chunks(ctx, 0); + if(ret) return ret; + if(!ctx->stored.text) return SPNG_ECHUNKAVAIL; + if(n_text == NULL) return 1; + + if(text == NULL) + { + *n_text = ctx->n_text; + return 0; + } + + if(*n_text < ctx->n_text) return 1; + + uint32_t i; + for(i=0; i< ctx->n_text; i++) + { + text[i].type = ctx->text_list[i].type; + memcpy(&text[i].keyword, ctx->text_list[i].keyword, strlen(ctx->text_list[i].keyword) + 1); + text[i].compression_method = 0; + text[i].compression_flag = ctx->text_list[i].compression_flag; + text[i].language_tag = ctx->text_list[i].language_tag; + text[i].translated_keyword = ctx->text_list[i].translated_keyword; + text[i].length = ctx->text_list[i].text_length; + text[i].text = ctx->text_list[i].text; + } + + return ret; +} + +int spng_get_bkgd(spng_ctx *ctx, struct spng_bkgd *bkgd) +{ + SPNG_GET_CHUNK_BOILERPLATE(bkgd); + + *bkgd = ctx->bkgd; + + return 0; +} + +int spng_get_hist(spng_ctx *ctx, struct spng_hist *hist) +{ + SPNG_GET_CHUNK_BOILERPLATE(hist); + + *hist = ctx->hist; + + return 0; +} + +int spng_get_phys(spng_ctx *ctx, struct spng_phys *phys) +{ + SPNG_GET_CHUNK_BOILERPLATE(phys); + + *phys = ctx->phys; + + return 0; +} + +int spng_get_splt(spng_ctx *ctx, struct spng_splt *splt, uint32_t *n_splt) +{ + if(ctx == NULL) return 1; + int ret = read_chunks(ctx, 0); + if(ret) return ret; + if(!ctx->stored.splt) return SPNG_ECHUNKAVAIL; + if(n_splt == NULL) return 1; + + if(splt == NULL) + { + *n_splt = ctx->n_splt; + return 0; + } + + if(*n_splt < ctx->n_splt) return 1; + + memcpy(splt, ctx->splt_list, ctx->n_splt * sizeof(struct spng_splt)); + + return 0; +} + +int spng_get_time(spng_ctx *ctx, struct spng_time *time) +{ + SPNG_GET_CHUNK_BOILERPLATE(time); + + *time = ctx->time; + + return 0; +} + +int spng_get_unknown_chunks(spng_ctx *ctx, struct spng_unknown_chunk *chunks, uint32_t *n_chunks) +{ + if(ctx == NULL) return 1; + int ret = read_chunks(ctx, 0); + if(ret) return ret; + if(!ctx->stored.unknown) return SPNG_ECHUNKAVAIL; + if(n_chunks == NULL) return 1; + + if(chunks == NULL) + { + *n_chunks = ctx->n_chunks; + return 0; + } + + if(*n_chunks < ctx->n_chunks) return 1; + + memcpy(chunks, ctx->chunk_list, sizeof(struct spng_unknown_chunk)); + + return 0; +} + +int spng_get_offs(spng_ctx *ctx, struct spng_offs *offs) +{ + SPNG_GET_CHUNK_BOILERPLATE(offs); + + *offs = ctx->offs; + + return 0; +} + +int spng_get_exif(spng_ctx *ctx, struct spng_exif *exif) +{ + SPNG_GET_CHUNK_BOILERPLATE(exif); + + *exif = ctx->exif; + + return 0; +} + +int spng_set_ihdr(spng_ctx *ctx, struct spng_ihdr *ihdr) +{ + SPNG_SET_CHUNK_BOILERPLATE(ihdr); + + if(ctx->stored.ihdr) return 1; + + ret = check_ihdr(ihdr, ctx->max_width, ctx->max_height); + if(ret) return ret; + + ctx->ihdr = *ihdr; + + ctx->stored.ihdr = 1; + ctx->user.ihdr = 1; + + return 0; +} + +int spng_set_plte(spng_ctx *ctx, struct spng_plte *plte) +{ + SPNG_SET_CHUNK_BOILERPLATE(plte); + + if(!ctx->stored.ihdr) return 1; + + if(check_plte(plte, &ctx->ihdr)) return 1; + + ctx->plte.n_entries = plte->n_entries; + + memcpy(ctx->plte.entries, plte->entries, plte->n_entries * sizeof(struct spng_plte_entry)); + + ctx->stored.plte = 1; + ctx->user.plte = 1; + + return 0; +} + +int spng_set_trns(spng_ctx *ctx, struct spng_trns *trns) +{ + SPNG_SET_CHUNK_BOILERPLATE(trns); + + if(!ctx->stored.ihdr) return SPNG_ENOIHDR; + + if(ctx->ihdr.color_type == SPNG_COLOR_TYPE_GRAYSCALE) + { + ctx->trns.gray = trns->gray; + } + else if(ctx->ihdr.color_type == SPNG_COLOR_TYPE_TRUECOLOR) + { + ctx->trns.red = trns->red; + ctx->trns.green = trns->green; + ctx->trns.blue = trns->blue; + } + else if(ctx->ihdr.color_type == SPNG_COLOR_TYPE_INDEXED) + { + if(!ctx->stored.plte) return SPNG_ETRNS_NO_PLTE; + if(trns->n_type3_entries > ctx->plte.n_entries) return 1; + + ctx->trns.n_type3_entries = trns->n_type3_entries; + memcpy(ctx->trns.type3_alpha, trns->type3_alpha, trns->n_type3_entries); + } + else return SPNG_ETRNS_COLOR_TYPE; + + ctx->stored.trns = 1; + ctx->user.trns = 1; + + return 0; +} + +int spng_set_chrm(spng_ctx *ctx, struct spng_chrm *chrm) +{ + SPNG_SET_CHUNK_BOILERPLATE(chrm); + + struct spng_chrm_int chrm_int; + + chrm_int.white_point_x = (uint32_t)(chrm->white_point_x * 100000.0); + chrm_int.white_point_y = (uint32_t)(chrm->white_point_y * 100000.0); + chrm_int.red_x = (uint32_t)(chrm->red_x * 100000.0); + chrm_int.red_y = (uint32_t)(chrm->red_y * 100000.0); + chrm_int.green_x = (uint32_t)(chrm->green_x * 100000.0); + chrm_int.green_y = (uint32_t)(chrm->green_y * 100000.0); + chrm_int.blue_x = (uint32_t)(chrm->blue_x * 100000.0); + chrm_int.blue_y = (uint32_t)(chrm->blue_y * 100000.0); + + if(check_chrm_int(&chrm_int)) return SPNG_ECHRM; + + ctx->chrm_int = chrm_int; + + ctx->stored.chrm = 1; + ctx->user.chrm = 1; + + return 0; +} + +int spng_set_chrm_int(spng_ctx *ctx, struct spng_chrm_int *chrm_int) +{ + SPNG_SET_CHUNK_BOILERPLATE(chrm_int); + + if(check_chrm_int(chrm_int)) return SPNG_ECHRM; + + ctx->chrm_int = *chrm_int; + + ctx->stored.chrm = 1; + ctx->user.chrm = 1; + + return 0; +} + +int spng_set_gama(spng_ctx *ctx, double gamma) +{ + SPNG_SET_CHUNK_BOILERPLATE(ctx); + + uint32_t gama = gamma * 100000.0; + + if(!gama) return 1; + if(gama > spng_u32max) return 1; + + ctx->gama = gama; + + ctx->stored.gama = 1; + ctx->user.gama = 1; + + return 0; +} + +int spng_set_gama_int(spng_ctx *ctx, uint32_t gamma) +{ + SPNG_SET_CHUNK_BOILERPLATE(ctx); + + if(!gamma) return 1; + if(gamma > spng_u32max) return 1; + + ctx->gama = gamma; + + ctx->stored.gama = 1; + ctx->user.gama = 1; + + return 0; +} + +int spng_set_iccp(spng_ctx *ctx, struct spng_iccp *iccp) +{ + SPNG_SET_CHUNK_BOILERPLATE(iccp); + + if(check_png_keyword(iccp->profile_name)) return SPNG_EICCP_NAME; + if(!iccp->profile_len) return SPNG_ECHUNK_SIZE; + if(iccp->profile_len > spng_u32max) return SPNG_ECHUNK_STDLEN; + + if(ctx->iccp.profile && !ctx->user.iccp) spng__free(ctx, ctx->iccp.profile); + + ctx->iccp = *iccp; + + ctx->stored.iccp = 1; + ctx->user.iccp = 1; + + return 0; +} + +int spng_set_sbit(spng_ctx *ctx, struct spng_sbit *sbit) +{ + SPNG_SET_CHUNK_BOILERPLATE(sbit); + + if(check_sbit(sbit, &ctx->ihdr)) return 1; + + if(!ctx->stored.ihdr) return 1; + + ctx->sbit = *sbit; + + ctx->stored.sbit = 1; + ctx->user.sbit = 1; + + return 0; +} + +int spng_set_srgb(spng_ctx *ctx, uint8_t rendering_intent) +{ + SPNG_SET_CHUNK_BOILERPLATE(ctx); + + if(rendering_intent > 3) return 1; + + ctx->srgb_rendering_intent = rendering_intent; + + ctx->stored.srgb = 1; + ctx->user.srgb = 1; + + return 0; +} + +int spng_set_text(spng_ctx *ctx, struct spng_text *text, uint32_t n_text) +{ + if(!n_text) return 1; + SPNG_SET_CHUNK_BOILERPLATE(text); + + uint32_t i; + for(i=0; i < n_text; i++) + { + if(check_png_keyword(text[i].keyword)) return SPNG_ETEXT_KEYWORD; + if(!text[i].length) return 1; + if(text[i].length > UINT_MAX) return 1; + if(text[i].text == NULL) return 1; + + if(text[i].type == SPNG_TEXT) + { + if(ctx->strict && check_png_text(text[i].text, text[i].length)) return 1; + } + else if(text[i].type == SPNG_ZTXT) + { + if(ctx->strict && check_png_text(text[i].text, text[i].length)) return 1; + + if(text[i].compression_method != 0) return SPNG_EZTXT_COMPRESSION_METHOD; + } + else if(text[i].type == SPNG_ITXT) + { + if(text[i].compression_flag > 1) return SPNG_EITXT_COMPRESSION_FLAG; + if(text[i].compression_method != 0) return SPNG_EITXT_COMPRESSION_METHOD; + if(text[i].language_tag == NULL) return SPNG_EITXT_LANG_TAG; + if(text[i].translated_keyword == NULL) return SPNG_EITXT_TRANSLATED_KEY; + } + else return 1; + + } + + struct spng_text2 *text_list = spng__calloc(ctx, sizeof(struct spng_text2), n_text); + + if(!text_list) return SPNG_EMEM; + + if(ctx->text_list != NULL) + { + for(i=0; i < ctx->n_text; i++) + { + if(ctx->user.text) break; + + spng__free(ctx, ctx->text_list[i].keyword); + if(ctx->text_list[i].compression_flag) spng__free(ctx, ctx->text_list[i].text); + } + spng__free(ctx, ctx->text_list); + } + + for(i=0; i < n_text; i++) + { + text_list[i].type = text[i].type; + /* Prevent issues with spng_text.keyword[80] going out of scope */ + text_list[i].keyword = text_list[i].user_keyword_storage; + memcpy(text_list[i].user_keyword_storage, text[i].keyword, strlen(text[i].keyword)); + text_list[i].text = text[i].text; + text_list[i].text_length = text[i].length; + + if(text[i].type == SPNG_ZTXT) + { + text_list[i].compression_flag = 1; + } + else if(text[i].type == SPNG_ITXT) + { + text_list[i].compression_flag = text[i].compression_flag; + text_list[i].language_tag = text[i].language_tag; + text_list[i].translated_keyword = text[i].translated_keyword; + } + } + + ctx->text_list = text_list; + ctx->n_text = n_text; + + ctx->stored.text = 1; + ctx->user.text = 1; + + return 0; +} + +int spng_set_bkgd(spng_ctx *ctx, struct spng_bkgd *bkgd) +{ + SPNG_SET_CHUNK_BOILERPLATE(bkgd); + + if(!ctx->stored.ihdr) return 1; + + if(ctx->ihdr.color_type == 0 || ctx->ihdr.color_type == 4) + { + ctx->bkgd.gray = bkgd->gray; + } + else if(ctx->ihdr.color_type == 2 || ctx->ihdr.color_type == 6) + { + ctx->bkgd.red = bkgd->red; + ctx->bkgd.green = bkgd->green; + ctx->bkgd.blue = bkgd->blue; + } + else if(ctx->ihdr.color_type == 3) + { + if(!ctx->stored.plte) return SPNG_EBKGD_NO_PLTE; + if(bkgd->plte_index >= ctx->plte.n_entries) return SPNG_EBKGD_PLTE_IDX; + + ctx->bkgd.plte_index = bkgd->plte_index; + } + + ctx->stored.bkgd = 1; + ctx->user.bkgd = 1; + + return 0; +} + +int spng_set_hist(spng_ctx *ctx, struct spng_hist *hist) +{ + SPNG_SET_CHUNK_BOILERPLATE(hist); + + if(!ctx->stored.plte) return SPNG_EHIST_NO_PLTE; + + ctx->hist = *hist; + + ctx->stored.hist = 1; + ctx->user.hist = 1; + + return 0; +} + +int spng_set_phys(spng_ctx *ctx, struct spng_phys *phys) +{ + SPNG_SET_CHUNK_BOILERPLATE(phys); + + if(check_phys(phys)) return SPNG_EPHYS; + + ctx->phys = *phys; + + ctx->stored.phys = 1; + ctx->user.phys = 1; + + return 0; +} + +int spng_set_splt(spng_ctx *ctx, struct spng_splt *splt, uint32_t n_splt) +{ + if(!n_splt) return 1; + SPNG_SET_CHUNK_BOILERPLATE(splt); + + uint32_t i; + for(i=0; i < n_splt; i++) + { + if(check_png_keyword(splt[i].name)) return SPNG_ESPLT_NAME; + if( !(splt[i].sample_depth == 8 || splt[i].sample_depth == 16) ) return SPNG_ESPLT_DEPTH; + } + + if(ctx->stored.splt && !ctx->user.splt) + { + for(i=0; i < ctx->n_splt; i++) + { + if(ctx->splt_list[i].entries != NULL) spng__free(ctx, ctx->splt_list[i].entries); + } + spng__free(ctx, ctx->splt_list); + } + + ctx->splt_list = splt; + ctx->n_splt = n_splt; + + ctx->stored.splt = 1; + ctx->user.splt = 1; + + return 0; +} + +int spng_set_time(spng_ctx *ctx, struct spng_time *time) +{ + SPNG_SET_CHUNK_BOILERPLATE(time); + + if(check_time(time)) return SPNG_ETIME; + + ctx->time = *time; + + ctx->stored.time = 1; + ctx->user.time = 1; + + return 0; +} + +int spng_set_unknown_chunks(spng_ctx *ctx, struct spng_unknown_chunk *chunks, uint32_t n_chunks) +{ + if(!n_chunks) return 1; + SPNG_SET_CHUNK_BOILERPLATE(chunks); + + uint32_t i; + for(i=0; i < n_chunks; i++) + { + if(chunks[i].length > spng_u32max) return SPNG_ECHUNK_STDLEN; + if(chunks[i].length && chunks[i].data == NULL) return 1; + + switch(chunks[i].location) + { + case SPNG_AFTER_IHDR: + case SPNG_AFTER_PLTE: + case SPNG_AFTER_IDAT: + break; + default: return SPNG_ECHUNK_POS; + } + } + + if(ctx->stored.unknown && !ctx->user.unknown) + { + for(i=0; i < ctx->n_chunks; i++) + { + spng__free(ctx, ctx->chunk_list[i].data); + } + spng__free(ctx, ctx->chunk_list); + } + + ctx->chunk_list = chunks; + ctx->n_chunks = n_chunks; + + ctx->stored.unknown = 1; + ctx->user.unknown = 1; + + return 0; +} + +int spng_set_offs(spng_ctx *ctx, struct spng_offs *offs) +{ + SPNG_SET_CHUNK_BOILERPLATE(offs); + + if(check_offs(offs)) return SPNG_EOFFS; + + ctx->offs = *offs; + + ctx->stored.offs = 1; + ctx->user.offs = 1; + + return 0; +} + +int spng_set_exif(spng_ctx *ctx, struct spng_exif *exif) +{ + SPNG_SET_CHUNK_BOILERPLATE(exif); + + if(check_exif(exif)) return SPNG_EEXIF; + + if(ctx->exif.data != NULL && !ctx->user.exif) spng__free(ctx, ctx->exif.data); + + ctx->exif = *exif; + + ctx->stored.exif = 1; + ctx->user.exif = 1; + + return 0; +} + +const char *spng_strerror(int err) +{ + switch(err) + { + case SPNG_IO_EOF: return "end of stream"; + case SPNG_IO_ERROR: return "stream error"; + case SPNG_OK: return "success"; + case SPNG_EINVAL: return "invalid argument"; + case SPNG_EMEM: return "out of memory"; + case SPNG_EOVERFLOW: return "arithmetic overflow"; + case SPNG_ESIGNATURE: return "invalid signature"; + case SPNG_EWIDTH: return "invalid image width"; + case SPNG_EHEIGHT: return "invalid image height"; + case SPNG_EUSER_WIDTH: return "image width exceeds user limit"; + case SPNG_EUSER_HEIGHT: return "image height exceeds user limit"; + case SPNG_EBIT_DEPTH: return "invalid bit depth"; + case SPNG_ECOLOR_TYPE: return "invalid color type"; + case SPNG_ECOMPRESSION_METHOD: return "invalid compression method"; + case SPNG_EFILTER_METHOD: return "invalid filter method"; + case SPNG_EINTERLACE_METHOD: return "invalid interlace method"; + case SPNG_EIHDR_SIZE: return "invalid IHDR chunk size"; + case SPNG_ENOIHDR: return "missing IHDR chunk"; + case SPNG_ECHUNK_POS: return "invalid chunk position"; + case SPNG_ECHUNK_SIZE: return "invalid chunk length"; + case SPNG_ECHUNK_CRC: return "invalid chunk checksum"; + case SPNG_ECHUNK_TYPE: return "invalid chunk type"; + case SPNG_ECHUNK_UNKNOWN_CRITICAL: return "unknown critical chunk"; + case SPNG_EDUP_PLTE: return "duplicate PLTE chunk"; + case SPNG_EDUP_CHRM: return "duplicate cHRM chunk"; + case SPNG_EDUP_GAMA: return "duplicate gAMA chunk"; + case SPNG_EDUP_ICCP: return "duplicate iCCP chunk"; + case SPNG_EDUP_SBIT: return "duplicate sBIT chunk"; + case SPNG_EDUP_SRGB: return "duplicate sRGB chunk"; + case SPNG_EDUP_BKGD: return "duplicate bKGD chunk"; + case SPNG_EDUP_HIST: return "duplicate hIST chunk"; + case SPNG_EDUP_TRNS: return "duplicate tRNS chunk"; + case SPNG_EDUP_PHYS: return "duplicate pHYs chunk"; + case SPNG_EDUP_TIME: return "duplicate tIME chunk"; + case SPNG_EDUP_OFFS: return "duplicate oFFs chunk"; + case SPNG_EDUP_EXIF: return "duplicate eXIf chunk"; + case SPNG_ECHRM: return "invalid cHRM chunk"; + case SPNG_EPLTE_IDX: return "invalid palette (PLTE) index"; + case SPNG_ETRNS_COLOR_TYPE: return "tRNS chunk with incompatible color type"; + case SPNG_ETRNS_NO_PLTE: return "missing palette (PLTE) for tRNS chunk"; + case SPNG_EGAMA: return "invalid gAMA chunk"; + case SPNG_EICCP_NAME: return "invalid iCCP profile name"; + case SPNG_EICCP_COMPRESSION_METHOD: return "invalid iCCP compression method"; + case SPNG_ESBIT: return "invalid sBIT chunk"; + case SPNG_ESRGB: return "invalid sRGB chunk"; + case SPNG_ETEXT: return "invalid tEXt chunk"; + case SPNG_ETEXT_KEYWORD: return "invalid tEXt keyword"; + case SPNG_EZTXT: return "invalid zTXt chunk"; + case SPNG_EZTXT_COMPRESSION_METHOD: return "invalid zTXt compression method"; + case SPNG_EITXT: return "invalid iTXt chunk"; + case SPNG_EITXT_COMPRESSION_FLAG: return "invalid iTXt compression flag"; + case SPNG_EITXT_COMPRESSION_METHOD: return "invalid iTXt compression method"; + case SPNG_EITXT_LANG_TAG: return "invalid iTXt language tag"; + case SPNG_EITXT_TRANSLATED_KEY: return "invalid iTXt translated key"; + case SPNG_EBKGD_NO_PLTE: return "missing palette for bKGD chunk"; + case SPNG_EBKGD_PLTE_IDX: return "invalid palette index for bKGD chunk"; + case SPNG_EHIST_NO_PLTE: return "missing palette for hIST chunk"; + case SPNG_EPHYS: return "invalid pHYs chunk"; + case SPNG_ESPLT_NAME: return "invalid suggested palette name"; + case SPNG_ESPLT_DUP_NAME: return "duplicate suggested palette (sPLT) name"; + case SPNG_ESPLT_DEPTH: return "invalid suggested palette (sPLT) sample depth"; + case SPNG_ETIME: return "invalid tIME chunk"; + case SPNG_EOFFS: return "invalid oFFs chunk"; + case SPNG_EEXIF: return "invalid eXIf chunk"; + case SPNG_EIDAT_TOO_SHORT: return "IDAT stream too short"; + case SPNG_EIDAT_STREAM: return "IDAT stream error"; + case SPNG_EZLIB: return "zlib error"; + case SPNG_EFILTER: return "invalid scanline filter"; + case SPNG_EBUFSIZ: return "invalid buffer size"; + case SPNG_EIO: return "i/o error"; + case SPNG_EOF: return "end of file"; + case SPNG_EBUF_SET: return "buffer already set"; + case SPNG_EBADSTATE: return "non-recoverable state"; + case SPNG_EFMT: return "invalid format"; + case SPNG_EFLAGS: return "invalid flags"; + case SPNG_ECHUNKAVAIL: return "chunk not available"; + case SPNG_ENCODE_ONLY: return "encode only context"; + case SPNG_EOI: return "reached end-of-image state"; + case SPNG_ENOPLTE: return "missing PLTE for indexed image"; + case SPNG_ECHUNK_LIMITS: return "reached chunk/cache limits"; + case SPNG_EZLIB_INIT: return "zlib init error"; + case SPNG_ECHUNK_STDLEN: return "chunk exceeds maximum standard length"; + case SPNG_EINTERNAL: return "internal error"; + case SPNG_ECTXTYPE: return "invalid operation for context type"; + case SPNG_ENOSRC: return "source PNG not set"; + case SPNG_ENODST: return "PNG output not set"; + case SPNG_EOPSTATE: return "invalid operation for state"; + case SPNG_ENOTFINAL: return "PNG not finalized"; + default: return "unknown error"; + } +} + +const char *spng_version_string(void) +{ + return SPNG_VERSION_STRING; +} + +#if defined(_MSC_VER) + #pragma warning(pop) +#endif + +/* The following SIMD optimizations are derived from libpng source code. */ + +/* +* PNG Reference Library License version 2 +* +* Copyright (c) 1995-2019 The PNG Reference Library Authors. +* Copyright (c) 2018-2019 Cosmin Truta. +* Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson. +* Copyright (c) 1996-1997 Andreas Dilger. +* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. +* +* The software is supplied "as is", without warranty of any kind, +* express or implied, including, without limitation, the warranties +* of merchantability, fitness for a particular purpose, title, and +* non-infringement. In no event shall the Copyright owners, or +* anyone distributing the software, be liable for any damages or +* other liability, whether in contract, tort or otherwise, arising +* from, out of, or in connection with the software, or the use or +* other dealings in the software, even if advised of the possibility +* of such damage. +* +* Permission is hereby granted to use, copy, modify, and distribute +* this software, or portions hereof, for any purpose, without fee, +* subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; you +* must not claim that you wrote the original software. If you +* use this software in a product, an acknowledgment in the product +* documentation would be appreciated, but is not required. +* +* 2. Altered source versions must be plainly marked as such, and must +* not be misrepresented as being the original software. +* +* 3. This Copyright notice may not be removed or altered from any +* source or altered source distribution. +*/ + +#if defined(SPNG_X86) + +#ifndef SPNG_SSE + #define SPNG_SSE 1 +#endif + +#if defined(__GNUC__) && !defined(__clang__) + #if SPNG_SSE == 3 + #pragma GCC target("ssse3") + #elif SPNG_SSE == 4 + #pragma GCC target("sse4.1") + #else + #pragma GCC target("sse2") + #endif +#endif + +/* SSE2 optimised filter functions + * Derived from filter_neon_intrinsics.c + * + * Copyright (c) 2018 Cosmin Truta + * Copyright (c) 2016-2017 Glenn Randers-Pehrson + * Written by Mike Klein and Matt Sarett + * Derived from arm/filter_neon_intrinsics.c + * + * This code is derived from libpng source code. + * For conditions of distribution and use, see the disclaimer + * and license above. + */ + +#include +#include +#include + +/* Functions in this file look at most 3 pixels (a,b,c) to predict the 4th (d). + * They're positioned like this: + * prev: c b + * row: a d + * The Sub filter predicts d=a, Avg d=(a+b)/2, and Paeth predicts d to be + * whichever of a, b, or c is closest to p=a+b-c. + */ + +static __m128i load4(const void* p) +{ + int tmp; + memcpy(&tmp, p, sizeof(tmp)); + return _mm_cvtsi32_si128(tmp); +} + +static void store4(void* p, __m128i v) +{ + int tmp = _mm_cvtsi128_si32(v); + memcpy(p, &tmp, sizeof(int)); +} + +static __m128i load3(const void* p) +{ + uint32_t tmp = 0; + memcpy(&tmp, p, 3); + return _mm_cvtsi32_si128(tmp); +} + +static void store3(void* p, __m128i v) +{ + int tmp = _mm_cvtsi128_si32(v); + memcpy(p, &tmp, 3); +} + +static void defilter_sub3(size_t rowbytes, unsigned char *row) +{ + /* The Sub filter predicts each pixel as the previous pixel, a. + * There is no pixel to the left of the first pixel. It's encoded directly. + * That works with our main loop if we just say that left pixel was zero. + */ + size_t rb = rowbytes; + + __m128i a, d = _mm_setzero_si128(); + + while(rb >= 4) + { + a = d; d = load4(row); + d = _mm_add_epi8(d, a); + store3(row, d); + + row += 3; + rb -= 3; + } + + if(rb > 0) + { + a = d; d = load3(row); + d = _mm_add_epi8(d, a); + store3(row, d); + } +} + +static void defilter_sub4(size_t rowbytes, unsigned char *row) +{ + /* The Sub filter predicts each pixel as the previous pixel, a. + * There is no pixel to the left of the first pixel. It's encoded directly. + * That works with our main loop if we just say that left pixel was zero. + */ + size_t rb = rowbytes+4; + + __m128i a, d = _mm_setzero_si128(); + + while(rb > 4) + { + a = d; d = load4(row); + d = _mm_add_epi8(d, a); + store4(row, d); + + row += 4; + rb -= 4; + } +} + +static void defilter_avg3(size_t rowbytes, unsigned char *row, const unsigned char *prev) +{ + /* The Avg filter predicts each pixel as the (truncated) average of a and b. + * There's no pixel to the left of the first pixel. Luckily, it's + * predicted to be half of the pixel above it. So again, this works + * perfectly with our loop if we make sure a starts at zero. + */ + + size_t rb = rowbytes; + + const __m128i zero = _mm_setzero_si128(); + + __m128i b; + __m128i a, d = zero; + + while(rb >= 4) + { + __m128i avg; + b = load4(prev); + a = d; d = load4(row ); + + /* PNG requires a truncating average, so we can't just use _mm_avg_epu8 */ + avg = _mm_avg_epu8(a,b); + /* ...but we can fix it up by subtracting off 1 if it rounded up. */ + avg = _mm_sub_epi8(avg, _mm_and_si128(_mm_xor_si128(a, b), + _mm_set1_epi8(1))); + d = _mm_add_epi8(d, avg); + store3(row, d); + + prev += 3; + row += 3; + rb -= 3; + } + + if(rb > 0) + { + __m128i avg; + b = load3(prev); + a = d; d = load3(row ); + + /* PNG requires a truncating average, so we can't just use _mm_avg_epu8 */ + avg = _mm_avg_epu8(a, b); + /* ...but we can fix it up by subtracting off 1 if it rounded up. */ + avg = _mm_sub_epi8(avg, _mm_and_si128(_mm_xor_si128(a, b), + _mm_set1_epi8(1))); + + d = _mm_add_epi8(d, avg); + store3(row, d); + } +} + +static void defilter_avg4(size_t rowbytes, unsigned char *row, const unsigned char *prev) +{ + /* The Avg filter predicts each pixel as the (truncated) average of a and b. + * There's no pixel to the left of the first pixel. Luckily, it's + * predicted to be half of the pixel above it. So again, this works + * perfectly with our loop if we make sure a starts at zero. + */ + size_t rb = rowbytes+4; + + const __m128i zero = _mm_setzero_si128(); + __m128i b; + __m128i a, d = zero; + + while(rb > 4) + { + __m128i avg; + b = load4(prev); + a = d; d = load4(row ); + + /* PNG requires a truncating average, so we can't just use _mm_avg_epu8 */ + avg = _mm_avg_epu8(a,b); + /* ...but we can fix it up by subtracting off 1 if it rounded up. */ + avg = _mm_sub_epi8(avg, _mm_and_si128(_mm_xor_si128(a, b), + _mm_set1_epi8(1))); + + d = _mm_add_epi8(d, avg); + store4(row, d); + + prev += 4; + row += 4; + rb -= 4; + } +} + +/* Returns |x| for 16-bit lanes. */ +#if (SPNG_SSE >= 3) && !defined(_MSC_VER) +__attribute__((target("ssse3"))) +#endif +static __m128i abs_i16(__m128i x) +{ +#if SPNG_SSE >= 3 + return _mm_abs_epi16(x); +#else + /* Read this all as, return x<0 ? -x : x. + * To negate two's complement, you flip all the bits then add 1. + */ + __m128i is_negative = _mm_cmplt_epi16(x, _mm_setzero_si128()); + + /* Flip negative lanes. */ + x = _mm_xor_si128(x, is_negative); + + /* +1 to negative lanes, else +0. */ + x = _mm_sub_epi16(x, is_negative); + return x; +#endif +} + +/* Bytewise c ? t : e. */ +static __m128i if_then_else(__m128i c, __m128i t, __m128i e) +{ +#if SPNG_SSE >= 4 + return _mm_blendv_epi8(e, t, c); +#else + return _mm_or_si128(_mm_and_si128(c, t), _mm_andnot_si128(c, e)); +#endif +} + +static void defilter_paeth3(size_t rowbytes, unsigned char *row, const unsigned char *prev) +{ + /* Paeth tries to predict pixel d using the pixel to the left of it, a, + * and two pixels from the previous row, b and c: + * prev: c b + * row: a d + * The Paeth function predicts d to be whichever of a, b, or c is nearest to + * p=a+b-c. + * + * The first pixel has no left context, and so uses an Up filter, p = b. + * This works naturally with our main loop's p = a+b-c if we force a and c + * to zero. + * Here we zero b and d, which become c and a respectively at the start of + * the loop. + */ + size_t rb = rowbytes; + const __m128i zero = _mm_setzero_si128(); + __m128i c, b = zero, + a, d = zero; + + while(rb >= 4) + { + /* It's easiest to do this math (particularly, deal with pc) with 16-bit + * intermediates. + */ + __m128i pa,pb,pc,smallest,nearest; + c = b; b = _mm_unpacklo_epi8(load4(prev), zero); + a = d; d = _mm_unpacklo_epi8(load4(row ), zero); + + /* (p-a) == (a+b-c - a) == (b-c) */ + + pa = _mm_sub_epi16(b, c); + + /* (p-b) == (a+b-c - b) == (a-c) */ + pb = _mm_sub_epi16(a, c); + + /* (p-c) == (a+b-c - c) == (a+b-c-c) == (b-c)+(a-c) */ + pc = _mm_add_epi16(pa, pb); + + pa = abs_i16(pa); /* |p-a| */ + pb = abs_i16(pb); /* |p-b| */ + pc = abs_i16(pc); /* |p-c| */ + + smallest = _mm_min_epi16(pc, _mm_min_epi16(pa, pb)); + + /* Paeth breaks ties favoring a over b over c. */ + nearest = if_then_else(_mm_cmpeq_epi16(smallest, pa), a, + if_then_else(_mm_cmpeq_epi16(smallest, pb), b, c)); + + /* Note `_epi8`: we need addition to wrap modulo 255. */ + d = _mm_add_epi8(d, nearest); + store3(row, _mm_packus_epi16(d, d)); + + prev += 3; + row += 3; + rb -= 3; + } + + if(rb > 0) + { + /* It's easiest to do this math (particularly, deal with pc) with 16-bit + * intermediates. + */ + __m128i pa, pb, pc, smallest, nearest; + c = b; b = _mm_unpacklo_epi8(load3(prev), zero); + a = d; d = _mm_unpacklo_epi8(load3(row ), zero); + + /* (p-a) == (a+b-c - a) == (b-c) */ + pa = _mm_sub_epi16(b, c); + + /* (p-b) == (a+b-c - b) == (a-c) */ + pb = _mm_sub_epi16(a, c); + + /* (p-c) == (a+b-c - c) == (a+b-c-c) == (b-c)+(a-c) */ + pc = _mm_add_epi16(pa, pb); + + pa = abs_i16(pa); /* |p-a| */ + pb = abs_i16(pb); /* |p-b| */ + pc = abs_i16(pc); /* |p-c| */ + + smallest = _mm_min_epi16(pc, _mm_min_epi16(pa, pb)); + + /* Paeth breaks ties favoring a over b over c. */ + nearest = if_then_else(_mm_cmpeq_epi16(smallest, pa), a, + if_then_else(_mm_cmpeq_epi16(smallest, pb), b, c)); + + /* Note `_epi8`: we need addition to wrap modulo 255. */ + d = _mm_add_epi8(d, nearest); + store3(row, _mm_packus_epi16(d, d)); + } +} + +static void defilter_paeth4(size_t rowbytes, unsigned char *row, const unsigned char *prev) +{ + /* Paeth tries to predict pixel d using the pixel to the left of it, a, + * and two pixels from the previous row, b and c: + * prev: c b + * row: a d + * The Paeth function predicts d to be whichever of a, b, or c is nearest to + * p=a+b-c. + * + * The first pixel has no left context, and so uses an Up filter, p = b. + * This works naturally with our main loop's p = a+b-c if we force a and c + * to zero. + * Here we zero b and d, which become c and a respectively at the start of + * the loop. + */ + size_t rb = rowbytes+4; + + const __m128i zero = _mm_setzero_si128(); + __m128i pa, pb, pc, smallest, nearest; + __m128i c, b = zero, + a, d = zero; + + while(rb > 4) + { + /* It's easiest to do this math (particularly, deal with pc) with 16-bit + * intermediates. + */ + c = b; b = _mm_unpacklo_epi8(load4(prev), zero); + a = d; d = _mm_unpacklo_epi8(load4(row ), zero); + + /* (p-a) == (a+b-c - a) == (b-c) */ + pa = _mm_sub_epi16(b, c); + + /* (p-b) == (a+b-c - b) == (a-c) */ + pb = _mm_sub_epi16(a, c); + + /* (p-c) == (a+b-c - c) == (a+b-c-c) == (b-c)+(a-c) */ + pc = _mm_add_epi16(pa, pb); + + pa = abs_i16(pa); /* |p-a| */ + pb = abs_i16(pb); /* |p-b| */ + pc = abs_i16(pc); /* |p-c| */ + + smallest = _mm_min_epi16(pc, _mm_min_epi16(pa, pb)); + + /* Paeth breaks ties favoring a over b over c. */ + nearest = if_then_else(_mm_cmpeq_epi16(smallest, pa), a, + if_then_else(_mm_cmpeq_epi16(smallest, pb), b, c)); + + /* Note `_epi8`: we need addition to wrap modulo 255. */ + d = _mm_add_epi8(d, nearest); + store4(row, _mm_packus_epi16(d, d)); + + prev += 4; + row += 4; + rb -= 4; + } +} + +#endif /* SPNG_X86 */ + + +#if defined(SPNG_ARM) + +/* NEON optimised filter functions + * Derived from filter_neon_intrinsics.c + * + * Copyright (c) 2018 Cosmin Truta + * Copyright (c) 2014,2016 Glenn Randers-Pehrson + * Written by James Yu , October 2013. + * Based on filter_neon.S, written by Mans Rullgard, 2011. + * + * This code is derived from libpng source code. + * For conditions of distribution and use, see the disclaimer + * and license in this file. + */ + +#define png_aligncast(type, value) ((void*)(value)) +#define png_aligncastconst(type, value) ((const void*)(value)) + +/* libpng row pointers are not necessarily aligned to any particular boundary, + * however this code will only work with appropriate alignment. mips/mips_init.c + * checks for this (and will not compile unless it is done). This code uses + * variants of png_aligncast to avoid compiler warnings. + */ +#define png_ptr(type,pointer) png_aligncast(type *,pointer) +#define png_ptrc(type,pointer) png_aligncastconst(const type *,pointer) + +/* The following relies on a variable 'temp_pointer' being declared with type + * 'type'. This is written this way just to hide the GCC strict aliasing + * warning; note that the code is safe because there never is an alias between + * the input and output pointers. + */ +#define png_ldr(type,pointer)\ + (temp_pointer = png_ptr(type,pointer), *temp_pointer) + + +#if defined(_MSC_VER) && !defined(__clang__) && defined(_M_ARM64) + #include +#else + #include +#endif + +static void defilter_sub3(size_t rowbytes, unsigned char *row) +{ + unsigned char *rp = row; + unsigned char *rp_stop = row + rowbytes; + + uint8x16_t vtmp = vld1q_u8(rp); + uint8x8x2_t *vrpt = png_ptr(uint8x8x2_t, &vtmp); + uint8x8x2_t vrp = *vrpt; + + uint8x8x4_t vdest; + vdest.val[3] = vdup_n_u8(0); + + for (; rp < rp_stop;) + { + uint8x8_t vtmp1, vtmp2; + uint32x2_t *temp_pointer; + + vtmp1 = vext_u8(vrp.val[0], vrp.val[1], 3); + vdest.val[0] = vadd_u8(vdest.val[3], vrp.val[0]); + vtmp2 = vext_u8(vrp.val[0], vrp.val[1], 6); + vdest.val[1] = vadd_u8(vdest.val[0], vtmp1); + + vtmp1 = vext_u8(vrp.val[1], vrp.val[1], 1); + vdest.val[2] = vadd_u8(vdest.val[1], vtmp2); + vdest.val[3] = vadd_u8(vdest.val[2], vtmp1); + + vtmp = vld1q_u8(rp + 12); + vrpt = png_ptr(uint8x8x2_t, &vtmp); + vrp = *vrpt; + + vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[0]), 0); + rp += 3; + vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[1]), 0); + rp += 3; + vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[2]), 0); + rp += 3; + vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[3]), 0); + rp += 3; + } +} + +static void defilter_sub4(size_t rowbytes, unsigned char *row) +{ + unsigned char *rp = row; + unsigned char *rp_stop = row + rowbytes; + + uint8x8x4_t vdest; + vdest.val[3] = vdup_n_u8(0); + + for (; rp < rp_stop; rp += 16) + { + uint32x2x4_t vtmp = vld4_u32(png_ptr(uint32_t,rp)); + uint8x8x4_t *vrpt = png_ptr(uint8x8x4_t,&vtmp); + uint8x8x4_t vrp = *vrpt; + uint32x2x4_t *temp_pointer; + uint32x2x4_t vdest_val; + + vdest.val[0] = vadd_u8(vdest.val[3], vrp.val[0]); + vdest.val[1] = vadd_u8(vdest.val[0], vrp.val[1]); + vdest.val[2] = vadd_u8(vdest.val[1], vrp.val[2]); + vdest.val[3] = vadd_u8(vdest.val[2], vrp.val[3]); + + vdest_val = png_ldr(uint32x2x4_t, &vdest); + vst4_lane_u32(png_ptr(uint32_t,rp), vdest_val, 0); + } +} + +static void defilter_avg3(size_t rowbytes, unsigned char *row, const unsigned char *prev_row) +{ + unsigned char *rp = row; + const unsigned char *pp = prev_row; + unsigned char *rp_stop = row + rowbytes; + + uint8x16_t vtmp; + uint8x8x2_t *vrpt; + uint8x8x2_t vrp; + uint8x8x4_t vdest; + vdest.val[3] = vdup_n_u8(0); + + vtmp = vld1q_u8(rp); + vrpt = png_ptr(uint8x8x2_t,&vtmp); + vrp = *vrpt; + + for (; rp < rp_stop; pp += 12) + { + uint8x8_t vtmp1, vtmp2, vtmp3; + + uint8x8x2_t *vppt; + uint8x8x2_t vpp; + + uint32x2_t *temp_pointer; + + vtmp = vld1q_u8(pp); + vppt = png_ptr(uint8x8x2_t,&vtmp); + vpp = *vppt; + + vtmp1 = vext_u8(vrp.val[0], vrp.val[1], 3); + vdest.val[0] = vhadd_u8(vdest.val[3], vpp.val[0]); + vdest.val[0] = vadd_u8(vdest.val[0], vrp.val[0]); + + vtmp2 = vext_u8(vpp.val[0], vpp.val[1], 3); + vtmp3 = vext_u8(vrp.val[0], vrp.val[1], 6); + vdest.val[1] = vhadd_u8(vdest.val[0], vtmp2); + vdest.val[1] = vadd_u8(vdest.val[1], vtmp1); + + vtmp2 = vext_u8(vpp.val[0], vpp.val[1], 6); + vtmp1 = vext_u8(vrp.val[1], vrp.val[1], 1); + + vtmp = vld1q_u8(rp + 12); + vrpt = png_ptr(uint8x8x2_t,&vtmp); + vrp = *vrpt; + + vdest.val[2] = vhadd_u8(vdest.val[1], vtmp2); + vdest.val[2] = vadd_u8(vdest.val[2], vtmp3); + + vtmp2 = vext_u8(vpp.val[1], vpp.val[1], 1); + + vdest.val[3] = vhadd_u8(vdest.val[2], vtmp2); + vdest.val[3] = vadd_u8(vdest.val[3], vtmp1); + + vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[0]), 0); + rp += 3; + vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[1]), 0); + rp += 3; + vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[2]), 0); + rp += 3; + vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[3]), 0); + rp += 3; + } +} + +static void defilter_avg4(size_t rowbytes, unsigned char *row, const unsigned char *prev_row) +{ + unsigned char *rp = row; + unsigned char *rp_stop = row + rowbytes; + const unsigned char *pp = prev_row; + + uint8x8x4_t vdest; + vdest.val[3] = vdup_n_u8(0); + + for (; rp < rp_stop; rp += 16, pp += 16) + { + uint32x2x4_t vtmp; + uint8x8x4_t *vrpt, *vppt; + uint8x8x4_t vrp, vpp; + uint32x2x4_t *temp_pointer; + uint32x2x4_t vdest_val; + + vtmp = vld4_u32(png_ptr(uint32_t,rp)); + vrpt = png_ptr(uint8x8x4_t,&vtmp); + vrp = *vrpt; + vtmp = vld4_u32(png_ptrc(uint32_t,pp)); + vppt = png_ptr(uint8x8x4_t,&vtmp); + vpp = *vppt; + + vdest.val[0] = vhadd_u8(vdest.val[3], vpp.val[0]); + vdest.val[0] = vadd_u8(vdest.val[0], vrp.val[0]); + vdest.val[1] = vhadd_u8(vdest.val[0], vpp.val[1]); + vdest.val[1] = vadd_u8(vdest.val[1], vrp.val[1]); + vdest.val[2] = vhadd_u8(vdest.val[1], vpp.val[2]); + vdest.val[2] = vadd_u8(vdest.val[2], vrp.val[2]); + vdest.val[3] = vhadd_u8(vdest.val[2], vpp.val[3]); + vdest.val[3] = vadd_u8(vdest.val[3], vrp.val[3]); + + vdest_val = png_ldr(uint32x2x4_t, &vdest); + vst4_lane_u32(png_ptr(uint32_t,rp), vdest_val, 0); + } +} + +static uint8x8_t paeth_arm(uint8x8_t a, uint8x8_t b, uint8x8_t c) +{ + uint8x8_t d, e; + uint16x8_t p1, pa, pb, pc; + + p1 = vaddl_u8(a, b); /* a + b */ + pc = vaddl_u8(c, c); /* c * 2 */ + pa = vabdl_u8(b, c); /* pa */ + pb = vabdl_u8(a, c); /* pb */ + pc = vabdq_u16(p1, pc); /* pc */ + + p1 = vcleq_u16(pa, pb); /* pa <= pb */ + pa = vcleq_u16(pa, pc); /* pa <= pc */ + pb = vcleq_u16(pb, pc); /* pb <= pc */ + + p1 = vandq_u16(p1, pa); /* pa <= pb && pa <= pc */ + + d = vmovn_u16(pb); + e = vmovn_u16(p1); + + d = vbsl_u8(d, b, c); + e = vbsl_u8(e, a, d); + + return e; +} + +static void defilter_paeth3(size_t rowbytes, unsigned char *row, const unsigned char *prev_row) +{ + unsigned char *rp = row; + const unsigned char *pp = prev_row; + unsigned char *rp_stop = row + rowbytes; + + uint8x16_t vtmp; + uint8x8x2_t *vrpt; + uint8x8x2_t vrp; + uint8x8_t vlast = vdup_n_u8(0); + uint8x8x4_t vdest; + vdest.val[3] = vdup_n_u8(0); + + vtmp = vld1q_u8(rp); + vrpt = png_ptr(uint8x8x2_t,&vtmp); + vrp = *vrpt; + + for (; rp < rp_stop; pp += 12) + { + uint8x8x2_t *vppt; + uint8x8x2_t vpp; + uint8x8_t vtmp1, vtmp2, vtmp3; + uint32x2_t *temp_pointer; + + vtmp = vld1q_u8(pp); + vppt = png_ptr(uint8x8x2_t,&vtmp); + vpp = *vppt; + + vdest.val[0] = paeth_arm(vdest.val[3], vpp.val[0], vlast); + vdest.val[0] = vadd_u8(vdest.val[0], vrp.val[0]); + + vtmp1 = vext_u8(vrp.val[0], vrp.val[1], 3); + vtmp2 = vext_u8(vpp.val[0], vpp.val[1], 3); + vdest.val[1] = paeth_arm(vdest.val[0], vtmp2, vpp.val[0]); + vdest.val[1] = vadd_u8(vdest.val[1], vtmp1); + + vtmp1 = vext_u8(vrp.val[0], vrp.val[1], 6); + vtmp3 = vext_u8(vpp.val[0], vpp.val[1], 6); + vdest.val[2] = paeth_arm(vdest.val[1], vtmp3, vtmp2); + vdest.val[2] = vadd_u8(vdest.val[2], vtmp1); + + vtmp1 = vext_u8(vrp.val[1], vrp.val[1], 1); + vtmp2 = vext_u8(vpp.val[1], vpp.val[1], 1); + + vtmp = vld1q_u8(rp + 12); + vrpt = png_ptr(uint8x8x2_t,&vtmp); + vrp = *vrpt; + + vdest.val[3] = paeth_arm(vdest.val[2], vtmp2, vtmp3); + vdest.val[3] = vadd_u8(vdest.val[3], vtmp1); + + vlast = vtmp2; + + vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[0]), 0); + rp += 3; + vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[1]), 0); + rp += 3; + vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[2]), 0); + rp += 3; + vst1_lane_u32(png_ptr(uint32_t,rp), png_ldr(uint32x2_t,&vdest.val[3]), 0); + rp += 3; + } +} + +static void defilter_paeth4(size_t rowbytes, unsigned char *row, const unsigned char *prev_row) +{ + unsigned char *rp = row; + unsigned char *rp_stop = row + rowbytes; + const unsigned char *pp = prev_row; + + uint8x8_t vlast = vdup_n_u8(0); + uint8x8x4_t vdest; + vdest.val[3] = vdup_n_u8(0); + + for (; rp < rp_stop; rp += 16, pp += 16) + { + uint32x2x4_t vtmp; + uint8x8x4_t *vrpt, *vppt; + uint8x8x4_t vrp, vpp; + uint32x2x4_t *temp_pointer; + uint32x2x4_t vdest_val; + + vtmp = vld4_u32(png_ptr(uint32_t,rp)); + vrpt = png_ptr(uint8x8x4_t,&vtmp); + vrp = *vrpt; + vtmp = vld4_u32(png_ptrc(uint32_t,pp)); + vppt = png_ptr(uint8x8x4_t,&vtmp); + vpp = *vppt; + + vdest.val[0] = paeth_arm(vdest.val[3], vpp.val[0], vlast); + vdest.val[0] = vadd_u8(vdest.val[0], vrp.val[0]); + vdest.val[1] = paeth_arm(vdest.val[0], vpp.val[1], vpp.val[0]); + vdest.val[1] = vadd_u8(vdest.val[1], vrp.val[1]); + vdest.val[2] = paeth_arm(vdest.val[1], vpp.val[2], vpp.val[1]); + vdest.val[2] = vadd_u8(vdest.val[2], vrp.val[2]); + vdest.val[3] = paeth_arm(vdest.val[2], vpp.val[3], vpp.val[2]); + vdest.val[3] = vadd_u8(vdest.val[3], vrp.val[3]); + + vlast = vpp.val[3]; + + vdest_val = png_ldr(uint32x2x4_t, &vdest); + vst4_lane_u32(png_ptr(uint32_t,rp), vdest_val, 0); + } +} + +/* NEON optimised palette expansion functions + * Derived from palette_neon_intrinsics.c + * + * Copyright (c) 2018-2019 Cosmin Truta + * Copyright (c) 2017-2018 Arm Holdings. All rights reserved. + * Written by Richard Townsend , February 2017. + * + * This code is derived from libpng source code. + * For conditions of distribution and use, see the disclaimer + * and license in this file. + * + * Related: https://developer.arm.com/documentation/101964/latest/Color-palette-expansion + * + * The functions were refactored to iterate forward. + * + */ + +/* Expands a palettized row into RGBA8. */ +static uint32_t expand_palette_rgba8_neon(unsigned char *row, const unsigned char *scanline, const unsigned char *plte, uint32_t width) +{ + const uint32_t scanline_stride = 4; + const uint32_t row_stride = scanline_stride * 4; + const uint32_t count = width / scanline_stride; + const uint32_t *palette = (const uint32_t*)plte; + + if(!count) return 0; + + uint32_t i; + uint32x4_t cur; + for(i=0; i < count; i++, scanline += scanline_stride) + { + cur = vld1q_dup_u32 (palette + scanline[0]); + cur = vld1q_lane_u32(palette + scanline[1], cur, 1); + cur = vld1q_lane_u32(palette + scanline[2], cur, 2); + cur = vld1q_lane_u32(palette + scanline[3], cur, 3); + vst1q_u32((uint32_t*)(row + i * row_stride), cur); + } + + return count * scanline_stride; +} + +/* Expands a palettized row into RGB8. */ +static uint32_t expand_palette_rgb8_neon(unsigned char *row, const unsigned char *scanline, const unsigned char *plte, uint32_t width) +{ + const uint32_t scanline_stride = 8; + const uint32_t row_stride = scanline_stride * 3; + const uint32_t count = width / scanline_stride; + + if(!count) return 0; + + uint32_t i; + uint8x8x3_t cur; + for(i=0; i < count; i++, scanline += scanline_stride) + { + cur = vld3_dup_u8 (plte + 3 * scanline[0]); + cur = vld3_lane_u8(plte + 3 * scanline[1], cur, 1); + cur = vld3_lane_u8(plte + 3 * scanline[2], cur, 2); + cur = vld3_lane_u8(plte + 3 * scanline[3], cur, 3); + cur = vld3_lane_u8(plte + 3 * scanline[4], cur, 4); + cur = vld3_lane_u8(plte + 3 * scanline[5], cur, 5); + cur = vld3_lane_u8(plte + 3 * scanline[6], cur, 6); + cur = vld3_lane_u8(plte + 3 * scanline[7], cur, 7); + vst3_u8(row + i * row_stride, cur); + } + + return count * scanline_stride; +} + +#endif /* SPNG_ARM */ diff --git a/tools/assets/n64texconv/lib/spng/spng.h b/tools/assets/n64texconv/lib/spng/spng.h new file mode 100644 index 0000000000..8f946337bf --- /dev/null +++ b/tools/assets/n64texconv/lib/spng/spng.h @@ -0,0 +1,537 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ +#ifndef SPNG_H +#define SPNG_H + +#ifdef __cplusplus +extern "C" { +#endif + +#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(SPNG_STATIC) + #if defined(SPNG__BUILD) + #define SPNG_API __declspec(dllexport) + #else + #define SPNG_API __declspec(dllimport) + #endif +#else + #define SPNG_API +#endif + +#if defined(_MSC_VER) + #define SPNG_CDECL __cdecl +#else + #define SPNG_CDECL +#endif + +#include +#include +#include + +#define SPNG_VERSION_MAJOR 0 +#define SPNG_VERSION_MINOR 7 +#define SPNG_VERSION_PATCH 4 + +enum spng_errno +{ + SPNG_IO_ERROR = -2, + SPNG_IO_EOF = -1, + SPNG_OK = 0, + SPNG_EINVAL, + SPNG_EMEM, + SPNG_EOVERFLOW, + SPNG_ESIGNATURE, + SPNG_EWIDTH, + SPNG_EHEIGHT, + SPNG_EUSER_WIDTH, + SPNG_EUSER_HEIGHT, + SPNG_EBIT_DEPTH, + SPNG_ECOLOR_TYPE, + SPNG_ECOMPRESSION_METHOD, + SPNG_EFILTER_METHOD, + SPNG_EINTERLACE_METHOD, + SPNG_EIHDR_SIZE, + SPNG_ENOIHDR, + SPNG_ECHUNK_POS, + SPNG_ECHUNK_SIZE, + SPNG_ECHUNK_CRC, + SPNG_ECHUNK_TYPE, + SPNG_ECHUNK_UNKNOWN_CRITICAL, + SPNG_EDUP_PLTE, + SPNG_EDUP_CHRM, + SPNG_EDUP_GAMA, + SPNG_EDUP_ICCP, + SPNG_EDUP_SBIT, + SPNG_EDUP_SRGB, + SPNG_EDUP_BKGD, + SPNG_EDUP_HIST, + SPNG_EDUP_TRNS, + SPNG_EDUP_PHYS, + SPNG_EDUP_TIME, + SPNG_EDUP_OFFS, + SPNG_EDUP_EXIF, + SPNG_ECHRM, + SPNG_EPLTE_IDX, + SPNG_ETRNS_COLOR_TYPE, + SPNG_ETRNS_NO_PLTE, + SPNG_EGAMA, + SPNG_EICCP_NAME, + SPNG_EICCP_COMPRESSION_METHOD, + SPNG_ESBIT, + SPNG_ESRGB, + SPNG_ETEXT, + SPNG_ETEXT_KEYWORD, + SPNG_EZTXT, + SPNG_EZTXT_COMPRESSION_METHOD, + SPNG_EITXT, + SPNG_EITXT_COMPRESSION_FLAG, + SPNG_EITXT_COMPRESSION_METHOD, + SPNG_EITXT_LANG_TAG, + SPNG_EITXT_TRANSLATED_KEY, + SPNG_EBKGD_NO_PLTE, + SPNG_EBKGD_PLTE_IDX, + SPNG_EHIST_NO_PLTE, + SPNG_EPHYS, + SPNG_ESPLT_NAME, + SPNG_ESPLT_DUP_NAME, + SPNG_ESPLT_DEPTH, + SPNG_ETIME, + SPNG_EOFFS, + SPNG_EEXIF, + SPNG_EIDAT_TOO_SHORT, + SPNG_EIDAT_STREAM, + SPNG_EZLIB, + SPNG_EFILTER, + SPNG_EBUFSIZ, + SPNG_EIO, + SPNG_EOF, + SPNG_EBUF_SET, + SPNG_EBADSTATE, + SPNG_EFMT, + SPNG_EFLAGS, + SPNG_ECHUNKAVAIL, + SPNG_ENCODE_ONLY, + SPNG_EOI, + SPNG_ENOPLTE, + SPNG_ECHUNK_LIMITS, + SPNG_EZLIB_INIT, + SPNG_ECHUNK_STDLEN, + SPNG_EINTERNAL, + SPNG_ECTXTYPE, + SPNG_ENOSRC, + SPNG_ENODST, + SPNG_EOPSTATE, + SPNG_ENOTFINAL, +}; + +enum spng_text_type +{ + SPNG_TEXT = 1, + SPNG_ZTXT = 2, + SPNG_ITXT = 3 +}; + +enum spng_color_type +{ + SPNG_COLOR_TYPE_GRAYSCALE = 0, + SPNG_COLOR_TYPE_TRUECOLOR = 2, + SPNG_COLOR_TYPE_INDEXED = 3, + SPNG_COLOR_TYPE_GRAYSCALE_ALPHA = 4, + SPNG_COLOR_TYPE_TRUECOLOR_ALPHA = 6 +}; + +enum spng_filter +{ + SPNG_FILTER_NONE = 0, + SPNG_FILTER_SUB = 1, + SPNG_FILTER_UP = 2, + SPNG_FILTER_AVERAGE = 3, + SPNG_FILTER_PAETH = 4 +}; + +enum spng_filter_choice +{ + SPNG_DISABLE_FILTERING = 0, + SPNG_FILTER_CHOICE_NONE = 8, + SPNG_FILTER_CHOICE_SUB = 16, + SPNG_FILTER_CHOICE_UP = 32, + SPNG_FILTER_CHOICE_AVG = 64, + SPNG_FILTER_CHOICE_PAETH = 128, + SPNG_FILTER_CHOICE_ALL = (8|16|32|64|128) +}; + +enum spng_interlace_method +{ + SPNG_INTERLACE_NONE = 0, + SPNG_INTERLACE_ADAM7 = 1 +}; + +/* Channels are always in byte-order */ +enum spng_format +{ + SPNG_FMT_RGBA8 = 1, + SPNG_FMT_RGBA16 = 2, + SPNG_FMT_RGB8 = 4, + + /* Partially implemented, see documentation */ + SPNG_FMT_GA8 = 16, + SPNG_FMT_GA16 = 32, + SPNG_FMT_G8 = 64, + + /* No conversion or scaling */ + SPNG_FMT_PNG = 256, + SPNG_FMT_RAW = 512 /* big-endian (everything else is host-endian) */ +}; + +enum spng_ctx_flags +{ + SPNG_CTX_IGNORE_ADLER32 = 1, /* Ignore checksum in DEFLATE streams */ + SPNG_CTX_ENCODER = 2 /* Create an encoder context */ +}; + +enum spng_decode_flags +{ + SPNG_DECODE_USE_TRNS = 1, /* Deprecated */ + SPNG_DECODE_USE_GAMA = 2, /* Deprecated */ + SPNG_DECODE_USE_SBIT = 8, /* Undocumented */ + + SPNG_DECODE_TRNS = 1, /* Apply transparency */ + SPNG_DECODE_GAMMA = 2, /* Apply gamma correction */ + SPNG_DECODE_PROGRESSIVE = 256 /* Initialize for progressive reads */ +}; + +enum spng_crc_action +{ + /* Default for critical chunks */ + SPNG_CRC_ERROR = 0, + + /* Discard chunk, invalid for critical chunks. + Since v0.6.2: default for ancillary chunks */ + SPNG_CRC_DISCARD = 1, + + /* Ignore and don't calculate checksum. + Since v0.6.2: also ignores checksums in DEFLATE streams */ + SPNG_CRC_USE = 2 +}; + +enum spng_encode_flags +{ + SPNG_ENCODE_PROGRESSIVE = 1, /* Initialize for progressive writes */ + SPNG_ENCODE_FINALIZE = 2, /* Finalize PNG after encoding image */ +}; + +struct spng_ihdr +{ + uint32_t width; + uint32_t height; + uint8_t bit_depth; + uint8_t color_type; + uint8_t compression_method; + uint8_t filter_method; + uint8_t interlace_method; +}; + +struct spng_plte_entry +{ + uint8_t red; + uint8_t green; + uint8_t blue; + + uint8_t alpha; /* Reserved for internal use */ +}; + +struct spng_plte +{ + uint32_t n_entries; + struct spng_plte_entry entries[256]; +}; + +struct spng_trns +{ + uint16_t gray; + + uint16_t red; + uint16_t green; + uint16_t blue; + + uint32_t n_type3_entries; + uint8_t type3_alpha[256]; +}; + +struct spng_chrm_int +{ + uint32_t white_point_x; + uint32_t white_point_y; + uint32_t red_x; + uint32_t red_y; + uint32_t green_x; + uint32_t green_y; + uint32_t blue_x; + uint32_t blue_y; +}; + +struct spng_chrm +{ + double white_point_x; + double white_point_y; + double red_x; + double red_y; + double green_x; + double green_y; + double blue_x; + double blue_y; +}; + +struct spng_iccp +{ + char profile_name[80]; + size_t profile_len; + char *profile; +}; + +struct spng_sbit +{ + uint8_t grayscale_bits; + uint8_t red_bits; + uint8_t green_bits; + uint8_t blue_bits; + uint8_t alpha_bits; +}; + +struct spng_text +{ + char keyword[80]; + int type; + + size_t length; + char *text; + + uint8_t compression_flag; /* iTXt only */ + uint8_t compression_method; /* iTXt, ztXt only */ + char *language_tag; /* iTXt only */ + char *translated_keyword; /* iTXt only */ +}; + +struct spng_bkgd +{ + uint16_t gray; /* Only for gray/gray alpha */ + uint16_t red; + uint16_t green; + uint16_t blue; + uint16_t plte_index; /* Only for indexed color */ +}; + +struct spng_hist +{ + uint16_t frequency[256]; +}; + +struct spng_phys +{ + uint32_t ppu_x, ppu_y; + uint8_t unit_specifier; +}; + +struct spng_splt_entry +{ + uint16_t red; + uint16_t green; + uint16_t blue; + uint16_t alpha; + uint16_t frequency; +}; + +struct spng_splt +{ + char name[80]; + uint8_t sample_depth; + uint32_t n_entries; + struct spng_splt_entry *entries; +}; + +struct spng_time +{ + uint16_t year; + uint8_t month; + uint8_t day; + uint8_t hour; + uint8_t minute; + uint8_t second; +}; + +struct spng_offs +{ + int32_t x, y; + uint8_t unit_specifier; +}; + +struct spng_exif +{ + size_t length; + char *data; +}; + +struct spng_chunk +{ + size_t offset; + uint32_t length; + uint8_t type[4]; + uint32_t crc; +}; + +enum spng_location +{ + SPNG_AFTER_IHDR = 1, + SPNG_AFTER_PLTE = 2, + SPNG_AFTER_IDAT = 8, +}; + +struct spng_unknown_chunk +{ + uint8_t type[4]; + size_t length; + void *data; + enum spng_location location; +}; + +enum spng_option +{ + SPNG_KEEP_UNKNOWN_CHUNKS = 1, + + SPNG_IMG_COMPRESSION_LEVEL, + SPNG_IMG_WINDOW_BITS, + SPNG_IMG_MEM_LEVEL, + SPNG_IMG_COMPRESSION_STRATEGY, + + SPNG_TEXT_COMPRESSION_LEVEL, + SPNG_TEXT_WINDOW_BITS, + SPNG_TEXT_MEM_LEVEL, + SPNG_TEXT_COMPRESSION_STRATEGY, + + SPNG_FILTER_CHOICE, + SPNG_CHUNK_COUNT_LIMIT, + SPNG_ENCODE_TO_BUFFER, +}; + +typedef void* SPNG_CDECL spng_malloc_fn(size_t size); +typedef void* SPNG_CDECL spng_realloc_fn(void* ptr, size_t size); +typedef void* SPNG_CDECL spng_calloc_fn(size_t count, size_t size); +typedef void SPNG_CDECL spng_free_fn(void* ptr); + +struct spng_alloc +{ + spng_malloc_fn *malloc_fn; + spng_realloc_fn *realloc_fn; + spng_calloc_fn *calloc_fn; + spng_free_fn *free_fn; +}; + +struct spng_row_info +{ + uint32_t scanline_idx; + uint32_t row_num; /* deinterlaced row index */ + int pass; + uint8_t filter; +}; + +typedef struct spng_ctx spng_ctx; + +typedef int spng_read_fn(spng_ctx *ctx, void *user, void *dest, size_t length); +typedef int spng_write_fn(spng_ctx *ctx, void *user, void *src, size_t length); + +typedef int spng_rw_fn(spng_ctx *ctx, void *user, void *dst_src, size_t length); + +SPNG_API spng_ctx *spng_ctx_new(int flags); +SPNG_API spng_ctx *spng_ctx_new2(struct spng_alloc *alloc, int flags); +SPNG_API void spng_ctx_free(spng_ctx *ctx); + +SPNG_API int spng_set_png_buffer(spng_ctx *ctx, const void *buf, size_t size); +SPNG_API int spng_set_png_stream(spng_ctx *ctx, spng_rw_fn *rw_func, void *user); +SPNG_API int spng_set_png_file(spng_ctx *ctx, FILE *file); + +SPNG_API void *spng_get_png_buffer(spng_ctx *ctx, size_t *len, int *error); + +SPNG_API int spng_set_image_limits(spng_ctx *ctx, uint32_t width, uint32_t height); +SPNG_API int spng_get_image_limits(spng_ctx *ctx, uint32_t *width, uint32_t *height); + +SPNG_API int spng_set_chunk_limits(spng_ctx *ctx, size_t chunk_size, size_t cache_size); +SPNG_API int spng_get_chunk_limits(spng_ctx *ctx, size_t *chunk_size, size_t *cache_size); + +SPNG_API int spng_set_crc_action(spng_ctx *ctx, int critical, int ancillary); + +SPNG_API int spng_set_option(spng_ctx *ctx, enum spng_option option, int value); +SPNG_API int spng_get_option(spng_ctx *ctx, enum spng_option option, int *value); + +SPNG_API int spng_decoded_image_size(spng_ctx *ctx, int fmt, size_t *len); + +/* Decode */ +SPNG_API int spng_decode_image(spng_ctx *ctx, void *out, size_t len, int fmt, int flags); + +/* Progressive decode */ +SPNG_API int spng_decode_scanline(spng_ctx *ctx, void *out, size_t len); +SPNG_API int spng_decode_row(spng_ctx *ctx, void *out, size_t len); +SPNG_API int spng_decode_chunks(spng_ctx *ctx); + +/* Encode/decode */ +SPNG_API int spng_get_row_info(spng_ctx *ctx, struct spng_row_info *row_info); + +/* Encode */ +SPNG_API int spng_encode_image(spng_ctx *ctx, const void *img, size_t len, int fmt, int flags); + +/* Progressive encode */ +SPNG_API int spng_encode_scanline(spng_ctx *ctx, const void *scanline, size_t len); +SPNG_API int spng_encode_row(spng_ctx *ctx, const void *row, size_t len); +SPNG_API int spng_encode_chunks(spng_ctx *ctx); + +SPNG_API int spng_get_ihdr(spng_ctx *ctx, struct spng_ihdr *ihdr); +SPNG_API int spng_get_plte(spng_ctx *ctx, struct spng_plte *plte); +SPNG_API int spng_get_trns(spng_ctx *ctx, struct spng_trns *trns); +SPNG_API int spng_get_chrm(spng_ctx *ctx, struct spng_chrm *chrm); +SPNG_API int spng_get_chrm_int(spng_ctx *ctx, struct spng_chrm_int *chrm_int); +SPNG_API int spng_get_gama(spng_ctx *ctx, double *gamma); +SPNG_API int spng_get_gama_int(spng_ctx *ctx, uint32_t *gama_int); +SPNG_API int spng_get_iccp(spng_ctx *ctx, struct spng_iccp *iccp); +SPNG_API int spng_get_sbit(spng_ctx *ctx, struct spng_sbit *sbit); +SPNG_API int spng_get_srgb(spng_ctx *ctx, uint8_t *rendering_intent); +SPNG_API int spng_get_text(spng_ctx *ctx, struct spng_text *text, uint32_t *n_text); +SPNG_API int spng_get_bkgd(spng_ctx *ctx, struct spng_bkgd *bkgd); +SPNG_API int spng_get_hist(spng_ctx *ctx, struct spng_hist *hist); +SPNG_API int spng_get_phys(spng_ctx *ctx, struct spng_phys *phys); +SPNG_API int spng_get_splt(spng_ctx *ctx, struct spng_splt *splt, uint32_t *n_splt); +SPNG_API int spng_get_time(spng_ctx *ctx, struct spng_time *time); +SPNG_API int spng_get_unknown_chunks(spng_ctx *ctx, struct spng_unknown_chunk *chunks, uint32_t *n_chunks); + +/* Official extensions */ +SPNG_API int spng_get_offs(spng_ctx *ctx, struct spng_offs *offs); +SPNG_API int spng_get_exif(spng_ctx *ctx, struct spng_exif *exif); + + +SPNG_API int spng_set_ihdr(spng_ctx *ctx, struct spng_ihdr *ihdr); +SPNG_API int spng_set_plte(spng_ctx *ctx, struct spng_plte *plte); +SPNG_API int spng_set_trns(spng_ctx *ctx, struct spng_trns *trns); +SPNG_API int spng_set_chrm(spng_ctx *ctx, struct spng_chrm *chrm); +SPNG_API int spng_set_chrm_int(spng_ctx *ctx, struct spng_chrm_int *chrm_int); +SPNG_API int spng_set_gama(spng_ctx *ctx, double gamma); +SPNG_API int spng_set_gama_int(spng_ctx *ctx, uint32_t gamma); +SPNG_API int spng_set_iccp(spng_ctx *ctx, struct spng_iccp *iccp); +SPNG_API int spng_set_sbit(spng_ctx *ctx, struct spng_sbit *sbit); +SPNG_API int spng_set_srgb(spng_ctx *ctx, uint8_t rendering_intent); +SPNG_API int spng_set_text(spng_ctx *ctx, struct spng_text *text, uint32_t n_text); +SPNG_API int spng_set_bkgd(spng_ctx *ctx, struct spng_bkgd *bkgd); +SPNG_API int spng_set_hist(spng_ctx *ctx, struct spng_hist *hist); +SPNG_API int spng_set_phys(spng_ctx *ctx, struct spng_phys *phys); +SPNG_API int spng_set_splt(spng_ctx *ctx, struct spng_splt *splt, uint32_t n_splt); +SPNG_API int spng_set_time(spng_ctx *ctx, struct spng_time *time); +SPNG_API int spng_set_unknown_chunks(spng_ctx *ctx, struct spng_unknown_chunk *chunks, uint32_t n_chunks); + +/* Official extensions */ +SPNG_API int spng_set_offs(spng_ctx *ctx, struct spng_offs *offs); +SPNG_API int spng_set_exif(spng_ctx *ctx, struct spng_exif *exif); + + +SPNG_API const char *spng_strerror(int err); +SPNG_API const char *spng_version_string(void); + +#ifdef __cplusplus +} +#endif + +#endif /* SPNG_H */ diff --git a/tools/ZAPD/lib/libgfxd/LICENSE b/tools/assets/n64texconv/src/LICENSE similarity index 95% rename from tools/ZAPD/lib/libgfxd/LICENSE rename to tools/assets/n64texconv/src/LICENSE index a7655f829d..3c68e6a959 100644 --- a/tools/ZAPD/lib/libgfxd/LICENSE +++ b/tools/assets/n64texconv/src/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2016-2021 glank (glankk@github.com) +Copyright (c) 2025 ZeldaRET Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/tools/assets/n64texconv/src/app/main.c b/tools/assets/n64texconv/src/app/main.c new file mode 100644 index 0000000000..9829c512c1 --- /dev/null +++ b/tools/assets/n64texconv/src/app/main.c @@ -0,0 +1,137 @@ +/* SPDX-FileCopyrightText: Copyright (C) 2025 ZeldaRET */ +/* SPDX-License-Identifier: MIT */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define NORETURN __attribute__((noreturn)) +#define ARRLEN(a) (sizeof(a) / sizeof((a)[0])) +#define strequ(s1, s2) (strcmp((s1), (s2)) == 0) + +#include "../libn64texconv/n64texconv.h" +#include "../libn64texconv/jfif.h" + +static bool +is_regular_file(const char *path) +{ + struct stat sb; + stat(path, &sb); + return S_ISREG(sb.st_mode); +} + +static NORETURN void +usage(const char *progname) +{ + fprintf(stderr, + "n64texconv: Convert an input png to N64 data in the desired format.\n" + "Usage: %s [pal_out.c]\n" + " Valid types: i4 / i8 / ci4 / ci8 / ia4 / ia8 / ia16 / rgba16 / rgba32 / JFIF\n", + progname); + exit(EXIT_FAILURE); +} + +static const struct fmt_info { + const char *name; + int fmt; + int siz; +} fmt_map[] = { + // clang-format off + { "i4", G_IM_FMT_I, G_IM_SIZ_4b, }, + { "i8", G_IM_FMT_I, G_IM_SIZ_8b, }, + { "ci4", G_IM_FMT_CI, G_IM_SIZ_4b, }, + { "ci8", G_IM_FMT_CI, G_IM_SIZ_8b, }, + { "ia4", G_IM_FMT_IA, G_IM_SIZ_4b, }, + { "ia8", G_IM_FMT_IA, G_IM_SIZ_8b, }, + { "ia16", G_IM_FMT_IA, G_IM_SIZ_16b, }, + { "rgba16", G_IM_FMT_RGBA, G_IM_SIZ_16b, }, + { "rgba32", G_IM_FMT_RGBA, G_IM_SIZ_32b, }, + // clang-format on +}; + +int +main(int argc, char **argv) +{ + const char *progname = argv[0]; + const char *fmt; + const char *array_fmt; + const char *in; + const char *out; + const char *pal_out; + + if (argc < 5) + usage(progname); + + fmt = argv[1]; + array_fmt = argv[2]; + in = argv[3]; + out = argv[4]; + pal_out = (argc > 5) ? argv[5] : NULL; + + unsigned int byte_width = (strequ(array_fmt, "u32") ? 4 : 8); + + if (!is_regular_file(in)) { + fprintf(stderr, "Could not open input file %s\n", in); + return EXIT_FAILURE; + } + + if (strequ(fmt, "JFIF")) { + struct JFIF *jfif = jfif_fromfile(in, JFIF_BUFFER_SIZE); + if (jfif == NULL) { + fprintf(stderr, "Could not open input file %s\n", in); + return EXIT_FAILURE; + } + if (jfif_to_c_file(out, jfif, JFIF_BUFFER_SIZE)) { + fprintf(stderr, "Could not save output C file %s\n", out); + return EXIT_FAILURE; + } + jfif_free(jfif); + } else { + int rv; + const struct fmt_info *fmt_info = NULL; + for (size_t i = 0; i < ARRLEN(fmt_map); i++) { + if (strequ(fmt, fmt_map[i].name)) { + fmt_info = &fmt_map[i]; + break; + } + } + if (fmt_info == NULL) { + fprintf(stderr, "Error: Invalid fmt %s\n", fmt); + return EXIT_FAILURE; + } + + struct n64_image *img = n64texconv_image_from_png(in, fmt_info->fmt, fmt_info->siz, G_IM_FMT_RGBA); + if (img == NULL) { + fprintf(stderr, "Could not open input file %s\n", in); + return EXIT_FAILURE; + } + + if (img->pal != NULL) { + if (pal_out == NULL) { + fprintf(stderr, "Input file %s is color indexed, a palette output C file must be provided.\n", in); + usage(progname); + } + + if (rv = n64texconv_palette_to_c_file(pal_out, img->pal, false, byte_width), rv != 0) { + fprintf(stderr, "Could not save output C file %s (error %d)\n", pal_out, rv); + return EXIT_FAILURE; + } + } + + if (rv = n64texconv_image_to_c_file(out, img, false, false, byte_width), rv != 0) { + fprintf(stderr, "Could not save output C file %s (error %d)\n", out, rv); + return EXIT_FAILURE; + } + + if (img->pal != NULL) + n64texconv_palette_free(img->pal); + n64texconv_image_free(img); + } + + return EXIT_SUCCESS; +} diff --git a/tools/assets/n64texconv/src/libn64texconv/bin2c.c b/tools/assets/n64texconv/src/libn64texconv/bin2c.c new file mode 100644 index 0000000000..c5d9475bbf --- /dev/null +++ b/tools/assets/n64texconv/src/libn64texconv/bin2c.c @@ -0,0 +1,130 @@ +/* SPDX-FileCopyrightText: Copyright (C) 2025 ZeldaRET */ +/* SPDX-License-Identifier: MIT */ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "bin2c.h" +#include "endian.h" + +#define BYTES_PER_ROW 32 +#define LINE_MASK (BYTES_PER_ROW - 1) + +int +bin2c(char **out, size_t *size_out, void *bin, size_t size, size_t pad_to_size, unsigned int byte_width) +{ + assert(out != NULL); + assert(size_out != NULL); + assert(bin != NULL); + + if (byte_width != 1 && byte_width != 2 && byte_width != 4 && byte_width != 8) + return -2; + + size_t end_size = (pad_to_size > size) ? pad_to_size : size; + + if ((end_size & (byte_width - 1)) != 0) + return -3; + + size_t size_out_ = (1 + 1 + 2 * byte_width + 1 + 1) * ((end_size + byte_width - 1) / byte_width) + 2; + char *out_ = malloc(size_out_); + if (out_ == NULL) + return -1; + + char *pos = out_; + bool was_newline = false; + for (size_t p = 0; p < size; p += byte_width) { + size_t rem = byte_width; + if (rem > size - p) // For any remaining unaligned data, rest will be padded with 0 + rem = size - p; + + // Read input + uint64_t d = 0; + memcpy(&d, &((uint8_t *)bin)[p], rem); + + // Byteswap + shift + d = be64toh(d) >> (64 - 8 * byte_width); + + // Write output + was_newline = (((p + byte_width) & LINE_MASK) == 0); + char end = was_newline ? '\n' : ' '; + pos += sprintf(pos, "0x%0*" PRIX64 ",%c", 2 * byte_width, d, end); + } + + for (size_t p = (size + byte_width - 1) & ~(byte_width - 1); p < pad_to_size; p += byte_width) { + was_newline = (((p + byte_width) & LINE_MASK) == 0); + char end = was_newline ? '\n' : ' '; + pos += sprintf(pos, "0x%0*" PRIX64 ",%c", 2 * byte_width, (uint64_t)0, end); + } + + if (!was_newline) + *pos++ = '\n'; + + *pos++ = '\0'; + + *out = out_; + *size_out = size_out_; + return 0; +} + +int +bin2c_file(const char *out_path, void *bin, size_t size, size_t pad_to_size, unsigned int byte_width) +{ + assert(out_path != NULL); + assert(bin != NULL); + + if (byte_width != 1 && byte_width != 2 && byte_width != 4 && byte_width != 8) + return -2; + + size_t end_size = (pad_to_size > size) ? pad_to_size : size; + + if ((end_size & (byte_width - 1)) != 0) + return -3; + + FILE *of = fopen(out_path, "w"); + if (of == NULL) + return -1; + + bool was_newline = false; + for (size_t p = 0; p < size; p += byte_width) { + size_t rem = byte_width; + if (rem > size - p) // For any remaining unaligned data, rest will be padded with 0 + rem = size - p; + + // Read input + uint64_t d = 0; + memcpy(&d, &((uint8_t *)bin)[p], rem); + + // Byteswap + shift + d = be64toh(d) >> (64 - 8 * byte_width); + + // Write output + was_newline = (((p + byte_width) & LINE_MASK) == 0); + char end = was_newline ? '\n' : ' '; + + if (fprintf(of, "0x%0*" PRIX64 ",%c", 2 * byte_width, d, end) < 0) + goto error_post_open; + } + + for (size_t p = (size + byte_width - 1) & ~(byte_width - 1); p < pad_to_size; p += byte_width) { + was_newline = (((p + byte_width) & LINE_MASK) == 0); + char end = was_newline ? '\n' : ' '; + if (fprintf(of, "0x%0*" PRIX64 ",%c", 2 * byte_width, (uint64_t)0, end) < 0) + goto error_post_open; + } + + if (!was_newline) + fputs("\n", of); + + fclose(of); + return 0; +error_post_open: + fclose(of); + if (remove(out_path) != 0) + fprintf(stderr, "error calling remove(\"%s\"): %s", out_path, strerror(errno)); + return -4; +} diff --git a/tools/assets/n64texconv/src/libn64texconv/bin2c.h b/tools/assets/n64texconv/src/libn64texconv/bin2c.h new file mode 100644 index 0000000000..f34a65baf4 --- /dev/null +++ b/tools/assets/n64texconv/src/libn64texconv/bin2c.h @@ -0,0 +1,14 @@ +/* SPDX-FileCopyrightText: Copyright (C) 2025 ZeldaRET */ +/* SPDX-License-Identifier: MIT */ +#ifndef BIN2C_H +#define BIN2C_H + +#include + +int +bin2c(char **out, size_t *size_out, void *bin, size_t size, size_t pad_to_size, unsigned int byte_width); + +int +bin2c_file(const char *out_path, void *bin, size_t size, size_t pad_to_size, unsigned int byte_width); + +#endif diff --git a/tools/assets/n64texconv/src/libn64texconv/endian.h b/tools/assets/n64texconv/src/libn64texconv/endian.h new file mode 100644 index 0000000000..e457b8664d --- /dev/null +++ b/tools/assets/n64texconv/src/libn64texconv/endian.h @@ -0,0 +1,69 @@ +/* SPDX-FileCopyrightText: Copyright (C) 2025 ZeldaRET */ +/* SPDX-License-Identifier: MIT */ +#ifndef ENDIAN_H +#define ENDIAN_H + +#if defined(__linux__) || defined(__CYGWIN__) +#include +#elif defined(__APPLE__) +#include + +#define htobe16(x) OSSwapHostToBigInt16(x) +#define htole16(x) OSSwapHostToLittleInt16(x) +#define be16toh(x) OSSwapBigToHostInt16(x) +#define le16toh(x) OSSwapLittleToHostInt16(x) + +#define htobe32(x) OSSwapHostToBigInt32(x) +#define htole32(x) OSSwapHostToLittleInt32(x) +#define be32toh(x) OSSwapBigToHostInt32(x) +#define le32toh(x) OSSwapLittleToHostInt32(x) + +#define htobe64(x) OSSwapHostToBigInt64(x) +#define htole64(x) OSSwapHostToLittleInt64(x) +#define be64toh(x) OSSwapBigToHostInt64(x) +#define le64toh(x) OSSwapLittleToHostInt64(x) +#else + +#if !defined(__BYTE_ORDER__) +#error "No endian define provided by compiler" +#endif + +#if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) + +#define htobe16(x) (x) +#define htole16(x) __builtin_bswap16(x) +#define be16toh(x) (x) +#define le16toh(x) __builtin_bswap16(x) + +#define htobe32(x) (x) +#define htole32(x) __builtin_bswap32(x) +#define be32toh(x) (x) +#define le32toh(x) __builtin_bswap32(x) + +#define htobe64(x) (x) +#define htole64(x) __builtin_bswap64(x) +#define be64toh(x) (x) +#define le64toh(x) __builtin_bswap64(x) + +#else + +#define htobe16(x) __builtin_bswap16(x) +#define htole16(x) (x) +#define be16toh(x) __builtin_bswap16(x) +#define le16toh(x) (x) + +#define htobe32(x) __builtin_bswap32(x) +#define htole32(x) (x) +#define be32toh(x) __builtin_bswap32(x) +#define le32toh(x) (x) + +#define htobe64(x) __builtin_bswap64(x) +#define htole64(x) (x) +#define be64toh(x) __builtin_bswap64(x) +#define le64toh(x) (x) + +#endif + +#endif + +#endif diff --git a/tools/assets/n64texconv/src/libn64texconv/jfif.c b/tools/assets/n64texconv/src/libn64texconv/jfif.c new file mode 100644 index 0000000000..645614c890 --- /dev/null +++ b/tools/assets/n64texconv/src/libn64texconv/jfif.c @@ -0,0 +1,76 @@ +/* SPDX-FileCopyrightText: Copyright (C) 2025 ZeldaRET */ +/* SPDX-License-Identifier: MIT */ +#include +#include +#include +#include +#include + +#include "endian.h" +#include "bin2c.h" +#include "jfif.h" + +struct JFIF * +jfif_fromfile(const char *path, size_t max_size) +{ + assert(path != NULL); + FILE *f = fopen(path, "rb"); + if (f == NULL) + return NULL; + + fseek(f, 0, SEEK_END); + size_t data_size = ftell(f); + fseek(f, 0, SEEK_SET); + + struct JFIF *jfif = malloc(((sizeof(struct JFIF) + 3) & ~3) + data_size); + if (jfif != NULL) { + jfif->data = (void *)(jfif + 1); + jfif->data_size = data_size; + + if (fread(jfif->data, 1, data_size, f) != data_size) { + free(jfif); + jfif = NULL; + } else { + uint8_t *data8 = jfif->data; + uint16_t *data16 = jfif->data; + uint32_t *data32 = jfif->data; + + if (be32toh(data32[0]) != 0xFFD8FFE0) + printf("[Warning] Missing JPEG marker\n"); + if (data8[6] != 'J' || data8[7] != 'F' || data8[8] != 'I' || data8[9] != 'F') + printf("[Warning] Not JFIF\n"); + if (data8[11] != 0x01 || data8[12] != 0x01) + printf("[Warning] Not JFIF version 1.01\n"); + if (be16toh(data16[10]) != 0xFFDB) + printf("[Warning] Data before DQT\n"); + if (jfif->data_size > max_size) + printf("[Warning] JFIF image too large\n"); + } + } + + fclose(f); + return jfif; +} + +void +jfif_free(struct JFIF *jfif) +{ + assert(jfif != NULL); + free(jfif); +} + +int +jfif_to_c(char **out, size_t *size_out, struct JFIF *jfif, size_t pad_to_size) +{ + assert(out != NULL); + assert(size_out != NULL); + return bin2c(out, size_out, jfif->data, jfif->data_size, pad_to_size, 8); +} + +int +jfif_to_c_file(const char *out_path, struct JFIF *jfif, size_t pad_to_size) +{ + assert(out_path != NULL); + assert(jfif != NULL); + return bin2c_file(out_path, jfif->data, jfif->data_size, pad_to_size, 8); +} diff --git a/tools/assets/n64texconv/src/libn64texconv/jfif.h b/tools/assets/n64texconv/src/libn64texconv/jfif.h new file mode 100644 index 0000000000..d094d54788 --- /dev/null +++ b/tools/assets/n64texconv/src/libn64texconv/jfif.h @@ -0,0 +1,28 @@ +/* SPDX-FileCopyrightText: Copyright (C) 2025 ZeldaRET */ +/* SPDX-License-Identifier: MIT */ +#ifndef JFIF_H +#define JFIF_H + +#include +#include + +struct JFIF { + void *data; + size_t data_size; +}; + +#define JFIF_BUFFER_SIZE (320 * 240 * sizeof(uint16_t)) + +struct JFIF * +jfif_fromfile(const char *path, size_t max_size); + +void +jfif_free(struct JFIF *jfif); + +int +jfif_to_c(char **out, size_t *size_out, struct JFIF *jfif, size_t pad_to_size); + +int +jfif_to_c_file(const char *out_path, struct JFIF *jfif, size_t pad_to_size); + +#endif diff --git a/tools/assets/n64texconv/src/libn64texconv/n64texconv.c b/tools/assets/n64texconv/src/libn64texconv/n64texconv.c new file mode 100644 index 0000000000..61d7fbb8eb --- /dev/null +++ b/tools/assets/n64texconv/src/libn64texconv/n64texconv.c @@ -0,0 +1,1299 @@ +/* SPDX-FileCopyrightText: Copyright (C) 2025 ZeldaRET */ +/* SPDX-License-Identifier: MIT */ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "spng.h" +#include "libimagequant.h" +#include "endian.h" +#include "bin2c.h" +#include "n64texconv.h" + +// ******************************************************************************************************************** +// Helpers +// ******************************************************************************************************************** + +#define UNUSED __attribute__((unused)) + +#define ALIGN8(x) (((x) + 7) & ~7) + +#define ABS(x) (((x) < 0) ? -(x) : (x)) + +static uint8_t +texel_to_greyscale(uint8_t r, uint8_t g, uint8_t b) +{ + // Approximately (0.2126729, 0.7151522, 0.0721750) in 1.8 fixed point + // Same as Blender: + // https://github.com/blender/blender/blob/594f47ecd2d5367ca936cf6fc6ec8168c2b360d0/intern/cycles/render/shader.cpp#L387 + return (r * 54 + g * 183 + b * 19 + 128) / 256; +} + +UNUSED static void +texels_to_greyscale(struct color *out, struct color *in, size_t ntexels, bool alpha) +{ + assert(out != NULL); + assert(in != NULL); + + for (size_t i = 0; i < ntexels; i++) { + struct color color = in[i]; + uint8_t grey = texel_to_greyscale(color.r, color.g, color.b); + uint8_t a = color.a; + out[i].r = grey; + out[i].g = grey; + out[i].b = grey; + out[i].a = (alpha) ? a : grey; + } +} + +static void +palette_dim(size_t count, size_t *width, size_t *height) +{ + assert(width != NULL); + assert(height != NULL); + + size_t best_width = count; + size_t best_height = 1; + size_t best_diff = count - 1; + + if (count >= 4) { + // Find a factorization of count for which the two factors are close to equal, and width >= height. + // This makes the output palette image approximately square. + for (size_t i = 2; i <= (size_t)sqrtf(count); i++) { + size_t div = count / i; + + size_t new_diff = ABS((signed)(div - i)); + if (div * i == count && new_diff < best_diff) { + // (div, i) is a factorization and is closer to a square than before + best_width = div; + best_height = i; + best_diff = new_diff; + } + } + } + *width = best_width; + *height = best_height; +} + +static void +n64texconv_quantize(uint8_t *out_indices, struct color *out_pal, size_t *out_pal_count, struct color *texels, + size_t width, size_t height, unsigned int max_colors, float dither_level) +{ + assert(out_indices != NULL); + assert(out_pal != NULL); + assert(out_pal_count != NULL); + assert(texels != NULL); + + // Set options + liq_attr *attr = liq_attr_create(); + liq_set_max_colors(attr, max_colors); + + // Quantize + liq_image *img = liq_image_create_rgba(attr, (void *)texels, width, height, 0.0); + liq_result *result; + liq_error err = liq_image_quantize(img, attr, &result); + assert(err == LIQ_OK); + + // Write output bitmap + liq_set_dithering_level(result, dither_level); + liq_write_remapped_image(result, img, (void *)out_indices, width * height); + + // Write output palette + const liq_palette *pal = liq_get_palette(result); + assert(pal->count <= max_colors); + *out_pal_count = pal->count; + memcpy(out_pal, pal->entries, pal->count * 4); + + // Cleanup + liq_result_destroy(result); + liq_image_destroy(img); + liq_attr_destroy(attr); +} + +/** + * out_indices, out_pal, out_pal_count, texels, widths, heights are all arrays of size num_images + * texels[i] and out_indices[i] are arrays of size widths[i] * heights[i] + */ +int +n64texconv_quantize_shared(uint8_t **out_indices, struct color *out_pal, size_t *out_pal_count, struct color **texels, + size_t *widths, size_t *heights, size_t num_images, unsigned int max_colors, + float dither_level) +{ + assert(out_indices != NULL); + assert(out_pal != NULL); + assert(out_pal_count != NULL); + assert(texels != NULL); + assert(widths != NULL); + assert(heights != NULL); + + int rv = 0; + + // Set options + liq_attr *attr = liq_attr_create(); + liq_set_max_colors(attr, max_colors); + + // Create histogram + liq_histogram *hist = liq_histogram_create(attr); + + // Add images to histogram + liq_image *images[num_images]; + for (size_t i = 0; i < num_images; i++) { + images[i] = liq_image_create_rgba(attr, (void *)texels[i], widths[i], heights[i], 0); + liq_histogram_add_image(hist, attr, images[i]); + } + + // Simultaneous quantization + liq_result *result; + liq_error err = liq_histogram_quantize(hist, attr, &result); + if (err != LIQ_OK) { + rv = -1; + goto exit; + } + + // Remap images + liq_set_dithering_level(result, dither_level); + for (size_t i = 0; i < num_images; i++) { + liq_write_remapped_image(result, images[i], (void *)out_indices[i], widths[i] * heights[i]); + } + + // Write output palette + const liq_palette *pal = liq_get_palette(result); + assert(pal->count <= max_colors); + *out_pal_count = pal->count; + memcpy(out_pal, pal->entries, pal->count * 4); + + // Cleanup + liq_result_destroy(result); +exit: + for (size_t i = 0; i < num_images; i++) { + liq_image_destroy(images[i]); + } + liq_histogram_destroy(hist); + liq_attr_destroy(attr); + return rv; +} + + + +// ******************************************************************************************************************** +// Format Packing and Unpacking +// ******************************************************************************************************************** + +#define UNPACK_FUNC(fmt_name) static int fmt_name##_unpack(struct color *out, void *in, size_t ntexels) + +#define UNPACK_CI_FUNC(fmt_name) static int fmt_name##_unpack(uint8_t *out, void *in, size_t ntexels, size_t npal) + +#define PACK_FUNC(fmt_name) static int fmt_name##_pack(void *out, struct color *in, size_t ntexels) + +#define PACK_CI_FUNC(fmt_name) static int fmt_name##_pack(void *out, uint8_t *in, size_t ntexels, size_t npal) + +/* RGBA16 */ + +UNPACK_FUNC(rgba16) +{ + uint16_t *in16 = in; + + for (size_t n = 0; n < ntexels; n++) { + uint16_t c = be16toh(in16[n]); + uint8_t r = (c >> 11) & 0b11111; + uint8_t g = (c >> 6) & 0b11111; + uint8_t b = (c >> 1) & 0b11111; + uint8_t a = (c >> 0) & 1; + out[n].r = (r << 3) | (r >> 2); + out[n].g = (g << 3) | (g >> 2); + out[n].b = (b << 3) | (b >> 2); + out[n].a = 255 * a; + } + return 0; +} + +PACK_FUNC(rgba16) +{ + uint16_t *out16 = out; + + for (size_t n = 0; n < ntexels; n++) { + uint8_t r = (in[n].r >> 3) & 0b11111; + uint8_t g = (in[n].g >> 3) & 0b11111; + uint8_t b = (in[n].b >> 3) & 0b11111; + uint8_t a = in[n].a != 0; + out16[n] = htobe16((r << 11) | (g << 6) | (b << 1) | a); + } + return 0; +} + +/* RGBA32 */ + +UNPACK_FUNC(rgba32) +{ + uint32_t *in32 = in; + + for (size_t n = 0; n < ntexels; n++) { + uint32_t c = be32toh(in32[n]); + out[n].r = (c >> 24) & 0xFF; + out[n].g = (c >> 16) & 0xFF; + out[n].b = (c >> 8) & 0xFF; + out[n].a = (c >> 0) & 0xFF; + } + return 0; +} + +PACK_FUNC(rgba32) +{ + uint32_t *out32 = out; + + for (size_t n = 0; n < ntexels; n++) { + out32[n] = htobe32((in[n].r << 24) | (in[n].g << 16) | (in[n].b << 8) | in[n].a); + } + return 0; +} + +/* CI4 */ + +UNPACK_CI_FUNC(ci4) +{ + uint8_t *in8 = in; + + unsigned sft = 4; + for (size_t n = 0; n < ntexels; n++, sft ^= 4) { + uint8_t c = (in8[n >> 1] >> sft) & 0xF; + if (!(c < npal)) + return -1; // palette too small for image data + out[n] = c; + } + return 0; +} + +PACK_CI_FUNC(ci4) +{ + uint8_t *out8 = out; + + unsigned sft = 4; + for (size_t n = 0; n < ntexels; n++, sft ^= 4) { + uint8_t c = in[n]; + if (!(c < npal)) + return -1; // palette too small for image data + if (sft == 4) + out8[n >> 1] = 0; + out8[n >> 1] |= c << sft; + } + return 0; +} + +/* CI8 */ + +UNPACK_CI_FUNC(ci8) +{ + uint8_t *in8 = in; + + for (size_t n = 0; n < ntexels; n++) { + uint8_t c = in8[n] & 0xFF; + if (!(c < npal)) + return -1; // palette too small for image data + out[n] = c; + } + return 0; +} + +PACK_CI_FUNC(ci8) +{ + uint8_t *out8 = out; + + for (size_t n = 0; n < ntexels; n++) { + uint8_t c = in[n]; + if (!(c < npal)) + return -1; // palette too small for image data + out8[n] = c; + } + return 0; +} + +/* IA4 */ + +UNPACK_FUNC(ia4) +{ + uint8_t *in8 = in; + + unsigned sft = 4; + for (size_t n = 0; n < ntexels; n++, sft ^= 4) { + uint8_t c = (in8[n >> 1] >> sft) & 0xF; + uint8_t i = c & 0b1110; + uint8_t a = c & 0b0001; + i = (i << 4) | (i << 1) | (i >> 2); + a = 255 * a; + out[n].r = i; + out[n].g = i; + out[n].b = i; + out[n].a = a; + } + return 0; +} + +PACK_FUNC(ia4) +{ + uint8_t *out8 = out; + + unsigned sft = 4; + for (size_t n = 0; n < ntexels; n++, sft ^= 4) { + uint8_t g = texel_to_greyscale(in[n].r, in[n].g, in[n].b); + uint8_t i = (g >> 5) & 0b111; + uint8_t a = in[n].a != 0; + if (sft == 4) + out8[n >> 1] = 0; + out8[n >> 1] |= ((i << 1) | a) << sft; + } + return 0; +} + +/* IA8 */ + +UNPACK_FUNC(ia8) +{ + uint8_t *in8 = in; + + for (size_t n = 0; n < ntexels; n++) { + uint8_t c = in8[n]; + uint8_t i = (c >> 4) & 0xF; + uint8_t a = (c >> 0) & 0xF; + i = (i << 4) | i; + a = (a << 4) | a; + out[n].r = i; + out[n].g = i; + out[n].b = i; + out[n].a = a; + } + return 0; +} + +PACK_FUNC(ia8) +{ + uint8_t *out8 = out; + + for (size_t n = 0; n < ntexels; n++) { + uint8_t g = texel_to_greyscale(in[n].r, in[n].g, in[n].b); + uint8_t i = (g >> 4) & 0xF; + uint8_t a = (in[n].a >> 4) & 0xF; + out8[n] = (i << 4) | a; + } + return 0; +} + +/* IA16 */ + +UNPACK_FUNC(ia16) +{ + uint16_t *in16 = in; + + for (size_t n = 0; n < ntexels; n++) { + uint16_t c = be16toh(in16[n]); + uint8_t i = (c >> 8) & 0xFF; + uint8_t a = (c >> 0) & 0xFF; + out[n].r = i; + out[n].g = i; + out[n].b = i; + out[n].a = a; + } + return 0; +} + +PACK_FUNC(ia16) +{ + uint16_t *out16 = out; + + for (size_t n = 0; n < ntexels; n++) { + uint8_t i = texel_to_greyscale(in[n].r, in[n].g, in[n].b); + uint8_t a = in[n].a; + out16[n] = htobe16((i << 8) | a); + } + return 0; +} + +/* I4 */ + +UNPACK_FUNC(i4) +{ + uint8_t *in8 = in; + + unsigned sft = 4; + for (size_t n = 0; n < ntexels; n++, sft ^= 4) { + uint8_t i = (in8[n >> 1] >> sft) & 0xF; + i = (i << 4) | i; + out[n].r = i; + out[n].g = i; + out[n].b = i; + out[n].a = i; + } + return 0; +} + +PACK_FUNC(i4) +{ + uint8_t *out8 = out; + + unsigned sft = 4; + for (size_t n = 0; n < ntexels; n++, sft ^= 4) { + uint8_t g = texel_to_greyscale(in[n].r, in[n].g, in[n].b); + uint8_t i = (g >> 4) & 0xF; + if (sft == 4) + out8[n >> 1] = 0; + out8[n >> 1] |= i << sft; + } + return 0; +} + +/* I8 */ + +UNPACK_FUNC(i8) +{ + uint8_t *in8 = in; + + for (size_t n = 0; n < ntexels; n++) { + uint8_t i = in8[n]; + out[n].r = i; + out[n].g = i; + out[n].b = i; + out[n].a = i; + } + return 0; +} + +PACK_FUNC(i8) +{ + uint8_t *out8 = out; + + for (size_t n = 0; n < ntexels; n++) { + uint8_t i = texel_to_greyscale(in[n].r, in[n].g, in[n].b); + out8[n] = i; + } + return 0; +} + +struct texel_layout { + const char *name; + union { + int (*pack)(void *out, struct color *in, size_t ntexels); + int (*pack_ci)(void *out, uint8_t *in, size_t ntexels, size_t npal); + }; + union { + int (*unpack)(struct color *out, void *in, size_t ntexels); + int (*unpack_ci)(uint8_t *out, void *in, size_t ntexels, size_t npal); + }; +}; + +#define FMT_SIZ(fmt, siz) (((fmt) << 2) | (siz)) +struct texel_layout texel_layouts[32] = { + [FMT_SIZ(G_IM_FMT_RGBA, G_IM_SIZ_16b)] = { "rgba16", .pack = rgba16_pack, .unpack = rgba16_unpack, }, + [FMT_SIZ(G_IM_FMT_RGBA, G_IM_SIZ_32b)] = { "rgba32", .pack = rgba32_pack, .unpack = rgba32_unpack, }, + [FMT_SIZ(G_IM_FMT_CI, G_IM_SIZ_4b) ] = { "ci4", .pack_ci = ci4_pack, .unpack_ci = ci4_unpack, }, + [FMT_SIZ(G_IM_FMT_CI, G_IM_SIZ_8b) ] = { "ci8", .pack_ci = ci8_pack, .unpack_ci = ci8_unpack, }, + [FMT_SIZ(G_IM_FMT_IA, G_IM_SIZ_4b) ] = { "ia4", .pack = ia4_pack, .unpack = ia4_unpack, }, + [FMT_SIZ(G_IM_FMT_IA, G_IM_SIZ_8b) ] = { "ia8", .pack = ia8_pack, .unpack = ia8_unpack, }, + [FMT_SIZ(G_IM_FMT_IA, G_IM_SIZ_16b)] = { "ia16", .pack = ia16_pack, .unpack = ia16_unpack, }, + [FMT_SIZ(G_IM_FMT_I, G_IM_SIZ_4b) ] = { "i4", .pack = i4_pack, .unpack = i4_unpack, }, + [FMT_SIZ(G_IM_FMT_I, G_IM_SIZ_8b) ] = { "i8", .pack = i8_pack, .unpack = i8_unpack, }, +}; + +static int +n64texconv_data_sync(struct color *texels, uint8_t *color_indices, size_t ntexels, int fmt, int siz, size_t pal_count) +{ + assert(texels != NULL); + + void *temp = malloc(texel_size_bytes(ntexels, siz)); + if (temp == NULL) + return -1; + + struct texel_layout *layout = &texel_layouts[FMT_SIZ(fmt, siz)]; + assert(layout != NULL); + if (fmt == G_IM_FMT_CI) { + assert(color_indices != NULL); + layout->pack_ci(temp, color_indices, ntexels, pal_count); + layout->unpack_ci(color_indices, temp, ntexels, pal_count); + // TODO update texels from color indices too? + } else { + layout->pack(temp, texels, ntexels); + layout->unpack(texels, temp, ntexels); + } + + free(temp); + return 0; +} + + + +// ******************************************************************************************************************** +// Palette +// ******************************************************************************************************************** + +static int +n64texconv_palette_sync(struct n64_palette *pal) +{ + assert(pal != NULL); + return n64texconv_data_sync(pal->texels, NULL, pal->count, pal->fmt, G_IM_SIZ_16b, 0); +} + +struct n64_palette * +n64texconv_palette_new(size_t count, int fmt) +{ + if (fmt != G_IM_FMT_RGBA && fmt != G_IM_FMT_IA) + return NULL; + + struct n64_palette *pal = malloc(sizeof(struct n64_palette) + count * sizeof(struct color)); + if (pal == NULL) + return NULL; + + pal->texels = (struct color *)(pal + 1); + pal->fmt = fmt; + pal->count = count; + return pal; +} + +void +n64texconv_palette_free(struct n64_palette *pal) +{ + assert(pal != NULL); + free(pal); +} + +struct n64_palette * +n64texconv_palette_copy(struct n64_palette *pal) +{ + assert(pal != NULL); + // Create new palette + struct n64_palette *new_pal = n64texconv_palette_new(pal->count, pal->fmt); + if (new_pal == NULL) + return NULL; + + // Copy texels + memcpy(new_pal->texels, pal->texels, new_pal->count * sizeof(struct color)); + return new_pal; +} + +struct n64_palette * +n64texconv_palette_reformat(struct n64_palette *pal, int fmt) +{ + assert(pal != NULL); + + // If the target format and source format are the same, just copy + if (pal->fmt == fmt) + return n64texconv_palette_copy(pal); + + // Create new palette + struct n64_palette *new_pal = n64texconv_palette_new(pal->count, pal->fmt); + if (new_pal == NULL) + return NULL; + + n64texconv_palette_sync(new_pal); + return new_pal; +} + +struct n64_palette * +n64texconv_palette_from_png(const char *path, int fmt) +{ + assert(path != NULL); + + FILE *png = fopen(path, "rb"); + if (png == NULL) + return NULL; + + spng_ctx *ctx = spng_ctx_new(0); + assert(ctx != NULL); + + int rv; + rv = spng_set_png_file(ctx, png); + assert(rv == 0); + + size_t ntexels; + rv = spng_decoded_image_size(ctx, SPNG_FMT_RGBA8, &ntexels); + assert(rv == 0); + + struct n64_palette *pal = n64texconv_palette_new(ntexels, fmt); + if (pal == NULL) + return NULL; + + rv = spng_decode_image(ctx, (void *)pal->texels, ntexels, SPNG_FMT_RGBA8, 0); + assert(rv == 0); + for (size_t i = 0; i < ntexels; i++) { + pal->texels[i].w = htobe32(pal->texels[i].w); + } + + spng_ctx_free(ctx); + fclose(png); + + rv = n64texconv_palette_sync(pal); + assert(rv == 0); + return pal; +} + +struct n64_palette * +n64texconv_palette_from_bin(void *data, size_t count, int fmt) +{ + assert(data != NULL); + + // Reserve new palette + struct n64_palette *pal = n64texconv_palette_new(count, fmt); + if (pal == NULL) + return NULL; + + // Unpack data + // The format is always valid at this point since the above NULL check + // would be hit if an invalid palette format was passed in. + texel_layouts[FMT_SIZ(fmt, G_IM_SIZ_16b)].unpack(pal->texels, data, count); + return pal; +} + +int +n64texconv_palette_to_png(const char *outpath, struct n64_palette *pal) +{ + assert(outpath != NULL); + assert(pal != NULL); + + // Compute arbitrary dimensions for palette + size_t width, height; + palette_dim(pal->count, &width, &height); + + // Sync data to format + + int rv; + rv = n64texconv_palette_sync(pal); + assert(rv == 0); + + // Write texels + + struct spng_ctx *ctx = spng_ctx_new(SPNG_CTX_ENCODER); + if (ctx == NULL) + return -1; + + FILE *png = fopen(outpath, "wb"); + if (png == NULL) + return -2; + + rv = spng_set_png_file(ctx, png); + assert(rv == 0); + rv = spng_set_image_limits(ctx, width, height); + assert(rv == 0); + struct spng_ihdr ihdr = { + .width = width, + .height = height, + .bit_depth = 8, + .color_type = SPNG_COLOR_TYPE_TRUECOLOR_ALPHA, + .compression_method = 0, + .filter_method = 0, + .interlace_method = 0, + }; + rv = spng_set_ihdr(ctx, &ihdr); + assert(rv == 0); + rv = spng_encode_image(ctx, pal->texels, pal->count * sizeof(struct color), SPNG_FMT_PNG, SPNG_ENCODE_FINALIZE); + assert(rv == 0); + spng_ctx_free(ctx); + + fclose(png); + return 0; +} + +void * +n64texconv_palette_to_bin(struct n64_palette *pal, bool pad_to_8b) +{ + assert(pal != NULL); + + // Prepare output buffer + size_t size_unaligned = texel_size_bytes(pal->count, G_IM_SIZ_16b); + size_t size_aligned = ALIGN8(size_unaligned); + void *out = malloc(size_aligned); + if (out == NULL) + return NULL; + + // Pack into output format + assert(pal->fmt == G_IM_FMT_RGBA || pal->fmt == G_IM_FMT_IA); + texel_layouts[FMT_SIZ(pal->fmt, G_IM_SIZ_16b)].pack(out, pal->texels, pal->count); + + // Pad to 8-byte alignment if requested + if (pad_to_8b && size_aligned != size_unaligned) + memset((uint8_t *)out + size_unaligned, 0, size_aligned - size_unaligned); + + return out; +} + +int +n64texconv_palette_to_c(char **out, size_t *size_out, struct n64_palette *pal, bool pad_to_8b, unsigned int byte_width) +{ + assert(out != NULL); + assert(size_out != NULL); + assert(pal != NULL); + + size_t nbytes = texel_size_bytes(pal->count, G_IM_SIZ_16b); + void *bin = n64texconv_palette_to_bin(pal, pad_to_8b); + if (bin == NULL) + return -1; + nbytes = pad_to_8b ? ALIGN8(nbytes) : nbytes; + int rv = bin2c(out, size_out, bin, nbytes, 0, byte_width); + free(bin); + return rv; +} + +int +n64texconv_palette_to_c_file(const char *out_path, struct n64_palette *pal, bool pad_to_8b, unsigned int byte_width) +{ + assert(out_path != NULL); + assert(pal != NULL); + + size_t nbytes = texel_size_bytes(pal->count, G_IM_SIZ_16b); + void *bin = n64texconv_palette_to_bin(pal, pad_to_8b); + if (bin == NULL) + return -1; + nbytes = pad_to_8b ? ALIGN8(nbytes) : nbytes; + int rv = bin2c_file(out_path, bin, nbytes, 0, byte_width); + free(bin); + return rv; +} + + + +// ******************************************************************************************************************** +// Image +// ******************************************************************************************************************** + +static int +n64texconv_image_sync(struct n64_image *img) +{ + assert(img != NULL); + return n64texconv_data_sync(img->texels, img->color_indices, img->width * img->height, img->fmt, img->siz, + (img->pal != NULL) ? img->pal->count : 0); +} + +struct n64_image * +n64texconv_image_new(size_t width, size_t height, int fmt, int siz, struct n64_palette *pal) +{ + // TODO if fmt is CI, assert(pal != NULL) ? + if (fmt >= FMT_MAX || siz >= SIZ_MAX) + return NULL; + + size_t ntexels = width * height; + struct n64_image *img = malloc(sizeof(struct n64_image) + ntexels * (sizeof(struct color) + sizeof(uint8_t))); + if (img == NULL) + return NULL; + + struct color *texels = (void *)((uint8_t *)img + sizeof(struct n64_image)); + uint8_t *color_indices = (fmt == G_IM_FMT_CI) ? (uint8_t *)(texels + ntexels) : NULL; + + img->width = width; + img->height = height; + img->fmt = fmt; + img->siz = siz; + img->pal = pal; + img->texels = texels; + img->color_indices = color_indices; + return img; +} + +void +n64texconv_image_free(struct n64_image *img) +{ + assert(img != NULL); + free(img); +} + +struct n64_image * +n64texconv_image_copy(struct n64_image *img) +{ + if (img == NULL) + return NULL; + + // Create new image + struct n64_image *new_img = n64texconv_image_new(img->width, img->height, img->fmt, img->siz, img->pal); + if (new_img == NULL) + return NULL; + + // Copy texels/index data + size_t ntexels = new_img->width * new_img->height; + memcpy(new_img->texels, img->texels, ntexels * sizeof(struct color)); + if (img->fmt == G_IM_FMT_CI) // == new_img->fmt + memcpy(new_img->color_indices, img->color_indices, ntexels * sizeof(uint8_t)); + return new_img; +} + +/** + * Reads in the png image at `path`. + * + * For all choices of `fmt`, the png data is converted to a common RGBA32 format and stored that way, but may be + * subject to various edits described below. + * + * - If `fmt` is None (default), the best format and texel size are determined from the RGBA32 data, which is then + * processed accordingly (described below). + * + * - If `fmt` is RGBA, the RGBA32 texels are left as-is, with possible reduction if `siz` is 16-bit. + * + * - If `fmt` is greyscale (I or IA), the RGBA32 texels are converted to greyscale. If the texels were already + * greyscale this operation will leave them unaffected. + * + * - If `fmt` is CI and the png is an indexed png, the palette and indices in the png are saved in addition to the + * texels themselves. This is required for a roundtrip conversion of 'bin -> png -> file -> png -> bin' to match. + * + * - If `fmt` is CI and the png is not indexed, the image is quantized and a palette is generated automatically. + */ +struct n64_image * +n64texconv_image_from_png(const char *path, int fmt, int siz, int pal_fmt) +{ + assert(path != NULL); + + FILE *png = fopen(path, "rb"); + if (png == NULL) + return NULL; // Input file not found + + spng_ctx *ctx = spng_ctx_new(0); + int rv = spng_set_png_file(ctx, png); + assert(rv == 0); + + struct spng_ihdr ihdr; + rv = spng_get_ihdr(ctx, &ihdr); + assert(rv == 0); + + size_t nbytes; + rv = spng_decoded_image_size(ctx, SPNG_FMT_RGBA8, &nbytes); + assert(rv == 0); + + uint32_t width = ihdr.width; + uint32_t height = ihdr.height; + + struct n64_image *img = n64texconv_image_new(width, height, fmt, siz, NULL); + if (img == NULL) + goto error_post_open_png; + + struct n64_palette *pal = NULL; + + if (fmt == G_IM_FMT_CI) { + assert(siz == G_IM_SIZ_4b || siz == G_IM_SIZ_8b); + assert(pal_fmt != FMT_NONE); + + size_t max_colors = (siz == G_IM_SIZ_8b) ? 256 : 16; + + if (ihdr.color_type == SPNG_COLOR_TYPE_INDEXED) { + // Input is an indexed png, obtain palette and color indices + struct spng_plte plte; + rv = spng_get_plte(ctx, &plte); + assert(rv == 0); // must have a palette chunk if it's indexed + + // Palette should not have 0 entries + if (plte.n_entries == 0) + goto error_post_create_img; + + // Palette must have sufficiently few colors for the target format. If there are too + // many, requantize to the maximum amount for the target format. + if (plte.n_entries > max_colors) + goto requantize; + + pal = n64texconv_palette_new(plte.n_entries, pal_fmt); + if (pal == NULL) + goto error_post_create_img; + + struct spng_trns trns; + rv = spng_get_trns(ctx, &trns); + if (rv == 0) { + // Read palette transparency from here + assert(trns.n_type3_entries == plte.n_entries); + for (size_t i = 0; i < plte.n_entries; i++) { + pal->texels[i].r = plte.entries[i].red; + pal->texels[i].g = plte.entries[i].green; + pal->texels[i].b = plte.entries[i].blue; + pal->texels[i].a = trns.type3_alpha[i]; + } + } else { + // Treat as opaque if trns is not present + for (size_t i = 0; i < plte.n_entries; i++) { + pal->texels[i].r = plte.entries[i].red; + pal->texels[i].g = plte.entries[i].green; + pal->texels[i].b = plte.entries[i].blue; + pal->texels[i].a = 0xFF; + } + } + + // Fill color indices + size_t nidxbytes; + rv = spng_decoded_image_size(ctx, SPNG_FMT_RAW, &nidxbytes); + assert(rv == 0); + assert(nidxbytes * 4 == nbytes); + rv = spng_decode_image(ctx, (void *)img->color_indices, nidxbytes, SPNG_FMT_RAW, 0); + assert(rv == 0); + } else { + // Input is not an indexed png, quantize and generate palette + + requantize: // Input is an indexed png but has too many colors, requantize with new palette + + rv = spng_decode_image(ctx, (void *)img->texels, nbytes, SPNG_FMT_RGBA8, 0); + assert(rv == 0); + + pal = n64texconv_palette_new(max_colors, pal_fmt); + if (pal == NULL) + goto error_post_create_img; + + n64texconv_quantize(img->color_indices, pal->texels, &pal->count, img->texels, width, height, max_colors, + 0.5f); + } + + // Populate texels from color indices and palette + for (size_t i = 0; i < width * height; i++) + img->texels[i] = pal->texels[img->color_indices[i]]; + } else { + rv = spng_decode_image(ctx, (void *)img->texels, nbytes, SPNG_FMT_RGBA8, 0); + assert(rv == 0); + } + spng_ctx_free(ctx); + fclose(png); + + img->pal = pal; + + n64texconv_image_sync(img); + return img; + +error_post_create_img: + n64texconv_image_free(img); +error_post_open_png: + spng_ctx_free(ctx); + fclose(png); + return NULL; +} + +struct n64_image * +n64texconv_image_from_bin(void *data, size_t width, size_t height, int fmt, int siz, struct n64_palette *pal, + bool preswapped) +{ + assert(data != NULL); + assert((fmt == G_IM_FMT_CI && pal != NULL) || (fmt != G_IM_FMT_CI && pal == NULL)); + + size_t ntexels = width * height; + struct n64_image *img = n64texconv_image_new(width, height, fmt, siz, pal); + if (img == NULL) + return NULL; + + if (preswapped) { + // TODO unswap data + } + + struct texel_layout *layout = &texel_layouts[FMT_SIZ(fmt, siz)]; + assert(layout != NULL); + + if (fmt == G_IM_FMT_CI) { + layout->unpack_ci(img->color_indices, data, ntexels, img->pal->count); + for (size_t i = 0; i < ntexels; i++) + img->texels[i].w = pal->texels[img->color_indices[i]].w; + } else { + layout->unpack(img->texels, data, ntexels); + } + return img; +} + +/** + * Given an existing image, create a new image with the new format and size. + * + * This operation is very often a lossy process, do not expect matching round-trips through reformat; depending on the + * target format quality is often lost, sometimes severely. + * + * This process is typically for converting truecolor png to the optimal N64 format if the format was left unspecified + * when reading in the png, in a matching context the format should always be explicitly specified so that no + * reformatting is done. + */ +struct n64_image * +n64texconv_image_reformat(struct n64_image *img, int fmt, int siz, struct n64_palette *new_pal) +{ + assert(img != NULL); + + if (fmt == FMT_NONE || siz == SIZ_NONE) { + // TODO determine optimal format for data + } + + size_t width = img->width; + size_t height = img->height; + size_t ntexels = width * height; + + struct n64_image *new_img = n64texconv_image_new(width, height, fmt, siz, NULL); + if (new_img == NULL) + return NULL; + + bool src_ci = img->fmt == G_IM_FMT_CI; + bool dst_ci = fmt == G_IM_FMT_CI; + bool siz_changed = siz != img->siz; + + if (dst_ci && (!src_ci || siz_changed)) { + // Converting non-CI to CI, or CI->CI of different size + + size_t max_colors = (siz == G_IM_SIZ_8b) ? 256 : 16; + + // Set color indices pointer if coming from non-CI + if (new_img->color_indices == NULL) + new_img->color_indices = (void *)(new_img->texels + ntexels); + + if (new_pal != NULL) { + // Use the provided new palette + new_img->pal = new_pal; + + // Make sure the new palette is of an appropriate size for the bit depth + if (new_pal->count > max_colors) { + n64texconv_image_free(new_img); + return NULL; + } + + // Map to the palette + for (size_t i = 0; i < width * height; i++) { + for (size_t j = 0; j < new_pal->count; j++) { + if (new_img->texels[i].w == new_pal->texels[j].w) { + new_img->color_indices[i] = j; + goto got; + } + } + // Failed to find texel in palette + n64texconv_image_free(new_img); + return NULL; + got:; + } + } else { + // Generate a new palette + struct n64_palette *pal = n64texconv_palette_new(max_colors, G_IM_FMT_RGBA); // TODO IA palettes + if (pal == NULL) { + n64texconv_image_free(new_img); + return NULL; + } + new_img->pal = pal; + + // Quantize and fill color indices + n64texconv_quantize(new_img->color_indices, pal->texels, &pal->count, new_img->texels, width, height, + max_colors, 0.5f); + // Replace old texels + for (size_t i = 0; i < width * height; i++) { + new_img->texels[i] = pal->texels[new_img->color_indices[i]]; + } + } + } else { + // Copy texels + memcpy(new_img->texels, img->texels, ntexels * sizeof(struct color)); + if (dst_ci) + memcpy(new_img->color_indices, img->color_indices, ntexels * sizeof(uint8_t)); + } + + // Invalidate color indices if non-CI + if (!dst_ci) + new_img->color_indices = NULL; + + // Sync texels to format + n64texconv_image_sync(new_img); + //#pragma GCC diagnostic push + //#pragma GCC diagnostic ignored "-Wanalyzer-malloc-leak" + // Annoyingly the GCC static analyzer considers pal to be leaked here, but it's reachable by the assignment + // to new_img... + return new_img; + //#pragma GCC diagnostic pop +} + +/** + * Writes this texture out to a png file. If this texture is CI and was read in from binary or from an indexed png it + * will preserve the color indices and palette of the original if it has not since been reformatted in order to + * facilitate matching in a roundtrip of 'bin -> png -> file -> png -> bin'. + */ +int +n64texconv_image_to_png(const char *outpath, struct n64_image *img, bool intensity_alpha) +{ + assert(outpath != NULL); + assert(img != NULL); + + // For intensity images, we don't always want to write alpha (but sometimes we do), intensity images can be either + // RGB channel or Alpha channel but often not both. The `intensity_alpha` option determines whether to write PNGs + // with or without alpha, both will roundtrip identically. + bool has_alpha = (img->fmt != G_IM_FMT_I) || intensity_alpha; + + size_t ntexels = img->width * img->height; + + if (img->fmt == G_IM_FMT_CI) { + assert(img->color_indices != NULL); // CI textures must have color indices + assert(img->pal != NULL); // Writing CI to png must have a palette supplied + n64texconv_palette_sync(img->pal); + } + + // Ensure output is visually precise + n64texconv_image_sync(img); + + // Write the png, either truecolor or indexed + + FILE *png = fopen(outpath, "wb"); + if (png == NULL) + return -1; + struct spng_ctx *ctx = spng_ctx_new(SPNG_CTX_ENCODER); + int rv = spng_set_png_file(ctx, png); + assert(rv == 0); + rv = spng_set_image_limits(ctx, img->width, img->height); + assert(rv == 0); + + uint8_t color_type; + if (img->fmt == G_IM_FMT_CI) { + color_type = SPNG_COLOR_TYPE_INDEXED; + } else { + color_type = (has_alpha) ? SPNG_COLOR_TYPE_TRUECOLOR_ALPHA : SPNG_COLOR_TYPE_TRUECOLOR; + } + + struct spng_ihdr ihdr = { + .width = img->width, + .height = img->height, + .bit_depth = 8, + .color_type = color_type, + .compression_method = 0, + .filter_method = 0, + .interlace_method = 0, + }; + rv = spng_set_ihdr(ctx, &ihdr); + assert(rv == 0); + + if (img->fmt == G_IM_FMT_CI) { + struct n64_palette *pal = img->pal; + assert(pal != NULL); + + // Ensure palette is visually precise + rv = n64texconv_palette_sync(pal); + assert(rv == 0); + + // Write palette + struct spng_plte plte = { 0 }; + plte.n_entries = pal->count; + assert(pal->count <= 256); + memcpy(plte.entries, pal->texels, pal->count * 4); + rv = spng_set_plte(ctx, &plte); + assert(rv == 0); + + // Write palette alphas + struct spng_trns trns = { 0 }; + trns.n_type3_entries = pal->count; + for (size_t i = 0; i < pal->count; i++) { + trns.type3_alpha[i] = pal->texels[i].a; + } + rv = spng_set_trns(ctx, &trns); + assert(rv == 0); + + // Write color indices + rv = spng_encode_image(ctx, img->color_indices, ntexels * sizeof(uint8_t), SPNG_FMT_PNG, SPNG_ENCODE_FINALIZE); + assert(rv == 0); + } else { + void *out = img->texels; + size_t outsize = ntexels * sizeof(struct color); + if (!has_alpha) { + uint8_t *rgb = malloc(ntexels * 3); + assert(rgb != NULL); + size_t j = 0; + for (size_t i = 0; i < ntexels; i++) { + rgb[j++] = img->texels[i].r; + rgb[j++] = img->texels[i].g; + rgb[j++] = img->texels[i].b; + } + out = rgb; + outsize = ntexels * 3; + } + // Write texels + rv = spng_encode_image(ctx, out, outsize, SPNG_FMT_PNG, SPNG_ENCODE_FINALIZE); + assert(rv == 0); + if (!has_alpha) + free(out); + } + + spng_ctx_free(ctx); + fclose(png); + + return 0; +} + +void * +n64texconv_image_to_bin(struct n64_image *img, bool pad_to_8b, bool preswap) +{ + assert(img != NULL); + + size_t ntexels = img->width * img->height; + int fmt = img->fmt; + int siz = img->siz; + + // Reserve output buffer + size_t size_bytes = texel_size_bytes(ntexels, siz); + size_t size_bytes_aligned = ALIGN8(size_bytes); + void *out = malloc(size_bytes_aligned); + if (out == NULL) + return NULL; + + // Pack into output format + struct texel_layout *layout = &texel_layouts[FMT_SIZ(fmt, siz)]; + assert(layout != NULL); + if (fmt == G_IM_FMT_CI) { + assert(img->pal != NULL); + layout->pack_ci(out, img->color_indices, ntexels, img->pal->count); + } else { + assert(img->pal == NULL); + layout->pack(out, img->texels, ntexels); + } + + // Pad to 8-byte alignment if requested + if (pad_to_8b && size_bytes != size_bytes_aligned) { + memset((uint8_t *)out + size_bytes, 0, size_bytes_aligned - size_bytes); + } + + // Perform dxt=0 word swapping if requested + if (preswap) { + // TODO implement preswap + } + + return out; +} + +int +n64texconv_image_to_c(char **out, size_t *size_out, struct n64_image *img, bool pad_to_8b, bool preswap, + unsigned int byte_width) +{ + assert(out != NULL); + assert(size_out != NULL); + assert(img != NULL); + + size_t nbytes = texel_size_bytes(img->width * img->height, img->siz); + void *bin = n64texconv_image_to_bin(img, pad_to_8b, preswap); + if (bin == NULL) + return -1; + nbytes = pad_to_8b ? ALIGN8(nbytes) : nbytes; + int rv = bin2c(out, size_out, bin, nbytes, 0, byte_width); + free(bin); + return rv; +} + +int +n64texconv_image_to_c_file(const char *out_path, struct n64_image *img, bool pad_to_8b, bool preswap, + unsigned int byte_width) +{ + assert(out_path != NULL); + assert(img != NULL); + + size_t nbytes = texel_size_bytes(img->width * img->height, img->siz); + void *bin = n64texconv_image_to_bin(img, pad_to_8b, preswap); + if (bin == NULL) + return -1; + nbytes = pad_to_8b ? ALIGN8(nbytes) : nbytes; + int rv = bin2c_file(out_path, bin, nbytes, 0, byte_width); + free(bin); + return rv; +} + + + +// ******************************************************************************************************************** +// Others +// ******************************************************************************************************************** + +const char * +n64texconv_png_extension(struct n64_image *img) +{ + assert(img != NULL); + + struct texel_layout *layout = &texel_layouts[FMT_SIZ(img->fmt, img->siz)]; + assert(layout != NULL); + return layout->name; +} + +/* This is just for the python interface */ +void +n64texconv_free(void *p) +{ + assert(p != NULL); + free(p); +} diff --git a/tools/assets/n64texconv/src/libn64texconv/n64texconv.h b/tools/assets/n64texconv/src/libn64texconv/n64texconv.h new file mode 100644 index 0000000000..0c6476e3aa --- /dev/null +++ b/tools/assets/n64texconv/src/libn64texconv/n64texconv.h @@ -0,0 +1,127 @@ +/* SPDX-FileCopyrightText: Copyright (C) 2025 ZeldaRET */ +/* SPDX-License-Identifier: MIT */ +#ifndef N64TEXCONV_H +#define N64TEXCONV_H + +#include +#include +#include + +#define FMT_NONE -1 +#define FMT_MAX 5 +#define G_IM_FMT_RGBA 0 +#define G_IM_FMT_YUV 1 +#define G_IM_FMT_CI 2 +#define G_IM_FMT_IA 3 +#define G_IM_FMT_I 4 + +#define SIZ_NONE -1 +#define SIZ_MAX 4 +#define G_IM_SIZ_4b 0 +#define G_IM_SIZ_8b 1 +#define G_IM_SIZ_16b 2 +#define G_IM_SIZ_32b 3 + +struct color { + union { + struct { + uint8_t r, g, b, a; + }; + uint32_t w; + }; +}; + +static inline __attribute__((always_inline)) size_t +texel_size_bytes(size_t ntexels, int siz) +{ + return (siz == G_IM_SIZ_4b) ? (ntexels / 2) : (ntexels * ((1 << (unsigned)siz) >> 1)); +} + +struct n64_palette { + struct color *texels; + int fmt; + size_t count; +}; + +struct n64_palette * +n64texconv_palette_new(size_t count, int fmt); + +void +n64texconv_palette_free(struct n64_palette *pal); + +struct n64_palette * +n64texconv_palette_copy(struct n64_palette *pal); + +struct n64_palette * +n64texconv_palette_reformat(struct n64_palette *pal, int fmt); + +struct n64_palette * +n64texconv_palette_from_png(const char *path, int fmt); + +struct n64_palette * +n64texconv_palette_from_bin(void *data, size_t count, int fmt); + +int +n64texconv_palette_to_png(const char *outpath, struct n64_palette *pal); + +void * +n64texconv_palette_to_bin(struct n64_palette *pal, bool pad_to_8b); + +int +n64texconv_palette_to_c(char **out, size_t *size_out, struct n64_palette *pal, bool pad_to_8b, unsigned int byte_width); + +int +n64texconv_palette_to_c_file(const char *out_path, struct n64_palette *pal, bool pad_to_8b, unsigned int byte_width); + +struct n64_image { + size_t width; + size_t height; + int fmt; + int siz; + struct n64_palette *pal; + struct color *texels; + uint8_t *color_indices; +}; + +struct n64_image * +n64texconv_image_new(size_t width, size_t height, int fmt, int siz, struct n64_palette *pal); + +void +n64texconv_image_free(struct n64_image *img); + +struct n64_image * +n64texconv_image_copy(struct n64_image *img); + +struct n64_image * +n64texconv_image_from_png(const char *path, int fmt, int siz, int pal_fmt); + +struct n64_image * +n64texconv_image_from_bin(void *data, size_t width, size_t height, int fmt, int siz, struct n64_palette *pal, + bool preswapped); + +struct n64_image * +n64texconv_image_reformat(struct n64_image *img, int fmt, int siz, struct n64_palette *pal); + +int +n64texconv_image_to_png(const char *outpath, struct n64_image *img, bool intensity_alpha); + +void * +n64texconv_image_to_bin(struct n64_image *img, bool pad_to_8b, bool preswap); + +int +n64texconv_image_to_c(char **out, size_t *size_out, struct n64_image *img, bool pad_to_8b, bool preswap, + unsigned int byte_width); + +int +n64texconv_image_to_c_file(const char *out_path, struct n64_image *img, bool pad_to_8b, bool preswap, + unsigned int byte_width); + +const char * +n64texconv_png_extension(struct n64_image *img); + +int +n64texconv_quantize_shared(uint8_t **out_indices, struct color *out_pal, size_t *out_pal_count, struct color **texels, + size_t *widths, size_t *heights, size_t num_images, unsigned int max_colors, + float dither_level); + +#endif diff --git a/tools/audio/extraction/audio_extract.py b/tools/audio/extraction/audio_extract.py index 29bf632e3a..a524312be1 100644 --- a/tools/audio/extraction/audio_extract.py +++ b/tools/audio/extraction/audio_extract.py @@ -49,7 +49,7 @@ BASEROM_DEBUG = False # Run # ====================================================================================================================== -def collect_sample_banks(audiotable_seg : memoryview, extracted_dir : str, version_info : GameVersionInfo, +def collect_sample_banks(audiotable_seg : memoryview, output_dir : str, version_info : GameVersionInfo, table : AudioCodeTable, samplebank_descs : Dict[int, SampleBankExtractionDescription]): sample_banks : List[Union[AudioTableFile, int]] = [] @@ -76,7 +76,7 @@ def collect_sample_banks(audiotable_seg : memoryview, extracted_dir : str, versi extraction_desc=samplebank_descs.get(i, None)) if BASEROM_DEBUG: - bank.dump_bin(f"{extracted_dir}/baserom_audiotest/audiotable_files/{bank.file_name}.bin") + bank.dump_bin(f"{output_dir}/baserom_audiotest/audiotable_files/{bank.file_name}.bin") sample_banks.append(bank) @@ -90,7 +90,7 @@ def bank_data_lookup(sample_banks : List[Union[AudioTableFile, int]], e : Union[ else: return e -def collect_soundfonts(audiobank_seg : memoryview, extracted_dir : str, version_info : GameVersionInfo, +def collect_soundfonts(audiobank_seg : memoryview, output_dir : str, version_info : GameVersionInfo, sound_font_table : AudioCodeTable, soundfont_descs : Dict[int, SoundFontExtractionDescription], sample_banks : List[Union[AudioTableFile, int]]): soundfonts = [] @@ -110,7 +110,7 @@ def collect_soundfonts(audiobank_seg : memoryview, extracted_dir : str, version_ if BASEROM_DEBUG: # Write the individual file for debugging and comparison - soundfont.dump_bin(f"{extracted_dir}/baserom_audiotest/audiobank_files/{soundfont.file_name}.bin") + soundfont.dump_bin(f"{output_dir}/baserom_audiotest/audiobank_files/{soundfont.file_name}.bin") return soundfonts @@ -133,17 +133,17 @@ def aifc_extract_one_bin(base_path : str, sample : AudioTableData): else: sample.to_file(f"{base_path}/{sample.filename}") -def extract_samplebank(pool : ThreadPool, extracted_dir : str, sample_banks : List[Union[AudioTableFile, int]], +def extract_samplebank(pool : ThreadPool, output_dir : str, sample_banks : List[Union[AudioTableFile, int]], bank : AudioTableFile, write_xml : bool): # deal with remaining gaps, have to blob them unless we can find an exact match in another bank bank.finalize_coverage(sample_banks) # assign names bank.assign_names() - base_path = f"{extracted_dir}/assets/audio/samples/{bank.name}" + base_path = f"{output_dir}/assets/audio/samples/{bank.name}" # write xml - with open(f"{extracted_dir}/assets/audio/samplebanks/{bank.file_name}.xml", "w") as outfile: + with open(f"{output_dir}/assets/audio/samplebanks/{bank.file_name}.xml", "w") as outfile: outfile.write(bank.to_xml(f"assets/audio/samples/{bank.name}")) # write the extraction xml if specified @@ -175,17 +175,17 @@ def extract_samplebank(pool : ThreadPool, extracted_dir : str, sample_banks : Li if not BASEROM_DEBUG: shutil.rmtree(f"{base_path}/aifc") -def disassemble_one_sequence(extracted_dir : str, version_info : GameVersionInfo, soundfonts : List[AudiobankFile], +def disassemble_one_sequence(output_dir : str, version_info : GameVersionInfo, soundfonts : List[AudiobankFile], enum_names : List[str], id : int, data : bytes, name : str, filename : str, fonts : memoryview): - out_filename = f"{extracted_dir}/assets/audio/sequences/{filename}.seq" + out_filename = f"{output_dir}/assets/audio/sequences/{filename}.seq" disas = SequenceDisassembler(id, data, version_info.seq_disas_tables.get(id, None), CMD_SPEC, version_info.mml_version, out_filename, name, [soundfonts[i] for i in fonts], enum_names) disas.analyze() disas.emit() -def extract_sequences(audioseq_seg : memoryview, extracted_dir : str, version_info : GameVersionInfo, write_xml : bool, +def extract_sequences(audioseq_seg : memoryview, output_dir : str, version_info : GameVersionInfo, write_xml : bool, sequence_table : AudioCodeTable, sequence_font_table : memoryview, sequence_descs : Dict[int, SequenceExtractionDescription], soundfonts : List[AudiobankFile]): @@ -198,9 +198,9 @@ def extract_sequences(audioseq_seg : memoryview, extracted_dir : str, version_in assert len(seq_enum_names) == len(sequence_table) if BASEROM_DEBUG: - os.makedirs(f"{extracted_dir}/baserom_audiotest/audioseq_files", exist_ok=True) + os.makedirs(f"{output_dir}/baserom_audiotest/audioseq_files", exist_ok=True) - os.makedirs(f"{extracted_dir}/assets/audio/sequences", exist_ok=True) + os.makedirs(f"{output_dir}/assets/audio/sequences", exist_ok=True) if write_xml: os.makedirs(f"assets/xml/audio/sequences", exist_ok=True) @@ -235,7 +235,7 @@ def extract_sequences(audioseq_seg : memoryview, extracted_dir : str, version_in if BASEROM_DEBUG: # Extract original sequence binary for comparison - with open(f"{extracted_dir}/baserom_audiotest/audioseq_files/seq_{i}{ext}.aseq", "wb") as outfile: + with open(f"{output_dir}/baserom_audiotest/audioseq_files/seq_{i}{ext}.aseq", "wb") as outfile: outfile.write(seq_data) extraction_desc = sequence_descs.get(i, None) @@ -301,12 +301,12 @@ def extract_sequences(audioseq_seg : memoryview, extracted_dir : str, version_in # Disassemble to text for job in disas_jobs: - disassemble_one_sequence(extracted_dir, version_info, soundfonts, seq_enum_names, *job) + disassemble_one_sequence(output_dir, version_info, soundfonts, seq_enum_names, *job) dt = time.time() - t print(f"Sequences extraction took {dt:.3f}s") -def extract_audio_for_version(version_info : GameVersionInfo, extracted_dir : str, read_xml : bool, write_xml : bool): +def extract_audio_for_version(version_info : GameVersionInfo, output_dir : str, baserom_segments_dir : str, read_xml : bool, write_xml : bool): print("Setting up...") # Open baserom segments @@ -316,16 +316,16 @@ def extract_audio_for_version(version_info : GameVersionInfo, extracted_dir : st audiobank_seg = None audioseq_seg = None - with open(f"{extracted_dir}/baserom/code", "rb") as infile: + with open(f"{baserom_segments_dir}/code", "rb") as infile: code_seg = memoryview(infile.read()) - with open(f"{extracted_dir}/baserom/Audiotable", "rb") as infile: + with open(f"{baserom_segments_dir}/Audiotable", "rb") as infile: audiotable_seg = memoryview(infile.read()) - with open(f"{extracted_dir}/baserom/Audiobank", "rb") as infile: + with open(f"{baserom_segments_dir}/Audiobank", "rb") as infile: audiobank_seg = memoryview(infile.read()) - with open(f"{extracted_dir}/baserom/Audioseq", "rb") as infile: + with open(f"{baserom_segments_dir}/Audioseq", "rb") as infile: audioseq_seg = memoryview(infile.read()) # ================================================================================================================== @@ -342,18 +342,18 @@ def extract_audio_for_version(version_info : GameVersionInfo, extracted_dir : st if BASEROM_DEBUG: # Extract Table Binaries - os.makedirs(f"{extracted_dir}/baserom_audiotest/audio_code_tables/", exist_ok=True) + os.makedirs(f"{output_dir}/baserom_audiotest/audio_code_tables/", exist_ok=True) - with open(f"{extracted_dir}/baserom_audiotest/audio_code_tables/samplebank_table.bin", "wb") as outfile: + with open(f"{output_dir}/baserom_audiotest/audio_code_tables/samplebank_table.bin", "wb") as outfile: outfile.write(sample_bank_table.data) - with open(f"{extracted_dir}/baserom_audiotest/audio_code_tables/soundfont_table.bin", "wb") as outfile: + with open(f"{output_dir}/baserom_audiotest/audio_code_tables/soundfont_table.bin", "wb") as outfile: outfile.write(sound_font_table.data) - with open(f"{extracted_dir}/baserom_audiotest/audio_code_tables/sequence_table.bin", "wb") as outfile: + with open(f"{output_dir}/baserom_audiotest/audio_code_tables/sequence_table.bin", "wb") as outfile: outfile.write(sequence_table.data) - with open(f"{extracted_dir}/baserom_audiotest/audio_code_tables/sequence_font_table.bin", "wb") as outfile: + with open(f"{output_dir}/baserom_audiotest/audio_code_tables/sequence_font_table.bin", "wb") as outfile: outfile.write(sequence_font_table) # ================================================================================================================== @@ -384,16 +384,16 @@ def extract_audio_for_version(version_info : GameVersionInfo, extracted_dir : st # ================================================================================================================== if BASEROM_DEBUG: - os.makedirs(f"{extracted_dir}/baserom_audiotest/audiotable_files", exist_ok=True) - sample_banks = collect_sample_banks(audiotable_seg, extracted_dir, version_info, sample_bank_table, samplebank_descs) + os.makedirs(f"{output_dir}/baserom_audiotest/audiotable_files", exist_ok=True) + sample_banks = collect_sample_banks(audiotable_seg, output_dir, version_info, sample_bank_table, samplebank_descs) # ================================================================================================================== # Collect soundfonts # ================================================================================================================== if BASEROM_DEBUG: - os.makedirs(f"{extracted_dir}/baserom_audiotest/audiobank_files", exist_ok=True) - soundfonts = collect_soundfonts(audiobank_seg, extracted_dir, version_info, sound_font_table, soundfont_descs, + os.makedirs(f"{output_dir}/baserom_audiotest/audiobank_files", exist_ok=True) + soundfonts = collect_soundfonts(audiobank_seg, output_dir, version_info, sound_font_table, soundfont_descs, sample_banks) # ================================================================================================================== @@ -413,14 +413,14 @@ def extract_audio_for_version(version_info : GameVersionInfo, extracted_dir : st # Check that the sampleconv binary is available assert os.path.isfile(SAMPLECONV_PATH) , "Compile sampleconv" - os.makedirs(f"{extracted_dir}/assets/audio/samplebanks", exist_ok=True) + os.makedirs(f"{output_dir}/assets/audio/samplebanks", exist_ok=True) if write_xml: os.makedirs(f"assets/xml/audio/samplebanks", exist_ok=True) with ThreadPool(processes=os.cpu_count()) as pool: for bank in sample_banks: if isinstance(bank, AudioTableFile): - extract_samplebank(pool, extracted_dir, sample_banks, bank, write_xml) + extract_samplebank(pool, output_dir, sample_banks, bank, write_xml) # ================================================================================================================== # Extract soundfonts @@ -428,7 +428,7 @@ def extract_audio_for_version(version_info : GameVersionInfo, extracted_dir : st print("Extracting soundfonts...") - os.makedirs(f"{extracted_dir}/assets/audio/soundfonts", exist_ok=True) + os.makedirs(f"{output_dir}/assets/audio/soundfonts", exist_ok=True) if write_xml: os.makedirs(f"assets/xml/audio/soundfonts", exist_ok=True) @@ -441,7 +441,7 @@ def extract_audio_for_version(version_info : GameVersionInfo, extracted_dir : st sf.finalize() # write the soundfont xml itself - with open(f"{extracted_dir}/assets/audio/soundfonts/{sf.file_name}.xml", "w") as outfile: + with open(f"{output_dir}/assets/audio/soundfonts/{sf.file_name}.xml", "w") as outfile: outfile.write(sf.to_xml(f"Soundfont_{i}", "assets/audio/samplebanks")) # write the extraction xml if specified @@ -454,5 +454,5 @@ def extract_audio_for_version(version_info : GameVersionInfo, extracted_dir : st print("Extracting sequences...") - extract_sequences(audioseq_seg, extracted_dir, version_info, write_xml, sequence_table, sequence_font_table, + extract_sequences(audioseq_seg, output_dir, version_info, write_xml, sequence_table, sequence_font_table, sequence_descs, soundfonts) diff --git a/tools/bin2c.c b/tools/bin2c.c new file mode 100644 index 0000000000..3faa3be54c --- /dev/null +++ b/tools/bin2c.c @@ -0,0 +1,174 @@ +/* SPDX-FileCopyrightText: (C) 2025 ZeldaRET */ +/* SPDX-License-Identifier: MIT */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "endian.h" + +#define NORETURN __attribute__((noreturn)) + +static void NORETURN +verror(const char *fmt, va_list args) +{ + fputs("\x1b[91merror\x1b[97m: ", stderr); + vfprintf(stderr, fmt, args); + fputs("\x1b[0m", stderr); + exit(EXIT_FAILURE); +} + +static void NORETURN +error(const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + verror(fmt, args); + va_end(args); +} + +static void NORETURN +error_post_open(const char *path_to_rm, FILE *file_to_rm, const char *fmt, ...) +{ + // cleanup output file + fclose(file_to_rm); + if (remove(path_to_rm) != 0) + fprintf(stderr, "error calling remove(): %s", strerror(errno)); + + // error as normal + va_list args; + va_start(args, fmt); + verror(fmt, args); + va_end(args); +} + +static void NORETURN +usage(const char *progname) +{ + fprintf(stderr, + "usage: %s -t [-pad] input.bin output.inc.c" "\n" + " fmt must be one of { 1, 2, 4, 8 }" "\n" + " if pad, align to fmt by filling with 0s, otherwise error if input is not aligned" "\n", + progname); + exit(EXIT_FAILURE); +} + +#define BYTES_PER_ROW 32 +#define LINE_MASK (BYTES_PER_ROW - 1) + +int +main(int argc, char **argv) +{ + const char *progname = argv[0]; + const char *inpath = NULL; + const char *outpath = NULL; + const char *fmt_opt = NULL; + int fmt = 0; + bool pad = false; + + // Collect arguments + + int narg = 0; + for (int i = 1; i < argc; i++) { + if (argv[i][0] == '-') { + if (strcmp(argv[i], "-t") == 0) { + if (++i == argc) + usage(progname); + fmt_opt = argv[i]; + char *end; + fmt = strtol(argv[i], &end, 10); + if (end != &argv[i][strlen(argv[i])]) + error("Invalid base 10 integer %s\n", argv[i]); + } else if (strcmp(argv[i], "-pad") == 0) { + pad = true; + } else { + usage(progname); + } + } else { + switch (narg) { + case 0: + inpath = argv[i]; + break; + case 1: + outpath = argv[i]; + break; + default: + usage(progname); + break; + } + narg++; + } + } + + // Check arguments + + if (inpath == NULL || outpath == NULL || fmt_opt == NULL) + usage(progname); + + if (fmt != 1 && fmt != 2 && fmt != 4 && fmt != 8) + error("Invalid fmt option '%s'. Valid options: [1, 2, 4, 8]\n", fmt_opt); + + // Open the input binary file + + FILE *infile = fopen(inpath, "rb"); + if (infile == NULL) + error("Failed to open input file '%s' for reading: %s\n", inpath, strerror(errno)); + + // Get size + + if (fseek(infile, 0, SEEK_END) != 0) + error("Could not ascertain input file size, could not seek to end: %s\n", strerror(errno)); + size_t file_size = ftell(infile); + if (fseek(infile, 0, SEEK_SET) != 0) + error("Could not ascertain input file size, could not seek to start: %s\n", strerror(errno)); + + // Check alignment + + if ((file_size & (fmt - 1)) != 0 && !pad) { + // Not aligned to data size and don't pad, error + error("Input file '%s' size (%lu) is not aligned to %d bytes\n", inpath, file_size, fmt); + } + + // Open the output text file + + FILE *outfile = fopen(outpath, "w"); + if (outfile == NULL) + error("Failed to open output file '%s' for writing: %s\n", outpath, strerror(errno)); + + // Write data. If the input binary size was not aligned we either don't get this far or the option + // to pad with 0s is set. + + bool was_newline = false; + for (size_t p = 0; p < file_size; p += fmt) { + size_t rem = fmt; + if (rem > file_size - p) // For any remaining unaligned data, rest will be padded with 0 + rem = file_size - p; + + // Read input + uint64_t d = 0; + if (fread(&d, 1, rem, infile) != rem) + error_post_open(outpath, outfile, "Error reading from input file '%s': %s\n", inpath, strerror(errno)); + + // Byteswap + shift + d = be64toh(d) >> (64 - 8 * fmt); + + // Write output + bool was_newline = (((p + fmt) & LINE_MASK) == 0); + char end = was_newline ? '\n' : ' '; + if (fprintf(outfile, "0x%0*" PRIX64 ",%c", 2 * fmt, d, end) < 0) + error_post_open(outpath, outfile, "Error writing to output file '%s': %s\n", outpath, strerror(errno)); + } + if (!was_newline) { + if (fputs("\n", outfile) == EOF) + error_post_open(outpath, outfile, "Error writing to output file '%s': %s\n", outpath, strerror(errno)); + } + + fclose(infile); + fclose(outfile); + return EXIT_SUCCESS; +} diff --git a/tools/com-plugin/.gitrepo b/tools/com-plugin/.gitrepo index ad5310ed1c..6215d57598 100644 --- a/tools/com-plugin/.gitrepo +++ b/tools/com-plugin/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = git@github.com:Thar0/com-plugin.git branch = main - commit = 81595ed1ca40d22846064537ba5fa8147b9f7068 - parent = a1632bcbfc04672f21866f11bf074b420dea9693 + commit = fc5aa5eda0b09e8e3cf91ce1530f886bb1ab8eef + parent = 54939bac3ac972a24918d3fdc97d58199ff54bc9 method = merge cmdver = 0.4.6 diff --git a/tools/com-plugin/Makefile b/tools/com-plugin/Makefile index 8fb570f822..c15dfb6ed6 100644 --- a/tools/com-plugin/Makefile +++ b/tools/com-plugin/Makefile @@ -14,6 +14,6 @@ clean: $(RM) $(TARGET) $(DEP_FILES) $(TARGET): $(SOURCES) - $(CC) -shared $(CFLAGS) -MMD -o $@ $^ + $(CC) -shared $(CFLAGS) -MMD -o $@ $(SOURCES) -include $(DEP_FILES) diff --git a/tools/csdis.py b/tools/csdis.py index 1d96c48e4f..f83efd3aa1 100755 --- a/tools/csdis.py +++ b/tools/csdis.py @@ -2,8 +2,6 @@ # Disassemble a cutscene script -from overlayhelpers import filemap - import argparse, os, struct import math @@ -506,7 +504,7 @@ cutscene_command_macros = { "CS_RUMBLE_CONTROLLER(%h2:1:x, %h1:1:s, %h2:2:s, %b2:2:x, %b1:2:x, %b4:3:x, %b3:3:x, %h1:3:x)", 3), 140: ("CS_TIME_LIST(%w1:1:s)", 2, None, 0, - "CS_TIME(%h2:1:x, %h1:1:s, %h2:2:s, %b2:2:x, %b1:2:x, %w1:3:x)", 3), + "CS_TIME(%h2:1:x, %h1:1:s, %h2:2:s, %b2:2:x, %b1:2:x)", 3), 10: ("CS_PLAYER_CUE_LIST(%w1:1:s)", 2, None, 0, "CS_PLAYER_CUE(%h2:1:e6, %h1:1:s, %h2:2:s, %h1:2:x, %h2:3:x, %h1:3:x, %w1:4:s, %w1:5:s, %w1:6:s, %w1:7:s, %w1:8:s, %w1:9:s, %w1:10:f, %w1:11:f, %w1:12:f)", 12), @@ -711,7 +709,12 @@ Note that this isn't protected against indexing errors since a cutscene should a end before the end of the file it's in. """ -def disassemble_cutscene(cs_in): +def disassemble_cutscene(cs_in) -> tuple[int, str]: + """ + Takes a sequence of words cs_in + + Returns a tuple (cutscene_size_in_words, cutscene_macros_source) + """ i = 0 total_entries = cs_in[i] i+=1 @@ -720,12 +723,14 @@ def disassemble_cutscene(cs_in): if (total_entries < 0 or cutscene_end_frame < 0): print("This cutscene would abort if played in-engine") if total_entries < 0: - return "Could not disassemble cutscene: Number of commands is negative" + raise Exception("Could not disassemble cutscene: Number of commands is negative") macros = format_cmd(begin_cutscene_entry[0], [total_entries, cutscene_end_frame])+line_end + # iterate total_entries+1 times to also parse the CS_END_OF_SCRIPT command, + # which is not included in the count for k in range(0,total_entries+1): cmd_type = cs_in[i] if (cmd_type == 0xFFFFFFFF): - return macros + multi_key(-1)[0]+line_end + return (i+2), (macros + multi_key(-1)[0]+line_end) entry = multi_key(cmd_type) if entry is None: entry = unk_data_entry @@ -758,12 +763,14 @@ def disassemble_cutscene(cs_in): else: i += n_words print("Warning: cutscene reached maximum entries without encountering a CS_END_SCRIPT command") - return macros + return i, macros def hex_parse(s): return int(s, 16) def main(): + from overlayhelpers import filemap + parser = argparse.ArgumentParser(description="Disassembles cutscenes for OoT") parser.add_argument('address', help="VRAM or ROM address to disassemble at", type=hex_parse) args = parser.parse_args() @@ -785,7 +792,7 @@ def main(): ovl_file.seek(file_result.offset) cs_data = [i[0] for i in struct.iter_unpack(">I", bytearray(ovl_file.read()))] if cs_data is not None: - print("static CutsceneData D_" + hex(args.address).replace("0x","").upper() + "[] = {\n" + indent+disassemble_cutscene(cs_data).replace(linesep,linesep+indent).rstrip()+"\n};") + print("static CutsceneData D_" + hex(args.address).replace("0x","").upper() + "[] = {\n" + indent+disassemble_cutscene(cs_data)[1].replace(linesep,linesep+indent).rstrip()+"\n};") if __name__ == "__main__": main() diff --git a/tools/decompress_baserom.py b/tools/decompress_baserom.py index aeea9e3dae..4e79d848e0 100755 --- a/tools/decompress_baserom.py +++ b/tools/decompress_baserom.py @@ -30,10 +30,11 @@ def decompress_zlib(data: bytes) -> bytes: return bytes(output) -def decompress(data: bytes, is_zlib_compressed: bool) -> bytes: - if is_zlib_compressed: +def decompress(data: bytes, is_ique: bool) -> bytes: + if is_ique: return decompress_zlib(data) - return crunch64.yaz0.decompress(data) + else: + return crunch64.yaz0.decompress(data) def round_up(n, shift): @@ -41,11 +42,13 @@ def round_up(n, shift): return (n + mod - 1) >> shift << shift -def update_crc(decompressed: io.BytesIO) -> io.BytesIO: +def update_crc(decompressed: io.BytesIO, is_ique: bool) -> io.BytesIO: print("Recalculating crc...") - calculated_checksum = ipl3checksum.CICKind.CIC_X105.calculateChecksum( - bytes(decompressed.getbuffer()) - ) + if is_ique: + cic_kind = ipl3checksum.CICKind.CIC_6102_7101 + else: + cic_kind = ipl3checksum.CICKind.CIC_X105 + calculated_checksum = cic_kind.calculateChecksum(bytes(decompressed.getbuffer())) new_crc = struct.pack(f">II", calculated_checksum[0], calculated_checksum[1]) decompressed.seek(0x10) @@ -57,7 +60,7 @@ def decompress_rom( file_content: bytearray, dmadata_start: int, dma_entries: list[dmadata.DmaEntry], - is_zlib_compressed: bool, + is_ique: bool, ) -> bytearray: rom_segments = {} # vrom start : data s.t. len(data) == vrom_end - vrom_start new_dmadata = [] # new dmadata: list[dmadata.Entry] @@ -73,7 +76,7 @@ def decompress_rom( new_dmadata.append(dma_entry) continue if dma_entry.is_compressed(): - new_contents = decompress(file_content[p_start:p_end], is_zlib_compressed) + new_contents = decompress(file_content[p_start:p_end], is_ique) rom_segments[v_start] = new_contents else: rom_segments[v_start] = file_content[p_start : p_start + v_end - v_start] @@ -95,7 +98,7 @@ def decompress_rom( decompressed.seek(padding_start) decompressed.write(b"\x00" * (padding_end - padding_start)) # re-calculate crc - return bytearray(update_crc(decompressed).getbuffer()) + return bytearray(update_crc(decompressed, is_ique).getbuffer()) def get_str_hash(byte_array): @@ -246,10 +249,8 @@ def main(): # Decompress if any(dma_entry.is_compressed() for dma_entry in dma_entries): print("Decompressing rom...") - is_zlib_compressed = version in {"ique-cn", "ique-zh"} - file_content = decompress_rom( - file_content, dmadata_start, dma_entries, is_zlib_compressed - ) + is_ique = version.startswith("ique-") + file_content = decompress_rom(file_content, dmadata_start, dma_entries, is_ique) # Double check the hash str_hash = get_str_hash(file_content) diff --git a/tools/disasm/ique-cn/file_addresses.csv b/tools/disasm/ique-cn/file_addresses.csv deleted file mode 100644 index 3f3c9d9590..0000000000 --- a/tools/disasm/ique-cn/file_addresses.csv +++ /dev/null @@ -1,472 +0,0 @@ -name,vrom_start,vrom_end,rom_start,rom_end,vram_start,overlay_dir -boot,1050,B7A0,1050,0,80000450, -code,AB0000,BB8FA0,A890F0,B08080,80018FA0, -ovl_title,BB8FA0,BB98D0,B08080,B08650,80800000,gamestates -ovl_select,BB98D0,BBC550,B08650,B09C90,80800930,gamestates -ovl_opening,BBC550,BBC6A0,B09C90,B09DA0,808035B0,gamestates -ovl_file_choose,BBC6A0,BCD170,B09DA0,B114B0,80803700,gamestates -ovl_kaleido_scope,BCD170,BE91A0,B114B0,B1CE20,808141F0,misc -ovl_player_actor,BE91A0,C0F8B0,B1CE20,B318E0,80830290,actors -ovl_map_mark_data,C0F8B0,C16410,B318E0,B31C00,80856A70,misc -ovl_En_Test,C16410,C1BCC0,B31C00,B34720,8085D5D0,actors -ovl_En_GirlA,C1BCC0,C1E5E0,B34720,B357F0,80862E80,actors -ovl_En_Part,C1E5E0,C1FC40,B357F0,B36580,808657A0,actors -ovl_En_Light,C1FC40,C20A40,B36580,B36DD0,80866E00,actors -ovl_En_Door,C20A40,C21880,B36DD0,B37790,80867C00,actors -ovl_En_Box,C21880,C233D0,B37790,B387B0,80868A40,actors -ovl_En_Poh,C233D0,C275C0,B387B0,B3AB60,8086A5A0,actors -ovl_En_Okuta,C275C0,C29BA0,B3AB60,B3C1B0,8086E790,actors -ovl_En_Bom,C29BA0,C2AA70,B3C1B0,B3CB60,80870D70,actors -ovl_En_Wallmas,C2AA70,C2C480,B3CB60,B3DA80,80871C40,actors -ovl_En_Dodongo,C2C480,C2F220,B3DA80,B3F4D0,80873650,actors -ovl_En_Firefly,C2F220,C31390,B3F4D0,B40800,808763F0,actors -ovl_En_Horse,C31390,C3D5F0,B40800,B46B20,80878560,actors -ovl_En_Arrow,C3D5F0,C3ECF0,B46B20,B47900,808847C0,actors -ovl_En_Elf,C3ECF0,C436B0,B47900,B4A170,80885EC0,actors -ovl_En_Niw,C436B0,C469E0,B4A170,B4C040,8088A880,actors -ovl_En_Tite,C469E0,C49780,B4C040,B4D800,8088DBB0,actors -ovl_En_Reeba,C49780,C4B1F0,B4D800,B4E810,80890950,actors -ovl_En_Peehat,C4B1F0,C4E8F0,B4E810,B505B0,808923C0,actors -ovl_En_Holl,C4E8F0,C4F8C0,B505B0,B50F90,80895AC0,actors -ovl_En_Scene_Change,C4F8C0,C4F9F0,B50F90,B51060,80896A90,actors -ovl_En_Zf,C4F9F0,C564D0,B51060,B548E0,80896BC0,actors -ovl_En_Hata,C564D0,C56A60,B548E0,B54D00,8089D6B0,actors -ovl_Boss_Dodongo,C56A60,C60560,B54D00,B5A160,8089DC40,actors -ovl_Boss_Goma,C60560,C66500,B5A160,B5D240,808A7740,actors -ovl_En_Zl1,C66500,C6A310,B5D240,B5ED00,808AD6E0,actors -ovl_En_Viewer,C6A310,C6D1B0,B5ED00,B607E0,808B14F0,actors -ovl_En_Goma,C6D1B0,C6FE60,B607E0,B62130,808B43B0,actors -ovl_Bg_Pushbox,C6FE60,C70160,B62130,B62350,808B7060,actors -ovl_En_Bubble,C70160,C71580,B62350,B63030,808B7360,actors -ovl_Door_Shutter,C71580,C73840,B63030,B64550,808B8780,actors -ovl_En_Dodojr,C73840,C756E0,B64550,B65760,808BAA40,actors -ovl_En_Bdfire,C756E0,C76280,B65760,B65EF0,808BC8E0,actors -ovl_En_Boom,C76280,C76B50,B65EF0,B664F0,808BD480,actors -ovl_En_Torch2,C76B50,C792B0,B664F0,B67D50,808BDD50,actors -ovl_En_Bili,C792B0,C7B580,B67D50,B691C0,808C04F0,actors -ovl_En_Tp,C7B580,C7D3F0,B691C0,B6A490,808C27C0,actors -ovl_En_St,C7D3F0,C80060,B6A490,B6BEB0,808C4630,actors -ovl_En_Bw,C80060,C833F0,B6BEB0,B6DC30,808C72A0,actors -ovl_En_Eiyer,C833F0,C85050,B6DC30,B6ED50,808CA630,actors -ovl_En_River_Sound,C85050,C859E0,B6ED50,B6F3D0,808CC290,actors -ovl_En_Horse_Normal,C859E0,C88000,B6F3D0,B708B0,808CCC20,actors -ovl_En_Ossan,C88000,C8E5E0,B708B0,B73780,808CF240,actors -ovl_Bg_Treemouth,C8E5E0,C8FC40,B73780,B741C0,808D5820,actors -ovl_Bg_Dodoago,C8FC40,C90980,B741C0,B74A60,808D6E80,actors -ovl_Bg_Hidan_Dalm,C90980,C911D0,B74A60,B74FB0,808D7C30,actors -ovl_Bg_Hidan_Hrock,C911D0,C91A00,B74FB0,B75510,808D8480,actors -ovl_En_Horse_Ganon,C91A00,C92780,B75510,B75DD0,808D8CB0,actors -ovl_Bg_Hidan_Rock,C92780,C93880,B75DD0,B76880,808D9A30,actors -ovl_Bg_Hidan_Rsekizou,C93880,C94460,B76880,B76FC0,808DAB30,actors -ovl_Bg_Hidan_Sekizou,C94460,C958B0,B76FC0,B77C90,808DB710,actors -ovl_Bg_Hidan_Sima,C958B0,C967B0,B77C90,B78660,808DCB60,actors -ovl_Bg_Hidan_Syoku,C967B0,C96C10,B78660,B78900,808DDA60,actors -ovl_En_Xc,C96C10,C9D370,B78900,B7B400,808DDEC0,actors -ovl_Bg_Hidan_Curtain,C9D370,C9DE10,B7B400,B7BAE0,808E4650,actors -ovl_Bg_Spot00_Hanebasi,C9DE10,C9EF20,B7BAE0,B7C670,808E50F0,actors -ovl_En_Mb,C9EF20,CA3150,B7C670,B7EAB0,808E6200,actors -ovl_En_Bombf,CA3150,CA45E0,B7EAB0,B7F820,808EA430,actors -ovl_Bg_Hidan_Firewall,CA45E0,CA4D40,B7F820,B7FD30,808EB8C0,actors -ovl_Bg_Dy_Yoseizo,CA4D40,CA7B30,B7FD30,B817E0,808EC020,actors -ovl_En_Zl2,CA7B30,CAC230,B817E0,B834B0,808EEE10,actors -ovl_Bg_Hidan_Fslift,CAC230,CAC700,B834B0,B837B0,808F3510,actors -ovl_En_OE2,CAC700,CAC7E0,B837B0,B83830,808F39E0,actors -ovl_Bg_Ydan_Hasi,CAC7E0,CACF90,B83830,B83D40,808F3AC0,actors -ovl_Bg_Ydan_Maruta,CACF90,CAD670,B83D40,B841D0,808F4270,actors -ovl_Boss_Ganondrof,CAD670,CB2400,B841D0,B86CE0,808F4950,actors -ovl_En_Am,CB2400,CB4800,B86CE0,B88160,808F96E0,actors -ovl_En_Dekubaba,CB4800,CB82B0,B88160,B8A190,808FBAE0,actors -ovl_En_M_Fire1,CB82B0,CB8450,B8A190,B8A2C0,808FF590,actors -ovl_En_M_Thunder,CB8450,CB9A50,B8A2C0,B8B070,808FF730,actors -ovl_Bg_Ddan_Jd,CB9A50,CBA0A0,B8B070,B8B4A0,80900D30,actors -ovl_Bg_Breakwall,CBA0A0,CBAF10,B8B4A0,B8BE10,80901380,actors -ovl_En_Jj,CBAF10,CBC4E0,B8BE10,B8C890,809021F0,actors -ovl_En_Horse_Zelda,CBC4E0,CBCFD0,B8C890,B8CFF0,809037C0,actors -ovl_Bg_Ddan_Kd,CBCFD0,CBD8C0,B8CFF0,B8D5A0,809042B0,actors -ovl_Door_Warp1,CBD8C0,CC1BC0,B8D5A0,B8F6A0,80904BA0,actors -ovl_Obj_Syokudai,CC1BC0,CC2800,B8F6A0,B8FF20,80908EB0,actors -ovl_Item_B_Heart,CC2800,CC2C10,B8FF20,B90200,80909B00,actors -ovl_En_Dekunuts,CC2C10,CC4410,B90200,B90F60,80909F10,actors -ovl_Bg_Menkuri_Kaiten,CC4410,CC45A0,B90F60,B91090,8090B710,actors -ovl_Bg_Menkuri_Eye,CC45A0,CC4A30,B91090,B913C0,8090B8A0,actors -ovl_En_Vali,CC4A30,CC70F0,B913C0,B92A60,8090BD40,actors -ovl_Bg_Mizu_Movebg,CC70F0,CC8270,B92A60,B934F0,8090E400,actors -ovl_Bg_Mizu_Water,CC8270,CC8F40,B934F0,B93C70,8090F590,actors -ovl_Arms_Hook,CC8F40,CC9CB0,B93C70,B94520,80910260,actors -ovl_En_fHG,CC9CB0,CCC5E0,B94520,B95C80,80910FD0,actors -ovl_Bg_Mori_Hineri,CCC5E0,CCD330,B95C80,B964C0,80913900,actors -ovl_En_Bb,CCD330,CD1010,B964C0,B98950,80914650,actors -ovl_Bg_Toki_Hikari,CD1010,CD1DB0,B98950,B99070,80918330,actors -ovl_En_Yukabyun,CD1DB0,CD23C0,B99070,B994E0,809190D0,actors -ovl_Bg_Toki_Swd,CD23C0,CD3A10,B994E0,B99DB0,809196E0,actors -ovl_En_Fhg_Fire,CD3A10,CD60B0,B99DB0,B9B520,8091AD30,actors -ovl_Bg_Mjin,CD60B0,CD64A0,B9B520,B9B7F0,8091D3D0,actors -ovl_Bg_Hidan_Kousi,CD64A0,CD6A30,B9B7F0,B9BB80,8091D7C0,actors -ovl_Door_Toki,CD6A30,CD6B90,B9BB80,B9BC80,8091DD50,actors -ovl_Bg_Hidan_Hamstep,CD6B90,CD7A40,B9BC80,B9C5E0,8091DEB0,actors -ovl_En_Bird,CD7A40,CD7F00,B9C5E0,B9C920,8091ED60,actors -ovl_En_Wood02,CD7F00,CD90D0,B9C920,B9D4C0,8091F220,actors -ovl_En_Lightbox,CD90D0,CD9550,B9D4C0,B9D800,80920400,actors -ovl_En_Pu_box,CD9550,CD9890,B9D800,B9DA60,80920880,actors -ovl_En_Trap,CD9890,CDAB30,B9DA60,B9E4B0,80920BC0,actors -ovl_En_Arow_Trap,CDAB30,CDAC80,B9E4B0,B9E5D0,80921E60,actors -ovl_En_Vase,CDAC80,CDAD80,B9E5D0,B9E690,80921FB0,actors -ovl_En_Ta,CDAD80,CDE740,B9E690,BA0470,809220B0,actors -ovl_En_Tk,CDE740,CE0570,BA0470,BA1710,80925A70,actors -ovl_Bg_Mori_Bigst,CE0570,CE0EA0,BA1710,BA1C80,809278A0,actors -ovl_Bg_Mori_Elevator,CE0EA0,CE1990,BA1C80,BA22B0,809281D0,actors -ovl_Bg_Mori_Kaitenkabe,CE1990,CE2000,BA22B0,BA2720,80928CC0,actors -ovl_Bg_Mori_Rakkatenjo,CE2000,CE2980,BA2720,BA2CD0,80929330,actors -ovl_En_Vm,CE2980,CE4240,BA2CD0,BA3BB0,80929CB0,actors -ovl_Demo_Effect,CE4240,CE9DE0,BA3BB0,BA6D90,8092B570,actors -ovl_Demo_Kankyo,CE9DE0,CEDA80,BA6D90,BA8C80,80931110,actors -ovl_Bg_Hidan_Fwbig,CEDA80,CEE760,BA8C80,BA9520,80934E00,actors -ovl_En_Floormas,CEE760,CF1B40,BA9520,BAB060,80935AE0,actors -ovl_En_Heishi1,CF1B40,CF3050,BAB060,BABC80,80938EC0,actors -ovl_En_Rd,CF3050,CF5910,BABC80,BAD2A0,8093A3D0,actors -ovl_En_Po_Sisters,CF5910,CFA600,BAD2A0,BAFCF0,8093CC90,actors -ovl_Bg_Heavy_Block,CFA600,CFBEF0,BAFCF0,BB0C40,80941980,actors -ovl_Bg_Po_Event,CFBEF0,CFDD20,BB0C40,BB1F30,80943270,actors -ovl_Obj_Mure,CFDD20,CFED30,BB1F30,BB2890,809450B0,actors -ovl_En_Sw,CFED30,D024A0,BB2890,BB4A40,809460C0,actors -ovl_Boss_Fd,D024A0,D09800,BB4A40,BB8AF0,809498B0,actors -ovl_Object_Kankyo,D09800,D0CA80,BB8AF0,BBA8B0,80950C10,actors -ovl_En_Du,D0CA80,D0E510,BBA8B0,BBB820,80953E90,actors -ovl_En_Fd,D0E510,D111B0,BBB820,BBD3D0,80955920,actors -ovl_En_Horse_Link_Child,D111B0,D12FB0,BBD3D0,BBE350,809585C0,actors -ovl_Door_Ana,D12FB0,D13620,BBE350,BBE7D0,8095A3C0,actors -ovl_Bg_Spot02_Objects,D13620,D14980,BBE7D0,BBF3A0,8095AA30,actors -ovl_Bg_Haka,D14980,D15040,BBF3A0,BBF860,8095BD90,actors -ovl_Magic_Wind,D15040,D16D40,BBF860,BC0F20,8095C450,actors -ovl_Magic_Fire,D16D40,D19040,BC0F20,BC2B20,8095E150,actors -ovl_En_Ru1,D19040,D206E0,BC2B20,BC5F20,80960450,actors -ovl_Boss_Fd2,D206E0,D24410,BC5F20,BC83D0,80967AF0,actors -ovl_En_Fd_Fire,D24410,D25120,BC83D0,BC8CD0,8096B820,actors -ovl_En_Dh,D25120,D26C00,BC8CD0,BC9D70,8096C530,actors -ovl_En_Dha,D26C00,D27C00,BC9D70,BCA750,8096E010,actors -ovl_En_Rl,D27C00,D28AE0,BCA750,BCAEE0,8096F010,actors -ovl_En_Encount1,D28AE0,D29640,BCAEE0,BCB6B0,8096FEF0,actors -ovl_Demo_Du,D29640,D2CE20,BCB6B0,BCCE20,80970A50,actors -ovl_Demo_Im,D2CE20,D30D90,BCCE20,BCE8A0,80974230,actors -ovl_Demo_Tre_Lgt,D30D90,D314A0,BCE8A0,BCED80,809781A0,actors -ovl_En_Fw,D314A0,D32C60,BCED80,BCFD90,809788B0,actors -ovl_Bg_Vb_Sima,D32C60,D33380,BCFD90,BD02B0,8097A070,actors -ovl_En_Vb_Ball,D33380,D34530,BD02B0,BD0DF0,8097A790,actors -ovl_Bg_Haka_Megane,D34530,D34930,BD0DF0,BD10B0,8097B940,actors -ovl_Bg_Haka_MeganeBG,D34930,D34FF0,BD10B0,BD1510,8097BD40,actors -ovl_Bg_Haka_Ship,D34FF0,D35A40,BD1510,BD1BE0,8097C400,actors -ovl_Bg_Haka_Sgami,D35A40,D36660,BD1BE0,BD23D0,8097CE50,actors -ovl_En_Heishi2,D36660,D38860,BD23D0,BD3570,8097DA70,actors -ovl_En_Encount2,D38860,D39A90,BD3570,BD4140,8097FC70,actors -ovl_En_Fire_Rock,D39A90,D3ABA0,BD4140,BD4BB0,80980EA0,actors -ovl_En_Brob,D3ABA0,D3BC90,BD4BB0,BD5610,80981FB0,actors -ovl_Mir_Ray,D3BC90,D3D540,BD5610,BD66B0,809830A0,actors -ovl_Bg_Spot09_Obj,D3D540,D3DA60,BD66B0,BD69E0,80984950,actors -ovl_Bg_Spot18_Obj,D3DA60,D3E330,BD69E0,BD6F20,80984E70,actors -ovl_Boss_Va,D3E330,D4CBC0,BD6F20,BDEBF0,80985740,actors -ovl_Bg_Haka_Tubo,D4CBC0,D4D5E0,BDEBF0,BDF2D0,8099C9D0,actors -ovl_Bg_Haka_Trap,D4D5E0,D4EBB0,BDF2D0,BE0060,8099D3F0,actors -ovl_Bg_Haka_Huta,D4EBB0,D4F650,BE0060,BE0760,8099E9C0,actors -ovl_Bg_Haka_Zou,D4F650,D50840,BE0760,BE12E0,8099F460,actors -ovl_Bg_Spot17_Funen,D50840,D50A90,BE12E0,BE14A0,809A0650,actors -ovl_En_Syateki_Itm,D50A90,D51830,BE14A0,BE1D30,809A08A0,actors -ovl_En_Syateki_Man,D51830,D525F0,BE1D30,BE25B0,809A1640,actors -ovl_En_Tana,D525F0,D528A0,BE25B0,BE2790,809A2400,actors -ovl_En_Nb,D528A0,D56E70,BE2790,BE4570,809A26B0,actors -ovl_Boss_Mo,D56E70,D62940,BE4570,BEB300,809A6C80,actors -ovl_En_Sb,D62940,D63D80,BEB300,BEBE70,809B7260,actors -ovl_En_Bigokuta,D63D80,D66880,BEBE70,BED740,809B86A0,actors -ovl_En_Karebaba,D66880,D68170,BED740,BEE610,809BB1A0,actors -ovl_Bg_Bdan_Objects,D68170,D69440,BEE610,BEF150,809BCA90,actors -ovl_Demo_Sa,D69440,D6BF60,BEF150,BF03C0,809BDD60,actors -ovl_Demo_Go,D6BF60,D6CCB0,BF03C0,BF0B70,809C0880,actors -ovl_En_In,D6CCB0,D6FA50,BF0B70,BF2750,809C15D0,actors -ovl_En_Tr,D6FA50,D71350,BF2750,BF3690,809C4370,actors -ovl_Bg_Spot16_Bombstone,D71350,D728A0,BF3690,BF4490,809C5C70,actors -ovl_Bg_Hidan_Kowarerukabe,D728A0,D73780,BF4490,BF4CE0,809C71C0,actors -ovl_Bg_Bombwall,D73780,D74040,BF4CE0,BF52A0,809C80A0,actors -ovl_En_Ru2,D74040,D76DC0,BF52A0,BF65C0,809C8960,actors -ovl_Obj_Dekujr,D76DC0,D77400,BF65C0,BF6A10,809CB6E0,actors -ovl_Bg_Mizu_Uzu,D77400,D775D0,BF6A10,BF6B70,809CBD20,actors -ovl_Bg_Spot06_Objects,D775D0,D789D0,BF6B70,BF7840,809CBEF0,actors -ovl_Bg_Ice_Objects,D789D0,D79910,BF7840,BF80C0,809CD2F0,actors -ovl_Bg_Haka_Water,D79910,D7A110,BF80C0,BF85A0,809CE230,actors -ovl_En_Ma2,D7A110,D7B170,BF85A0,BF9020,809CEA30,actors -ovl_En_Bom_Chu,D7B170,D7C810,BF9020,BF9F10,809CFA90,actors -ovl_En_Horse_Game_Check,D7C810,D7D8E0,BF9F10,BFA960,809D1130,actors -ovl_Boss_Tw,D7D8E0,D90A30,BFA960,C04CE0,809D2200,actors -ovl_En_Rr,D90A30,D92F60,C04CE0,C06350,809E7DD0,actors -ovl_En_Ba,D92F60,D94E30,C06350,C07490,809EA300,actors -ovl_En_Bx,D94E30,D95930,C07490,C07C60,809EC1D0,actors -ovl_En_Anubice,D95930,D96BE0,C07C60,C08810,809ECCD0,actors -ovl_En_Anubice_Fire,D96BE0,D979A0,C08810,C09180,809EDF80,actors -ovl_Bg_Mori_Hashigo,D979A0,D98260,C09180,C09700,809EED40,actors -ovl_Bg_Mori_Hashira4,D98260,D987E0,C09700,C09AA0,809EF600,actors -ovl_Bg_Mori_Idomizu,D987E0,D98E20,C09AA0,C09EC0,809EFB90,actors -ovl_Bg_Spot16_Doughnut,D98E20,D993E0,C09EC0,C0A2C0,809F01D0,actors -ovl_Bg_Bdan_Switch,D993E0,D9A810,C0A2C0,C0ACC0,809F0790,actors -ovl_En_Ma1,D9A810,D9BAF0,C0ACC0,C0B870,809F1BC0,actors -ovl_Boss_Ganon,D9BAF0,DBDDA0,C0B870,C1E5A0,809F2EA0,actors -ovl_Boss_Sst,DBDDA0,DCA330,C1E5A0,C24DB0,80A18CD0,actors -ovl_En_Ny,DCA330,DCBC70,C24DB0,C25D40,80A252A0,actors -ovl_En_Fr,DCBC70,DCE700,C25D40,C276B0,80A26BE0,actors -ovl_Item_Shield,DCE700,DCF110,C276B0,C27D70,80A29670,actors -ovl_Bg_Ice_Shelter,DCF110,DD0350,C27D70,C28900,80A2A080,actors -ovl_En_Ice_Hono,DD0350,DD1540,C28900,C293E0,80A2B2C0,actors -ovl_Item_Ocarina,DD1540,DD1D10,C293E0,C298C0,80A2C4B0,actors -ovl_Magic_Dark,DD1D10,DD3560,C298C0,C2A9A0,80A2CC80,actors -ovl_Demo_6K,DD3560,DD62C0,C2A9A0,C2C5E0,80A2E4D0,actors -ovl_En_Anubice_Tag,DD62C0,DD6590,C2C5E0,C2C7F0,80A31230,actors -ovl_Bg_Haka_Gate,DD6590,DD7620,C2C7F0,C2D290,80A31500,actors -ovl_Bg_Spot15_Saku,DD7620,DD7960,C2D290,C2D4F0,80A325A0,actors -ovl_Bg_Jya_Goroiwa,DD7960,DD80E0,C2D4F0,C2DA20,80A328E0,actors -ovl_Bg_Jya_Zurerukabe,DD80E0,DD8790,C2DA20,C2DE80,80A33060,actors -ovl_Bg_Jya_Cobra,DD8790,DDA4D0,C2DE80,C2F0B0,80A33710,actors -ovl_Bg_Jya_Kanaami,DDA4D0,DDA880,C2F0B0,C2F330,80A35450,actors -ovl_Fishing,DDA880,DECD10,C2F330,C38420,80A35800,actors -ovl_Obj_Oshihiki,DECD10,DEE7C0,C38420,C393D0,80A4ED40,actors -ovl_Bg_Gate_Shutter,DEE7C0,DEEC50,C393D0,C396C0,80A507F0,actors -ovl_Eff_Dust,DEEC50,DF0020,C396C0,C3A0E0,80A50C80,actors -ovl_Bg_Spot01_Fusya,DF0020,DF02C0,C3A0E0,C3A2E0,80A52050,actors -ovl_Bg_Spot01_Idohashira,DF02C0,DF0EC0,C3A2E0,C3AA70,80A522F0,actors -ovl_Bg_Spot01_Idomizu,DF0EC0,DF11E0,C3AA70,C3ACD0,80A52EF0,actors -ovl_Bg_Po_Syokudai,DF11E0,DF1B50,C3ACD0,C3B320,80A53210,actors -ovl_Bg_Ganon_Otyuka,DF1B50,DF4190,C3B320,C3CCA0,80A53B80,actors -ovl_Bg_Spot15_Rrbox,DF4190,DF4F70,C3CCA0,C3D500,80A561C0,actors -ovl_Bg_Umajump,DF4F70,DF5100,C3D500,C3D630,80A56FA0,actors -ovl_En_Insect,DF5100,DF7620,C3D630,C3EB20,80A57130,actors -ovl_En_Butte,DF7620,DF8BF0,C3EB20,C3F870,80A59650,actors -ovl_En_Fish,DF8BF0,DFAD00,C3F870,C40A30,80A5AC20,actors -ovl_Bg_Spot08_Iceblock,DFAD00,DFBD40,C40A30,C413B0,80A5CD30,actors -ovl_Item_Etcetera,DFBD40,DFC610,C413B0,C41920,80A5DD70,actors -ovl_Arrow_Fire,DFC610,DFE4F0,C41920,C430F0,80A5E640,actors -ovl_Arrow_Ice,DFE4F0,E003F0,C430F0,C446A0,80A60520,actors -ovl_Arrow_Light,E003F0,E02300,C446A0,C45CD0,80A62420,actors -ovl_Obj_Kibako,E02300,E03000,C45CD0,C46440,80A64330,actors -ovl_Obj_Tsubo,E03000,E03FF0,C46440,C46DD0,80A65030,actors -ovl_En_Wonder_Item,E03FF0,E04C40,C46DD0,C47520,80A66020,actors -ovl_En_Ik,E04C40,E09290,C47520,C497E0,80A66D50,actors -ovl_Demo_Ik,E09290,E0A7A0,C497E0,C4A2D0,80A6B3B0,actors -ovl_En_Skj,E0A7A0,E0E0E0,C4A2D0,C4C0E0,80A6C8C0,actors -ovl_En_Skjneedle,E0E0E0,E0E3F0,C4C0E0,C4C320,80A70210,actors -ovl_En_G_Switch,E0E3F0,E0FC10,C4C320,C4D2D0,80A70520,actors -ovl_Demo_Ext,E0FC10,E10560,C4D2D0,C4D8D0,80A71D40,actors -ovl_Demo_Shd,E10560,E12970,C4D8D0,C4EE30,80A72690,actors -ovl_En_Dns,E12970,E13D00,C4EE30,C4F900,80A74AA0,actors -ovl_Elf_Msg,E13D00,E142F0,C4F900,C4FCB0,80A75E30,actors -ovl_En_Honotrap,E142F0,E15850,C4FCB0,C50A20,80A76420,actors -ovl_En_Tubo_Trap,E15850,E164F0,C50A20,C511C0,80A77980,actors -ovl_Obj_Ice_Poly,E164F0,E16EA0,C511C0,C51850,80A78620,actors -ovl_Bg_Spot03_Taki,E16EA0,E177C0,C51850,C51E00,80A78FD0,actors -ovl_Bg_Spot07_Taki,E177C0,E17DB0,C51E00,C521C0,80A798F0,actors -ovl_En_Fz,E17DB0,E19DC0,C521C0,C534E0,80A79EE0,actors -ovl_En_Po_Relay,E19DC0,E1B4D0,C534E0,C543A0,80A7BEF0,actors -ovl_Bg_Relay_Objects,E1B4D0,E1BC80,C543A0,C548B0,80A7D600,actors -ovl_En_Diving_Game,E1BC80,E1D630,C548B0,C55800,80A7DDB0,actors -ovl_En_Kusa,E1D630,E1EB10,C55800,C564E0,80A7F760,actors -ovl_Obj_Bean,E1EB10,E212A0,C564E0,C57A00,80A80C40,actors -ovl_Obj_Bombiwa,E212A0,E21810,C57A00,C57DF0,80A833D0,actors -ovl_Obj_Switch,E21810,E235F0,C57DF0,C58DF0,80A83940,actors -ovl_Obj_Elevator,E235F0,E239B0,C58DF0,C59070,80A85720,actors -ovl_Obj_Lift,E239B0,E243D0,C59070,C59750,80A85AE0,actors -ovl_Obj_Hsblock,E243D0,E249A0,C59750,C59B30,80A86500,actors -ovl_En_Okarina_Tag,E249A0,E25EA0,C59B30,C5A570,80A86AD0,actors -ovl_En_Yabusame_Mark,E25EA0,E26570,C5A570,C5A9D0,80A87FD0,actors -ovl_En_Goroiwa,E26570,E28930,C5A9D0,C5BF50,80A886A0,actors -ovl_En_Ex_Ruppy,E28930,E299F0,C5BF50,C5C9F0,80A8AA60,actors -ovl_En_Toryo,E299F0,E2A680,C5C9F0,C5D1A0,80A8BB20,actors -ovl_En_Daiku,E2A680,E2BDC0,C5D1A0,C5E0C0,80A8C7B0,actors -ovl_En_Nwc,E2BDC0,E2C7E0,C5E0C0,C5E7E0,80A8DEF0,actors -ovl_En_Blkobj,E2C7E0,E2CD40,C5E7E0,C5EBA0,80A8E910,actors -ovl_Item_Inbox,E2CD40,E2CEA0,C5EBA0,C5EC90,80A8EE70,actors -ovl_En_Ge1,E2CEA0,E2EED0,C5EC90,C5FDC0,80A8EFD0,actors -ovl_Obj_Blockstop,E2EED0,E2F070,C5FDC0,C5FF00,80A91000,actors -ovl_En_Sda,E2F070,E306A0,C5FF00,C60BA0,80A911A0,actors -ovl_En_Clear_Tag,E306A0,E39210,C60BA0,C64720,80A92890,actors -ovl_En_Niw_Lady,E39210,E3AB10,C64720,C65630,80A9DE30,actors -ovl_En_Gm,E3AB10,E3B840,C65630,C65EB0,80A9F730,actors -ovl_En_Ms,E3B840,E3BF30,C65EB0,C66370,80AA0460,actors -ovl_En_Hs,E3BF30,E3CAD0,C66370,C66A60,80AA0B50,actors -ovl_Bg_Ingate,E3CAD0,E3CE60,C66A60,C66CF0,80AA16F0,actors -ovl_En_Kanban,E3CE60,E3FFB0,C66CF0,C68660,80AA1A80,actors -ovl_En_Heishi3,E3FFB0,E40980,C68660,C68C60,80AA4BD0,actors -ovl_En_Syateki_Niw,E40980,E42A10,C68C60,C6A060,80AA55A0,actors -ovl_En_Attack_Niw,E42A10,E43C70,C6A060,C6ABA0,80AA7630,actors -ovl_Bg_Spot01_Idosoko,E43C70,E43E80,C6ABA0,C6AD20,80AA8890,actors -ovl_En_Sa,E43E80,E460F0,C6AD20,C6BFE0,80AA8AA0,actors -ovl_En_Wonder_Talk,E460F0,E46780,C6BFE0,C6C450,80AAAD10,actors -ovl_Bg_Gjyo_Bridge,E46780,E46C70,C6C450,C6C7E0,80AAB3A0,actors -ovl_En_Ds,E46C70,E47890,C6C7E0,C6CF10,80AAB890,actors -ovl_En_Mk,E47890,E48720,C6CF10,C6D770,80AAC4B0,actors -ovl_En_Bom_Bowl_Man,E48720,E49C60,C6D770,C6E4B0,80AAD340,actors -ovl_En_Bom_Bowl_Pit,E49C60,E4A5D0,C6E4B0,C6EAD0,80AAE880,actors -ovl_En_Owl,E4A5D0,E4E170,C6EAD0,C707E0,80AAF1F0,actors -ovl_En_Ishi,E4E170,E572C0,C707E0,C717A0,80AB2D90,actors -ovl_Obj_Hana,E572C0,E575D0,C717A0,C719C0,80ABBEE0,actors -ovl_Obj_Lightswitch,E575D0,E58A00,C719C0,C72570,80ABC1F0,actors -ovl_Obj_Mure2,E58A00,E59420,C72570,C72BB0,80ABD620,actors -ovl_En_Go,E59420,E5DA60,C72BB0,C75160,80ABE040,actors -ovl_En_Fu,E5DA60,E5E7A0,C75160,C75A10,80AC2680,actors -ovl_En_Changer,E5E7A0,E5F180,C75A10,C76020,80AC33D0,actors -ovl_Bg_Jya_Megami,E5F180,E60370,C76020,C76CA0,80AC3DB0,actors -ovl_Bg_Jya_Lift,E60370,E608C0,C76CA0,C77040,80AC4FA0,actors -ovl_Bg_Jya_Bigmirror,E608C0,E61110,C77040,C77610,80AC54F0,actors -ovl_Bg_Jya_Bombchuiwa,E61110,E61C50,C77610,C77D40,80AC5D40,actors -ovl_Bg_Jya_Amishutter,E61C50,E61FE0,C77D40,C77F40,80AC6880,actors -ovl_Bg_Jya_Bombiwa,E61FE0,E625A0,C77F40,C78350,80AC6C10,actors -ovl_Bg_Spot18_Basket,E625A0,E63590,C78350,C78D60,80AC71D0,actors -ovl_En_Ganon_Organ,E63590,E6A5D0,C78D60,C7BCA0,80AC81C0,actors -ovl_En_Siofuki,E6A5D0,E6B380,C7BCA0,C7C530,80ACF200,actors -ovl_En_Stream,E6B380,E6B910,C7C530,C7C920,80ACFFB0,actors -ovl_En_Mm,E6B910,E6CF70,C7C920,C7D770,80AD0540,actors -ovl_En_Ko,E6CF70,E710B0,C7D770,C7F6F0,80AD1BA0,actors -ovl_En_Kz,E710B0,E72650,C7F6F0,C80480,80AD5CE0,actors -ovl_En_Weather_Tag,E72650,E73540,C80480,C80AA0,80AD7280,actors -ovl_Bg_Sst_Floor,E73540,E73AA0,C80AA0,C80EB0,80AD8170,actors -ovl_En_Ani,E73AA0,E74810,C80EB0,C816C0,80AD86D0,actors -ovl_En_Ex_Item,E74810,E75990,C816C0,C82120,80AD9440,actors -ovl_Bg_Jya_Ironobj,E75990,E76740,C82120,C82910,80ADA5C0,actors -ovl_En_Js,E76740,E77110,C82910,C82F00,80ADB370,actors -ovl_En_Jsjutan,E77110,E7BEE0,C82F00,C847E0,80ADBD40,actors -ovl_En_Cs,E7BEE0,E7D110,C847E0,C85380,80AE1670,actors -ovl_En_Md,E7D110,E7F780,C85380,C866E0,80AE28A0,actors -ovl_En_Hy,E7F780,E830C0,C866E0,C88530,80AE4F10,actors -ovl_En_Ganon_Mant,E830C0,E872F0,C88530,C89E00,80AE8850,actors -ovl_En_Okarina_Effect,E872F0,E876B0,C89E00,C8A080,80AECA80,actors -ovl_En_Mag,E876B0,E8A6F0,C8A080,C8B630,80AECE40,actors -ovl_Door_Gerudo,E8A6F0,E8ACE0,C8B630,C8BA60,80AF1E80,actors -ovl_Elf_Msg2,E8ACE0,E8B150,C8BA60,C8BCE0,80AF2470,actors -ovl_Demo_Gt,E8B150,E90760,C8BCE0,C8E1A0,80AF28E0,actors -ovl_En_Po_Field,E90760,E94160,C8E1A0,C903D0,80AF7EF0,actors -ovl_Efc_Erupc,E94160,E94C50,C903D0,C90B40,80AFB980,actors -ovl_Bg_Zg,E94C50,E950A0,C90B40,C90E20,80AFC470,actors -ovl_En_Heishi4,E950A0,E95FA0,C90E20,C91710,80AFC8C0,actors -ovl_En_Zl3,E95FA0,E9DDF0,C91710,C94CC0,80AFD7C0,actors -ovl_Boss_Ganon2,E9DDF0,EAF140,C94CC0,C9DC80,80B05610,actors -ovl_En_Kakasi,EAF140,EAFE80,C9DC80,C9E500,80B18480,actors -ovl_En_Takara_Man,EAFE80,EB0740,C9E500,C9EB20,80B191C0,actors -ovl_Obj_Makeoshihiki,EB0740,EB0BD0,C9EB20,C9EE50,80B19A80,actors -ovl_Oceff_Spot,EB0BD0,EB1B00,C9EE50,C9F9C0,80B19F10,actors -ovl_End_Title,EB1B00,EB7540,C9F9C0,CA1670,80B1AE40,actors -ovl_En_Torch,EB7540,EB7630,CA1670,CA1740,80B20880,actors -ovl_Demo_Ec,EB7630,EBAE90,CA1740,CA2A30,80B20970,actors -ovl_Shot_Sun,EBAE90,EBB550,CA2A30,CA2EF0,80B241D0,actors -ovl_En_Dy_Extra,EBB550,EBBAF0,CA2EF0,CA3300,80B24890,actors -ovl_En_Wonder_Talk2,EBBAF0,EBC190,CA3300,CA37A0,80B24E30,actors -ovl_En_Ge2,EBC190,EBDB30,CA37A0,CA4690,80B254D0,actors -ovl_Obj_Roomtimer,EBDB30,EBDD80,CA4690,CA4850,80B26E70,actors -ovl_En_Ssh,EBDD80,EC0370,CA4850,CA5EA0,80B270C0,actors -ovl_En_Sth,EC0370,EC4430,CA5EA0,CA8540,80B296B0,actors -ovl_Oceff_Wipe,EC4430,EC51B0,CA8540,CA8FA0,80B2D770,actors -ovl_Effect_Ss_Dust,EC51B0,EC59F0,CA8FA0,CA9530,80B2E4F0,effects -ovl_Effect_Ss_KiraKira,EC59F0,EC6060,CA9530,CA99D0,80B2ED30,effects -ovl_Effect_Ss_Bomb,EC6060,EC6490,CA99D0,CA9D00,80B2F3A0,effects -ovl_Effect_Ss_Bomb2,EC6490,EC6D90,CA9D00,CAA290,80B2F7D0,effects -ovl_Effect_Ss_Blast,EC6D90,EC7120,CAA290,CAA560,80B300D0,effects -ovl_Effect_Ss_G_Spk,EC7120,EC76D0,CAA560,CAA990,80B30460,effects -ovl_Effect_Ss_D_Fire,EC76D0,EC7BC0,CAA990,CAAD60,80B30A10,effects -ovl_Effect_Ss_Bubble,EC7BC0,EC8040,CAAD60,CAB0B0,80B30F00,effects -ovl_Effect_Ss_G_Ripple,EC8040,EC85A0,CAB0B0,CAB4B0,80B31380,effects -ovl_Effect_Ss_G_Splash,EC85A0,EC8A50,CAB4B0,CAB7C0,80B318E0,effects -ovl_Effect_Ss_G_Magma,EC8A50,EC8CB0,CAB7C0,CAB9A0,80B31D90,effects -ovl_Effect_Ss_G_Fire,EC8CB0,EC8F40,CAB9A0,CABB90,80B31FF0,effects -ovl_Effect_Ss_Lightning,EC8F40,EC9610,CABB90,CAC0C0,80B32280,effects -ovl_Effect_Ss_Dt_Bubble,EC9610,EC9BA0,CAC0C0,CAC4C0,80B32950,effects -ovl_Effect_Ss_Hahen,EC9BA0,ECA1E0,CAC4C0,CAC8E0,80B32EE0,effects -ovl_Effect_Ss_Stick,ECA1E0,ECA580,CAC8E0,CACB90,80B33520,effects -ovl_Effect_Ss_Sibuki,ECA580,ECAC50,CACB90,CAD080,80B338C0,effects -ovl_Effect_Ss_Sibuki2,ECAC50,ECAF80,CAD080,CAD300,80B33F90,effects -ovl_Effect_Ss_G_Magma2,ECAF80,ECB490,CAD300,CAD6E0,80B342C0,effects -ovl_Effect_Ss_Stone1,ECB490,ECB810,CAD6E0,CAD990,80B347D0,effects -ovl_Effect_Ss_HitMark,ECB810,ECBD60,CAD990,CADD60,80B34B50,effects -ovl_Effect_Ss_Fhg_Flash,ECBD60,ECCCE0,CADD60,CAE5E0,80B350A0,effects -ovl_Effect_Ss_K_Fire,ECCCE0,ECD120,CAE5E0,CAE930,80B36020,effects -ovl_Effect_Ss_Solder_Srch_Ball,ECD120,ECD2D0,CAE930,CAEA90,80B36460,effects -ovl_Effect_Ss_Kakera,ECD2D0,ECE360,CAEA90,CAF4C0,80B36610,effects -ovl_Effect_Ss_Ice_Piece,ECE360,ECE7A0,CAF4C0,CAF810,80B376A0,effects -ovl_Effect_Ss_En_Ice,ECE7A0,ECF060,CAF810,CAFE60,80B37AE0,effects -ovl_Effect_Ss_Fire_Tail,ECF060,ECF760,CAFE60,CB0390,80B383A0,effects -ovl_Effect_Ss_En_Fire,ECF760,ECFEB0,CB0390,CB08F0,80B38AA0,effects -ovl_Effect_Ss_Extra,ECFEB0,ED0270,CB08F0,CB0BE0,80B391F0,effects -ovl_Effect_Ss_Fcircle,ED0270,ED0720,CB0BE0,CB0F80,80B395B0,effects -ovl_Effect_Ss_Dead_Db,ED0720,ED0C00,CB0F80,CB1360,80B39A60,effects -ovl_Effect_Ss_Dead_Dd,ED0C00,ED1190,CB1360,CB1780,80B39F40,effects -ovl_Effect_Ss_Dead_Ds,ED1190,ED1610,CB1780,CB1AF0,80B3A4D0,effects -ovl_Effect_Ss_Dead_Sound,ED1610,ED1750,CB1AF0,CB1C00,80B3A950,effects -ovl_Oceff_Storm,ED1750,ED3300,CB1C00,CB33A0,80B3AA90,actors -ovl_En_Weiyer,ED3300,ED4D00,CB33A0,CB4250,80B3C640,actors -ovl_Bg_Spot05_Soko,ED4D00,ED5020,CB4250,CB4480,80B3E040,actors -ovl_Bg_Jya_1flift,ED5020,ED56B0,CB4480,CB48B0,80B3E360,actors -ovl_Bg_Jya_Haheniron,ED56B0,ED5EA0,CB48B0,CB4E10,80B3E9F0,actors -ovl_Bg_Spot12_Gate,ED5EA0,ED62B0,CB4E10,CB50C0,80B3F1E0,actors -ovl_Bg_Spot12_Saku,ED62B0,ED6770,CB50C0,CB53F0,80B3F5F0,actors -ovl_En_Hintnuts,ED6770,ED81A0,CB53F0,CB62E0,80B3FAB0,actors -ovl_En_Nutsball,ED81A0,ED87C0,CB62E0,CB6760,80B414E0,actors -ovl_Bg_Spot00_Break,ED87C0,ED8960,CB6760,CB68A0,80B41B00,actors -ovl_En_Shopnuts,ED8960,ED9870,CB68A0,CB7170,80B41CA0,actors -ovl_En_It,ED9870,ED9A00,CB7170,CB7280,80B42BB0,actors -ovl_En_GeldB,ED9A00,EDEDB0,CB7280,CB9DA0,80B42D40,actors -ovl_Oceff_Wipe2,EDEDB0,EE0520,CB9DA0,CBA9E0,80B480F0,actors -ovl_Oceff_Wipe3,EE0520,EE1C70,CBA9E0,CBBA20,80B49860,actors -ovl_En_Niw_Girl,EE1C70,EE2740,CBBA20,CBC1D0,80B4AFB0,actors -ovl_En_Dog,EE2740,EE38F0,CBC1D0,CBCC50,80B4BA80,actors -ovl_En_Si,EE38F0,EE3DF0,CBCC50,CBCFC0,80B4CC30,actors -ovl_Bg_Spot01_Objects2,EE3DF0,EE42B0,CBCFC0,CBD330,80B4D130,actors -ovl_Obj_Comb,EE42B0,EE4B10,CBD330,CBD940,80B4D5F0,actors -ovl_Bg_Spot11_Bakudankabe,EE4B10,EE5150,CBD940,CBDDB0,80B4DE50,actors -ovl_Obj_Kibako2,EE5150,EE5810,CBDDB0,CBE260,80B4E490,actors -ovl_En_Dnt_Demo,EE5810,EE6530,CBE260,CBEB10,80B4EB50,actors -ovl_En_Dnt_Jiji,EE6530,EE7A50,CBEB10,CBF5F0,80B4F870,actors -ovl_En_Dnt_Nomal,EE7A50,EEA850,CBF5F0,CC0D90,80B50D90,actors -ovl_En_Guest,EEA850,EEB1F0,CC0D90,CC1440,80B53B90,actors -ovl_Bg_Bom_Guard,EEB1F0,EEB410,CC1440,CC15F0,80B54530,actors -ovl_En_Hs2,EEB410,EEB9F0,CC15F0,CC19F0,80B54750,actors -ovl_Demo_Kekkai,EEB9F0,EECCE0,CC19F0,CC2630,80B54D30,actors -ovl_Bg_Spot08_Bakudankabe,EECCE0,EED380,CC2630,CC2AE0,80B56020,actors -ovl_Bg_Spot17_Bakudankabe,EED380,EEDA70,CC2AE0,CC2FC0,80B566C0,actors -ovl_Obj_Mure3,EEDA70,EEE240,CC2FC0,CC34F0,80B56DB0,actors -ovl_En_Tg,EEE240,EEE920,CC34F0,CC39A0,80B57580,actors -ovl_En_Mu,EEE920,EEF240,CC39A0,CC4000,80B57C60,actors -ovl_En_Go2,EEF240,EF5280,CC4000,CC7460,80B58580,actors -ovl_En_Wf,EF5280,EF9590,CC7460,CC97F0,80B5E5C0,actors -ovl_En_Skb,EF9590,EFAE80,CC97F0,CCA720,80B628D0,actors -ovl_Demo_Gj,EFAE80,EFEB30,CCA720,CCBEA0,80B641C0,actors -ovl_Demo_Geff,EFEB30,EFF350,CCBEA0,CCC380,80B67E70,actors -ovl_Bg_Gnd_Firemeiro,EFF350,EFF8A0,CCC380,CCC720,80B68690,actors -ovl_Bg_Gnd_Darkmeiro,EFF8A0,F00060,CCC720,CCCC00,80B68BE0,actors -ovl_Bg_Gnd_Soulmeiro,F00060,F008C0,CCCC00,CCD1D0,80B693A0,actors -ovl_Bg_Gnd_Nisekabe,F008C0,F00A30,CCD1D0,CCD2F0,80B69C00,actors -ovl_Bg_Gnd_Iceblock,F00A30,F01B20,CCD2F0,CCDC00,80B69D70,actors -ovl_Bg_Ydan_Sp,F01B20,F03240,CCDC00,CCEA50,80B6AE70,actors -ovl_En_Gb,F03240,F04970,CCEA50,CCF8E0,80B6C590,actors -ovl_En_Gs,F04970,F067E0,CCF8E0,CD0BD0,80B6DCC0,actors -ovl_Bg_Mizu_Bwall,F067E0,F07CB0,CD0BD0,CD1780,80B6FB30,actors -ovl_Bg_Mizu_Shutter,F07CB0,F084B0,CD1780,CD1CB0,80B71000,actors -ovl_En_Daiku_Kakariko,F084B0,F09870,CD1CB0,CD2940,80B71800,actors -ovl_Bg_Bowl_Wall,F09870,F0A1F0,CD2940,CD3000,80B72BC0,actors -ovl_En_Wall_Tubo,F0A1F0,F0A6E0,CD3000,CD3370,80B73540,actors -ovl_En_Po_Desert,F0A6E0,F0B4A0,CD3370,CD3CD0,80B73A30,actors -ovl_En_Crow,F0B4A0,F0CB40,CD3CD0,CD4B00,80B747F0,actors -ovl_Door_Killer,F0CB40,F0E0B0,CD4B00,CD58C0,80B75E90,actors -ovl_Bg_Spot11_Oasis,F0E0B0,F0E7E0,CD58C0,CD5DE0,80B77400,actors -ovl_Bg_Spot18_Futa,F0E7E0,F0E980,CD5DE0,CD5F20,80B77B30,actors -ovl_Bg_Spot18_Shutter,F0E980,F0EED0,CD5F20,CD62A0,80B77CD0,actors -ovl_En_Ma3,F0EED0,F0FE80,CD62A0,CD6CA0,80B78220,actors -ovl_En_Cow,F0FE80,F112E0,CD6CA0,CD77D0,80B791D0,actors -ovl_Bg_Ice_Turara,F112E0,F11B10,CD77D0,CD7D70,80B7A630,actors -ovl_Bg_Ice_Shutter,F11B10,F11F80,CD7D70,CD8040,80B7AE60,actors -ovl_En_Kakasi2,F11F80,F126A0,CD8040,CD84E0,80B7B2D0,actors -ovl_En_Kakasi3,F126A0,F13780,CD84E0,CD8F40,80B7B9F0,actors -ovl_Oceff_Wipe4,F13780,F14760,CD8F40,CD9970,80B7CAD0,actors -ovl_En_Eg,F14760,F14910,CD9970,CD9AB0,80B7DAB0,actors -ovl_Bg_Menkuri_Nisekabe,F14910,F14A60,CD9AB0,CD9BB0,80B7DC60,actors -ovl_En_Zo,F14A60,F17020,CD9BB0,CDB1A0,80B7DDB0,actors -ovl_Effect_Ss_Ice_Smoke,F17020,F17500,CDB1A0,CDB530,80B80370,effects -ovl_Obj_Makekinsuta,F17500,F17650,CDB530,CDB650,80B80850,actors -ovl_En_Ge3,F17650,F18290,CDB650,CDBDE0,80B809A0,actors -ovl_Obj_Timeblock,F18290,F18EE0,CDBDE0,CDC570,80B815E0,actors -ovl_Obj_Hamishi,F18EE0,F19730,CDC570,CDCB40,80B82230,actors -ovl_En_Zl4,F19730,F1E160,CDCB40,CDEB30,80B82A80,actors -ovl_En_Mm2,F1E160,F1EF20,CDEB30,CDF3F0,80B874B0,actors -ovl_Bg_Jya_Block,F1EF20,F1F190,CDF3F0,CDF5F0,80B88270,actors -ovl_Obj_Warp2block,F1F190,F1FCC0,CDF5F0,CDFD50,80B884E0,actors diff --git a/tools/disasm/ique-cn/files_boot.csv b/tools/disasm/ique-cn/files_boot.csv deleted file mode 100644 index dfbbf225bc..0000000000 --- a/tools/disasm/ique-cn/files_boot.csv +++ /dev/null @@ -1,141 +0,0 @@ -offset,vram,.text -0,80000450,src/boot/boot_main -140,80000590,src/boot/idle -390,800007E0,src/boot/viconfig -4D0,80000920,src/boot/z_std_dma -B50,80000FA0,src/boot/inflate -2830,80002C80,src/boot/z_locale -2870,80002CC0,src/boot/is_debug_ique -2890,80002CE0,src/boot/driverominit -2A70,80002EC0,src/boot/mio0 -2B20,80002F70,src/libu64/stackcheck -2D70,800031C0,src/libultra/os/invaldcache -2E20,80003270,src/libultra/os/invalicache -2EA0,800032F0,src/libultra/libc/bcmp -2FB0,80003400,src/libultra/libc/bzero -3050,800034A0,src/libultra/os/createmesgqueue -30C0,80003510,src/libultra/os/recvmesg -3230,80003680,src/libultra/os/sendmesg -33A0,800037F0,src/libultra/os/getfpccsr -33B0,80003800,src/libultra/os/getsr -33C0,80003810,src/libultra/os/setfpccsr -33D0,80003820,src/libultra/os/setsr -33E0,80003830,src/libultra/os/createthread -3550,800039A0,src/libultra/os/setthreadpri -3660,80003AB0,src/libultra/os/startthread -37F0,80003C40,src/libultra/os/stopthread -38E0,80003D30,src/libultra/os/thread -3940,80003D90,src/libultra/os/gettime -39F0,80003E40,src/libultra/os/timerintr -3F10,80004360,src/libultra/io/vigetnextframebuf -3F50,800043A0,src/libultra/io/vimgr -4250,800046A0,src/libultra/io/visetmode -42D0,80004720,src/libultra/io/visetspecial -4450,800048A0,src/libultra/io/visetxscale -4510,80004960,src/libultra/io/visetyscale -4560,800049B0,src/libultra/io/viswapbuf -45B0,80004A00,src/libultra/io/viswapcontext -48C0,80004D10,src/libultra/io/viblack -4920,80004D70,src/libultra/io/viextendvstart -4930,80004D80,src/libultra/os/exceptasm -53B0,80005800,src/libultra/os/interrupt -5440,80005890,src/libultra/os/setintmask -54F0,80005940,src/libultra/os/sethwintrroutine -5580,800059D0,src/libultra/os/gethwintrroutine -55F0,80005A40,src/libultra/io/pimgr -5770,80005BC0,src/libultra/io/epirawdma -5B30,80005F80,src/libultra/io/epiread -5B90,80005FE0,src/libultra/io/epidma -5C30,80006080,src/libultra/io/cartrominit -5D90,800061E0,src/libultra/io/devmgr -6230,80006680,src/libultra/io/piacs -62F0,80006740,src/libultra/os/parameters -6360,800067B0,src/libultra/os/getmemsize -6390,800067E0,src/libultra/os/initialize -6920,80006D70,src/libultra/os/writebackdcache -69A0,80006DF0,src/libultra/os/virtualtophysical -6A70,80006EC0,src/libultra/libc/bcopy -6D90,800071E0,src/libultra/os/jammesg -6F10,80007360,src/libultra/os/seteventmesg -6FE0,80007430,src/libultra/os/getcause -6FF0,80007440,src/libultra/os/setwatchlo -7000,80007450,src/libultra/reg/_getcount -7100,80007550,src/libultra/reg/_setcompare -71B0,80007600,src/libultra/io/sirawread -7200,80007650,src/libultra/io/sirawwrite -7250,800076A0,src/libultra/os/destroythread -7380,800077D0,src/libultra/os/getthreadpri -73D0,80007820,src/libultra/os/yieldthread -7430,80007880,src/libultra/os/probetlb -74F0,80007940,src/libultra/os/maptlbrdb -7550,800079A0,src/libultra/os/unmaptlball -75A0,800079F0,src/libultra/io/vi -76A0,80007AF0,src/libultra/io/vigetcurrcontext -76B0,80007B00,src/libultra/os/setglobalintmask -7710,80007B60,src/libultra/os/resetglobalintmask -7780,80007BD0,src/libultra/io/pirawdma -7860,80007CB0,src/libultra/io/pigetcmdq -7890,80007CE0,src/libultra/io/epirawread -7A10,80007E60,src/libultra/io/epirawwrite -7B90,80007FE0,src/libultra/io/si -7BC0,80008010,src/libgcc/__divdi3 -81A0,800085F0,src/libgcc/__moddi3 -8730,80008B80,src/libgcc/__udivdi3 -8CA0,800090F0,src/libgcc/__umoddi3 -91B0,80009600,src/libgcc/__cmpdi2 -9200,80009650,src/libgcc/__floatdidf -9250,800096A0,src/libgcc/__floatdisf -9310,80009760,src/libgcc/__fixunsdfdi -9510,80009960,src/libgcc/__fixdfdi -9580,800099D0,src/libgcc/__fixunssfdi -9780,80009BD0,src/libgcc/__fixsfdi -97E0,80009C30,data/rsp_boot - -offset,vram,.data -98D0,80009D20,src/boot/idle -98F0,80009D40,src/boot/viconfig -9910,80009D60,src/boot/carthandle -9920,80009D70,src/boot/z_std_dma -9930,80009D80,src/boot/inflate -9AB0,80009F00,src/boot/z_locale -9AC0,80009F10,src/boot/driverominit -9AD0,80009F20,src/libu64/stackcheck -9AE0,80009F30,src/libultra/os/thread -9B00,80009F50,src/libultra/os/timerintr -9B10,80009F60,src/libultra/io/vimgr -9B30,80009F80,src/libultra/io/vimodentsclan1 -9B80,80009FD0,src/libultra/io/vimodepallan1 -9BD0,8000A020,src/libultra/io/vimodempallan1 -9C20,8000A070,src/libultra/os/exceptasm -9C50,8000A0A0,src/libultra/io/pimgr -9C80,8000A0D0,src/libultra/io/cartrominit -9C90,8000A0E0,src/libultra/io/piacs -9CA0,8000A0F0,src/libultra/os/initialize -9CC0,8000A110,src/libultra/os/seteventmesg -9CD0,8000A120,src/libultra/io/vi - -offset,vram,.rodata -9D40,8000A190,src/boot/boot_main -9D50,8000A1A0,src/boot/idle -9FA0,8000A3F0,src/boot/z_std_dma -A210,8000A660,src/libu64/stackcheck -A220,8000A670,src/libultra/os/exceptasm -A270,8000A6C0,src/libultra/os/setintmask -A2F0,8000A740,src/libultra/io/devmgr -A310,8000A760,src/libgcc/__divdi3 -A410,8000A860,src/libgcc/__moddi3 -A510,8000A960,src/libgcc/__udivdi3 -A610,8000AA60,src/libgcc/__umoddi3 -A710,8000AA70,src/boot/build - -offset,vram,.bss -A750,8000ABA0,data/boot_common_8000ABA0 -A7A0,8000ABF0,src/boot/boot_main -B190,8000B5E0,src/boot/idle -BD90,8000C1E0,src/boot/z_std_dma -C500,8000C950,src/boot/inflate -10310,80010760,src/boot/driverominit -10390,800107E0,src/libultra/io/vimgr -115B0,80011A00,src/libultra/io/pimgr -12940,80012D90,data/boot_common_80012D90 -12BF0,80013040,.end diff --git a/tools/disasm/ique-cn/files_code.csv b/tools/disasm/ique-cn/files_code.csv deleted file mode 100644 index 031d059a0b..0000000000 --- a/tools/disasm/ique-cn/files_code.csv +++ /dev/null @@ -1,528 +0,0 @@ -offset,vram,.text -0,80018FA0,src/code/z_en_a_keep -AA0,80019A40,src/code/z_en_item00 -2EA0,8001BE40,src/code/z_eff_blure -62D0,8001F270,src/code/z_eff_shield_particle -7930,800208D0,src/code/z_eff_spark -8FE0,80021F80,src/code/z_eff_ss_dead -9790,80022730,src/code/z_effect -9F10,80022EB0,src/code/z_effect_soft_sprite -A9B0,80023950,src/code/z_effect_soft_sprite_old_init -D4D0,80026470,src/code/flg_set -D8F0,80026890,src/code/z_DLF -DB40,80026AE0,src/code/z_actor -18ED0,80031E70,src/code/z_actor_dlftbls -19020,80031FC0,src/code/z_bgcheck -22C00,8003BBA0,src/code/z_bg_collect -22F20,8003BEC0,src/code/z_bg_item -232B0,8003C250,src/code/z_camera -378E0,80050880,src/code/z_collision_btltbls -37940,800508E0,src/code/z_collision_check -3F5C0,80058560,src/code/z_common_data -3F670,80058610,src/code/z_debug -3F980,80058920,src/code/z_debug_display -3FE40,80058DE0,src/code/z_demo -44B20,8005DAC0,src/code/z_memory_utils -44BB0,8005DB50,src/code/z_draw -46AB0,8005FA50,src/code/z_sfx_source -46C70,8005FC10,src/code/z_elf_message -47350,800602F0,src/code/z_face_reaction -473A0,80060340,src/code/z_env_flags -47520,800604C0,src/code/z_fcurve_data -47760,80060700,src/code/z_fcurve_data_skelanime -47F70,80060F10,src/code/z_horse -48C50,80061BF0,src/code/z_jpeg -49410,800623B0,src/code/z_kaleido_setup -497E0,80062780,src/code/z_kanfont -499E0,80062980,src/code/z_kankyo -511F0,8006A190,src/code/z_lib -52390,8006B330,src/code/z_lifemeter -53730,8006C6D0,src/code/z_lights -547D0,8006D770,src/code/z_malloc -549B0,8006D950,src/code/z_map_mark -54FB0,8006DF50,src/code/z_prenmi_buff -55070,8006E010,src/code/z_nulltask -550F0,8006E090,src/code/z_olib -557E0,8006E780,src/code/z_onepointdemo -59780,80072720,src/code/z_map_exp -5B320,800742C0,src/code/z_parameter -66080,8007F020,src/code/z_path -66250,8007F1F0,src/code/z_frame_advance -66300,8007F2A0,src/code/z_player_lib -69D70,80082D10,src/code/z_prenmi -69F10,80082EB0,src/code/z_quake -6AD80,80083D20,src/code/z_rcp -6C640,800855E0,src/code/z_room -6DE30,80086DD0,src/code/z_sample -6E230,800871D0,src/code/z_inventory -6E3F0,80087390,src/code/z_scene -6F8A0,80088840,src/code/z_scene_table -760A0,8008F040,src/code/z_skelanime -7AA90,80093A30,src/code/z_skin -7B630,800945D0,src/code/z_skin_awb -7BF40,80094EE0,src/code/z_skin_matrix -7D2E0,80096280,src/code/z_sram -7E690,80097630,src/code/z_ss_sram -7E860,80097800,src/code/z_rumble -7EAE0,80097A80,src/code/z_view -801E0,80099180,src/code/z_vimode -80D50,80099CF0,src/code/z_viscvg -80EF0,80099E90,src/code/z_vismono -81710,8009A6B0,src/code/z_viszbuf -819A0,8009A940,src/code/z_vr_box -84270,8009D210,src/code/z_vr_box_draw -84950,8009D8F0,src/code/z_player_call -84AC0,8009DA60,src/code/z_fbdemo -854E0,8009E480,src/code/z_fbdemo_triforce -85AA0,8009EA40,src/code/z_fbdemo_wipe1 -85F10,8009EEB0,src/code/z_fbdemo_circle -865D0,8009F570,src/code/z_fbdemo_fade -86930,8009F8D0,src/code/shrink_window -86AA0,8009FA40,src/code/z_cutscene_spline -86F70,8009FF10,src/code/z_kaleido_manager -871A0,800A0140,src/code/z_kaleido_scope_call -87480,800A0420,src/code/z_play -8AEA0,800A3E40,src/code/PreRender -8CF90,800A5F30,src/code/TwoHeadGfxArena -8D1A0,800A6140,src/code/TwoHeadArena -8D360,800A6300,src/code/audio_stop_all_sfx -8D3B0,800A6350,src/code/audio_thread_manager -8D7C0,800A6760,src/code/title_setup -8D830,800A67D0,src/code/game -8DFB0,800A6F50,src/code/gamealloc -8E0F0,800A7090,src/code/graph -8EA90,800A7A30,src/code/gfxalloc -8EAF0,800A7A90,src/code/listalloc -8EC40,800A7BE0,src/code/main -8EFA0,800A7F40,src/code/padmgr -8FAA0,800A8A40,src/code/sched -90720,800A96C0,src/code/speed_meter -91160,800AA100,src/code/sys_cfb -91280,800AA220,src/code/sys_math -91520,800AA4C0,src/code/sys_math3d -972F0,800B0290,src/code/sys_math_atan -97520,800B04C0,src/code/sys_matrix -99920,800B28C0,src/code/sys_ucode -99970,800B2910,src/code/sys_rumble -99CD0,800B2C70,src/code/sys_freeze -99D00,800B2CA0,src/code/irqmgr -9A320,800B32C0,src/code/fault_gc -9CB70,800B5B10,src/code/fault_gc_drawer -9D5F0,800B6590,src/code/kanread -9E0E0,800B7080,src/audio/lib/synthesis -A1240,800BA1E0,src/audio/lib/heap -A4610,800BD5B0,src/audio/lib/load -A8400,800C13A0,src/audio/lib/thread -A9C60,800C2C00,src/audio/lib/dcache -A9CE0,800C2C80,src/audio/lib/aisetnextbuf -A9D60,800C2D00,src/audio/lib/playback -ABCE0,800C4C80,src/audio/lib/effects -AC760,800C5700,src/audio/lib/seqplayer -AFD80,800C8D20,src/audio/general -B5F10,800CEEB0,src/audio/sfx -B7D70,800D0D10,src/audio/sequence -B9990,800D2930,src/libu64/system_heap -B9CD0,800D2C70,src/libu64/debug -B9D30,800D2CD0,src/libu64/gfxprint -BAAA0,800D3A40,src/libu64/relocation_gc -BACE0,800D3C80,src/libu64/loadfragment2_gc -BAD40,800D3CE0,src/libu64/load_gc -BAE10,800D3DB0,src/libu64/padsetup -BAF50,800D3EF0,src/libu64/pad -BB140,800D40E0,src/libu64/rcp_utils -BB1A0,800D4140,src/libc64/__osMalloc_gc -BBF50,800D4EF0,src/libc64/aprintf -BBFB0,800D4F50,src/libc64/malloc -BC180,800D5120,src/libc64/math64 -BC690,800D5630,src/libc64/fp -BC7F0,800D5790,src/libc64/qrand -BC9B0,800D5950,src/libc64/sleep -BCB50,800D5AF0,src/libc64/sprintf -BCC20,800D5BC0,src/code/jpegutils -BD130,800D60D0,src/code/jpegdecoder -BD720,800D66C0,src/libultra/io/aigetlen -BD730,800D66D0,src/libultra/io/aisetfreq -BD830,800D67D0,src/libultra/audio/sl -BD8E0,800D6880,src/libultra/audio/synthesizer -BDF50,800D6EF0,src/libultra/audio/syndelete -BDF60,800D6F00,src/libultra/audio/synallocfx -BE000,800D6FA0,src/libultra/os/writebackdcacheall -BE030,800D6FD0,src/libultra/io/contquery -BE0E0,800D7080,src/libultra/io/contreaddata -BE360,800D7300,src/libultra/io/controller -BE730,800D76D0,src/libultra/io/contsetch -BE790,800D7730,src/libultra/gu/sqrtf -BE7A0,800D7740,src/libultra/gu/cosf -BE8D0,800D7870,src/libultra/gu/coss -BE8F0,800D7890,src/libultra/gu/lookat -BEC20,800D7BC0,src/libultra/gu/lookathil -BF4F0,800D8490,src/libultra/gu/ortho -BF660,800D8600,src/libultra/gu/perspective -BF860,800D8800,src/libultra/gu/position -BFA40,800D89E0,src/libultra/gu/sinf -BFBC0,800D8B60,src/libultra/gu/sins -BFC10,800D8BB0,src/libultra/gu/us2dex -BFD30,800D8CD0,src/libultra/libc/ll -C02B0,800D9250,src/libultra/libc/llcvt -C05C0,800D9560,src/libultra/libc/string -C0640,800D95E0,src/libultra/libc/xprintf -C1020,800D9FC0,src/libultra/io/dpgetstat -C1030,800D9FD0,src/libultra/io/dpsetstat -C1040,800D9FE0,src/libultra/io/spgetstat -C1050,800D9FF0,src/libultra/io/spsetstat -C1060,800DA000,src/libultra/io/sptask -C1270,800DA210,src/libultra/io/sptaskyield -C1290,800DA230,src/libultra/io/sptaskyielded -C12E0,800DA280,src/libultra/io/sirawdma -C13C0,800DA360,src/libultra/io/siacs -C1480,800DA420,src/libultra/os/getthreadid -C14D0,800DA470,src/libultra/os/getactivequeue -C1500,800DA4A0,src/libultra/os/settimer -C16C0,800DA660,src/libultra/os/stoptimer -C17E0,800DA780,src/libultra/io/vigetcurrframebuf -C1820,800DA7C0,src/libultra/io/visetevent -C1880,800DA820,src/libultra/mgu/mtxident -C18E0,800DA880,src/libultra/mgu/mtxidentf -C1940,800DA8E0,src/libultra/mgu/mtxf2l -C19C0,800DA960,src/libultra/mgu/scale -C1A60,800DAA00,src/libultra/mgu/translate -C1B30,800DAAD0,src/libultra/gu/rotate -C1CC0,800DAC60,src/libultra/os/getcurrfaultedthread -C1CF0,800DAC90,src/libultra/bb/sk/skapi -C1F40,800DAEE0,src/libultra/bb/sa/common -C2030,800DAFD0,src/libultra/io/motor -C2040,800DAFE0,src/libultra/os/afterprenmi -C2080,800DB020,src/libultra/audio/drvrnew -C2830,800DB7D0,src/libultra/audio/load -C32C0,800DC260,src/libultra/audio/auxbus -C33D0,800DC370,src/libultra/audio/env -C3F40,800DCEE0,src/libultra/audio/filter -C3F60,800DCF00,src/libultra/audio/mainbus -C40D0,800DD070,src/libultra/audio/resample -C4370,800DD310,src/libultra/audio/reverb -C4EE0,800DDE80,src/libultra/audio/save -C4FC0,800DDF60,src/libultra/audio/heapalloc -C5010,800DDFB0,src/libultra/audio/copy -C5040,800DDFE0,src/libultra/libc/xlitob -C5270,800DE210,src/libultra/libc/xldtob -C5C70,800DEC10,src/libultra/io/sp -C5CA0,800DEC40,src/libultra/io/spsetpc -C5CD0,800DEC70,src/libultra/io/sprawdma -C5D60,800DED00,src/libultra/mgu/normalize -C5DC0,800DED60,src/libultra/libc/ldiv -C5F80,800DEF20,src/libc/fmodf -C5FC0,800DEF60,src/libc/memmove -C6050,800DEFF0,src/libc/absf -C6060,800DF000,src/libc/sqrt -C6070,800DF010,src/code/z_message_z_game_over -D20D0,800EB070,src/code/z_construct -D2FD0,800EBF70,data/rsp.text - -offset,vram,.data -D6330,800EF2D0,src/code/z_en_a_keep -D63D0,800EF370,src/code/z_en_item00 -D6670,800EF610,src/code/z_eff_blure -D6720,800EF6C0,src/code/z_eff_shield_particle -D6770,800EF710,src/code/z_effect -D67C0,800EF760,src/code/z_effect_soft_sprite -D67D0,800EF770,src/code/z_effect_soft_sprite_old_init -D68C0,800EF860,src/code/z_effect_soft_sprite_dlftbls -D6CD0,800EFC70,src/code/flg_set -D6E90,800EFE30,src/code/z_actor -D7180,800F0120,src/code/z_actor_dlftbls -DAC70,800F3C10,src/code/z_bgcheck -DADC0,800F3D60,src/code/z_camera -DE310,800F72B0,src/code/z_collision_btltbls -DE5F0,800F7590,src/code/z_collision_check -DE8A0,800F7840,src/code/z_debug -DE8D0,800F7870,src/code/z_debug_display -DE920,800F78C0,src/code/z_demo -DEA80,800F7A20,src/code/z_draw -DFB00,800F8AA0,src/code/z_elf_message -DFB50,800F8AF0,src/code/z_face_reaction -DFF90,800F8F30,src/code/z_game_dlftbls -E00B0,800F9050,src/code/z_horse -E01C0,800F9160,src/code/z_jpeg -E0200,800F91A0,src/code/z_kaleido_setup -E0250,800F91F0,src/code/z_kankyo -E0640,800F95E0,src/code/z_lib -E0670,800F9610,src/code/z_lifemeter -E0790,800F9730,src/code/z_lights -E07A0,800F9740,src/code/z_map_mark -E0860,800F9800,src/code/z_onepointdemo -E4180,800FD120,src/code/z_map_exp -E41A0,800FD140,src/code/z_map_data -E5FA0,800FEF40,src/code/z_parameter -E6280,800FF220,src/code/z_player_lib -E6960,800FF900,src/code/z_quake -E6990,800FF930,src/code/z_rcp -E77B0,80100750,src/code/z_room -E7830,801007D0,src/code/z_inventory -E7BB0,80100B50,src/code/z_scene -E7C30,80100BD0,src/code/object_table -E88D0,80101870,src/code/z_scene_table -EAAE0,80103A80,src/code/z_skelanime -EAB00,80103AA0,src/code/z_skin_matrix -EAB40,80103AE0,src/code/z_sram -EACF0,80103C90,src/code/z_ss_sram -EADA0,80103D40,data/unk_8012ABC0.data -EADD0,80103D70,src/code/z_view -EADE0,80103D80,src/code/z_viscvg -EAE70,80103E10,src/code/z_vr_box -EB170,80104110,src/code/z_player_call -EB190,80104130,src/code/z_fbdemo -EB210,801041B0,src/code/z_fbdemo_triforce -EB2E0,80104280,src/code/z_fbdemo_wipe1 -EBD80,80104D20,src/code/z_fbdemo_circle -ED080,80106020,src/code/z_fbdemo_fade -ED0B0,80106050,src/code/shrink_window -ED0C0,80106060,src/code/z_kaleido_manager -ED110,801060B0,src/code/z_play -ED120,801060C0,src/code/audio_stop_all_sfx -ED130,801060D0,src/code/graph -ED140,801060E0,src/code/main -ED150,801060F0,src/code/padmgr -ED160,80106100,src/code/speed_meter -ED190,80106130,src/code/sys_math -ED1D0,80106170,src/code/sys_math_atan -ED9E0,80106980,src/code/sys_matrix -EDA60,80106A00,src/code/sys_ucode -EDA70,80106A10,src/code/sys_rumble -EDA80,80106A20,src/code/irqmgr -EDAA0,80106A40,src/code/fault_gc -EDB00,80106AA0,src/code/fault_gc_drawer -EDB40,80106AE0,src/audio/lib/data -EFF50,80108EF0,src/audio/lib/synthesis -EFF80,80108F20,src/audio/lib/load -EFF90,80108F30,src/audio/lib/thread -EFFB0,80108F50,src/audio/lib/aisetnextbuf -EFFC0,80108F60,src/audio/lib/effects -EFFD0,80108F70,src/audio/lib/seqplayer -F0020,80108FC0,src/audio/general -F1740,8010A6E0,src/audio/sfx_params -F2B10,8010BAB0,src/audio/data -F2B80,8010BB20,src/audio/session_config -F3320,8010C2C0,src/libu64/system_heap -F3330,8010C2D0,src/libu64/gfxprint -F3BE0,8010CB80,src/libu64/logseverity_gc -F3BF0,8010CB90,src/libc64/__osMalloc_gc -F3C00,8010CBA0,src/libc64/fp -F3C20,8010CBC0,src/libc64/qrand -F3C30,8010CBD0,src/libultra/audio/sl -F3C40,8010CBE0,src/libultra/io/controller -F3C50,8010CBF0,src/libultra/gu/position -F3C60,8010CC00,src/libultra/gu/sins -F4460,8010D400,src/libultra/libc/xprintf -F44B0,8010D450,src/libultra/io/siacs -F44C0,8010D460,src/libultra/io/vitbl -F5640,8010E5E0,src/libultra/io/vimodentsclpn1 -F5690,8010E630,src/libultra/io/vimodentsclpf1 -F56E0,8010E680,src/libultra/io/vimodentsclaf1 -F5730,8010E6D0,src/libultra/io/vimodentsclpn2 -F5780,8010E720,src/libultra/io/vimodentsclpf2 -F57D0,8010E770,src/libultra/io/vimodentsclan2 -F5820,8010E7C0,src/libultra/io/vimodentsclaf2 -F5870,8010E810,src/libultra/io/vimodentschpn1 -F58C0,8010E860,src/libultra/io/vimodentschpf1 -F5910,8010E8B0,src/libultra/io/vimodentschan1 -F5960,8010E900,src/libultra/io/vimodentschaf1 -F59B0,8010E950,src/libultra/io/vimodentschpn2 -F5A00,8010E9A0,src/libultra/io/vimodentschpf2 -F5A50,8010E9F0,src/libultra/io/vimodepallpn1 -F5AA0,8010EA40,src/libultra/io/vimodepallpf1 -F5AF0,8010EA90,src/libultra/io/vimodepallaf1 -F5B40,8010EAE0,src/libultra/io/vimodepallpn2 -F5B90,8010EB30,src/libultra/io/vimodepallpf2 -F5BE0,8010EB80,src/libultra/io/vimodepallan2 -F5C30,8010EBD0,src/libultra/io/vimodepallaf2 -F5C80,8010EC20,src/libultra/io/vimodepalhpn1 -F5CD0,8010EC70,src/libultra/io/vimodepalhpf1 -F5D20,8010ECC0,src/libultra/io/vimodepalhan1 -F5D70,8010ED10,src/libultra/io/vimodepalhaf1 -F5DC0,8010ED60,src/libultra/io/vimodepalhpn2 -F5E10,8010EDB0,src/libultra/io/vimodepalhpf2 -F5E60,8010EE00,src/libultra/io/vimodempallpn1 -F5EB0,8010EE50,src/libultra/io/vimodempallpf1 -F5F00,8010EEA0,src/libultra/io/vimodempallaf1 -F5F50,8010EEF0,src/libultra/io/vimodempallpn2 -F5FA0,8010EF40,src/libultra/io/vimodempallpf2 -F5FF0,8010EF90,src/libultra/io/vimodempallan2 -F6040,8010EFE0,src/libultra/io/vimodempallaf2 -F6090,8010F030,src/libultra/io/vimodempalhpn1 -F60E0,8010F080,src/libultra/io/vimodempalhpf1 -F6130,8010F0D0,src/libultra/io/vimodempalhan1 -F6180,8010F120,src/libultra/io/vimodempalhaf1 -F61D0,8010F170,src/libultra/io/vimodempalhpn2 -F6220,8010F1C0,src/libultra/io/vimodempalhpf2 -F6270,8010F210,src/libultra/io/vimodefpallpn1 -F62C0,8010F260,src/libultra/io/vimodefpallpf1 -F6310,8010F2B0,src/libultra/io/vimodefpallan1 -F6360,8010F300,src/libultra/io/vimodefpallaf1 -F63B0,8010F350,src/libultra/io/vimodefpallpn2 -F6400,8010F3A0,src/libultra/io/vimodefpallpf2 -F6450,8010F3F0,src/libultra/io/vimodefpallan2 -F64A0,8010F440,src/libultra/io/vimodefpallaf2 -F64F0,8010F490,src/libultra/io/vimodefpalhpn1 -F6540,8010F4E0,src/libultra/io/vimodefpalhpf1 -F6590,8010F530,src/libultra/io/vimodefpalhan1 -F65E0,8010F580,src/libultra/io/vimodefpalhaf1 -F6630,8010F5D0,src/libultra/io/vimodefpalhpn2 -F6680,8010F620,src/libultra/io/vimodefpalhpf2 -F66D0,8010F670,src/libultra/gu/rotate -F66E0,8010F680,src/libultra/audio/drvrnew -F6870,8010F810,src/libultra/audio/env -F6970,8010F910,src/libultra/libc/xlitob - -offset,vram,.rodata -F69A0,8010F940,src/code/z_en_a_keep -F69F0,8010F990,src/code/z_en_item00 -F6C60,8010FC00,src/code/z_eff_blure -F6C90,8010FC30,src/code/z_eff_shield_particle -F6CA0,8010FC40,src/code/z_eff_spark -F6CB0,8010FC50,src/code/z_eff_ss_dead -F6CC0,8010FC60,src/code/z_effect_soft_sprite_old_init -F6CE0,8010FC80,src/code/flg_set -F7070,80110010,src/code/z_actor -F7790,80110730,src/code/z_actor_dlftbls -F77E0,80110780,src/code/z_bgcheck -F7880,80110820,src/code/z_bg_item -F7890,80110830,src/code/z_camera -F8010,80110FB0,src/code/z_collision_check -F8060,80111000,src/code/z_debug -F8070,80111010,src/code/z_demo -F8550,801114F0,src/code/z_draw -F8560,80111500,src/code/z_elf_message -F8680,80111620,src/code/z_fcurve_data -F8690,80111630,src/code/z_fcurve_data_skelanime -F86A0,80111640,src/code/z_horse -F86B0,80111650,src/code/z_jpeg -F8740,801116E0,src/code/z_kanfont -F87A0,80111740,src/code/z_kankyo -F8850,801117F0,src/code/z_lib -F8860,80111800,src/code/z_lifemeter -F8880,80111820,src/code/z_lights -F8890,80111830,src/code/z_map_mark -F88F0,80111890,src/code/z_olib -F8910,801118B0,src/code/z_onepointdemo -F91D0,80112170,src/code/z_map_exp -F94F0,80112490,src/code/z_parameter -F9BF0,80112B90,src/code/z_path -F9C00,80112BA0,src/code/z_player_lib -F9C60,80112C00,src/code/z_quake -F9CF0,80112C90,src/code/z_room -F9D30,80112CD0,src/code/z_sample -F9D40,80112CE0,src/code/z_scene_table -F9D80,80112D20,src/code/z_skelanime -F9DA0,80112D40,src/code/z_skin -F9DB0,80112D50,src/code/z_skin_matrix -F9DC0,80112D60,src/code/z_sram -FA460,80113400,src/code/z_rumble -FA470,80113410,src/code/z_view -FA480,80113420,src/code/z_vr_box -FA570,80113510,src/code/z_fbdemo_triforce -FA580,80113520,src/code/z_fbdemo_wipe1 -FA590,80113530,src/code/z_fbdemo_circle -FA5A0,80113540,src/code/z_cutscene_spline -FA5B0,80113550,src/code/z_kaleido_manager -FA5D0,80113570,src/code/z_play -FA690,80113630,src/code/game -FA6B0,80113650,src/code/graph -FA700,801136A0,src/code/main -FA730,801136D0,src/code/padmgr -FA740,801136E0,src/code/sys_cfb -FA750,801136F0,src/code/sys_math -FA760,80113700,src/code/sys_math3d -FA7F0,80113790,src/code/sys_math_atan -FA800,801137A0,src/code/sys_matrix -FA830,801137D0,src/code/irqmgr -FA850,801137F0,src/code/fault_gc -FB260,80114200,src/code/fault_gc_drawer -FB690,80114630,src/audio/lib/synthesis -FB6B0,80114650,src/audio/lib/heap -FB6E0,80114680,src/audio/lib/load -FB750,801146F0,src/audio/lib/thread -FB880,80114820,src/audio/lib/playback -FB8B0,80114850,src/audio/lib/effects -FB8E0,80114880,src/audio/lib/seqplayer -FBF20,80114EC0,src/audio/general -FC0B0,80115050,src/audio/sfx -FC0D0,80115070,src/audio/sequence -FC150,801150F0,src/audio/session_init -FC160,80115100,src/libu64/debug -FC170,80115110,src/libu64/gfxprint -FC190,80115130,src/libc64/__osMalloc_gc -FC450,801153F0,src/libc64/math64 -FC4A0,80115440,src/libultra/audio/synthesizer -FC4B0,80115450,src/libultra/gu/cosf -FC500,801154A0,src/libultra/gu/lookathil -FC510,801154B0,src/libultra/gu/perspective -FC520,801154C0,src/libultra/gu/sinf -FC570,80115510,src/libultra/libc/xprintf -FC6F0,80115690,src/libultra/audio/drvrnew -FC710,801156B0,src/libultra/audio/env -FC7B0,80115750,src/libultra/audio/resample -FC7E0,80115780,src/libultra/audio/reverb -FC810,801157B0,src/libultra/gu/libm_vals -FC820,801157C0,src/libultra/libc/xldtob -FC880,80115820,src/code/z_message_z_game_over -106130,8011F0D0,src/code/z_construct -1062E0,8011F280,data/audio_tables.rodata -106E80,8011FE20,data/rsp.rodata - -offset,vram,.bss -108FA0,80121F40,data/code_common_80121F40 -108FC0,80121F60,src/code/z_en_item00 -108FD0,80121F70,src/code/z_effect -10CDC0,80125D60,src/code/flg_set -10CDD0,80125D70,src/code/z_actor -10CE50,80125DF0,src/code/z_actor_dlftbls -10CE60,80125E00,src/code/z_bgcheck -10CF80,80125F20,src/code/z_camera -10D060,80126000,src/code/z_collision_check -10E7C0,80127760,src/code/z_debug -10E9E0,80127980,src/code/z_debug_display -10E9F0,80127990,src/code/z_demo -10EA20,801279C0,src/code/z_kankyo -10EAF0,80127A90,src/code/z_lifemeter -10EB20,80127AC0,src/code/z_lights -10ECB0,80127C50,src/code/z_malloc -10ECE0,80127C80,src/code/z_map_mark -10ECF0,80127C90,src/code/z_map_exp -10ED00,80127CA0,src/code/z_parameter -10ED20,80127CC0,src/code/z_player_lib -10ED40,80127CE0,src/code/z_quake -10EDD0,80127D70,src/code/z_skelanime -10EDE0,80127D80,src/code/z_skin -10FCF0,80128C90,src/code/z_rumble -10FE00,80128DA0,src/code/z_vr_box_draw -10FE10,80128DB0,src/code/z_player_call -10FE20,80128DC0,src/code/z_kaleido_scope_call -10FE40,80128DE0,src/code/z_play -10FF50,80128EF0,src/code/game -110030,80128FD0,src/code/graph -1100A0,80129040,src/code/main -113F30,8012CED0,src/code/padmgr -113F40,8012CEE0,src/code/sched -113F60,8012CF00,src/code/speed_meter -113FD0,8012CF70,src/code/sys_cfb -113FE0,8012CF80,src/code/sys_math3d -114200,8012D1A0,src/code/sys_matrix -114210,8012D1B0,src/code/fault_gc -115090,8012E030,src/code/fault_gc_drawer -1150F0,8012E090,src/audio/lib/load -1151B0,8012E150,src/audio/general -1153B0,8012E350,src/audio/sfx -117BC0,80130B60,src/audio/sequence -118980,80131920,src/audio/data -118A20,801319C0,src/audio/session_config -11EE90,80137E30,src/libu64/gfxprint -11EEA0,80137E40,src/libc64/__osMalloc_gc -11EEB0,80137E50,src/libc64/malloc -11EEE0,80137E80,src/libc64/math64 -11EEF0,80137E90,src/libc64/qrand -11EF00,80137EA0,src/code/jpegdecoder -11EF10,80137EB0,src/libultra/io/sptask -11EF50,80137EF0,src/libultra/io/siacs -11EF60,80137F00,data/code_common_80137F00 -120420,801393C0,src/code/z_message_z_game_over -120440,801393E0,.end diff --git a/tools/disasm/ique-cn/files_ovl_file_choose.csv b/tools/disasm/ique-cn/files_ovl_file_choose.csv deleted file mode 100644 index c850ed0ca5..0000000000 --- a/tools/disasm/ique-cn/files_ovl_file_choose.csv +++ /dev/null @@ -1,23 +0,0 @@ -offset,vram,.text -0,80803700,src/overlays/gamestates/ovl_file_choose/z_file_copy_erase -3AE0,808071E0,src/overlays/gamestates/ovl_file_choose/z_file_nameset -8F30,8080C630,src/overlays/gamestates/ovl_file_choose/z_file_choose - -offset,vram,.data -F6E0,80812DE0,src/overlays/gamestates/ovl_file_choose/z_file_nameset_data -FDC0,808134C0,src/overlays/gamestates/ovl_file_choose/z_file_copy_erase -FDF0,808134F0,src/overlays/gamestates/ovl_file_choose/z_file_nameset -FF90,80813690,src/overlays/gamestates/ovl_file_choose/z_file_choose - -offset,vram,.rodata -10280,80813980,src/overlays/gamestates/ovl_file_choose/z_file_copy_erase -102B0,808139B0,src/overlays/gamestates/ovl_file_choose/z_file_nameset -102C0,808139C0,src/overlays/gamestates/ovl_file_choose/z_file_choose - -offset,vram,.ovl -102E0,808139E0,src/overlays/gamestates/ovl_file_choose/ovl_file_choose_reloc - -offset,vram,.bss -10AD0,808141D0,src/overlays/gamestates/ovl_file_choose/z_file_copy_erase -10AE0,808141E0,src/overlays/gamestates/ovl_file_choose/z_file_nameset -10AF0,808141F0,.end diff --git a/tools/disasm/ique-cn/files_ovl_kaleido_scope.csv b/tools/disasm/ique-cn/files_ovl_kaleido_scope.csv deleted file mode 100644 index 938c3ebc0d..0000000000 --- a/tools/disasm/ique-cn/files_ovl_kaleido_scope.csv +++ /dev/null @@ -1,35 +0,0 @@ -offset,vram,.text -0,808141F0,src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect -2400,808165F0,src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug -43B0,808185A0,src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment -5E30,8081A020,src/overlays/misc/ovl_kaleido_scope/z_kaleido_item -7E20,8081C010,src/overlays/misc/ovl_kaleido_scope/z_kaleido_map -B3F0,8081F5E0,src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt -B5F0,8081F7E0,src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope -149E0,80828BD0,src/overlays/misc/ovl_kaleido_scope/z_lmap_mark - -offset,vram,.data -150A0,80829290,src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect -15250,80829440,src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug -15420,80829610,src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment -15450,80829640,src/overlays/misc/ovl_kaleido_scope/z_kaleido_item -154C0,808296B0,src/overlays/misc/ovl_kaleido_scope/z_kaleido_map -15700,808298F0,src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt -15710,80829900,src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope -160A0,8082A290,src/overlays/misc/ovl_kaleido_scope/z_lmap_mark -160F0,8082A2E0,src/overlays/misc/ovl_kaleido_scope/z_lmap_mark_data - -offset,vram,.rodata -1A250,8082E440,src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug -1A330,8082E520,src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment -1A340,8082E530,src/overlays/misc/ovl_kaleido_scope/z_kaleido_map -1A380,8082E570,src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope -1A5F0,8082E7E0,src/overlays/misc/ovl_kaleido_scope/z_lmap_mark -1A6A0,8082E890,src/overlays/misc/ovl_kaleido_scope/z_lmap_mark_data - -offset,vram,.ovl -1A720,8082E910,src/overlays/misc/ovl_kaleido_scope/ovl_kaleido_scope_reloc - -offset,vram,.bss -1C030,80830220,src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope -1C0A0,80830290,.end diff --git a/tools/disasm/ique-cn/functions.txt b/tools/disasm/ique-cn/functions.txt deleted file mode 100644 index 1afd8b8b50..0000000000 --- a/tools/disasm/ique-cn/functions.txt +++ /dev/null @@ -1,13232 +0,0 @@ -entrypoint = 0x80000400; // type:func -bootclear = 0x80000450; // type:func -bootproc = 0x80000484; // type:func -Main_ThreadEntry = 0x80000590; // type:func -Idle_ThreadEntry = 0x80000604; // type:func -ViConfig_UpdateVi = 0x800007E0; // type:func -ViConfig_UpdateBlack = 0x800008D8; // type:func -DmaMgr_StrCmp = 0x80000920; // type:func -DmaMgr_DmaRomToRam = 0x80000980; // type:func -DmaMgr_AudioDmaHandler = 0x80000AD0; // type:func -DmaMgr_DmaFromDriveRom = 0x80000AEC; // type:func -DmaMgr_GetFileName = 0x80000BA4; // type:func -DmaMgr_ProcessRequest = 0x80000BB0; // type:func -DmaMgr_ThreadEntry = 0x80000D60; // type:func -DmaMgr_RequestAsync = 0x80000DC4; // type:func -DmaMgr_RequestSync = 0x80000E14; // type:func -DmaMgr_Init = 0x80000EAC; // type:func -gzip_malloc = 0x80000FA0; // type:func -gzip_free = 0x80000FE8; // type:func -huft_build = 0x80001004; // type:func -huft_free = 0x800015E8; // type:func -inflate_codes = 0x8000162C; // type:func -inflate_stored = 0x80001BCC; // type:func -inflate_fixed = 0x80001E4C; // type:func -inflate_dynamic = 0x80002018; // type:func -inflate_block = 0x80002808; // type:func -inflate = 0x800029B0; // type:func -gzip_read = 0x80002A88; // type:func -unzip = 0x80002B14; // type:func -clear_bufs = 0x80002B50; // type:func -fill_inbuf = 0x80002B68; // type:func -flush_window = 0x80002C2C; // type:func -gzip_decompress = 0x80002C3C; // type:func -Locale_Init = 0x80002C80; // type:func -Locale_ResetRegion = 0x80002CB4; // type:func -osSyncPrintfUnused = 0x80002CC0; // type:func -osSyncPrintf = 0x80002CC8; // type:func -rmonPrintf = 0x80002CD0; // type:func -osDriveRomInit = 0x80002CE0; // type:func -Mio0_Decompress = 0x80002EC0; // type:func -StackCheck_Init = 0x80002F70; // type:func -StackCheck_Cleanup = 0x80003048; // type:func -StackCheck_GetState = 0x800030B8; // type:func -StackCheck_CheckAll = 0x80003130; // type:func -StackCheck_Check = 0x80003188; // type:func -osInvalDCache = 0x800031C0; // type:func -osInvalICache = 0x80003270; // type:func -bcmp = 0x800032F0; // type:func -bzero = 0x80003400; // type:func -osCreateMesgQueue = 0x800034A0; // type:func -osRecvMesg = 0x80003510; // type:func -osSendMesg = 0x80003680; // type:func -__osGetFpcCsr = 0x800037F0; // type:func -__osGetSR = 0x80003800; // type:func -__osSetFpcCsr = 0x80003810; // type:func -__osSetSR = 0x80003820; // type:func -osCreateThread = 0x80003830; // type:func -osSetThreadPri = 0x800039A0; // type:func -osStartThread = 0x80003AB0; // type:func -osStopThread = 0x80003C40; // type:func -__osDequeueThread = 0x80003D30; // type:func -osGetTime = 0x80003D90; // type:func -__osTimerServicesInit = 0x80003E40; // type:func -__osTimerInterrupt = 0x80003EEC; // type:func -__osSetTimerIntr = 0x800040D4; // type:func -__osInsertTimer = 0x800041A8; // type:func -osViGetNextFramebuffer = 0x80004360; // type:func -osCreateViManager = 0x800043A0; // type:func -viMgrMain = 0x80004518; // type:func -osViSetMode = 0x800046A0; // type:func -osViSetSpecialFeatures = 0x80004720; // type:func -osViSetXScale = 0x800048A0; // type:func -osViSetYScale = 0x80004960; // type:func -osViSwapBuffer = 0x800049B0; // type:func -__osViSwapContext = 0x80004A00; // type:func -osViBlack = 0x80004D10; // type:func -osViExtendVStart = 0x80004D70; // type:func -__osExceptionPreamble = 0x80004D80; // type:func -__osException = 0x80004D90; // type:func -__osEnqueueAndYield = 0x80005504; // type:func -__osEnqueueThread = 0x80005610; // type:func -__osPopThread = 0x80005658; // type:func -__osNop = 0x80005668; // type:func -__osDispatchThread = 0x80005670; // type:func -__osCleanupThread = 0x800057F0; // type:func -__osDisableInt = 0x80005800; // type:func -__osRestoreInt = 0x80005870; // type:func -osSetIntMask = 0x80005890; // type:func -__osSetHWIntrRoutine = 0x80005940; // type:func -__osGetHWIntrRoutine = 0x800059D0; // type:func -osCreatePiManager = 0x80005A40; // type:func -__osEPiRawStartDma = 0x80005BC0; // type:func -osEPiReadIo = 0x80005F80; // type:func -osEPiStartDma = 0x80005FE0; // type:func -osCartRomInit = 0x80006080; // type:func -__osDevMgrMain = 0x800061E0; // type:func -__osPiCreateAccessQueue = 0x80006680; // type:func -__osPiGetAccess = 0x800066D4; // type:func -__osPiRelAccess = 0x80006710; // type:func -osGetMemSize = 0x800067B0; // type:func -__createSpeedParam = 0x800067E0; // type:func -__osInitialize_common = 0x80006894; // type:func -__osInitialize_autodetect = 0x80006D4C; // type:func -osWritebackDCache = 0x80006D70; // type:func -osVirtualToPhysical = 0x80006DF0; // type:func -bcopy = 0x80006EC0; // type:func -osJamMesg = 0x800071E0; // type:func -osSetEventMesg = 0x80007360; // type:func -__osGetCause = 0x80007430; // type:func -__osSetWatchLo = 0x80007440; // type:func -osGetCount = 0x80007450; // type:func -__osSetCompare = 0x80007550; // type:func -__osSiRawReadIo = 0x80007600; // type:func -__osSiRawWriteIo = 0x80007650; // type:func -osDestroyThread = 0x800076A0; // type:func -osGetThreadPri = 0x800077D0; // type:func -osYieldThread = 0x80007820; // type:func -__osProbeTLB = 0x80007880; // type:func -osMapTLBRdb = 0x80007940; // type:func -osUnmapTLBAll = 0x800079A0; // type:func -__osViInit = 0x800079F0; // type:func -__osViGetCurrentContext = 0x80007AF0; // type:func -__osSetGlobalIntMask = 0x80007B00; // type:func -__osResetGlobalIntMask = 0x80007B60; // type:func -__osPiRawStartDma = 0x80007BD0; // type:func -osPiGetCmdQueue = 0x80007CB0; // type:func -__osEPiRawReadIo = 0x80007CE0; // type:func -__osEPiRawWriteIo = 0x80007E60; // type:func -__osSiDeviceBusy = 0x80007FE0; // type:func -__divdi3 = 0x80008010; // type:func -__moddi3 = 0x800085F0; // type:func -__udivdi3 = 0x80008B80; // type:func -__umoddi3 = 0x800090F0; // type:func -__cmpdi2 = 0x80009600; // type:func -__floatdidf = 0x80009650; // type:func -__floatdisf = 0x800096A0; // type:func -__fixunsdfdi = 0x80009760; // type:func -__fixdfdi = 0x80009960; // type:func -__fixunssfdi = 0x800099D0; // type:func -__fixsfdi = 0x80009BD0; // type:func -EnAObj_SetupAction = 0x80018FA0; // type:func -EnAObj_Init = 0x80018FAC; // type:func -EnAObj_Destroy = 0x800192EC; // type:func -EnAObj_WaitFinishedTalking = 0x80019348; // type:func -EnAObj_SetupWaitTalk = 0x80019378; // type:func -EnAObj_WaitTalk = 0x800193A0; // type:func -EnAObj_SetupBlockRot = 0x80019454; // type:func -EnAObj_BlockRot = 0x800194A4; // type:func -EnAObj_SetupBoulderFragment = 0x800195C4; // type:func -EnAObj_BoulderFragment = 0x800195EC; // type:func -EnAObj_SetupBlock = 0x8001970C; // type:func -EnAObj_Block = 0x8001974C; // type:func -EnAObj_Update = 0x80019834; // type:func -EnAObj_Draw = 0x80019950; // type:func -EnItem00_SetupAction = 0x80019A40; // type:func -EnItem00_Init = 0x80019A4C; // type:func -EnItem00_Destroy = 0x8001A0B4; // type:func -func_8001DFC8 = 0x8001A0E0; // type:func -func_8001E1C8 = 0x8001A2E0; // type:func -func_8001E304 = 0x8001A41C; // type:func -EnItem00_Collected = 0x8001A6E0; // type:func -EnItem00_Update = 0x8001A838; // type:func -EnItem00_Draw = 0x8001AEB8; // type:func -EnItem00_DrawRupee = 0x8001B050; // type:func -EnItem00_DrawCollectible = 0x8001B168; // type:func -EnItem00_DrawHeartContainer = 0x8001B2A8; // type:func -EnItem00_DrawHeartPiece = 0x8001B3A0; // type:func -func_8001F404 = 0x8001B438; // type:func -Item_DropCollectible = 0x8001B580; // type:func -Item_DropCollectible2 = 0x8001B7B8; // type:func -Item_DropCollectibleRandom = 0x8001B98C; // type:func -EffectBlure_AddVertex = 0x8001BE40; // type:func -EffectBlure_AddSpace = 0x8001C164; // type:func -EffectBlure_InitElements = 0x8001C1A8; // type:func -EffectBlure_Init1 = 0x8001C260; // type:func -EffectBlure_Init2 = 0x8001C370; // type:func -EffectBlure_Destroy = 0x8001C4A4; // type:func -EffectBlure_Update = 0x8001C4B0; // type:func -EffectBlure_UpdateFlags = 0x8001C914; // type:func -EffectBlure_GetComputedValues = 0x8001CA84; // type:func -EffectBlure_SetupSmooth = 0x8001CF98; // type:func -EffectBlure_DrawElemNoInterpolation = 0x8001CFCC; // type:func -EffectBlure_DrawElemHermiteInterpolation = 0x8001D4A0; // type:func -EffectBlure_DrawSmooth = 0x8001DE2C; // type:func -EffectBlure_SetupSimple = 0x8001E0FC; // type:func -EffectBlure_SetupSimpleAlt = 0x8001E134; // type:func -EffectBlure_DrawSimpleVertices = 0x8001E39C; // type:func -EffectBlure_DrawSimple = 0x8001E87C; // type:func -EffectBlure_Draw = 0x8001ED88; // type:func -EffectShieldParticle_Init = 0x8001F270; // type:func -EffectShieldParticle_Destroy = 0x8001F4A8; // type:func -EffectShieldParticle_Update = 0x8001F534; // type:func -EffectShieldParticle_GetColors = 0x8001F698; // type:func -EffectShieldParticle_Draw = 0x800203B8; // type:func -EffectSpark_Init = 0x800208D0; // type:func -EffectSpark_Destroy = 0x80020CAC; // type:func -EffectSpark_Update = 0x80020CB8; // type:func -EffectSpark_Draw = 0x80020D7C; // type:func -func_80026230 = 0x80021F80; // type:func -func_80026400 = 0x80022128; // type:func -func_80026608 = 0x8002230C; // type:func -func_80026690 = 0x80022350; // type:func -func_80026860 = 0x800224F8; // type:func -func_80026A6C = 0x800226E4; // type:func -Effect_GetPlayState = 0x80022730; // type:func -Effect_GetByIndex = 0x80022740; // type:func -Effect_InitStatus = 0x80022850; // type:func -Effect_InitContext = 0x80022864; // type:func -Effect_Add = 0x8002290C; // type:func -Effect_DrawAll = 0x80022A8C; // type:func -Effect_UpdateAll = 0x80022B88; // type:func -Effect_Delete = 0x80022CB4; // type:func -Effect_DeleteAll = 0x80022DC0; // type:func -EffectSs_InitInfo = 0x80022EB0; // type:func -EffectSs_ClearAll = 0x80022F94; // type:func -EffectSs_Delete = 0x80023054; // type:func -EffectSs_Reset = 0x800230B4; // type:func -EffectSs_FindSlot = 0x80023148; // type:func -EffectSs_Insert = 0x80023280; // type:func -EffectSs_Spawn = 0x80023318; // type:func -EffectSs_Update = 0x800234C0; // type:func -EffectSs_UpdateAll = 0x80023560; // type:func -EffectSs_Draw = 0x8002361C; // type:func -EffectSs_DrawAll = 0x80023660; // type:func -EffectSs_LerpInv = 0x800237AC; // type:func -EffectSs_LerpS16 = 0x80023810; // type:func -EffectSs_LerpU8 = 0x80023864; // type:func -EffectSs_DrawGEffect = 0x80023950; // type:func -EffectSsDust_Spawn = 0x80023B8C; // type:func -func_8002829C = 0x80023C40; // type:func -func_80028304 = 0x80023CA8; // type:func -func_8002836C = 0x80023D10; // type:func -func_800283D4 = 0x80023D78; // type:func -func_8002843C = 0x80023DE0; // type:func -func_800284A4 = 0x80023E48; // type:func -func_80028510 = 0x80023EB4; // type:func -func_8002857C = 0x80023F20; // type:func -func_800285EC = 0x80023F90; // type:func -func_8002865C = 0x80024000; // type:func -func_800286CC = 0x80024070; // type:func -func_8002873C = 0x800240E0; // type:func -func_800287AC = 0x80024150; // type:func -func_8002881C = 0x800241C0; // type:func -func_80028858 = 0x800241FC; // type:func -func_80028894 = 0x80024238; // type:func -func_80028990 = 0x80024334; // type:func -func_80028A54 = 0x800243F8; // type:func -EffectSsKiraKira_SpawnSmallYellow = 0x800244BC; // type:func -EffectSsKiraKira_SpawnSmall = 0x80024518; // type:func -EffectSsKiraKira_SpawnDispersed = 0x80024554; // type:func -EffectSsKiraKira_SpawnFocused = 0x80024690; // type:func -EffectSsBomb_Spawn = 0x80024768; // type:func -EffectSsBomb2_SpawnFade = 0x800247C0; // type:func -EffectSsBomb2_SpawnLayered = 0x80024828; // type:func -EffectSsBlast_Spawn = 0x80024898; // type:func -EffectSsBlast_SpawnWhiteShockwaveSetScale = 0x80024928; // type:func -EffectSsBlast_SpawnShockwaveSetColor = 0x8002497C; // type:func -EffectSsBlast_SpawnWhiteShockwave = 0x800249C8; // type:func -EffectSsGSpk_SpawnAccel = 0x80024A04; // type:func -EffectSsGSpk_SpawnNoAccel = 0x80024A94; // type:func -EffectSsGSpk_SpawnFuse = 0x80024B28; // type:func -EffectSsGSpk_SpawnRandColor = 0x80024B7C; // type:func -EffectSsGSpk_SpawnSmall = 0x80024C80; // type:func -EffectSsDFire_Spawn = 0x80024CC4; // type:func -EffectSsDFire_SpawnFixedScale = 0x80024D44; // type:func -EffectSsBubble_Spawn = 0x80024D88; // type:func -EffectSsGRipple_Spawn = 0x80024DE8; // type:func -EffectSsGSplash_Spawn = 0x80024E40; // type:func -EffectSsGMagma_Spawn = 0x80024ED4; // type:func -EffectSsGFire_Spawn = 0x80024F0C; // type:func -EffectSsLightning_Spawn = 0x80024F44; // type:func -EffectSsDtBubble_SpawnColorProfile = 0x80024FBC; // type:func -EffectSsDtBubble_SpawnCustomColor = 0x80025038; // type:func -EffectSsHahen_Spawn = 0x800250C8; // type:func -EffectSsHahen_SpawnBurst = 0x80025148; // type:func -EffectSsStick_Spawn = 0x80025290; // type:func -EffectSsSibuki_Spawn = 0x800252E4; // type:func -EffectSsSibuki_SpawnBurst = 0x80025354; // type:func -EffectSsSibuki2_Spawn = 0x800254D8; // type:func -EffectSsGMagma2_Spawn = 0x80025538; // type:func -EffectSsStone1_Spawn = 0x800255A8; // type:func -EffectSsHitMark_Spawn = 0x800255FC; // type:func -EffectSsHitMark_SpawnFixedScale = 0x80025654; // type:func -EffectSsHitMark_SpawnCustomScale = 0x80025678; // type:func -EffectSsFhgFlash_SpawnLightBall = 0x800256A4; // type:func -EffectSsFhgFlash_SpawnShock = 0x80025710; // type:func -EffectSsKFire_Spawn = 0x80025774; // type:func -EffectSsSolderSrchBall_Spawn = 0x800257DC; // type:func -EffectSsKakera_Spawn = 0x80025844; // type:func -EffectSsIcePiece_Spawn = 0x800258FC; // type:func -EffectSsIcePiece_SpawnBurst = 0x80025964; // type:func -EffectSsEnIce_SpawnFlyingVec3f = 0x80025AF8; // type:func -EffectSsEnIce_SpawnFlyingVec3s = 0x80025B98; // type:func -EffectSsEnIce_Spawn = 0x80025C64; // type:func -EffectSsFireTail_Spawn = 0x80025CEC; // type:func -EffectSsFireTail_SpawnFlame = 0x80025D84; // type:func -EffectSsFireTail_SpawnFlameOnPlayer = 0x80025E48; // type:func -EffectSsEnFire_SpawnVec3f = 0x80025E98; // type:func -EffectSsEnFire_SpawnVec3s = 0x80025F10; // type:func -EffectSsExtra_Spawn = 0x80025FBC; // type:func -EffectSsFCircle_Spawn = 0x80026024; // type:func -EffectSsDeadDb_Spawn = 0x80026080; // type:func -EffectSsDeadDd_Spawn = 0x80026138; // type:func -EffectSsDeadDd_SpawnRandYellow = 0x800261EC; // type:func -EffectSsDeadDs_Spawn = 0x8002625C; // type:func -EffectSsDeadDs_SpawnStationary = 0x800262D4; // type:func -EffectSsDeadSound_Spawn = 0x80026324; // type:func -EffectSsDeadSound_SpawnStationary = 0x800263BC; // type:func -EffectSsIceSmoke_Spawn = 0x8002640C; // type:func -FlagSet_Update = 0x80026470; // type:func -Overlay_LoadGameState = 0x80026890; // type:func -Overlay_FreeGameState = 0x800269B8; // type:func -ActorShape_Init = 0x80026AE0; // type:func -ActorShadow_Draw = 0x80026AF8; // type:func -ActorShadow_DrawCircle = 0x80026DC0; // type:func -ActorShadow_DrawWhiteCircle = 0x80026DE4; // type:func -ActorShadow_DrawHorse = 0x80026E10; // type:func -ActorShadow_DrawFoot = 0x80026E34; // type:func -ActorShadow_DrawFeet = 0x8002701C; // type:func -Actor_SetFeetPos = 0x80027450; // type:func -Actor_ProjectPos = 0x80027490; // type:func -Attention_SetReticlePos = 0x800274E0; // type:func -Attention_InitReticle = 0x80027510; // type:func -Attention_SetNaviState = 0x800275DC; // type:func -Attention_Init = 0x800276CC; // type:func -Attention_Draw = 0x8002773C; // type:func -Attention_Update = 0x80027D18; // type:func -Flags_GetSwitch = 0x80028068; // type:func -Flags_SetSwitch = 0x8002809C; // type:func -Flags_UnsetSwitch = 0x800280DC; // type:func -Flags_GetUnknown = 0x80028124; // type:func -Flags_SetUnknown = 0x80028158; // type:func -Flags_UnsetUnknown = 0x80028198; // type:func -Flags_GetTreasure = 0x800281E0; // type:func -Flags_SetTreasure = 0x800281F4; // type:func -Flags_GetClear = 0x8002820C; // type:func -Flags_SetClear = 0x80028220; // type:func -Flags_UnsetClear = 0x80028238; // type:func -Flags_GetTempClear = 0x80028254; // type:func -Flags_SetTempClear = 0x80028268; // type:func -Flags_UnsetTempClear = 0x80028280; // type:func -Flags_GetCollectible = 0x8002829C; // type:func -Flags_SetCollectible = 0x800282D0; // type:func -TitleCard_Init = 0x80028318; // type:func -TitleCard_InitBossName = 0x8002832C; // type:func -TitleCard_InitPlaceName = 0x8002835C; // type:func -TitleCard_Update = 0x800283F0; // type:func -TitleCard_Draw = 0x80028488; // type:func -TitleCard_Clear = 0x80028A18; // type:func -Actor_Kill = 0x80028A44; // type:func -Actor_SetWorldToHome = 0x80028A60; // type:func -Actor_SetFocus = 0x80028A8C; // type:func -Actor_SetWorldRotToShape = 0x80028AC8; // type:func -Actor_SetShapeRotToWorld = 0x80028AE4; // type:func -Actor_SetScale = 0x80028B00; // type:func -Actor_SetObjectDependency = 0x80028B14; // type:func -Actor_Init = 0x80028B4C; // type:func -Actor_Destroy = 0x80028C60; // type:func -Actor_UpdatePos = 0x80028C98; // type:func -Actor_UpdateVelocityXZGravity = 0x80028D10; // type:func -Actor_MoveXZGravity = 0x80028D78; // type:func -Actor_UpdateVelocityXYZ = 0x80028DA4; // type:func -Actor_MoveXYZ = 0x80028E10; // type:func -Actor_SetProjectileSpeed = 0x80028E3C; // type:func -Actor_UpdatePosByAnimation = 0x80028E90; // type:func -Actor_WorldYawTowardActor = 0x80028F08; // type:func -Actor_FocusYawTowardActor = 0x80028F28; // type:func -Actor_WorldYawTowardPoint = 0x80028F48; // type:func -Actor_WorldPitchTowardActor = 0x80028F64; // type:func -Actor_FocusPitchTowardActor = 0x80028F84; // type:func -Actor_WorldPitchTowardPoint = 0x80028FA4; // type:func -Actor_WorldDistXYZToActor = 0x80028FC0; // type:func -Actor_WorldDistXYZToPoint = 0x80028FE0; // type:func -Actor_WorldDistXZToActor = 0x80028FFC; // type:func -Actor_WorldDistXZToPoint = 0x8002901C; // type:func -Actor_WorldToActorCoords = 0x80029038; // type:func -Actor_HeightDiff = 0x800290D8; // type:func -Player_GetHeight = 0x800290E8; // type:func -func_8002DCE4 = 0x80029140; // type:func -func_8002DD6C = 0x800291CC; // type:func -func_8002DD78 = 0x800291D8; // type:func -func_8002DDA8 = 0x8002921C; // type:func -func_8002DDE4 = 0x80029264; // type:func -func_8002DDF4 = 0x80029274; // type:func -Actor_SwapHookshotAttachment = 0x80029284; // type:func -Actor_RequestHorseCameraSetting = 0x800292F0; // type:func -Actor_MountHorse = 0x8002934C; // type:func -func_8002DEEC = 0x80029368; // type:func -Actor_InitPlayerHorse = 0x80029398; // type:func -Player_SetCsAction = 0x800293B4; // type:func -Player_SetCsActionWithHaltedActors = 0x800293CC; // type:func -func_8002DF90 = 0x80029404; // type:func -func_8002DFA4 = 0x80029414; // type:func -Player_IsFacingActor = 0x8002942C; // type:func -Actor_ActorBIsFacingActorA = 0x80029478; // type:func -Actor_IsFacingPlayer = 0x800294DC; // type:func -Actor_ActorAIsFacingActorB = 0x80029520; // type:func -Actor_IsFacingAndNearPlayer = 0x80029580; // type:func -Actor_ActorAIsFacingAndNearActorB = 0x800295F8; // type:func -func_8002E234 = 0x80029684; // type:func -func_8002E2AC = 0x800296E4; // type:func -Actor_UpdateBgCheckInfo = 0x800298D0; // type:func -func_8002E830 = 0x80029C04; // type:func -func_8002EABC = 0x80029DA0; // type:func -func_8002EB44 = 0x80029DDC; // type:func -func_8002EBCC = 0x80029E18; // type:func -func_8002ED80 = 0x80029F38; // type:func -Actor_GetFocus = 0x8002A058; // type:func -Actor_GetWorld = 0x8002A08C; // type:func -Actor_GetWorldPosShapeRot = 0x8002A0C0; // type:func -Attention_WeightedDistToPlayerSq = 0x8002A13C; // type:func -Attention_ActorIsInRange = 0x8002A1FC; // type:func -Attention_ShouldReleaseLockOn = 0x8002A22C; // type:func -Actor_TalkOfferAccepted = 0x8002A2E8; // type:func -Actor_OfferTalkExchange = 0x8002A310; // type:func -Actor_OfferTalkExchangeEquiCylinder = 0x8002A3E0; // type:func -Actor_OfferTalk = 0x8002A404; // type:func -Actor_OfferTalkNearColChkInfoCylinder = 0x8002A420; // type:func -Actor_TextboxIsClosing = 0x8002A458; // type:func -Actor_GetPlayerExchangeItemId = 0x8002A484; // type:func -Actor_GetScreenPos = 0x8002A494; // type:func -Actor_HasParent = 0x8002A524; // type:func -Actor_OfferGetItem = 0x8002A540; // type:func -Actor_OfferGetItemNearby = 0x8002A65C; // type:func -Actor_OfferCarry = 0x8002A684; // type:func -Actor_HasNoParent = 0x8002A6A0; // type:func -func_8002F5C4 = 0x8002A6BC; // type:func -Actor_SetClosestSecretDistance = 0x8002A6E4; // type:func -Actor_IsMounted = 0x8002A708; // type:func -Actor_SetRideActor = 0x8002A724; // type:func -Actor_NotMounted = 0x8002A754; // type:func -Actor_SetPlayerKnockback = 0x8002A770; // type:func -Actor_SetPlayerKnockbackLarge = 0x8002A798; // type:func -Actor_SetPlayerKnockbackLargeNoDamage = 0x8002A7D0; // type:func -Actor_SetPlayerKnockbackSmall = 0x8002A7FC; // type:func -Actor_SetPlayerKnockbackSmallNoDamage = 0x8002A834; // type:func -Player_PlaySfx = 0x8002A860; // type:func -Actor_PlaySfx = 0x8002A8A0; // type:func -Actor_PlaySfx_SurfaceBomb = 0x8002A8C0; // type:func -Actor_PlaySfx_Flagged2 = 0x8002A94C; // type:func -Actor_PlaySfx_FlaggedCentered1 = 0x8002A970; // type:func -Actor_PlaySfx_FlaggedCentered2 = 0x8002A994; // type:func -Actor_PlaySfx_Flagged = 0x8002A9B8; // type:func -Actor_PlaySfx_FlaggedTimer = 0x8002A9D4; // type:func -func_8002F9EC = 0x8002AA24; // type:func -func_8002FA60 = 0x8002AA9C; // type:func -Actor_DrawFaroresWindPointer = 0x8002ABE4; // type:func -func_80030488 = 0x8002B34C; // type:func -Actor_DisableLens = 0x8002B370; // type:func -Actor_InitContext = 0x8002B394; // type:func -Actor_UpdateAll = 0x8002B4B8; // type:func -Actor_FaultPrint = 0x8002B904; // type:func -Actor_Draw = 0x8002B970; // type:func -Actor_UpdateFlaggedAudio = 0x8002BC1C; // type:func -Actor_DrawLensOverlay = 0x8002BCF0; // type:func -Actor_DrawLensActors = 0x8002BE8C; // type:func -Actor_CullingCheck = 0x8002C0EC; // type:func -Actor_CullingVolumeTest = 0x8002C10C; // type:func -func_800315AC = 0x8002C1B8; // type:func -Actor_KillAllWithMissingObject = 0x8002C3A4; // type:func -Actor_FreezeAllEnemies = 0x8002C438; // type:func -func_80031B14 = 0x8002C48C; // type:func -func_80031C3C = 0x8002C5A0; // type:func -Actor_AddToCategory = 0x8002C650; // type:func -Actor_RemoveFromCategory = 0x8002C6A0; // type:func -Actor_FreeOverlay = 0x8002C770; // type:func -Actor_Spawn = 0x8002C7CC; // type:func -Actor_SpawnAsChild = 0x8002CA70; // type:func -Actor_SpawnTransitionActors = 0x8002CAFC; // type:func -Actor_SpawnEntry = 0x8002CC7C; // type:func -Actor_Delete = 0x8002CCF4; // type:func -Attention_ActorOnScreen = 0x8002CDF8; // type:func -Attention_FindActorInCategory = 0x8002CE48; // type:func -Attention_FindActor = 0x8002D040; // type:func -Actor_Find = 0x8002D178; // type:func -Enemy_StartFinishingBlow = 0x8002D1B4; // type:func -FaceChange_UpdateBlinking = 0x8002D1E0; // type:func -FaceChange_UpdateRandomSet = 0x8002D280; // type:func -BodyBreak_Alloc = 0x8002D358; // type:func -BodyBreak_SetInfo = 0x8002D448; // type:func -BodyBreak_SpawnParts = 0x8002D554; // type:func -Actor_SpawnFloorDustRing = 0x8002D730; // type:func -func_80033480 = 0x8002D930; // type:func -Actor_GetCollidedExplosive = 0x8002DAB8; // type:func -func_80033684 = 0x8002DAEC; // type:func -Actor_ChangeCategory = 0x8002DB8C; // type:func -Actor_GetProjectileActor = 0x8002DBD8; // type:func -Actor_SetTextWithPrefix = 0x8002DD44; // type:func -Actor_TestFloorInDirection = 0x8002DDB8; // type:func -Actor_IsLockedOn = 0x8002DE98; // type:func -Actor_OtherIsLockedOn = 0x8002DEC8; // type:func -func_80033AEC = 0x8002DEF8; // type:func -func_80033C30 = 0x8002DFD4; // type:func -Actor_RequestQuake = 0x8002E124; // type:func -Actor_RequestQuakeWithSpeed = 0x8002E1A0; // type:func -Actor_RequestQuakeAndRumble = 0x8002E22C; // type:func -Rand_ZeroFloat = 0x8002E2B0; // type:func -Rand_CenteredFloat = 0x8002E2D8; // type:func -Actor_DrawDoorLock = 0x8002E30C; // type:func -func_8003424C = 0x8002E57C; // type:func -Actor_SetColorFilter = 0x8002E598; // type:func -func_800342EC = 0x8002E5CC; // type:func -func_8003435C = 0x8002E63C; // type:func -Npc_UpdateTalking = 0x8002E6AC; // type:func -Npc_TrackPointWithLimits = 0x8002E79C; // type:func -Npc_GetTrackingPresetMaxPlayerYaw = 0x8002EA9C; // type:func -Npc_UpdateAutoTurn = 0x8002EAC0; // type:func -Npc_TrackPoint = 0x8002EC48; // type:func -func_80034B28 = 0x8002ED90; // type:func -func_80034B54 = 0x8002EDAC; // type:func -func_80034BA0 = 0x8002EDE0; // type:func -func_80034CC4 = 0x8002EEF8; // type:func -Actor_UpdateAlphaByDistance = 0x8002EFF8; // type:func -Animation_ChangeByInfo = 0x8002F0C4; // type:func -Actor_UpdateFidgetTables = 0x8002F150; // type:func -Actor_Noop = 0x8002F1A8; // type:func -func_80035124 = 0x8002F1B0; // type:func -Gfx_DrawDListOpa = 0x8002F2F4; // type:func -Gfx_DrawDListXlu = 0x8002F380; // type:func -func_800353E8 = 0x8002F40C; // type:func -Actor_FindNearby = 0x8002F41C; // type:func -func_800354B4 = 0x8002F4C0; // type:func -func_8003555C = 0x8002F554; // type:func -func_800355B8 = 0x8002F5AC; // type:func -func_800355E4 = 0x8002F5D8; // type:func -Actor_ApplyDamage = 0x8002F614; // type:func -Actor_SetDropFlag = 0x8002F63C; // type:func -Actor_SetDropFlagJntSph = 0x8002F724; // type:func -func_80035844 = 0x8002F820; // type:func -func_800358DC = 0x8002F8C0; // type:func -func_800359B8 = 0x8002F994; // type:func -func_80035B18 = 0x8002FAE0; // type:func -Flags_GetEventChkInf = 0x8002FB18; // type:func -Flags_SetEventChkInf = 0x8002FB40; // type:func -Flags_GetInfTable = 0x8002FB70; // type:func -Flags_SetInfTable = 0x8002FB98; // type:func -func_80035BFC = 0x8002FBC8; // type:func -func_80036E50 = 0x800309B0; // type:func -func_800374E0 = 0x80031038; // type:func -func_80037C30 = 0x80031710; // type:func -func_80037C5C = 0x80031734; // type:func -func_80037C94 = 0x8003175C; // type:func -func_80037CB8 = 0x8003177C; // type:func -func_80037D98 = 0x80031884; // type:func -Actor_TrackNone = 0x800319F0; // type:func -Actor_TrackPoint = 0x80031A8C; // type:func -Actor_TrackPlayerSetFocusHeight = 0x80031C1C; // type:func -Actor_TrackPlayer = 0x80031D4C; // type:func -ActorOverlayTable_LogPrint = 0x80031E70; // type:func -ActorOverlayTable_FaultPrint = 0x80031E78; // type:func -ActorOverlayTable_Init = 0x80031F50; // type:func -ActorOverlayTable_Cleanup = 0x80031F90; // type:func -SSNode_SetValue = 0x80031FC0; // type:func -SSList_SetNull = 0x80031FDC; // type:func -SSNodeList_SetSSListHead = 0x80031FEC; // type:func -DynaSSNodeList_SetSSListHead = 0x80032044; // type:func -DynaSSNodeList_Initialize = 0x8003209C; // type:func -DynaSSNodeList_Alloc = 0x800320B0; // type:func -DynaSSNodeList_ResetCount = 0x80032100; // type:func -DynaSSNodeList_GetNextNodeIdx = 0x8003210C; // type:func -BgCheck_Vec3sToVec3f = 0x8003213C; // type:func -BgCheck_Vec3fToVec3s = 0x80032180; // type:func -CollisionPoly_GetMinY = 0x800321C4; // type:func -CollisionPoly_GetNormalF = 0x80032270; // type:func -func_80038A28 = 0x800322C8; // type:func -CollisionPoly_GetPointDistanceFromPlane = 0x8003241C; // type:func -CollisionPoly_GetVertices = 0x80032484; // type:func -CollisionPoly_GetVerticesByBgId = 0x80032524; // type:func -CollisionPoly_CheckYIntersectApprox1 = 0x800325A4; // type:func -CollisionPoly_CheckYIntersect = 0x800326D8; // type:func -CollisionPoly_CheckYIntersectApprox2 = 0x80032784; // type:func -CollisionPoly_CheckXIntersectApprox = 0x800327C4; // type:func -CollisionPoly_CheckZIntersectApprox = 0x80032868; // type:func -CollisionPoly_LineVsPoly = 0x8003290C; // type:func -CollisionPoly_SphVsPoly = 0x80032BEC; // type:func -StaticLookup_AddPolyToSSList = 0x80032CBC; // type:func -StaticLookup_AddPoly = 0x80032EDC; // type:func -BgCheck_RaycastDownStaticList = 0x80032F70; // type:func -BgCheck_RaycastDownStatic = 0x800331AC; // type:func -BgCheck_ComputeWallDisplacement = 0x800332C4; // type:func -BgCheck_SphVsStaticWall = 0x80033374; // type:func -BgCheck_CheckStaticCeiling = 0x80033C08; // type:func -BgCheck_CheckLineAgainstSSList = 0x80033DE0; // type:func -BgCheck_CheckLineInSubdivision = 0x80034004; // type:func -BgCheck_SphVsFirstStaticPolyList = 0x80034190; // type:func -BgCheck_SphVsFirstStaticPoly = 0x80034360; // type:func -BgCheck_GetNearestStaticLookup = 0x80034498; // type:func -BgCheck_GetStaticLookup = 0x8003454C; // type:func -BgCheck_GetStaticLookupIndicesFromPos = 0x80034618; // type:func -BgCheck_GetSubdivisionMinBounds = 0x800346F8; // type:func -BgCheck_GetSubdivisionMaxBounds = 0x8003489C; // type:func -BgCheck_GetPolySubdivisionBounds = 0x80034A68; // type:func -BgCheck_PolyIntersectsSubdivision = 0x80034C18; // type:func -BgCheck_InitializeStaticLookup = 0x8003536C; // type:func -BgCheck_IsSpotScene = 0x8003576C; // type:func -BgCheck_TryGetCustomMemsize = 0x800357B0; // type:func -BgCheck_SetSubdivisionDimension = 0x80035848; // type:func -BgCheck_Allocate = 0x800358D0; // type:func -BgCheck_GetCollisionHeader = 0x80035CB4; // type:func -BgCheck_PosInStaticBoundingBox = 0x80035D1C; // type:func -BgCheck_RaycastDownImpl = 0x80035DD8; // type:func -BgCheck_CameraRaycastDown1 = 0x80035FA8; // type:func -BgCheck_EntityRaycastDown1 = 0x80036004; // type:func -BgCheck_EntityRaycastDown2 = 0x80036060; // type:func -BgCheck_EntityRaycastDown3 = 0x800360B4; // type:func -BgCheck_EntityRaycastDown4 = 0x80036118; // type:func -BgCheck_EntityRaycastDown5 = 0x80036180; // type:func -BgCheck_EntityRaycastDown6 = 0x800361D8; // type:func -BgCheck_EntityRaycastDown7 = 0x8003623C; // type:func -BgCheck_AnyRaycastDown1 = 0x800362A4; // type:func -BgCheck_AnyRaycastDown2 = 0x80036358; // type:func -BgCheck_CameraRaycastDown2 = 0x80036410; // type:func -BgCheck_EntityRaycastDownWalls = 0x80036474; // type:func -BgCheck_EntityRaycastDown9 = 0x800364DC; // type:func -BgCheck_CheckWallImpl = 0x80036540; // type:func -BgCheck_EntitySphVsWall1 = 0x80036B7C; // type:func -BgCheck_EntitySphVsWall2 = 0x80036BE0; // type:func -BgCheck_EntitySphVsWall3 = 0x80036C44; // type:func -BgCheck_EntitySphVsWall4 = 0x80036CAC; // type:func -BgCheck_CheckCeilingImpl = 0x80036D18; // type:func -BgCheck_AnyCheckCeiling = 0x80036E38; // type:func -BgCheck_EntityCheckCeiling = 0x80036E84; // type:func -BgCheck_CheckLineImpl = 0x80036ED4; // type:func -BgCheck_GetBccFlags = 0x800373B4; // type:func -BgCheck_CameraLineTest1 = 0x800373FC; // type:func -BgCheck_CameraLineTest2 = 0x80037488; // type:func -BgCheck_EntityLineTest1 = 0x80037514; // type:func -BgCheck_EntityLineTest2 = 0x800375A0; // type:func -BgCheck_EntityLineTest3 = 0x80037630; // type:func -BgCheck_ProjectileLineTest = 0x800376BC; // type:func -BgCheck_AnyLineTest1 = 0x80037748; // type:func -BgCheck_AnyLineTest2 = 0x8003778C; // type:func -BgCheck_AnyLineTest3 = 0x80037818; // type:func -BgCheck_SphVsFirstPolyImpl = 0x800378A4; // type:func -BgCheck_SphVsFirstPoly = 0x80037968; // type:func -BgCheck_SphVsFirstWall = 0x800379AC; // type:func -SSNodeList_Initialize = 0x800379F4; // type:func -SSNodeList_Alloc = 0x80037A0C; // type:func -SSNodeList_GetNextNode = 0x80037A7C; // type:func -SSNodeList_GetNextNodeIdx = 0x80037AB8; // type:func -ScaleRotPos_Initialize = 0x80037ACC; // type:func -ScaleRotPos_SetValue = 0x80037B0C; // type:func -ScaleRotPos_Equals = 0x80037B5C; // type:func -DynaLookup_ResetLists = 0x80037C30; // type:func -DynaLookup_Reset = 0x80037C70; // type:func -DynaLookup_ResetVtxStartIndex = 0x80037C90; // type:func -BgActor_Initialize = 0x80037C9C; // type:func -BgActor_SetActor = 0x80037CFC; // type:func -BgActor_IsTransformUnchanged = 0x80037DB4; // type:func -DynaPoly_NullPolyList = 0x80037DDC; // type:func -DynaPoly_AllocPolyList = 0x80037DE8; // type:func -DynaPoly_NullVtxList = 0x80037E24; // type:func -DynaPoly_AllocVtxList = 0x80037E30; // type:func -DynaPoly_SetBgActorPrevTransform = 0x80037E78; // type:func -DynaPoly_IsBgIdBgActor = 0x80037EC4; // type:func -DynaPoly_Init = 0x80037EE4; // type:func -DynaPoly_Alloc = 0x80037F30; // type:func -DynaPoly_SetBgActor = 0x80038004; // type:func -DynaPoly_GetActor = 0x800380C4; // type:func -DynaPoly_DisableCollision = 0x80038138; // type:func -DynaPoly_EnableCollision = 0x80038190; // type:func -DynaPoly_DisableCeilingCollision = 0x800381E8; // type:func -DynaPoly_EnableCeilingCollision = 0x80038240; // type:func -DynaPoly_DeleteBgActor = 0x80038298; // type:func -DynaPoly_InvalidateLookup = 0x80038320; // type:func -DynaPoly_AddBgActorToLookup = 0x80038338; // type:func -DynaPoly_UnsetAllInteractFlags = 0x80038C84; // type:func -DynaPoly_UpdateContext = 0x80038D1C; // type:func -DynaPoly_UpdateBgActorTransforms = 0x80038E88; // type:func -BgCheck_RaycastDownDynaList = 0x80038F18; // type:func -BgCheck_RaycastDownDyna = 0x80039100; // type:func -BgCheck_SphVsDynaWallInBgActor = 0x800395A8; // type:func -BgCheck_SphVsDynaWall = 0x80039C6C; // type:func -BgCheck_CheckDynaCeilingList = 0x80039EA8; // type:func -BgCheck_CheckDynaCeiling = 0x8003A104; // type:func -BgCheck_CheckLineAgainstBgActorSSList = 0x8003A268; // type:func -BgCheck_CheckLineAgainstBgActor = 0x8003A3EC; // type:func -BgCheck_CheckLineAgainstDyna = 0x8003A508; // type:func -BgCheck_SphVsFirstDynaPolyList = 0x8003A6C0; // type:func -BgCheck_SphVsFirstDynaPolyInBgActor = 0x8003A7D8; // type:func -BgCheck_SphVsFirstDynaPoly = 0x8003A918; // type:func -CollisionHeader_SegmentedToVirtual = 0x8003AA70; // type:func -CollisionHeader_GetVirtual = 0x8003AB54; // type:func -func_800418D0 = 0x8003ABA8; // type:func -BgCheck_ResetPolyCheckTbl = 0x8003AC50; // type:func -SurfaceType_GetData = 0x8003AC88; // type:func -SurfaceType_GetBgCamIndex = 0x8003AD00; // type:func -BgCheck_GetBgCamSettingImpl = 0x8003AD24; // type:func -BgCheck_GetBgCamSetting = 0x8003AD6C; // type:func -BgCheck_GetBgCamCountImpl = 0x8003AE00; // type:func -BgCheck_GetBgCamCount = 0x8003AE5C; // type:func -BgCheck_GetBgCamFuncDataImpl = 0x8003AEF0; // type:func -BgCheck_GetBgCamFuncData = 0x8003AF78; // type:func -SurfaceType_GetExitIndex = 0x8003B00C; // type:func -SurfaceType_GetFloorType = 0x8003B034; // type:func -func_80041D70 = 0x8003B05C; // type:func -SurfaceType_GetWallType = 0x8003B084; // type:func -SurfaceType_GetWallFlags = 0x8003B0AC; // type:func -SurfaceType_CheckWallFlag0 = 0x8003B0DC; // type:func -SurfaceType_CheckWallFlag1 = 0x8003B110; // type:func -SurfaceType_CheckWallFlag2 = 0x8003B144; // type:func -SurfaceType_GetFloorProperty2 = 0x8003B178; // type:func -SurfaceType_GetFloorProperty = 0x8003B1A0; // type:func -SurfaceType_IsSoft = 0x8003B1C8; // type:func -SurfaceType_IsHorseBlocked = 0x8003B1F0; // type:func -SurfaceType_GetMaterial = 0x8003B218; // type:func -SurfaceType_GetSfxOffset = 0x8003B23C; // type:func -SurfaceType_GetFloorEffect = 0x8003B284; // type:func -SurfaceType_GetLightSetting = 0x8003B2AC; // type:func -SurfaceType_GetEcho = 0x8003B2D4; // type:func -SurfaceType_CanHookshot = 0x8003B2FC; // type:func -SurfaceType_IsIgnoredByEntities = 0x8003B324; // type:func -SurfaceType_IsIgnoredByProjectiles = 0x8003B360; // type:func -SurfaceType_IsFloorConveyor = 0x8003B39C; // type:func -SurfaceType_GetConveyorSpeed = 0x8003B3D8; // type:func -SurfaceType_GetConveyorDirection = 0x8003B400; // type:func -func_80042108 = 0x8003B428; // type:func -WaterBox_GetSurface1 = 0x8003B45C; // type:func -WaterBox_GetSurfaceImpl = 0x8003B568; // type:func -WaterBox_GetSurface2 = 0x8003B6C0; // type:func -WaterBox_GetBgCamIndex = 0x8003B85C; // type:func -WaterBox_GetBgCamSetting = 0x8003B870; // type:func -WaterBox_GetLightIndex = 0x8003B8C8; // type:func -func_800425B0 = 0x8003B8E0; // type:func -func_80042708 = 0x8003BA38; // type:func -func_800427B4 = 0x8003BAE8; // type:func -DynaPolyActor_UpdateCarriedActorPos = 0x8003BBA0; // type:func -DynaPolyActor_UpdateCarriedActorRotY = 0x8003BCDC; // type:func -func_80043334 = 0x8003BD70; // type:func -DynaPolyActor_TransformCarriedActor = 0x8003BDE0; // type:func -DynaPolyActor_Init = 0x8003BEC0; // type:func -DynaPolyActor_UnsetAllInteractFlags = 0x8003BEE4; // type:func -DynaPolyActor_SetActorOnTop = 0x8003BEF0; // type:func -DynaPolyActor_SetPlayerOnTop = 0x8003BF04; // type:func -DynaPoly_SetPlayerOnTop = 0x8003BF18; // type:func -DynaPolyActor_SetPlayerAbove = 0x8003BF48; // type:func -DynaPoly_SetPlayerAbove = 0x8003BF5C; // type:func -DynaPolyActor_SetSwitchPressed = 0x8003BF8C; // type:func -DynaPolyActor_IsActorOnTop = 0x8003BFA0; // type:func -DynaPolyActor_IsPlayerOnTop = 0x8003BFC4; // type:func -DynaPolyActor_IsPlayerAbove = 0x8003BFE8; // type:func -DynaPolyActor_IsSwitchPressed = 0x8003C00C; // type:func -func_800435D8 = 0x8003C030; // type:func -Camera_InterpolateCurve = 0x8003C250; // type:func -Camera_LERPCeilF = 0x8003C2FC; // type:func -Camera_LERPFloorF = 0x8003C340; // type:func -Camera_LERPCeilS = 0x8003C384; // type:func -Camera_LERPFloorS = 0x8003C418; // type:func -Camera_LERPCeilVec3f = 0x8003C4AC; // type:func -func_80043ABC = 0x8003C530; // type:func -func_80043B60 = 0x8003C570; // type:func -Camera_Vec3sToVec3f = 0x8003C5A0; // type:func -Camera_AddVecGeoToVec3f = 0x8003C608; // type:func -Camera_Vec3fTranslateByUnitVector = 0x8003C688; // type:func -Camera_BGCheckInfo = 0x8003C6F4; // type:func -Camera_BGCheck = 0x8003C91C; // type:func -func_80043F94 = 0x8003C978; // type:func -func_80044340 = 0x8003CD30; // type:func -Camera_CheckOOB = 0x8003CD8C; // type:func -Camera_GetFloorYNorm = 0x8003CE28; // type:func -Camera_GetFloorY = 0x8003CF0C; // type:func -Camera_GetFloorYLayer = 0x8003CF68; // type:func -Camera_GetBgCamSetting = 0x8003D12C; // type:func -Camera_GetBgCamFuncData = 0x8003D160; // type:func -Camera_GetBgCamIndex = 0x8003D190; // type:func -Camera_GetBgCamFuncDataUnderPlayer = 0x8003D210; // type:func -Camera_GetWaterBoxBgCamIndex = 0x8003D2C0; // type:func -Camera_GetWaterSurface = 0x8003D3A0; // type:func -Camera_XZAngle = 0x8003D468; // type:func -Camera_GetPitchAdjFromFloorHeightDiffs = 0x8003D4D0; // type:func -Camera_CalcUpFromPitchYawRoll = 0x8003D7FC; // type:func -Camera_ClampLERPScale = 0x8003DA38; // type:func -Camera_CopyDataToRegs = 0x8003DA90; // type:func -Camera_UpdateInterface = 0x8003DAA0; // type:func -Camera_BGCheckCorner = 0x8003DBAC; // type:func -func_80045508 = 0x8003DC14; // type:func -Camera_CalcSlopeYAdj = 0x8003DE24; // type:func -Camera_CalcAtDefault = 0x8003DEB8; // type:func -func_800458D4 = 0x8003DFD0; // type:func -func_80045B08 = 0x8003E188; // type:func -Camera_CalcAtForParallel = 0x8003E2E8; // type:func -Camera_CalcAtForLockOn = 0x8003E64C; // type:func -Camera_CalcAtForHorse = 0x8003EB04; // type:func -Camera_LERPClampDist = 0x8003ECC0; // type:func -Camera_ClampDist = 0x8003ED78; // type:func -Camera_CalcDefaultPitch = 0x8003EE8C; // type:func -Camera_CalcDefaultYaw = 0x8003EFEC; // type:func -func_80046E20 = 0x8003F140; // type:func -Camera_Noop = 0x8003F664; // type:func -Camera_Normal1 = 0x8003F674; // type:func -Camera_Normal2 = 0x800400CC; // type:func -Camera_Normal3 = 0x8004085C; // type:func -Camera_Normal4 = 0x80040F04; // type:func -Camera_Normal0 = 0x80040F24; // type:func -Camera_Parallel1 = 0x80040F44; // type:func -Camera_Parallel2 = 0x800417D0; // type:func -Camera_Parallel3 = 0x800417F0; // type:func -Camera_Parallel4 = 0x80041854; // type:func -Camera_Parallel0 = 0x80041874; // type:func -Camera_Jump1 = 0x80041894; // type:func -Camera_Jump2 = 0x80041ED4; // type:func -Camera_Jump3 = 0x800427C0; // type:func -Camera_Jump4 = 0x80042F2C; // type:func -Camera_Jump0 = 0x80042F4C; // type:func -Camera_Battle1 = 0x80042F6C; // type:func -Camera_Battle2 = 0x80043CA8; // type:func -Camera_Battle3 = 0x80043CC8; // type:func -Camera_Battle4 = 0x80043CE8; // type:func -Camera_Battle0 = 0x80044040; // type:func -Camera_KeepOn1 = 0x80044060; // type:func -Camera_KeepOn2 = 0x80044DB0; // type:func -Camera_KeepOn3 = 0x80044DD0; // type:func -Camera_KeepOn4 = 0x800457C8; // type:func -Camera_KeepOn0 = 0x800465E0; // type:func -Camera_Fixed1 = 0x80046880; // type:func -Camera_Fixed2 = 0x80046B6C; // type:func -Camera_Fixed3 = 0x80046F20; // type:func -Camera_Fixed4 = 0x80047120; // type:func -Camera_Fixed0 = 0x800474AC; // type:func -Camera_Subj1 = 0x800474CC; // type:func -Camera_Subj2 = 0x800474EC; // type:func -Camera_Subj3 = 0x8004750C; // type:func -Camera_Subj4 = 0x80047B10; // type:func -Camera_Subj0 = 0x80048144; // type:func -Camera_Data0 = 0x80048164; // type:func -Camera_Data1 = 0x80048184; // type:func -Camera_Data2 = 0x800481A4; // type:func -Camera_Data3 = 0x800481C4; // type:func -Camera_Data4 = 0x800481E4; // type:func -Camera_Unique1 = 0x800484D0; // type:func -Camera_Unique2 = 0x80048954; // type:func -Camera_Unique3 = 0x80048D0C; // type:func -Camera_Unique0 = 0x800491BC; // type:func -Camera_Unique4 = 0x800496D8; // type:func -Camera_Unique5 = 0x800496F8; // type:func -Camera_Unique6 = 0x80049718; // type:func -Camera_Unique7 = 0x80049848; // type:func -Camera_Unique8 = 0x80049A4C; // type:func -Camera_Unique9 = 0x80049A6C; // type:func -Camera_Vec3fCopy = 0x8004AEC8; // type:func -Camera_RotateAroundPoint = 0x8004AEE8; // type:func -Camera_Demo1 = 0x8004AF44; // type:func -Camera_Demo2 = 0x8004B11C; // type:func -Camera_Demo3 = 0x8004B13C; // type:func -Camera_Demo4 = 0x8004BBD8; // type:func -Camera_Demo5 = 0x8004BBF8; // type:func -Camera_Demo6 = 0x8004C5D0; // type:func -Camera_Demo7 = 0x8004C874; // type:func -Camera_Demo8 = 0x8004C8A8; // type:func -Camera_Demo9 = 0x8004C8C8; // type:func -Camera_Demo0 = 0x8004CCE8; // type:func -Camera_Special0 = 0x8004CD08; // type:func -Camera_Special1 = 0x8004CE50; // type:func -Camera_Special2 = 0x8004CE70; // type:func -Camera_Special3 = 0x8004CE90; // type:func -Camera_Special4 = 0x8004CEB0; // type:func -Camera_Special5 = 0x8004D054; // type:func -Camera_Special7 = 0x8004D3F8; // type:func -Camera_Special6 = 0x8004D744; // type:func -Camera_Special8 = 0x8004DBB4; // type:func -Camera_Special9 = 0x8004DBD4; // type:func -Camera_Create = 0x8004E2BC; // type:func -Camera_Destroy = 0x8004E30C; // type:func -Camera_Init = 0x8004E334; // type:func -func_80057FC4 = 0x8004E554; // type:func -Camera_Stub80058140 = 0x8004E6A8; // type:func -Camera_InitDataUsingPlayer = 0x8004E6B4; // type:func -Camera_ChangeStatus = 0x8004E8B0; // type:func -Camera_UpdateWater = 0x8004E8CC; // type:func -Camera_UpdateHotRoom = 0x8004ECE8; // type:func -Camera_UpdateDistortion = 0x8004ED28; // type:func -Camera_Update = 0x8004F088; // type:func -Camera_Finish = 0x8004F8B8; // type:func -Camera_SetNewModeStateFlags = 0x8004FA24; // type:func -Camera_RequestModeImpl = 0x8004FA48; // type:func -Camera_RequestMode = 0x8004FDAC; // type:func -Camera_CheckValidMode = 0x8004FDD8; // type:func -Camera_RequestSettingImpl = 0x8004FE44; // type:func -Camera_RequestSetting = 0x80050038; // type:func -Camera_RequestBgCam = 0x80050064; // type:func -Camera_GetInputDir = 0x80050138; // type:func -Camera_GetInputDirPitch = 0x8005015C; // type:func -Camera_GetInputDirYaw = 0x80050184; // type:func -Camera_GetCamDir = 0x800501AC; // type:func -Camera_GetCamDirPitch = 0x800501D0; // type:func -Camera_GetCamDirYaw = 0x800501F8; // type:func -Camera_RequestQuake = 0x80050220; // type:func -Camera_SetViewParam = 0x80050294; // type:func -Camera_UnsetViewFlag = 0x80050428; // type:func -Camera_OverwriteStateFlags = 0x80050450; // type:func -Camera_ResetAnim = 0x8005046C; // type:func -Camera_SetCSParams = 0x8005047C; // type:func -Camera_SetStateFlag = 0x80050510; // type:func -Camera_UnsetStateFlag = 0x80050534; // type:func -Camera_ChangeDoorCam = 0x8005055C; // type:func -Camera_Copy = 0x8005065C; // type:func -Camera_IsDebugCamEnabled = 0x800507A4; // type:func -Camera_GetQuakeOffset = 0x800507B0; // type:func -Camera_SetCameraData = 0x800507D4; // type:func -func_8005B198 = 0x80050820; // type:func -Camera_SetFinishedFlag = 0x80050830; // type:func -DamageTable_Get = 0x80050880; // type:func -DamageTable_Clear = 0x800508AC; // type:func -Collider_InitBase = 0x800508E0; // type:func -Collider_DestroyBase = 0x80050928; // type:func -Collider_SetBaseToActor = 0x8005093C; // type:func -Collider_SetBaseType1 = 0x8005097C; // type:func -Collider_SetBase = 0x800509C0; // type:func -Collider_ResetATBase = 0x80050A04; // type:func -Collider_ResetACBase = 0x80050A20; // type:func -Collider_ResetOCBase = 0x80050A3C; // type:func -Collider_InitElementDamageInfoAT = 0x80050A64; // type:func -Collider_DestroyElementDamageInfoAT = 0x80050A8C; // type:func -Collider_SetElementDamageInfoAT = 0x80050AA0; // type:func -Collider_ResetATElement_Unk = 0x80050AC8; // type:func -Collider_InitElementDamageInfoAC = 0x80050AD8; // type:func -Collider_DestroyElementDamageInfoAC = 0x80050B08; // type:func -Collider_SetElementDamageInfoAC = 0x80050B1C; // type:func -Collider_InitElement = 0x80050B44; // type:func -Collider_DestroyElement = 0x80050BC4; // type:func -Collider_SetElement = 0x80050C04; // type:func -Collider_ResetATElement = 0x80050C7C; // type:func -Collider_ResetACElement = 0x80050CB4; // type:func -Collider_ResetOCElement = 0x80050CEC; // type:func -Collider_InitJntSphElementDim = 0x80050D04; // type:func -Collider_DestroyJntSphElementDim = 0x80050D4C; // type:func -Collider_SetJntSphElementDim = 0x80050D60; // type:func -Collider_InitJntSphElement = 0x80050DB8; // type:func -Collider_DestroyJntSphElement = 0x80050DF8; // type:func -Collider_SetJntSphElement = 0x80050E38; // type:func -Collider_ResetJntSphElementAT = 0x80050E88; // type:func -Collider_ResetJntSphElementAC = 0x80050EAC; // type:func -Collider_ResetJntSphElementOC = 0x80050ED0; // type:func -Collider_InitJntSph = 0x80050EF4; // type:func -Collider_FreeJntSph = 0x80050F20; // type:func -Collider_DestroyJntSph = 0x80050FC0; // type:func -Collider_SetJntSphToActor = 0x80051050; // type:func -Collider_SetJntSphAllocType1 = 0x8005112C; // type:func -Collider_SetJntSphAlloc = 0x80051208; // type:func -Collider_SetJntSph = 0x800512E4; // type:func -Collider_ResetJntSphAT = 0x80051398; // type:func -Collider_ResetJntSphAC = 0x80051424; // type:func -Collider_ResetJntSphOC = 0x800514B0; // type:func -Collider_InitCylinderDim = 0x8005153C; // type:func -Collider_DestroyCylinderDim = 0x80051598; // type:func -Collider_SetCylinderDim = 0x800515AC; // type:func -Collider_InitCylinder = 0x800515EC; // type:func -Collider_DestroyCylinder = 0x8005163C; // type:func -Collider_SetCylinderToActor = 0x8005168C; // type:func -Collider_SetCylinderType1 = 0x800516F4; // type:func -Collider_SetCylinder = 0x8005175C; // type:func -Collider_ResetCylinderAT = 0x800517C4; // type:func -Collider_ResetCylinderAC = 0x80051804; // type:func -Collider_ResetCylinderOC = 0x80051844; // type:func -Collider_InitTrisElementDim = 0x80051884; // type:func -Collider_DestroyTrisElementDim = 0x800518D0; // type:func -Collider_SetTrisElementDim = 0x800518E4; // type:func -Collider_InitTrisElement = 0x80051998; // type:func -Collider_DestroyTrisElement = 0x800519D8; // type:func -Collider_SetTrisElement = 0x80051A18; // type:func -Collider_ResetTrisElementAT = 0x80051A68; // type:func -Collider_ResetTrisElementAC = 0x80051A8C; // type:func -Collider_ResetTrisElementOC = 0x80051AB0; // type:func -Collider_InitTris = 0x80051AD4; // type:func -Collider_FreeTris = 0x80051B00; // type:func -Collider_DestroyTris = 0x80051BB8; // type:func -Collider_SetTrisAllocType1 = 0x80051C5C; // type:func -Collider_SetTrisAlloc = 0x80051D5C; // type:func -Collider_SetTris = 0x80051E5C; // type:func -Collider_ResetTrisAT = 0x80051F28; // type:func -Collider_ResetTrisAC = 0x80051FC8; // type:func -Collider_ResetTrisOC = 0x80052068; // type:func -Collider_InitQuadDim = 0x80052108; // type:func -Collider_DestroyQuadDim = 0x80052154; // type:func -Collider_ResetQuadACDist = 0x80052168; // type:func -Collider_SetQuadMidpoints = 0x80052184; // type:func -Collider_SetQuadDim = 0x80052240; // type:func -Collider_InitQuad = 0x800522C8; // type:func -Collider_DestroyQuad = 0x80052318; // type:func -Collider_SetQuadType1 = 0x80052368; // type:func -Collider_SetQuad = 0x800523D0; // type:func -Collider_ResetQuadAT = 0x80052438; // type:func -Collider_ResetQuadAC = 0x80052488; // type:func -Collider_ResetQuadOC = 0x800524C8; // type:func -Collider_QuadSetNearestAC = 0x80052508; // type:func -Collider_InitLine = 0x800525B8; // type:func -Collider_DestroyLine = 0x80052618; // type:func -Collider_SetLinePoints = 0x8005262C; // type:func -Collider_SetLine = 0x80052670; // type:func -Collider_ResetLineOC = 0x8005269C; // type:func -CollisionCheck_InitContext = 0x800526B8; // type:func -CollisionCheck_DestroyContext = 0x800526D8; // type:func -CollisionCheck_ClearContext = 0x800526E8; // type:func -CollisionCheck_EnableSAC = 0x80052790; // type:func -CollisionCheck_DisableSAC = 0x800527A8; // type:func -CollisionCheck_SetAT = 0x800527C0; // type:func -CollisionCheck_SetAT_SAC = 0x800528A0; // type:func -CollisionCheck_SetAC = 0x800529B0; // type:func -CollisionCheck_SetAC_SAC = 0x80052A90; // type:func -CollisionCheck_SetOC = 0x80052BA0; // type:func -CollisionCheck_SetOC_SAC = 0x80052C80; // type:func -CollisionCheck_SetOCLine = 0x80052D90; // type:func -CollisionCheck_IsElementNotAT = 0x80052E1C; // type:func -CollisionCheck_IsElementNotAC = 0x80052E40; // type:func -CollisionCheck_NoSharedFlags = 0x80052E64; // type:func -CollisionCheck_NoBlood = 0x80052E8C; // type:func -CollisionCheck_BlueBlood = 0x80052EA0; // type:func -CollisionCheck_GreenBlood = 0x8005300C; // type:func -CollisionCheck_WaterBurst = 0x80053178; // type:func -CollisionCheck_RedBlood = 0x800531B4; // type:func -CollisionCheck_RedBloodUnused = 0x800531D8; // type:func -CollisionCheck_HitSolid = 0x800531FC; // type:func -CollisionCheck_SwordHitAudio = 0x8005340C; // type:func -CollisionCheck_HitEffects = 0x80053518; // type:func -CollisionCheck_SetBounce = 0x80053718; // type:func -CollisionCheck_SetATvsAC = 0x80053738; // type:func -CollisionCheck_ATJntSphVsACJntSph = 0x800538E0; // type:func -CollisionCheck_ATJntSphVsACCyl = 0x80053B8C; // type:func -CollisionCheck_ATCylVsACJntSph = 0x80053E00; // type:func -CollisionCheck_ATJntSphVsACTris = 0x800540A0; // type:func -CollisionCheck_ATTrisVsACJntSph = 0x800542C0; // type:func -CollisionCheck_ATJntSphVsACQuad = 0x800544D4; // type:func -CollisionCheck_ATQuadVsACJntSph = 0x800546F4; // type:func -CollisionCheck_ATCylVsACCyl = 0x80054958; // type:func -CollisionCheck_ATCylVsACTris = 0x80054B2C; // type:func -CollisionCheck_ATTrisVsACCyl = 0x80054CF0; // type:func -CollisionCheck_ATCylVsACQuad = 0x80054EB0; // type:func -CollisionCheck_ATQuadVsACCyl = 0x80055124; // type:func -CollisionCheck_ATTrisVsACTris = 0x800553D0; // type:func -CollisionCheck_ATTrisVsACQuad = 0x80055624; // type:func -CollisionCheck_ATQuadVsACTris = 0x800558B4; // type:func -CollisionCheck_ATQuadVsACQuad = 0x80055B4C; // type:func -CollisionCheck_SetJntSphHitFX = 0x80055DDC; // type:func -CollisionCheck_SetCylHitFX = 0x80055EBC; // type:func -CollisionCheck_SetTrisHitFX = 0x80055F54; // type:func -CollisionCheck_SetQuadHitFX = 0x8005603C; // type:func -CollisionCheck_SetHitEffects = 0x800560D4; // type:func -CollisionCheck_AC = 0x800561A8; // type:func -CollisionCheck_AT = 0x800562D0; // type:func -CollisionCheck_GetMassType = 0x800563A0; // type:func -CollisionCheck_SetOCvsOC = 0x800563DC; // type:func -CollisionCheck_OC_JntSphVsJntSph = 0x8005670C; // type:func -CollisionCheck_OC_JntSphVsCyl = 0x800568DC; // type:func -CollisionCheck_OC_CylVsJntSph = 0x80056A3C; // type:func -CollisionCheck_OC_CylVsCyl = 0x80056A68; // type:func -CollisionCheck_SkipOC = 0x80056B38; // type:func -CollisionCheck_Incompatible = 0x80056B5C; // type:func -CollisionCheck_OC = 0x80056BDC; // type:func -CollisionCheck_InitInfo = 0x80056D6C; // type:func -CollisionCheck_ResetDamage = 0x80056DB4; // type:func -CollisionCheck_SetInfoNoDamageTable = 0x80056DE0; // type:func -CollisionCheck_SetInfo = 0x80056E08; // type:func -CollisionCheck_SetInfo2 = 0x80056E34; // type:func -CollisionCheck_SetInfoGetDamageTable = 0x80056E68; // type:func -CollisionCheck_ApplyDamage = 0x80056EA0; // type:func -CollisionCheck_ApplyDamageJntSph = 0x80057060; // type:func -CollisionCheck_ApplyDamageCyl = 0x80057108; // type:func -CollisionCheck_ApplyDamageTris = 0x80057128; // type:func -CollisionCheck_ApplyDamageQuad = 0x800571BC; // type:func -CollisionCheck_Damage = 0x800571DC; // type:func -CollisionCheck_LineOC_JntSph = 0x8005729C; // type:func -CollisionCheck_LineOC_Cyl = 0x800573B4; // type:func -CollisionCheck_LineOC = 0x8005742C; // type:func -CollisionCheck_LineOCCheckAll = 0x80057574; // type:func -CollisionCheck_LineOCCheck = 0x80057598; // type:func -Collider_UpdateCylinder = 0x800575C4; // type:func -Collider_SetCylinderPosition = 0x80057608; // type:func -Collider_SetQuadVertices = 0x80057628; // type:func -Collider_SetTrisVertices = 0x80057698; // type:func -Collider_SetTrisDim = 0x80057758; // type:func -Collider_UpdateSpheres = 0x800577A8; // type:func -CollisionCheck_SpawnRedBlood = 0x8005792C; // type:func -CollisionCheck_SpawnWaterDroplets = 0x80057A8C; // type:func -CollisionCheck_SpawnShieldParticles = 0x80057BE8; // type:func -CollisionCheck_SpawnShieldParticlesMetal = 0x80057C7C; // type:func -CollisionCheck_SpawnShieldParticlesMetalSfx = 0x80057CC8; // type:func -CollisionCheck_SpawnShieldParticlesMetal2 = 0x80057D14; // type:func -CollisionCheck_SpawnShieldParticlesWood = 0x80057D34; // type:func -CollisionCheck_CylSideVsLineSeg = 0x80057DF4; // type:func -CollisionCheck_GetSwordDamage = 0x800584F8; // type:func -SaveContext_Init = 0x80058560; // type:func -Regs_Init = 0x80058610; // type:func -DebugCamera_ScreenText = 0x800586A0; // type:func -DebugCamera_ScreenTextColored = 0x800586B4; // type:func -DebugCamera_DrawScreenText = 0x80058770; // type:func -Debug_DrawText = 0x80058854; // type:func -DebugDisplay_Init = 0x80058920; // type:func -DebugDisplay_AddObject = 0x80058930; // type:func -DebugDisplay_DrawObjects = 0x80058A0C; // type:func -DebugDisplay_DrawSpriteI8 = 0x80058A9C; // type:func -DebugDisplay_DrawPolygon = 0x80058C80; // type:func -Cutscene_InitContext = 0x80058DE0; // type:func -Cutscene_StartManual = 0x80058DF8; // type:func -Cutscene_StopManual = 0x80058E10; // type:func -Cutscene_UpdateManual = 0x80058E34; // type:func -Cutscene_UpdateScripted = 0x80058E80; // type:func -CutsceneHandler_DoNothing = 0x80058F34; // type:func -Cutscene_StepTimer = 0x80058F44; // type:func -CutsceneHandler_StartManual = 0x80058F7C; // type:func -CutsceneHandler_StartScript = 0x80058FDC; // type:func -CutsceneCmd_Misc = 0x80059048; // type:func -CutsceneCmd_SetLightSetting = 0x800597E4; // type:func -CutsceneCmd_StartSequence = 0x80059824; // type:func -CutsceneCmd_StopSequence = 0x80059860; // type:func -CutsceneCmd_FadeOutSequence = 0x8005989C; // type:func -CutsceneCmd_RumbleController = 0x8005991C; // type:func -CutsceneCmd_SetTime = 0x80059960; // type:func -CutsceneCmd_Destination = 0x80059A04; // type:func -CutsceneCmd_Transition = 0x8005B724; // type:func -CutsceneCmd_UpdateCamEyeSpline = 0x8005C104; // type:func -CutsceneCmd_UpdateCamAtSpline = 0x8005C258; // type:func -CutsceneCmd_SetCamEye = 0x8005C3B4; // type:func -CutsceneCmd_SetCamAt = 0x8005C590; // type:func -CutsceneCmd_Text = 0x8005C738; // type:func -Cutscene_ProcessScript = 0x8005CA0C; // type:func -CutsceneHandler_RunScript = 0x8005D3DC; // type:func -CutsceneHandler_StopManual = 0x8005D420; // type:func -CutsceneHandler_StopScript = 0x8005D460; // type:func -Cutscene_SetupScripted = 0x8005D568; // type:func -func_80069048 = 0x8005D6E8; // type:func -func_8006907C = 0x8005D720; // type:func -Cutscene_HandleEntranceTriggers = 0x8005D744; // type:func -Cutscene_HandleConditionalTriggers = 0x8005D864; // type:func -Cutscene_SetScript = 0x8005DA6C; // type:func -MemCpy = 0x8005DAC0; // type:func -MemSet = 0x8005DAF0; // type:func -GetItem_Draw = 0x8005DB50; // type:func -GetItem_DrawMaskOrBombchu = 0x8005DB94; // type:func -GetItem_DrawSoldOut = 0x8005DC30; // type:func -GetItem_DrawBlueFire = 0x8005DCD8; // type:func -GetItem_DrawPoes = 0x8005DE7C; // type:func -GetItem_DrawFairy = 0x8005E078; // type:func -GetItem_DrawMirrorShield = 0x8005E254; // type:func -GetItem_DrawSkullToken = 0x8005E3CC; // type:func -GetItem_DrawEggOrMedallion = 0x8005E534; // type:func -GetItem_DrawCompass = 0x8005E5EC; // type:func -GetItem_DrawPotion = 0x8005E6F4; // type:func -GetItem_DrawGoronSword = 0x8005E8C8; // type:func -GetItem_DrawDekuNuts = 0x8005E9D0; // type:func -GetItem_DrawRecoveryHeart = 0x8005EAE4; // type:func -GetItem_DrawFish = 0x8005EBFC; // type:func -GetItem_DrawOpa0 = 0x8005ED04; // type:func -GetItem_DrawOpa0Xlu1 = 0x8005EDA0; // type:func -GetItem_DrawXlu01 = 0x8005EEA4; // type:func -GetItem_DrawOpa10Xlu2 = 0x8005EF5C; // type:func -GetItem_DrawMagicArrow = 0x8005F078; // type:func -GetItem_DrawMagicSpell = 0x8005F194; // type:func -GetItem_DrawOpa1023 = 0x8005F2E4; // type:func -GetItem_DrawOpa10Xlu32 = 0x8005F3CC; // type:func -GetItem_DrawSmallRupee = 0x8005F500; // type:func -GetItem_DrawScale = 0x8005F650; // type:func -GetItem_DrawBulletBag = 0x8005F7B0; // type:func -GetItem_DrawWallet = 0x8005F8FC; // type:func -SfxSource_InitAll = 0x8005FA50; // type:func -SfxSource_UpdateAll = 0x8005FA80; // type:func -SfxSource_PlaySfxAtFixedWorldPos = 0x8005FB28; // type:func -QuestHint_CheckCondition = 0x8005FC10; // type:func -QuestHint_CheckConditionChain = 0x8005FE8C; // type:func -QuestHint_CheckRandomCondition = 0x8005FF20; // type:func -QuestHint_GetTextIdFromScript = 0x80060100; // type:func -QuestHint_GetSariaTextId = 0x80060244; // type:func -QuestHint_GetNaviTextId = 0x800602AC; // type:func -MaskReaction_GetTextId = 0x800602F0; // type:func -CutsceneFlags_UnsetAll = 0x80060340; // type:func -CutsceneFlags_Set = 0x80060370; // type:func -CutsceneFlags_Unset = 0x800603DC; // type:func -CutsceneFlags_Get = 0x8006044C; // type:func -Curve_CubicHermiteSpline = 0x800604C0; // type:func -Curve_Interpolate = 0x80060558; // type:func -SkelCurve_Clear = 0x80060700; // type:func -SkelCurve_Init = 0x80060730; // type:func -SkelCurve_Destroy = 0x800607E0; // type:func -SkelCurve_SetAnim = 0x80060810; // type:func -SkelCurve_Update = 0x80060848; // type:func -SkelCurve_DrawLimb = 0x80060B38; // type:func -SkelCurve_Draw = 0x80060EC4; // type:func -Horse_CanSpawn = 0x80060F10; // type:func -Horse_ResetHorseData = 0x80060FC4; // type:func -Horse_FixLakeHyliaPosition = 0x80061000; // type:func -Horse_SetupInGameplay = 0x80061040; // type:func -Horse_SetupInCutscene = 0x800614D8; // type:func -Horse_InitPlayerHorse = 0x80061A4C; // type:func -Horse_RotateToPoint = 0x80061B5C; // type:func -Jpeg_ScheduleDecoderTask = 0x80061BF0; // type:func -Jpeg_CopyToZbuffer = 0x80061D2C; // type:func -Jpeg_GetUnalignedU16 = 0x80061E64; // type:func -Jpeg_ParseMarkers = 0x80061EB0; // type:func -Jpeg_Decode = 0x8006207C; // type:func -KaleidoSetup_Update = 0x800623B0; // type:func -KaleidoSetup_Init = 0x8006261C; // type:func -KaleidoSetup_Destroy = 0x80062770; // type:func -Font_LoadCharWide = 0x80062780; // type:func -Font_LoadChar = 0x800627D0; // type:func -Font_LoadCharCHN = 0x8006280C; // type:func -Font_LoadMessageBoxIcon = 0x80062848; // type:func -Font_LoadOrderedFont = 0x8006287C; // type:func -Environment_ZBufValToFixedPoint = 0x80062980; // type:func -Environment_GetPixelDepth = 0x800629B8; // type:func -Environment_GraphCallback = 0x800629E4; // type:func -Environment_Init = 0x80062A28; // type:func -Environment_SmoothStepToU8 = 0x80062EF8; // type:func -Environment_SmoothStepToS8 = 0x80063030; // type:func -Environment_LerpWeight = 0x80063170; // type:func -Environment_LerpWeightAccelDecel = 0x800631F4; // type:func -Environment_UpdateStorm = 0x800633B4; // type:func -Environment_UpdateSkybox = 0x800634A8; // type:func -Environment_EnableUnderwaterLights = 0x80063D94; // type:func -Environment_DisableUnderwaterLights = 0x80063E0C; // type:func -Environment_Update = 0x80063E84; // type:func -Environment_DrawSunAndMoon = 0x80065CE0; // type:func -Environment_DrawSunLensFlare = 0x8006653C; // type:func -Environment_DrawLensFlare = 0x80066610; // type:func -Environment_RandCentered = 0x80067268; // type:func -Environment_DrawRain = 0x80067290; // type:func -Environment_ChangeLightSetting = 0x80067838; // type:func -Environment_DrawSkyboxFilters = 0x800678BC; // type:func -Environment_DrawLightningFlash = 0x80067ADC; // type:func -Environment_UpdateLightningStrike = 0x80067B74; // type:func -Environment_AddLightningBolts = 0x80067E7C; // type:func -Environment_DrawLightning = 0x80067EE4; // type:func -Environment_PlaySceneSequence = 0x80068328; // type:func -Environment_PlayTimeBasedSequence = 0x80068518; // type:func -Environment_DrawCustomLensFlare = 0x80068830; // type:func -Environment_InitGameOverLights = 0x800688DC; // type:func -Environment_FadeInGameOverLights = 0x80068AC4; // type:func -Environment_FadeOutGameOverLights = 0x80068D78; // type:func -Environment_UpdateRain = 0x80069094; // type:func -Environment_FillScreen = 0x800690FC; // type:func -Environment_DrawSandstorm = 0x800692F4; // type:func -Environment_AdjustLights = 0x80069D40; // type:func -Environment_GetBgsDayCount = 0x80069F6C; // type:func -Environment_ClearBgsDayCount = 0x80069F7C; // type:func -Environment_GetTotalDays = 0x80069F8C; // type:func -Environment_ForcePlaySequence = 0x80069F9C; // type:func -Environment_IsForcedSequenceDisabled = 0x80069FB4; // type:func -Environment_PlayStormNatureAmbience = 0x80069FDC; // type:func -Environment_StopStormNatureAmbience = 0x8006A03C; // type:func -Environment_WarpSongLeave = 0x8006A09C; // type:func -Lib_MemSet = 0x8006A190; // type:func -Math_CosS = 0x8006A1E4; // type:func -Math_SinS = 0x8006A224; // type:func -Math_ScaledStepToS = 0x8006A264; // type:func -Math_StepToS = 0x8006A334; // type:func -Math_StepToF = 0x8006A3BC; // type:func -Math_StepUntilAngleS = 0x8006A450; // type:func -Math_StepUntilS = 0x8006A4B8; // type:func -Math_StepToAngleS = 0x8006A518; // type:func -Math_StepUntilF = 0x8006A5DC; // type:func -Math_AsymStepToF = 0x8006A62C; // type:func -Lib_GetControlStickData = 0x8006A6D4; // type:func -Rand_S16Offset = 0x8006A750; // type:func -Rand_S16OffsetStride = 0x8006A7A4; // type:func -Math_Vec3f_Copy = 0x8006A80C; // type:func -Math_Vec3s_ToVec3f = 0x8006A82C; // type:func -Math_Vec3f_Sum = 0x8006A870; // type:func -Math_Vec3f_Diff = 0x8006A8A8; // type:func -Math_Vec3s_DiffToVec3f = 0x8006A8E0; // type:func -Math_Vec3f_Scale = 0x8006A93C; // type:func -Math_Vec3f_DistXYZ = 0x8006A978; // type:func -Math_Vec3f_DistXYZAndStoreDiff = 0x8006A9BC; // type:func -Math_Vec3f_DistXZ = 0x8006AA18; // type:func -Math_Vec3f_DiffY = 0x8006AA4C; // type:func -Math_Vec3f_Yaw = 0x8006AA60; // type:func -Math_Vec3f_Pitch = 0x8006AA94; // type:func -Actor_ProcessInitChain = 0x8006AADC; // type:func -IChain_Apply_u8 = 0x8006AB54; // type:func -IChain_Apply_s8 = 0x8006AB70; // type:func -IChain_Apply_u16 = 0x8006AB8C; // type:func -IChain_Apply_s16 = 0x8006ABA8; // type:func -IChain_Apply_u32 = 0x8006ABC4; // type:func -IChain_Apply_s32 = 0x8006ABE0; // type:func -IChain_Apply_f32 = 0x8006ABFC; // type:func -IChain_Apply_f32div1000 = 0x8006AC20; // type:func -IChain_Apply_Vec3f = 0x8006AC50; // type:func -IChain_Apply_Vec3fdiv1000 = 0x8006AC7C; // type:func -IChain_Apply_Vec3s = 0x8006ACB4; // type:func -Math_SmoothStepToF = 0x8006ACD8; // type:func -Math_ApproachF = 0x8006ADE0; // type:func -Math_ApproachZeroF = 0x8006AE50; // type:func -Math_SmoothStepToDegF = 0x8006AEA4; // type:func -Math_SmoothStepToS = 0x8006B068; // type:func -Math_ApproachS = 0x8006B184; // type:func -Color_RGBA8_Copy = 0x8006B228; // type:func -Sfx_PlaySfxCentered = 0x8006B250; // type:func -Sfx_PlaySfxCentered2 = 0x8006B298; // type:func -Sfx_PlaySfxAtPos = 0x8006B2E0; // type:func -Health_InitMeter = 0x8006B330; // type:func -Health_UpdateMeter = 0x8006B40C; // type:func -func_80078E18 = 0x8006B7F0; // type:func -func_80078E34 = 0x8006B810; // type:func -func_80078E84 = 0x8006B860; // type:func -Health_DrawMeter = 0x8006B8F8; // type:func -Health_UpdateBeatingHeart = 0x8006C570; // type:func -Health_IsCritical = 0x8006C65C; // type:func -Lights_PointSetInfo = 0x8006C6D0; // type:func -Lights_PointNoGlowSetInfo = 0x8006C72C; // type:func -Lights_PointGlowSetInfo = 0x8006C790; // type:func -Lights_PointSetColorAndRadius = 0x8006C7F8; // type:func -Lights_DirectionalSetInfo = 0x8006C82C; // type:func -Lights_Reset = 0x8006C884; // type:func -Lights_Draw = 0x8006C8C0; // type:func -Lights_FindSlot = 0x8006CA04; // type:func -Lights_BindPoint = 0x8006CA34; // type:func -Lights_BindDirectional = 0x8006CD90; // type:func -Lights_BindAll = 0x8006CDF8; // type:func -Lights_FindBufSlot = 0x8006CE94; // type:func -Lights_FreeNode = 0x8006CF20; // type:func -LightContext_Init = 0x8006CF98; // type:func -LightContext_SetAmbientColor = 0x8006D004; // type:func -LightContext_SetFog = 0x8006D030; // type:func -LightContext_NewLights = 0x8006D06C; // type:func -LightContext_InitList = 0x8006D0A4; // type:func -LightContext_DestroyList = 0x8006D0B4; // type:func -LightContext_InsertLight = 0x8006D110; // type:func -LightContext_RemoveLight = 0x8006D170; // type:func -Lights_NewAndDraw = 0x8006D1D4; // type:func -Lights_New = 0x8006D31C; // type:func -Lights_GlowCheck = 0x8006D364; // type:func -Lights_DrawGlow = 0x8006D568; // type:func -ZeldaArena_Malloc = 0x8006D770; // type:func -ZeldaArena_MallocR = 0x8006D798; // type:func -ZeldaArena_Realloc = 0x8006D7C0; // type:func -ZeldaArena_Free = 0x8006D7F0; // type:func -ZeldaArena_Calloc = 0x8006D818; // type:func -ZeldaArena_GetSizes = 0x8006D870; // type:func -ZeldaArena_Check = 0x8006D8A8; // type:func -ZeldaArena_Init = 0x8006D8CC; // type:func -ZeldaArena_Cleanup = 0x8006D8FC; // type:func -ZeldaArena_IsInitialized = 0x8006D920; // type:func -MapMark_Init = 0x8006D950; // type:func -MapMark_ClearPointers = 0x8006D9FC; // type:func -MapMark_DrawForDungeon = 0x8006DA18; // type:func -MapMark_Draw = 0x8006DF08; // type:func -PreNmiBuff_Init = 0x8006DF50; // type:func -PreNmiBuff_SetReset = 0x8006DFC8; // type:func -PreNmiBuff_IsResetting = 0x8006DFFC; // type:func -Sched_FlushTaskQueue = 0x8006E010; // type:func -OLib_Vec3fDist = 0x8006E090; // type:func -OLib_Vec3fDistOutDiff = 0x8006E0D4; // type:func -OLib_Vec3fDistXZ = 0x8006E130; // type:func -OLib_ClampMinDist = 0x8006E164; // type:func -OLib_ClampMaxDist = 0x8006E1B4; // type:func -OLib_Vec3fDistNormalize = 0x8006E204; // type:func -OLib_VecSphToVec3f = 0x8006E2B4; // type:func -OLib_VecGeoToVec3f = 0x8006E360; // type:func -OLib_Vec3fToVecSph = 0x8006E3A4; // type:func -OLib_Vec3fToVecGeo = 0x8006E4F8; // type:func -OLib_Vec3fDiffToVecSph = 0x8006E540; // type:func -OLib_Vec3fDiffToVecGeo = 0x8006E594; // type:func -OLib_Vec3fDiffRad = 0x8006E5E8; // type:func -OLib_Vec3fDiffDegF = 0x8006E678; // type:func -OLib_Vec3fDiffBinAng = 0x8006E6E0; // type:func -OnePointCutscene_AddVecGeoToVec3f = 0x8006E780; // type:func -OnePointCutscene_Vec3fYaw = 0x8006E800; // type:func -OnePointCutscene_Vec3sToVec3f = 0x8006E868; // type:func -OnePointCutscene_BgCheckLineTest = 0x8006E8AC; // type:func -OnePointCutscene_RaycastDown = 0x8006E8FC; // type:func -OnePointCutscene_SetCsCamPoints = 0x8006E924; // type:func -OnePointCutscene_SetInfo = 0x8006E958; // type:func -OnePointCutscene_SetAsChild = 0x80072094; // type:func -OnePointCutscene_RemoveCamera = 0x800720DC; // type:func -OnePointCutscene_Init = 0x800721B0; // type:func -OnePointCutscene_EndCutscene = 0x80072468; // type:func -OnePointCutscene_Attention = 0x800724C4; // type:func -OnePointCutscene_AttentionSetSfx = 0x80072630; // type:func -OnePointCutscene_EnableAttention = 0x80072684; // type:func -OnePointCutscene_DisableAttention = 0x80072694; // type:func -OnePointCutscene_CheckForCategory = 0x800726A8; // type:func -OnePointCutscene_Noop = 0x80072708; // type:func -Map_SavePlayerInitialInfo = 0x80072720; // type:func -Map_SetPaletteData = 0x80072780; // type:func -Map_SetFloorPalettesData = 0x800727FC; // type:func -Map_InitData = 0x800729B4; // type:func -Map_InitRoomData = 0x80072C70; // type:func -Map_Destroy = 0x80072D4C; // type:func -Map_Init = 0x80072D74; // type:func -Minimap_DrawCompassIcons = 0x80072FFC; // type:func -Minimap_Draw = 0x80073450; // type:func -Map_GetFloorTextIndexOffset = 0x80073F6C; // type:func -Map_Update = 0x80073F94; // type:func -Interface_ChangeHudVisibilityMode = 0x800742C0; // type:func -Interface_RaiseButtonAlphas = 0x800742F0; // type:func -Interface_DimButtonAlphas = 0x80074434; // type:func -Interface_UpdateHudAlphas = 0x800744F8; // type:func -func_80083108 = 0x80074BF4; // type:func -Interface_SetSceneRestrictions = 0x800759A0; // type:func -Gfx_TextureIA8 = 0x80075AF0; // type:func -Gfx_TextureI8 = 0x80075D08; // type:func -Inventory_SwapAgeEquipment = 0x80075F20; // type:func -Interface_InitHorsebackArchery = 0x8007620C; // type:func -func_800849EC = 0x8007624C; // type:func -Interface_LoadItemIcon1 = 0x800762C8; // type:func -Interface_LoadItemIcon2 = 0x80076368; // type:func -func_80084BF4 = 0x80076408; // type:func -Item_Give = 0x800764FC; // type:func -Item_CheckObtainability = 0x80077A34; // type:func -Inventory_DeleteItem = 0x80077E30; // type:func -Inventory_ReplaceItem = 0x80077EC0; // type:func -Inventory_HasEmptyBottle = 0x80077F68; // type:func -Inventory_HasSpecificBottle = 0x80077FA4; // type:func -Inventory_UpdateBottleItem = 0x80077FE0; // type:func -Inventory_ConsumeFairy = 0x80078094; // type:func -func_80086D5C = 0x8007817C; // type:func -Interface_LoadActionLabel = 0x800781B0; // type:func -Interface_SetDoAction = 0x80078304; // type:func -Interface_SetNaviCall = 0x8007837C; // type:func -Interface_LoadActionLabelB = 0x8007846C; // type:func -Health_ChangeBy = 0x80078534; // type:func -Health_GiveHearts = 0x80078620; // type:func -Rupees_ChangeBy = 0x80078640; // type:func -Inventory_ChangeAmmo = 0x80078660; // type:func -Magic_Fill = 0x8007891C; // type:func -Magic_Reset = 0x8007895C; // type:func -Magic_RequestChange = 0x80078998; // type:func -Magic_Update = 0x80078BB0; // type:func -Magic_DrawMeter = 0x80079470; // type:func -Interface_SetSubTimer = 0x80079C6C; // type:func -Interface_SetSubTimerToFinalSecond = 0x80079CB4; // type:func -Interface_SetTimer = 0x80079CF0; // type:func -Interface_DrawActionLabel = 0x80079D38; // type:func -Interface_DrawItemButtons = 0x80079E3C; // type:func -Interface_DrawItemIconTexture = 0x8007ACD4; // type:func -Interface_DrawAmmoCount = 0x8007AED0; // type:func -Interface_DrawActionButton = 0x8007B374; // type:func -Interface_InitVertices = 0x8007B578; // type:func -func_8008A8B8 = 0x8007B870; // type:func -func_8008A994 = 0x8007B954; // type:func -Interface_Draw = 0x8007B99C; // type:func -Interface_Update = 0x8007E538; // type:func -Path_GetByIndex = 0x8007F020; // type:func -Path_OrientAndGetDistSq = 0x8007F064; // type:func -Path_CopyLastPoint = 0x8007F150; // type:func -FrameAdvance_Init = 0x8007F1F0; // type:func -FrameAdvance_Update = 0x8007F200; // type:func -Player_SetBootData = 0x8007F2A0; // type:func -Player_InBlockingCsMode = 0x8007F42C; // type:func -Player_InCsMode = 0x8007F4DC; // type:func -Player_CheckHostileLockOn = 0x8007F518; // type:func -Player_IsChildWithHylianShield = 0x8007F528; // type:func -Player_ActionToModelGroup = 0x8007F550; // type:func -Player_SetModelsForHoldingShield = 0x8007F59C; // type:func -Player_SetModels = 0x8007F688; // type:func -Player_SetModelGroup = 0x8007F760; // type:func -func_8008EC70 = 0x8007F7CC; // type:func -Player_SetEquipmentData = 0x8007F804; // type:func -Player_UpdateBottleHeld = 0x8007F8F4; // type:func -Player_ReleaseLockOn = 0x8007F948; // type:func -Player_ClearZTargeting = 0x8007F964; // type:func -Player_SetAutoLockOnActor = 0x8007FA08; // type:func -func_8008EF30 = 0x8007FA8C; // type:func -func_8008EF44 = 0x8007FAA4; // type:func -Player_IsBurningStickInRange = 0x8007FAC0; // type:func -Player_GetStrength = 0x8007FB98; // type:func -Player_GetMask = 0x8007FBE4; // type:func -Player_UnsetMask = 0x8007FBF4; // type:func -Player_HasMirrorShieldEquipped = 0x8007FC04; // type:func -Player_HasMirrorShieldSetToDraw = 0x8007FC1C; // type:func -Player_ActionToMagicSpell = 0x8007FC48; // type:func -Player_HoldsHookshot = 0x8007FC74; // type:func -func_8008F128 = 0x8007FC98; // type:func -Player_ActionToMeleeWeapon = 0x8007FCCC; // type:func -Player_GetMeleeWeaponHeld = 0x8007FCF4; // type:func -Player_HoldsTwoHandedWeapon = 0x8007FD18; // type:func -Player_HoldsBrokenKnife = 0x8007FD44; // type:func -Player_ActionToBottle = 0x8007FD9C; // type:func -Player_GetBottleHeld = 0x8007FDC8; // type:func -Player_ActionToExplosive = 0x8007FDE8; // type:func -Player_GetExplosiveHeld = 0x8007FE14; // type:func -func_8008F2BC = 0x8007FE34; // type:func -Player_GetEnvironmentalHazard = 0x8007FE70; // type:func -Player_DrawImpl = 0x8007FFE8; // type:func -func_8008F87C = 0x800803AC; // type:func -Player_OverrideLimbDrawGameplayCommon = 0x800807F8; // type:func -Player_OverrideLimbDrawGameplayDefault = 0x80080B4C; // type:func -Player_OverrideLimbDrawGameplayFirstPerson = 0x80080E38; // type:func -Player_OverrideLimbDrawGameplayCrawling = 0x80080F88; // type:func -func_80090480 = 0x80080FCC; // type:func -Player_UpdateShieldCollider = 0x80081154; // type:func -func_800906D4 = 0x80081228; // type:func -Player_DrawGetItemImpl = 0x80081338; // type:func -Player_DrawGetItem = 0x800814CC; // type:func -func_80090A28 = 0x80081544; // type:func -Player_DrawHookshotReticle = 0x80081618; // type:func -Player_PostLimbDrawGameplay = 0x800817FC; // type:func -Player_InitPauseDrawData = 0x80082164; // type:func -Player_OverrideLimbDrawPause = 0x80082290; // type:func -Player_DrawPauseImpl = 0x80082434; // type:func -Player_DrawPause = 0x80082B38; // type:func -func_80092320 = 0x80082D10; // type:func -PreNMI_Update = 0x80082D24; // type:func -PreNMI_Draw = 0x80082D6C; // type:func -PreNMI_Main = 0x80082E28; // type:func -PreNMI_Destroy = 0x80082E5C; // type:func -PreNMI_Init = 0x80082E68; // type:func -Quake_AddVecGeoToVec3f = 0x80082EB0; // type:func -Quake_UpdateShakeInfo = 0x80082F30; // type:func -Quake_CallbackType1 = 0x80083158; // type:func -Quake_CallbackType5 = 0x800831E0; // type:func -Quake_CallbackType6 = 0x80083254; // type:func -Quake_CallbackType3 = 0x800832D8; // type:func -Quake_CallbackType2 = 0x80083370; // type:func -Quake_CallbackType4 = 0x800833E0; // type:func -Quake_GetFreeIndex = 0x80083478; // type:func -Quake_RequestImpl = 0x800834DC; // type:func -Quake_Remove = 0x80083594; // type:func -Quake_GetRequest = 0x800835BC; // type:func -Quake_SetValue = 0x80083618; // type:func -Quake_SetSpeed = 0x80083748; // type:func -Quake_SetDuration = 0x80083790; // type:func -Quake_GetTimeLeft = 0x800837E0; // type:func -Quake_SetPerturbations = 0x80083818; // type:func -Quake_SetOrientation = 0x80083880; // type:func -Quake_Init = 0x800838E8; // type:func -Quake_Request = 0x8008393C; // type:func -Quake_RemoveRequest = 0x80083960; // type:func -Quake_Update = 0x800839A8; // type:func -Gfx_SetFog = 0x80083D20; // type:func -Gfx_SetFogWithSync = 0x80083E9C; // type:func -Gfx_SetFog2 = 0x8008402C; // type:func -Gfx_SetupDLImpl = 0x80084060; // type:func -Gfx_SetupDL = 0x8008409C; // type:func -Gfx_SetupDLAtPtr = 0x800840BC; // type:func -Gfx_SetupDL_57 = 0x800840E8; // type:func -Gfx_SetupDL_57b = 0x80084110; // type:func -Gfx_SetupDL_52NoCD = 0x80084138; // type:func -Gfx_SetupDL_58Opa = 0x8008417C; // type:func -Gfx_SetupDL_57Opa = 0x800841A4; // type:func -Gfx_SetupDL_50Opa = 0x800841CC; // type:func -Gfx_SetupDL_51Opa = 0x800841F4; // type:func -Gfx_SetupDL_52Xlu = 0x8008421C; // type:func -Gfx_SetupDL_53Opa = 0x80084244; // type:func -Gfx_SetupDL_54Opa = 0x8008426C; // type:func -Gfx_SetupDL_55Xlu = 0x80084294; // type:func -Gfx_SetupDL_26Opa = 0x800842BC; // type:func -Gfx_SetupDL_25Xlu2 = 0x800842E4; // type:func -func_80093C80 = 0x8008430C; // type:func -Gfx_SetupDL_25Opa = 0x80084378; // type:func -Gfx_SetupDL_25Xlu = 0x800843A0; // type:func -Gfx_SetupDL_31Opa = 0x800843C8; // type:func -Gfx_SetupDL_32Opa = 0x800843F0; // type:func -Gfx_SetupDL_33Opa = 0x80084418; // type:func -Gfx_SetupDL_64 = 0x80084440; // type:func -Gfx_SetupDL_34 = 0x80084468; // type:func -Gfx_SetupDL_34Opa = 0x80084490; // type:func -Gfx_SetupDL_35Opa = 0x800844BC; // type:func -Gfx_SetupDL_44Xlu = 0x800844E4; // type:func -Gfx_SetupDL_36Opa = 0x8008450C; // type:func -Gfx_SetupDL_28 = 0x80084534; // type:func -Gfx_SetupDL_28Opa = 0x8008455C; // type:func -Gfx_SetupDL_43Opa = 0x80084584; // type:func -Gfx_SetupDL_45Opa = 0x800845AC; // type:func -Gfx_SetupDL_46Overlay = 0x800845D4; // type:func -Gfx_SetupDL_38Xlu = 0x800845FC; // type:func -Gfx_SetupDL_4Xlu = 0x80084624; // type:func -Gfx_SetupDL_37Opa = 0x8008464C; // type:func -Gfx_SetupDL_2Opa = 0x80084674; // type:func -Gfx_SetupDL_39 = 0x8008469C; // type:func -Gfx_SetupDL_39Opa = 0x800846C4; // type:func -Gfx_SetupDL_39Overlay = 0x800846F0; // type:func -Gfx_SetupDL_39Ptr = 0x8008471C; // type:func -Gfx_SetupDL_40Opa = 0x80084748; // type:func -Gfx_SetupDL_41Opa = 0x80084770; // type:func -Gfx_SetupDL_47Xlu = 0x80084798; // type:func -Gfx_SetupDL_66 = 0x800847C0; // type:func -Gfx_SetupDL_67 = 0x800847E8; // type:func -Gfx_SetupDL_68NoCD = 0x80084810; // type:func -Gfx_SetupDL_69NoCD = 0x80084854; // type:func -func_800947AC = 0x80084898; // type:func -Gfx_SetupDL_70 = 0x800848DC; // type:func -Gfx_SetupDL_20NoCD = 0x80084904; // type:func -Gfx_SetupDL_42Opa = 0x80084948; // type:func -Gfx_SetupDL_42Overlay = 0x80084970; // type:func -Gfx_SetupDL_48Opa = 0x80084998; // type:func -Gfx_SetupDL_49Xlu = 0x800849C0; // type:func -Gfx_SetupDL_27Xlu = 0x800849E8; // type:func -Gfx_SetupDL_60NoCDXlu = 0x80084A10; // type:func -Gfx_SetupDL_61Xlu = 0x80084A58; // type:func -Gfx_SetupDL_56Opa = 0x80084A80; // type:func -Gfx_SetupDL_56Ptr = 0x80084AA8; // type:func -Gfx_SetupDL_59Opa = 0x80084AD4; // type:func -Gfx_BranchTexScroll = 0x80084AFC; // type:func -func_80094E54 = 0x80084BA0; // type:func -func_80094E78 = 0x80084BC4; // type:func -Gfx_TexScroll = 0x80084BE8; // type:func -Gfx_TwoTexScroll = 0x80084C6C; // type:func -Gfx_TwoTexScrollEnvColor = 0x80084D8C; // type:func -Gfx_EnvColor = 0x80084EEC; // type:func -Gfx_SetupFrame = 0x80084F44; // type:func -func_80095974 = 0x800854FC; // type:func -func_80095AA0 = 0x800855E0; // type:func -Room_DrawNormal = 0x800855F8; // type:func -Room_DrawCullable = 0x80085814; // type:func -Room_DecodeJpeg = 0x80085CDC; // type:func -Room_DrawBackground2D = 0x80085D64; // type:func -Room_DrawImageSingle = 0x80086060; // type:func -Room_GetImageMultiBgEntry = 0x80086430; // type:func -Room_DrawImageMulti = 0x8008651C; // type:func -Room_DrawImage = 0x800868EC; // type:func -Room_Init = 0x80086954; // type:func -Room_SetupFirstRoom = 0x8008696C; // type:func -Room_RequestNewRoom = 0x80086B08; // type:func -Room_ProcessRoomRequest = 0x80086C40; // type:func -Room_Draw = 0x80086CE4; // type:func -Room_FinishRoomChange = 0x80086D34; // type:func -Sample_HandleStateChange = 0x80086DD0; // type:func -Sample_Draw = 0x80086E04; // type:func -Sample_Main = 0x80086FF0; // type:func -Sample_Destroy = 0x8008701C; // type:func -Sample_SetupView = 0x80087028; // type:func -Sample_LoadTitleStatic = 0x800870E0; // type:func -Sample_Init = 0x80087140; // type:func -Inventory_ChangeEquipment = 0x800871D0; // type:func -Inventory_DeleteEquipment = 0x80087228; // type:func -Inventory_ChangeUpgrade = 0x80087334; // type:func -Object_SpawnPersistent = 0x80087390; // type:func -Object_InitContext = 0x80087474; // type:func -Object_UpdateEntries = 0x800875D0; // type:func -Object_GetSlot = 0x800876C8; // type:func -Object_IsLoaded = 0x80087728; // type:func -func_800981B8 = 0x80087758; // type:func -func_800982FC = 0x800877E0; // type:func -Scene_ExecuteCommands = 0x80087840; // type:func -Scene_CommandPlayerEntryList = 0x800878C4; // type:func -Scene_CommandActorEntryList = 0x800879A0; // type:func -Scene_CommandUnused2 = 0x800879F8; // type:func -Scene_CommandCollisionHeader = 0x80087A40; // type:func -Scene_CommandRoomList = 0x80087B70; // type:func -Scene_CommandSpawnList = 0x80087BC8; // type:func -Scene_CommandSpecialFiles = 0x80087C10; // type:func -Scene_CommandRoomBehavior = 0x80087CD8; // type:func -Scene_CommandRoomShape = 0x80087D30; // type:func -Scene_CommandObjectList = 0x80087D78; // type:func -Scene_CommandLightList = 0x80087F2C; // type:func -Scene_CommandPathList = 0x80087FDC; // type:func -Scene_CommandTransitionActorEntryList = 0x80088024; // type:func -Scene_ResetTransitionActorList = 0x8008807C; // type:func -Scene_CommandLightSettingsList = 0x8008808C; // type:func -Scene_CommandSkyboxSettings = 0x800880E4; // type:func -Scene_CommandSkyboxDisables = 0x80088128; // type:func -Scene_CommandTimeSettings = 0x80088150; // type:func -Scene_CommandWindSettings = 0x80088464; // type:func -Scene_CommandExitList = 0x800884C8; // type:func -Scene_CommandUndefined9 = 0x80088510; // type:func -Scene_CommandSoundSettings = 0x80088520; // type:func -Scene_CommandEchoSettings = 0x8008856C; // type:func -Scene_CommandAlternateHeaderList = 0x80088584; // type:func -Scene_CommandCutsceneData = 0x80088680; // type:func -Scene_CommandMiscSettings = 0x800886C0; // type:func -Scene_SetTransitionForNextEntrance = 0x80088784; // type:func -Scene_DrawConfigDefault = 0x80088840; // type:func -Scene_DrawConfigDekuTree = 0x80088880; // type:func -Scene_DrawConfigDekuTreeBoss = 0x800889C8; // type:func -Scene_DrawConfigDodongosCavern = 0x80088AAC; // type:func -Scene_DrawConfigTempleOfTime = 0x80088DD4; // type:func -Scene_DrawConfigGrottos = 0x800895EC; // type:func -Scene_DrawConfigChamberOfTheSages = 0x800898FC; // type:func -Scene_DrawConfigGreatFairyFountain = 0x80089B20; // type:func -Scene_DrawConfigGraveExitLightShining = 0x80089CB8; // type:func -Scene_DrawConfigFairysFountain = 0x80089D90; // type:func -Scene_DrawConfigShadowTempleAndWell = 0x80089EF4; // type:func -Scene_DrawConfigThievesHideout = 0x8008A080; // type:func -Scene_DrawConfigWaterTemple = 0x8008A168; // type:func -Scene_DrawConfigWaterTempleBoss = 0x8008A8D8; // type:func -Scene_DrawConfigShootingGallery = 0x8008A9F8; // type:func -Scene_DrawConfigCastleCourtyardGuards = 0x8008AAAC; // type:func -Scene_DrawConfigOutsideGanonsCastle = 0x8008AC24; // type:func -func_8009BEEC = 0x8008AEC0; // type:func -Scene_DrawConfigGanonsTowerCollapseExterior = 0x8008B080; // type:func -Scene_DrawConfigIceCavern = 0x8008B38C; // type:func -Scene_DrawConfigRoyalFamilysTomb = 0x8008B57C; // type:func -Scene_DrawConfigLakesideLaboratory = 0x8008B800; // type:func -Scene_DrawConfigCalmWater = 0x8008B9E0; // type:func -Scene_DrawConfigGerudoTrainingGround = 0x8008BAE8; // type:func -Gfx_TwoTexScrollPrimColor = 0x8008BCD8; // type:func -Scene_DrawConfigFishingPond = 0x8008BE38; // type:func -Scene_DrawConfigBombchuBowlingAlley = 0x8008BF64; // type:func -Scene_DrawConfigLonLonBuildings = 0x8008C168; // type:func -Scene_DrawConfigMarketGuardHouse = 0x8008C238; // type:func -Scene_DrawConfigPotionShopGranny = 0x8008C368; // type:func -Scene_DrawConfigForestTemple = 0x8008C4E0; // type:func -Scene_DrawConfigSpiritTemple = 0x8008C6D0; // type:func -Scene_DrawConfigHyruleField = 0x8008C740; // type:func -Scene_DrawConfigKakarikoVillage = 0x8008CA3C; // type:func -Scene_DrawConfigZorasRiver = 0x8008CB0C; // type:func -Scene_DrawConfigKokiriForest = 0x8008CD24; // type:func -Scene_DrawConfigLakeHylia = 0x8008D188; // type:func -Scene_DrawConfigZorasDomain = 0x8008D348; // type:func -Scene_DrawConfigZorasFountain = 0x8008D4A4; // type:func -Scene_DrawConfigGerudoValley = 0x8008D694; // type:func -Scene_DrawConfigLostWoods = 0x8008D9D0; // type:func -Scene_DrawConfigDesertColossus = 0x8008DBCC; // type:func -Scene_DrawConfigGerudosFortress = 0x8008DCD8; // type:func -Scene_DrawConfigHauntedWasteland = 0x8008DD48; // type:func -Scene_DrawConfigHyruleCastle = 0x8008DEC0; // type:func -Scene_DrawConfigDeathMountainTrail = 0x8008E064; // type:func -Scene_DrawConfigDeathMountainCrater = 0x8008E228; // type:func -Scene_DrawConfigGoronCity = 0x8008E3F4; // type:func -Scene_DrawConfigLonLonRanch = 0x8008E564; // type:func -Scene_DrawConfigFireTemple = 0x8008E634; // type:func -Scene_DrawConfigJabuJabu = 0x8008E7D8; // type:func -Scene_DrawConfigInsideGanonsCastle = 0x8008EC84; // type:func -Scene_DrawConfigInsideGanonsCastleCollapse = 0x8008EE88; // type:func -Scene_DrawConfigGanonsTowerCollapseInterior = 0x8008EEA8; // type:func -Scene_DrawConfigBesitu = 0x8008EEC8; // type:func -Scene_Draw = 0x8008F000; // type:func -SkelAnime_DrawLimbLod = 0x8008F040; // type:func -SkelAnime_DrawLod = 0x8008F2A8; // type:func -SkelAnime_DrawFlexLimbLod = 0x8008F498; // type:func -SkelAnime_DrawFlexLod = 0x8008F728; // type:func -SkelAnime_DrawLimbOpa = 0x8008F9A0; // type:func -SkelAnime_DrawOpa = 0x8008FBEC; // type:func -SkelAnime_DrawFlexLimbOpa = 0x8008FDCC; // type:func -SkelAnime_DrawFlexOpa = 0x80090044; // type:func -SkelAnime_GetFrameData = 0x800902A8; // type:func -Animation_GetLength = 0x80090410; // type:func -Animation_GetLastFrame = 0x8009044C; // type:func -SkelAnime_DrawLimb = 0x80090494; // type:func -SkelAnime_Draw = 0x800906D4; // type:func -SkelAnime_DrawFlexLimb = 0x800908C4; // type:func -SkelAnime_DrawFlex = 0x80090B54; // type:func -SkelAnime_GetFrameDataLegacy = 0x80090DBC; // type:func -Animation_GetLimbCountLegacy = 0x800911C0; // type:func -Animation_GetLengthLegacy = 0x800911FC; // type:func -Animation_GetLastFrameLegacy = 0x80091238; // type:func -SkelAnime_InterpFrameTable = 0x80091280; // type:func -AnimTaskQueue_Reset = 0x80091700; // type:func -AnimTaskQueue_SetNextGroup = 0x8009170C; // type:func -AnimTaskQueue_DisableTransformTasksForGroup = 0x8009172C; // type:func -AnimTaskQueue_NewTask = 0x80091754; // type:func -AnimTaskQueue_AddLoadPlayerFrame = 0x8009178C; // type:func -AnimTaskQueue_AddCopy = 0x80091888; // type:func -AnimTaskQueue_AddInterp = 0x800918F0; // type:func -AnimTaskQueue_AddCopyUsingMap = 0x80091960; // type:func -AnimTaskQueue_AddCopyUsingMapInverted = 0x800919D0; // type:func -AnimTaskQueue_AddActorMovement = 0x80091A40; // type:func -AnimTask_LoadPlayerFrame = 0x80091A9C; // type:func -AnimTask_Copy = 0x80091ACC; // type:func -AnimTask_Interp = 0x80091B3C; // type:func -AnimTask_CopyUsingMap = 0x80091B98; // type:func -AnimTask_CopyUsingMapInverted = 0x80091C18; // type:func -AnimTask_ActorMovement = 0x80091C9C; // type:func -AnimTaskQueue_Update = 0x80091D30; // type:func -SkelAnime_InitLink = 0x80091DD0; // type:func -LinkAnimation_SetUpdateFunction = 0x80091F34; // type:func -LinkAnimation_Update = 0x80091F6C; // type:func -LinkAnimation_Morph = 0x80091F90; // type:func -LinkAnimation_AnimateFrame = 0x8009204C; // type:func -LinkAnimation_Loop = 0x80092128; // type:func -LinkAnimation_Once = 0x800921C8; // type:func -Animation_SetMorph = 0x800922A4; // type:func -LinkAnimation_Change = 0x800922C8; // type:func -LinkAnimation_PlayOnce = 0x80092440; // type:func -LinkAnimation_PlayOnceSetSpeed = 0x800924A0; // type:func -LinkAnimation_PlayLoop = 0x80092504; // type:func -LinkAnimation_PlayLoopSetSpeed = 0x80092560; // type:func -LinkAnimation_CopyJointToMorph = 0x800925C0; // type:func -LinkAnimation_CopyMorphToJoint = 0x800925F0; // type:func -LinkAnimation_LoadToMorph = 0x80092620; // type:func -LinkAnimation_LoadToJoint = 0x80092664; // type:func -LinkAnimation_InterpJointMorph = 0x800926A8; // type:func -LinkAnimation_BlendToJoint = 0x800926E0; // type:func -LinkAnimation_BlendToMorph = 0x80092780; // type:func -LinkAnimation_EndLoop = 0x80092820; // type:func -Animation_OnFrameImpl = 0x80092844; // type:func -LinkAnimation_OnFrame = 0x800928FC; // type:func -SkelAnime_Init = 0x8009294C; // type:func -SkelAnime_InitFlex = 0x80092A50; // type:func -SkelAnime_InitSkin = 0x80092B5C; // type:func -SkelAnime_SetUpdate = 0x80092C3C; // type:func -SkelAnime_Update = 0x80092C88; // type:func -SkelAnime_Morph = 0x80092CAC; // type:func -SkelAnime_MorphTaper = 0x80092D6C; // type:func -SkelAnime_AnimateFrame = 0x80092EF4; // type:func -SkelAnime_LoopFull = 0x8009303C; // type:func -SkelAnime_LoopPartial = 0x800930DC; // type:func -SkelAnime_Once = 0x80093184; // type:func -Animation_ChangeImpl = 0x80093288; // type:func -Animation_Change = 0x80093444; // type:func -Animation_PlayOnce = 0x8009348C; // type:func -Animation_MorphToPlayOnce = 0x800934E4; // type:func -Animation_PlayOnceSetSpeed = 0x80093540; // type:func -Animation_PlayLoop = 0x8009359C; // type:func -Animation_MorphToLoop = 0x800935F0; // type:func -Animation_PlayLoopSetSpeed = 0x80093628; // type:func -Animation_EndLoop = 0x80093680; // type:func -Animation_Reverse = 0x800936AC; // type:func -SkelAnime_CopyFrameTableTrue = 0x800936D0; // type:func -SkelAnime_CopyFrameTableFalse = 0x80093738; // type:func -SkelAnime_UpdateTranslation = 0x800937A4; // type:func -Animation_OnFrame = 0x80093970; // type:func -SkelAnime_Free = 0x80093998; // type:func -SkelAnime_CopyFrameTable = 0x800939E4; // type:func -Skin_UpdateVertices = 0x80093A30; // type:func -Skin_ApplyLimbModifications = 0x80093BFC; // type:func -Skin_DrawAnimatedLimb = 0x80094068; // type:func -Skin_DrawLimb = 0x80094144; // type:func -Skin_DrawImpl = 0x8009426C; // type:func -func_800A6330 = 0x80094498; // type:func -func_800A6360 = 0x800944C8; // type:func -func_800A6394 = 0x800944FC; // type:func -func_800A63CC = 0x80094534; // type:func -Skin_GetLimbPos = 0x80094570; // type:func -Skin_InitAnimatedLimb = 0x800945D0; // type:func -Skin_Init = 0x800947AC; // type:func -Skin_Free = 0x8009497C; // type:func -func_800A698C = 0x80094A50; // type:func -Skin_ApplyAnimTransformations = 0x80094B8C; // type:func -SkinMatrix_Vec3fMtxFMultXYZW = 0x80094EE0; // type:func -SkinMatrix_Vec3fMtxFMultXYZ = 0x80094FC8; // type:func -SkinMatrix_MtxFMtxFMult = 0x80095078; // type:func -SkinMatrix_GetClear = 0x800953D4; // type:func -SkinMatrix_Clear = 0x800953E8; // type:func -SkinMatrix_MtxFCopy = 0x80095440; // type:func -SkinMatrix_Invert = 0x800954C8; // type:func -SkinMatrix_SetScale = 0x80095768; // type:func -SkinMatrix_SetRotateZYX = 0x800957CC; // type:func -SkinMatrix_SetRotateYXZ = 0x8009595C; // type:func -SkinMatrix_SetTranslate = 0x80095AEC; // type:func -SkinMatrix_SetTranslateRotateZYXScale = 0x80095B50; // type:func -SkinMatrix_SetTranslateRotateYXZScale = 0x80095BD4; // type:func -SkinMatrix_SetTranslateRotateZYX = 0x80095C58; // type:func -SkinMatrix_Vec3fToVec3s = 0x80095CB8; // type:func -SkinMatrix_Vec3sToVec3f = 0x80095CFC; // type:func -SkinMatrix_MtxFToMtx = 0x80095D40; // type:func -SkinMatrix_MtxFToNewMtx = 0x80095F58; // type:func -SkinMatrix_SetRotateAxis = 0x80095FA0; // type:func -func_800A8030 = 0x80096110; // type:func -Sram_ReadWriteIQue = 0x80096280; // type:func -Sram_InitNewSave = 0x800962D0; // type:func -Sram_InitDebugSave = 0x80096420; // type:func -Sram_OpenSave = 0x800965E8; // type:func -Sram_WriteSave = 0x80096934; // type:func -Sram_VerifyAndLoadAllSaves = 0x80096A78; // type:func -Sram_InitSave = 0x80096F04; // type:func -Sram_EraseSave = 0x800971CC; // type:func -Sram_CopySave = 0x800972E0; // type:func -Sram_WriteSramHeader = 0x80097504; // type:func -Sram_InitSram = 0x80097530; // type:func -Sram_Alloc = 0x800975F4; // type:func -Sram_Init = 0x80097624; // type:func -SsSram_Init = 0x80097630; // type:func -SsSram_Dma = 0x80097708; // type:func -SsSram_ReadWrite = 0x80097794; // type:func -Rumble_Update = 0x80097800; // type:func -Rumble_Override = 0x8009783C; // type:func -Rumble_Request = 0x800978D8; // type:func -Rumble_Init = 0x80097994; // type:func -Rumble_Destroy = 0x800979D0; // type:func -Rumble_Controller1HasRumblePak = 0x80097A28; // type:func -Rumble_Reset = 0x80097A40; // type:func -Rumble_ClearRequests = 0x80097A54; // type:func -Rumble_SetUpdateEnabled = 0x80097A64; // type:func -View_ViewportToVp = 0x80097A80; // type:func -View_New = 0x80097AEC; // type:func -View_Free = 0x80097B38; // type:func -View_Init = 0x80097B58; // type:func -View_LookAt = 0x80097C18; // type:func -View_LookAtUnsafe = 0x80097CB4; // type:func -View_SetScale = 0x80097D04; // type:func -View_GetScale = 0x80097D24; // type:func -View_SetPerspective = 0x80097D34; // type:func -View_GetPerspective = 0x80097D64; // type:func -View_SetOrtho = 0x80097D84; // type:func -View_GetOrtho = 0x80097DC0; // type:func -View_SetViewport = 0x80097DE0; // type:func -View_GetViewport = 0x80097E14; // type:func -View_ApplyLetterbox = 0x80097E3C; // type:func -View_SetDistortionOrientation = 0x80097F7C; // type:func -View_SetDistortionScale = 0x80097FA0; // type:func -View_SetDistortionSpeed = 0x80097FC4; // type:func -View_InitDistortion = 0x80097FD8; // type:func -View_ClearDistortion = 0x8009803C; // type:func -View_SetDistortion = 0x80098070; // type:func -View_StepDistortion = 0x800980C4; // type:func -View_Apply = 0x8009827C; // type:func -View_ApplyPerspective = 0x800982C8; // type:func -View_ApplyOrtho = 0x800985BC; // type:func -View_ApplyOrthoToOverlay = 0x80098768; // type:func -View_ApplyPerspectiveToOverlay = 0x8009899C; // type:func -View_UpdateViewingMatrix = 0x80098CEC; // type:func -View_ApplyTo = 0x80098D58; // type:func -ViMode_LogPrint = 0x80099180; // type:func -ViMode_Configure = 0x8009918C; // type:func -ViMode_Save = 0x80099734; // type:func -ViMode_Load = 0x80099814; // type:func -ViMode_Init = 0x8009989C; // type:func -ViMode_Destroy = 0x80099904; // type:func -ViMode_ConfigureFeatures = 0x80099910; // type:func -ViMode_Update = 0x80099974; // type:func -VisCvg_Init = 0x80099CF0; // type:func -VisCvg_Destroy = 0x80099D14; // type:func -VisCvg_Draw = 0x80099D20; // type:func -VisMono_Init = 0x80099E90; // type:func -VisMono_Destroy = 0x80099EE0; // type:func -VisMono_DesaturateTLUT = 0x80099F04; // type:func -VisMono_DesaturateDList = 0x8009A218; // type:func -VisMono_Draw = 0x8009A448; // type:func -VisMono_DrawOld = 0x8009A63C; // type:func -VisZBuf_Init = 0x8009A6B0; // type:func -VisZBuf_Destroy = 0x8009A6E4; // type:func -VisZBuf_Draw = 0x8009A6F0; // type:func -Skybox_CalculateFace256 = 0x8009A940; // type:func -Skybox_CalculateFace128 = 0x8009B050; // type:func -Skybox_Calculate256 = 0x8009BD58; // type:func -Skybox_Calculate128 = 0x8009BF08; // type:func -Skybox_Setup = 0x8009BFA8; // type:func -Skybox_Init = 0x8009D0FC; // type:func -Skybox_UpdateMatrix = 0x8009D210; // type:func -Skybox_Draw = 0x8009D298; // type:func -Skybox_Update = 0x8009D8E0; // type:func -PlayerCall_InitFuncPtrs = 0x8009D8F0; // type:func -PlayerCall_Init = 0x8009D958; // type:func -PlayerCall_Destroy = 0x8009D9A0; // type:func -PlayerCall_Update = 0x8009D9E0; // type:func -PlayerCall_Draw = 0x8009DA20; // type:func -TransitionTile_InitGraphics = 0x8009DA60; // type:func -TransitionTile_InitVtxData = 0x8009DE2C; // type:func -TransitionTile_Destroy = 0x8009DEEC; // type:func -TransitionTile_Init = 0x8009DF78; // type:func -TransitionTile_SetVtx = 0x8009E0F0; // type:func -TransitionTile_Draw = 0x8009E204; // type:func -TransitionTile_Suck = 0x8009E330; // type:func -TransitionTile_Update = 0x8009E464; // type:func -func_800B23F0 = 0x8009E470; // type:func -TransitionTriforce_Start = 0x8009E480; // type:func -TransitionTriforce_Init = 0x8009E4B8; // type:func -TransitionTriforce_Destroy = 0x8009E558; // type:func -TransitionTriforce_Update = 0x8009E564; // type:func -TransitionTriforce_SetColor = 0x8009E678; // type:func -TransitionTriforce_SetType = 0x8009E684; // type:func -TransitionTriforce_SetState = 0x8009E690; // type:func -TransitionTriforce_Draw = 0x8009E69C; // type:func -TransitionTriforce_IsDone = 0x8009E9AC; // type:func -TransitionWipe_Start = 0x8009EA40; // type:func -TransitionWipe_Init = 0x8009EAF8; // type:func -TransitionWipe_Destroy = 0x8009EB24; // type:func -TransitionWipe_Update = 0x8009EB30; // type:func -TransitionWipe_Draw = 0x8009EC10; // type:func -TransitionWipe_IsDone = 0x8009EE4C; // type:func -TransitionWipe_SetType = 0x8009EE58; // type:func -TransitionWipe_SetColor = 0x8009EE98; // type:func -TransitionWipe_SetUnkColor = 0x8009EEA4; // type:func -TransitionCircle_Start = 0x8009EEB0; // type:func -TransitionCircle_Init = 0x8009F09C; // type:func -TransitionCircle_Destroy = 0x8009F0C8; // type:func -TransitionCircle_Update = 0x8009F0D4; // type:func -TransitionCircle_Draw = 0x8009F258; // type:func -TransitionCircle_IsDone = 0x8009F4F4; // type:func -TransitionCircle_SetType = 0x8009F500; // type:func -TransitionCircle_SetColor = 0x8009F558; // type:func -TransitionCircle_SetUnkColor = 0x8009F564; // type:func -TransitionFade_Start = 0x8009F570; // type:func -TransitionFade_Init = 0x8009F5CC; // type:func -TransitionFade_Destroy = 0x8009F5F8; // type:func -TransitionFade_Update = 0x8009F604; // type:func -TransitionFade_Draw = 0x8009F794; // type:func -TransitionFade_IsDone = 0x8009F860; // type:func -TransitionFade_SetColor = 0x8009F86C; // type:func -TransitionFade_SetType = 0x8009F878; // type:func -Letterbox_SetSizeTarget = 0x8009F8D0; // type:func -Letterbox_GetSizeTarget = 0x8009F8E0; // type:func -Letterbox_SetSize = 0x8009F8F0; // type:func -Letterbox_GetSize = 0x8009F900; // type:func -Letterbox_Init = 0x8009F910; // type:func -Letterbox_Destroy = 0x8009F930; // type:func -Letterbox_Update = 0x8009F940; // type:func -func_800BB0A0 = 0x8009FA40; // type:func -func_800BB2B4 = 0x8009FC54; // type:func -KaleidoManager_LoadOvl = 0x8009FF10; // type:func -KaleidoManager_ClearOvl = 0x8009FF6C; // type:func -KaleidoManager_Init = 0x8009FFBC; // type:func -KaleidoManager_Destroy = 0x800A002C; // type:func -KaleidoManager_GetRamAddr = 0x800A006C; // type:func -KaleidoScopeCall_LoadPlayer = 0x800A0140; // type:func -KaleidoScopeCall_Init = 0x800A018C; // type:func -KaleidoScopeCall_Destroy = 0x800A01D8; // type:func -KaleidoScopeCall_Update = 0x800A01F8; // type:func -KaleidoScopeCall_Draw = 0x800A0398; // type:func -Play_RequestViewpointBgCam = 0x800A0420; // type:func -Play_SetViewpoint = 0x800A0460; // type:func -Play_CheckViewpoint = 0x800A050C; // type:func -Play_SetShopBrowsingViewpoint = 0x800A0534; // type:func -Play_SetupTransition = 0x800A0560; // type:func -func_800BC88C = 0x800A080C; // type:func -Play_SetFog = 0x800A0824; // type:func -Play_Destroy = 0x800A0870; // type:func -Play_Init = 0x800A09DC; // type:func -Play_Update = 0x800A1158; // type:func -Play_DrawOverlayElements = 0x800A224C; // type:func -Play_Draw = 0x800A22E4; // type:func -Play_Main = 0x800A2D28; // type:func -Play_InCsMode = 0x800A2D68; // type:func -func_800BFCB8 = 0x800A2D9C; // type:func -Play_LoadFile = 0x800A2F48; // type:func -Play_InitEnvironment = 0x800A2FA4; // type:func -Play_InitScene = 0x800A2FEC; // type:func -Play_SpawnScene = 0x800A30F0; // type:func -Play_GetScreenPos = 0x800A3198; // type:func -Play_CreateSubCamera = 0x800A325C; // type:func -Play_GetActiveCamId = 0x800A330C; // type:func -Play_ChangeCameraStatus = 0x800A3318; // type:func -Play_ClearCamera = 0x800A3388; // type:func -Play_ClearAllSubCameras = 0x800A33F0; // type:func -Play_GetCamera = 0x800A345C; // type:func -Play_SetCameraAtEye = 0x800A3494; // type:func -Play_SetCameraAtEyeUp = 0x800A35A4; // type:func -Play_SetCameraFov = 0x800A36C8; // type:func -Play_SetCameraRoll = 0x800A3710; // type:func -Play_CopyCamera = 0x800A375C; // type:func -Play_InitCameraDataUsingPlayer = 0x800A37D8; // type:func -Play_RequestCameraSetting = 0x800A3848; // type:func -Play_ReturnToMainCam = 0x800A3884; // type:func -Play_GetCameraUID = 0x800A3960; // type:func -func_800C09D8 = 0x800A3994; // type:func -Play_SaveSceneFlags = 0x800A3A00; // type:func -Play_SetRespawnData = 0x800A3A48; // type:func -Play_SetupRespawnPoint = 0x800A3AB8; // type:func -Play_TriggerVoidOut = 0x800A3B24; // type:func -Play_LoadToLastEntrance = 0x800A3B7C; // type:func -Play_TriggerRespawn = 0x800A3C50; // type:func -Play_CamIsNotFixed = 0x800A3C84; // type:func -FrameAdvance_IsEnabled = 0x800A3CF4; // type:func -func_800C0D34 = 0x800A3D04; // type:func -func_800C0DB4 = 0x800A3D84; // type:func -PreRender_SetValuesSave = 0x800A3E40; // type:func -PreRender_Init = 0x800A3E7C; // type:func -PreRender_SetValues = 0x800A3EB0; // type:func -PreRender_Destroy = 0x800A3EE4; // type:func -PreRender_CopyImage = 0x800A3F08; // type:func -PreRender_CopyImageRegionImpl = 0x800A41D0; // type:func -func_800C170C = 0x800A4618; // type:func -func_800C1AE8 = 0x800A4994; // type:func -PreRender_CoverageRgba16ToI8 = 0x800A49D0; // type:func -PreRender_SaveZBuffer = 0x800A4CE8; // type:func -PreRender_SaveFramebuffer = 0x800A4D20; // type:func -PreRender_FetchFbufCoverage = 0x800A4D58; // type:func -PreRender_DrawCoverage = 0x800A4E70; // type:func -PreRender_RestoreZBuffer = 0x800A4EB4; // type:func -func_800C213C = 0x800A4ED8; // type:func -PreRender_RestoreFramebuffer = 0x800A5208; // type:func -PreRender_CopyImageRegion = 0x800A522C; // type:func -PreRender_AntiAliasFilter = 0x800A524C; // type:func -PreRender_DivotFilter = 0x800A5D0C; // type:func -PreRender_ApplyFilters = 0x800A5E60; // type:func -THGA_Init = 0x800A5F30; // type:func -THGA_Destroy = 0x800A5F50; // type:func -THGA_IsCrash = 0x800A5F70; // type:func -THGA_Reset = 0x800A5F90; // type:func -THGA_GetRemaining = 0x800A5FB0; // type:func -THGA_GetHead = 0x800A5FD0; // type:func -THGA_SetHead = 0x800A5FF0; // type:func -THGA_GetTail = 0x800A6010; // type:func -THGA_AllocDisplayList = 0x800A6030; // type:func -THGA_AllocGfx = 0x800A6054; // type:func -THGA_AllocGfx2 = 0x800A6074; // type:func -THGA_AllocTail = 0x800A6094; // type:func -THGA_AllocMtxArray = 0x800A60B4; // type:func -THGA_AllocMtx = 0x800A60D8; // type:func -THGA_AllocVtxArray = 0x800A60F8; // type:func -THGA_AllocVtx = 0x800A611C; // type:func -THA_GetHead = 0x800A6140; // type:func -THA_SetHead = 0x800A614C; // type:func -THA_GetTail = 0x800A6158; // type:func -THA_AllocHead = 0x800A6164; // type:func -THA_AllocHeadByte = 0x800A6178; // type:func -THA_AllocTail = 0x800A6198; // type:func -THA_AllocTailAlign16 = 0x800A6228; // type:func -THA_AllocTailAlign = 0x800A6248; // type:func -THA_GetRemaining = 0x800A6264; // type:func -THA_IsCrash = 0x800A6278; // type:func -THA_Reset = 0x800A629C; // type:func -THA_Init = 0x800A62B8; // type:func -THA_Destroy = 0x800A62DC; // type:func -AudioMgr_StopAllSfx = 0x800A6300; // type:func -AudioMgr_NotifyTaskDone = 0x800A6350; // type:func -AudioMgr_HandleRetrace = 0x800A6388; // type:func -AudioMgr_HandlePreNMI = 0x800A6510; // type:func -AudioMgr_ThreadEntry = 0x800A6534; // type:func -AudioMgr_WaitForInit = 0x800A6664; // type:func -AudioMgr_Init = 0x800A6690; // type:func -Setup_InitImpl = 0x800A6760; // type:func -Setup_Destroy = 0x800A679C; // type:func -Setup_Init = 0x800A67A8; // type:func -GameState_SetFBFilter = 0x800A67D0; // type:func -func_800C4344 = 0x800A6924; // type:func -GameState_Draw = 0x800A6930; // type:func -GameState_SetFrameBuffer = 0x800A6A28; // type:func -func_800C49F4 = 0x800A6B0C; // type:func -GameState_ReqPadData = 0x800A6B84; // type:func -GameState_Update = 0x800A6BB4; // type:func -GameState_InitArena = 0x800A6C30; // type:func -GameState_Realloc = 0x800A6CA0; // type:func -GameState_Init = 0x800A6D60; // type:func -GameState_Destroy = 0x800A6E58; // type:func -GameState_GetInit = 0x800A6F08; // type:func -GameState_GetSize = 0x800A6F14; // type:func -GameState_IsRunning = 0x800A6F20; // type:func -GameState_GetArenaSize = 0x800A6F2C; // type:func -GameAlloc_Log = 0x800A6F50; // type:func -GameAlloc_Malloc = 0x800A6F70; // type:func -GameAlloc_Free = 0x800A6FDC; // type:func -GameAlloc_Cleanup = 0x800A7028; // type:func -GameAlloc_Init = 0x800A7078; // type:func -Graph_InitTHGA = 0x800A7090; // type:func -Graph_GetNextGameState = 0x800A71A8; // type:func -Graph_Init = 0x800A7258; // type:func -Graph_Destroy = 0x800A72C8; // type:func -Graph_TaskSet00 = 0x800A72D4; // type:func -Graph_Update = 0x800A7618; // type:func -Graph_ThreadEntry = 0x800A78CC; // type:func -Graph_Alloc = 0x800A79C4; // type:func -Graph_Alloc2 = 0x800A79F8; // type:func -Gfx_Open = 0x800A7A30; // type:func -Gfx_Close = 0x800A7A3C; // type:func -Gfx_Alloc = 0x800A7A54; // type:func -ListAlloc_Init = 0x800A7A90; // type:func -ListAlloc_Alloc = 0x800A7AA4; // type:func -ListAlloc_Free = 0x800A7B10; // type:func -ListAlloc_FreeAll = 0x800A7B90; // type:func -Main = 0x800A7BE0; // type:func -PadMgr_AcquireSerialEventQueue = 0x800A7F40; // type:func -PadMgr_ReleaseSerialEventQueue = 0x800A7F70; // type:func -PadMgr_LockPadData = 0x800A7F98; // type:func -PadMgr_UnlockPadData = 0x800A7FC4; // type:func -PadMgr_UpdateRumble = 0x800A7FF0; // type:func -PadMgr_RumbleStop = 0x800A8240; // type:func -PadMgr_RumbleReset = 0x800A82D8; // type:func -PadMgr_RumbleSetSingle = 0x800A82E8; // type:func -PadMgr_RumbleSet = 0x800A8300; // type:func -PadMgr_UpdateInputs = 0x800A8330; // type:func -PadMgr_HandleRetrace = 0x800A8510; // type:func -PadMgr_HandlePreNMI = 0x800A86A8; // type:func -PadMgr_RequestPadData = 0x800A86CC; // type:func -PadMgr_ThreadEntry = 0x800A8848; // type:func -PadMgr_Init = 0x800A8944; // type:func -Sched_SwapFrameBufferImpl = 0x800A8A40; // type:func -Sched_SwapFrameBuffer = 0x800A8AB0; // type:func -Sched_HandlePreNMI = 0x800A8B00; // type:func -Sched_HandleNMI = 0x800A8B0C; // type:func -Sched_QueueTask = 0x800A8B30; // type:func -Sched_Yield = 0x800A8B9C; // type:func -Sched_GfxTaskFramebufferValid = 0x800A8BD0; // type:func -Sched_Schedule = 0x800A8C94; // type:func -Sched_SetNextFramebufferFromTask = 0x800A8DC8; // type:func -Sched_TaskComplete = 0x800A8E14; // type:func -Sched_RunTask = 0x800A8E8C; // type:func -Sched_HandleNotification = 0x800A8FF0; // type:func -Sched_HandleRetrace = 0x800A90E0; // type:func -Sched_HandleRSPDone = 0x800A91B8; // type:func -Sched_HandleRDPDone = 0x800A93CC; // type:func -Sched_Notify = 0x800A9494; // type:func -Sched_ThreadEntry = 0x800A94B8; // type:func -Sched_Init = 0x800A95EC; // type:func -SpeedMeter_InitImpl = 0x800A96C0; // type:func -SpeedMeter_Init = 0x800A96D0; // type:func -SpeedMeter_Destroy = 0x800A96F4; // type:func -SpeedMeter_DrawTimeEntries = 0x800A9700; // type:func -SpeedMeter_InitAllocEntry = 0x800A9BC4; // type:func -SpeedMeter_DrawAllocEntry = 0x800A9C08; // type:func -SpeedMeter_DrawAllocEntries = 0x800A9E5C; // type:func -SysCfb_Init = 0x800AA100; // type:func -SysCfb_Reset = 0x800AA1C8; // type:func -SysCfb_GetFbPtr = 0x800AA1E8; // type:func -SysCfb_GetFbEnd = 0x800AA210; // type:func -Math_FactorialF = 0x800AA220; // type:func -Math_Factorial = 0x800AA320; // type:func -Math_PowF = 0x800AA3E4; // type:func -Math_SinF = 0x800AA40C; // type:func -Math_CosF = 0x800AA460; // type:func -Math3D_PlaneVsLineSegClosestPoint = 0x800AA4C0; // type:func -Math3D_LineVsLineClosestTwoPoints = 0x800AA5E0; // type:func -Math3D_LineClosestToPoint = 0x800AA88C; // type:func -Math3D_FindPointOnPlaneIntersect = 0x800AA978; // type:func -Math3D_PlaneVsPlaneNewLine = 0x800AA9D8; // type:func -Math3D_PlaneVsPlaneVsLineClosestPoint = 0x800AABB8; // type:func -Math3D_PointOnInfiniteLine = 0x800AAC34; // type:func -Math3D_LineSplitRatio = 0x800AAC80; // type:func -Math3D_Cos = 0x800AACCC; // type:func -Math3D_CosOut = 0x800AACF0; // type:func -Math3D_Vec3fReflect = 0x800AADA8; // type:func -Math3D_PointInSquare2D = 0x800AAE7C; // type:func -Math3D_CirSquareVsTriSquare = 0x800AAEE0; // type:func -Math3D_SphCubeVsTriCube = 0x800AB020; // type:func -Math3D_Dist1DSq = 0x800AB244; // type:func -Math3D_Dist1D = 0x800AB25C; // type:func -Math3D_Dist2DSq = 0x800AB280; // type:func -Math3D_Dist2D = 0x800AB2C4; // type:func -Math3D_Vec3fMagnitudeSq = 0x800AB2F4; // type:func -Math3D_Vec3fMagnitude = 0x800AB320; // type:func -Math3D_Vec3fDistSq = 0x800AB348; // type:func -Math3D_Vec3f_DistXYZ = 0x800AB370; // type:func -Math3D_DistXYZ16toF = 0x800AB390; // type:func -Math3D_Vec3fDiff_CrossZ = 0x800AB408; // type:func -Math3D_Vec3fDiff_CrossX = 0x800AB448; // type:func -Math3D_Vec3fDiff_CrossY = 0x800AB488; // type:func -Math3D_Vec3f_Cross = 0x800AB4C8; // type:func -Math3D_SurfaceNorm = 0x800AB53C; // type:func -Math3D_PointRelativeToCubeFaces = 0x800AB5A4; // type:func -Math3D_PointRelativeToCubeEdges = 0x800AB650; // type:func -Math3D_PointRelativeToCubeVertices = 0x800AB800; // type:func -Math3D_LineVsCube = 0x800AB97C; // type:func -Math3D_LineVsCubeShort = 0x800AC3F4; // type:func -Math3D_RotateXZPlane = 0x800AC560; // type:func -Math3D_DefPlane = 0x800AC5EC; // type:func -Math3D_Planef = 0x800AC700; // type:func -Math3D_Plane = 0x800AC740; // type:func -Math3D_UDistPlaneToPos = 0x800AC77C; // type:func -Math3D_DistPlaneToPos = 0x800AC7B4; // type:func -Math3D_TriChkPointParaYImpl = 0x800AC838; // type:func -Math3D_TriChkPointParaYDeterminate = 0x800ACB54; // type:func -Math3D_TriChkPointParaYSlopedY = 0x800ACB9C; // type:func -Math3D_TriChkPointParaYIntersectDist = 0x800ACBEC; // type:func -Math3D_TriChkPointParaYIntersectInsideTri = 0x800ACC9C; // type:func -Math3D_TriChkPointParaY = 0x800ACD48; // type:func -Math3D_TriChkLineSegParaYIntersect = 0x800ACDC4; // type:func -Math3D_TriChkPointParaYDist = 0x800ACF38; // type:func -Math3D_TriChkPointParaXImpl = 0x800ACFAC; // type:func -Math3D_TriChkPointParaXDeterminate = 0x800AD2C8; // type:func -Math3D_TriChkPointParaXIntersect = 0x800AD310; // type:func -Math3D_TriChkPointParaX = 0x800AD3C4; // type:func -Math3D_TriChkLineSegParaXIntersect = 0x800AD440; // type:func -Math3D_TriChkPointParaXDist = 0x800AD5C8; // type:func -Math3D_TriChkPointParaZImpl = 0x800AD63C; // type:func -Math3D_TriChkPointParaZDeterminate = 0x800AD984; // type:func -Math3D_TriChkPointParaZIntersect = 0x800AD9CC; // type:func -Math3D_TriChkPointParaZ = 0x800ADA80; // type:func -Math3D_TriChkLineSegParaZIntersect = 0x800ADAFC; // type:func -Math3D_TriChkLineSegParaZDist = 0x800ADC88; // type:func -Math3D_LineSegFindPlaneIntersect = 0x800ADCFC; // type:func -Math3D_LineSegVsPlane = 0x800ADDD8; // type:func -Math3D_TriLineIntersect = 0x800ADEE0; // type:func -Math3D_TriNorm = 0x800AE044; // type:func -Math3D_PointInSph = 0x800AE0F4; // type:func -Math3D_PointDistSqToLine2D = 0x800AE144; // type:func -Math3D_LineVsSph = 0x800AE28C; // type:func -Math3D_GetSphVsTriIntersectPoint = 0x800AE494; // type:func -Math3D_TriVsSphIntersect = 0x800AE5D4; // type:func -Math3D_PointInCyl = 0x800AE9F4; // type:func -Math3D_CylVsLineSeg = 0x800AEAB0; // type:func -Math3D_CylTriVsIntersect = 0x800AF478; // type:func -Math3D_CylVsTri = 0x800AF8F8; // type:func -Math3D_SphVsSph = 0x800AF918; // type:func -Math3D_SphVsSphOverlap = 0x800AF938; // type:func -Math3D_SphVsSphOverlapCenterDist = 0x800AF958; // type:func -Math3D_SphVsCylOverlap = 0x800AFA30; // type:func -Math3D_SphVsCylOverlapCenterDist = 0x800AFA50; // type:func -Math3D_CylVsCylOverlap = 0x800AFBC0; // type:func -Math3D_CylVsCylOverlapCenterDist = 0x800AFBE0; // type:func -Math3D_TriVsTriIntersect = 0x800AFDB0; // type:func -Math3D_XZInSphere = 0x800B0130; // type:func -Math3D_XYInSphere = 0x800B01A4; // type:func -Math3D_YZInSphere = 0x800B0218; // type:func -Math_GetAtan2Tbl = 0x800B0290; // type:func -Math_Atan2S = 0x800B0308; // type:func -Math_Atan2F = 0x800B0480; // type:func -Matrix_Init = 0x800B04C0; // type:func -Matrix_Push = 0x800B04FC; // type:func -Matrix_Pop = 0x800B0534; // type:func -Matrix_Get = 0x800B0550; // type:func -Matrix_Put = 0x800B0574; // type:func -Matrix_GetCurrent = 0x800B059C; // type:func -Matrix_Mult = 0x800B05AC; // type:func -Matrix_Translate = 0x800B0604; // type:func -Matrix_Scale = 0x800B070C; // type:func -Matrix_RotateX = 0x800B07F0; // type:func -Matrix_RotateY = 0x800B09A4; // type:func -Matrix_RotateZ = 0x800B0B5C; // type:func -Matrix_RotateZYX = 0x800B0D10; // type:func -Matrix_TranslateRotateZYX = 0x800B0FCC; // type:func -Matrix_SetTranslateRotateYXZ = 0x800B1320; // type:func -Matrix_MtxFToMtx = 0x800B14CC; // type:func -Matrix_ToMtx = 0x800B16E8; // type:func -Matrix_Finalize = 0x800B1710; // type:func -Matrix_MtxFToNewMtx = 0x800B173C; // type:func -Matrix_MultVec3f = 0x800B1768; // type:func -Matrix_MtxFCopy = 0x800B1820; // type:func -Matrix_MtxToMtxF = 0x800B1928; // type:func -Matrix_MultVec3fExt = 0x800B1B7C; // type:func -Matrix_Transpose = 0x800B1C2C; // type:func -Matrix_ReplaceRotation = 0x800B1C64; // type:func -Matrix_MtxFToYXZRotS = 0x800B1D60; // type:func -Matrix_MtxFToZYXRotS = 0x800B1EF8; // type:func -Matrix_RotateAxis = 0x800B2090; // type:func -Matrix_SetTranslateUniformScaleMtxF = 0x800B24F8; // type:func -Matrix_SetTranslateUniformScaleMtx = 0x800B2560; // type:func -Matrix_SetTranslateUniformScaleMtx2 = 0x800B25B0; // type:func -Matrix_SetTranslateScaleMtx1 = 0x800B26A0; // type:func -Matrix_SetTranslateScaleMtx2 = 0x800B27C0; // type:func -SysUcode_GetUCodeBoot = 0x800B28C0; // type:func -SysUcode_GetUCodeBootSize = 0x800B28D0; // type:func -SysUcode_GetUCode = 0x800B28EC; // type:func -SysUcode_GetUCodeData = 0x800B28FC; // type:func -RumbleMgr_Update = 0x800B2910; // type:func -RumbleMgr_Init = 0x800B2C20; // type:func -RumbleMgr_Destroy = 0x800B2C58; // type:func -func_800D31A0 = 0x800B2C70; // type:func -IrqMgr_AddClient = 0x800B2CA0; // type:func -IrqMgr_RemoveClient = 0x800B2D2C; // type:func -IrqMgr_SendMesgToClients = 0x800B2DB8; // type:func -IrqMgr_JamMesgToClients = 0x800B2E1C; // type:func -IrqMgr_HandlePreNMI = 0x800B2E80; // type:func -IrqMgr_CheckStacks = 0x800B2F18; // type:func -IrqMgr_HandlePreNMI450 = 0x800B2F38; // type:func -IrqMgr_HandlePreNMI480 = 0x800B2FB4; // type:func -IrqMgr_HandlePreNMI500 = 0x800B3048; // type:func -IrqMgr_HandleRetrace = 0x800B306C; // type:func -IrqMgr_ThreadEntry = 0x800B3124; // type:func -IrqMgr_Init = 0x800B31F8; // type:func -Fault_SleepImpl = 0x800B32C0; // type:func -Fault_ClientProcessThread = 0x800B3330; // type:func -Fault_ClientRunTask = 0x800B33A4; // type:func -Fault_ProcessClient = 0x800B3528; // type:func -Fault_AddClient = 0x800B357C; // type:func -Fault_RemoveClient = 0x800B3660; // type:func -Fault_AddAddrConvClient = 0x800B3758; // type:func -Fault_RemoveAddrConvClient = 0x800B3830; // type:func -Fault_ConvertAddress = 0x800B3928; // type:func -Fault_Sleep = 0x800B39DC; // type:func -Fault_PadCallback = 0x800B3A18; // type:func -Fault_UpdatePadImpl = 0x800B3A54; // type:func -Fault_WaitForInputImpl = 0x800B3AA0; // type:func -Fault_WaitForInput = 0x800B3BEC; // type:func -Fault_DrawRec = 0x800B3C38; // type:func -Fault_FillScreenBlack = 0x800B3C98; // type:func -Fault_FillScreenRed = 0x800B3CEC; // type:func -Fault_DrawCornerRec = 0x800B3D40; // type:func -Fault_PrintFReg = 0x800B3D94; // type:func -Fault_LogFReg = 0x800B3E40; // type:func -Fault_PrintFPCSR = 0x800B3EF0; // type:func -Fault_LogFPCSR = 0x800B3F94; // type:func -Fault_PrintThreadContext = 0x800B402C; // type:func -Fault_LogThreadContext = 0x800B4348; // type:func -Fault_FindFaultedThread = 0x800B4644; // type:func -Fault_Wait5Seconds = 0x800B46CC; // type:func -Fault_WaitForButtonCombo = 0x800B475C; // type:func -Fault_DrawMemDumpContents = 0x800B4A28; // type:func -Fault_DrawMemDump = 0x800B4B94; // type:func -Fault_WalkStack = 0x800B4D98; // type:func -Fault_DrawStackTrace = 0x800B4F28; // type:func -Fault_LogStackTrace = 0x800B50A8; // type:func -Fault_ResumeThread = 0x800B5218; // type:func -Fault_DisplayFrameBuffer = 0x800B5294; // type:func -Fault_ProcessClients = 0x800B5354; // type:func -Fault_UpdatePad = 0x800B5434; // type:func -Fault_ThreadEntry = 0x800B5470; // type:func -Fault_SetFrameBuffer = 0x800B57D0; // type:func -Fault_Init = 0x800B5824; // type:func -Fault_HungupFaultClient = 0x800B5958; // type:func -Fault_AddHungupAndCrashImpl = 0x800B5A54; // type:func -Fault_AddHungupAndCrash = 0x800B5AAC; // type:func -Fault_SetOsSyncPrintfEnabled = 0x800B5B10; // type:func -Fault_DrawRecImpl = 0x800B5B20; // type:func -Fault_DrawChar = 0x800B5C3C; // type:func -Fault_ColorToPrintColor = 0x800B5DAC; // type:func -Fault_UpdatePrintColor = 0x800B5E5C; // type:func -Fault_SetForeColor = 0x800B5EFC; // type:func -Fault_SetBackColor = 0x800B5F44; // type:func -Fault_SetFontColor = 0x800B5F8C; // type:func -Fault_SetCharPad = 0x800B5FD4; // type:func -Fault_SetCursor = 0x800B6004; // type:func -Fault_FillScreen = 0x800B60FC; // type:func -Fault_PrintCallback = 0x800B618C; // type:func -Fault_VPrintf = 0x800B6398; // type:func -Fault_Printf = 0x800B63E8; // type:func -Fault_DrawText = 0x800B6438; // type:func -Fault_SetDrawerFB = 0x800B6488; // type:func -Fault_SetInputCallback = 0x800B64B4; // type:func -Fault_WritebackFBDCache = 0x800B64C4; // type:func -Fault_InitDrawer = 0x800B6520; // type:func -Kanji_OffsetFromShiftJIS = 0x800B6590; // type:func -AudioSynth_InitNextRingBuf = 0x800B7080; // type:func -func_800DB03C = 0x800B73FC; // type:func -AudioSynth_Update = 0x800B7484; // type:func -func_800DB2C0 = 0x800B7680; // type:func -AudioSynth_LoadRingBuffer1AtTemp = 0x800B76F0; // type:func -AudioSynth_SaveRingBuffer1AtTemp = 0x800B7798; // type:func -AudioSynth_LeakReverb = 0x800B7840; // type:func -func_800DB4E4 = 0x800B78A4; // type:func -func_800DB680 = 0x800B7A40; // type:func -func_800DB828 = 0x800B7BE8; // type:func -AudioSynth_FilterReverb = 0x800B7E00; // type:func -AudioSynth_MaybeMixRingBuffer1 = 0x800B7EA8; // type:func -func_800DBB94 = 0x800B7F54; // type:func -AudioSynth_ClearBuffer = 0x800B7F5C; // type:func -func_800DBBBC = 0x800B7F7C; // type:func -func_800DBBC4 = 0x800B7F84; // type:func -func_800DBBCC = 0x800B7F8C; // type:func -AudioSynth_Mix = 0x800B7F94; // type:func -func_800DBC08 = 0x800B7FC8; // type:func -func_800DBC10 = 0x800B7FD0; // type:func -func_800DBC18 = 0x800B7FD8; // type:func -AudioSynth_SetBuffer = 0x800B7FE0; // type:func -func_800DBC54 = 0x800B8014; // type:func -func_800DBC5C = 0x800B801C; // type:func -AudioSynth_DMemMove = 0x800B8024; // type:func -func_800DBC90 = 0x800B8050; // type:func -func_800DBC98 = 0x800B8058; // type:func -func_800DBCA0 = 0x800B8060; // type:func -func_800DBCA8 = 0x800B8068; // type:func -AudioSynth_InterL = 0x800B8070; // type:func -AudioSynth_EnvSetup1 = 0x800B8094; // type:func -func_800DBD08 = 0x800B80C8; // type:func -AudioSynth_LoadBuffer = 0x800B80D0; // type:func -AudioSynth_SaveBuffer = 0x800B80F8; // type:func -AudioSynth_EnvSetup2 = 0x800B8120; // type:func -func_800DBD7C = 0x800B813C; // type:func -func_800DBD84 = 0x800B8144; // type:func -func_800DBD8C = 0x800B814C; // type:func -AudioSynth_S8Dec = 0x800B8154; // type:func -AudioSynth_HiLoGain = 0x800B8170; // type:func -AudioSynth_UnkCmd19 = 0x800B81A4; // type:func -func_800DBE18 = 0x800B81D8; // type:func -func_800DBE20 = 0x800B81E0; // type:func -func_800DBE28 = 0x800B81E8; // type:func -func_800DBE30 = 0x800B81F0; // type:func -AudioSynth_UnkCmd3 = 0x800B81F8; // type:func -func_800DBE5C = 0x800B821C; // type:func -func_800DBE64 = 0x800B8224; // type:func -func_800DBE6C = 0x800B822C; // type:func -AudioSynth_LoadFilterBuffer = 0x800B8234; // type:func -AudioSynth_LoadFilterSize = 0x800B8258; // type:func -AudioSynth_LoadRingBuffer1 = 0x800B8270; // type:func -AudioSynth_LoadRingBuffer2 = 0x800B831C; // type:func -AudioSynth_LoadRingBufferPart = 0x800B83C8; // type:func -AudioSynth_SaveRingBufferPart = 0x800B8434; // type:func -AudioSynth_SaveBufferOffset = 0x800B84A0; // type:func -AudioSynth_MaybeLoadRingBuffer2 = 0x800B84E4; // type:func -AudioSynth_LoadReverbSamples = 0x800B8524; // type:func -AudioSynth_SaveReverbSamples = 0x800B8598; // type:func -AudioSynth_SaveRingBuffer2 = 0x800B869C; // type:func -AudioSynth_DoOneAudioUpdate = 0x800B8744; // type:func -AudioSynth_ProcessNote = 0x800B8CD0; // type:func -AudioSynth_FinalResample = 0x800B99EC; // type:func -AudioSynth_ProcessEnvelope = 0x800B9A8C; // type:func -AudioSynth_LoadWaveSamples = 0x800B9DB4; // type:func -AudioSynth_ApplyHaasEffect = 0x800B9F24; // type:func -AudioHeap_CalculateAdsrDecay = 0x800BA1E0; // type:func -AudioHeap_InitAdsrDecayTable = 0x800BA1FC; // type:func -AudioHeap_ResetLoadStatus = 0x800BA340; // type:func -AudioHeap_DiscardFont = 0x800BA408; // type:func -AudioHeap_ReleaseNotesForFont = 0x800BA4EC; // type:func -AudioHeap_DiscardSequence = 0x800BA574; // type:func -AudioHeap_WritebackDCache = 0x800BA5F8; // type:func -AudioHeap_AllocZeroedAttemptExternal = 0x800BA618; // type:func -AudioHeap_AllocAttemptExternal = 0x800BA670; // type:func -AudioHeap_AllocDmaMemory = 0x800BA6C8; // type:func -AudioHeap_AllocDmaMemoryZeroed = 0x800BA704; // type:func -AudioHeap_AllocZeroed = 0x800BA740; // type:func -AudioHeap_Alloc = 0x800BA79C; // type:func -AudioHeap_InitPool = 0x800BA7F4; // type:func -AudioHeap_InitPersistentCache = 0x800BA81C; // type:func -AudioHeap_InitTemporaryCache = 0x800BA830; // type:func -AudioHeap_ResetPool = 0x800BA860; // type:func -AudioHeap_PopPersistentCache = 0x800BA870; // type:func -AudioHeap_InitMainPools = 0x800BA9B0; // type:func -AudioHeap_InitSessionPools = 0x800BAA10; // type:func -AudioHeap_InitCachePools = 0x800BAA94; // type:func -AudioHeap_InitPersistentPoolsAndCaches = 0x800BAB18; // type:func -AudioHeap_InitTemporaryPoolsAndCaches = 0x800BABDC; // type:func -AudioHeap_AllocCached = 0x800BACA0; // type:func -AudioHeap_SearchCaches = 0x800BB434; // type:func -AudioHeap_SearchRegularCaches = 0x800BB48C; // type:func -func_800DF1D8 = 0x800BB598; // type:func -AudioHeap_ClearFilter = 0x800BB96C; // type:func -AudioHeap_LoadLowPassFilter = 0x800BB99C; // type:func -AudioHeap_LoadHighPassFilter = 0x800BB9F0; // type:func -AudioHeap_LoadFilter = 0x800BBA48; // type:func -AudioHeap_UpdateReverb = 0x800BBB7C; // type:func -AudioHeap_UpdateReverbs = 0x800BBB84; // type:func -AudioHeap_ClearCurrentAiBuffer = 0x800BBC48; // type:func -AudioHeap_ResetStep = 0x800BBCB4; // type:func -AudioHeap_Init = 0x800BBFB8; // type:func -AudioHeap_SearchPermanentCache = 0x800BC8A8; // type:func -AudioHeap_AllocPermanent = 0x800BC900; // type:func -AudioHeap_AllocSampleCache = 0x800BC984; // type:func -AudioHeap_InitSampleCaches = 0x800BC9F4; // type:func -AudioHeap_AllocTemporarySampleCacheEntry = 0x800BCA8C; // type:func -AudioHeap_UnapplySampleCacheForFont = 0x800BCD24; // type:func -AudioHeap_DiscardSampleCacheEntry = 0x800BCE98; // type:func -AudioHeap_UnapplySampleCache = 0x800BCF74; // type:func -AudioHeap_AllocPersistentSampleCacheEntry = 0x800BCFB8; // type:func -AudioHeap_DiscardSampleCacheForFont = 0x800BD040; // type:func -AudioHeap_DiscardSampleCaches = 0x800BD07C; // type:func -AudioHeap_ChangeStorage = 0x800BD1CC; // type:func -AudioHeap_DiscardSampleBank = 0x800BD22C; // type:func -AudioHeap_ApplySampleBankCache = 0x800BD250; // type:func -AudioHeap_ApplySampleBankCacheInternal = 0x800BD274; // type:func -AudioHeap_DiscardSampleBanks = 0x800BD508; // type:func -AudioLoad_DecreaseSampleDmaTtls = 0x800BD5B0; // type:func -AudioLoad_DmaSampleData = 0x800BD69C; // type:func -AudioLoad_InitSampleDmaBuffers = 0x800BD9D8; // type:func -AudioLoad_IsFontLoadComplete = 0x800BDC70; // type:func -AudioLoad_IsSeqLoadComplete = 0x800BDCE8; // type:func -AudioLoad_IsSampleLoadComplete = 0x800BDD60; // type:func -AudioLoad_SetFontLoadStatus = 0x800BDDD8; // type:func -AudioLoad_SetSeqLoadStatus = 0x800BDE08; // type:func -AudioLoad_SetSampleFontLoadStatusAndApplyCaches = 0x800BDE38; // type:func -AudioLoad_SetSampleFontLoadStatus = 0x800BDE98; // type:func -AudioLoad_InitTable = 0x800BDEC8; // type:func -AudioLoad_SyncLoadSeqFonts = 0x800BDF28; // type:func -AudioLoad_SyncLoadSeqParts = 0x800BDFD8; // type:func -AudioLoad_SyncLoadSample = 0x800BE038; // type:func -AudioLoad_SyncLoadInstrument = 0x800BE124; // type:func -AudioLoad_AsyncLoad = 0x800BE1F4; // type:func -AudioLoad_AsyncLoadSeq = 0x800BE22C; // type:func -AudioLoad_AsyncLoadSampleBank = 0x800BE270; // type:func -AudioLoad_AsyncLoadFont = 0x800BE2B4; // type:func -AudioLoad_GetFontsForSequence = 0x800BE2F8; // type:func -AudioLoad_DiscardSeqFonts = 0x800BE33C; // type:func -AudioLoad_DiscardFont = 0x800BE3EC; // type:func -AudioLoad_SyncInitSeqPlayer = 0x800BE494; // type:func -AudioLoad_SyncInitSeqPlayerSkipTicks = 0x800BE4E4; // type:func -AudioLoad_SyncInitSeqPlayerInternal = 0x800BE53C; // type:func -AudioLoad_SyncLoadSeq = 0x800BE684; // type:func -AudioLoad_GetSampleBank = 0x800BE6D8; // type:func -AudioLoad_TrySyncLoadSampleBank = 0x800BE6F8; // type:func -AudioLoad_SyncLoadFont = 0x800BE814; // type:func -AudioLoad_SyncLoad = 0x800BE918; // type:func -AudioLoad_GetRealTableIndex = 0x800BEB28; // type:func -AudioLoad_SearchCaches = 0x800BEB64; // type:func -AudioLoad_GetLoadTable = 0x800BEBB8; // type:func -AudioLoad_RelocateFont = 0x800BEBFC; // type:func -AudioLoad_SyncDma = 0x800BEE68; // type:func -AudioLoad_SyncDmaUnkMedium = 0x800BEF8C; // type:func -AudioLoad_Dma = 0x800BEFA0; // type:func -AudioLoad_Unused1 = 0x800BF078; // type:func -AudioLoad_SyncLoadSimple = 0x800BF080; // type:func -AudioLoad_AsyncLoadInner = 0x800BF0A0; // type:func -AudioLoad_ProcessLoads = 0x800BF3AC; // type:func -AudioLoad_SetDmaHandler = 0x800BF3DC; // type:func -AudioLoad_SetUnusedHandler = 0x800BF3E8; // type:func -AudioLoad_InitSoundFont = 0x800BF3F4; // type:func -AudioLoad_Init = 0x800BF454; // type:func -AudioLoad_InitSlowLoads = 0x800BF7C0; // type:func -AudioLoad_SlowLoadSample = 0x800BF7D4; // type:func -AudioLoad_GetFontSample = 0x800BF9A0; // type:func -AudioLoad_Unused2 = 0x800BFA30; // type:func -AudioLoad_FinishSlowLoad = 0x800BFA38; // type:func -AudioLoad_ProcessSlowLoads = 0x800BFAAC; // type:func -AudioLoad_DmaSlowCopy = 0x800BFC34; // type:func -AudioLoad_DmaSlowCopyUnkMedium = 0x800BFCB8; // type:func -AudioLoad_SlowLoadSeq = 0x800BFCCC; // type:func -AudioLoad_InitAsyncLoads = 0x800BFDD4; // type:func -AudioLoad_StartAsyncLoadUnkMedium = 0x800BFE04; // type:func -AudioLoad_StartAsyncLoad = 0x800BFE88; // type:func -AudioLoad_ProcessAsyncLoads = 0x800BFFAC; // type:func -AudioLoad_ProcessAsyncLoadUnkMedium = 0x800C00D0; // type:func -AudioLoad_FinishAsyncLoad = 0x800C00DC; // type:func -AudioLoad_ProcessAsyncLoad = 0x800C0218; // type:func -AudioLoad_AsyncDma = 0x800C0374; // type:func -AudioLoad_AsyncDmaUnkMedium = 0x800C0404; // type:func -AudioLoad_RelocateSample = 0x800C0418; // type:func -AudioLoad_RelocateFontAndPreloadSamples = 0x800C0558; // type:func -AudioLoad_ProcessSamplePreloads = 0x800C0950; // type:func -AudioLoad_AddToSampleSet = 0x800C0B04; // type:func -AudioLoad_GetSamplesForFont = 0x800C0B4C; // type:func -AudioLoad_AddUsedSample = 0x800C0C80; // type:func -AudioLoad_PreloadSamplesForFont = 0x800C0CD8; // type:func -AudioLoad_LoadPermanentSamples = 0x800C1154; // type:func -AudioLoad_Unused3 = 0x800C1294; // type:func -AudioLoad_Unused4 = 0x800C129C; // type:func -AudioLoad_Unused5 = 0x800C12A4; // type:func -AudioLoad_ScriptLoad = 0x800C12AC; // type:func -AudioLoad_ProcessScriptLoads = 0x800C1318; // type:func -AudioLoad_InitScriptLoads = 0x800C1370; // type:func -AudioThread_Update = 0x800C13A0; // type:func -AudioThread_UpdateImpl = 0x800C13C0; // type:func -AudioThread_ProcessGlobalCmd = 0x800C1944; // type:func -AudioThread_SetFadeOutTimer = 0x800C1D18; // type:func -AudioThread_SetFadeInTimer = 0x800C1D6C; // type:func -AudioThread_InitMesgQueuesImpl = 0x800C1DB4; // type:func -AudioThread_QueueCmd = 0x800C1E4C; // type:func -AudioThread_QueueCmdF32 = 0x800C1E98; // type:func -AudioThread_QueueCmdS32 = 0x800C1EBC; // type:func -AudioThread_QueueCmdS8 = 0x800C1EE0; // type:func -AudioThread_QueueCmdU16 = 0x800C1F10; // type:func -AudioThread_ScheduleProcessCmds = 0x800C1F40; // type:func -AudioThread_ResetCmdQueue = 0x800C1FD0; // type:func -AudioThread_ProcessCmd = 0x800C1FE8; // type:func -AudioThread_ProcessCmds = 0x800C212C; // type:func -func_800E5E20 = 0x800C21E0; // type:func -AudioThread_GetFontsForSequence = 0x800C2244; // type:func -Audio_GetSampleBankIdsOfFont = 0x800C2264; // type:func -func_800E5EDC = 0x800C229C; // type:func -func_800E5F34 = 0x800C22F4; // type:func -AudioThread_ResetAudioHeap = 0x800C2348; // type:func -AudioThread_PreNMIInternal = 0x800C23E4; // type:func -AudioThread_GetChannelIO = 0x800C2430; // type:func -AudioThread_GetSeqPlayerIO = 0x800C2484; // type:func -AudioThread_InitExternalPool = 0x800C24AC; // type:func -AudioThread_ResetExternalPool = 0x800C24DC; // type:func -AudioThread_ProcessSeqPlayerCmd = 0x800C24E8; // type:func -AudioThread_ProcessChannelCmd = 0x800C26C0; // type:func -AudioThread_Noop1Cmd = 0x800C2870; // type:func -AudioThread_Noop1CmdZeroed = 0x800C28B8; // type:func -AudioThread_Noop2Cmd = 0x800C28DC; // type:func -AudioThread_WaitForAudioTask = 0x800C2910; // type:func -func_800E6590 = 0x800C2950; // type:func -func_800E6680 = 0x800C2A40; // type:func -func_800E66A0 = 0x800C2A60; // type:func -func_800E66C0 = 0x800C2A80; // type:func -AudioThread_NextRandom = 0x800C2B80; // type:func -AudioThread_InitMesgQueues = 0x800C2BD8; // type:func -Audio_InvalDCache = 0x800C2C00; // type:func -Audio_WritebackDCache = 0x800C2C40; // type:func -osAiSetNextBuffer = 0x800C2C80; // type:func -Audio_InitNoteSub = 0x800C2D00; // type:func -Audio_NoteSetResamplingRate = 0x800C3178; // type:func -Audio_NoteInit = 0x800C3228; // type:func -Audio_NoteDisable = 0x800C32E8; // type:func -Audio_ProcessNotes = 0x800C334C; // type:func -Audio_GetInstrumentTunedSample = 0x800C381C; // type:func -Audio_GetInstrumentInner = 0x800C3858; // type:func -Audio_GetDrum = 0x800C392C; // type:func -Audio_GetSoundEffect = 0x800C3A10; // type:func -Audio_SetFontInstrument = 0x800C3B04; // type:func -Audio_SeqLayerDecayRelease = 0x800C3C48; // type:func -Audio_SeqLayerNoteDecay = 0x800C3F20; // type:func -Audio_SeqLayerNoteRelease = 0x800C3F40; // type:func -Audio_BuildSyntheticWave = 0x800C3F60; // type:func -Audio_InitSyntheticWave = 0x800C4064; // type:func -Audio_InitNoteList = 0x800C40BC; // type:func -Audio_InitNoteLists = 0x800C40CC; // type:func -Audio_InitNoteFreeList = 0x800C411C; // type:func -Audio_NotePoolClear = 0x800C41C0; // type:func -Audio_NotePoolFill = 0x800C4320; // type:func -Audio_AudioListPushFront = 0x800C445C; // type:func -Audio_AudioListRemove = 0x800C449C; // type:func -Audio_FindNodeWithPrioLessThan = 0x800C44C8; // type:func -Audio_NoteInitForLayer = 0x800C4548; // type:func -func_800E82C0 = 0x800C4680; // type:func -Audio_NoteReleaseAndTakeOwnership = 0x800C46B4; // type:func -Audio_AllocNoteFromDisabled = 0x800C46E0; // type:func -Audio_AllocNoteFromDecaying = 0x800C472C; // type:func -Audio_AllocNoteFromActive = 0x800C477C; // type:func -Audio_AllocNote = 0x800C4874; // type:func -Audio_NoteInitAll = 0x800C4B48; // type:func -Audio_SequenceChannelProcessSound = 0x800C4C80; // type:func -Audio_SequencePlayerProcessSound = 0x800C4E48; // type:func -Audio_GetPortamentoFreqScale = 0x800C4F94; // type:func -Audio_GetVibratoPitchChange = 0x800C4FF0; // type:func -Audio_GetVibratoFreqScale = 0x800C5028; // type:func -Audio_NoteVibratoUpdate = 0x800C5264; // type:func -Audio_NoteVibratoInit = 0x800C52C0; // type:func -Audio_NotePortamentoInit = 0x800C5378; // type:func -Audio_AdsrInit = 0x800C53A4; // type:func -Audio_AdsrUpdate = 0x800C53C4; // type:func -AudioSeq_GetScriptControlFlowArgument = 0x800C5700; // type:func -AudioSeq_HandleScriptFlowControl = 0x800C5768; // type:func -AudioSeq_InitSequenceChannel = 0x800C5944; // type:func -AudioSeq_SeqChannelSetLayer = 0x800C5A98; // type:func -AudioSeq_SeqLayerDisable = 0x800C5BBC; // type:func -AudioSeq_SeqLayerFree = 0x800C5C38; // type:func -AudioSeq_SequenceChannelDisable = 0x800C5C88; // type:func -AudioSeq_SequencePlayerSetupChannels = 0x800C5CF4; // type:func -AudioSeq_SequencePlayerDisableChannels = 0x800C5DEC; // type:func -AudioSeq_SequenceChannelEnable = 0x800C5E6C; // type:func -AudioSeq_SequencePlayerDisableAsFinished = 0x800C5F04; // type:func -AudioSeq_SequencePlayerDisable = 0x800C5F2C; // type:func -AudioSeq_AudioListPushBack = 0x800C5FE8; // type:func -AudioSeq_AudioListPopBack = 0x800C6028; // type:func -AudioSeq_InitLayerFreelist = 0x800C6068; // type:func -AudioSeq_ScriptReadU8 = 0x800C6108; // type:func -AudioSeq_ScriptReadS16 = 0x800C611C; // type:func -AudioSeq_ScriptReadCompressedU16 = 0x800C6154; // type:func -AudioSeq_SeqLayerProcessScript = 0x800C6194; // type:func -AudioSeq_SeqLayerProcessScriptStep1 = 0x800C6298; // type:func -AudioSeq_SeqLayerProcessScriptStep5 = 0x800C6324; // type:func -AudioSeq_SeqLayerProcessScriptStep2 = 0x800C6480; // type:func -AudioSeq_SeqLayerProcessScriptStep4 = 0x800C6800; // type:func -AudioSeq_SeqLayerProcessScriptStep3 = 0x800C6EA0; // type:func -AudioSeq_SetChannelPriorities = 0x800C72B4; // type:func -AudioSeq_GetInstrument = 0x800C72E4; // type:func -AudioSeq_SetInstrument = 0x800C7358; // type:func -AudioSeq_SequenceChannelSetVolume = 0x800C7404; // type:func -AudioSeq_SequenceChannelProcessScript = 0x800C7428; // type:func -AudioSeq_SequencePlayerProcessSequence = 0x800C8118; // type:func -AudioSeq_ProcessSequences = 0x800C8924; // type:func -AudioSeq_SkipForwardSequence = 0x800C89D8; // type:func -AudioSeq_ResetSequencePlayer = 0x800C8A28; // type:func -AudioSeq_InitSequencePlayerChannels = 0x800C8AF4; // type:func -AudioSeq_InitSequencePlayer = 0x800C8BCC; // type:func -AudioSeq_InitSequencePlayers = 0x800C8C9C; // type:func -AudioOcarina_SetCustomButtonMapping = 0x800C8D20; // type:func -AudioOcarina_ReadControllerInput = 0x800C8DC0; // type:func -AudioOcarina_BendPitchTwoSemitones = 0x800C8E20; // type:func -AudioOcarina_GetPlayingState = 0x800C8EB0; // type:func -AudioOcarina_MapNoteToButton = 0x800C8EF4; // type:func -AudioOcarina_MapNotesToScarecrowButtons = 0x800C8F3C; // type:func -AudioOcarina_Start = 0x800C8FC4; // type:func -AudioOcarina_CheckIfStartedSong = 0x800C917C; // type:func -AudioOcarina_CheckSongsWithMusicStaff = 0x800C91B8; // type:func -AudioOcarina_CheckSongsWithoutMusicStaff = 0x800C95C0; // type:func -AudioOcarina_PlayControllerInput = 0x800C9818; // type:func -AudioOcarina_EnableInput = 0x800C9C08; // type:func -AudioOcarina_SetInstrument = 0x800C9C18; // type:func -AudioOcarina_SetPlaybackSong = 0x800C9CFC; // type:func -AudioOcarina_PlaybackSong = 0x800C9DFC; // type:func -AudioOcarina_SetRecordingSong = 0x800CA128; // type:func -AudioOcarina_SetRecordingState = 0x800CA530; // type:func -AudioOcarina_UpdateRecordingStaff = 0x800CA65C; // type:func -AudioOcarina_UpdatePlayingStaff = 0x800CA694; // type:func -AudioOcarina_UpdatePlaybackStaff = 0x800CA6D8; // type:func -AudioOcarina_GetRecordingStaff = 0x800CA788; // type:func -AudioOcarina_GetPlayingStaff = 0x800CA794; // type:func -AudioOcarina_GetPlaybackStaff = 0x800CA7B8; // type:func -AudioOcarina_RecordSong = 0x800CA7C4; // type:func -AudioOcarina_MemoryGameInit = 0x800CA93C; // type:func -AudioOcarina_MemoryGameNextNote = 0x800CA9AC; // type:func -AudioOcarina_Update = 0x800CAAB4; // type:func -AudioOcarina_PlayLongScarecrowSong = 0x800CABE4; // type:func -AudioOcarina_ResetStaffs = 0x800CACF0; // type:func -AudioDebug_Draw = 0x800CAD3C; // type:func -AudioDebug_ScrPrt = 0x800CAD44; // type:func -Audio_Update = 0x800CAD50; // type:func -func_800F3138 = 0x800CADF4; // type:func -func_800F3140 = 0x800CADFC; // type:func -func_800F314C = 0x800CAE08; // type:func -Audio_ComputeSfxVolume = 0x800CAE44; // type:func -Audio_ComputeSfxReverb = 0x800CAFAC; // type:func -Audio_ComputeSfxPanSigned = 0x800CB124; // type:func -Audio_ComputeSfxFreqScale = 0x800CB2A8; // type:func -func_800F37B8 = 0x800CB474; // type:func -func_800F3990 = 0x800CB64C; // type:func -Audio_SetSfxProperties = 0x800CB6C4; // type:func -Audio_ResetSfxChannelState = 0x800CBB9C; // type:func -Audio_PlayCutsceneEffectsSequence = 0x800CBC04; // type:func -func_800F3F84 = 0x800CBC4C; // type:func -func_800F4010 = 0x800CBCD8; // type:func -func_800F4138 = 0x800CBDF8; // type:func -func_800F4190 = 0x800CBE50; // type:func -Audio_PlaySfxRandom = 0x800CBEA0; // type:func -func_800F4254 = 0x800CBF14; // type:func -func_800F436C = 0x800CC02C; // type:func -func_800F4414 = 0x800CC0D4; // type:func -func_800F44EC = 0x800CC1AC; // type:func -func_800F4524 = 0x800CC1E4; // type:func -func_800F4578 = 0x800CC238; // type:func -func_800F45D0 = 0x800CC290; // type:func -Audio_PlaySfxRiver = 0x800CC2F4; // type:func -Audio_PlaySfxWaterfall = 0x800CC3A0; // type:func -Audio_StepFreqLerp = 0x800CC444; // type:func -Audio_SetBgmVolumeOffDuringFanfare = 0x800CC47C; // type:func -Audio_SetBgmVolumeOnDuringFanfare = 0x800CC4BC; // type:func -Audio_SetMainBgmVolume = 0x800CC4FC; // type:func -Audio_SetGanonsTowerBgmVolumeLevel = 0x800CC530; // type:func -Audio_SetGanonsTowerBgmVolume = 0x800CC5DC; // type:func -Audio_LowerMainBgmVolume = 0x800CC714; // type:func -Audio_UpdateRiverSoundVolumes = 0x800CC730; // type:func -Audio_PlaySfxIncreasinglyTransposed = 0x800CC818; // type:func -Audio_ResetIncreasingTranspose = 0x800CC8A8; // type:func -Audio_PlaySfxTransposed = 0x800CC8B4; // type:func -func_800F4C58 = 0x800CC918; // type:func -func_800F4E30 = 0x800CCAF0; // type:func -Audio_ClearSariaBgm = 0x800CCD8C; // type:func -Audio_ClearSariaBgmAtPos = 0x800CCDAC; // type:func -Audio_SplitBgmChannels = 0x800CCDCC; // type:func -Audio_PlaySariaBgm = 0x800CCF60; // type:func -Audio_ClearSariaBgm2 = 0x800CD1C4; // type:func -Audio_PlayMorningSceneSequence = 0x800CD1D0; // type:func -Audio_PlaySceneSequence = 0x800CD210; // type:func -Audio_UpdateSceneSequenceResumePoint = 0x800CD368; // type:func -Audio_PlayWindmillBgm = 0x800CD3D8; // type:func -Audio_SetMainBgmTempoFreqAfterFanfare = 0x800CD40C; // type:func -Audio_SetFastTempoForTimedMinigame = 0x800CD5D8; // type:func -Audio_PlaySequenceInCutscene = 0x800CD61C; // type:func -Audio_StopSequenceInCutscene = 0x800CD6A8; // type:func -Audio_IsSequencePlaying = 0x800CD718; // type:func -func_800F5ACC = 0x800CD78C; // type:func -func_800F5B58 = 0x800CD800; // type:func -func_800F5BF0 = 0x800CD898; // type:func -func_800F5C2C = 0x800CD8D4; // type:func -Audio_PlayFanfare = 0x800CD90C; // type:func -Audio_UpdateFanfare = 0x800CD9A0; // type:func -Audio_PlaySequenceWithSeqPlayerIO = 0x800CDAC0; // type:func -Audio_SetSequenceMode = 0x800CDB38; // type:func -Audio_SetBgmEnemyVolume = 0x800CDDB4; // type:func -Audio_UpdateMalonSinging = 0x800CDF08; // type:func -func_800F64E0 = 0x800CE16C; // type:func -Audio_ToggleMalonSinging = 0x800CE210; // type:func -Audio_SetEnvReverb = 0x800CE34C; // type:func -Audio_SetCodeReverb = 0x800CE368; // type:func -func_800F6700 = 0x800CE38C; // type:func -Audio_SetBaseFilter = 0x800CE42C; // type:func -Audio_SetExtraFilter = 0x800CE4B4; // type:func -Audio_SetCutsceneFlag = 0x800CE548; // type:func -Audio_PlaySfxGeneralIfNotInCutscene = 0x800CE560; // type:func -Audio_PlaySfxIfNotInCutscene = 0x800CE5A8; // type:func -func_800F6964 = 0x800CE5F0; // type:func -Audio_StopBgmAndFanfare = 0x800CE73C; // type:func -func_800F6B3C = 0x800CE7C8; // type:func -Audio_DisableAllSeq = 0x800CE7F4; // type:func -func_800F6BB8 = 0x800CE844; // type:func -func_800F6BDC = 0x800CE868; // type:func -Audio_PreNMI = 0x800CE8A0; // type:func -func_800F6C34 = 0x800CE8C0; // type:func -Audio_SetNatureAmbienceChannelIO = 0x800CE9E4; // type:func -Audio_StartNatureAmbienceSequence = 0x800CEAF8; // type:func -Audio_PlayNatureAmbienceSequence = 0x800CEBFC; // type:func -Audio_Init = 0x800CED40; // type:func -Audio_InitSound = 0x800CED64; // type:func -func_800F7170 = 0x800CEDB8; // type:func -func_800F71BC = 0x800CEE04; // type:func -func_800F7208 = 0x800CEE50; // type:func -Audio_SetSfxBanksMute = 0x800CEEB0; // type:func -Audio_QueueSeqCmdMute = 0x800CEF08; // type:func -Audio_ClearBGMMute = 0x800CEF6C; // type:func -Audio_PlaySfxGeneral = 0x800CEFDC; // type:func -Audio_RemoveMatchingSfxRequests = 0x800CF05C; // type:func -Audio_ProcessSfxRequest = 0x800CF1FC; // type:func -Audio_RemoveSfxBankEntry = 0x800CF698; // type:func -Audio_ChooseActiveSfx = 0x800CF830; // type:func -Audio_PlayActiveSfx = 0x800CFF70; // type:func -Audio_StopSfxByBank = 0x800D0290; // type:func -Audio_RemoveSfxFromBankByPos = 0x800D0374; // type:func -Audio_StopSfxByPosAndBank = 0x800D0490; // type:func -Audio_StopSfxByPos = 0x800D04D8; // type:func -Audio_StopSfxByPosAndId = 0x800D0534; // type:func -Audio_StopSfxByTokenAndId = 0x800D0690; // type:func -Audio_StopSfxById = 0x800D07F4; // type:func -Audio_ProcessSfxRequests = 0x800D092C; // type:func -Audio_SetUnusedBankLerp = 0x800D0990; // type:func -Audio_StepUnusedBankLerp = 0x800D0A24; // type:func -func_800F8F88 = 0x800D0A78; // type:func -Audio_IsSfxPlaying = 0x800D0AE4; // type:func -Audio_ResetSfx = 0x800D0B4C; // type:func -Audio_StartSequence = 0x800D0D10; // type:func -Audio_StopSequence = 0x800D0E94; // type:func -Audio_ProcessSeqCmd = 0x800D0F1C; // type:func -Audio_QueueSeqCmd = 0x800D19E0; // type:func -Audio_ProcessSeqCmds = 0x800D1A08; // type:func -Audio_GetActiveSeqId = 0x800D1A88; // type:func -Audio_IsSeqCmdNotQueued = 0x800D1AF0; // type:func -Audio_ResetSequenceRequests = 0x800D1B48; // type:func -Audio_ReplaceSeqCmdSetupOpVolRestore = 0x800D1B60; // type:func -Audio_SetVolumeScale = 0x800D1C14; // type:func -Audio_UpdateActiveSequences = 0x800D1DB0; // type:func -func_800FAD34 = 0x800D2708; // type:func -Audio_ResetActiveSequences = 0x800D27CC; // type:func -Audio_ResetActiveSequencesAndVolume = 0x800D2888; // type:func -func_800FC800 = 0x800D2930; // type:func -func_800FC83C = 0x800D2960; // type:func -func_800FC868 = 0x800D298C; // type:func -func_800FC8D8 = 0x800D29FC; // type:func -func_800FC948 = 0x800D2A6C; // type:func -func_800FCA18 = 0x800D2B3C; // type:func -func_800FCB34 = 0x800D2BD8; // type:func -SystemHeap_Init = 0x800D2C48; // type:func -LogUtils_HungupThread = 0x800D2C70; // type:func -LogUtils_ResetHungup = 0x800D2CA4; // type:func -GfxPrint_Setup = 0x800D2CD0; // type:func -GfxPrint_SetColor = 0x800D311C; // type:func -GfxPrint_SetPosPx = 0x800D3168; // type:func -GfxPrint_SetPos = 0x800D318C; // type:func -GfxPrint_SetBasePosPx = 0x800D31B4; // type:func -GfxPrint_PrintCharImpl = 0x800D31C8; // type:func -GfxPrint_PrintChar = 0x800D365C; // type:func -GfxPrint_PrintStringWithSize = 0x800D381C; // type:func -GfxPrint_PrintString = 0x800D3878; // type:func -GfxPrint_Callback = 0x800D38D0; // type:func -GfxPrint_Init = 0x800D38FC; // type:func -GfxPrint_Destroy = 0x800D3984; // type:func -GfxPrint_Open = 0x800D398C; // type:func -GfxPrint_Close = 0x800D39C0; // type:func -GfxPrint_VPrintf = 0x800D39F0; // type:func -GfxPrint_Printf = 0x800D3A10; // type:func -Overlay_Relocate = 0x800D3A40; // type:func -Overlay_AllocateAndLoad = 0x800D3C80; // type:func -Overlay_Load = 0x800D3CE0; // type:func -PadSetup_Init = 0x800D3DB0; // type:func -PadUtils_Init = 0x800D3EF0; // type:func -func_800FCB70 = 0x800D3F10; // type:func -PadUtils_ResetPressRel = 0x800D3F18; // type:func -PadUtils_CheckCurExact = 0x800D3F24; // type:func -PadUtils_CheckCur = 0x800D3F3C; // type:func -PadUtils_CheckPressed = 0x800D3F58; // type:func -PadUtils_CheckReleased = 0x800D3F74; // type:func -PadUtils_GetCurButton = 0x800D3F90; // type:func -PadUtils_GetPressButton = 0x800D3F98; // type:func -PadUtils_GetCurX = 0x800D3FA0; // type:func -PadUtils_GetCurY = 0x800D3FA8; // type:func -PadUtils_SetRelXY = 0x800D3FB0; // type:func -PadUtils_GetRelXImpl = 0x800D3FBC; // type:func -PadUtils_GetRelYImpl = 0x800D3FC4; // type:func -PadUtils_GetRelX = 0x800D3FCC; // type:func -PadUtils_GetRelY = 0x800D3FEC; // type:func -PadUtils_UpdateRelXY = 0x800D400C; // type:func -RcpUtils_PrintRegisterStatus = 0x800D40E0; // type:func -RcpUtils_Reset = 0x800D4108; // type:func -ArenaImpl_LockInit = 0x800D4140; // type:func -ArenaImpl_Lock = 0x800D416C; // type:func -ArenaImpl_Unlock = 0x800D4194; // type:func -ArenaImpl_GetLastBlock = 0x800D41BC; // type:func -__osMallocInit = 0x800D4220; // type:func -__osMallocAddBlock = 0x800D4270; // type:func -__osMallocCleanup = 0x800D4310; // type:func -__osMallocIsInitialized = 0x800D4330; // type:func -__osMalloc_NoLock = 0x800D4338; // type:func -__osMalloc = 0x800D4464; // type:func -__osMallocR = 0x800D44A4; // type:func -__osFree_NoLock = 0x800D4618; // type:func -__osFree = 0x800D4758; // type:func -__osRealloc = 0x800D4790; // type:func -ArenaImpl_GetSizes = 0x800D4B88; // type:func -ArenaImpl_FaultClient = 0x800D4C5C; // type:func -__osCheckArena = 0x800D4E30; // type:func -PrintUtils_VPrintf = 0x800D4EF0; // type:func -PrintUtils_Printf = 0x800D4F24; // type:func -SystemArena_Malloc = 0x800D4F50; // type:func -SystemArena_MallocR = 0x800D4F78; // type:func -SystemArena_Realloc = 0x800D4FA0; // type:func -SystemArena_Free = 0x800D4FD0; // type:func -SystemArena_Calloc = 0x800D4FF8; // type:func -SystemArena_GetSizes = 0x800D504C; // type:func -SystemArena_Check = 0x800D5084; // type:func -SystemArena_Init = 0x800D50A8; // type:func -SystemArena_Cleanup = 0x800D50D8; // type:func -SystemArena_IsInitialized = 0x800D50FC; // type:func -Math_FTanF = 0x800D5120; // type:func -Math_FFloorF = 0x800D5154; // type:func -Math_FCeilF = 0x800D5174; // type:func -Math_FRoundF = 0x800D5194; // type:func -Math_FTruncF = 0x800D51B4; // type:func -Math_FNearbyIntF = 0x800D51D4; // type:func -Math_FAtanTaylorQF = 0x800D51F4; // type:func -Math_FAtanTaylorF = 0x800D5240; // type:func -Math_FAtanContFracF = 0x800D5364; // type:func -Math_FAtanF = 0x800D54B0; // type:func -Math_FAtan2F = 0x800D54F0; // type:func -Math_FAsinF = 0x800D55D8; // type:func -Math_FAcosF = 0x800D5608; // type:func -floorf = 0x800D5630; // type:func -floor = 0x800D563C; // type:func -lfloorf = 0x800D5648; // type:func -lfloor = 0x800D5658; // type:func -ceilf = 0x800D5668; // type:func -ceil = 0x800D5674; // type:func -lceilf = 0x800D5680; // type:func -lceil = 0x800D5690; // type:func -truncf = 0x800D56A0; // type:func -trunc = 0x800D56AC; // type:func -ltruncf = 0x800D56B8; // type:func -ltrunc = 0x800D56C8; // type:func -nearbyintf = 0x800D56D8; // type:func -nearbyint = 0x800D56E4; // type:func -lnearbyintf = 0x800D56F0; // type:func -lnearbyint = 0x800D5700; // type:func -roundf = 0x800D5710; // type:func -round = 0x800D572C; // type:func -lroundf = 0x800D574C; // type:func -lround = 0x800D576C; // type:func -Rand_Next = 0x800D5790; // type:func -Rand_Seed = 0x800D57C0; // type:func -Rand_ZeroOne = 0x800D57CC; // type:func -Rand_Centered = 0x800D5820; // type:func -Rand_Seed_Variable = 0x800D5878; // type:func -Rand_Next_Variable = 0x800D5880; // type:func -Rand_ZeroOne_Variable = 0x800D58A8; // type:func -Rand_Centered_Variable = 0x800D58F4; // type:func -Sleep_Cycles = 0x800D5950; // type:func -Sleep_Nsec = 0x800D59BC; // type:func -Sleep_Usec = 0x800D5A0C; // type:func -Sleep_Msec = 0x800D5A5C; // type:func -Sleep_Sec = 0x800D5AB0; // type:func -proutSprintf = 0x800D5AF0; // type:func -vsprintf = 0x800D5B14; // type:func -sprintf = 0x800D5B64; // type:func -JpegUtils_ProcessQuantizationTable = 0x800D5BC0; // type:func -JpegUtils_ParseHuffmanCodesLengths = 0x800D5C28; // type:func -JpegUtils_GetHuffmanCodes = 0x800D5CAC; // type:func -JpegUtils_SetHuffmanTable = 0x800D5D18; // type:func -JpegUtils_ProcessHuffmanTableImpl = 0x800D5DC0; // type:func -JpegUtils_ProcessHuffmanTable = 0x800D5E7C; // type:func -JpegUtils_SetHuffmanTableOld = 0x800D5F54; // type:func -JpegUtils_ProcessHuffmanTableImplOld = 0x800D5FFC; // type:func -JpegDecoder_Decode = 0x800D60D0; // type:func -JpegDecoder_ProcessMcu = 0x800D62F8; // type:func -JpegDecoder_ParseNextSymbol = 0x800D6494; // type:func -JpegDecoder_ReadBits = 0x800D65D0; // type:func -osAiGetLength = 0x800D66C0; // type:func -osAiSetFrequency = 0x800D66D0; // type:func -alInit = 0x800D67D0; // type:func -alClose = 0x800D67FC; // type:func -alLink = 0x800D682C; // type:func -alUnlink = 0x800D684C; // type:func -alSynNew = 0x800D6880; // type:func -alAudioFrame = 0x800D6BA4; // type:func -__allocParam = 0x800D6D50; // type:func -__freeParam = 0x800D6D7C; // type:func -_collectPVoices = 0x800D6D94; // type:func -_freePVoice = 0x800D6DE4; // type:func -_timeToSamplesNoRound = 0x800D6E24; // type:func -_timeToSamples = 0x800D6E6C; // type:func -__nextSampleTime = 0x800D6E90; // type:func -alSynDelete = 0x800D6EF0; // type:func -alSynAllocFX = 0x800D6F00; // type:func -osWritebackDCacheAll = 0x800D6FA0; // type:func -osContStartQuery = 0x800D6FD0; // type:func -osContGetQuery = 0x800D7054; // type:func -osContStartReadData = 0x800D7080; // type:func -osContGetReadData = 0x800D7108; // type:func -__osPackReadData = 0x800D7244; // type:func -osContInit = 0x800D7300; // type:func -__osContGetInitData = 0x800D74A4; // type:func -__osPackRequestData = 0x800D7610; // type:func -osContSetCh = 0x800D76D0; // type:func -sqrtf = 0x800D7730; // type:func -cosf = 0x800D7740; // type:func -coss = 0x800D7870; // type:func -guLookAtF = 0x800D7890; // type:func -guLookAt = 0x800D7B54; // type:func -guLookAtHiliteF = 0x800D7BC0; // type:func -guLookAtHilite = 0x800D83B8; // type:func -guOrthoF = 0x800D8490; // type:func -guOrtho = 0x800D85AC; // type:func -guPerspectiveF = 0x800D8600; // type:func -guPerspective = 0x800D87A8; // type:func -guPositionF = 0x800D8800; // type:func -guPosition = 0x800D8988; // type:func -sinf = 0x800D89E0; // type:func -sins = 0x800D8B60; // type:func -guS2DInitBg = 0x800D8BB0; // type:func -__ull_rshift = 0x800D8CD0; // type:func -__ull_rem = 0x800D8D4C; // type:func -__ull_div = 0x800D8DB0; // type:func -__ll_lshift = 0x800D8E0C; // type:func -__ll_rem = 0x800D8E88; // type:func -__ll_div = 0x800D8EEC; // type:func -__ll_mul = 0x800D8F48; // type:func -__ull_divremi = 0x800D8FBC; // type:func -__ll_mod = 0x800D9060; // type:func -__ll_rshift = 0x800D91CC; // type:func -__d_to_ll = 0x800D9250; // type:func -__f_to_ll = 0x800D9294; // type:func -__d_to_ull = 0x800D92D8; // type:func -__f_to_ull = 0x800D931C; // type:func -__ll_to_d = 0x800D9360; // type:func -__ll_to_f = 0x800D93A4; // type:func -__ull_to_d = 0x800D93E8; // type:func -__ull_to_f = 0x800D94A4; // type:func -strchr = 0x800D9560; // type:func -strlen = 0x800D9590; // type:func -memcpy = 0x800D95B4; // type:func -_Printf = 0x800D95E0; // type:func -_Putfld = 0x800D9B1C; // type:func -osDpGetStatus = 0x800D9FC0; // type:func -osDpSetStatus = 0x800D9FD0; // type:func -__osSpGetStatus = 0x800D9FE0; // type:func -__osSpSetStatus = 0x800D9FF0; // type:func -_VirtualToPhysicalTask = 0x800DA000; // type:func -osSpTaskLoad = 0x800DA0DC; // type:func -osSpTaskStartGo = 0x800DA1E0; // type:func -osSpTaskYield = 0x800DA210; // type:func -osSpTaskYielded = 0x800DA230; // type:func -__osSiRawStartDma = 0x800DA280; // type:func -__osSiCreateAccessQueue = 0x800DA360; // type:func -__osSiGetAccess = 0x800DA3B4; // type:func -__osSiRelAccess = 0x800DA3F0; // type:func -osGetThreadId = 0x800DA420; // type:func -__osGetActiveQueue = 0x800DA470; // type:func -osSetTimer = 0x800DA4A0; // type:func -osStopTimer = 0x800DA660; // type:func -osViGetCurrentFramebuffer = 0x800DA780; // type:func -osViSetEvent = 0x800DA7C0; // type:func -guMtxIdent = 0x800DA820; // type:func -guMtxIdentF = 0x800DA880; // type:func -guMtxF2L = 0x800DA8E0; // type:func -guScale = 0x800DA960; // type:func -guTranslate = 0x800DAA00; // type:func -guRotateF = 0x800DAAD0; // type:func -guRotate = 0x800DAC1C; // type:func -__osGetCurrFaultedThread = 0x800DAC60; // type:func -skGetId = 0x800DAC90; // type:func -skLaunchSetup = 0x800DACAC; // type:func -skLaunch = 0x800DACC8; // type:func -skRecryptListValid = 0x800DACE4; // type:func -skRecryptBegin = 0x800DAD00; // type:func -skRecryptData = 0x800DAD1C; // type:func -skRecryptComputeState = 0x800DAD38; // type:func -skRecryptEnd = 0x800DAD54; // type:func -skSignHash = 0x800DAD70; // type:func -skVerifyHash = 0x800DAD8C; // type:func -skGetConsumption = 0x800DADA8; // type:func -skAdvanceTicketWindow = 0x800DADC4; // type:func -skSetLimit = 0x800DADE0; // type:func -skExit = 0x800DADFC; // type:func -skKeepAlive = 0x800DAE18; // type:func -skGetRandomKeyData = 0x800DAE34; // type:func -skDumpVirage = 0x800DAE50; // type:func -skTest2 = 0x800DAE6C; // type:func -skTest3 = 0x800DAE88; // type:func -skResetWindow = 0x800DAEA4; // type:func -skValidateRls = 0x800DAEC0; // type:func -strcmp = 0x800DAEE0; // type:func -memset = 0x800DAF30; // type:func -strncmp = 0x800DAF54; // type:func -__osMotorAccess = 0x800DAFD0; // type:func -osMotorInit = 0x800DAFD8; // type:func -osAfterPreNMI = 0x800DAFE0; // type:func -_init_lpfilter = 0x800DB020; // type:func -alFxNew = 0x800DB0D0; // type:func -alEnvmixerNew = 0x800DB4E4; // type:func -alLoadNew = 0x800DB594; // type:func -alResampleNew = 0x800DB644; // type:func -alAuxBusNew = 0x800DB6D0; // type:func -alMainBusNew = 0x800DB72C; // type:func -alSaveNew = 0x800DB788; // type:func -alAdpcmPull = 0x800DB7D0; // type:func -alRaw16Pull = 0x800DBBEC; // type:func -alLoadParam = 0x800DBF70; // type:func -_decodeChunk = 0x800DC0FC; // type:func -alAuxBusPull = 0x800DC260; // type:func -alAuxBusParam = 0x800DC33C; // type:func -alEnvmixerPull = 0x800DC370; // type:func -alEnvmixerParam = 0x800DC83C; // type:func -_pullSubFrame = 0x800DC904; // type:func -_frexpf = 0x800DCBC8; // type:func -_ldexpf = 0x800DCC7C; // type:func -_getRate = 0x800DCC9C; // type:func -_getVol = 0x800DCE5C; // type:func -alFilterNew = 0x800DCEE0; // type:func -alMainBusPull = 0x800DCF00; // type:func -alMainBusParam = 0x800DD044; // type:func -alResamplePull = 0x800DD070; // type:func -alResampleParam = 0x800DD248; // type:func -alFxPull = 0x800DD310; // type:func -alFxParam = 0x800DD660; // type:func -alFxParamHdl = 0x800DD674; // type:func -_loadOutputBuffer = 0x800DD850; // type:func -_loadBuffer = 0x800DDA54; // type:func -_saveBuffer = 0x800DDBC0; // type:func -_filterBuffer = 0x800DDD30; // type:func -_doModFunc = 0x800DDDE8; // type:func -alSavePull = 0x800DDE80; // type:func -alSaveParam = 0x800DDF2C; // type:func -alHeapDBAlloc = 0x800DDF60; // type:func -alCopy = 0x800DDFB0; // type:func -_Litob = 0x800DDFE0; // type:func -_Ldtob = 0x800DE210; // type:func -_Ldunscale = 0x800DE63C; // type:func -_Genld = 0x800DE6D8; // type:func -__osSpDeviceBusy = 0x800DEC10; // type:func -__osSpSetPc = 0x800DEC40; // type:func -__osSpRawStartDma = 0x800DEC70; // type:func -guNormalize = 0x800DED00; // type:func -ldiv = 0x800DED60; // type:func -lldiv = 0x800DEDDC; // type:func -fmodf = 0x800DEF20; // type:func -memmove = 0x800DEF60; // type:func -absf = 0x800DEFF0; // type:func -sqrt = 0x800DF000; // type:func -Message_ResetOcarinaNoteState = 0x800DF010; // type:func -Message_UpdateOcarinaMemoryGame = 0x800DF0F4; // type:func -Message_ShouldAdvance = 0x800DF1E4; // type:func -Message_ShouldAdvanceSilent = 0x800DF29C; // type:func -Message_CloseTextbox = 0x800DF2DC; // type:func -Message_HandleChoiceSelection = 0x800DF35C; // type:func -Message_DrawTextChar = 0x800DF528; // type:func -Message_GrowTextbox = 0x800DF85C; // type:func -Message_FindMessageJPN = 0x800DFA58; // type:func -Message_FindMessageNES = 0x800DFADC; // type:func -Message_FindCreditsMessage = 0x800DFB60; // type:func -Message_SetTextColor = 0x800DFBCC; // type:func -Message_DrawTextboxIcon = 0x800DFEAC; // type:func -Message_DrawItemIcon = 0x800E06E0; // type:func -Message_HandleOcarina = 0x800E0A4C; // type:func -Message_DrawTextWide = 0x800E0BE8; // type:func -Message_DrawText = 0x800E208C; // type:func -Message_LoadItemIcon = 0x800E33C4; // type:func -Message_Decode = 0x800E3520; // type:func -Message_OpenText = 0x800E5D2C; // type:func -Message_StartTextbox = 0x800E61B0; // type:func -Message_ContinueTextbox = 0x800E6240; // type:func -Message_StartOcarinaImpl = 0x800E6364; // type:func -Message_StartOcarina = 0x800E67C0; // type:func -Message_StartOcarinaSunsSongDisabled = 0x800E67E8; // type:func -Message_GetState = 0x800E6814; // type:func -Message_DrawTextBox = 0x800E691C; // type:func -Message_SetView = 0x800E6DBC; // type:func -Message_DrawMain = 0x800E6E04; // type:func -Message_Draw = 0x800E9F58; // type:func -Message_Update = 0x800E9FF8; // type:func -Message_SetTables = 0x800EAAF8; // type:func -GameOver_Init = 0x800EAB30; // type:func -GameOver_FadeInLights = 0x800EAB44; // type:func -GameOver_Update = 0x800EABAC; // type:func -Interface_Destroy = 0x800EB070; // type:func -Interface_Init = 0x800EB08C; // type:func -Message_Init = 0x800EB474; // type:func -Regs_InitDataImpl = 0x800EB558; // type:func -Regs_InitData = 0x800EBF48; // type:func -ConsoleLogo_Calc = 0x80800000; // type:func -ConsoleLogo_SetupView = 0x80800098; // type:func -ConsoleLogo_Draw = 0x8080011C; // type:func -ConsoleLogo_Main = 0x808006C0; // type:func -ConsoleLogo_Destroy = 0x80800780; // type:func -ConsoleLogo_Init = 0x8080079C; // type:func -MapSelect_LoadTitle = 0x80800930; // type:func -MapSelect_LoadGame = 0x80800950; // type:func -MapSelect_UpdateMenu = 0x80800A40; // type:func -MapSelect_PrintMenu = 0x808013A0; // type:func -MapSelect_PrintLoadingMessage = 0x8080157C; // type:func -MapSelect_PrintAgeSetting = 0x80801608; // type:func -MapSelect_PrintCutsceneSetting = 0x8080167C; // type:func -MapSelect_DrawMenu = 0x80801838; // type:func -MapSelect_DrawLoadingScreen = 0x8080194C; // type:func -MapSelect_Draw = 0x80801A34; // type:func -MapSelect_Main = 0x80801AE8; // type:func -MapSelect_Destroy = 0x80801B14; // type:func -MapSelect_Init = 0x80801B20; // type:func -TitleSetup_SetupTitleScreen = 0x808035B0; // type:func -func_80803C5C = 0x8080361C; // type:func -TitleSetup_Main = 0x80803624; // type:func -TitleSetup_Destroy = 0x80803668; // type:func -TitleSetup_Init = 0x80803670; // type:func -FileSelect_SetupCopySource = 0x80803700; // type:func -FileSelect_SelectCopySource = 0x8080392C; // type:func -FileSelect_SetupCopyDest1 = 0x80803CD0; // type:func -FileSelect_SetupCopyDest2 = 0x80803EE4; // type:func -FileSelect_SelectCopyDest = 0x80803FD4; // type:func -FileSelect_ExitToCopySource1 = 0x80804400; // type:func -FileSelect_ExitToCopySource2 = 0x808044FC; // type:func -FileSelect_SetupCopyConfirm1 = 0x80804644; // type:func -FileSelect_SetupCopyConfirm2 = 0x80804900; // type:func -FileSelect_CopyConfirm = 0x80804968; // type:func -FileSelect_ReturnToCopyDest = 0x80804B78; // type:func -FileSelect_CopyAnim1 = 0x80804E5C; // type:func -FileSelect_CopyAnim2 = 0x80804F1C; // type:func -FileSelect_CopyAnim3 = 0x808050D8; // type:func -FileSelect_CopyAnim4 = 0x80805228; // type:func -FileSelect_CopyAnim5 = 0x80805370; // type:func -FileSelect_ExitCopyToMain = 0x8080579C; // type:func -FileSelect_SetupEraseSelect = 0x80805910; // type:func -FileSelect_EraseSelect = 0x80805B4C; // type:func -FileSelect_SetupEraseConfirm1 = 0x80805EF0; // type:func -FileSelect_SetupEraseConfirm2 = 0x808062D8; // type:func -FileSelect_EraseConfirm = 0x808063F8; // type:func -FileSelect_ExitToEraseSelect1 = 0x808065F8; // type:func -FileSelect_ExitToEraseSelect2 = 0x808066E0; // type:func -FileSelect_EraseAnim1 = 0x808069BC; // type:func -FileSelect_EraseAnim2 = 0x80806C2C; // type:func -FileSelect_EraseAnim3 = 0x80806CE4; // type:func -FileSelect_ExitEraseToMain = 0x80807004; // type:func -FileSelect_DrawCharacter = 0x808071E0; // type:func -FileSelect_DrawCharacterTransition = 0x80807318; // type:func -FileSelect_SetKeyboardVtx = 0x808074F8; // type:func -FileSelect_SetNameEntryVtx = 0x808077BC; // type:func -FileSelect_DrawKeyboard = 0x808084A0; // type:func -FileSelect_ApplyDiacriticToCharacter = 0x80808D64; // type:func -FileSelect_ApplyDiacriticToFilename = 0x80808F6C; // type:func -FileSelect_DrawNameEntry = 0x80808FEC; // type:func -FileSelect_StartNameEntry = 0x8080A450; // type:func -FileSelect_UpdateKeyboardCursor = 0x8080A504; // type:func -FileSelect_StartOptions = 0x8080AEE4; // type:func -FileSelect_UpdateOptionsMenu = 0x8080AF74; // type:func -FileSelect_DrawOptionsImpl = 0x8080B1F0; // type:func -FileSelect_DrawOptions = 0x8080C608; // type:func -FileSelect_SetView = 0x8080C630; // type:func -FileSelect_QuadTextureIA8 = 0x8080C6B4; // type:func -FileSelect_InitModeUpdate = 0x8080C894; // type:func -FileSelect_InitModeDraw = 0x8080C8EC; // type:func -FileSelect_FadeInMenuElements = 0x8080C8F8; // type:func -FileSelect_SplitNumber = 0x8080CA60; // type:func -FileSelect_StartFadeIn = 0x8080CAD4; // type:func -FileSelect_FinishFadeIn = 0x8080CB5C; // type:func -FileSelect_UpdateMainMenu = 0x8080CBF4; // type:func -FileSelect_UnusedCM31 = 0x8080D498; // type:func -FileSelect_UnusedCMDelay = 0x8080D4A4; // type:func -FileSelect_RotateToNameEntry = 0x8080D4F8; // type:func -FileSelect_RotateToOptions = 0x8080D56C; // type:func -FileSelect_RotateToMain = 0x8080D5E0; // type:func -FileSelect_PulsateCursor = 0x8080D658; // type:func -FileSelect_ConfigModeUpdate = 0x8080D754; // type:func -FileSelect_SetWindowVtx = 0x8080D790; // type:func -FileSelect_SetWindowContentVtx = 0x8080DA64; // type:func -FileSelect_DrawFileInfo = 0x8080ED28; // type:func -FileSelect_DrawWindowContents = 0x8080F4A4; // type:func -FileSelect_ConfigModeDraw = 0x80810958; // type:func -FileSelect_FadeMainToSelect = 0x80811238; // type:func -FileSelect_MoveSelectedFileToTop = 0x808113A4; // type:func -FileSelect_FadeInFileInfo = 0x808114A8; // type:func -FileSelect_ConfirmFile = 0x8081158C; // type:func -FileSelect_FadeOutFileInfo = 0x80811764; // type:func -FileSelect_MoveSelectedFileToSlot = 0x80811854; // type:func -FileSelect_FadeOut = 0x80811AAC; // type:func -FileSelect_LoadGame = 0x80811B08; // type:func -FileSelect_SelectModeUpdate = 0x80811CD0; // type:func -FileSelect_SelectModeDraw = 0x80811D0C; // type:func -FileSelect_Main = 0x808120C4; // type:func -FileSelect_InitContext = 0x8081268C; // type:func -FileSelect_Destroy = 0x80812CB8; // type:func -FileSelect_Init = 0x80812CC4; // type:func -KaleidoScope_DrawQuestStatus = 0x808141F0; // type:func -KaleidoScope_UpdateQuestStatusPoint = 0x808165DC; // type:func -KaleidoScope_DrawDebugEditorText = 0x808165F0; // type:func -KaleidoScope_DrawDigit = 0x808168E4; // type:func -KaleidoScope_DrawDebugEditor = 0x80816A58; // type:func -KaleidoScope_DrawEquipmentImage = 0x808185A0; // type:func -KaleidoScope_DrawPlayerWork = 0x808189A0; // type:func -KaleidoScope_DrawEquipment = 0x80818B44; // type:func -KaleidoScope_DrawAmmoCount = 0x8081A020; // type:func -KaleidoScope_SetCursorPos = 0x8081A55C; // type:func -KaleidoScope_SetItemCursorPos = 0x8081A58C; // type:func -KaleidoScope_DrawItemSelect = 0x8081A5B8; // type:func -KaleidoScope_UpdateItemEquip = 0x8081B414; // type:func -KaleidoScope_DrawDungeonMap = 0x8081C010; // type:func -KaleidoScope_DrawWorldMap = 0x8081D89C; // type:func -KaleidoScope_UpdatePrompt = 0x8081F5E0; // type:func -KaleidoScope_SetupPlayerPreRender = 0x8081F7E0; // type:func -KaleidoScope_ProcessPlayerPreRender = 0x8081F8CC; // type:func -KaleidoScope_QuadTextureIA4 = 0x8081F908; // type:func -KaleidoScope_QuadTextureIA8 = 0x8081FAE4; // type:func -KaleidoScope_OverridePalIndexCI4 = 0x8081FCC4; // type:func -KaleidoScope_MoveCursorToSpecialPos = 0x8081FD34; // type:func -KaleidoScope_DrawQuadTextureRGBA32 = 0x8081FD88; // type:func -KaleidoScope_SetDefaultCursor = 0x8081FF88; // type:func -KaleidoScope_SetupPageSwitch = 0x80820038; // type:func -KaleidoScope_HandlePageToggles = 0x808201B4; // type:func -KaleidoScope_DrawCursor = 0x808202AC; // type:func -KaleidoScope_DrawPageSections = 0x8082064C; // type:func -KaleidoScope_DrawPages = 0x80820900; // type:func -KaleidoScope_DrawInfoPanel = 0x80821FB8; // type:func -KaleidoScope_UpdateNamePanel = 0x80823404; // type:func -KaleidoScope_UpdatePageSwitch = 0x8082359C; // type:func -KaleidoScope_SetView = 0x8082376C; // type:func -KaleidoScope_SetPageVertices = 0x808237D8; // type:func -KaleidoScope_SetVertices = 0x8082459C; // type:func -KaleidoScope_DrawGameOver = 0x80825730; // type:func -KaleidoScope_Draw = 0x80825E18; // type:func -KaleidoScope_GrayOutTextureRGBA32 = 0x80826064; // type:func -KaleidoScope_UpdateOpening = 0x80826114; // type:func -KaleidoScope_UpdateCursorVtx = 0x808262F0; // type:func -KaleidoScope_LoadDungeonMap = 0x80826568; // type:func -KaleidoScope_UpdateDungeonMap = 0x808265F8; // type:func -KaleidoScope_Update = 0x808266DC; // type:func -PauseMapMark_Init = 0x80828BD0; // type:func -PauseMapMark_Clear = 0x80828C04; // type:func -PauseMapMark_DrawForDungeon = 0x80828C18; // type:func -PauseMapMark_Draw = 0x8082922C; // type:func -Player_ZeroSpeedXZ = 0x80830290; // type:func -func_80832224 = 0x808302A8; // type:func -Player_IsTalking = 0x808302D0; // type:func -Player_AnimPlayOnce = 0x808302EC; // type:func -Player_AnimPlayLoop = 0x80830310; // type:func -Player_AnimPlayLoopAdjusted = 0x80830334; // type:func -Player_AnimPlayOnceAdjusted = 0x80830364; // type:func -Player_ApplyYawFromAnim = 0x80830394; // type:func -func_80832318 = 0x808303B4; // type:func -func_80832340 = 0x808303E0; // type:func -Player_DetachHeldActor = 0x80830450; // type:func -func_80832440 = 0x808304DC; // type:func -Player_PutAwayHeldItem = 0x808305C4; // type:func -func_80832564 = 0x80830600; // type:func -func_80832594 = 0x80830638; // type:func -func_80832630 = 0x808306D8; // type:func -Player_RequestRumble = 0x808306F4; // type:func -Player_PlayVoiceSfx = 0x80830740; // type:func -func_808326F0 = 0x808307A0; // type:func -Player_ApplyFloorSfxOffset = 0x8083080C; // type:func -Player_PlayFloorSfx = 0x80830828; // type:func -Player_ApplyFloorAndAgeSfxOffsets = 0x80830860; // type:func -Player_PlayFloorSfxByAge = 0x80830888; // type:func -Player_PlaySteppingSfx = 0x808308C0; // type:func -Player_PlayJumpingSfx = 0x8083091C; // type:func -Player_PlayLandingSfx = 0x80830968; // type:func -func_808328EC = 0x808309B4; // type:func -Player_ProcessAnimSfxList = 0x808309E8; // type:func -Player_AnimChangeOnceMorph = 0x80830BD0; // type:func -Player_AnimChangeOnceMorphAdjusted = 0x80830C3C; // type:func -Player_AnimChangeLoopMorph = 0x80830CAC; // type:func -Player_AnimChangeFreeze = 0x80830CF4; // type:func -Player_AnimChangeLoopSlowMorph = 0x80830D38; // type:func -func_80832CB0 = 0x80830D80; // type:func -Player_ResetAnimMovement = 0x80830DD4; // type:func -Player_ResetAnimMovementScaledByAge = 0x80830DFC; // type:func -Player_ZeroRootLimbYaw = 0x80830E88; // type:func -Player_FinishAnimMovement = 0x80830E98; // type:func -Player_ApplyAnimMovementScaledByAge = 0x80830F24; // type:func -Player_StartAnimMovement = 0x80831034; // type:func -Player_AnimReplacePlayOnceSetSpeed = 0x808310DC; // type:func -Player_AnimReplacePlayOnce = 0x80831124; // type:func -Player_AnimReplacePlayOnceAdjusted = 0x8083114C; // type:func -Player_AnimReplaceNormalPlayOnceAdjusted = 0x80831174; // type:func -Player_AnimReplacePlayLoopSetSpeed = 0x80831194; // type:func -Player_AnimReplacePlayLoop = 0x808311DC; // type:func -Player_AnimReplacePlayLoopAdjusted = 0x80831204; // type:func -Player_AnimReplaceNormalPlayLoopAdjusted = 0x8083122C; // type:func -Player_ProcessControlStick = 0x8083124C; // type:func -func_8083328C = 0x80831378; // type:func -func_808332B8 = 0x808313A8; // type:func -func_808332E4 = 0x808313D4; // type:func -func_808332F4 = 0x808313E8; // type:func -Player_GetIdleAnim = 0x8083142C; // type:func -Player_CheckForIdleAnim = 0x80831448; // type:func -Player_ProcessFidgetAnimSfxList = 0x808314FC; // type:func -func_80833438 = 0x80831538; // type:func -func_808334B4 = 0x808315B4; // type:func -func_808334E4 = 0x808315E8; // type:func -func_80833528 = 0x80831630; // type:func -func_8083356C = 0x80831678; // type:func -func_808335B0 = 0x808316C0; // type:func -func_808335F4 = 0x80831708; // type:func -Player_SetUpperActionFunc = 0x80831750; // type:func -Player_InitItemActionWithAnim = 0x8083177C; // type:func -Player_ItemToItemAction = 0x8083183C; // type:func -Player_InitDefaultIA = 0x80831888; // type:func -Player_InitDekuStickIA = 0x80831898; // type:func -Player_InitHammerIA = 0x808318B4; // type:func -Player_InitBowOrSlingshotIA = 0x808318C4; // type:func -Player_InitExplosiveIA = 0x808318FC; // type:func -Player_InitHookshotIA = 0x80831A3C; // type:func -Player_InitBoomerangIA = 0x80831AAC; // type:func -Player_InitItemAction = 0x80831AC8; // type:func -func_80833A20 = 0x80831B54; // type:func -Player_FriendlyLockOnOrParallel = 0x80831C5C; // type:func -Player_UpdateHostileLockOn = 0x80831C84; // type:func -Player_IsZTargeting = 0x80831CFC; // type:func -Player_IsZTargetingWithHostileUpdate = 0x80831D38; // type:func -func_80833C3C = 0x80831D74; // type:func -Player_ItemIsInUse = 0x80831D8C; // type:func -Player_ItemIsItemAction = 0x80831DD8; // type:func -Player_GetItemOnButton = 0x80831E20; // type:func -Player_ProcessItemButtons = 0x80831F3C; // type:func -Player_StartChangingHeldItem = 0x80832224; // type:func -Player_UpdateItems = 0x808323DC; // type:func -func_80834380 = 0x808324C4; // type:func -func_8083442C = 0x80832570; // type:func -Player_FinishItemChange = 0x808326D8; // type:func -func_80834644 = 0x80832788; // type:func -func_808346C4 = 0x80832808; // type:func -func_80834758 = 0x8083289C; // type:func -func_8083485C = 0x808329A4; // type:func -func_80834894 = 0x808329DC; // type:func -Player_WaitToFinishItemChange = 0x80832A38; // type:func -func_8083499C = 0x80832AE8; // type:func -Player_UpperAction_Sword = 0x80832B28; // type:func -Player_UpperAction_ChangeHeldItem = 0x80832B78; // type:func -func_80834B5C = 0x80832CA8; // type:func -func_80834BD4 = 0x80832D24; // type:func -func_80834C74 = 0x80832DC8; // type:func -func_80834D2C = 0x80832E80; // type:func -func_80834E44 = 0x80832F98; // type:func -func_80834E7C = 0x80832FD0; // type:func -func_80834EB8 = 0x8083300C; // type:func -func_80834F2C = 0x80833080; // type:func -func_80834FBC = 0x80833110; // type:func -func_8083501C = 0x80833170; // type:func -func_808350A4 = 0x808331F8; // type:func -func_808351D4 = 0x8083332C; // type:func -func_808353D8 = 0x80833538; // type:func -func_80835588 = 0x808336E8; // type:func -Player_SetParallel = 0x80833744; // type:func -func_80835644 = 0x808337B0; // type:func -func_80835688 = 0x808337F8; // type:func -Player_UpperAction_CarryActor = 0x80833858; // type:func -func_808357E8 = 0x80833958; // type:func -func_80835800 = 0x80833974; // type:func -func_80835884 = 0x808339F8; // type:func -func_808358F0 = 0x80833A64; // type:func -func_808359FC = 0x80833B78; // type:func -func_80835B60 = 0x80833CE0; // type:func -func_80835C08 = 0x80833D88; // type:func -Player_SetupAction = 0x80833DE0; // type:func -Player_SetupActionPreserveAnimMovement = 0x80833F3C; // type:func -Player_SetupActionPreserveItemAction = 0x80833F70; // type:func -func_80835E44 = 0x80833FD4; // type:func -func_80835EA4 = 0x80834038; // type:func -Player_DestroyHookshot = 0x80834094; // type:func -Player_UseItem = 0x808340E4; // type:func -func_80836448 = 0x808345EC; // type:func -Player_CanUpdateItems = 0x8083476C; // type:func -Player_UpdateUpperBody = 0x80834818; // type:func -Player_SetupWaitForPutAway = 0x80834A40; // type:func -Player_UpdateShapeYaw = 0x80834A98; // type:func -Player_ScaledStepBinangClamped = 0x80834B74; // type:func -func_80836AB8 = 0x80834C60; // type:func -Player_UpdateZTargeting = 0x80834D94; // type:func -Player_CalcSpeedAndYawFromControlStick = 0x80835158; // type:func -Player_DecelerateToZero = 0x808353C8; // type:func -Player_GetMovementSpeedAndYaw = 0x8083541C; // type:func -Player_TryActionHandlerList = 0x808354FC; // type:func -Player_TryActionInterrupt = 0x80835658; // type:func -func_80837530 = 0x808356F0; // type:func -Player_CanSpinAttack = 0x808357A0; // type:func -func_80837704 = 0x808358D0; // type:func -func_808377DC = 0x808359A8; // type:func -func_80837818 = 0x808359EC; // type:func -func_80837918 = 0x80835AEC; // type:func -func_80837948 = 0x80835B1C; // type:func -Player_SetIntangibility = 0x80835CBC; // type:func -Player_SetInvulnerability = 0x80835CD8; // type:func -func_80837B18 = 0x80835CF8; // type:func -func_80837B60 = 0x80835D40; // type:func -func_80837B9C = 0x80835D7C; // type:func -func_80837C0C = 0x80835DEC; // type:func -func_80838144 = 0x80836324; // type:func -func_8083816C = 0x8083634C; // type:func -func_8083819C = 0x8083637C; // type:func -func_8083821C = 0x80836400; // type:func -func_80838280 = 0x80836464; // type:func -func_808382BC = 0x808364A0; // type:func -func_808382DC = 0x808364C0; // type:func -func_80838940 = 0x80836B24; // type:func -func_808389E8 = 0x80836BC8; // type:func -Player_ActionHandler_12 = 0x80836BF4; // type:func -func_80838E70 = 0x80837050; // type:func -func_80838F18 = 0x80837100; // type:func -func_80838F5C = 0x8083714C; // type:func -func_80838FB8 = 0x808371B0; // type:func -Player_HandleExitsAndVoids = 0x8083722C; // type:func -Player_GetRelativePosition = 0x808377D0; // type:func -Player_SpawnFairy = 0x80837874; // type:func -func_808396F4 = 0x808378E8; // type:func -func_8083973C = 0x80837934; // type:func -Player_PosVsWallLineTest = 0x80837960; // type:func -Player_ActionHandler_1 = 0x808379FC; // type:func -func_80839E88 = 0x80838094; // type:func -func_80839F30 = 0x80838138; // type:func -func_80839F90 = 0x80838194; // type:func -func_80839FFC = 0x80838200; // type:func -func_8083A060 = 0x80838268; // type:func -func_8083A098 = 0x808382A4; // type:func -func_8083A0D4 = 0x808382E4; // type:func -func_8083A0F4 = 0x80838304; // type:func -Player_SetupTalk = 0x80838508; // type:func -func_8083A360 = 0x80838578; // type:func -func_8083A388 = 0x808385A0; // type:func -func_8083A3B0 = 0x808385C8; // type:func -func_8083A40C = 0x80838620; // type:func -func_8083A434 = 0x80838648; // type:func -func_8083A4A8 = 0x808386BC; // type:func -func_8083A5C4 = 0x808387D8; // type:func -func_8083A6AC = 0x808388CC; // type:func -func_8083A9B8 = 0x80838BD4; // type:func -func_8083AA10 = 0x80838C2C; // type:func -func_8083AD4C = 0x80838F68; // type:func -Player_StartCsAction = 0x80838FF0; // type:func -func_8083AE40 = 0x8083905C; // type:func -func_8083AF44 = 0x808390E4; // type:func -func_8083B010 = 0x808391B8; // type:func -Player_ActionHandler_13 = 0x808391EC; // type:func -Player_ActionHandler_Talk = 0x808397F0; // type:func -func_8083B8F4 = 0x80839AA0; // type:func -Player_ActionHandler_0 = 0x80839B48; // type:func -func_8083BA90 = 0x80839C40; // type:func -func_8083BB20 = 0x80839CD8; // type:func -func_8083BBA0 = 0x80839D58; // type:func -Player_SetupRoll = 0x80839DC0; // type:func -Player_TryRoll = 0x80839E38; // type:func -func_8083BCD0 = 0x80839E8C; // type:func -Player_ActionHandler_10 = 0x80839F78; // type:func -func_8083BF50 = 0x8083A110; // type:func -func_8083C0B8 = 0x8083A274; // type:func -func_8083C0E8 = 0x8083A2AC; // type:func -func_8083C148 = 0x8083A308; // type:func -Player_ActionHandler_Roll = 0x8083A3A4; // type:func -Player_ActionHandler_11 = 0x8083A480; // type:func -func_8083C484 = 0x8083A658; // type:func -func_8083C50C = 0x8083A6E0; // type:func -Player_ActionHandler_8 = 0x8083A718; // type:func -func_8083C61C = 0x8083A7F4; // type:func -func_8083C6B8 = 0x8083A890; // type:func -func_8083C858 = 0x8083AA34; // type:func -func_8083C8DC = 0x8083AAB8; // type:func -Player_SetStartingMovement = 0x8083AAEC; // type:func -Player_StartMode_Idle = 0x8083AC00; // type:func -Player_StartMode_MoveForwardSlow = 0x8083AC38; // type:func -Player_StartMode_MoveForward = 0x8083AC80; // type:func -func_8083CB2C = 0x8083AD14; // type:func -func_8083CB94 = 0x8083AD78; // type:func -func_8083CBF0 = 0x8083ADD4; // type:func -func_8083CC9C = 0x8083AE7C; // type:func -func_8083CD00 = 0x8083AEDC; // type:func -Player_SetupTurnInPlace = 0x8083AF30; // type:func -func_8083CE0C = 0x8083AFEC; // type:func -func_8083CEAC = 0x8083B088; // type:func -func_8083CF10 = 0x8083B0E8; // type:func -func_8083CF5C = 0x8083B130; // type:func -func_8083CFA8 = 0x8083B178; // type:func -func_8083D0A8 = 0x8083B280; // type:func -func_8083D12C = 0x8083B308; // type:func -func_8083D330 = 0x8083B510; // type:func -func_8083D36C = 0x8083B54C; // type:func -func_8083D53C = 0x8083B720; // type:func -func_8083D6EC = 0x8083B8D0; // type:func -func_8083DB98 = 0x8083BD80; // type:func -func_8083DC54 = 0x8083BE3C; // type:func -func_8083DDC8 = 0x8083BFB0; // type:func -func_8083DF68 = 0x8083C158; // type:func -func_8083DFE0 = 0x8083C1D4; // type:func -Player_ActionHandler_3 = 0x8083C2F4; // type:func -Player_GetSlopeDirection = 0x8083C494; // type:func -Player_HandleSlopes = 0x8083C510; // type:func -func_8083E4C4 = 0x8083C6C4; // type:func -Player_ActionHandler_2 = 0x8083C7AC; // type:func -func_8083EA94 = 0x8083CC44; // type:func -Player_CanThrowCarriedActor = 0x8083CCA0; // type:func -Player_ActionHandler_9 = 0x8083CCF4; // type:func -func_8083EC18 = 0x8083CDC8; // type:func -func_8083F070 = 0x8083D224; // type:func -Player_TryEnteringCrawlspace = 0x8083D27C; // type:func -func_8083F360 = 0x8083D518; // type:func -func_8083F524 = 0x8083D6DC; // type:func -Player_TryLeavingCrawlspace = 0x8083D728; // type:func -func_8083F72C = 0x8083D8E4; // type:func -Player_ActionHandler_5 = 0x8083D970; // type:func -func_8083F9D0 = 0x8083DB88; // type:func -func_8083FAB8 = 0x8083DC70; // type:func -func_8083FB14 = 0x8083DCCC; // type:func -func_8083FB7C = 0x8083DD34; // type:func -func_8083FBC0 = 0x8083DD74; // type:func -func_8083FC68 = 0x8083DE24; // type:func -func_8083FD78 = 0x8083DF34; // type:func -func_8083FFB8 = 0x8083E178; // type:func -func_80840058 = 0x8083E218; // type:func -func_80840138 = 0x8083E300; // type:func -func_808401B0 = 0x8083E378; // type:func -func_8084021C = 0x8083E3E4; // type:func -func_8084029C = 0x8083E464; // type:func -Player_Action_80840450 = 0x8083E61C; // type:func -Player_Action_808407CC = 0x8083E998; // type:func -Player_ChooseNextIdleAnim = 0x8083EB98; // type:func -Player_Action_Idle = 0x8083ED94; // type:func -Player_Action_80840DE4 = 0x8083EFB4; // type:func -func_80841138 = 0x8083F308; // type:func -func_8084140C = 0x8083F5E4; // type:func -func_80841458 = 0x8083F630; // type:func -Player_Action_808414F8 = 0x8083F6D0; // type:func -func_808416C0 = 0x8083F8A4; // type:func -Player_Action_8084170C = 0x8083F8F0; // type:func -Player_Action_808417FC = 0x8083F9E0; // type:func -func_80841860 = 0x8083FA44; // type:func -Player_Action_8084193C = 0x8083FB20; // type:func -Player_Action_TurnInPlace = 0x8083FD84; // type:func -func_80841CC4 = 0x8083FEA0; // type:func -func_80841EE4 = 0x808400C4; // type:func -Player_Action_80842180 = 0x80840368; // type:func -Player_Action_8084227C = 0x8084046C; // type:func -Player_Action_808423EC = 0x808405E0; // type:func -Player_Action_8084251C = 0x80840710; // type:func -func_8084260C = 0x80840800; // type:func -func_8084269C = 0x80840890; // type:func -Player_Action_8084279C = 0x80840990; // type:func -func_8084285C = 0x80840A50; // type:func -func_808428D8 = 0x80840ACC; // type:func -func_80842964 = 0x80840B5C; // type:func -Player_RequestQuake = 0x80840BB4; // type:func -func_80842A28 = 0x80840C28; // type:func -func_80842A88 = 0x80840C8C; // type:func -func_80842AC4 = 0x80840CC8; // type:func -func_80842B7C = 0x80840D84; // type:func -func_80842CF0 = 0x80840EFC; // type:func -func_80842D20 = 0x80840F34; // type:func -func_80842DF4 = 0x8084100C; // type:func -Player_Action_80843188 = 0x808413A0; // type:func -Player_Action_808435C4 = 0x808417DC; // type:func -Player_Action_8084370C = 0x80841928; // type:func -Player_Action_8084377C = 0x8084199C; // type:func -Player_Action_80843954 = 0x80841B78; // type:func -Player_Action_80843A38 = 0x80841C60; // type:func -func_80843AE8 = 0x80841D14; // type:func -Player_Action_80843CEC = 0x80841F18; // type:func -func_80843E14 = 0x80842044; // type:func -func_80843E64 = 0x80842098; // type:func -func_8084409C = 0x808422D0; // type:func -Player_Action_8084411C = 0x80842358; // type:func -Player_Action_Roll = 0x8084294C; // type:func -Player_Action_80844A44 = 0x80842C88; // type:func -Player_Action_80844AF4 = 0x80842D38; // type:func -func_80844BE4 = 0x80842E28; // type:func -func_80844CF8 = 0x80842F40; // type:func -func_80844D30 = 0x80842F78; // type:func -func_80844D68 = 0x80842FB0; // type:func -func_80844DC8 = 0x80843014; // type:func -func_80844E3C = 0x80843088; // type:func -Player_Action_80844E68 = 0x808430B8; // type:func -Player_Action_80845000 = 0x80843250; // type:func -Player_Action_80845308 = 0x80843558; // type:func -Player_Action_80845668 = 0x808438B8; // type:func -Player_Action_WaitForPutAway = 0x80843B24; // type:func -func_80845964 = 0x80843BB8; // type:func -func_80845BA0 = 0x80843DFC; // type:func -func_80845C68 = 0x80843EC8; // type:func -Player_Action_80845CA4 = 0x80843F08; // type:func -Player_Action_80845EF8 = 0x80844168; // type:func -Player_Action_80846050 = 0x808442C0; // type:func -Player_Action_80846120 = 0x80844398; // type:func -Player_Action_80846260 = 0x808444D8; // type:func -Player_Action_80846358 = 0x808445D8; // type:func -Player_Action_80846408 = 0x80844688; // type:func -Player_Action_808464B0 = 0x80844730; // type:func -Player_Action_80846578 = 0x808447FC; // type:func -Player_DoNothing = 0x808448C4; // type:func -Player_StartMode_Nothing = 0x808448D4; // type:func -Player_StartMode_BlueWarp = 0x808448F0; // type:func -Player_PutSwordInHand = 0x808449B0; // type:func -Player_StartMode_TimeTravel = 0x80844A64; // type:func -Player_StartMode_Door = 0x80844B40; // type:func -Player_StartMode_Grotto = 0x80844B88; // type:func -Player_StartMode_KnockedOver = 0x80844C18; // type:func -Player_StartMode_WarpSong = 0x80844C5C; // type:func -Player_SpawnMagicSpell = 0x80844C9C; // type:func -Player_StartMode_FaroresWind = 0x80844D08; // type:func -Player_InitCommon = 0x80844D48; // type:func -Player_Init = 0x80844F78; // type:func -Player_ApproachZeroBinang = 0x80845488; // type:func -func_80847298 = 0x8084552C; // type:func -Player_UpdateInterface = 0x80845668; // type:func -Player_UpdateHoverBoots = 0x80845D18; // type:func -Player_ProcessSceneCollision = 0x80845E40; // type:func -Player_UpdateCamAndSeqModes = 0x80846948; // type:func -Player_UpdateBurningDekuStick = 0x80846CA8; // type:func -Player_UpdateBodyShock = 0x80846DF0; // type:func -Player_UpdateBodyBurn = 0x80846F20; // type:func -Player_DetectRumbleSecrets = 0x808471A4; // type:func -Player_UpdateCommon = 0x8084724C; // type:func -Player_Update = 0x80848158; // type:func -Player_DrawGameplay = 0x80848390; // type:func -Player_Draw = 0x80848834; // type:func -Player_Destroy = 0x80848D94; // type:func -func_8084ABD8 = 0x80848E18; // type:func -func_8084AEEC = 0x8084912C; // type:func -func_8084B000 = 0x80849248; // type:func -func_8084B158 = 0x808493A8; // type:func -Player_Action_8084B1D8 = 0x80849428; // type:func -func_8084B3CC = 0x80849618; // type:func -func_8084B498 = 0x808496EC; // type:func -func_8084B4D4 = 0x80849728; // type:func -Player_Action_Talk = 0x80849788; // type:func -Player_Action_8084B78C = 0x808499F0; // type:func -func_8084B840 = 0x80849AA4; // type:func -Player_Action_8084B898 = 0x80849B00; // type:func -Player_Action_8084B9E4 = 0x80849C4C; // type:func -Player_Action_8084BBE4 = 0x80849E50; // type:func -Player_Action_8084BDFC = 0x8084A068; // type:func -func_8084BEE4 = 0x8084A150; // type:func -Player_Action_8084BF1C = 0x8084A188; // type:func -Player_Action_8084C5F8 = 0x8084A868; // type:func -Player_Action_8084C760 = 0x8084A9D0; // type:func -Player_Action_8084C81C = 0x8084AA8C; // type:func -func_8084C89C = 0x8084AB0C; // type:func -func_8084C9BC = 0x8084AC38; // type:func -func_8084CBF4 = 0x8084AE74; // type:func -Player_Action_8084CC98 = 0x8084AF1C; // type:func -Player_Action_8084D3E4 = 0x8084B66C; // type:func -func_8084D530 = 0x8084B7C0; // type:func -func_8084D574 = 0x8084B808; // type:func -func_8084D5CC = 0x8084B864; // type:func -Player_Action_8084D610 = 0x8084B8B0; // type:func -Player_Action_8084D7C4 = 0x8084BA60; // type:func -Player_Action_8084D84C = 0x8084BAF0; // type:func -func_8084D980 = 0x8084BC24; // type:func -Player_Action_8084DAB4 = 0x8084BD5C; // type:func -func_8084DBC4 = 0x8084BE6C; // type:func -Player_Action_8084DC48 = 0x8084BEF0; // type:func -func_8084DF6C = 0x8084C21C; // type:func -func_8084DFAC = 0x8084C260; // type:func -func_8084DFF4 = 0x8084C2AC; // type:func -Player_Action_8084E1EC = 0x8084C4A4; // type:func -Player_Action_8084E30C = 0x8084C5C4; // type:func -Player_Action_8084E368 = 0x8084C624; // type:func -Player_Action_8084E3C4 = 0x8084C684; // type:func -Player_Action_8084E604 = 0x8084C8C4; // type:func -Player_Action_8084E6D4 = 0x8084C994; // type:func -func_8084E988 = 0x8084CC48; // type:func -Player_Action_TimeTravelEnd = 0x8084CC6C; // type:func -Player_Action_8084EAC0 = 0x8084CD80; // type:func -Player_Action_SwingBottle = 0x8084CF6C; // type:func -Player_Action_8084EED8 = 0x8084D1A4; // type:func -Player_Action_8084EFC0 = 0x8084D28C; // type:func -Player_Action_ExchangeItem = 0x8084D3D4; // type:func -Player_Action_8084F308 = 0x8084D5DC; // type:func -Player_Action_SlideOnSlope = 0x8084D664; // type:func -Player_Action_WaitForCutscene = 0x8084D8DC; // type:func -Player_Action_StartWarpSongArrive = 0x8084D96C; // type:func -Player_Action_BlueWarpArrive = 0x8084D9E4; // type:func -Player_Action_8084F88C = 0x8084DB60; // type:func -Player_Action_TryOpeningDoor = 0x8084DC74; // type:func -Player_Action_ExitGrotto = 0x8084DC94; // type:func -Player_Action_8084FA54 = 0x8084DD28; // type:func -Player_Action_8084FB10 = 0x8084DDE4; // type:func -Player_Action_8084FBF4 = 0x8084DEC8; // type:func -func_8084FF7C = 0x8084DF80; // type:func -Player_UpdateBunnyEars = 0x8084E034; // type:func -Player_ActionHandler_7 = 0x8084E22C; // type:func -Player_Action_808502D0 = 0x8084E2D8; // type:func -Player_Action_808505DC = 0x8084E5E8; // type:func -Player_Action_8085063C = 0x8084E648; // type:func -Player_Action_FaroresWindArrive = 0x8084E778; // type:func -Player_Action_808507F4 = 0x8084E800; // type:func -Player_Action_HookshotFly = 0x8084EAFC; // type:func -Player_Action_80850C68 = 0x8084EC7C; // type:func -Player_Action_80850E84 = 0x8084EE98; // type:func -Player_AnimChangeOnceMorphZeroRootYawSpeed = 0x8084EEEC; // type:func -Player_AnimChangeOnceMorphAdjustedZeroRootYawSpeed = 0x8084EF30; // type:func -Player_AnimChangeLoopMorphAdjustedZeroRootYawSpeed = 0x8084EFB0; // type:func -func_80851008 = 0x8084F01C; // type:func -func_80851030 = 0x8084F044; // type:func -func_80851050 = 0x8084F064; // type:func -func_80851094 = 0x8084F0A8; // type:func -func_808510B4 = 0x8084F0C8; // type:func -func_808510D4 = 0x8084F0E8; // type:func -func_808510F4 = 0x8084F108; // type:func -func_80851114 = 0x8084F128; // type:func -func_80851134 = 0x8084F148; // type:func -func_80851154 = 0x8084F168; // type:func -func_80851174 = 0x8084F188; // type:func -func_80851194 = 0x8084F1A8; // type:func -func_808511B4 = 0x8084F1C8; // type:func -func_808511D4 = 0x8084F1E8; // type:func -func_808511FC = 0x8084F214; // type:func -func_80851248 = 0x8084F268; // type:func -func_80851294 = 0x8084F2BC; // type:func -func_808512E0 = 0x8084F310; // type:func -func_80851314 = 0x8084F348; // type:func -func_80851368 = 0x8084F39C; // type:func -func_808513BC = 0x8084F3F0; // type:func -func_808514C0 = 0x8084F4F8; // type:func -func_8085157C = 0x8084F5B4; // type:func -func_808515A4 = 0x8084F5E0; // type:func -func_80851688 = 0x8084F6C4; // type:func -func_80851750 = 0x8084F794; // type:func -func_80851788 = 0x8084F7D0; // type:func -func_80851828 = 0x8084F870; // type:func -func_808518DC = 0x8084F928; // type:func -func_8085190C = 0x8084F95C; // type:func -func_80851998 = 0x8084F9E8; // type:func -func_808519C0 = 0x8084FA10; // type:func -func_808519EC = 0x8084FA3C; // type:func -func_80851A50 = 0x8084FAA0; // type:func -func_80851B90 = 0x8084FBE0; // type:func -func_80851BE8 = 0x8084FC3C; // type:func -func_80851CA4 = 0x8084FCFC; // type:func -func_80851D2C = 0x8084FD88; // type:func -func_80851D80 = 0x8084FDE0; // type:func -func_80851DEC = 0x8084FE54; // type:func -func_80851E28 = 0x8084FE94; // type:func -func_80851E64 = 0x8084FED4; // type:func -func_80851E90 = 0x8084FF00; // type:func -func_80851ECC = 0x8084FF40; // type:func -func_80851F14 = 0x8084FF90; // type:func -func_80851F84 = 0x80850004; // type:func -func_80851FB0 = 0x80850030; // type:func -func_80852048 = 0x808500CC; // type:func -func_80852080 = 0x80850108; // type:func -func_808520BC = 0x80850148; // type:func -func_80852174 = 0x80850200; // type:func -func_808521B8 = 0x8085024C; // type:func -func_808521F4 = 0x8085028C; // type:func -func_80852234 = 0x808502CC; // type:func -func_8085225C = 0x808502F8; // type:func -func_80852280 = 0x8085031C; // type:func -func_80852298 = 0x80850338; // type:func -func_80852328 = 0x808503CC; // type:func -func_80852358 = 0x808503FC; // type:func -func_80852388 = 0x8085042C; // type:func -func_80852414 = 0x808504BC; // type:func -func_80852450 = 0x808504FC; // type:func -func_80852480 = 0x8085052C; // type:func -func_808524B0 = 0x8085055C; // type:func -func_808524D0 = 0x80850580; // type:func -func_80852514 = 0x808505C8; // type:func -func_80852544 = 0x808505FC; // type:func -func_80852554 = 0x80850610; // type:func -func_80852564 = 0x80850624; // type:func -func_808525C0 = 0x80850688; // type:func -func_80852608 = 0x808506D4; // type:func -func_80852648 = 0x8085071C; // type:func -func_808526EC = 0x808507C4; // type:func -func_8085283C = 0x8085091C; // type:func -func_808528C8 = 0x808509AC; // type:func -func_80852944 = 0x80850A2C; // type:func -func_808529D0 = 0x80850AB8; // type:func -func_80852A54 = 0x80850B40; // type:func -func_80852B4C = 0x80850C38; // type:func -func_80852C0C = 0x80850CF8; // type:func -func_80852C50 = 0x80850D3C; // type:func -Player_Action_CsAction = 0x80850EF8; // type:func -Player_IsDroppingFish = 0x80850FA0; // type:func -Player_StartFishing = 0x80850FD4; // type:func -func_80852F38 = 0x80851010; // type:func -Player_TryCsAction = 0x808510DC; // type:func -func_80853080 = 0x80851160; // type:func -Player_InflictDamage = 0x808511BC; // type:func -Player_StartTalking = 0x80851224; // type:func -EnTest_SetupAction = 0x8085D5D0; // type:func -EnTest_Init = 0x8085D5DC; // type:func -EnTest_Destroy = 0x8085D828; // type:func -EnTest_ChooseRandomAction = 0x8085D8C0; // type:func -EnTest_ChooseAction = 0x8085DA3C; // type:func -EnTest_SetupWaitGround = 0x8085DD5C; // type:func -EnTest_WaitGround = 0x8085DDD4; // type:func -EnTest_SetupWaitAbove = 0x8085DEB4; // type:func -EnTest_WaitAbove = 0x8085DF28; // type:func -EnTest_SetupIdle = 0x8085DFF4; // type:func -EnTest_Idle = 0x8085E078; // type:func -EnTest_Fall = 0x8085E2A8; // type:func -EnTest_Land = 0x8085E35C; // type:func -EnTest_SetupWalkAndBlock = 0x8085E3CC; // type:func -EnTest_WalkAndBlock = 0x8085E490; // type:func -func_80860BDC = 0x8085EB74; // type:func -func_80860C24 = 0x8085EBBC; // type:func -func_80860EC0 = 0x8085EE58; // type:func -func_80860F84 = 0x8085EF1C; // type:func -EnTest_SetupSlashDown = 0x8085F3B0; // type:func -EnTest_SlashDown = 0x8085F434; // type:func -EnTest_SetupSlashDownEnd = 0x8085F540; // type:func -EnTest_SlashDownEnd = 0x8085F590; // type:func -EnTest_SetupSlashUp = 0x8085F7BC; // type:func -EnTest_SlashUp = 0x8085F838; // type:func -EnTest_SetupJumpBack = 0x8085F8F0; // type:func -EnTest_JumpBack = 0x8085F990; // type:func -EnTest_SetupJumpslash = 0x8085FB38; // type:func -EnTest_Jumpslash = 0x8085FBE4; // type:func -EnTest_SetupJumpUp = 0x8085FCF4; // type:func -EnTest_JumpUp = 0x8085FD6C; // type:func -EnTest_SetupStopAndBlock = 0x8085FE64; // type:func -EnTest_StopAndBlock = 0x8085FF24; // type:func -EnTest_SetupIdleFromBlock = 0x8085FFF4; // type:func -EnTest_IdleFromBlock = 0x80860040; // type:func -func_80862154 = 0x808600F8; // type:func -func_808621D4 = 0x80860178; // type:func -func_80862398 = 0x80860340; // type:func -func_80862418 = 0x808603C0; // type:func -EnTest_SetupStunned = 0x80860524; // type:func -EnTest_Stunned = 0x80860600; // type:func -func_808627C4 = 0x80860778; // type:func -func_808628C8 = 0x8086087C; // type:func -func_80862DBC = 0x80860D74; // type:func -func_80862E6C = 0x80860E28; // type:func -func_80862FA8 = 0x80860F64; // type:func -func_80863044 = 0x80861000; // type:func -func_808630F0 = 0x808610AC; // type:func -func_8086318C = 0x80861148; // type:func -EnTest_SetupRecoil = 0x808611FC; // type:func -EnTest_Recoil = 0x80861250; // type:func -EnTest_Rise = 0x8086131C; // type:func -func_808633E8 = 0x808613A4; // type:func -EnTest_UpdateHeadRot = 0x80861420; // type:func -EnTest_UpdateDamage = 0x808614B8; // type:func -EnTest_Update = 0x80861658; // type:func -EnTest_OverrideLimbDraw = 0x80861A84; // type:func -EnTest_PostLimbDraw = 0x80861C58; // type:func -EnTest_Draw = 0x80861FE0; // type:func -func_80864158 = 0x808620F4; // type:func -EnTest_ReactToProjectile = 0x80862184; // type:func -EnGirlA_SetupAction = 0x80862E80; // type:func -EnGirlA_TryChangeShopItem = 0x80862E8C; // type:func -EnGirlA_InitItem = 0x80863004; // type:func -EnGirlA_Init = 0x808630A8; // type:func -EnGirlA_Destroy = 0x808630DC; // type:func -EnGirlA_CanBuy_Arrows = 0x8086310C; // type:func -EnGirlA_CanBuy_Bombs = 0x808631BC; // type:func -EnGirlA_CanBuy_DekuNuts = 0x8086325C; // type:func -EnGirlA_CanBuy_DekuSticks = 0x80863314; // type:func -EnGirlA_CanBuy_Fish = 0x808633CC; // type:func -EnGirlA_CanBuy_RedPotion = 0x80863444; // type:func -EnGirlA_CanBuy_GreenPotion = 0x808634BC; // type:func -EnGirlA_CanBuy_BluePotion = 0x80863534; // type:func -EnGirlA_CanBuy_Longsword = 0x808635AC; // type:func -EnGirlA_CanBuy_HylianShield = 0x80863640; // type:func -EnGirlA_CanBuy_DekuShield = 0x808636C0; // type:func -EnGirlA_CanBuy_GoronTunic = 0x80863740; // type:func -EnGirlA_CanBuy_ZoraTunic = 0x808637E8; // type:func -EnGirlA_CanBuy_RecoveryHeart = 0x80863890; // type:func -EnGirlA_CanBuy_MilkBottle = 0x808638DC; // type:func -EnGirlA_CanBuy_WeirdEgg = 0x80863938; // type:func -EnGirlA_CanBuy_Unk19 = 0x80863994; // type:func -EnGirlA_CanBuy_Unk20 = 0x808639A8; // type:func -EnGirlA_CanBuy_Bombchus = 0x808639BC; // type:func -EnGirlA_CanBuy_DekuSeeds = 0x80863A40; // type:func -EnGirlA_CanBuy_SoldOut = 0x80863AF0; // type:func -EnGirlA_CanBuy_BlueFire = 0x80863B04; // type:func -EnGirlA_CanBuy_Bugs = 0x80863B7C; // type:func -EnGirlA_CanBuy_Poe = 0x80863BF4; // type:func -EnGirlA_CanBuy_Fairy = 0x80863C6C; // type:func -EnGirlA_ItemGive_Arrows = 0x80863CE4; // type:func -EnGirlA_ItemGive_Bombs = 0x80863D2C; // type:func -EnGirlA_ItemGive_DekuNuts = 0x80863DCC; // type:func -EnGirlA_ItemGive_DekuSticks = 0x80863E3C; // type:func -EnGirlA_ItemGive_Longsword = 0x80863E78; // type:func -EnGirlA_ItemGive_HylianShield = 0x80863EC0; // type:func -EnGirlA_ItemGive_DekuShield = 0x80863EFC; // type:func -EnGirlA_ItemGive_GoronTunic = 0x80863F38; // type:func -EnGirlA_ItemGive_ZoraTunic = 0x80863F74; // type:func -EnGirlA_ItemGive_Health = 0x80863FB0; // type:func -EnGirlA_ItemGive_MilkBottle = 0x80863FF0; // type:func -EnGirlA_ItemGive_WeirdEgg = 0x8086402C; // type:func -EnGirlA_ItemGive_Unk19 = 0x80864068; // type:func -EnGirlA_ItemGive_Unk20 = 0x80864098; // type:func -EnGirlA_ItemGive_DekuSeeds = 0x808640C8; // type:func -EnGirlA_ItemGive_BottledItem = 0x80864104; // type:func -EnGirlA_BuyEvent_ShieldDiscount = 0x80864234; // type:func -EnGirlA_BuyEvent_GoronTunic = 0x808642D4; // type:func -EnGirlA_BuyEvent_ZoraTunic = 0x80864304; // type:func -EnGirlA_BuyEvent_ObtainBombchuPack = 0x80864334; // type:func -EnGirlA_Noop = 0x80864448; // type:func -EnGirlA_SetItemDescription = 0x80864458; // type:func -EnGirlA_SetItemOutOfStock = 0x80864580; // type:func -EnGirlA_UpdateStockedItem = 0x808645B4; // type:func -EnGirlA_TrySetMaskItemDescription = 0x8086462C; // type:func -EnGirlA_WaitForObject = 0x808646BC; // type:func -EnGirlA_Update2 = 0x80864A6C; // type:func -EnGirlA_Update = 0x80864B28; // type:func -func_80A3C498 = 0x80864B4C; // type:func -EnGirlA_Draw = 0x80864B90; // type:func -EnPart_Init = 0x808657A0; // type:func -EnPart_Destroy = 0x808657B0; // type:func -func_80ACDDE8 = 0x808657C0; // type:func -func_80ACE13C = 0x80865B14; // type:func -func_80ACE5B8 = 0x80865F90; // type:func -func_80ACE5C8 = 0x80865FA4; // type:func -func_80ACE7E8 = 0x808661C8; // type:func -EnPart_Update = 0x808663C4; // type:func -func_80ACEAC0 = 0x808664A4; // type:func -EnPart_Draw = 0x8086655C; // type:func -EnLight_Init = 0x80866E00; // type:func -EnLight_Destroy = 0x80866FE0; // type:func -EnLight_UpdatePosRot = 0x80867014; // type:func -EnLight_Update = 0x80867090; // type:func -EnLight_UpdateSwitch = 0x80867334; // type:func -EnLight_Draw = 0x8086776C; // type:func -EnDoor_Init = 0x80867C00; // type:func -EnDoor_Destroy = 0x80867E1C; // type:func -EnDoor_SetupType = 0x80867E50; // type:func -EnDoor_Idle = 0x80868008; // type:func -EnDoor_WaitForCheck = 0x808682C0; // type:func -EnDoor_Check = 0x8086830C; // type:func -EnDoor_AjarWait = 0x80868344; // type:func -EnDoor_AjarOpen = 0x80868378; // type:func -EnDoor_AjarClose = 0x808683E8; // type:func -EnDoor_Open = 0x80868430; // type:func -EnDoor_Update = 0x80868684; // type:func -EnDoor_OverrideLimbDraw = 0x808686A8; // type:func -EnDoor_Draw = 0x808687DC; // type:func -EnBox_SetupAction = 0x80868A40; // type:func -EnBox_ClipToGround = 0x80868A4C; // type:func -EnBox_Init = 0x80868AD8; // type:func -EnBox_Destroy = 0x80868F48; // type:func -EnBox_RandomDustKinematic = 0x80868F7C; // type:func -EnBox_SpawnDust = 0x80869080; // type:func -EnBox_Fall = 0x80869134; // type:func -EnBox_FallOnSwitchFlag = 0x808692B8; // type:func -func_809C9700 = 0x80869388; // type:func -EnBox_AppearOnSwitchFlag = 0x80869518; // type:func -EnBox_AppearOnRoomClear = 0x80869598; // type:func -EnBox_AppearInit = 0x80869650; // type:func -EnBox_AppearAnimation = 0x8086970C; // type:func -EnBox_WaitOpen = 0x808697B8; // type:func -EnBox_Open = 0x808699EC; // type:func -EnBox_SpawnIceSmoke = 0x80869B74; // type:func -EnBox_Update = 0x80869E20; // type:func -EnBox_PostLimbDraw = 0x80869F5C; // type:func -EnBox_EmptyDList = 0x8086A0C4; // type:func -func_809CA4A0 = 0x8086A0E8; // type:func -func_809CA518 = 0x8086A128; // type:func -EnBox_Draw = 0x8086A168; // type:func -EnPoh_Init = 0x8086A5A0; // type:func -EnPoh_Destroy = 0x8086A8E8; // type:func -func_80ADE114 = 0x8086A968; // type:func -EnPoh_SetupIdle = 0x8086A9C0; // type:func -func_80ADE1BC = 0x8086AA10; // type:func -EnPoh_SetupAttack = 0x8086AA60; // type:func -func_80ADE28C = 0x8086AAE0; // type:func -func_80ADE368 = 0x8086ABBC; // type:func -EnPoh_SetupInitialAction = 0x8086AC30; // type:func -func_80ADE48C = 0x8086ACE0; // type:func -func_80ADE4C8 = 0x8086AD20; // type:func -func_80ADE514 = 0x8086AD6C; // type:func -EnPoh_SetupDisappear = 0x8086ADC4; // type:func -EnPoh_SetupAppear = 0x8086AE1C; // type:func -EnPoh_SetupDeath = 0x8086AE68; // type:func -func_80ADE6D4 = 0x8086AF34; // type:func -EnPoh_Talk = 0x8086B020; // type:func -func_80ADE950 = 0x8086B1B8; // type:func -func_80ADE998 = 0x8086B204; // type:func -func_80ADE9BC = 0x8086B22C; // type:func -EnPoh_MoveTowardsPlayerHeight = 0x8086B240; // type:func -func_80ADEA5C = 0x8086B2D4; // type:func -func_80ADEAC4 = 0x8086B344; // type:func -EnPoh_Idle = 0x8086B400; // type:func -func_80ADEC9C = 0x8086B51C; // type:func -EnPoh_Attack = 0x8086B680; // type:func -func_80ADEECC = 0x8086B750; // type:func -func_80ADEF38 = 0x8086B7BC; // type:func -EnPoh_ComposerAppear = 0x8086B93C; // type:func -func_80ADF15C = 0x8086B9E0; // type:func -func_80ADF574 = 0x8086BDF8; // type:func -func_80ADF5E0 = 0x8086BE64; // type:func -EnPoh_Disappear = 0x8086BEE4; // type:func -EnPoh_Appear = 0x8086C000; // type:func -func_80ADF894 = 0x8086C120; // type:func -EnPoh_Death = 0x8086C220; // type:func -func_80ADFA90 = 0x8086C320; // type:func -func_80ADFE28 = 0x8086C6B8; // type:func -func_80ADFE80 = 0x8086C710; // type:func -func_80AE009C = 0x8086C92C; // type:func -EnPoh_TalkRegular = 0x8086C96C; // type:func -EnPoh_TalkComposer = 0x8086CA98; // type:func -func_80AE032C = 0x8086CBC4; // type:func -EnPoh_UpdateVisibility = 0x8086CC5C; // type:func -EnPoh_Update = 0x8086CDCC; // type:func -func_80AE067C = 0x8086CF18; // type:func -func_80AE089C = 0x8086D138; // type:func -EnPoh_UpdateLiving = 0x8086D2B8; // type:func -EnPoh_OverrideLimbDraw = 0x8086D498; // type:func -EnPoh_PostLimbDraw = 0x8086D58C; // type:func -EnPoh_DrawRegular = 0x8086D77C; // type:func -EnPoh_DrawComposer = 0x8086D9A4; // type:func -EnPoh_UpdateDead = 0x8086DE20; // type:func -EnPoh_DrawSoul = 0x8086DE74; // type:func -EnOkuta_Init = 0x8086E790; // type:func -EnOkuta_Destroy = 0x8086E99C; // type:func -EnOkuta_SpawnBubbles = 0x8086E9C8; // type:func -EnOkuta_SpawnDust = 0x8086EA74; // type:func -EnOkuta_SpawnSplash = 0x8086EADC; // type:func -EnOkuta_SpawnRipple = 0x8086EB20; // type:func -EnOkuta_SetupWaitToAppear = 0x8086EBC4; // type:func -EnOkuta_SetupAppear = 0x8086EBF4; // type:func -EnOkuta_SetupHide = 0x8086EC64; // type:func -EnOkuta_SetupWaitToShoot = 0x8086ECA4; // type:func -EnOkuta_SetupShoot = 0x8086ED04; // type:func -EnOkuta_SetupWaitToDie = 0x8086EDF0; // type:func -EnOkuta_SetupDie = 0x8086EE78; // type:func -EnOkuta_SetupFreeze = 0x8086EEC0; // type:func -EnOkuta_SpawnProjectile = 0x8086EF0C; // type:func -EnOkuta_WaitToAppear = 0x8086F04C; // type:func -EnOkuta_Appear = 0x8086F0A8; // type:func -EnOkuta_Hide = 0x8086F1EC; // type:func -EnOkuta_WaitToShoot = 0x8086F2EC; // type:func -EnOkuta_Shoot = 0x8086F41C; // type:func -EnOkuta_WaitToDie = 0x8086F59C; // type:func -EnOkuta_Die = 0x8086F5F0; // type:func -EnOkuta_Freeze = 0x8086F904; // type:func -EnOkuta_ProjectileFly = 0x8086FA80; // type:func -EnOkuta_UpdateHeadScale = 0x8086FCCC; // type:func -EnOkuta_ColliderCheck = 0x80870074; // type:func -EnOkuta_Update = 0x80870124; // type:func -EnOkuta_GetSnoutScale = 0x808704A4; // type:func -EnOkuta_OverrideLimbDraw = 0x8087072C; // type:func -EnOkuta_Draw = 0x80870828; // type:func -EnBom_SetupAction = 0x80870D70; // type:func -EnBom_Init = 0x80870D7C; // type:func -EnBom_Destroy = 0x80870E94; // type:func -EnBom_Move = 0x80870ED4; // type:func -EnBom_WaitForRelease = 0x808710A4; // type:func -EnBom_Explode = 0x808710F0; // type:func -EnBom_Update = 0x80871240; // type:func -EnBom_Draw = 0x808718D0; // type:func -EnWallmas_Init = 0x80871C40; // type:func -EnWallmas_Destroy = 0x80871D80; // type:func -EnWallmas_TimerInit = 0x80871DAC; // type:func -EnWallmas_SetupDrop = 0x80871E08; // type:func -EnWallmas_SetupLand = 0x80871ECC; // type:func -EnWallmas_SetupStand = 0x80871F90; // type:func -EnWallmas_SetupWalk = 0x80871FD0; // type:func -EnWallmas_SetupJumpToCeiling = 0x80872020; // type:func -EnWallmas_SetupReturnToCeiling = 0x80872068; // type:func -EnWallmas_SetupTakeDamage = 0x808720EC; // type:func -EnWallmas_SetupCooldown = 0x808721A8; // type:func -EnWallmas_SetupDie = 0x808721FC; // type:func -EnWallmas_SetupTakePlayer = 0x808722C4; // type:func -EnWallmas_ProximityOrSwitchInit = 0x8087234C; // type:func -EnWallmas_SetupStun = 0x80872394; // type:func -EnWallmas_WaitToDrop = 0x80872464; // type:func -EnWallmas_Drop = 0x80872570; // type:func -EnWallmas_Land = 0x8087263C; // type:func -EnWallmas_Stand = 0x80872678; // type:func -EnWallmas_Walk = 0x808726D8; // type:func -EnWallmas_JumpToCeiling = 0x8087278C; // type:func -EnWallmas_ReturnToCeiling = 0x808727C8; // type:func -EnWallmas_TakeDamage = 0x808728E4; // type:func -EnWallmas_Cooldown = 0x80872978; // type:func -EnWallmas_Die = 0x808729B4; // type:func -EnWallmas_TakePlayer = 0x80872A28; // type:func -EnWallmas_WaitForProximity = 0x80872C4C; // type:func -EnWallmas_WaitForSwitchFlag = 0x80872CA8; // type:func -EnWallmas_Stun = 0x80872CF4; // type:func -EnWallmas_ColUpdate = 0x80872D68; // type:func -EnWallmas_Update = 0x80872E84; // type:func -EnWallmas_DrawXlu = 0x8087304C; // type:func -EnWallMas_OverrideLimbDraw = 0x808731EC; // type:func -EnWallMas_PostLimbDraw = 0x80873260; // type:func -EnWallmas_Draw = 0x80873350; // type:func -EnDodongo_SetupAction = 0x80873650; // type:func -EnDodongo_SpawnBombSmoke = 0x8087365C; // type:func -EnDodongo_Init = 0x80873B4C; // type:func -EnDodongo_Destroy = 0x80873D74; // type:func -EnDodongo_SetupIdle = 0x80873DD4; // type:func -EnDodongo_SetupWalk = 0x80873E3C; // type:func -EnDodongo_SetupBreatheFire = 0x80873EE0; // type:func -EnDodongo_SetupEndBreatheFire = 0x80873F34; // type:func -EnDodongo_SetupSwallowBomb = 0x80873F84; // type:func -EnDodongo_SetupStunned = 0x80874004; // type:func -EnDodongo_Idle = 0x8087409C; // type:func -EnDodongo_EndBreatheFire = 0x80874114; // type:func -EnDodongo_BreatheFire = 0x80874164; // type:func -EnDodongo_SwallowBomb = 0x8087433C; // type:func -EnDodongo_Walk = 0x80874834; // type:func -EnDodongo_SetupSweepTail = 0x80874B74; // type:func -EnDodongo_SweepTail = 0x80874BD4; // type:func -EnDodongo_SetupDeath = 0x80874E98; // type:func -EnDodongo_Death = 0x80874F10; // type:func -EnDodongo_Stunned = 0x8087505C; // type:func -EnDodongo_CollisionCheck = 0x808750C0; // type:func -EnDodongo_UpdateQuad = 0x808751E8; // type:func -EnDodongo_Update = 0x80875354; // type:func -EnDodongo_OverrideLimbDraw = 0x80875520; // type:func -EnDodongo_PostLimbDraw = 0x80875574; // type:func -EnDodongo_Draw = 0x808759B0; // type:func -EnDodongo_ShiftVecRadial = 0x80875AA0; // type:func -EnDodongo_AteBomb = 0x80875B00; // type:func -EnFirefly_Extinguish = 0x808763F0; // type:func -EnFirefly_Ignite = 0x8087641C; // type:func -EnFirefly_Init = 0x8087645C; // type:func -EnFirefly_Destroy = 0x80876654; // type:func -EnFirefly_SetupFlyIdle = 0x80876680; // type:func -EnFirefly_SetupFall = 0x8087672C; // type:func -EnFirefly_SetupDie = 0x808767D0; // type:func -EnFirefly_SetupRebound = 0x808767F4; // type:func -EnFirefly_SetupDiveAttack = 0x80876830; // type:func -EnFirefly_SetupFlyAway = 0x808768A0; // type:func -EnFirefly_SetupStunned = 0x808768D0; // type:func -EnFirefly_SetupFrozenFall = 0x80876940; // type:func -EnFirefly_SetupPerch = 0x80876AE0; // type:func -EnFirefly_SetupDisturbDiveAttack = 0x80876B04; // type:func -EnFirefly_ReturnToPerch = 0x80876B40; // type:func -EnFirefly_SeekTorch = 0x80876C5C; // type:func -EnFirefly_FlyIdle = 0x80876DAC; // type:func -EnFirefly_Fall = 0x8087703C; // type:func -EnFirefly_Die = 0x8087710C; // type:func -EnFirefly_DiveAttack = 0x80877188; // type:func -EnFirefly_Rebound = 0x8087739C; // type:func -EnFirefly_FlyAway = 0x80877430; // type:func -EnFirefly_Stunned = 0x80877598; // type:func -EnFirefly_FrozenFall = 0x8087763C; // type:func -EnFirefly_Perch = 0x8087769C; // type:func -EnFirefly_DisturbDiveAttack = 0x8087775C; // type:func -EnFirefly_Combust = 0x80877834; // type:func -EnFirefly_UpdateDamage = 0x808778B4; // type:func -EnFirefly_Update = 0x80877A64; // type:func -EnFirefly_OverrideLimbDraw = 0x80877D0C; // type:func -EnFirefly_PostLimbDraw = 0x80877D60; // type:func -EnFirefly_Draw = 0x808780F0; // type:func -EnFirefly_DrawInvisible = 0x808781A4; // type:func -EnHorse_BgCheckBridgeJumpPoint = 0x80878560; // type:func -EnHorse_CheckBridgeJumps = 0x808786C0; // type:func -EnHorse_RaceWaypointPos = 0x80878800; // type:func -EnHorse_RotateToPoint = 0x80878854; // type:func -EnHorse_UpdateIngoRaceInfo = 0x80878890; // type:func -EnHorse_PlayWalkingSfx = 0x80878C44; // type:func -EnHorse_PlayTrottingSfx = 0x80878D00; // type:func -EnHorse_PlayGallopingSfx = 0x80878D48; // type:func -EnHorse_SlopeSpeedMultiplier = 0x80878D90; // type:func -func_80A5BB90 = 0x80878E10; // type:func -func_80A5BBBC = 0x80878E40; // type:func -EnHorse_IdleAnimSounds = 0x80878EF0; // type:func -EnHorse_Spawn = 0x8087901C; // type:func -EnHorse_ResetCutscene = 0x80879260; // type:func -EnHorse_ResetRace = 0x80879278; // type:func -EnHorse_PlayerCanMove = 0x80879288; // type:func -EnHorse_ResetHorsebackArchery = 0x80879344; // type:func -EnHorse_ClearDustFlags = 0x8087935C; // type:func -EnHorse_Init = 0x80879368; // type:func -EnHorse_Destroy = 0x80879A98; // type:func -EnHorse_RotateToPlayer = 0x80879B08; // type:func -EnHorse_Freeze = 0x80879B78; // type:func -EnHorse_Frozen = 0x80879BF8; // type:func -EnHorse_UpdateSpeed = 0x80879D68; // type:func -EnHorse_StartMountedIdleResetAnim = 0x8087A1AC; // type:func -EnHorse_StartMountedIdle = 0x8087A1E8; // type:func -EnHorse_MountedIdle = 0x8087A324; // type:func -EnHorse_MountedIdleAnim = 0x8087A424; // type:func -EnHorse_MountedIdleWhinney = 0x8087A448; // type:func -EnHorse_MountedIdleWhinneying = 0x8087A544; // type:func -EnHorse_StartTurning = 0x8087A644; // type:func -EnHorse_MountedTurn = 0x8087A6EC; // type:func -EnHorse_StartWalkingFromIdle = 0x8087A8B0; // type:func -EnHorse_StartWalkingInterruptable = 0x8087A900; // type:func -EnHorse_StartWalking = 0x8087A924; // type:func -EnHorse_MountedWalkingReset = 0x8087A9D0; // type:func -EnHorse_MountedWalk = 0x8087AA24; // type:func -EnHorse_StartTrotting = 0x8087ACF4; // type:func -EnHorse_MountedTrotReset = 0x8087AD98; // type:func -EnHorse_MountedTrot = 0x8087ADE4; // type:func -EnHorse_StartGallopingInterruptable = 0x8087AF1C; // type:func -EnHorse_StartGalloping = 0x8087AF40; // type:func -EnHorse_MountedGallopReset = 0x8087AFE8; // type:func -EnHorse_JumpLanding = 0x8087B040; // type:func -EnHorse_MountedGallop = 0x8087B0C4; // type:func -EnHorse_StartRearing = 0x8087B298; // type:func -EnHorse_MountedRearing = 0x8087B3BC; // type:func -EnHorse_StartBraking = 0x8087B538; // type:func -EnHorse_Stopping = 0x8087B628; // type:func -EnHorse_StartReversingInterruptable = 0x8087B814; // type:func -EnHorse_StartReversing = 0x8087B838; // type:func -EnHorse_Reverse = 0x8087B8DC; // type:func -EnHorse_LowJumpInit = 0x8087BC8C; // type:func -EnHorse_StartLowJump = 0x8087BCB0; // type:func -EnHorse_Stub1 = 0x8087BDE0; // type:func -EnHorse_LowJump = 0x8087BDEC; // type:func -EnHorse_HighJumpInit = 0x8087BFB0; // type:func -EnHorse_StartHighJump = 0x8087BFD4; // type:func -EnHorse_Stub2 = 0x8087C110; // type:func -EnHorse_HighJump = 0x8087C11C; // type:func -EnHorse_InitInactive = 0x8087C2E0; // type:func -EnHorse_Inactive = 0x8087C330; // type:func -EnHorse_PlayIdleAnimation = 0x8087C45C; // type:func -EnHorse_ChangeIdleAnimation = 0x8087C62C; // type:func -EnHorse_ResetIdleAnimation = 0x8087C654; // type:func -EnHorse_StartIdleRidable = 0x8087C688; // type:func -EnHorse_Idle = 0x8087C6BC; // type:func -EnHorse_StartMovingAnimation = 0x8087C8A4; // type:func -EnHorse_SetFollowAnimation = 0x8087CA0C; // type:func -EnHorse_FollowPlayer = 0x8087CB40; // type:func -EnHorse_InitIngoHorse = 0x8087CF64; // type:func -EnHorse_SetIngoAnimation = 0x8087CFE8; // type:func -EnHorse_UpdateIngoHorseAnim = 0x8087D08C; // type:func -EnHorse_UpdateIngoRace = 0x8087D3A0; // type:func -EnHorse_CsMoveInit = 0x8087D550; // type:func -EnHorse_CsMoveToPoint = 0x8087D5BC; // type:func -EnHorse_CsSetAnimHighJump = 0x8087D70C; // type:func -EnHorse_CsPlayHighJumpAnim = 0x8087D730; // type:func -EnHorse_CsJumpInit = 0x8087D864; // type:func -EnHorse_CsJump = 0x8087D89C; // type:func -EnHorse_CsRearingInit = 0x8087DAF4; // type:func -EnHorse_CsRearing = 0x8087DC14; // type:func -EnHorse_WarpMoveInit = 0x8087DDBC; // type:func -EnHorse_CsWarpMoveToPoint = 0x8087DEA4; // type:func -EnHorse_CsWarpRearingInit = 0x8087DFF4; // type:func -EnHorse_CsWarpRearing = 0x8087E17C; // type:func -EnHorse_InitCutscene = 0x8087E324; // type:func -EnHorse_GetCutsceneFunctionIndex = 0x8087E348; // type:func -EnHorse_CutsceneUpdate = 0x8087E398; // type:func -EnHorse_UpdateHbaRaceInfo = 0x8087E4F0; // type:func -EnHorse_InitHorsebackArchery = 0x8087E6E0; // type:func -EnHorse_UpdateHbaAnim = 0x8087E714; // type:func -EnHorse_UpdateHorsebackArchery = 0x8087EA4C; // type:func -EnHorse_InitFleePlayer = 0x8087ECD8; // type:func -EnHorse_FleePlayer = 0x8087ED00; // type:func -EnHorse_BridgeJumpInit = 0x8087F554; // type:func -EnHorse_StartBridgeJump = 0x8087F78C; // type:func -EnHorse_BridgeJumpMove = 0x8087F83C; // type:func -EnHorse_CheckBridgeJumpLanding = 0x8087F998; // type:func -EnHorse_BridgeJump = 0x8087FA84; // type:func -EnHorse_Vec3fOffset = 0x8087FAC8; // type:func -EnHorse_CalcFloorHeight = 0x8087FB44; // type:func -EnHorse_ObstructMovement = 0x8087FC84; // type:func -EnHorse_CheckFloors = 0x8087FDAC; // type:func -EnHorse_MountDismount = 0x8088032C; // type:func -EnHorse_StickDirection = 0x80880430; // type:func -EnHorse_UpdateStick = 0x808804BC; // type:func -EnHorse_ResolveCollision = 0x808804FC; // type:func -EnHorse_BgCheckSlowMoving = 0x80880654; // type:func -EnHorse_UpdateBgCheckInfo = 0x80880794; // type:func -EnHorse_CheckBoost = 0x808812A0; // type:func -EnHorse_RegenBoost = 0x8088144C; // type:func -EnHorse_UpdatePlayerDir = 0x80881678; // type:func -EnHorse_TiltBody = 0x80881784; // type:func -EnHorse_UpdateConveyors = 0x80881880; // type:func -EnHorse_RandInt = 0x80881988; // type:func -EnHorse_Update = 0x808819BC; // type:func -EnHorse_PlayerDirToMountSide = 0x808821E8; // type:func -EnHorse_MountSideCheck = 0x80882228; // type:func -EnHorse_GetMountSide = 0x8088232C; // type:func -EnHorse_RandomOffset = 0x80882384; // type:func -EnHorse_PostDraw = 0x80882420; // type:func -EnHorse_OverrideLimbDraw = 0x80882F18; // type:func -EnHorse_Draw = 0x80883018; // type:func -EnArrow_SetupAction = 0x808847C0; // type:func -EnArrow_Init = 0x808847CC; // type:func -EnArrow_Destroy = 0x808849D4; // type:func -EnArrow_Shoot = 0x80884A5C; // type:func -func_809B3CEC = 0x80884B74; // type:func -EnArrow_CarryActor = 0x80884C5C; // type:func -EnArrow_Fly = 0x80884E60; // type:func -func_809B45E0 = 0x80885468; // type:func -func_809B4640 = 0x808854C8; // type:func -EnArrow_Update = 0x80885530; // type:func -func_809B4800 = 0x8088568C; // type:func -EnArrow_Draw = 0x808857F4; // type:func -EnElf_SetupAction = 0x80885EC0; // type:func -func_80A01C38 = 0x80885ECC; // type:func -func_80A01F90 = 0x80886224; // type:func -func_80A01FE0 = 0x80886278; // type:func -func_80A020A4 = 0x80886340; // type:func -func_80A0214C = 0x808863EC; // type:func -func_80A0232C = 0x808865CC; // type:func -EnElf_GetColorValue = 0x80886644; // type:func -EnElf_Init = 0x808866B4; // type:func -func_80A0299C = 0x80886C20; // type:func -func_80A029A8 = 0x80886C30; // type:func -EnElf_Destroy = 0x80886C58; // type:func -func_80A02A20 = 0x80886CA8; // type:func -func_80A02AA4 = 0x80886D2C; // type:func -func_80A02B38 = 0x80886DC0; // type:func -func_80A02BD8 = 0x80886E5C; // type:func -func_80A02C98 = 0x80886F1C; // type:func -func_80A02E30 = 0x808870B4; // type:func -func_80A02EC0 = 0x80887140; // type:func -func_80A02F2C = 0x808871AC; // type:func -func_80A03018 = 0x80887298; // type:func -func_80A03148 = 0x808873CC; // type:func -func_80A0329C = 0x80887524; // type:func -func_80A0353C = 0x808877C8; // type:func -func_80A03604 = 0x80887890; // type:func -func_80A03610 = 0x808878A0; // type:func -func_80A03814 = 0x80887AA8; // type:func -func_80A03990 = 0x80887C28; // type:func -func_80A03AB0 = 0x80887D4C; // type:func -EnElf_UpdateLights = 0x80887DB0; // type:func -func_80A03CF8 = 0x80887F84; // type:func -EnElf_ChangeColor = 0x8088861C; // type:func -func_80A04414 = 0x808886A8; // type:func -func_80A0461C = 0x808888B4; // type:func -EnElf_SpawnSparkles = 0x80888C50; // type:func -func_80A04D90 = 0x80889030; // type:func -func_80A04DE4 = 0x80889084; // type:func -func_80A04F94 = 0x80889238; // type:func -func_80A05040 = 0x808892E8; // type:func -func_80A05114 = 0x808893C4; // type:func -func_80A05188 = 0x80889440; // type:func -func_80A05208 = 0x808894C8; // type:func -func_80A052F4 = 0x808895BC; // type:func -func_80A053F0 = 0x808896C0; // type:func -EnElf_Update = 0x8088993C; // type:func -EnElf_OverrideLimbDraw = 0x80889998; // type:func -EnElf_Draw = 0x80889ABC; // type:func -EnElf_GetCuePos = 0x8088A134; // type:func -EnNiw_Init = 0x8088A880; // type:func -EnNiw_Destroy = 0x8088AD84; // type:func -func_80AB5BF8 = 0x8088ADB0; // type:func -EnNiw_SpawnAttackCucco = 0x8088B158; // type:func -func_80AB6100 = 0x8088B2A0; // type:func -EnNiw_ResetAction = 0x8088B41C; // type:func -func_80AB6324 = 0x8088B4C4; // type:func -func_80AB63A8 = 0x8088B548; // type:func -func_80AB6450 = 0x8088B5F0; // type:func -func_80AB6570 = 0x8088B710; // type:func -func_80AB6A38 = 0x8088BBDC; // type:func -func_80AB6BF8 = 0x8088BD9C; // type:func -func_80AB6D08 = 0x8088BEAC; // type:func -func_80AB6EB4 = 0x8088C058; // type:func -func_80AB6F04 = 0x8088C0A8; // type:func -func_80AB70A0 = 0x8088C248; // type:func -func_80AB70F8 = 0x8088C2A0; // type:func -func_80AB714C = 0x8088C2F4; // type:func -func_80AB7204 = 0x8088C3AC; // type:func -func_80AB7290 = 0x8088C43C; // type:func -func_80AB7328 = 0x8088C4D4; // type:func -func_80AB7420 = 0x8088C5D0; // type:func -func_80AB747C = 0x8088C62C; // type:func -EnNiw_Update = 0x8088C6E4; // type:func -EnNiw_OverrideLimbDraw = 0x8088CF90; // type:func -EnNiw_Draw = 0x8088D0E8; // type:func -EnNiw_SpawnFeather = 0x8088D198; // type:func -EnNiw_UpdateEffects = 0x8088D288; // type:func -EnNiw_DrawEffects = 0x8088D43C; // type:func -EnTite_SetupAction = 0x8088DBB0; // type:func -EnTite_Init = 0x8088DBBC; // type:func -EnTite_Destroy = 0x8088DD14; // type:func -EnTite_SetupIdle = 0x8088DD5C; // type:func -EnTite_Idle = 0x8088DDC4; // type:func -EnTite_SetupAttack = 0x8088DF08; // type:func -EnTite_Attack = 0x8088DF7C; // type:func -EnTite_SetupTurnTowardPlayer = 0x8088E624; // type:func -EnTite_TurnTowardPlayer = 0x8088E6C0; // type:func -EnTite_SetupMoveTowardPlayer = 0x8088E95C; // type:func -EnTite_MoveTowardPlayer = 0x8088EA18; // type:func -EnTite_SetupRecoil = 0x8088EF28; // type:func -EnTite_Recoil = 0x8088EF94; // type:func -EnTite_SetupStunned = 0x8088F2EC; // type:func -EnTite_Stunned = 0x8088F3A0; // type:func -EnTite_SetupDeathCry = 0x8088F73C; // type:func -EnTite_DeathCry = 0x8088F770; // type:func -EnTite_FallApart = 0x8088F7E4; // type:func -EnTite_SetupFlipOnBack = 0x8088F870; // type:func -EnTite_FlipOnBack = 0x8088F98C; // type:func -EnTite_SetupFlipUpright = 0x8088FB48; // type:func -EnTite_FlipUpright = 0x8088FB98; // type:func -EnTite_CheckDamage = 0x8088FCC0; // type:func -EnTite_Update = 0x8088FE98; // type:func -EnTite_PostLimbDraw = 0x80890284; // type:func -EnTite_Draw = 0x80890374; // type:func -EnReeba_Init = 0x80890950; // type:func -EnReeba_Destroy = 0x80890B2C; // type:func -EnReeba_SetupSurface = 0x80890BA4; // type:func -EnReeba_Surface = 0x80890CB8; // type:func -EnReeba_Move = 0x80890ED8; // type:func -EnReeba_SetupMoveBig = 0x80890FF4; // type:func -EnReeba_MoveBig = 0x80891018; // type:func -EnReeba_Recoiled = 0x80891288; // type:func -EnReeba_SetupSink = 0x808912F4; // type:func -EnReeba_Sink = 0x8089134C; // type:func -EnReeba_SetupDamaged = 0x8089145C; // type:func -EnReeba_Damaged = 0x808914C0; // type:func -EnReeba_SetupStunned = 0x80891558; // type:func -EnReeba_Stunned = 0x808915A8; // type:func -EnReeba_StunDie = 0x8089170C; // type:func -EnReeba_SetupDie = 0x80891834; // type:func -EnReeba_Die = 0x808918A8; // type:func -EnReeba_StunRecover = 0x80891A88; // type:func -EnReeba_CheckDamage = 0x80891B1C; // type:func -EnReeba_Update = 0x80891D58; // type:func -EnReeba_Draw = 0x80892008; // type:func -EnPeehat_SetupAction = 0x808923C0; // type:func -EnPeehat_Init = 0x808923CC; // type:func -EnPeehat_Destroy = 0x8089263C; // type:func -EnPeehat_SpawnDust = 0x808926B0; // type:func -EnPeehat_HitWhenGrounded = 0x80892848; // type:func -EnPeehat_Ground_SetStateGround = 0x80892A64; // type:func -EnPeehat_Ground_StateGround = 0x80892AFC; // type:func -EnPeehat_Flying_SetStateGround = 0x80892C50; // type:func -EnPeehat_Flying_StateGrounded = 0x80892CDC; // type:func -EnPeehat_Flying_SetStateFly = 0x80892DE0; // type:func -EnPeehat_Flying_StateFly = 0x80892E28; // type:func -EnPeehat_Ground_SetStateRise = 0x80892FA0; // type:func -EnPeehat_Ground_StateRise = 0x80893048; // type:func -EnPeehat_Flying_SetStateRise = 0x80893210; // type:func -EnPeehat_Flying_StateRise = 0x808932B8; // type:func -EnPeehat_Ground_SetStateSeekPlayer = 0x80893480; // type:func -EnPeehat_Ground_StateSeekPlayer = 0x808934D0; // type:func -EnPeehat_Larva_SetStateSeekPlayer = 0x8089364C; // type:func -EnPeehat_Larva_StateSeekPlayer = 0x80893698; // type:func -EnPeehat_Ground_SetStateLanding = 0x80893A70; // type:func -EnPeehat_Ground_StateLanding = 0x80893AB8; // type:func -EnPeehat_Flying_SetStateLanding = 0x80893C6C; // type:func -EnPeehat_Flying_StateLanding = 0x80893CB4; // type:func -EnPeehat_Ground_SetStateHover = 0x80893E64; // type:func -EnPeehat_Ground_StateHover = 0x80893EF4; // type:func -EnPeehat_Ground_SetStateReturnHome = 0x80894150; // type:func -EnPeehat_Ground_StateReturnHome = 0x80894188; // type:func -EnPeehat_SetStateAttackRecoil = 0x80894374; // type:func -EnPeehat_StateAttackRecoil = 0x808943D4; // type:func -EnPeehat_SetStateBoomerangStunned = 0x808945B0; // type:func -EnPeehat_StateBoomerangStunned = 0x80894634; // type:func -EnPeehat_Adult_SetStateDie = 0x808946B0; // type:func -EnPeehat_Adult_StateDie = 0x8089471C; // type:func -EnPeehat_SetStateExplode = 0x808949DC; // type:func -EnPeehat_StateExplode = 0x80894A34; // type:func -EnPeehat_Adult_CollisionCheck = 0x80894B0C; // type:func -EnPeehat_Update = 0x80894CF8; // type:func -EnPeehat_OverrideLimbDraw = 0x8089515C; // type:func -EnPeehat_PostLimbDraw = 0x80895334; // type:func -EnPeehat_Draw = 0x808954E8; // type:func -EnHoll_SetupAction = 0x80895AC0; // type:func -EnHoll_IsKokiriLayer8 = 0x80895ACC; // type:func -EnHoll_ChooseAction = 0x80895AFC; // type:func -EnHoll_Init = 0x80895B64; // type:func -EnHoll_Destroy = 0x80895BA0; // type:func -EnHoll_SwapRooms = 0x80895BD0; // type:func -EnHoll_HorizontalVisibleNarrow = 0x80895C8C; // type:func -EnHoll_HorizontalInvisible = 0x80895ECC; // type:func -EnHoll_VerticalDownBgCoverLarge = 0x8089607C; // type:func -EnHoll_VerticalBgCover = 0x80896268; // type:func -EnHoll_VerticalInvisible = 0x808963E8; // type:func -EnHoll_HorizontalBgCoverSwitchFlag = 0x808964E0; // type:func -EnHoll_WaitRoomLoaded = 0x808966F0; // type:func -EnHoll_Update = 0x80896768; // type:func -EnHoll_Draw = 0x8089678C; // type:func -EnSceneChange_SetupAction = 0x80896A90; // type:func -EnSceneChange_Init = 0x80896A9C; // type:func -EnSceneChange_Destroy = 0x80896AC4; // type:func -EnSceneChange_DoNothing = 0x80896AD4; // type:func -EnSceneChange_Update = 0x80896AE4; // type:func -EnSceneChange_Draw = 0x80896B08; // type:func -EnZf_SetupAction = 0x80896BC0; // type:func -EnZf_PrimaryFloorCheck = 0x80896BCC; // type:func -EnZf_SecondaryFloorCheck = 0x80896D3C; // type:func -EnZf_Init = 0x80896E6C; // type:func -EnZf_Destroy = 0x808971A4; // type:func -EnZf_FindPlatform = 0x80897228; // type:func -EnZf_FindNextPlatformAwayFromPlayer = 0x808973F0; // type:func -EnZf_FindNextPlatformTowardsPlayer = 0x80897694; // type:func -EnZf_CanAttack = 0x80897870; // type:func -func_80B44DC4 = 0x80897944; // type:func -EnZf_ChooseAction = 0x80897A10; // type:func -EnZf_SetupDropIn = 0x80897C30; // type:func -EnZf_DropIn = 0x80897CF8; // type:func -func_80B45384 = 0x80897F08; // type:func -func_80B4543C = 0x80897FC0; // type:func -EnZf_SetupApproachPlayer = 0x8089823C; // type:func -EnZf_ApproachPlayer = 0x808982D0; // type:func -EnZf_SetupJumpForward = 0x808989BC; // type:func -EnZf_JumpForward = 0x80898A7C; // type:func -func_80B4604C = 0x80898BD8; // type:func -func_80B46098 = 0x80898C24; // type:func -func_80B462E4 = 0x80898E70; // type:func -func_80B463E4 = 0x80898F78; // type:func -EnZf_SetupSlash = 0x808995BC; // type:func -EnZf_Slash = 0x80899678; // type:func -EnZf_SetupRecoilFromBlockedSlash = 0x80899904; // type:func -EnZf_RecoilFromBlockedSlash = 0x80899978; // type:func -EnZf_SetupJumpBack = 0x80899A30; // type:func -EnZf_JumpBack = 0x80899AD0; // type:func -EnZf_SetupStunned = 0x80899BF4; // type:func -EnZf_Stunned = 0x80899CC4; // type:func -EnZf_SetupSheatheSword = 0x80899F04; // type:func -EnZf_SheatheSword = 0x80899FE0; // type:func -EnZf_SetupHopAndTaunt = 0x8089A08C; // type:func -EnZf_HopAndTaunt = 0x8089A0EC; // type:func -EnZf_SetupHopAway = 0x8089A344; // type:func -EnZf_HopAway = 0x8089A3C4; // type:func -EnZf_SetupDrawSword = 0x8089A810; // type:func -EnZf_DrawSword = 0x8089A8A4; // type:func -EnZf_SetupDamaged = 0x8089A954; // type:func -EnZf_Damaged = 0x8089AA60; // type:func -EnZf_SetupJumpUp = 0x8089ADC0; // type:func -EnZf_JumpUp = 0x8089AE68; // type:func -func_80B483E4 = 0x8089AF94; // type:func -EnZf_CircleAroundPlayer = 0x8089B130; // type:func -EnZf_SetupDie = 0x8089B8B0; // type:func -EnZf_Die = 0x8089BA14; // type:func -EnZf_UpdateHeadRotation = 0x8089BB54; // type:func -EnZf_UpdateDamage = 0x8089BC78; // type:func -EnZf_Update = 0x8089BE10; // type:func -EnZf_OverrideLimbDraw = 0x8089C1C8; // type:func -EnZf_PostLimbDraw = 0x8089C254; // type:func -EnZf_Draw = 0x8089C4A8; // type:func -EnZf_SetupCircleAroundPlayer = 0x8089C6F4; // type:func -EnZf_DodgeRangedEngaging = 0x8089C7C0; // type:func -EnZf_DodgeRangedWaiting = 0x8089C9EC; // type:func -EnHata_Init = 0x8089D6B0; // type:func -EnHata_Destroy = 0x8089D7E8; // type:func -EnHata_Update = 0x8089D830; // type:func -EnHata_OverrideLimbDraw = 0x8089DA4C; // type:func -EnHata_PostLimbDraw = 0x8089DAD0; // type:func -EnHata_Draw = 0x8089DAE8; // type:func -func_808C1190 = 0x8089DC40; // type:func -func_808C11D0 = 0x8089DC80; // type:func -func_808C1200 = 0x8089DCB0; // type:func -func_808C1230 = 0x8089DCE0; // type:func -func_808C1278 = 0x8089DD28; // type:func -func_808C12C4 = 0x8089DD74; // type:func -func_808C1554 = 0x8089E004; // type:func -func_808C17C8 = 0x8089E284; // type:func -BossDodongo_AteExplosive = 0x8089E36C; // type:func -BossDodongo_Init = 0x8089E42C; // type:func -BossDodongo_Destroy = 0x8089E708; // type:func -BossDodongo_SetupIntroCutscene = 0x8089E748; // type:func -BossDodongo_IntroCutscene = 0x8089E7C8; // type:func -BossDodongo_SetupDamaged = 0x8089F344; // type:func -BossDodongo_SetupExplode = 0x8089F3D8; // type:func -BossDodongo_SetupWalk = 0x8089F47C; // type:func -BossDodongo_SetupRoll = 0x8089F50C; // type:func -BossDodongo_SetupBlowFire = 0x8089F580; // type:func -BossDodongo_SetupInhale = 0x8089F608; // type:func -BossDodongo_Damaged = 0x8089F698; // type:func -BossDodongo_Explode = 0x8089F74C; // type:func -BossDodongo_LayDown = 0x8089F9A0; // type:func -BossDodongo_Vulnerable = 0x8089FA80; // type:func -BossDodongo_GetUp = 0x8089FB6C; // type:func -BossDodongo_BlowFire = 0x8089FBD0; // type:func -BossDodongo_Inhale = 0x8089FD00; // type:func -BossDodongo_Walk = 0x8089FDD4; // type:func -BossDodongo_Roll = 0x808A01E4; // type:func -BossDodongo_Update = 0x808A05E0; // type:func -BossDodongo_OverrideLimbDraw = 0x808A1420; // type:func -BossDodongo_PostLimbDraw = 0x808A1644; // type:func -BossDodongo_Draw = 0x808A1728; // type:func -func_808C4F6C = 0x808A19F0; // type:func -func_808C50A8 = 0x808A1B2C; // type:func -BossDodongo_PlayerYawCheck = 0x808A1C78; // type:func -BossDodongo_PlayerPosCheck = 0x808A1CD4; // type:func -BossDodongo_SpawnFire = 0x808A1D68; // type:func -BossDodongo_UpdateDamage = 0x808A1DDC; // type:func -BossDodongo_SetupDeathCutscene = 0x808A1F48; // type:func -BossDodongo_DeathCutscene = 0x808A2000; // type:func -BossDodongo_UpdateEffects = 0x808A3740; // type:func -BossDodongo_DrawEffects = 0x808A3874; // type:func -BossGoma_ClearPixels16x16Rgba16 = 0x808A7740; // type:func -BossGoma_ClearPixels32x32Rgba16 = 0x808A7770; // type:func -BossGoma_ClearPixels = 0x808A77C4; // type:func -BossGoma_Init = 0x808A7974; // type:func -BossGoma_PlayEffectsAndSfx = 0x808A7B2C; // type:func -BossGoma_Destroy = 0x808A7C34; // type:func -BossGoma_SetupDefeated = 0x808A7C74; // type:func -BossGoma_SetupEncounter = 0x808A7D3C; // type:func -BossGoma_SetupFloorIdle = 0x808A7DE0; // type:func -BossGoma_SetupCeilingIdle = 0x808A7E68; // type:func -BossGoma_SetupFallJump = 0x808A7EEC; // type:func -BossGoma_SetupFallStruckDown = 0x808A7F68; // type:func -BossGoma_SetupCeilingSpawnGohmas = 0x808A7FE4; // type:func -BossGoma_SetupCeilingPrepareSpawnGohmas = 0x808A8058; // type:func -BossGoma_SetupWallClimb = 0x808A80D0; // type:func -BossGoma_SetupCeilingMoveToCenter = 0x808A8154; // type:func -BossGoma_SetupFloorMain = 0x808A81E8; // type:func -BossGoma_SetupFloorLand = 0x808A8268; // type:func -BossGoma_SetupFloorLandStruckDown = 0x808A82F4; // type:func -BossGoma_SetupFloorStunned = 0x808A8398; // type:func -BossGoma_SetupFloorAttackPosture = 0x808A8408; // type:func -BossGoma_SetupFloorPrepareAttack = 0x808A847C; // type:func -BossGoma_SetupFloorAttack = 0x808A84F0; // type:func -BossGoma_SetupFloorDamaged = 0x808A856C; // type:func -BossGoma_UpdateCeilingMovement = 0x808A85E0; // type:func -BossGoma_SetupEncounterState4 = 0x808A881C; // type:func -BossGoma_Encounter = 0x808A89CC; // type:func -BossGoma_Defeated = 0x808A9AC4; // type:func -BossGoma_FloorAttackPosture = 0x808AA934; // type:func -BossGoma_FloorPrepareAttack = 0x808AAA3C; // type:func -BossGoma_FloorAttack = 0x808AAA98; // type:func -BossGoma_FloorDamaged = 0x808AACE8; // type:func -BossGoma_FloorLandStruckDown = 0x808AAD80; // type:func -BossGoma_FloorLand = 0x808AAE24; // type:func -BossGoma_FloorStunned = 0x808AAE80; // type:func -BossGoma_FallJump = 0x808AAFAC; // type:func -BossGoma_FallStruckDown = 0x808AB060; // type:func -BossGoma_CeilingSpawnGohmas = 0x808AB120; // type:func -BossGoma_CeilingPrepareSpawnGohmas = 0x808AB27C; // type:func -BossGoma_FloorIdle = 0x808AB2D8; // type:func -BossGoma_CeilingIdle = 0x808AB340; // type:func -BossGoma_FloorMain = 0x808AB438; // type:func -BossGoma_WallClimb = 0x808AB6A8; // type:func -BossGoma_CeilingMoveToCenter = 0x808AB774; // type:func -BossGoma_UpdateEye = 0x808AB970; // type:func -BossGoma_UpdateTailLimbsScale = 0x808ABBB8; // type:func -BossGoma_UpdateHit = 0x808ABCC4; // type:func -BossGoma_UpdateMainEnvColor = 0x808ABEA4; // type:func -BossGoma_UpdateEyeEnvColor = 0x808AC020; // type:func -BossGoma_Update = 0x808AC0C8; // type:func -BossGoma_OverrideLimbDraw = 0x808AC298; // type:func -BossGoma_PostLimbDraw = 0x808AC6E4; // type:func -BossGoma_EmptyDlist = 0x808AC8E8; // type:func -BossGoma_NoBackfaceCullingDlist = 0x808AC90C; // type:func -BossGoma_Draw = 0x808AC978; // type:func -BossGoma_SpawnChildGohma = 0x808ACA68; // type:func -func_80B4AB40 = 0x808AD6E0; // type:func -func_80B4AB48 = 0x808AD6E8; // type:func -EnZl1_Init = 0x808AD6F0; // type:func -EnZl1_Destroy = 0x808AD980; // type:func -func_80B4AE18 = 0x808AD9C0; // type:func -func_80B4AF18 = 0x808ADAC0; // type:func -func_80B4B010 = 0x808ADBB8; // type:func -func_80B4B240 = 0x808ADDF0; // type:func -func_80B4B7F4 = 0x808AE3A4; // type:func -func_80B4B834 = 0x808AE3E8; // type:func -func_80B4B874 = 0x808AE42C; // type:func -func_80B4B8B4 = 0x808AE46C; // type:func -func_80B4BBC4 = 0x808AE77C; // type:func -func_80B4BC78 = 0x808AE830; // type:func -func_80B4BF2C = 0x808AEAE4; // type:func -EnZl1_Update = 0x808AEDD8; // type:func -EnZl1_OverrideLimbDraw = 0x808AEEFC; // type:func -EnZl1_PostLimbDraw = 0x808AEFBC; // type:func -EnZl1_Draw = 0x808AF018; // type:func -EnViewer_SetupAction = 0x808B14F0; // type:func -EnViewer_Init = 0x808B14FC; // type:func -EnViewer_Destroy = 0x808B15D0; // type:func -EnViewer_InitAnimGanondorfOrZelda = 0x808B15FC; // type:func -EnViewer_InitAnimImpa = 0x808B1748; // type:func -EnViewer_InitAnimHorse = 0x808B17D8; // type:func -EnViewer_InitImpl = 0x808B1870; // type:func -EnViewer_UpdateImpl = 0x808B1A2C; // type:func -EnViewer_Update = 0x808B2584; // type:func -EnViewer_Ganondorf3OverrideLimbDraw = 0x808B25D8; // type:func -EnViewer_Ganondorf9PostLimbDraw = 0x808B2648; // type:func -EnViewer_GanondorfPostLimbDrawUpdateCapeVec = 0x808B2710; // type:func -EnViewer_DrawGanondorf = 0x808B2750; // type:func -EnViewer_DrawHorse = 0x808B2B7C; // type:func -EnViewer_ZeldaOverrideLimbDraw = 0x808B2BA8; // type:func -EnViewer_ZeldaPostLimbDraw = 0x808B2C28; // type:func -EnViewer_DrawZelda = 0x808B2C70; // type:func -EnViewer_ImpaOverrideLimbDraw = 0x808B3314; // type:func -EnViewer_DrawImpa = 0x808B333C; // type:func -EnViewer_Draw = 0x808B3450; // type:func -EnViewer_UpdatePosition = 0x808B3540; // type:func -EnViewer_InitFireEffect = 0x808B3910; // type:func -EnViewer_DrawFireEffects = 0x808B3A58; // type:func -EnViewer_UpdateGanondorfCape = 0x808B3D9C; // type:func -EnGoma_Init = 0x808B43B0; // type:func -EnGoma_Destroy = 0x808B473C; // type:func -EnGoma_SetupFlee = 0x808B478C; // type:func -EnGoma_Flee = 0x808B4830; // type:func -EnGoma_EggFallToGround = 0x808B48D0; // type:func -EnGoma_Egg = 0x808B4B5C; // type:func -EnGoma_SetupHatch = 0x808B4D9C; // type:func -EnGoma_Hatch = 0x808B4E64; // type:func -EnGoma_SetupHurt = 0x808B4EAC; // type:func -EnGoma_Hurt = 0x808B4F98; // type:func -EnGoma_SetupDie = 0x808B5020; // type:func -EnGoma_Die = 0x808B50E0; // type:func -EnGoma_SetupDead = 0x808B5184; // type:func -EnGoma_Dead = 0x808B51FC; // type:func -EnGoma_SetupStand = 0x808B536C; // type:func -EnGoma_SetupChasePlayer = 0x808B53F8; // type:func -EnGoma_SetupPrepareJump = 0x808B5478; // type:func -EnGoma_PrepareJump = 0x808B54F4; // type:func -EnGoma_SetupLand = 0x808B558C; // type:func -EnGoma_Land = 0x808B5604; // type:func -EnGoma_SetupJump = 0x808B5670; // type:func -EnGoma_Jump = 0x808B5718; // type:func -EnGoma_Stand = 0x808B57D0; // type:func -EnGoma_ChasePlayer = 0x808B584C; // type:func -EnGoma_SetupStunned = 0x808B5954; // type:func -EnGoma_Stunned = 0x808B59F0; // type:func -EnGoma_LookAtPlayer = 0x808B5AF0; // type:func -EnGoma_UpdateHit = 0x808B5B9C; // type:func -EnGoma_UpdateEyeEnvColor = 0x808B5DCC; // type:func -EnGoma_SetFloorRot = 0x808B5E5C; // type:func -EnGoma_Update = 0x808B5F70; // type:func -EnGoma_OverrideLimbDraw = 0x808B61BC; // type:func -EnGoma_NoBackfaceCullingDlist = 0x808B6318; // type:func -EnGoma_Draw = 0x808B6384; // type:func -EnGoma_Debris = 0x808B6810; // type:func -EnGoma_SpawnHatchDebris = 0x808B6854; // type:func -EnGoma_BossLimb = 0x808B69B8; // type:func -BgPushbox_SetupAction = 0x808B7060; // type:func -BgPushbox_Init = 0x808B706C; // type:func -BgPushbox_Destroy = 0x808B7104; // type:func -BgPushbox_UpdateImpl = 0x808B7138; // type:func -BgPushbox_Update = 0x808B7214; // type:func -BgPushbox_Draw = 0x808B7244; // type:func -EnBubble_SetDimensions = 0x808B7360; // type:func -func_809CBCBC = 0x808B741C; // type:func -func_809CBCEC = 0x808B7450; // type:func -EnBubble_DamagePlayer = 0x808B7474; // type:func -EnBubble_Explosion = 0x808B74E0; // type:func -func_809CBFD4 = 0x808B773C; // type:func -func_809CC020 = 0x808B7788; // type:func -EnBubble_Vec3fNormalizedReflect = 0x808B77DC; // type:func -EnBubble_Vec3fNormalize = 0x808B7864; // type:func -EnBubble_Fly = 0x808B78DC; // type:func -func_809CC648 = 0x808B7DB8; // type:func -EnBubble_DetectPop = 0x808B7E54; // type:func -func_809CC774 = 0x808B7EE4; // type:func -EnBubble_Init = 0x808B7FF8; // type:func -EnBubble_Destroy = 0x808B80F8; // type:func -EnBubble_Wait = 0x808B8124; // type:func -EnBubble_Pop = 0x808B81D8; // type:func -EnBubble_Disappear = 0x808B8228; // type:func -EnBubble_Regrow = 0x808B8270; // type:func -EnBubble_Update = 0x808B82E0; // type:func -EnBubble_Draw = 0x808B835C; // type:func -DoorShutter_SetupAction = 0x808B8780; // type:func -DoorShutter_SetupDoor = 0x808B8790; // type:func -DoorShutter_Init = 0x808B8978; // type:func -DoorShutter_Destroy = 0x808B8B90; // type:func -DoorShutter_WaitForObject = 0x808B8C00; // type:func -DoorShutter_GetPlayerDistance = 0x808B8D3C; // type:func -DoorShutter_GetPlayerSide = 0x808B8DD4; // type:func -DoorShutter_WaitClear = 0x808B8F54; // type:func -DoorShutter_Unopenable = 0x808B9000; // type:func -DoorShutter_Idle = 0x808B9010; // type:func -DoorShutter_InitOpeningDoorCam = 0x808B9164; // type:func -DoorShutter_UpdateOpening = 0x808B921C; // type:func -DoorShutter_UpdateBarsClosed = 0x808B9314; // type:func -DoorShutter_BarAndWaitSwitchFlag = 0x808B93F8; // type:func -DoorShutter_UnbarredCheckSwitchFlag = 0x808B94B0; // type:func -DoorShutter_Open = 0x808B951C; // type:func -DoorShutter_Unbar = 0x808B966C; // type:func -DoorShutter_SetupClosed = 0x808B973C; // type:func -DoorShutter_Close = 0x808B9908; // type:func -DoorShutter_JabuDoorClose = 0x808B9A4C; // type:func -DoorShutter_WaitPlayerSurprised = 0x808B9A90; // type:func -DoorShutter_GohmaBlockFall = 0x808B9AE8; // type:func -DoorShutter_GohmaBlockBounce = 0x808B9BE4; // type:func -DoorShutter_PhantomGanonBarsRaise = 0x808B9C70; // type:func -DoorShutter_Update = 0x808B9D00; // type:func -DoorShutter_DrawJabuJabuDoor = 0x808B9D54; // type:func -DoorShutter_ShouldDraw = 0x808B9F44; // type:func -DoorShutter_Draw = 0x808B9FF0; // type:func -DoorShutter_RequestQuakeAndRumble = 0x808BA544; // type:func -EnDodojr_Init = 0x808BAA40; // type:func -EnDodojr_Destroy = 0x808BAB28; // type:func -EnDodojr_DoSwallowedBombEffects = 0x808BAB54; // type:func -EnDodojr_SpawnLargeDust = 0x808BAB98; // type:func -EnDodojr_SpawnSmallDust = 0x808BADB8; // type:func -EnDodojr_UpdateBounces = 0x808BAF38; // type:func -EnDodojr_SetupCrawlTowardsTarget = 0x808BB01C; // type:func -EnDodojr_SetupFlipBounce = 0x808BB0A4; // type:func -EnDodojr_SetupSwallowedBombDeathSequence = 0x808BB148; // type:func -EnDodojr_SetupJumpAttackBounce = 0x808BB1B8; // type:func -EnDodojr_SetupDespawn = 0x808BB23C; // type:func -EnDodojr_SetupEatBomb = 0x808BB2A8; // type:func -EnDodojr_CheckNearbyBombs = 0x808BB324; // type:func -EnDodojr_TryEatBomb = 0x808BB450; // type:func -EnDodojr_UpdateCrawl = 0x808BB4D4; // type:func -EnDodojr_IsPlayerWithinAttackRange = 0x808BB6E8; // type:func -EnDodojr_SetupStandardDeathBounce = 0x808BB718; // type:func -EnDodojr_CheckDamaged = 0x808BB764; // type:func -EnDodojr_UpdateCollider = 0x808BB920; // type:func -EnDodojr_WaitUnderground = 0x808BBA30; // type:func -EnDodojr_EmergeFromGround = 0x808BBB48; // type:func -EnDodojr_CrawlTowardsTarget = 0x808BBC10; // type:func -EnDodojr_EatBomb = 0x808BBD14; // type:func -EnDodojr_SwallowBomb = 0x808BBDC4; // type:func -EnDodojr_SwallowedBombDeathBounce = 0x808BBE34; // type:func -EnDodojr_SwallowedBombDeathSequence = 0x808BBED4; // type:func -EnDodojr_StunnedBounce = 0x808BBEF4; // type:func -EnDodojr_Stunned = 0x808BBF74; // type:func -EnDodojr_JumpAttackBounce = 0x808BC024; // type:func -EnDodojr_Despawn = 0x808BC08C; // type:func -EnDodojr_StandardDeathBounce = 0x808BC144; // type:func -EnDodojr_DeathSequence = 0x808BC1CC; // type:func -EnDodojr_DropItem = 0x808BC278; // type:func -EnDodojr_WaitFreezeFrames = 0x808BC2DC; // type:func -EnDodojr_Update = 0x808BC324; // type:func -EnDodojr_OverrideLimbDraw = 0x808BC3E4; // type:func -EnDodojr_PostLimbDraw = 0x808BC490; // type:func -EnDodojr_Draw = 0x808BC4A8; // type:func -EnBdfire_SetupAction = 0x808BC8E0; // type:func -EnbdFire_SetupDraw = 0x808BC8EC; // type:func -EnBdfire_Init = 0x808BC8F8; // type:func -EnBdfire_Destroy = 0x808BCB28; // type:func -func_809BC2A4 = 0x808BCB60; // type:func -func_809BC598 = 0x808BCE54; // type:func -EnBdfire_Update = 0x808BD144; // type:func -EnBdfire_DrawFire = 0x808BD180; // type:func -EnBdfire_Draw = 0x808BD340; // type:func -EnBoom_SetupAction = 0x808BD480; // type:func -EnBoom_Init = 0x808BD48C; // type:func -EnBoom_Destroy = 0x808BD5A8; // type:func -EnBoom_Fly = 0x808BD5E8; // type:func -EnBoom_Update = 0x808BDA28; // type:func -EnBoom_Draw = 0x808BDA80; // type:func -EnTorch2_Init = 0x808BDD50; // type:func -EnTorch2_Destroy = 0x808BDEF8; // type:func -EnTorch2_GetAttackItem = 0x808BDF68; // type:func -EnTorch2_SwingSword = 0x808BDFB0; // type:func -EnTorch2_Backflip = 0x808BE148; // type:func -EnTorch2_Update = 0x808BE1A0; // type:func -EnTorch2_OverrideLimbDraw = 0x808BFB88; // type:func -EnTorch2_PostLimbDraw = 0x808BFBB4; // type:func -EnTorch2_Draw = 0x808BFBD8; // type:func -EnBili_Init = 0x808C04F0; // type:func -EnBili_Destroy = 0x808C05E8; // type:func -EnBili_SetupFloatIdle = 0x808C0614; // type:func -EnBili_SetupSpawnedFlyApart = 0x808C0670; // type:func -EnBili_SetupDischargeLightning = 0x808C06E8; // type:func -EnBili_SetupClimb = 0x808C0744; // type:func -EnBili_SetupApproachPlayer = 0x808C079C; // type:func -EnBili_SetupSetNewHomeHeight = 0x808C07BC; // type:func -EnBili_SetupRecoil = 0x808C0824; // type:func -EnBili_SetupBurnt = 0x808C08AC; // type:func -EnBili_SetupDie = 0x808C094C; // type:func -EnBili_SetupStunned = 0x808C0980; // type:func -EnBili_SetupFrozen = 0x808C09F8; // type:func -EnBili_UpdateTentaclesIndex = 0x808C0BD0; // type:func -EnBili_UpdateFloating = 0x808C0CF0; // type:func -EnBili_FloatIdle = 0x808C0DD8; // type:func -EnBili_SpawnedFlyApart = 0x808C0EC4; // type:func -EnBili_DischargeLightning = 0x808C0F1C; // type:func -EnBili_Climb = 0x808C1118; // type:func -EnBili_ApproachPlayer = 0x808C11D4; // type:func -EnBili_SetNewHomeHeight = 0x808C1264; // type:func -EnBili_Recoil = 0x808C12E0; // type:func -EnBili_Burnt = 0x808C1344; // type:func -EnBili_Die = 0x808C13B8; // type:func -EnBili_Stunned = 0x808C15E0; // type:func -EnBili_Frozen = 0x808C1640; // type:func -EnBili_UpdateDamage = 0x808C16D0; // type:func -EnBili_Update = 0x808C189C; // type:func -EnBili_PulseLimb3 = 0x808C1A70; // type:func -EnBili_PulseLimb2 = 0x808C1C88; // type:func -EnBili_PulseLimb4 = 0x808C1EA8; // type:func -EnBili_OverrideLimbDraw = 0x808C2010; // type:func -EnBili_Draw = 0x808C2100; // type:func -EnTp_SetupAction = 0x808C27C0; // type:func -EnTp_Init = 0x808C27CC; // type:func -EnTp_Destroy = 0x808C2A44; // type:func -EnTp_Tail_SetupFollowHead = 0x808C2A70; // type:func -EnTp_Tail_FollowHead = 0x808C2A9C; // type:func -EnTp_Head_SetupApproachPlayer = 0x808C2C78; // type:func -EnTp_Head_ApproachPlayer = 0x808C2CAC; // type:func -EnTp_SetupDie = 0x808C2E48; // type:func -EnTp_Die = 0x808C2EC0; // type:func -EnTp_Fragment_SetupFade = 0x808C31F0; // type:func -EnTp_Fragment_Fade = 0x808C32F4; // type:func -EnTp_Head_SetupTakeOff = 0x808C3340; // type:func -EnTp_Head_TakeOff = 0x808C339C; // type:func -EnTp_Head_SetupWait = 0x808C3584; // type:func -EnTp_Head_Wait = 0x808C35D0; // type:func -EnTp_Head_SetupBurrowReturnHome = 0x808C38DC; // type:func -EnTp_Head_BurrowReturnHome = 0x808C390C; // type:func -EnTp_UpdateDamage = 0x808C3BDC; // type:func -EnTp_Update = 0x808C3E34; // type:func -EnTp_Draw = 0x808C41A0; // type:func -EnSt_SetupAction = 0x808C4630; // type:func -EnSt_SpawnDust = 0x808C463C; // type:func -EnSt_SpawnBlastEffect = 0x808C485C; // type:func -EnSt_SpawnDeadEffect = 0x808C48E4; // type:func -EnSt_CreateBlureEffect = 0x808C4A20; // type:func -EnSt_CheckCeilingPos = 0x808C4B1C; // type:func -EnSt_AddBlurVertex = 0x808C4BEC; // type:func -EnSt_AddBlurSpace = 0x808C4CF4; // type:func -EnSt_SetWaitingAnimation = 0x808C4D20; // type:func -EnSt_SetReturnToCeilingAnimation = 0x808C4D50; // type:func -EnSt_SetLandAnimation = 0x808C4D90; // type:func -EnSt_SetDropAnimAndVel = 0x808C4DEC; // type:func -EnSt_InitColliders = 0x808C4E4C; // type:func -EnSt_CheckBodyStickHit = 0x808C4F8C; // type:func -EnSt_SetBodyCylinderAC = 0x808C5000; // type:func -EnSt_SetLegsCylinderAC = 0x808C5044; // type:func -EnSt_SetCylinderOC = 0x808C50FC; // type:func -EnSt_UpdateCylinders = 0x808C52D4; // type:func -EnSt_CheckHitPlayer = 0x808C5398; // type:func -EnSt_CheckHitFrontside = 0x808C5484; // type:func -EnSt_CheckHitBackside = 0x808C54C4; // type:func -EnSt_CheckColliders = 0x808C56B4; // type:func -EnSt_SetColliderScale = 0x808C573C; // type:func -EnSt_SetTeethColor = 0x808C58A8; // type:func -EnSt_DecrStunTimer = 0x808C59D8; // type:func -EnSt_UpdateYaw = 0x808C59F8; // type:func -EnSt_IsDoneBouncing = 0x808C5C98; // type:func -EnSt_Bob = 0x808C5D60; // type:func -EnSt_IsCloseToPlayer = 0x808C5DCC; // type:func -EnSt_IsCloseToInitialPos = 0x808C5E74; // type:func -EnSt_IsCloseToGround = 0x808C5EAC; // type:func -EnSt_Sway = 0x808C5EEC; // type:func -EnSt_Init = 0x808C60BC; // type:func -EnSt_Destroy = 0x808C61E0; // type:func -EnSt_WaitOnCeiling = 0x808C6260; // type:func -EnSt_WaitOnGround = 0x808C62BC; // type:func -EnSt_LandOnGround = 0x808C63B4; // type:func -EnSt_MoveToGround = 0x808C64B8; // type:func -EnSt_ReturnToCeiling = 0x808C65B0; // type:func -EnSt_BounceAround = 0x808C6684; // type:func -EnSt_FinishBouncing = 0x808C6758; // type:func -EnSt_Die = 0x808C68CC; // type:func -EnSt_StartOnCeilingOrGround = 0x808C6944; // type:func -EnSt_Update = 0x808C69C8; // type:func -EnSt_OverrideLimbDraw = 0x808C6B48; // type:func -EnSt_PostLimbDraw = 0x808C6C28; // type:func -EnSt_Draw = 0x808C6C64; // type:func -EnBw_SetupAction = 0x808C72A0; // type:func -EnBw_Init = 0x808C72AC; // type:func -EnBw_Destroy = 0x808C740C; // type:func -func_809CE884 = 0x808C744C; // type:func -func_809CE9A8 = 0x808C7570; // type:func -func_809CEA24 = 0x808C75EC; // type:func -func_809CF72C = 0x808C82F4; // type:func -func_809CF7AC = 0x808C8374; // type:func -func_809CF8F0 = 0x808C84B8; // type:func -func_809CF984 = 0x808C854C; // type:func -func_809CFBA8 = 0x808C8774; // type:func -func_809CFC4C = 0x808C8818; // type:func -func_809CFF10 = 0x808C8ADC; // type:func -func_809CFF98 = 0x808C8B64; // type:func -func_809D00F4 = 0x808C8CC0; // type:func -func_809D014C = 0x808C8D18; // type:func -func_809D01CC = 0x808C8D98; // type:func -func_809D0268 = 0x808C8E34; // type:func -func_809D03CC = 0x808C8F98; // type:func -func_809D0424 = 0x808C8FF0; // type:func -func_809D0584 = 0x808C9150; // type:func -EnBw_Update = 0x808C945C; // type:func -EnBw_OverrideLimbDraw = 0x808C98EC; // type:func -EnBw_Draw = 0x808C9B04; // type:func -EnEiyer_Init = 0x808CA630; // type:func -EnEiyer_Destroy = 0x808CA810; // type:func -EnEiyer_RotateAroundHome = 0x808CA83C; // type:func -EnEiyer_SetupAppearFromGround = 0x808CA8AC; // type:func -EnEiyer_SetupUnderground = 0x808CA9EC; // type:func -EnEiyer_SetupInactive = 0x808CAA4C; // type:func -EnEiyer_SetupAmbush = 0x808CAA78; // type:func -EnEiyer_SetupGlide = 0x808CAB58; // type:func -EnEiyer_SetupStartAttack = 0x808CABD4; // type:func -EnEiyer_SetupDiveAttack = 0x808CABE8; // type:func -EnEiyer_SetupLand = 0x808CAC30; // type:func -EnEiyer_SetupHurt = 0x808CACA8; // type:func -EnEiyer_SetupDie = 0x808CAD58; // type:func -EnEiyer_SetupDead = 0x808CAE18; // type:func -EnEiyer_SetupStunned = 0x808CAE44; // type:func -EnEiyer_AppearFromGround = 0x808CAF08; // type:func -EnEiyer_CheckPlayerCollision = 0x808CAF58; // type:func -EnEiyer_CircleUnderground = 0x808CAF88; // type:func -EnEiyer_WanderUnderground = 0x808CB004; // type:func -EnEiyer_Inactive = 0x808CB138; // type:func -EnEiyer_Ambush = 0x808CB1CC; // type:func -EnEiyer_Glide = 0x808CB324; // type:func -EnEiyer_StartAttack = 0x808CB540; // type:func -EnEiyer_DiveAttack = 0x808CB63C; // type:func -EnEiyer_Land = 0x808CB6C8; // type:func -EnEiyer_Hurt = 0x808CB7BC; // type:func -EnEiyer_Die = 0x808CB8F4; // type:func -EnEiyer_Dead = 0x808CB9A8; // type:func -EnEiyer_Stunned = 0x808CBA28; // type:func -EnEiyer_UpdateDamage = 0x808CBAE0; // type:func -EnEiyer_Update = 0x808CBC28; // type:func -EnEiyer_OverrideLimbDraw = 0x808CBE4C; // type:func -EnEiyer_Draw = 0x808CBEA0; // type:func -EnRiverSound_Init = 0x808CC290; // type:func -EnRiverSound_Destroy = 0x808CC360; // type:func -EnRiverSound_FindClosestPointOnLineSegment = 0x808CC3B8; // type:func -EnRiverSound_GetSfxPos = 0x808CC524; // type:func -EnRiverSound_Update = 0x808CC820; // type:func -EnRiverSound_Draw = 0x808CC9F0; // type:func -func_80A6B250 = 0x808CCC20; // type:func -func_80A6B30C = 0x808CCCDC; // type:func -EnHorseNormal_Init = 0x808CCDA4; // type:func -EnHorseNormal_Destroy = 0x808CD294; // type:func -func_80A6B91C = 0x808CD2F4; // type:func -EnHorseNormal_FollowPath = 0x808CD3AC; // type:func -EnHorseNormal_NextAnimation = 0x808CD588; // type:func -EnHorseNormal_CycleAnimations = 0x808CD5DC; // type:func -func_80A6BC48 = 0x808CD624; // type:func -func_80A6BCEC = 0x808CD6CC; // type:func -func_80A6BD7C = 0x808CD75C; // type:func -EnHorseNormal_Wander = 0x808CD850; // type:func -func_80A6C4CC = 0x808CDEB4; // type:func -EnHorseNormal_Wait = 0x808CDF5C; // type:func -func_80A6C6B0 = 0x808CE09C; // type:func -EnHorseNormal_WaitClone = 0x808CE150; // type:func -func_80A6C8E0 = 0x808CE2D4; // type:func -EnHorseNormal_Update = 0x808CE398; // type:func -EnHorseNormal_PostDraw = 0x808CE4F4; // type:func -func_80A6CC88 = 0x808CE680; // type:func -EnHorseNormal_Draw = 0x808CE868; // type:func -EnOssan_SetupAction = 0x808CF240; // type:func -ShopItemDisp_Default = 0x808CF24C; // type:func -ShopItemDisp_SpookyMask = 0x808CF264; // type:func -ShopItemDisp_SkullMask = 0x808CF298; // type:func -ShopItemDisp_BunnyHood = 0x808CF2CC; // type:func -ShopItemDisp_ZoraMask = 0x808CF300; // type:func -ShopItemDisp_GoronMask = 0x808CF334; // type:func -ShopItemDisp_GerudoMask = 0x808CF368; // type:func -EnOssan_SpawnItemsOnShelves = 0x808CF39C; // type:func -EnOssan_UpdateShopOfferings = 0x808CF4F0; // type:func -EnOssan_TalkDefaultShopkeeper = 0x808CF65C; // type:func -EnOssan_TalkKakarikoPotionShopkeeper = 0x808CF67C; // type:func -EnOssan_TalkMarketPotionShopkeeper = 0x808CF6C0; // type:func -EnOssan_TalkKokiriShopkeeper = 0x808CF6E0; // type:func -EnOssan_TalkBazaarShopkeeper = 0x808CF700; // type:func -EnOssan_TalkBombchuShopkeeper = 0x808CF744; // type:func -EnOssan_TalkZoraShopkeeper = 0x808CF764; // type:func -EnOssan_TalkGoronShopkeeper = 0x808CF7BC; // type:func -EnOssan_TalkHappyMaskShopkeeper = 0x808CF890; // type:func -EnOssan_UpdateCameraDirection = 0x808CF91C; // type:func -EnOssan_TryGetObjBankIndices = 0x808CF980; // type:func -EnOssan_Init = 0x808CFA44; // type:func -EnOssan_Destroy = 0x808CFC10; // type:func -EnOssan_UpdateCursorPos = 0x808CFC50; // type:func -EnOssan_EndInteraction = 0x808CFCB4; // type:func -EnOssan_TestEndInteraction = 0x808CFD78; // type:func -EnOssan_TestCancelOption = 0x808CFDC0; // type:func -EnOssan_SetStateStartShopping = 0x808CFE24; // type:func -EnOssan_StartShopping = 0x808CFEA8; // type:func -EnOssan_ChooseTalkToOwner = 0x808CFF80; // type:func -EnOssan_SetLookToShopkeeperFromShelf = 0x808CFFE0; // type:func -EnOssan_State_Idle = 0x808D0014; // type:func -EnOssan_UpdateJoystickInputState = 0x808D00C4; // type:func -EnOssan_SetCursorIndexFromNeutral = 0x808D0210; // type:func -EnOssan_CursorRight = 0x808D0348; // type:func -EnOssan_CursorLeft = 0x808D03D4; // type:func -EnOssan_TryPaybackMask = 0x808D043C; // type:func -EnOssan_State_StartConversation = 0x808D0578; // type:func -EnOssan_FacingShopkeeperDialogResult = 0x808D0720; // type:func -EnOssan_State_FacingShopkeeper = 0x808D078C; // type:func -EnOssan_State_TalkingToShopkeeper = 0x808D08A4; // type:func -EnOssan_State_LookToLeftShelf = 0x808D08F8; // type:func -EnOssan_State_LookToRightShelf = 0x808D09E4; // type:func -EnOssan_CursorUpDown = 0x808D0AD0; // type:func -EnOssan_HasPlayerSelectedItem = 0x808D0CE4; // type:func -EnOssan_State_BrowseLeftShelf = 0x808D0E80; // type:func -EnOssan_State_BrowseRightShelf = 0x808D1040; // type:func -EnOssan_State_LookFromShelfToShopkeeper = 0x808D1200; // type:func -EnOssan_State_DisplayOnlyBombDialog = 0x808D12BC; // type:func -EnOssan_GiveItemWithFanfare = 0x808D138C; // type:func -EnOssan_SetStateCantGetItem = 0x808D1458; // type:func -EnOssan_SetStateQuickBuyDialog = 0x808D148C; // type:func -EnOssan_HandleCanBuyItem = 0x808D14C0; // type:func -EnOssan_HandleCanBuyLonLonMilk = 0x808D1668; // type:func -EnOssan_HandleCanBuyWeirdEgg = 0x808D1774; // type:func -EnOssan_HandleCanBuyBombs = 0x808D18AC; // type:func -EnOssan_BuyGoronCityBombs = 0x808D19B0; // type:func -EnOssan_State_ItemSelected = 0x808D1A54; // type:func -EnOssan_State_SelectMilkBottle = 0x808D1B28; // type:func -EnOssan_State_SelectWeirdEgg = 0x808D1BFC; // type:func -EnOssan_State_SelectUnimplementedItem = 0x808D1CD0; // type:func -EnOssan_State_SelectBombs = 0x808D1D60; // type:func -EnOssan_State_SelectMaskItem = 0x808D1E58; // type:func -EnOssan_State_CantGetItem = 0x808D2034; // type:func -EnOssan_State_QuickBuyDialog = 0x808D20B0; // type:func -EnOssan_State_GiveItemWithFanfare = 0x808D2158; // type:func -EnOssan_State_ItemPurchased = 0x808D21C8; // type:func -EnOssan_State_ContinueShoppingPrompt = 0x808D230C; // type:func -EnOssan_State_WaitForDisplayOnlyBombDialog = 0x808D24EC; // type:func -EnOssan_State_21 = 0x808D2554; // type:func -EnOssan_State_22 = 0x808D25C8; // type:func -EnOssan_State_GiveLonLonMilk = 0x808D261C; // type:func -EnOssan_State_LendMaskOfTruth = 0x808D2670; // type:func -EnOssan_SetStateGiveDiscountDialog = 0x808D26E0; // type:func -EnOssan_State_GiveDiscountDialog = 0x808D270C; // type:func -EnOssan_PositionSelectedItem = 0x808D27A0; // type:func -EnOssan_ResetItemPosition = 0x808D2888; // type:func -EnOssan_TakeItemOffShelf = 0x808D28AC; // type:func -EnOssan_ReturnItemToShelf = 0x808D2948; // type:func -EnOssan_UpdateItemSelectedProperty = 0x808D29D4; // type:func -EnOssan_UpdateCursorAnim = 0x808D2B10; // type:func -EnOssan_UpdateStickDirectionPromptAnim = 0x808D2BDC; // type:func -EnOssan_WaitForBlink = 0x808D2D8C; // type:func -EnOssan_Blink = 0x808D2DC0; // type:func -EnOssan_AreShopkeeperObjectsLoaded = 0x808D2E60; // type:func -EnOssan_InitBazaarShopkeeper = 0x808D2EFC; // type:func -EnOssan_InitKokiriShopkeeper = 0x808D2F5C; // type:func -EnOssan_InitGoronShopkeeper = 0x808D3074; // type:func -EnOssan_InitZoraShopkeeper = 0x808D3150; // type:func -EnOssan_InitPotionShopkeeper = 0x808D322C; // type:func -EnOssan_InitHappyMaskShopkeeper = 0x808D328C; // type:func -EnOssan_InitBombchuShopkeeper = 0x808D32EC; // type:func -EnOssan_SetupHelloDialog = 0x808D334C; // type:func -EnOssan_InitActionFunc = 0x808D34B4; // type:func -EnOssan_Obj3ToSeg6 = 0x808D376C; // type:func -EnOssan_MainActionFunc = 0x808D37A4; // type:func -EnOssan_Update = 0x808D38C0; // type:func -EnOssan_OverrideLimbDrawDefaultShopkeeper = 0x808D38EC; // type:func -EnOssan_DrawCursor = 0x808D3924; // type:func -EnOssan_DrawTextRec = 0x808D3B84; // type:func -EnOssan_DrawStickDirectionPrompts = 0x808D3D20; // type:func -EnOssan_DrawBazaarShopkeeper = 0x808D40C8; // type:func -EnOssan_OverrideLimbDrawKokiriShopkeeper = 0x808D41BC; // type:func -EnOssan_EmptyDList = 0x808D42B4; // type:func -EnOssan_SetEnvColor = 0x808D42D8; // type:func -EnOssan_DrawKokiriShopkeeper = 0x808D4344; // type:func -EnOssan_DrawGoronShopkeeper = 0x808D44A4; // type:func -EnOssan_OverrideLimbDrawZoraShopkeeper = 0x808D45D8; // type:func -EnOssan_DrawZoraShopkeeper = 0x808D4610; // type:func -EnOssan_DrawPotionShopkeeper = 0x808D4754; // type:func -EnOssan_DrawHappyMaskShopkeeper = 0x808D4840; // type:func -EnOssan_DrawBombchuShopkeeper = 0x808D492C; // type:func -BgTreemouth_SetupAction = 0x808D5820; // type:func -BgTreemouth_Init = 0x808D582C; // type:func -BgTreemouth_Destroy = 0x808D5954; // type:func -func_808BC65C = 0x808D5988; // type:func -func_808BC6F8 = 0x808D5A24; // type:func -func_808BC80C = 0x808D5B38; // type:func -func_808BC864 = 0x808D5B90; // type:func -func_808BC8B8 = 0x808D5BE4; // type:func -func_808BC9EC = 0x808D5D18; // type:func -func_808BCAF0 = 0x808D5E20; // type:func -BgTreemouth_DoNothing = 0x808D5EBC; // type:func -BgTreemouth_Update = 0x808D5ECC; // type:func -BgTreemouth_Draw = 0x808D5F4C; // type:func -BgDodoago_SetupAction = 0x808D6E80; // type:func -BgDodoago_SpawnSparkles = 0x808D6E8C; // type:func -BgDodoago_Init = 0x808D6FAC; // type:func -BgDodoago_Destroy = 0x808D7110; // type:func -BgDodoago_WaitExplosives = 0x808D717C; // type:func -BgDodoago_OpenJaw = 0x808D7440; // type:func -BgDodoago_DoNothing = 0x808D7704; // type:func -BgDodoago_LightOneEye = 0x808D7714; // type:func -BgDodoago_Update = 0x808D7778; // type:func -BgDodoago_Draw = 0x808D78D0; // type:func -BgHidanDalm_Init = 0x808D7C30; // type:func -BgHidanDalm_Destroy = 0x808D7D18; // type:func -BgHidanDalm_Wait = 0x808D7D60; // type:func -BgHidanDalm_Shrink = 0x808D7EE4; // type:func -BgHidanDalm_Update = 0x808D8094; // type:func -BgHidanDalm_UpdateCollider = 0x808D80F4; // type:func -BgHidanDalm_Draw = 0x808D8220; // type:func -BgHidanHrock_Init = 0x808D8480; // type:func -BgHidanHrock_Destroy = 0x808D87B0; // type:func -func_808894A4 = 0x808D87F8; // type:func -func_808894B0 = 0x808D8808; // type:func -func_8088960C = 0x808D8964; // type:func -func_808896B8 = 0x808D8A10; // type:func -BgHidanHrock_Update = 0x808D8AF0; // type:func -BgHidanHrock_Draw = 0x808D8B14; // type:func -func_80A68660 = 0x808D8CB0; // type:func -func_80A686A8 = 0x808D8CFC; // type:func -func_80A68870 = 0x808D8EC4; // type:func -EnHorseGanon_Init = 0x808D8F80; // type:func -EnHorseGanon_Destroy = 0x808D90CC; // type:func -func_80A68AC4 = 0x808D911C; // type:func -func_80A68AF0 = 0x808D914C; // type:func -func_80A68B20 = 0x808D9180; // type:func -func_80A68DB0 = 0x808D9410; // type:func -func_80A68E14 = 0x808D9474; // type:func -EnHorseGanon_Update = 0x808D9538; // type:func -EnHorseGanon_PostDraw = 0x808D960C; // type:func -EnHorseGanon_Draw = 0x808D9798; // type:func -BgHidanRock_Init = 0x808D9A30; // type:func -BgHidanRock_Destroy = 0x808D9BAC; // type:func -func_8088B24C = 0x808D9C00; // type:func -func_8088B268 = 0x808D9C20; // type:func -func_8088B5F4 = 0x808D9FB0; // type:func -func_8088B634 = 0x808D9FF0; // type:func -func_8088B69C = 0x808DA05C; // type:func -func_8088B79C = 0x808DA15C; // type:func -func_8088B90C = 0x808DA2CC; // type:func -func_8088B954 = 0x808DA314; // type:func -func_8088B990 = 0x808DA350; // type:func -BgHidanRock_Update = 0x808DA53C; // type:func -func_8088BC40 = 0x808DA60C; // type:func -BgHidanRock_Draw = 0x808DA81C; // type:func -BgHidanRsekizou_Init = 0x808DAB30; // type:func -BgHidanRsekizou_Destroy = 0x808DAC34; // type:func -BgHidanRsekizou_Update = 0x808DAC7C; // type:func -BgHidanRsekizou_DrawFireball = 0x808DB040; // type:func -BgHidanRsekizou_Draw = 0x808DB358; // type:func -func_8088CEC0 = 0x808DB710; // type:func -BgHidanSekizou_Init = 0x808DBACC; // type:func -BgHidanSekizou_Destroy = 0x808DBC40; // type:func -func_8088D434 = 0x808DBC88; // type:func -func_8088D720 = 0x808DBF74; // type:func -func_8088D750 = 0x808DBFA4; // type:func -BgHidanSekizou_Update = 0x808DC110; // type:func -func_8088D9F4 = 0x808DC24C; // type:func -func_8088DC50 = 0x808DC494; // type:func -func_8088DE08 = 0x808DC64C; // type:func -BgHidanSekizou_Draw = 0x808DC72C; // type:func -BgHidanSima_Init = 0x808DCB60; // type:func -BgHidanSima_Destroy = 0x808DCC64; // type:func -func_8088E518 = 0x808DCCAC; // type:func -func_8088E5D0 = 0x808DCD68; // type:func -func_8088E6D0 = 0x808DCE6C; // type:func -func_8088E760 = 0x808DCF04; // type:func -func_8088E7A8 = 0x808DCF4C; // type:func -func_8088E90C = 0x808DD0B0; // type:func -BgHidanSima_Update = 0x808DD210; // type:func -func_8088EB54 = 0x808DD300; // type:func -BgHidanSima_Draw = 0x808DD778; // type:func -BgHidanSyoku_Init = 0x808DDA60; // type:func -BgHidanSyoku_Destroy = 0x808DDAEC; // type:func -func_8088F47C = 0x808DDB20; // type:func -func_8088F4B8 = 0x808DDB5C; // type:func -func_8088F514 = 0x808DDBBC; // type:func -func_8088F5A0 = 0x808DDC48; // type:func -func_8088F62C = 0x808DDCD4; // type:func -BgHidanSyoku_Update = 0x808DDD30; // type:func -BgHidanSyoku_Draw = 0x808DDDD8; // type:func -EnXc_InitCollider = 0x808DDEC0; // type:func -EnXc_UpdateCollider = 0x808DDF0C; // type:func -EnXc_Destroy = 0x808DDF50; // type:func -EnXc_CalculateHeadTurn = 0x808DDF7C; // type:func -EnXc_SetEyePattern = 0x808DE004; // type:func -EnXc_SpawnNut = 0x808DE08C; // type:func -EnXc_BgCheck = 0x808DE154; // type:func -EnXc_AnimIsFinished = 0x808DE19C; // type:func -EnXc_GetCue = 0x808DE1C0; // type:func -EnXc_CheckForCue = 0x808DE1E4; // type:func -EnXc_CheckForNoCue = 0x808DE230; // type:func -func_80B3C588 = 0x808DE27C; // type:func -func_80B3C620 = 0x808DE314; // type:func -EnXc_ChangeAnimation = 0x808DE3F4; // type:func -EnXc_CheckAndSetAction = 0x808DE4B0; // type:func -func_80B3C7D4 = 0x808DE4C8; // type:func -func_80B3C8CC = 0x808DE4F4; // type:func -func_80B3C924 = 0x808DE550; // type:func -func_80B3C964 = 0x808DE590; // type:func -func_80B3C9DC = 0x808DE608; // type:func -func_80B3C9EC = 0x808DE61C; // type:func -func_80B3CA38 = 0x808DE668; // type:func -EnXc_MinuetCS = 0x808DE6BC; // type:func -func_80B3CB58 = 0x808DE794; // type:func -EnXc_BoleroCS = 0x808DE7E8; // type:func -EnXc_SetupSerenadeAction = 0x808DE948; // type:func -EnXc_SerenadeCS = 0x808DE9A0; // type:func -EnXc_DoNothing = 0x808DEA68; // type:func -EnXc_SetWalkingSFX = 0x808DEA78; // type:func -EnXc_SetNutThrowSFX = 0x808DEAF8; // type:func -EnXc_SetLandingSFX = 0x808DEB84; // type:func -EnXc_SetColossusAppearSFX = 0x808DEC04; // type:func -func_80B3D118 = 0x808DED10; // type:func -EnXc_SetColossusWindSFX = 0x808DED54; // type:func -EnXc_SpawnFlame = 0x808DEE5C; // type:func -EnXc_SetupFlamePos = 0x808DEF00; // type:func -EnXc_DestroyFlame = 0x808DEF7C; // type:func -EnXc_InitFlame = 0x808DEFBC; // type:func -func_80B3D48C = 0x808DF058; // type:func -EnXc_GetCurrentHarpAnim = 0x808DF0A8; // type:func -EnXc_CalcXZAccel = 0x808DF13C; // type:func -func_80B3D644 = 0x808DF214; // type:func -EnXc_CalcXZSpeed = 0x808DF234; // type:func -func_80B3D6F0 = 0x808DF2C0; // type:func -func_80B3D710 = 0x808DF2E0; // type:func -func_80B3D730 = 0x808DF300; // type:func -func_80B3D750 = 0x808DF320; // type:func -EnXc_SetupFallFromSkyAction = 0x808DF36C; // type:func -func_80B3D8A4 = 0x808DF47C; // type:func -EnXc_SetupWalkAction = 0x808DF56C; // type:func -EnXc_SetupHaltAction = 0x808DF5DC; // type:func -EnXc_SetupStoppedAction = 0x808DF688; // type:func -func_80B3DAF0 = 0x808DF6D0; // type:func -EnXc_SetupInitialHarpAction = 0x808DF790; // type:func -EnXc_SetupPlayingHarpAction = 0x808DF808; // type:func -func_80B3DCA8 = 0x808DF890; // type:func -EnXc_SetupHarpPutawayAction = 0x808DF924; // type:func -func_80B3DE00 = 0x808DF9F4; // type:func -func_80B3DE78 = 0x808DFA6C; // type:func -EnXc_SetupReverseAccel = 0x808DFAE8; // type:func -EnXc_SetupReverseWalkAction = 0x808DFB98; // type:func -EnXc_SetupReverseHaltAction = 0x808DFC08; // type:func -EnXc_SetupNutThrow = 0x808DFCB4; // type:func -func_80B3E164 = 0x808DFD5C; // type:func -EnXc_SetupDisappear = 0x808DFDB0; // type:func -EnXc_ActionFunc0 = 0x808DFE20; // type:func -EnXc_ActionFunc1 = 0x808DFE60; // type:func -EnXc_GracefulFall = 0x808DFEA0; // type:func -EnXc_Accelerate = 0x808DFF1C; // type:func -EnXc_Walk = 0x808DFF7C; // type:func -EnXc_Stopped = 0x808DFFDC; // type:func -EnXc_ActionFunc6 = 0x808E003C; // type:func -EnXc_ActionFunc7 = 0x808E0084; // type:func -EnXc_ActionFunc8 = 0x808E00D0; // type:func -EnXc_ActionFunc9 = 0x808E0120; // type:func -EnXc_ActionFunc10 = 0x808E0168; // type:func -EnXc_ActionFunc11 = 0x808E01B0; // type:func -EnXc_ActionFunc12 = 0x808E01FC; // type:func -EnXc_ActionFunc13 = 0x808E0248; // type:func -EnXc_ReverseAccelerate = 0x808E02A4; // type:func -EnXc_ActionFunc15 = 0x808E0310; // type:func -EnXc_HaltAndWaitToThrowNut = 0x808E037C; // type:func -EnXc_ThrowNut = 0x808E03E8; // type:func -EnXc_Delete = 0x808E0450; // type:func -EnXc_Fade = 0x808E04AC; // type:func -func_80B3E87C = 0x808E04CC; // type:func -EnXc_PullingOutHarpOverrideLimbDraw = 0x808E04FC; // type:func -EnXc_HarpOverrideLimbDraw = 0x808E0538; // type:func -EnXc_DrawPullingOutHarp = 0x808E0560; // type:func -EnXc_DrawHarp = 0x808E069C; // type:func -func_80B3EBF0 = 0x808E07D8; // type:func -func_80B3EC00 = 0x808E07EC; // type:func -func_80B3EC0C = 0x808E07FC; // type:func -func_80B3EC90 = 0x808E0880; // type:func -func_80B3ECD8 = 0x808E08C8; // type:func -EnXc_ActionFunc20 = 0x808E0938; // type:func -EnXc_ActionFunc21 = 0x808E095C; // type:func -EnXc_ActionFunc22 = 0x808E097C; // type:func -EnXc_ActionFunc23 = 0x808E09C4; // type:func -EnXc_ActionFunc24 = 0x808E0A24; // type:func -EnXc_ActionFunc25 = 0x808E0A34; // type:func -EnXc_ActionFunc26 = 0x808E0A44; // type:func -EnXc_ActionFunc27 = 0x808E0A54; // type:func -EnXc_ActionFunc28 = 0x808E0A64; // type:func -func_80B3EE64 = 0x808E0A74; // type:func -func_80B3EE74 = 0x808E0A88; // type:func -func_80B3EEA4 = 0x808E0ABC; // type:func -func_80B3EEC8 = 0x808E0AE0; // type:func -func_80B3EEEC = 0x808E0B04; // type:func -func_80B3EF10 = 0x808E0B28; // type:func -func_80B3EF34 = 0x808E0B4C; // type:func -func_80B3EF58 = 0x808E0B70; // type:func -func_80B3EF80 = 0x808E0B98; // type:func -func_80B3EFA4 = 0x808E0BBC; // type:func -func_80B3EFC8 = 0x808E0BE0; // type:func -func_80B3EFEC = 0x808E0C04; // type:func -func_80B3F010 = 0x808E0C28; // type:func -func_80B3F0B8 = 0x808E0CD4; // type:func -func_80B3F0DC = 0x808E0CF8; // type:func -func_80B3F100 = 0x808E0D1C; // type:func -EnXc_Serenade = 0x808E0D40; // type:func -EnXc_ActionFunc30 = 0x808E0D60; // type:func -EnXc_ActionFunc31 = 0x808E0D8C; // type:func -EnXc_ActionFunc32 = 0x808E0DD0; // type:func -EnXc_ActionFunc33 = 0x808E0DFC; // type:func -EnXc_ActionFunc34 = 0x808E0E28; // type:func -EnXc_ActionFunc35 = 0x808E0E54; // type:func -EnXc_ActionFunc36 = 0x808E0E80; // type:func -EnXc_ActionFunc37 = 0x808E0EAC; // type:func -EnXc_ActionFunc38 = 0x808E0ED8; // type:func -EnXc_ActionFunc39 = 0x808E0F04; // type:func -EnXc_ActionFunc40 = 0x808E0F30; // type:func -EnXc_ActionFunc41 = 0x808E0F90; // type:func -EnXc_ActionFunc42 = 0x808E0FBC; // type:func -EnXc_ActionFunc43 = 0x808E0FE8; // type:func -EnXc_ActionFunc44 = 0x808E1014; // type:func -func_80B3F3C8 = 0x808E1024; // type:func -func_80B3F3D8 = 0x808E1038; // type:func -EnXc_PlayDiveSFX = 0x808E1058; // type:func -EnXc_LakeHyliaDive = 0x808E10AC; // type:func -func_80B3F534 = 0x808E1198; // type:func -func_80B3F59C = 0x808E1200; // type:func -func_80B3F620 = 0x808E1284; // type:func -func_80B3F644 = 0x808E12A8; // type:func -func_80B3F668 = 0x808E12CC; // type:func -func_80B3F6DC = 0x808E1340; // type:func -EnXc_SetupKneelAction = 0x808E1364; // type:func -func_80B3F754 = 0x808E13BC; // type:func -func_80B3F7BC = 0x808E142C; // type:func -EnXc_ActionFunc45 = 0x808E1468; // type:func -EnXc_ActionFunc46 = 0x808E1494; // type:func -EnXc_ActionFunc47 = 0x808E14C0; // type:func -EnXc_ActionFunc48 = 0x808E1518; // type:func -EnXc_ActionFunc49 = 0x808E1544; // type:func -EnXc_Kneel = 0x808E15A8; // type:func -EnXc_ActionFunc51 = 0x808E160C; // type:func -EnXc_ActionFunc52 = 0x808E1670; // type:func -func_80B3FA08 = 0x808E1690; // type:func -func_80B3FA2C = 0x808E16B8; // type:func -EnXc_PlayTriforceSFX = 0x808E16D8; // type:func -func_80B3FAE0 = 0x808E1770; // type:func -EnXc_CalcTriforce = 0x808E17B8; // type:func -func_80B3FF0C = 0x808E1BB0; // type:func -EnXc_SetupShowTriforceAction = 0x808E1C58; // type:func -EnXc_SetupShowTriforceIdleAction = 0x808E1CE8; // type:func -func_80B400AC = 0x808E1D54; // type:func -EnXc_ActionFunc53 = 0x808E1D90; // type:func -EnXc_ActionFunc54 = 0x808E1DB0; // type:func -EnXc_ShowTriforce = 0x808E1DF8; // type:func -EnXc_ShowTriforceIdle = 0x808E1E60; // type:func -EnXc_TriforceOverrideLimbDraw = 0x808E1EBC; // type:func -EnXc_TriforcePostLimbDraw = 0x808E1EE4; // type:func -EnXc_DrawTriforce = 0x808E1F60; // type:func -func_80B40590 = 0x808E21F4; // type:func -EnXc_SetThrownAroundSFX = 0x808E2210; // type:func -EnXc_PlayLinkScreamSFX = 0x808E22D4; // type:func -EnXc_SetCrySFX = 0x808E2308; // type:func -func_80B406F8 = 0x808E2364; // type:func -EnXc_SetupIdleInNocturne = 0x808E237C; // type:func -EnXc_SetupDefenseStance = 0x808E2418; // type:func -EnXc_SetupContortions = 0x808E2490; // type:func -EnXc_SetupFallInNocturne = 0x808E252C; // type:func -EnXc_SetupHittingGroundInNocturne = 0x808E2608; // type:func -func_80B40A78 = 0x808E26A8; // type:func -EnXc_SetupKneelInNocturne = 0x808E2748; // type:func -func_80B40BB4 = 0x808E27E4; // type:func -func_80B40C50 = 0x808E2880; // type:func -func_80B40C74 = 0x808E28A4; // type:func -func_80B40C98 = 0x808E28C8; // type:func -func_80B40CBC = 0x808E28EC; // type:func -func_80B40CE0 = 0x808E2910; // type:func -func_80B40D08 = 0x808E2938; // type:func -func_80B40D2C = 0x808E295C; // type:func -func_80B40D50 = 0x808E2980; // type:func -func_80B40D74 = 0x808E29A4; // type:func -EnXc_SetupReverseHaltInNocturneCS = 0x808E29C8; // type:func -func_80B40E40 = 0x808E2A74; // type:func -func_80B40E64 = 0x808E2A98; // type:func -func_80B40E88 = 0x808E2ABC; // type:func -EnXc_SetupNocturneState = 0x808E2AE0; // type:func -EnXc_InitialNocturneAction = 0x808E2C20; // type:func -EnXc_IdleInNocturne = 0x808E2C40; // type:func -EnXc_DefenseStance = 0x808E2C90; // type:func -EnXc_Contort = 0x808E2CD8; // type:func -EnXc_FallInNocturne = 0x808E2D44; // type:func -EnXc_HitGroundInNocturne = 0x808E2DAC; // type:func -EnXc_ActionFunc63 = 0x808E2DEC; // type:func -EnXc_KneelInNocturneCS = 0x808E2E48; // type:func -EnXc_ActionFunc65 = 0x808E2E90; // type:func -EnXc_ActionFunc66 = 0x808E2ED4; // type:func -EnXc_ActionFunc67 = 0x808E2F00; // type:func -EnXc_ActionFunc68 = 0x808E2F2C; // type:func -EnXc_ActionFunc69 = 0x808E2F58; // type:func -EnXc_ActionFunc70 = 0x808E2F84; // type:func -EnXc_ActionFunc71 = 0x808E2FB0; // type:func -EnXc_ActionFunc72 = 0x808E2FDC; // type:func -EnXc_ReverseAccelInNocturneCS = 0x808E3008; // type:func -EnXc_ReverseWalkInNocturneCS = 0x808E3034; // type:func -EnXc_ReverseHaltInNocturneCS = 0x808E3088; // type:func -EnXc_ThrowNutInNocturneCS = 0x808E30B4; // type:func -EnXc_DeleteInNocturneCS = 0x808E30E0; // type:func -EnXc_KillInNocturneCS = 0x808E310C; // type:func -EnXc_DrawSquintingEyes = 0x808E3130; // type:func -EnXc_InitTempleOfTime = 0x808E320C; // type:func -EnXc_SetupDialogueAction = 0x808E3378; // type:func -func_80B41798 = 0x808E3400; // type:func -EnXc_BlockingPedestalAction = 0x808E344C; // type:func -EnXc_ActionFunc80 = 0x808E34B4; // type:func -EnXc_Update = 0x808E351C; // type:func -EnXc_Init = 0x808E3564; // type:func -EnXc_OverrideLimbDraw = 0x808E36D0; // type:func -EnXc_PostLimbDraw = 0x808E3758; // type:func -EnXc_DrawNothing = 0x808E37E4; // type:func -EnXc_DrawDefault = 0x808E37F4; // type:func -EnXc_Draw = 0x808E38FC; // type:func -BgHidanCurtain_Init = 0x808E4650; // type:func -BgHidanCurtain_Destroy = 0x808E4864; // type:func -BgHidanCurtain_WaitForSwitchOn = 0x808E4890; // type:func -BgHidanCurtain_WaitForCutscene = 0x808E4944; // type:func -BgHidanCurtain_WaitForClear = 0x808E4970; // type:func -BgHidanCurtain_WaitForSwitchOff = 0x808E49B4; // type:func -BgHidanCurtain_TurnOn = 0x808E49F8; // type:func -BgHidanCurtain_TurnOff = 0x808E4A6C; // type:func -BgHidanCurtain_WaitForTimer = 0x808E4B5C; // type:func -BgHidanCurtain_Update = 0x808E4BC0; // type:func -BgHidanCurtain_Draw = 0x808E4E54; // type:func -BgSpot00Hanebasi_Init = 0x808E50F0; // type:func -BgSpot00Hanebasi_Destroy = 0x808E5500; // type:func -BgSpot00Hanebasi_DrawbridgeWait = 0x808E555C; // type:func -BgSpot00Hanebasi_DoNothing = 0x808E568C; // type:func -BgSpot00Hanebasi_DrawbridgeRiseAndFall = 0x808E569C; // type:func -BgSpot00Hanebasi_SetTorchLightInfo = 0x808E57D0; // type:func -BgSpot00Hanebasi_Update = 0x808E5928; // type:func -BgSpot00Hanebasi_DrawTorches = 0x808E5C38; // type:func -BgSpot00Hanebasi_Draw = 0x808E5ED8; // type:func -EnMb_SetupAction = 0x808E6200; // type:func -EnMb_Init = 0x808E620C; // type:func -EnMb_Destroy = 0x808E6570; // type:func -EnMb_FaceWaypoint = 0x808E65C0; // type:func -EnMb_NextWaypoint = 0x808E65F8; // type:func -EnMb_IsPlayerInCorridor = 0x808E66E4; // type:func -EnMb_FindWaypointTowardsPlayer = 0x808E6858; // type:func -EnMb_SetupSpearGuardLookAround = 0x808E69E8; // type:func -EnMb_SetupClubWaitPlayerNear = 0x808E6A50; // type:func -EnMb_SetupSpearPatrolTurnTowardsWaypoint = 0x808E6AB4; // type:func -EnMb_SetupSpearGuardWalk = 0x808E6B2C; // type:func -EnMb_SetupSpearPatrolWalkTowardsWaypoint = 0x808E6BD0; // type:func -EnMb_SetupSpearPrepareAndCharge = 0x808E6C80; // type:func -EnMb_SetupSpearPatrolImmediateCharge = 0x808E6D38; // type:func -EnMb_SetupClubAttack = 0x808E6DA8; // type:func -EnMb_SetupSpearEndChargeQuick = 0x808E6E78; // type:func -EnMb_SetupSpearPatrolEndCharge = 0x808E6ED8; // type:func -EnMb_SetupClubWaitAfterAttack = 0x808E6F5C; // type:func -EnMb_SetupClubDamaged = 0x808E6FD4; // type:func -EnMb_SetupClubDamagedWhileKneeling = 0x808E7034; // type:func -EnMb_SetupClubDead = 0x808E70BC; // type:func -EnMb_SetupStunned = 0x808E7144; // type:func -EnMb_Stunned = 0x808E71E8; // type:func -EnMb_SpearGuardLookAround = 0x808E72F4; // type:func -EnMb_SpearPatrolTurnTowardsWaypoint = 0x808E736C; // type:func -EnMb_SpearEndChargeQuick = 0x808E74D0; // type:func -EnMb_ClubWaitAfterAttack = 0x808E7638; // type:func -EnMb_SpearPatrolEndCharge = 0x808E767C; // type:func -EnMb_SpearGuardPrepareAndCharge = 0x808E7994; // type:func -EnMb_ClubAttack = 0x808E7AFC; // type:func -EnMb_SpearPatrolPrepareAndCharge = 0x808E7E74; // type:func -EnMb_SpearPatrolImmediateCharge = 0x808E81D8; // type:func -EnMb_ClubDamaged = 0x808E8548; // type:func -EnMb_ClubDamagedWhileKneeling = 0x808E85DC; // type:func -EnMb_ClubDead = 0x808E86E8; // type:func -EnMb_SpearGuardWalk = 0x808E89AC; // type:func -EnMb_SpearPatrolWalkTowardsWaypoint = 0x808E8CBC; // type:func -EnMb_ClubWaitPlayerNear = 0x808E8FA8; // type:func -EnMb_SetupSpearDamaged = 0x808E9058; // type:func -EnMb_SpearDamaged = 0x808E9120; // type:func -EnMb_SetupSpearDead = 0x808E9198; // type:func -EnMb_SpearDead = 0x808E9270; // type:func -EnMb_SpearUpdateAttackCollider = 0x808E9488; // type:func -EnMb_ClubUpdateAttackCollider = 0x808E9614; // type:func -EnMb_CheckColliding = 0x808E96AC; // type:func -EnMb_Update = 0x808E9878; // type:func -EnMb_PostLimbDraw = 0x808E9A4C; // type:func -EnMb_Draw = 0x808E9BE8; // type:func -EnBombf_SetupAction = 0x808EA430; // type:func -EnBombf_Init = 0x808EA43C; // type:func -EnBombf_Destroy = 0x808EA618; // type:func -EnBombf_SetupGrowBomb = 0x808EA658; // type:func -EnBombf_GrowBomb = 0x808EA680; // type:func -EnBombf_Move = 0x808EA990; // type:func -EnBombf_WaitForRelease = 0x808EAAB4; // type:func -EnBombf_Explode = 0x808EAB18; // type:func -EnBombf_Update = 0x808EAC6C; // type:func -EnBombf_NewMtxDList = 0x808EB418; // type:func -EnBombf_Draw = 0x808EB4A4; // type:func -BgHidanFirewall_Init = 0x808EB8C0; // type:func -BgHidanFirewall_Destroy = 0x808EB960; // type:func -BgHidanFirewall_CheckProximity = 0x808EB98C; // type:func -BgHidanFirewall_Wait = 0x808EB9FC; // type:func -BgHidanFirewall_Countdown = 0x808EBA44; // type:func -BgHidanFirewall_Erupt = 0x808EBA78; // type:func -BgHidanFirewall_Collide = 0x808EBB08; // type:func -BgHidanFirewall_ColliderFollowPlayer = 0x808EBB70; // type:func -BgHidanFirewall_Update = 0x808EBCD4; // type:func -BgHidanFirewall_Draw = 0x808EBDAC; // type:func -BgDyYoseizo_Init = 0x808EC020; // type:func -BgDyYoseizo_Destroy = 0x808EC124; // type:func -BgDyYoseizo_SpawnEffects = 0x808EC134; // type:func -BgDyYoseizo_Bob = 0x808EC430; // type:func -BgDyYoseizo_CheckMagicAcquired = 0x808EC4F8; // type:func -BgDyYoseizo_ChooseType = 0x808EC5BC; // type:func -BgDyYoseizo_SetupSpinGrow_NoReward = 0x808EC9B8; // type:func -BgDyYoseizo_SpinGrow_NoReward = 0x808ECAB4; // type:func -BgDyYoseizo_CompleteSpinGrow_NoReward = 0x808ECC10; // type:func -BgDyYoseizo_SetupGreetPlayer_NoReward = 0x808ECCC0; // type:func -BgDyYoseizo_GreetPlayer_NoReward = 0x808ECDD8; // type:func -BgDyYoseizo_SetupHealPlayer_NoReward = 0x808ECEB4; // type:func -BgDyYoseizo_HealPlayer_NoReward = 0x808ECFA0; // type:func -BgDyYoseizo_SayFarewell_NoReward = 0x808ED278; // type:func -BgDyYoseizo_SetupSpinShrink = 0x808ED354; // type:func -BgDyYoseizo_SpinShrink = 0x808ED458; // type:func -BgDyYoseizo_Vanish = 0x808ED548; // type:func -BgDyYoseizo_SetupSpinGrow_Reward = 0x808ED5EC; // type:func -BgDyYoseizo_SpinGrowSetupGive_Reward = 0x808ED720; // type:func -BgDyYoseizo_Give_Reward = 0x808EDA4C; // type:func -BgDyYoseizo_Update = 0x808EE09C; // type:func -BgDyYoseizo_OverrideLimbDraw = 0x808EE2C8; // type:func -BgDyYoseizo_Draw = 0x808EE330; // type:func -BgDyYoseizo_SpawnEffect = 0x808EE4B8; // type:func -BgDyYoseizo_UpdateEffects = 0x808EE5C8; // type:func -BgDyYoseizo_DrawEffects = 0x808EE8BC; // type:func -EnZl2_Destroy = 0x808EEE10; // type:func -EnZl2_UpdateEyes = 0x808EEE34; // type:func -func_80B4EA40 = 0x808EEEC4; // type:func -func_80B4EAF4 = 0x808EEF78; // type:func -func_80B4EBB8 = 0x808EF03C; // type:func -func_80B4EC48 = 0x808EF0CC; // type:func -EnZl2_setEyesIndex = 0x808EF16C; // type:func -EnZl2_setEyeIndex2 = 0x808EF18C; // type:func -EnZl2_setMouthIndex = 0x808EF1A4; // type:func -func_80B4ED2C = 0x808EF1BC; // type:func -EnZl2_UpdateSkelAnime = 0x808EF204; // type:func -EnZl2_GetCue = 0x808EF228; // type:func -func_80B4EDB8 = 0x808EF250; // type:func -func_80B4EE38 = 0x808EF2D0; // type:func -func_80B4EF64 = 0x808EF400; // type:func -func_80B4F230 = 0x808EF6D0; // type:func -func_80B4F45C = 0x808EF900; // type:func -EnZl2_PostLimbDraw = 0x808EFFCC; // type:func -func_80B4FCCC = 0x808F0118; // type:func -func_80B4FD00 = 0x808F0150; // type:func -func_80B4FD90 = 0x808F01E0; // type:func -func_80B4FDD4 = 0x808F0224; // type:func -func_80B4FE10 = 0x808F0264; // type:func -func_80B4FE48 = 0x808F029C; // type:func -func_80B4FE6C = 0x808F02C4; // type:func -func_80B4FE90 = 0x808F02EC; // type:func -func_80B4FEB4 = 0x808F0314; // type:func -func_80B4FED8 = 0x808F033C; // type:func -EnZl2_GiveLightArrows = 0x808F0364; // type:func -func_80B4FF84 = 0x808F03F4; // type:func -func_80B4FFF0 = 0x808F0460; // type:func -func_80B5008C = 0x808F0500; // type:func -func_80B500E0 = 0x808F0554; // type:func -func_80B501C4 = 0x808F0638; // type:func -func_80B501E8 = 0x808F065C; // type:func -func_80B50260 = 0x808F06D4; // type:func -func_80B50278 = 0x808F06F0; // type:func -func_80B50304 = 0x808F077C; // type:func -func_80B503DC = 0x808F0854; // type:func -func_80B5042C = 0x808F08A4; // type:func -func_80B50488 = 0x808F0900; // type:func -func_80B504D4 = 0x808F094C; // type:func -func_80B5053C = 0x808F09B0; // type:func -func_80B50580 = 0x808F09F8; // type:func -func_80B505D4 = 0x808F0A4C; // type:func -func_80B50618 = 0x808F0A94; // type:func -func_80B50644 = 0x808F0AC0; // type:func -func_80B50670 = 0x808F0AEC; // type:func -func_80B506C4 = 0x808F0B40; // type:func -func_80B5073C = 0x808F0BBC; // type:func -func_80B50780 = 0x808F0C04; // type:func -func_80B507E8 = 0x808F0C6C; // type:func -func_80B5082C = 0x808F0CB4; // type:func -func_80B50880 = 0x808F0D08; // type:func -func_80B508C8 = 0x808F0D50; // type:func -func_80B50928 = 0x808F0DAC; // type:func -func_80B50970 = 0x808F0DF4; // type:func -func_80B50980 = 0x808F0E08; // type:func -func_80B509A0 = 0x808F0E2C; // type:func -func_80B50A04 = 0x808F0E90; // type:func -func_80B50BBC = 0x808F1034; // type:func -func_80B50BEC = 0x808F106C; // type:func -func_80B50C40 = 0x808F10C8; // type:func -func_80B50CA8 = 0x808F1138; // type:func -func_80B50CFC = 0x808F1194; // type:func -func_80B50D50 = 0x808F11F0; // type:func -func_80B50D94 = 0x808F123C; // type:func -func_80B50DE8 = 0x808F1298; // type:func -func_80B50E3C = 0x808F12F4; // type:func -func_80B50E90 = 0x808F1350; // type:func -func_80B50EE4 = 0x808F13AC; // type:func -func_80B50F38 = 0x808F1408; // type:func -func_80B50F8C = 0x808F1464; // type:func -func_80B50FE8 = 0x808F14C8; // type:func -func_80B51034 = 0x808F151C; // type:func -func_80B51080 = 0x808F1570; // type:func -func_80B510CC = 0x808F15C4; // type:func -func_80B51118 = 0x808F1618; // type:func -func_80B51164 = 0x808F166C; // type:func -func_80B511B0 = 0x808F16C0; // type:func -func_80B511FC = 0x808F1714; // type:func -func_80B51250 = 0x808F1770; // type:func -func_80B512B8 = 0x808F17E0; // type:func -func_80B51310 = 0x808F1840; // type:func -func_80B5135C = 0x808F1890; // type:func -func_80B513A8 = 0x808F18DC; // type:func -func_80B51418 = 0x808F1950; // type:func -func_80B5146C = 0x808F19A4; // type:func -func_80B5149C = 0x808F19D8; // type:func -func_80B514F8 = 0x808F1A38; // type:func -func_80B5154C = 0x808F1A8C; // type:func -func_80B515C4 = 0x808F1B04; // type:func -func_80B515D8 = 0x808F1B1C; // type:func -func_80B51644 = 0x808F1B88; // type:func -func_80B51678 = 0x808F1BBC; // type:func -func_80B516D0 = 0x808F1C14; // type:func -func_80B51704 = 0x808F1C48; // type:func -func_80B5175C = 0x808F1CA0; // type:func -func_80B51790 = 0x808F1CD4; // type:func -func_80B517E0 = 0x808F1D24; // type:func -func_80B51824 = 0x808F1D6C; // type:func -func_80B5187C = 0x808F1DC4; // type:func -func_80B518C0 = 0x808F1E0C; // type:func -func_80B51948 = 0x808F1E94; // type:func -func_80B51A5C = 0x808F1F94; // type:func -func_80B51A8C = 0x808F1FCC; // type:func -func_80B51AE4 = 0x808F202C; // type:func -func_80B51B44 = 0x808F2094; // type:func -func_80B51BA8 = 0x808F2100; // type:func -func_80B51C0C = 0x808F216C; // type:func -func_80B51C64 = 0x808F21CC; // type:func -func_80B51CA8 = 0x808F2218; // type:func -func_80B51D0C = 0x808F2284; // type:func -func_80B51D24 = 0x808F22A0; // type:func -func_80B51DA4 = 0x808F2320; // type:func -func_80B51EA8 = 0x808F2424; // type:func -func_80B51EBC = 0x808F243C; // type:func -func_80B51F38 = 0x808F24BC; // type:func -func_80B51FA8 = 0x808F252C; // type:func -func_80B52068 = 0x808F25D8; // type:func -func_80B52098 = 0x808F2610; // type:func -func_80B52108 = 0x808F2688; // type:func -func_80B52114 = 0x808F2698; // type:func -func_80B521A0 = 0x808F26F8; // type:func -EnZl2_Update = 0x808F2784; // type:func -EnZl2_Init = 0x808F27CC; // type:func -EnZl2_OverrideLimbDraw = 0x808F2878; // type:func -func_80B523BC = 0x808F28E0; // type:func -func_80B523C8 = 0x808F28F0; // type:func -func_80B525D4 = 0x808F2ACC; // type:func -EnZl2_Draw = 0x808F2C74; // type:func -BgHidanFslift_Init = 0x808F3510; // type:func -BgHidanFslift_SetHookshotTargetPos = 0x808F35F8; // type:func -BgHidanFslift_Destroy = 0x808F3658; // type:func -BgHidanFslift_SetupIdle = 0x808F368C; // type:func -BgHidanFslift_Idle = 0x808F36A8; // type:func -BgHidanFslift_Descend = 0x808F3748; // type:func -BgHidanFslift_Ascend = 0x808F37B4; // type:func -BgHidanFslift_Update = 0x808F3850; // type:func -BgHidanFslift_Draw = 0x808F38F8; // type:func -EnOE2_SetupAction = 0x808F39E0; // type:func -EnOE2_Init = 0x808F39EC; // type:func -EnOE2_Destroy = 0x808F3A14; // type:func -EnOE2_DoNothing = 0x808F3A24; // type:func -EnOE2_Update = 0x808F3A34; // type:func -EnOE2_Draw = 0x808F3A44; // type:func -BgYdanHasi_Init = 0x808F3AC0; // type:func -BgYdanHasi_Destroy = 0x808F3C24; // type:func -BgYdanHasi_UpdateFloatingBlock = 0x808F3C58; // type:func -BgYdanHasi_InitWater = 0x808F3D90; // type:func -BgYdanHasi_MoveWater = 0x808F3DDC; // type:func -BgYdanHasi_DecWaterTimer = 0x808F3EAC; // type:func -BgYdanHasi_SetupThreeBlocks = 0x808F3F00; // type:func -BgYdanHasi_UpdateThreeBlocks = 0x808F3F6C; // type:func -BgYdanHasi_Update = 0x808F403C; // type:func -BgYdanHasi_Draw = 0x808F4060; // type:func -BgYdanMaruta_Init = 0x808F4270; // type:func -BgYdanMaruta_Destroy = 0x808F44D4; // type:func -func_808BEFF4 = 0x808F4528; // type:func -func_808BF078 = 0x808F45AC; // type:func -func_808BF108 = 0x808F463C; // type:func -func_808BF1EC = 0x808F4720; // type:func -BgYdanMaruta_DoNothing = 0x808F4790; // type:func -BgYdanMaruta_Update = 0x808F47A0; // type:func -BgYdanMaruta_Draw = 0x808F47C4; // type:func -BossGanondrof_ClearPixels8x8 = 0x808F4950; // type:func -BossGanondrof_ClearPixels16x8 = 0x808F4990; // type:func -BossGanondrof_ClearPixels16x16 = 0x808F49D0; // type:func -BossGanondrof_ClearPixels32x16 = 0x808F4A00; // type:func -BossGanondrof_ClearPixels16x32 = 0x808F4A48; // type:func -BossGanondrof_ClearPixels = 0x808F4A94; // type:func -BossGanondrof_SetColliderPos = 0x808F4D44; // type:func -BossGanondrof_Init = 0x808F4D88; // type:func -BossGanondrof_Destroy = 0x808F5018; // type:func -BossGanondrof_SetupIntro = 0x808F5084; // type:func -BossGanondrof_Intro = 0x808F50D0; // type:func -BossGanondrof_SetupPaintings = 0x808F5588; // type:func -BossGanondrof_Paintings = 0x808F55CC; // type:func -BossGanondrof_SetupNeutral = 0x808F57A0; // type:func -BossGanondrof_Neutral = 0x808F5820; // type:func -BossGanondrof_SetupThrow = 0x808F5F68; // type:func -BossGanondrof_Throw = 0x808F6090; // type:func -BossGanondrof_SetupReturn = 0x808F629C; // type:func -BossGanondrof_Return = 0x808F633C; // type:func -BossGanondrof_SetupStunned = 0x808F6448; // type:func -BossGanondrof_Stunned = 0x808F650C; // type:func -BossGanondrof_SetupBlock = 0x808F6620; // type:func -BossGanondrof_Block = 0x808F6694; // type:func -BossGanondrof_SetupCharge = 0x808F6770; // type:func -BossGanondrof_Charge = 0x808F67E0; // type:func -BossGanondrof_SetupDeath = 0x808F6EC4; // type:func -BossGanondrof_Death = 0x808F6F5C; // type:func -BossGanondrof_CollisionCheck = 0x808F7E4C; // type:func -BossGanondrof_Update = 0x808F8078; // type:func -BossGanondrof_OverrideLimbDraw = 0x808F8480; // type:func -BossGanondrof_PostLimbDraw = 0x808F885C; // type:func -BossGanondrof_GetClearPixelDList = 0x808F8920; // type:func -BossGanondrof_EmptyDList = 0x808F898C; // type:func -BossGanondrof_Draw = 0x808F89B0; // type:func -EnAm_SetupAction = 0x808F96E0; // type:func -EnAm_CanMove = 0x808F96EC; // type:func -EnAm_Init = 0x808F9818; // type:func -EnAm_Destroy = 0x808F99E4; // type:func -EnAm_SpawnEffects = 0x808F9A3C; // type:func -EnAm_SetupSleep = 0x808F9BD8; // type:func -EnAm_SetupStatue = 0x808F9C74; // type:func -EnAm_SetupLunge = 0x808F9D04; // type:func -EnAm_SetupCooldown = 0x808F9D68; // type:func -EnAm_SetupMoveToHome = 0x808F9DD4; // type:func -EnAm_SetupRotateToInit = 0x808F9E30; // type:func -EnAm_SetupRotateToHome = 0x808F9E8C; // type:func -EnAm_SetupRecoilFromDamage = 0x808F9EE8; // type:func -EnAm_SetupRicochet = 0x808F9FC0; // type:func -EnAm_Sleep = 0x808FA074; // type:func -EnAm_RotateToHome = 0x808FA2E0; // type:func -EnAm_RotateToInit = 0x808FA3E4; // type:func -EnAm_MoveToHome = 0x808FA550; // type:func -EnAm_RecoilFromDamage = 0x808FA6C0; // type:func -EnAm_Cooldown = 0x808FA764; // type:func -EnAm_Lunge = 0x808FA89C; // type:func -EnAm_Statue = 0x808FAAD0; // type:func -EnAm_SetupStunned = 0x808FAD20; // type:func -EnAm_Stunned = 0x808FAE0C; // type:func -EnAm_Ricochet = 0x808FAEE0; // type:func -EnAm_TransformSwordHitbox = 0x808FAF94; // type:func -EnAm_UpdateDamage = 0x808FB02C; // type:func -EnAm_Update = 0x808FB1C4; // type:func -EnAm_PostLimbDraw = 0x808FB568; // type:func -EnAm_Draw = 0x808FB5B0; // type:func -EnDekubaba_Init = 0x808FBAE0; // type:func -EnDekubaba_Destroy = 0x808FBD24; // type:func -EnDekubaba_DisableACColliderElems = 0x808FBD50; // type:func -EnDekubaba_SetupWait = 0x808FBDD8; // type:func -EnDekubaba_SetupGrow = 0x808FC040; // type:func -EnDekubaba_SetupRetract = 0x808FC170; // type:func -EnDekubaba_SetupDecideLunge = 0x808FC258; // type:func -EnDekubaba_SetupPrepareLunge = 0x808FC2B0; // type:func -EnDekubaba_SetupLunge = 0x808FC2D4; // type:func -EnDekubaba_SetupPullBack = 0x808FC318; // type:func -EnDekubaba_SetupRecover = 0x808FC390; // type:func -EnDekubaba_SetupHit = 0x808FC3C4; // type:func -EnDekubaba_SetupPrunedSomersault = 0x808FC48C; // type:func -EnDekubaba_SetupShrinkDie = 0x808FC500; // type:func -EnDekubaba_SetupStunnedVertical = 0x808FC580; // type:func -EnDekubaba_SetupSway = 0x808FC704; // type:func -EnDekubaba_SetupDeadStickDrop = 0x808FC770; // type:func -EnDekubaba_Wait = 0x808FC810; // type:func -EnDekubaba_Grow = 0x808FC8BC; // type:func -EnDekubaba_Retract = 0x808FCD24; // type:func -EnDekubaba_UpdateHeadPosition = 0x808FD0EC; // type:func -EnDekubaba_DecideLunge = 0x808FD1F0; // type:func -EnDekubaba_Lunge = 0x808FD420; // type:func -EnDekubaba_PrepareLunge = 0x808FD6A8; // type:func -EnDekubaba_PullBack = 0x808FD774; // type:func -EnDekubaba_Recover = 0x808FDB00; // type:func -EnDekubaba_Hit = 0x808FDBF8; // type:func -EnDekubaba_StunnedVertical = 0x808FDD08; // type:func -EnDekubaba_Sway = 0x808FDDA4; // type:func -EnDekubaba_PrunedSomersault = 0x808FDECC; // type:func -EnDekubaba_ShrinkDie = 0x808FE230; // type:func -EnDekubaba_DeadStickDrop = 0x808FE3F4; // type:func -EnDekubaba_UpdateDamage = 0x808FE45C; // type:func -EnDekubaba_Update = 0x808FE710; // type:func -EnDekubaba_DrawStemRetracted = 0x808FE8B0; // type:func -EnDekubaba_DrawStemExtended = 0x808FE9A0; // type:func -EnDekubaba_DrawStemBasePruned = 0x808FEC90; // type:func -EnDekubaba_DrawBaseShadow = 0x808FED50; // type:func -EnDekubaba_PostLimbDraw = 0x808FEE44; // type:func -EnDekubaba_Draw = 0x808FEE80; // type:func -EnMFire1_Init = 0x808FF590; // type:func -EnMFire1_Destroy = 0x808FF5FC; // type:func -EnMFire1_Update = 0x808FF628; // type:func -func_80A9EFE0 = 0x808FF730; // type:func -EnMThunder_Init = 0x808FF73C; // type:func -EnMThunder_Destroy = 0x808FF9FC; // type:func -func_80A9F314 = 0x808FFA6C; // type:func -func_80A9F350 = 0x808FFAA8; // type:func -func_80A9F408 = 0x808FFB60; // type:func -func_80A9F938 = 0x80900094; // type:func -func_80A9F9B4 = 0x80900110; // type:func -EnMThunder_Update = 0x8090027C; // type:func -EnMThunder_Draw = 0x80900450; // type:func -BgDdanJd_Init = 0x80900D30; // type:func -BgDdanJd_Destroy = 0x80900DDC; // type:func -BgDdanJd_Idle = 0x80900E10; // type:func -BgDdanJd_MoveEffects = 0x80900FB4; // type:func -BgDdanJd_Move = 0x8090118C; // type:func -BgDdanJd_Update = 0x80901290; // type:func -BgDdanJd_Draw = 0x809012B4; // type:func -BgBreakwall_SetupAction = 0x80901380; // type:func -BgBreakwall_Init = 0x8090138C; // type:func -BgBreakwall_Destroy = 0x80901538; // type:func -BgBreakwall_SpawnFragments = 0x8090156C; // type:func -BgBreakwall_WaitForObject = 0x80901A3C; // type:func -BgBreakwall_Wait = 0x80901B44; // type:func -BgBreakwall_LavaCoverMove = 0x80901D14; // type:func -BgBreakwall_Update = 0x80901D68; // type:func -BgBreakwall_Draw = 0x80901D8C; // type:func -EnJj_SetupAction = 0x809021F0; // type:func -EnJj_Init = 0x809021FC; // type:func -EnJj_Destroy = 0x8090248C; // type:func -EnJj_Blink = 0x8090251C; // type:func -EnJj_OpenMouth = 0x8090259C; // type:func -EnJj_WaitToOpenMouth = 0x809025F0; // type:func -EnJj_WaitForFish = 0x80902634; // type:func -EnJj_BeginCutscene = 0x809026F0; // type:func -EnJj_CutsceneUpdate = 0x80902798; // type:func -EnJj_RemoveDust = 0x809028F4; // type:func -EnJj_UpdateStaticCollision = 0x8090294C; // type:func -EnJj_Update = 0x8090295C; // type:func -EnJj_Draw = 0x80902A08; // type:func -EnHorseZelda_GetFieldPosition = 0x809037C0; // type:func -EnHorseZelda_Move = 0x8090380C; // type:func -EnHorseZelda_Init = 0x809039D4; // type:func -EnHorseZelda_Destroy = 0x80903B24; // type:func -EnHorseZelda_SetupStop = 0x80903B74; // type:func -EnHorseZelda_Stop = 0x80903BC4; // type:func -EnHorseZelda_Spur = 0x80903C0C; // type:func -EnHorseZelda_Gallop = 0x80903CF4; // type:func -EnHorseZelda_SetRotate = 0x80903D34; // type:func -EnHorseZelda_Update = 0x80903DF8; // type:func -EnHorseZelda_PostDraw = 0x80903ED4; // type:func -EnHorseZelda_Draw = 0x80904060; // type:func -BgDdanKd_SetupAction = 0x809042B0; // type:func -BgDdanKd_Init = 0x809042BC; // type:func -BgDdanKd_Destroy = 0x809043B4; // type:func -BgDdanKd_CheckForExplosions = 0x809043FC; // type:func -BgDdanKd_LowerStairs = 0x80904514; // type:func -BgDdanKd_DoNothing = 0x809049E8; // type:func -BgDdanKd_Update = 0x809049F8; // type:func -BgDdanKd_Draw = 0x80904A1C; // type:func -DoorWarp1_SetupAction = 0x80904BA0; // type:func -DoorWarp1_Init = 0x80904BAC; // type:func -DoorWarp1_Destroy = 0x80904D1C; // type:func -DoorWarp1_SetupWarp = 0x80904DA4; // type:func -DoorWarp1_SetupAdultDungeonWarp = 0x809050AC; // type:func -DoorWarp1_SetupBlueCrystal = 0x80905278; // type:func -DoorWarp1_SetupPurpleCrystal = 0x80905410; // type:func -DoorWarp1_SetPlayerPos = 0x809055B0; // type:func -DoorWarp1_BlueCrystal = 0x809055E8; // type:func -func_80999214 = 0x80905634; // type:func -func_80999348 = 0x80905768; // type:func -DoorWarp1_FloatPlayer = 0x80905830; // type:func -DoorWarp1_PurpleCrystal = 0x8090584C; // type:func -DoorWarp1_ChooseInitialAction = 0x8090592C; // type:func -DoorWarp1_AwaitClearFlag = 0x809059A4; // type:func -func_809995D4 = 0x809059FC; // type:func -DoorWarp1_WarpAppear = 0x80905B4C; // type:func -func_809998A4 = 0x80905CD0; // type:func -DoorWarp1_PlayerInRange = 0x80905D68; // type:func -DoorWarp1_ChildWarpIdle = 0x80905DD4; // type:func -DoorWarp1_ChildWarpOut = 0x80905EA0; // type:func -DoorWarp1_RutoWarpIdle = 0x80906294; // type:func -func_80999EE0 = 0x80906314; // type:func -func_80999FE4 = 0x8090641C; // type:func -DoorWarp1_RutoWarpOut = 0x809064D4; // type:func -func_8099A3A4 = 0x809067E0; // type:func -DoorWarp1_AdultWarpIdle = 0x809068AC; // type:func -func_8099A508 = 0x8090694C; // type:func -DoorWarp1_AdultWarpOut = 0x80906A30; // type:func -DoorWarp1_Destination = 0x80907314; // type:func -DoorWarp1_DoNothing = 0x80907444; // type:func -func_8099B020 = 0x80907454; // type:func -DoorWarp1_Update = 0x80907510; // type:func -DoorWarp1_DrawBlueCrystal = 0x80907574; // type:func -DoorWarp1_DrawPurpleCrystal = 0x80907744; // type:func -DoorWarp1_DrawWarp = 0x809079C8; // type:func -DoorWarp1_Draw = 0x80908874; // type:func -ObjSyokudai_Init = 0x80908EB0; // type:func -ObjSyokudai_Destroy = 0x80909074; // type:func -ObjSyokudai_Update = 0x809090C8; // type:func -ObjSyokudai_Draw = 0x809096E4; // type:func -ItemBHeart_Init = 0x80909B00; // type:func -ItemBHeart_Destroy = 0x80909B6C; // type:func -ItemBHeart_Update = 0x80909B7C; // type:func -func_80B85264 = 0x80909C24; // type:func -ItemBHeart_Draw = 0x80909D10; // type:func -EnDekunuts_Init = 0x80909F10; // type:func -EnDekunuts_Destroy = 0x8090A07C; // type:func -EnDekunuts_SetupWait = 0x8090A0B8; // type:func -EnDekunuts_SetupLookAround = 0x8090A12C; // type:func -EnDekunuts_SetupThrowNut = 0x8090A174; // type:func -EnDekunuts_SetupStand = 0x8090A1B8; // type:func -EnDekunuts_SetupBurrow = 0x8090A220; // type:func -EnDekunuts_SetupBeginRun = 0x8090A270; // type:func -EnDekunuts_SetupRun = 0x8090A2D8; // type:func -EnDekunuts_SetupGasp = 0x8090A330; // type:func -EnDekunuts_SetupBeDamaged = 0x8090A390; // type:func -EnDekunuts_SetupBeStunned = 0x8090A46C; // type:func -EnDekunuts_SetupDie = 0x8090A500; // type:func -EnDekunuts_Wait = 0x8090A550; // type:func -EnDekunuts_LookAround = 0x8090A7B4; // type:func -EnDekunuts_Stand = 0x8090A838; // type:func -EnDekunuts_ThrowNut = 0x8090A924; // type:func -EnDekunuts_Burrow = 0x8090AA7C; // type:func -EnDekunuts_BeginRun = 0x8090AB90; // type:func -EnDekunuts_Run = 0x8090ABF8; // type:func -EnDekunuts_Gasp = 0x8090AE38; // type:func -EnDekunuts_BeDamaged = 0x8090AEA0; // type:func -EnDekunuts_BeStunned = 0x8090AEF0; // type:func -EnDekunuts_Die = 0x8090AF6C; // type:func -EnDekunuts_ColliderCheck = 0x8090B0C8; // type:func -EnDekunuts_Update = 0x8090B1EC; // type:func -EnDekunuts_OverrideLimbDraw = 0x8090B354; // type:func -EnDekunuts_Draw = 0x8090B488; // type:func -BgMenkuriKaiten_Init = 0x8090B710; // type:func -BgMenkuriKaiten_Destroy = 0x8090B778; // type:func -BgMenkuriKaiten_Update = 0x8090B7AC; // type:func -BgMenkuriKaiten_Draw = 0x8090B80C; // type:func -BgMenkuriEye_Init = 0x8090B8A0; // type:func -BgMenkuriEye_Destroy = 0x8090B97C; // type:func -BgMenkuriEye_Update = 0x8090B9A8; // type:func -BgMenkuriEye_Draw = 0x8090BB18; // type:func -EnVali_Init = 0x8090BD40; // type:func -EnVali_Destroy = 0x8090BEBC; // type:func -EnVali_SetupLurk = 0x8090BF0C; // type:func -EnVali_SetupDropAppear = 0x8090BF5C; // type:func -EnVali_SetupFloatIdle = 0x8090BF94; // type:func -EnVali_SetupAttacked = 0x8090C1AC; // type:func -EnVali_SetupRetaliate = 0x8090C1E4; // type:func -EnVali_SetupMoveArmsDown = 0x8090C254; // type:func -EnVali_SetupBurnt = 0x8090C294; // type:func -EnVali_SetupDivideAndDie = 0x8090C2EC; // type:func -EnVali_SetupStunned = 0x8090C3F0; // type:func -EnVali_SetupFrozen = 0x8090C47C; // type:func -EnVali_SetupReturnToLurk = 0x8090C4DC; // type:func -EnVali_DischargeLightning = 0x8090C538; // type:func -EnVali_Lurk = 0x8090C734; // type:func -EnVali_DropAppear = 0x8090C774; // type:func -EnVali_FloatIdle = 0x8090C808; // type:func -EnVali_Attacked = 0x8090C9B4; // type:func -EnVali_Retaliate = 0x8090CA6C; // type:func -EnVali_MoveArmsDown = 0x8090CAC8; // type:func -EnVali_Burnt = 0x8090CB04; // type:func -EnVali_DivideAndDie = 0x8090CB40; // type:func -EnVali_Stunned = 0x8090CCF4; // type:func -EnVali_Frozen = 0x8090CDB0; // type:func -EnVali_ReturnToLurk = 0x8090CF40; // type:func -EnVali_UpdateDamage = 0x8090CFB0; // type:func -EnVali_Update = 0x8090D168; // type:func -EnVali_PulseOutside = 0x8090D2C4; // type:func -EnVali_PulseInsides = 0x8090D4E0; // type:func -EnVali_SetArmLength = 0x8090D6FC; // type:func -EnVali_OverrideLimbDraw = 0x8090D89C; // type:func -EnVali_PostLimbDraw = 0x8090D92C; // type:func -EnVali_DrawBody = 0x8090D9F0; // type:func -EnVali_Draw = 0x8090DD58; // type:func -BgMizuMovebg_GetDragonStatueBossRoomOffsetIndex = 0x8090E400; // type:func -BgMizuMovebg_Init = 0x8090E46C; // type:func -BgMizuMovebg_Destroy = 0x8090E834; // type:func -BgMizuMovebg_SetPosFromPath = 0x8090E8E8; // type:func -BgMizuMovebg_SetScrollAlphas = 0x8090E97C; // type:func -BgMizuMovebg_UpdateMain = 0x8090EB00; // type:func -BgMizuMovebg_UpdateHookshotPlatform = 0x8090EE3C; // type:func -BgMizuMovebg_Update = 0x8090EFF8; // type:func -BgMizuMovebg_Draw = 0x8090F01C; // type:func -BgMizuWater_GetWaterLevelActionIndex = 0x8090F590; // type:func -BgMizuWater_SetWaterBoxesHeight = 0x8090F630; // type:func -BgMizuWater_Init = 0x8090F69C; // type:func -BgMizuWater_Destroy = 0x8090F8F8; // type:func -BgMizuWater_WaitForAction = 0x8090F908; // type:func -BgMizuWater_ChangeWaterLevel = 0x8090FAD4; // type:func -BgMizuWater_Update = 0x8090FDE4; // type:func -BgMizuWater_Draw = 0x8090FF3C; // type:func -ArmsHook_SetupAction = 0x80910260; // type:func -ArmsHook_Init = 0x8091026C; // type:func -ArmsHook_Destroy = 0x809102E0; // type:func -ArmsHook_Wait = 0x80910328; // type:func -ArmsHook_PullPlayer = 0x809103A8; // type:func -ArmsHook_AttachToPlayer = 0x809103BC; // type:func -ArmsHook_DetachFromActor = 0x809103EC; // type:func -ArmsHook_CheckForCancel = 0x80910414; // type:func -ArmsHook_AttachToActor = 0x809104B0; // type:func -ArmsHook_Shoot = 0x809104F8; // type:func -ArmsHook_Update = 0x80910B64; // type:func -ArmsHook_Draw = 0x80910BA4; // type:func -EnfHG_Init = 0x80910FD0; // type:func -EnfHG_Destroy = 0x809110D0; // type:func -EnfHG_SetupIntro = 0x809110FC; // type:func -EnfHG_Intro = 0x80911160; // type:func -EnfHG_SetupApproach = 0x8091236C; // type:func -EnfHG_Approach = 0x809125B8; // type:func -EnfHG_Attack = 0x8091275C; // type:func -EnfHG_Damage = 0x80912BE0; // type:func -EnfHG_Retreat = 0x80912F10; // type:func -EnfHG_Done = 0x80913144; // type:func -EnfHG_Update = 0x80913154; // type:func -EnfHG_PostDraw = 0x809132E8; // type:func -EnfHG_Draw = 0x809132FC; // type:func -BgMoriHineri_Init = 0x80913900; // type:func -BgMoriHineri_Destroy = 0x80913B00; // type:func -func_808A39FC = 0x80913B34; // type:func -BgMoriHineri_DoNothing = 0x80913D2C; // type:func -BgMoriHineri_SpawnBossKeyChest = 0x80913D3C; // type:func -func_808A3C8C = 0x80913DCC; // type:func -func_808A3D58 = 0x80913E98; // type:func -func_808A3E54 = 0x80913F94; // type:func -BgMoriHineri_Update = 0x80914074; // type:func -BgMoriHineri_DrawHallAndRoom = 0x80914098; // type:func -EnBb_SetupAction = 0x80914650; // type:func -EnBb_FindExplosive = 0x8091465C; // type:func -EnBb_SpawnFlameTrail = 0x809146F0; // type:func -EnBb_KillFlameTrail = 0x8091488C; // type:func -EnBb_Init = 0x809148D8; // type:func -EnBb_Destroy = 0x80914C80; // type:func -EnBb_SetupFlameTrail = 0x80914CAC; // type:func -EnBb_FlameTrail = 0x80914D00; // type:func -EnBb_SetupDeath = 0x80914E7C; // type:func -EnBb_Death = 0x80914F10; // type:func -EnBb_SetupDamage = 0x8091508C; // type:func -EnBb_Damage = 0x8091514C; // type:func -EnBb_SetupBlue = 0x809151B8; // type:func -EnBb_Blue = 0x80915278; // type:func -EnBb_SetupDown = 0x80915A6C; // type:func -EnBb_Down = 0x80915AFC; // type:func -EnBb_SetupRed = 0x80915DD0; // type:func -EnBb_Red = 0x80915EE0; // type:func -EnBb_FaceWaypoint = 0x809162A8; // type:func -EnBb_SetWaypoint = 0x809162DC; // type:func -EnBb_SetupWhite = 0x809163A8; // type:func -EnBb_White = 0x80916458; // type:func -EnBb_InitGreen = 0x809167DC; // type:func -EnBb_SetupGreen = 0x80916914; // type:func -EnBb_Green = 0x809169AC; // type:func -EnBb_SetupStunned = 0x8091701C; // type:func -EnBb_Stunned = 0x80917130; // type:func -EnBb_CollisionCheck = 0x809172D4; // type:func -EnBb_Update = 0x80917608; // type:func -EnBb_PostLimbDraw = 0x80917888; // type:func -EnBb_Draw = 0x809178D8; // type:func -BgTokiHikari_Init = 0x80918330; // type:func -BgTokiHikari_Destroy = 0x809183BC; // type:func -BgTokiHikari_DoNothing = 0x809183CC; // type:func -BgTokiHikari_Update = 0x809183DC; // type:func -BgTokiHikari_Draw = 0x80918400; // type:func -func_808BA018 = 0x80918450; // type:func -func_808BA204 = 0x809185F8; // type:func -func_808BA22C = 0x80918620; // type:func -func_808BA274 = 0x80918668; // type:func -func_808BA2CC = 0x809186C0; // type:func -EnYukabyun_Init = 0x809190D0; // type:func -EnYukabyun_Destroy = 0x80919180; // type:func -func_80B43A94 = 0x809191AC; // type:func -func_80B43AD4 = 0x809191EC; // type:func -func_80B43B6C = 0x80919284; // type:func -EnYukabyun_Break = 0x809192E4; // type:func -EnYukabyun_Update = 0x80919358; // type:func -EnYukabyun_Draw = 0x809194F8; // type:func -BgTokiSwd_SetupAction = 0x809196E0; // type:func -BgTokiSwd_Init = 0x809196EC; // type:func -BgTokiSwd_Destroy = 0x809197C0; // type:func -func_808BAF40 = 0x809197EC; // type:func -func_808BB0AC = 0x80919960; // type:func -func_808BB128 = 0x809199E0; // type:func -BgTokiSwd_Update = 0x80919A34; // type:func -BgTokiSwd_Draw = 0x80919A88; // type:func -EnFhgFire_SetUpdate = 0x8091AD30; // type:func -EnFhgFire_Init = 0x8091AD3C; // type:func -EnFhgFire_Destroy = 0x8091B14C; // type:func -EnFhgFire_LightningStrike = 0x8091B1BC; // type:func -EnFhgFire_LightningTrail = 0x8091B554; // type:func -EnFhgFire_LightningShock = 0x8091B6F4; // type:func -EnFhgFire_LightningBurst = 0x8091B838; // type:func -EnFhgFire_SpearLight = 0x8091BAB4; // type:func -EnFhgFire_EnergyBall = 0x8091BCA8; // type:func -EnFhgFire_PhantomWarp = 0x8091C954; // type:func -EnFhgFire_Update = 0x8091CB10; // type:func -EnFhgFire_Draw = 0x8091CB60; // type:func -BgMjin_SetupAction = 0x8091D3D0; // type:func -BgMjin_Init = 0x8091D3DC; // type:func -BgMjin_Destroy = 0x8091D47C; // type:func -func_808A0850 = 0x8091D4B0; // type:func -BgMjin_DoNothing = 0x8091D584; // type:func -BgMjin_Update = 0x8091D594; // type:func -BgMjin_Draw = 0x8091D5B8; // type:func -BgHidanKousi_SetupAction = 0x8091D7C0; // type:func -BgHidanKousi_Init = 0x8091D7CC; // type:func -BgHidanKousi_Destroy = 0x8091D8C4; // type:func -func_80889ACC = 0x8091D8F8; // type:func -func_80889B5C = 0x8091D984; // type:func -func_80889BC0 = 0x8091D9E8; // type:func -func_80889C18 = 0x8091DA40; // type:func -func_80889C90 = 0x8091DAB8; // type:func -func_80889D28 = 0x8091DB54; // type:func -BgHidanKousi_Update = 0x8091DB64; // type:func -BgHidanKousi_Draw = 0x8091DB88; // type:func -DoorToki_Init = 0x8091DD50; // type:func -DoorToki_Destroy = 0x8091DDB8; // type:func -DoorToki_Update = 0x8091DDEC; // type:func -BgHidanHamstep_SetupAction = 0x8091DEB0; // type:func -BgHidanHamstep_SpawnChildren = 0x8091DED0; // type:func -BgHidanHamstep_Init = 0x8091E04C; // type:func -BgHidanHamstep_Destroy = 0x8091E2BC; // type:func -func_808884C8 = 0x8091E310; // type:func -func_80888638 = 0x8091E480; // type:func -func_80888694 = 0x8091E4DC; // type:func -func_80888734 = 0x8091E57C; // type:func -func_808887C4 = 0x8091E610; // type:func -func_80888860 = 0x8091E6AC; // type:func -func_808889B8 = 0x8091E7F8; // type:func -func_80888A58 = 0x8091E898; // type:func -BgHidanHamstep_DoNothing = 0x8091EA30; // type:func -BgHidanHamstep_Update = 0x8091EA40; // type:func -BgHidanHamstep_Draw = 0x8091EA64; // type:func -EnBird_SetupAction = 0x8091ED60; // type:func -EnBird_Init = 0x8091ED6C; // type:func -EnBird_Destroy = 0x8091EE58; // type:func -EnBird_SetupIdle = 0x8091EE68; // type:func -EnBird_Idle = 0x8091EF1C; // type:func -EnBird_SetupMove = 0x8091EFBC; // type:func -EnBird_Move = 0x8091EFFC; // type:func -EnBird_Update = 0x8091F118; // type:func -EnBird_Draw = 0x8091F148; // type:func -EnWood02_SpawnZoneCheck = 0x8091F220; // type:func -EnWood02_SpawnOffspring = 0x8091F348; // type:func -EnWood02_Init = 0x8091F560; // type:func -EnWood02_Destroy = 0x8091F99C; // type:func -EnWood02_Update = 0x8091F9D8; // type:func -EnWood02_Draw = 0x8091FED0; // type:func -EnLightbox_Init = 0x80920400; // type:func -EnLightbox_Destroy = 0x8092052C; // type:func -EnLightbox_Update = 0x80920560; // type:func -EnLightbox_Draw = 0x809207E8; // type:func -EnPubox_Init = 0x80920880; // type:func -EnPubox_Destroy = 0x809209B8; // type:func -EnPubox_Update = 0x809209EC; // type:func -EnPubox_Draw = 0x80920B3C; // type:func -EnTrap_Init = 0x80920BC0; // type:func -EnTrap_Destroy = 0x80920F7C; // type:func -EnTrap_Update = 0x80920FA8; // type:func -EnTrap_Draw = 0x80921D3C; // type:func -EnArowTrap_Init = 0x80921E60; // type:func -EnArowTrap_Destroy = 0x80921EB0; // type:func -EnArowTrap_Update = 0x80921EC0; // type:func -EnVase_Init = 0x80921FB0; // type:func -EnVase_Destroy = 0x80922014; // type:func -EnVase_Draw = 0x80922024; // type:func -EnTa_SetupAction = 0x809220B0; // type:func -EnTa_SetTextForTalkInLonLonHouse = 0x809220C0; // type:func -EnTa_Init = 0x809221A0; // type:func -EnTa_DecreaseShadowSize = 0x80922824; // type:func -EnTa_Destroy = 0x80922858; // type:func -EnTa_RequestTalk = 0x809228D0; // type:func -EnTa_SleepTalkInKakariko = 0x80922978; // type:func -EnTa_SleepTalkInLonLonHouse = 0x809229B8; // type:func -EnTa_SetupAwake = 0x809229F8; // type:func -EnTa_TalkWakingUp2 = 0x80922A74; // type:func -EnTa_TalkWakingUp1 = 0x80922AC0; // type:func -EnTa_WakeUp = 0x80922B5C; // type:func -EnTa_SleepTalkInCastle = 0x80922BE8; // type:func -EnTa_IdleAsleepInCastle = 0x80922C28; // type:func -EnTa_IdleAsleepInLonLonHouse = 0x80922CF0; // type:func -EnTa_IdleAsleepInKakariko = 0x80922D54; // type:func -EnTa_RunWithAccelerationAndSfx = 0x80922E1C; // type:func -EnTa_RunAwayRunOutOfGate = 0x80922E9C; // type:func -EnTa_RunAwayTurnTowardsGate = 0x80922F10; // type:func -EnTa_RunAwayRunWest = 0x80922F70; // type:func -EnTa_RunAwayTurnWest = 0x80922FF8; // type:func -EnTa_RunAwayRunSouth = 0x80923058; // type:func -EnTa_RunAwayStart = 0x809230F8; // type:func -EnTa_TalkAwakeInCastle = 0x80923170; // type:func -EnTa_IdleAwakeInCastle = 0x8092321C; // type:func -EnTa_TalkAwakeInKakariko = 0x80923268; // type:func -EnTa_IdleAwakeInKakariko = 0x809232B4; // type:func -EnTa_TalkAtRanch = 0x8092335C; // type:func -EnTa_IdleAtRanch = 0x809233A8; // type:func -EnTa_CheckCanBuyMilk = 0x809233EC; // type:func -EnTa_CreateFloorCamera = 0x8092343C; // type:func -EnTa_RemoveFloorCamera = 0x809234F0; // type:func -EnTa_SetupActionWithSleepAnimation = 0x80923534; // type:func -EnTa_SetupActionWithWakeUpAnimation = 0x809235C4; // type:func -EnTa_TalkNotEnoughRupees = 0x80923650; // type:func -EnTa_IsPlayerHoldingSuperCucco = 0x809236C8; // type:func -EnTa_TalkFoundSuperCucco = 0x8092371C; // type:func -EnTa_IdleFoundSuperCucco = 0x8092387C; // type:func -EnTa_GetSuperCuccosCount = 0x809238EC; // type:func -EnTa_AnimateHandsUpDown = 0x80923928; // type:func -EnTa_TransitionToPostCuccoGame = 0x809239F4; // type:func -EnTa_TalkCuccoGameEnd = 0x80923A44; // type:func -EnTa_RunCuccoGame = 0x80923B20; // type:func -EnTa_ThrowSuperCuccos = 0x80923E80; // type:func -EnTa_StartingCuccoGame3 = 0x809240F8; // type:func -EnTa_StartingCuccoGame2 = 0x8092421C; // type:func -EnTa_StartingCuccoGame1 = 0x809242EC; // type:func -EnTa_StartCuccoGame = 0x809243B4; // type:func -EnTa_TalkGeneralInLonLonHouse = 0x8092444C; // type:func -EnTa_GiveItemInLonLonHouse = 0x809244A8; // type:func -EnTa_TalkAfterCuccoGameFirstWon = 0x8092457C; // type:func -EnTa_WaitBuyMilkOrPlayCuccoGameResponse = 0x80924614; // type:func -EnTa_WaitForPlayCuccoGameResponse = 0x809247F0; // type:func -EnTa_WaitForMarryMalonResponse = 0x80924918; // type:func -EnTa_ContinueTalkInLonLonHouse = 0x80924998; // type:func -EnTa_TalkAfterCuccoGameWon = 0x80924A64; // type:func -EnTa_IdleSittingInLonLonHouse = 0x80924B3C; // type:func -EnTa_IdleAfterCuccoGameFinished = 0x80924C3C; // type:func -EnTa_BlinkWaitUntilNext = 0x80924D00; // type:func -EnTa_BlinkAdvanceState = 0x80924D34; // type:func -EnTa_AnimRepeatCurrent = 0x80924DF4; // type:func -EnTa_AnimSleeping = 0x80924E34; // type:func -EnTa_AnimSitSleeping = 0x80924E88; // type:func -EnTa_AnimRunToEnd = 0x80924F68; // type:func -EnTa_Update = 0x80924FC0; // type:func -EnTa_OverrideLimbDraw = 0x80925150; // type:func -EnTa_PostLimbDraw = 0x809252D4; // type:func -EnTa_Draw = 0x80925314; // type:func -EnTkEff_Create = 0x80925A70; // type:func -EnTkEff_Update = 0x80925B14; // type:func -EnTkEff_Draw = 0x80925C20; // type:func -EnTkEff_CreateDflt = 0x80925F18; // type:func -EnTk_RestAnim = 0x80925FD0; // type:func -EnTk_WalkAnim = 0x8092604C; // type:func -EnTk_DigAnim = 0x809260C0; // type:func -EnTk_UpdateEyes = 0x80926140; // type:func -EnTk_CheckFacingPlayer = 0x80926204; // type:func -EnTk_CheckNextSpot = 0x80926288; // type:func -EnTk_CheckCurrentSpot = 0x80926370; // type:func -EnTk_Step = 0x809263E8; // type:func -EnTk_Orient = 0x80926510; // type:func -EnTk_GetTextId = 0x80926680; // type:func -EnTk_UpdateTalkState = 0x809266D4; // type:func -EnTk_ChooseReward = 0x80926870; // type:func -EnTk_DigEff = 0x80926A2C; // type:func -EnTk_Init = 0x80926B9C; // type:func -EnTk_Destroy = 0x80926D18; // type:func -EnTk_Rest = 0x80926D44; // type:func -EnTk_Walk = 0x80926F6C; // type:func -EnTk_Dig = 0x8092703C; // type:func -EnTk_Update = 0x809272A0; // type:func -func_80B1D200 = 0x8092734C; // type:func -EnTk_OverrideLimbDraw = 0x80927378; // type:func -EnTk_PostLimbDraw = 0x809273E4; // type:func -EnTk_Draw = 0x80927498; // type:func -BgMoriBigst_SetupAction = 0x809278A0; // type:func -BgMoriBigst_InitDynapoly = 0x809278AC; // type:func -BgMoriBigst_Init = 0x80927904; // type:func -BgMoriBigst_Destroy = 0x809279DC; // type:func -BgMoriBigst_SetupWaitForMoriTex = 0x80927A10; // type:func -BgMoriBigst_WaitForMoriTex = 0x80927A38; // type:func -BgMoriBigst_SetupNoop = 0x80927B04; // type:func -BgMoriBigst_SetupStalfosFight = 0x80927B28; // type:func -BgMoriBigst_StalfosFight = 0x80927BDC; // type:func -BgMoriBigst_SetupFall = 0x80927C54; // type:func -BgMoriBigst_Fall = 0x80927C7C; // type:func -BgMoriBigst_SetupLanding = 0x80927D08; // type:func -BgMoriBigst_Landing = 0x80927D9C; // type:func -BgMoriBigst_SetupStalfosPairFight = 0x80927DC8; // type:func -BgMoriBigst_StalfosPairFight = 0x80927EE0; // type:func -BgMoriBigst_SetupDone = 0x80927F40; // type:func -BgMoriBigst_Update = 0x80927F64; // type:func -BgMoriBigst_Draw = 0x80927FD8; // type:func -func_808A1800 = 0x809281D0; // type:func -func_808A18FC = 0x809282C8; // type:func -BgMoriElevator_Init = 0x80928350; // type:func -BgMoriElevator_Destroy = 0x80928434; // type:func -BgMoriElevator_IsPlayerRiding = 0x80928474; // type:func -BgMoriElevator_SetupWaitAfterInit = 0x809284D4; // type:func -BgMoriElevator_WaitAfterInit = 0x809284E8; // type:func -func_808A1C30 = 0x8092858C; // type:func -BgMoriElevator_MoveIntoGround = 0x809285A0; // type:func -func_808A1CF4 = 0x80928654; // type:func -BgMoriElevator_MoveAboveGround = 0x809286B0; // type:func -BgMoriElevator_SetupSetPosition = 0x80928764; // type:func -BgMoriElevator_SetPosition = 0x80928778; // type:func -BgMoriElevator_StopMovement = 0x80928940; // type:func -func_808A2008 = 0x8092895C; // type:func -BgMoriElevator_Update = 0x80928A10; // type:func -BgMoriElevator_Draw = 0x80928A68; // type:func -BgMoriKaitenkabe_CrossProduct = 0x80928CC0; // type:func -BgMoriKaitenkabe_Init = 0x80928D34; // type:func -BgMoriKaitenkabe_Destroy = 0x80928DE8; // type:func -BgMoriKaitenkabe_WaitForMoriTex = 0x80928E1C; // type:func -BgMoriKaitenkabe_SetupWait = 0x80928E74; // type:func -BgMoriKaitenkabe_Wait = 0x80928E8C; // type:func -BgMoriKaitenkabe_SetupRotate = 0x80928FEC; // type:func -BgMoriKaitenkabe_Rotate = 0x8092900C; // type:func -BgMoriKaitenkabe_Update = 0x80929178; // type:func -BgMoriKaitenkabe_Draw = 0x8092919C; // type:func -BgMoriRakkatenjo_Init = 0x80929330; // type:func -BgMoriRakkatenjo_Destroy = 0x809293E8; // type:func -BgMoriRakkatenjo_IsLinkUnder = 0x8092941C; // type:func -BgMoriRakkatenjo_IsLinkClose = 0x809294CC; // type:func -BgMoriRakkatenjo_SetupWaitForMoriTex = 0x8092957C; // type:func -BgMoriRakkatenjo_WaitForMoriTex = 0x80929590; // type:func -BgMoriRakkatenjo_SetupWait = 0x809295E8; // type:func -BgMoriRakkatenjo_Wait = 0x80929624; // type:func -BgMoriRakkatenjo_SetupFall = 0x809296F4; // type:func -BgMoriRakkatenjo_Fall = 0x80929714; // type:func -BgMoriRakkatenjo_SetupRest = 0x8092988C; // type:func -BgMoriRakkatenjo_Rest = 0x809298B4; // type:func -BgMoriRakkatenjo_SetupRise = 0x809298E4; // type:func -BgMoriRakkatenjo_Rise = 0x80929904; // type:func -BgMoriRakkatenjo_Update = 0x80929984; // type:func -BgMoriRakkatenjo_Draw = 0x80929A5C; // type:func -EnVm_SetupAction = 0x80929CB0; // type:func -EnVm_Init = 0x80929CBC; // type:func -EnVm_Destroy = 0x80929E2C; // type:func -EnVm_SetupWait = 0x80929E58; // type:func -EnVm_Wait = 0x80929EE4; // type:func -EnVm_SetupAttack = 0x8092A238; // type:func -EnVm_Attack = 0x8092A2DC; // type:func -EnVm_SetupStun = 0x8092A52C; // type:func -EnVm_Stun = 0x8092A5D4; // type:func -EnVm_SetupDie = 0x8092A6E0; // type:func -EnVm_Die = 0x8092A7E8; // type:func -EnVm_CheckHealth = 0x8092A89C; // type:func -EnVm_Update = 0x8092A998; // type:func -EnVm_OverrideLimbDraw = 0x8092AB2C; // type:func -EnVm_PostLimbDraw = 0x8092AB94; // type:func -EnVm_Draw = 0x8092AE6C; // type:func -DemoEffect_SetupUpdate = 0x8092B570; // type:func -DemoEffect_InterpolateCsFrames = 0x8092B57C; // type:func -DemoEffect_InitJewel = 0x8092B5DC; // type:func -DemoEffect_InitGetItem = 0x8092B69C; // type:func -DemoEffect_Init = 0x8092B6E8; // type:func -DemoEffect_Destroy = 0x8092BEE8; // type:func -DemoEffect_WaitForObject = 0x8092BF38; // type:func -DemoEffect_UpdatePositionToParent = 0x8092BF90; // type:func -DemoEffect_UpdateCrystalLight = 0x8092BFC0; // type:func -DemoEffect_MedalSparkle = 0x8092BFF4; // type:func -DemoEffect_UpdateGetItem = 0x8092C18C; // type:func -DemoEffect_InitTimeWarp = 0x8092C3CC; // type:func -DemoEffect_UpdateTimeWarpPullMasterSword = 0x8092C588; // type:func -DemoEffect_TimewarpShrink = 0x8092C62C; // type:func -DemoEffect_UpdateTimeWarpReturnFromChamberOfSages = 0x8092C750; // type:func -DemoEffect_UpdateTimeWarpTimeblock = 0x8092C808; // type:func -DemoEffect_InitTimeWarpTimeblock = 0x8092C8C4; // type:func -DemoEffect_UpdateTriforceSpot = 0x8092C948; // type:func -DemoEffect_UpdateLightRingShrinking = 0x8092CC30; // type:func -DemoEffect_UpdateLightRingExpanding = 0x8092CCC0; // type:func -DemoEffect_UpdateLightRingTriforce = 0x8092CD34; // type:func -DemoEffect_UpdateCreationFireball = 0x8092CDF0; // type:func -DemoEffect_InitCreationFireball = 0x8092CF44; // type:func -DemoEffect_UpdateBlueOrbShrink = 0x8092CF94; // type:func -DemoEffect_UpdateBlueOrbGrow = 0x8092CFFC; // type:func -DemoEffect_UpdateLightEffect = 0x8092D0DC; // type:func -DemoEffect_UpdateLgtShower = 0x8092D3D4; // type:func -DemoEffect_UpdateGodLgtDin = 0x8092D440; // type:func -DemoEffect_UpdateGodLgtNayru = 0x8092D5DC; // type:func -DemoEffect_UpdateGodLgtFarore = 0x8092D7D4; // type:func -DemoEffect_MoveTowardTarget = 0x8092D978; // type:func -DemoEffect_InitJewelColor = 0x8092D9D8; // type:func -DemoEffect_SetJewelColor = 0x8092DAD8; // type:func -DemoEffect_MoveJewelSplit = 0x8092E24C; // type:func -DemoEffect_MoveJewelSpherical = 0x8092E2A8; // type:func -DemoEffect_MoveJewelActivateDoorOfTime = 0x8092E48C; // type:func -DemoEffect_JewelSparkle = 0x8092E6F8; // type:func -DemoEffect_PlayJewelSfx = 0x8092E85C; // type:func -DemoEffect_UpdateJewelAdult = 0x8092E8C0; // type:func -DemoEffect_UpdateJewelChild = 0x8092E904; // type:func -DemoEffect_UpdateDust = 0x8092EB18; // type:func -DemoEffect_Update = 0x8092EC3C; // type:func -DemoEffect_CheckForCue = 0x8092EC60; // type:func -DemoEffect_DrawJewel = 0x8092ECA4; // type:func -DemoEffect_DrawCrystalLight = 0x8092F0E4; // type:func -DemoEffect_DrawFireBall = 0x8092F3BC; // type:func -DemoEffect_DrawGodLgt = 0x8092F548; // type:func -DemoEffect_DrawLightEffect = 0x8092F918; // type:func -DemoEffect_DrawBlueOrb = 0x8092FB50; // type:func -DemoEffect_DrawLgtShower = 0x8092FC78; // type:func -DemoEffect_DrawLightRing = 0x8092FDFC; // type:func -DemoEffect_DrawTriforceSpot = 0x8092FF64; // type:func -DemoEffect_DrawGetItem = 0x809304E8; // type:func -DemoEffect_OverrideLimbDrawTimeWarp = 0x80930580; // type:func -DemoEffect_DrawTimeWarp = 0x80930700; // type:func -DemoEffect_FaceTowardPoint = 0x809307D8; // type:func -DemoEffect_SetPosRotFromCue = 0x80930888; // type:func -DemoEffect_MoveTowardCuePos = 0x809309E8; // type:func -DemoEffect_SetStartPosFromCue = 0x80930A94; // type:func -DemoKankyo_SetupAction = 0x80931110; // type:func -DemoKankyo_Init = 0x8093111C; // type:func -DemoKankyo_Destroy = 0x80931500; // type:func -DemoKankyo_SetupType = 0x8093150C; // type:func -DemoKankyo_DoNothing = 0x80931944; // type:func -DemoKankyo_UpdateWarpIn = 0x80931954; // type:func -DemoKankyo_SetPosFromCue = 0x8093197C; // type:func -DemoKankyo_UpdateRock = 0x80931A6C; // type:func -DemoKankyo_UpdateClouds = 0x80931AE4; // type:func -DemoKankyo_UpdateDoorOfTime = 0x80931B30; // type:func -DemoKankyo_KillDoorOfTimeCollision = 0x80931BCC; // type:func -DemoKankyo_Update = 0x80931BF8; // type:func -DemoKankyo_Draw = 0x80931C1C; // type:func -func_80989B54 = 0x80931DC4; // type:func -DemoKankyo_DrawRain = 0x80931F94; // type:func -DemoKankyo_DrawRock = 0x809325A0; // type:func -DemoKankyo_DrawClouds = 0x809326E4; // type:func -DemoKankyo_DrawDoorOfTime = 0x80932A10; // type:func -DemoKankyo_DrawLightPlane = 0x80932B20; // type:func -DemoKankyo_Vec3fCopy = 0x80932C08; // type:func -DemoKankyo_AddVecGeoToVec3f = 0x80932C28; // type:func -DemoKankyo_Vec3fAddPosRot = 0x80932CA8; // type:func -DemoKankyo_DrawWarpSparkles = 0x80932D04; // type:func -DemoKankyo_DrawSparkles = 0x80933460; // type:func -BgHidanFwbig_Init = 0x80934E00; // type:func -BgHidanFwbig_Destroy = 0x80934FA0; // type:func -BgHidanFwbig_UpdatePosition = 0x80934FCC; // type:func -BgHidanFwbig_WaitForSwitch = 0x8093504C; // type:func -BgHidanFwbig_WaitForCs = 0x809350B0; // type:func -BgHidanFwbig_Rise = 0x809350DC; // type:func -BgHidanFwbig_Lower = 0x80935150; // type:func -BgHidanFwbig_WaitForTimer = 0x80935230; // type:func -BgHidanFwbig_WaitForPlayer = 0x80935280; // type:func -BgHidanFwbig_Move = 0x809352E4; // type:func -BgHidanFwbig_MoveCollider = 0x80935384; // type:func -BgHidanFwbig_Update = 0x80935584; // type:func -BgHidanFwbig_Draw = 0x809356FC; // type:func -EnFloormas_Init = 0x80935AE0; // type:func -EnFloormas_Destroy = 0x80935CF4; // type:func -EnFloormas_MakeInvulnerable = 0x80935D20; // type:func -EnFloormas_MakeVulnerable = 0x80935D44; // type:func -EnFloormas_SetupBigDecideAction = 0x80935D60; // type:func -EnFloormas_SetupStand = 0x80935DA8; // type:func -EnFloormas_SetupBigWalk = 0x80935DEC; // type:func -EnFloormas_SetupBigStopWalk = 0x80935E78; // type:func -EnFloormas_SetupRun = 0x80935EC0; // type:func -EnFloormas_SetupTurn = 0x80935EF0; // type:func -EnFloormas_SetupHover = 0x80936020; // type:func -EnFloormas_SetupCharge = 0x809360F8; // type:func -EnFloormas_SetupLand = 0x8093612C; // type:func -EnFloormas_SetupSplit = 0x809361D8; // type:func -EnFloormas_SetupSmallWalk = 0x80936338; // type:func -EnFloormas_SetupSmallDecideAction = 0x80936388; // type:func -EnFloormas_SetupSmallShrink = 0x809363E8; // type:func -EnFloormas_SetupSmallFollowerJumpAtLeader = 0x809364C0; // type:func -EnFloormas_SetupJumpAtLink = 0x8093652C; // type:func -EnFloormas_SetupGrabLink = 0x80936598; // type:func -EnFloormas_SetupMerge = 0x8093676C; // type:func -EnFloormas_SetupSmallWait = 0x809367C4; // type:func -EnFloormas_SetupTakeDamage = 0x80936848; // type:func -EnFloormas_SetupRecover = 0x80936904; // type:func -EnFloormas_SetupFreeze = 0x80936958; // type:func -EnFloormas_Die = 0x80936A58; // type:func -EnFloormas_BigDecideAction = 0x80936AF4; // type:func -EnFloormas_Stand = 0x80936BB8; // type:func -EnFloormas_BigWalk = 0x80936C44; // type:func -EnFloormas_BigStopWalk = 0x80936DA0; // type:func -EnFloormas_Run = 0x80936DDC; // type:func -EnFloormas_Turn = 0x80936EE8; // type:func -EnFloormas_Hover = 0x809370AC; // type:func -EnFloormas_Slide = 0x80937130; // type:func -EnFloormas_Charge = 0x80937270; // type:func -EnFloormas_Land = 0x80937360; // type:func -EnFloormas_Split = 0x80937548; // type:func -EnFloormas_SmallWalk = 0x809375D0; // type:func -EnFloormas_SmallDecideAction = 0x809376C0; // type:func -EnFloormas_SmallShrink = 0x80937828; // type:func -EnFloormas_JumpAtLink = 0x80937880; // type:func -EnFloormas_GrabLink = 0x809379BC; // type:func -EnFloormas_SmallFollowerJumpAtLeader = 0x80937CD8; // type:func -EnFloormas_Merge = 0x80937EE8; // type:func -EnFloormas_SmallWait = 0x80938198; // type:func -EnFloormas_TakeDamage = 0x809381A8; // type:func -EnFloormas_Recover = 0x8093826C; // type:func -EnFloormas_Freeze = 0x809382A8; // type:func -EnFloormas_ColliderCheck = 0x8093831C; // type:func -EnFloormas_Update = 0x809384CC; // type:func -EnFloormas_OverrideLimbDraw = 0x80938734; // type:func -EnFloormas_PostLimbDraw = 0x80938770; // type:func -EnFloormas_Draw = 0x80938860; // type:func -EnFloormas_DrawHighlighted = 0x8093892C; // type:func -EnHeishi1_Init = 0x80938EC0; // type:func -EnHeishi1_Destroy = 0x809390D8; // type:func -EnHeishi1_SetupWalk = 0x809390E8; // type:func -EnHeishi1_Walk = 0x8093919C; // type:func -EnHeishi1_SetupMoveToLink = 0x809394BC; // type:func -EnHeishi1_MoveToLink = 0x80939578; // type:func -EnHeishi1_SetupWait = 0x80939670; // type:func -EnHeishi1_Wait = 0x80939738; // type:func -EnHeishi1_SetupTurnTowardLink = 0x809398F4; // type:func -EnHeishi1_TurnTowardLink = 0x80939990; // type:func -EnHeishi1_SetupKick = 0x80939A3C; // type:func -EnHeishi1_Kick = 0x80939AD0; // type:func -EnHeishi1_SetupWaitNight = 0x80939BA4; // type:func -EnHeishi1_WaitNight = 0x80939C38; // type:func -EnHeishi1_Update = 0x80939CB8; // type:func -EnHeishi1_OverrideLimbDraw = 0x80939FCC; // type:func -EnHeishi1_Draw = 0x8093A010; // type:func -EnRd_SetupAction = 0x8093A3D0; // type:func -EnRd_Init = 0x8093A3DC; // type:func -EnRd_Destroy = 0x8093A5C8; // type:func -EnRd_UpdateMourningTarget = 0x8093A60C; // type:func -EnRd_SetupIdle = 0x8093A678; // type:func -EnRd_Idle = 0x8093A720; // type:func -EnRd_SetupRiseFromCoffin = 0x8093A94C; // type:func -EnRd_RiseFromCoffin = 0x8093A9EC; // type:func -EnRd_SetupWalkToPlayer = 0x8093AB6C; // type:func -EnRd_WalkToPlayer = 0x8093ABF8; // type:func -EnRd_SetupWalkToHome = 0x8093AF2C; // type:func -EnRd_WalkToHome = 0x8093AFAC; // type:func -EnRd_SetupWalkToParent = 0x8093B1C0; // type:func -EnRd_WalkToParent = 0x8093B244; // type:func -EnRd_SetupGrab = 0x8093B3D8; // type:func -EnRd_Grab = 0x8093B43C; // type:func -EnRd_SetupAttemptPlayerFreeze = 0x8093B7A8; // type:func -EnRd_AttemptPlayerFreeze = 0x8093B820; // type:func -EnRd_SetupStandUp = 0x8093B918; // type:func -EnRd_StandUp = 0x8093B964; // type:func -EnRd_SetupCrouch = 0x8093B9C0; // type:func -EnRd_Crouch = 0x8093BA40; // type:func -EnRd_SetupDamaged = 0x8093BA7C; // type:func -EnRd_Damaged = 0x8093BB08; // type:func -EnRd_SetupDead = 0x8093BC18; // type:func -EnRd_Dead = 0x8093BC90; // type:func -EnRd_SetupStunned = 0x8093BDDC; // type:func -EnRd_Stunned = 0x8093BEC8; // type:func -EnRd_TurnTowardsPlayer = 0x8093BF9C; // type:func -EnRd_UpdateDamage = 0x8093C114; // type:func -EnRd_Update = 0x8093C2E0; // type:func -EnRd_OverrideLimbDraw = 0x8093C4CC; // type:func -EnRd_PostLimbDraw = 0x8093C528; // type:func -EnRd_Draw = 0x8093C670; // type:func -EnPoSisters_Init = 0x8093CC90; // type:func -EnPoSisters_Destroy = 0x8093CEDC; // type:func -func_80AD9240 = 0x8093CF44; // type:func -func_80AD9368 = 0x8093D070; // type:func -func_80AD93C4 = 0x8093D0CC; // type:func -func_80AD943C = 0x8093D144; // type:func -func_80AD944C = 0x8093D158; // type:func -func_80AD94E0 = 0x8093D1EC; // type:func -func_80AD9568 = 0x8093D274; // type:func -func_80AD95D8 = 0x8093D2E4; // type:func -func_80AD96A4 = 0x8093D3B0; // type:func -func_80AD9718 = 0x8093D424; // type:func -func_80AD97C8 = 0x8093D4D4; // type:func -func_80AD98F4 = 0x8093D600; // type:func -func_80AD99D4 = 0x8093D6E0; // type:func -func_80AD9A54 = 0x8093D760; // type:func -func_80AD9AA8 = 0x8093D7B4; // type:func -func_80AD9C24 = 0x8093D930; // type:func -func_80AD9D44 = 0x8093DA50; // type:func -func_80AD9DF0 = 0x8093DAFC; // type:func -func_80AD9E60 = 0x8093DB6C; // type:func -func_80AD9F1C = 0x8093DC28; // type:func -func_80AD9F90 = 0x8093DC9C; // type:func -func_80ADA028 = 0x8093DD34; // type:func -func_80ADA094 = 0x8093DDA0; // type:func -func_80ADA10C = 0x8093DE18; // type:func -func_80ADA1B8 = 0x8093DEC8; // type:func -func_80ADA25C = 0x8093DF6C; // type:func -func_80ADA2BC = 0x8093DFCC; // type:func -func_80ADA35C = 0x8093E06C; // type:func -func_80ADA4A8 = 0x8093E1B8; // type:func -func_80ADA530 = 0x8093E240; // type:func -func_80ADA6A0 = 0x8093E3B0; // type:func -func_80ADA7F0 = 0x8093E500; // type:func -func_80ADA8C0 = 0x8093E5D0; // type:func -func_80ADA9E8 = 0x8093E6F8; // type:func -func_80ADAAA4 = 0x8093E7B4; // type:func -func_80ADAC70 = 0x8093E980; // type:func -func_80ADAD54 = 0x8093EA64; // type:func -func_80ADAE6C = 0x8093EB7C; // type:func -func_80ADAFC0 = 0x8093ECD0; // type:func -func_80ADB17C = 0x8093EE8C; // type:func -func_80ADB2B8 = 0x8093EFC8; // type:func -func_80ADB338 = 0x8093F044; // type:func -func_80ADB4B0 = 0x8093F1C0; // type:func -func_80ADB51C = 0x8093F22C; // type:func -func_80ADB770 = 0x8093F480; // type:func -func_80ADB9F0 = 0x8093F700; // type:func -func_80ADBB6C = 0x8093F87C; // type:func -func_80ADBBF4 = 0x8093F904; // type:func -func_80ADBC88 = 0x8093F998; // type:func -func_80ADBD38 = 0x8093FA4C; // type:func -func_80ADBD8C = 0x8093FAA0; // type:func -func_80ADBEE8 = 0x8093FC00; // type:func -func_80ADBF58 = 0x8093FC70; // type:func -func_80ADC034 = 0x8093FD4C; // type:func -func_80ADC10C = 0x8093FE24; // type:func -EnPoSisters_Update = 0x8093FFE8; // type:func -func_80ADC55C = 0x8094027C; // type:func -EnPoSisters_OverrideLimbDraw = 0x8094049C; // type:func -EnPoSisters_PostLimbDraw = 0x8094068C; // type:func -EnPoSisters_Draw = 0x80940D5C; // type:func -BgHeavyBlock_SetPieceRandRot = 0x80941980; // type:func -BgHeavyBlock_InitPiece = 0x80941A10; // type:func -BgHeavyBlock_SetupDynapoly = 0x80941B8C; // type:func -BgHeavyBlock_Init = 0x80941C00; // type:func -BgHeavyBlock_Destroy = 0x80941E44; // type:func -BgHeavyBlock_MovePiece = 0x80941E8C; // type:func -BgHeavyBlock_SpawnDust = 0x80942050; // type:func -BgHeavyBlock_SpawnPieces = 0x809423B4; // type:func -BgHeavyBlock_Wait = 0x809425AC; // type:func -BgHeavyBlock_LiftedUp = 0x809426D4; // type:func -BgHeavyBlock_Fly = 0x8094283C; // type:func -BgHeavyBlock_DoNothing = 0x80942B54; // type:func -BgHeavyBlock_Land = 0x80942B64; // type:func -BgHeavyBlock_Update = 0x80942DD4; // type:func -BgHeavyBlock_Draw = 0x80942DF8; // type:func -BgHeavyBlock_DrawPiece = 0x80942F60; // type:func -BgPoEvent_InitPaintings = 0x80943270; // type:func -BgPoEvent_InitBlocks = 0x809435EC; // type:func -BgPoEvent_Init = 0x8094379C; // type:func -BgPoEvent_Destroy = 0x809438AC; // type:func -BgPoEvent_BlockWait = 0x80943930; // type:func -BgPoEvent_BlockShake = 0x80943A3C; // type:func -BgPoEvent_CheckBlock = 0x80943AF4; // type:func -BgPoEvent_BlockFall = 0x80943C2C; // type:func -BgPoEvent_BlockIdle = 0x80943D30; // type:func -BgPoEvent_BlockPush = 0x80943FE4; // type:func -BgPoEvent_BlockReset = 0x809441A4; // type:func -BgPoEvent_BlockSolved = 0x809442A4; // type:func -BgPoEvent_AmyWait = 0x8094431C; // type:func -BgPoEvent_AmyPuzzle = 0x80944398; // type:func -BgPoEvent_NextPainting = 0x809444B4; // type:func -BgPoEvent_PaintingEmpty = 0x80944570; // type:func -BgPoEvent_PaintingAppear = 0x809445A0; // type:func -BgPoEvent_PaintingVanish = 0x809445D8; // type:func -BgPoEvent_PaintingPresent = 0x80944628; // type:func -BgPoEvent_PaintingBurn = 0x80944884; // type:func -BgPoEvent_Update = 0x80944A30; // type:func -BgPoEvent_Draw = 0x80944AA0; // type:func -ObjMure_SetCullingImpl = 0x809450B0; // type:func -ObjMure_SetCulling = 0x80945108; // type:func -ObjMure_Init = 0x80945134; // type:func -ObjMure_Destroy = 0x809451E4; // type:func -ObjMure_GetMaxChildSpawns = 0x809451F4; // type:func -ObjMure_GetSpawnPos = 0x80945220; // type:func -ObjMure_SpawnActors0 = 0x80945248; // type:func -ObjMure_SpawnActors1 = 0x80945410; // type:func -ObjMure_SpawnActors = 0x8094555C; // type:func -ObjMure_KillActorsImpl = 0x809455AC; // type:func -ObjMure_KillActors = 0x809456A4; // type:func -ObjMure_CheckChildren = 0x809456C4; // type:func -ObjMure_InitialAction = 0x80945788; // type:func -ObjMure_CulledState = 0x809457A0; // type:func -ObjMure_SetFollowTargets = 0x80945800; // type:func -ObjMure_SetChildToFollowPlayer = 0x809458D8; // type:func -ObjMure_GroupBehavior0 = 0x80945A58; // type:func -ObjMure_GroupBehavior1 = 0x80945C80; // type:func -ObjMure_ActiveState = 0x80945E04; // type:func -ObjMure_Update = 0x80945EAC; // type:func -EnSw_CrossProduct = 0x809460C0; // type:func -func_80B0BE20 = 0x80946134; // type:func -func_80B0C020 = 0x80946334; // type:func -func_80B0C0CC = 0x809463E4; // type:func -EnSw_Init = 0x80946818; // type:func -EnSw_Destroy = 0x80946CE0; // type:func -func_80B0C9F0 = 0x80946D0C; // type:func -func_80B0CBE8 = 0x80946F08; // type:func -func_80B0CCF4 = 0x80947014; // type:func -func_80B0CEA8 = 0x809471C8; // type:func -func_80B0CF44 = 0x80947268; // type:func -func_80B0D14C = 0x80947470; // type:func -func_80B0D364 = 0x80947688; // type:func -func_80B0D3AC = 0x809476D0; // type:func -func_80B0D590 = 0x809478B8; // type:func -func_80B0D878 = 0x80947BA0; // type:func -func_80B0DB00 = 0x80947E28; // type:func -func_80B0DC7C = 0x80947FA8; // type:func -func_80B0DE34 = 0x80948164; // type:func -func_80B0DEA8 = 0x809481E0; // type:func -func_80B0DFFC = 0x80948334; // type:func -func_80B0E314 = 0x8094864C; // type:func -func_80B0E430 = 0x80948764; // type:func -func_80B0E5E0 = 0x80948914; // type:func -func_80B0E728 = 0x80948A60; // type:func -func_80B0E90C = 0x80948C44; // type:func -func_80B0E9BC = 0x80948CF4; // type:func -EnSw_Update = 0x80948DA4; // type:func -EnSw_OverrideLimbDraw = 0x80948E00; // type:func -EnSw_PostLimbDraw = 0x809490A4; // type:func -func_80B0EDB8 = 0x809490BC; // type:func -func_80B0EEA4 = 0x80949174; // type:func -EnSw_Draw = 0x809491A0; // type:func -BossFd_SpawnEmber = 0x809498B0; // type:func -BossFd_SpawnDebris = 0x8094997C; // type:func -BossFd_SpawnDust = 0x80949A4C; // type:func -BossFd_SpawnFireBreath = 0x80949AE4; // type:func -BossFd_SetCameraSpeed = 0x80949BF0; // type:func -BossFd_UpdateCamera = 0x80949C90; // type:func -BossFd_Init = 0x80949DFC; // type:func -BossFd_Destroy = 0x8094A11C; // type:func -BossFd_IsFacingLink = 0x8094A17C; // type:func -BossFd_SetupFly = 0x8094A1AC; // type:func -BossFd_Fly = 0x8094A21C; // type:func -BossFd_Wait = 0x8094C8A4; // type:func -BossFd_Effects = 0x8094CA94; // type:func -BossFd_CollisionCheck = 0x8094D6B4; // type:func -BossFd_Update = 0x8094D768; // type:func -BossFd_UpdateEffects = 0x8094DEA8; // type:func -BossFd_DrawEffects = 0x8094E300; // type:func -BossFd_Draw = 0x8094E9A0; // type:func -BossFd_OverrideRightArmDraw = 0x8094EA58; // type:func -BossFd_OverrideLeftArmDraw = 0x8094EB78; // type:func -BossFd_DrawMane = 0x8094EC98; // type:func -BossFd_OverrideHeadDraw = 0x8094F11C; // type:func -BossFd_PostHeadDraw = 0x8094F214; // type:func -BossFd_DrawBody = 0x8094F268; // type:func -ObjectKankyo_SetupAction = 0x80950C10; // type:func -ObjectKankyo_Init = 0x80950C1C; // type:func -ObjectKankyo_Destroy = 0x80950F1C; // type:func -ObjectKankyo_Snow = 0x80950F40; // type:func -ObjectKankyo_Fairies = 0x80950F50; // type:func -ObjectKankyo_Update = 0x80951D68; // type:func -ObjectKankyo_Draw = 0x80951D8C; // type:func -ObjectKankyo_DrawFairies = 0x80951E10; // type:func -ObjectKankyo_DrawSnow = 0x80952298; // type:func -ObjectKankyo_Lightning = 0x80952A60; // type:func -ObjectKankyo_DrawLightning = 0x80952B08; // type:func -ObjectKankyo_SunGraveSparkInit = 0x80952D04; // type:func -ObjectKankyo_WaitForSunGraveSparkObject = 0x80952D50; // type:func -ObjectKankyo_SunGraveSpark = 0x80952DC0; // type:func -ObjectKankyo_DrawSunGraveSpark = 0x80952E6C; // type:func -ObjectKankyo_InitBeams = 0x809533B4; // type:func -ObjectKankyo_WaitForBeamObject = 0x80953400; // type:func -ObjectKankyo_Beams = 0x80953460; // type:func -ObjectKankyo_DrawBeams = 0x80953540; // type:func -EnDu_SetupAction = 0x80953E90; // type:func -EnDu_GetTextId = 0x80953E9C; // type:func -EnDu_UpdateTalkState = 0x80953F40; // type:func -func_809FDDB4 = 0x8095401C; // type:func -func_809FDE24 = 0x8095408C; // type:func -func_809FDE9C = 0x80954104; // type:func -func_809FDFC0 = 0x80954228; // type:func -func_809FE000 = 0x8095426C; // type:func -func_809FE040 = 0x809542B0; // type:func -func_809FE104 = 0x80954374; // type:func -EnDu_Init = 0x8095441C; // type:func -EnDu_Destroy = 0x809545EC; // type:func -func_809FE3B4 = 0x8095462C; // type:func -func_809FE3C0 = 0x8095463C; // type:func -func_809FE4A4 = 0x80954724; // type:func -func_809FE638 = 0x809548BC; // type:func -func_809FE6CC = 0x80954954; // type:func -func_809FE740 = 0x809549C8; // type:func -func_809FE798 = 0x80954A20; // type:func -func_809FE890 = 0x80954B18; // type:func -func_809FEB08 = 0x80954D94; // type:func -func_809FEC14 = 0x80954EA0; // type:func -func_809FEC70 = 0x80954EFC; // type:func -func_809FECE4 = 0x80954F74; // type:func -EnDu_Update = 0x80954FAC; // type:func -EnDu_OverrideLimbDraw = 0x80955138; // type:func -EnDu_PostLimbDraw = 0x809552B4; // type:func -EnDu_Draw = 0x80955310; // type:func -EnFd_SpawnCore = 0x80955920; // type:func -EnFd_SpawnChildFire = 0x80955A18; // type:func -EnFd_SpawnDot = 0x80955B38; // type:func -EnFd_CheckHammer = 0x80955CA4; // type:func -EnFd_ColliderCheck = 0x80955D40; // type:func -EnFd_CanSeeActor = 0x80955ED8; // type:func -EnFd_FindBomb = 0x80955FE8; // type:func -EnFd_FindPotentialTheat = 0x809560A8; // type:func -EnFd_GetPosAdjAroundCircle = 0x8095611C; // type:func -EnFd_ShouldStopRunning = 0x809561E4; // type:func -EnFd_Fade = 0x80956318; // type:func -EnFd_Init = 0x80956428; // type:func -EnFd_Destroy = 0x80956564; // type:func -EnFd_Reappear = 0x80956590; // type:func -EnFd_SpinAndGrow = 0x80956620; // type:func -EnFd_JumpToGround = 0x809566F4; // type:func -EnFd_Land = 0x80956770; // type:func -EnFd_SpinAndSpawnFire = 0x80956850; // type:func -EnFd_Run = 0x80956A70; // type:func -EnFd_WaitForCore = 0x80956CD0; // type:func -EnFd_Update = 0x80956D48; // type:func -EnFd_OverrideLimbDraw = 0x80956F44; // type:func -EnFd_PostLimbDraw = 0x80956F80; // type:func -EnFd_Draw = 0x809572AC; // type:func -EnFd_SpawnEffect = 0x80957658; // type:func -EnFd_UpdateEffectsFlames = 0x80957748; // type:func -EnFd_UpdateEffectsDots = 0x80957860; // type:func -EnFd_DrawEffectsFlames = 0x8095797C; // type:func -EnFd_DrawEffectsDots = 0x80957D50; // type:func -func_80A693D0 = 0x809585C0; // type:func -func_80A6948C = 0x8095867C; // type:func -func_80A695A4 = 0x80958794; // type:func -EnHorseLinkChild_Init = 0x8095885C; // type:func -EnHorseLinkChild_Destroy = 0x80958A34; // type:func -func_80A6988C = 0x80958A84; // type:func -func_80A698F4 = 0x80958AE8; // type:func -func_80A6993C = 0x80958B30; // type:func -func_80A699FC = 0x80958BF0; // type:func -func_80A69B7C = 0x80958D78; // type:func -func_80A69C18 = 0x80958E18; // type:func -func_80A69EC0 = 0x809590C0; // type:func -func_80A69F5C = 0x80959160; // type:func -func_80A6A068 = 0x8095926C; // type:func -func_80A6A4DC = 0x809596E8; // type:func -func_80A6A5A4 = 0x809597B0; // type:func -func_80A6A724 = 0x80959930; // type:func -func_80A6A7D0 = 0x809599E0; // type:func -EnHorseLinkChild_Update = 0x80959CBC; // type:func -EnHorseLinkChild_PostDraw = 0x80959E14; // type:func -EnHorseLinkChild_OverrideLimbDraw = 0x80959FA0; // type:func -EnHorseLinkChild_Draw = 0x8095A028; // type:func -DoorAna_SetupAction = 0x8095A3C0; // type:func -DoorAna_Init = 0x8095A3CC; // type:func -DoorAna_Destroy = 0x8095A488; // type:func -DoorAna_WaitClosed = 0x8095A4C4; // type:func -DoorAna_WaitOpen = 0x8095A5FC; // type:func -DoorAna_GrabPlayer = 0x8095A7B0; // type:func -DoorAna_Update = 0x8095A85C; // type:func -DoorAna_Draw = 0x8095A8B0; // type:func -BgSpot02Objects_Init = 0x8095AA30; // type:func -BgSpot02Objects_Destroy = 0x8095ACA0; // type:func -func_808AC8FC = 0x8095ACD4; // type:func -func_808AC908 = 0x8095ACE4; // type:func -func_808ACA08 = 0x8095ADE4; // type:func -func_808ACAFC = 0x8095AEDC; // type:func -func_808ACB58 = 0x8095AF38; // type:func -BgSpot02Objects_Update = 0x8095AFB8; // type:func -BgSpot02Objects_Draw = 0x8095AFDC; // type:func -func_808ACC34 = 0x8095B018; // type:func -func_808ACCB8 = 0x8095B09C; // type:func -func_808AD3D4 = 0x8095B788; // type:func -func_808AD450 = 0x8095B804; // type:func -BgHaka_Init = 0x8095BD90; // type:func -BgHaka_Destroy = 0x8095BE0C; // type:func -BgHaka_CheckPlayerOnDirtPatch = 0x8095BE40; // type:func -BgHaka_IdleClosed = 0x8095BED0; // type:func -BgHaka_Pull = 0x8095C024; // type:func -BgHaka_IdleOpened = 0x8095C19C; // type:func -BgHaka_IdleLockedClosed = 0x8095C1D8; // type:func -BgHaka_Update = 0x8095C250; // type:func -BgHaka_Draw = 0x8095C274; // type:func -MagicWind_SetupAction = 0x8095C450; // type:func -MagicWind_Init = 0x8095C45C; // type:func -MagicWind_Destroy = 0x8095C568; // type:func -MagicWind_UpdateAlpha = 0x8095C59C; // type:func -MagicWind_WaitForTimer = 0x8095C6BC; // type:func -MagicWind_Grow = 0x8095C738; // type:func -MagicWind_WaitAtFullSize = 0x8095C788; // type:func -MagicWind_FadeOut = 0x8095C7D4; // type:func -MagicWind_Shrink = 0x8095C838; // type:func -MagicWind_Update = 0x8095C878; // type:func -MagicWind_OverrideLimbDraw = 0x8095C8CC; // type:func -MagicWind_Draw = 0x8095CA50; // type:func -MagicFire_Init = 0x8095E150; // type:func -MagicFire_Destroy = 0x8095E1FC; // type:func -MagicFire_UpdateBeforeCast = 0x8095E220; // type:func -MagicFire_Update = 0x8095E2C4; // type:func -MagicFire_Draw = 0x8095E658; // type:func -func_80AEAC10 = 0x80960450; // type:func -func_80AEAC54 = 0x80960494; // type:func -func_80AEACDC = 0x8096051C; // type:func -func_80AEAD20 = 0x80960560; // type:func -EnRu1_DestroyColliders = 0x809605D8; // type:func -func_80AEADD8 = 0x80960618; // type:func -func_80AEADE0 = 0x80960624; // type:func -func_80AEADF0 = 0x80960638; // type:func -EnRu1_Destroy = 0x80960648; // type:func -EnRu1_UpdateEyes = 0x80960668; // type:func -EnRu1_SetEyeIndex = 0x809606F0; // type:func -EnRu1_SetMouthIndex = 0x80960708; // type:func -func_80AEAECC = 0x80960720; // type:func -EnRu1_IsCsStateIdle = 0x80960788; // type:func -EnRu1_GetCue = 0x809607A8; // type:func -func_80AEAFA0 = 0x809607F4; // type:func -func_80AEAFE0 = 0x80960834; // type:func -func_80AEB020 = 0x80960874; // type:func -EnRu1_FindSwitch = 0x809608DC; // type:func -func_80AEB0EC = 0x80960924; // type:func -func_80AEB104 = 0x8096093C; // type:func -func_80AEB124 = 0x8096095C; // type:func -func_80AEB174 = 0x809609AC; // type:func -func_80AEB1B4 = 0x809609F0; // type:func -func_80AEB264 = 0x80960A1C; // type:func -EnRu1_UpdateSkelAnime = 0x80960AD8; // type:func -func_80AEB364 = 0x80960B1C; // type:func -func_80AEB3A4 = 0x80960B5C; // type:func -func_80AEB3CC = 0x80960B84; // type:func -func_80AEB3DC = 0x80960B98; // type:func -EnRu1_GetCueChannel3 = 0x80960BF4; // type:func -func_80AEB458 = 0x80960C14; // type:func -func_80AEB480 = 0x80960C3C; // type:func -EnRu1_SpawnRipple = 0x80960C64; // type:func -func_80AEB50C = 0x80960CCC; // type:func -func_80AEB59C = 0x80960D5C; // type:func -EnRu1_SpawnSplash = 0x80960E48; // type:func -func_80AEB6E0 = 0x80960EAC; // type:func -func_80AEB738 = 0x80960F08; // type:func -func_80AEB7D0 = 0x80960FA0; // type:func -func_80AEB7E0 = 0x80960FB4; // type:func -func_80AEB87C = 0x80961050; // type:func -func_80AEB89C = 0x80961074; // type:func -func_80AEB914 = 0x809610EC; // type:func -func_80AEB934 = 0x8096110C; // type:func -func_80AEB954 = 0x8096112C; // type:func -func_80AEB974 = 0x8096114C; // type:func -func_80AEBA0C = 0x809611E4; // type:func -func_80AEBA2C = 0x80961204; // type:func -func_80AEBAFC = 0x809612D4; // type:func -func_80AEBB3C = 0x80961318; // type:func -func_80AEBB78 = 0x80961358; // type:func -func_80AEBBF4 = 0x809613D8; // type:func -func_80AEBC30 = 0x80961418; // type:func -func_80AEBC84 = 0x80961470; // type:func -func_80AEBCB8 = 0x809614A8; // type:func -func_80AEBD1C = 0x8096150C; // type:func -func_80AEBD94 = 0x80961584; // type:func -func_80AEBE3C = 0x8096162C; // type:func -func_80AEBEC8 = 0x809616BC; // type:func -func_80AEBF60 = 0x80961754; // type:func -func_80AEBFD8 = 0x809617D0; // type:func -func_80AEC070 = 0x80961868; // type:func -func_80AEC0B4 = 0x809618B0; // type:func -func_80AEC100 = 0x80961904; // type:func -func_80AEC130 = 0x80961938; // type:func -func_80AEC17C = 0x80961988; // type:func -func_80AEC1D4 = 0x809619E8; // type:func -func_80AEC244 = 0x80961A5C; // type:func -func_80AEC2C0 = 0x80961ADC; // type:func -func_80AEC320 = 0x80961B40; // type:func -func_80AEC40C = 0x80961C34; // type:func -func_80AEC4CC = 0x80961CF4; // type:func -func_80AEC4F4 = 0x80961D1C; // type:func -func_80AEC5FC = 0x80961E24; // type:func -func_80AEC650 = 0x80961E78; // type:func -func_80AEC6B0 = 0x80961EDC; // type:func -func_80AEC6E4 = 0x80961F14; // type:func -func_80AEC780 = 0x80961FB4; // type:func -func_80AEC81C = 0x80962054; // type:func -func_80AEC8B8 = 0x809620F0; // type:func -func_80AEC93C = 0x80962178; // type:func -func_80AEC9C4 = 0x80962200; // type:func -func_80AECA18 = 0x80962254; // type:func -func_80AECA44 = 0x80962284; // type:func -func_80AECA94 = 0x809622D8; // type:func -func_80AECAB4 = 0x809622F8; // type:func -func_80AECAD4 = 0x80962318; // type:func -func_80AECB18 = 0x80962360; // type:func -func_80AECB60 = 0x809623AC; // type:func -func_80AECBB8 = 0x80962408; // type:func -func_80AECC1C = 0x80962470; // type:func -func_80AECC84 = 0x809624DC; // type:func -func_80AECCB0 = 0x80962508; // type:func -func_80AECDA0 = 0x809625F8; // type:func -func_80AECE04 = 0x8096265C; // type:func -func_80AECE20 = 0x8096267C; // type:func -func_80AECEB4 = 0x8096270C; // type:func -func_80AECF6C = 0x809627C4; // type:func -func_80AED084 = 0x809628DC; // type:func -func_80AED0B0 = 0x80962908; // type:func -func_80AED0C8 = 0x80962920; // type:func -func_80AED0D8 = 0x80962934; // type:func -func_80AED110 = 0x8096296C; // type:func -func_80AED154 = 0x809629B0; // type:func -func_80AED19C = 0x809629F8; // type:func -func_80AED218 = 0x80962A74; // type:func -func_80AED304 = 0x80962B64; // type:func -func_80AED324 = 0x80962B84; // type:func -func_80AED344 = 0x80962BA4; // type:func -func_80AED374 = 0x80962BD8; // type:func -func_80AED3A4 = 0x80962C0C; // type:func -func_80AED3E0 = 0x80962C4C; // type:func -func_80AED414 = 0x80962C84; // type:func -func_80AED44C = 0x80962CC4; // type:func -func_80AED4FC = 0x80962D78; // type:func -func_80AED520 = 0x80962DA0; // type:func -func_80AED57C = 0x80962E00; // type:func -func_80AED5B8 = 0x80962E40; // type:func -func_80AED5DC = 0x80962E68; // type:func -func_80AED600 = 0x80962E90; // type:func -func_80AED624 = 0x80962EB8; // type:func -func_80AED6DC = 0x80962F70; // type:func -func_80AED6F8 = 0x80962F90; // type:func -func_80AED738 = 0x80962FD0; // type:func -func_80AED83C = 0x809630D8; // type:func -func_80AED8DC = 0x8096317C; // type:func -func_80AEDAE0 = 0x80963380; // type:func -func_80AEDB30 = 0x809633D4; // type:func -func_80AEDEF4 = 0x80963794; // type:func -func_80AEDFF4 = 0x80963898; // type:func -func_80AEE02C = 0x809638D8; // type:func -func_80AEE050 = 0x80963900; // type:func -func_80AEE264 = 0x80963B1C; // type:func -func_80AEE2F8 = 0x80963BB0; // type:func -func_80AEE394 = 0x80963C4C; // type:func -func_80AEE488 = 0x80963D40; // type:func -func_80AEE568 = 0x80963E20; // type:func -func_80AEE628 = 0x80963EE4; // type:func -func_80AEE6D0 = 0x80963F88; // type:func -func_80AEE7C4 = 0x8096407C; // type:func -func_80AEEAC8 = 0x8096439C; // type:func -func_80AEEB24 = 0x809643F8; // type:func -func_80AEEBB4 = 0x80964488; // type:func -func_80AEEBD4 = 0x809644A8; // type:func -func_80AEEC5C = 0x80964534; // type:func -func_80AEECF0 = 0x809645CC; // type:func -func_80AEED58 = 0x80964638; // type:func -func_80AEEDCC = 0x809646B0; // type:func -func_80AEEE34 = 0x8096471C; // type:func -func_80AEEE9C = 0x80964788; // type:func -func_80AEEF08 = 0x809647F8; // type:func -func_80AEEF5C = 0x80964850; // type:func -func_80AEEF68 = 0x80964860; // type:func -func_80AEEFEC = 0x809648E8; // type:func -func_80AEF080 = 0x8096497C; // type:func -func_80AEF0BC = 0x809649BC; // type:func -func_80AEF170 = 0x80964A74; // type:func -func_80AEF188 = 0x80964A8C; // type:func -func_80AEF1F0 = 0x80964AF4; // type:func -func_80AEF29C = 0x80964BA0; // type:func -func_80AEF2AC = 0x80964BB4; // type:func -func_80AEF2D0 = 0x80964BDC; // type:func -func_80AEF354 = 0x80964C68; // type:func -func_80AEF3A8 = 0x80964CC4; // type:func -func_80AEF40C = 0x80964D2C; // type:func -func_80AEF4A8 = 0x80964DCC; // type:func -func_80AEF4E0 = 0x80964E04; // type:func -func_80AEF51C = 0x80964E44; // type:func -func_80AEF540 = 0x80964E6C; // type:func -func_80AEF5B8 = 0x80964EE8; // type:func -func_80AEF624 = 0x80964F58; // type:func -func_80AEF728 = 0x8096505C; // type:func -func_80AEF79C = 0x809650D0; // type:func -func_80AEF820 = 0x80965158; // type:func -func_80AEF890 = 0x809651C8; // type:func -func_80AEF930 = 0x80965254; // type:func -func_80AEF99C = 0x809652C4; // type:func -func_80AEF9D8 = 0x80965300; // type:func -func_80AEFA2C = 0x80965344; // type:func -func_80AEFAAC = 0x809653BC; // type:func -func_80AEFB04 = 0x80965404; // type:func -func_80AEFB68 = 0x80965460; // type:func -func_80AEFBC8 = 0x809654B8; // type:func -func_80AEFC24 = 0x80965518; // type:func -func_80AEFC54 = 0x8096554C; // type:func -func_80AEFCE8 = 0x809655E8; // type:func -func_80AEFD38 = 0x80965638; // type:func -func_80AEFDC0 = 0x809656C4; // type:func -func_80AEFE38 = 0x80965748; // type:func -func_80AEFE84 = 0x80965794; // type:func -func_80AEFE9C = 0x809657AC; // type:func -func_80AEFECC = 0x809657E0; // type:func -func_80AEFF40 = 0x8096585C; // type:func -func_80AEFF94 = 0x809658B8; // type:func -EnRu1_Update = 0x80965954; // type:func -EnRu1_Init = 0x8096599C; // type:func -func_80AF0278 = 0x80965AD8; // type:func -EnRu1_OverrideLimbDraw = 0x80965B48; // type:func -EnRu1_PostLimbDraw = 0x80965BB4; // type:func -EnRu1_DrawNothing = 0x80965C40; // type:func -EnRu1_DrawOpa = 0x80965C50; // type:func -EnRu1_DrawXlu = 0x80965DF4; // type:func -EnRu1_Draw = 0x80965F94; // type:func -BossFd2_SpawnDebris = 0x80967AF0; // type:func -BossFd2_SpawnFireBreath = 0x80967BC8; // type:func -BossFd2_SpawnEmber = 0x80967CDC; // type:func -BossFd2_SpawnSkullPiece = 0x80967DB0; // type:func -BossFd2_SpawnDust = 0x80967E88; // type:func -BossFd2_Init = 0x80967F20; // type:func -BossFd2_Destroy = 0x8096801C; // type:func -BossFd2_SetupEmerge = 0x8096805C; // type:func -BossFd2_Emerge = 0x80968154; // type:func -BossFd2_SetupIdle = 0x80968494; // type:func -BossFd2_Idle = 0x8096853C; // type:func -BossFd2_SetupBurrow = 0x80968690; // type:func -BossFd2_Burrow = 0x80968708; // type:func -BossFd2_SetupBreatheFire = 0x809687D8; // type:func -BossFd2_BreatheFire = 0x8096883C; // type:func -BossFd2_SetupClawSwipe = 0x80968D80; // type:func -BossFd2_ClawSwipe = 0x80968DE0; // type:func -BossFd2_SetupVulnerable = 0x80968E58; // type:func -BossFd2_Vulnerable = 0x80968EB4; // type:func -BossFd2_SetupDamaged = 0x8096910C; // type:func -BossFd2_Damaged = 0x80969168; // type:func -BossFd2_SetupDeath = 0x80969298; // type:func -BossFd2_UpdateCamera = 0x80969328; // type:func -BossFd2_Death = 0x80969498; // type:func -BossFd2_Wait = 0x80969B1C; // type:func -BossFd2_CollisionCheck = 0x80969B64; // type:func -BossFd2_UpdateFace = 0x8096A004; // type:func -BossFd2_Update = 0x8096A170; // type:func -BossFd2_OverrideLimbDraw = 0x8096A324; // type:func -BossFd2_PostLimbDraw = 0x8096A518; // type:func -BossFd2_UpdateMane = 0x8096A5C0; // type:func -BossFd2_DrawMane = 0x8096AB94; // type:func -BossFd2_Draw = 0x8096AFD8; // type:func -EnFdFire_UpdatePos = 0x8096B820; // type:func -EnFdFire_CheckCollider = 0x8096B8E8; // type:func -EnFdFire_Init = 0x8096B94C; // type:func -EnFdFire_Destroy = 0x8096BA54; // type:func -func_80A0E70C = 0x8096BA80; // type:func -EnFdFire_WaitToDie = 0x8096BBBC; // type:func -EnFdFire_DanceTowardsPlayer = 0x8096BBF8; // type:func -EnFdFire_Disappear = 0x8096BDA8; // type:func -EnFdFire_Update = 0x8096BE5C; // type:func -EnFdFire_Draw = 0x8096BF58; // type:func -EnDh_SetupAction = 0x8096C530; // type:func -EnDh_Init = 0x8096C53C; // type:func -EnDh_Destroy = 0x8096C678; // type:func -EnDh_SpawnDebris = 0x8096C6C0; // type:func -EnDh_SetupWait = 0x8096C858; // type:func -EnDh_Wait = 0x8096C90C; // type:func -EnDh_SetupWalk = 0x8096CB30; // type:func -EnDh_Walk = 0x8096CBCC; // type:func -EnDh_SetupRetreat = 0x8096CCD4; // type:func -EnDh_Retreat = 0x8096CD38; // type:func -EnDh_SetupAttack = 0x8096CDC4; // type:func -EnDh_Attack = 0x8096CE24; // type:func -EnDh_SetupBurrow = 0x8096D134; // type:func -EnDh_Burrow = 0x8096D1B8; // type:func -EnDh_SetupDamage = 0x8096D348; // type:func -EnDh_Damage = 0x8096D3C8; // type:func -EnDh_SetupDeath = 0x8096D4F0; // type:func -EnDh_Death = 0x8096D578; // type:func -EnDh_CollisionCheck = 0x8096D6A8; // type:func -EnDh_Update = 0x8096D7F8; // type:func -EnDh_PostLimbDraw = 0x8096D9A8; // type:func -EnDh_Draw = 0x8096DA38; // type:func -EnDha_SetupAction = 0x8096E010; // type:func -EnDha_Init = 0x8096E01C; // type:func -EnDha_Destroy = 0x8096E138; // type:func -EnDha_SetupWait = 0x8096E164; // type:func -EnDha_Wait = 0x8096E1EC; // type:func -EnDha_SetupTakeDamage = 0x8096E6FC; // type:func -EnDha_TakeDamage = 0x8096E728; // type:func -EnDha_SetupDeath = 0x8096E7F0; // type:func -EnDha_Die = 0x8096E860; // type:func -EnDha_UpdateHealth = 0x8096EA1C; // type:func -EnDha_Update = 0x8096EB10; // type:func -EnDha_OverrideLimbDraw = 0x8096EBB8; // type:func -EnDha_PostLimbDraw = 0x8096EC58; // type:func -EnDha_Draw = 0x8096ED70; // type:func -EnRl_Destroy = 0x8096F010; // type:func -func_80AE72D0 = 0x8096F034; // type:func -func_80AE744C = 0x8096F0BC; // type:func -func_80AE7494 = 0x8096F104; // type:func -func_80AE74B4 = 0x8096F128; // type:func -func_80AE74FC = 0x8096F174; // type:func -func_80AE7544 = 0x8096F1C0; // type:func -func_80AE7590 = 0x8096F20C; // type:func -func_80AE7668 = 0x8096F2EC; // type:func -func_80AE7698 = 0x8096F320; // type:func -func_80AE772C = 0x8096F3B4; // type:func -func_80AE7798 = 0x8096F420; // type:func -func_80AE77B8 = 0x8096F440; // type:func -func_80AE77F8 = 0x8096F488; // type:func -func_80AE7838 = 0x8096F4CC; // type:func -func_80AE7878 = 0x8096F514; // type:func -func_80AE78D4 = 0x8096F56C; // type:func -func_80AE7954 = 0x8096F5EC; // type:func -func_80AE79A4 = 0x8096F63C; // type:func -func_80AE7AF8 = 0x8096F790; // type:func -func_80AE7BF8 = 0x8096F89C; // type:func -func_80AE7C64 = 0x8096F908; // type:func -func_80AE7C94 = 0x8096F928; // type:func -func_80AE7CE8 = 0x8096F970; // type:func -func_80AE7D40 = 0x8096F9B4; // type:func -func_80AE7D94 = 0x8096F9FC; // type:func -EnRl_Update = 0x8096FB44; // type:func -EnRl_Init = 0x8096FB8C; // type:func -func_80AE7FD0 = 0x8096FBF8; // type:func -func_80AE7FDC = 0x8096FC08; // type:func -EnRl_Draw = 0x8096FD3C; // type:func -EnEncount1_Init = 0x8096FEF0; // type:func -EnEncount1_SpawnLeevers = 0x80970024; // type:func -EnEncount1_SpawnTektites = 0x80970380; // type:func -EnEncount1_SpawnStalchildOrWolfos = 0x80970518; // type:func -EnEncount1_Update = 0x8097096C; // type:func -DemoDu_Destroy = 0x80970A50; // type:func -DemoDu_UpdateEyes = 0x80970A74; // type:func -DemoDu_SetEyeTexIndex = 0x80970AFC; // type:func -DemoDu_SetMouthTexIndex = 0x80970B14; // type:func -DemoDu_UpdateSkelAnime = 0x80970B2C; // type:func -DemoDu_UpdateBgCheckInfo = 0x80970B50; // type:func -DemoDu_GetCue = 0x80970B98; // type:func -DemoDu_CheckForCue = 0x80970BC0; // type:func -DemoDu_CheckForNoCue = 0x80970C0C; // type:func -DemoDu_SetStartPosRotFromCue = 0x80970C58; // type:func -func_80969DDC = 0x80970CD8; // type:func -DemoDu_InitCs_FireMedallion = 0x80970D68; // type:func -DemoDu_CsFireMedallion_SpawnDoorWarp = 0x80970DD8; // type:func -func_80969F38 = 0x80970E34; // type:func -func_80969FB4 = 0x80970EB0; // type:func -DemoDu_CsFireMedallion_AdvanceTo01 = 0x80970ED0; // type:func -DemoDu_CsFireMedallion_AdvanceTo02 = 0x80970F68; // type:func -DemoDu_CsFireMedallion_AdvanceTo03 = 0x80970FB8; // type:func -DemoDu_CsFireMedallion_AdvanceTo04 = 0x80970FE4; // type:func -DemoDu_CsFireMedallion_AdvanceTo05 = 0x80971078; // type:func -DemoDu_CsFireMedallion_AdvanceTo06 = 0x809710E4; // type:func -DemoDu_UpdateCs_FM_00 = 0x80971130; // type:func -DemoDu_UpdateCs_FM_01 = 0x80971150; // type:func -DemoDu_UpdateCs_FM_02 = 0x80971170; // type:func -DemoDu_UpdateCs_FM_03 = 0x809711A4; // type:func -DemoDu_UpdateCs_FM_04 = 0x809711E4; // type:func -DemoDu_UpdateCs_FM_05 = 0x8097121C; // type:func -DemoDu_UpdateCs_FM_06 = 0x8097125C; // type:func -DemoDu_InitCs_GoronsRuby = 0x80971288; // type:func -DemoDu_CsPlaySfx_GoronLanding = 0x809712D8; // type:func -DemoDu_CsPlaySfx_DaruniaFalling = 0x80971300; // type:func -DemoDu_CsPlaySfx_DaruniaHitsLink = 0x80971330; // type:func -DemoDu_CsPlaySfx_HitBreast = 0x80971388; // type:func -DemoDu_CsPlaySfx_LinkEscapeFromGorons = 0x809713B0; // type:func -DemoDu_CsPlaySfx_LinkSurprised = 0x80971408; // type:func -DemoDu_CsGoronsRuby_UpdateFaceTextures = 0x80971460; // type:func -func_8096A630 = 0x80971568; // type:func -DemoDu_CsGoronsRuby_SpawnDustWhenHittingLink = 0x8097161C; // type:func -DemoDu_CsGoronsRuby_DaruniaFalling = 0x809718B0; // type:func -DemoDu_CsGoronsRuby_AdvanceTo01 = 0x8097198C; // type:func -DemoDu_CsGoronsRuby_AdvanceTo02 = 0x809719A0; // type:func -DemoDu_CsGoronsRuby_AdvanceTo03 = 0x80971A44; // type:func -DemoDu_CsGoronsRuby_AdvanceTo04 = 0x80971A98; // type:func -DemoDu_CsGoronsRuby_AdvanceTo05 = 0x80971AD0; // type:func -DemoDu_CsGoronsRuby_AdvanceTo06 = 0x80971B3C; // type:func -DemoDu_CsGoronsRuby_AdvanceTo07 = 0x80971BD4; // type:func -DemoDu_CsGoronsRuby_AdvanceTo08 = 0x80971C40; // type:func -DemoDu_CsGoronsRuby_AdvanceTo09 = 0x80971CD4; // type:func -DemoDu_CsGoronsRuby_AdvanceTo10 = 0x80971D44; // type:func -DemoDu_CsGoronsRuby_AdvanceTo11 = 0x80971DB0; // type:func -DemoDu_CsGoronsRuby_AdvanceTo12 = 0x80971E44; // type:func -DemoDu_CsGoronsRuby_AdvanceTo13 = 0x80971EB0; // type:func -DemoDu_UpdateCs_GR_00 = 0x80971F40; // type:func -DemoDu_UpdateCs_GR_01 = 0x80971F74; // type:func -DemoDu_UpdateCs_GR_02 = 0x80971FB0; // type:func -DemoDu_UpdateCs_GR_03 = 0x8097200C; // type:func -DemoDu_UpdateCs_GR_04 = 0x8097204C; // type:func -DemoDu_UpdateCs_GR_05 = 0x8097209C; // type:func -DemoDu_UpdateCs_GR_06 = 0x809720E8; // type:func -DemoDu_UpdateCs_GR_07 = 0x80972148; // type:func -DemoDu_UpdateCs_GR_08 = 0x80972194; // type:func -DemoDu_UpdateCs_GR_09 = 0x809721F8; // type:func -DemoDu_UpdateCs_GR_10 = 0x80972258; // type:func -DemoDu_UpdateCs_GR_11 = 0x809722A4; // type:func -DemoDu_UpdateCs_GR_12 = 0x809722F4; // type:func -DemoDu_UpdateCs_GR_13 = 0x80972340; // type:func -DemoDu_InitCs_AfterGanon = 0x80972388; // type:func -DemoDu_CsPlaySfx_WhiteOut = 0x80972428; // type:func -DemoDu_CsAfterGanon_SpawnDemo6K = 0x80972448; // type:func -DemoDu_CsAfterGanon_AdvanceTo01 = 0x809724C8; // type:func -DemoDu_CsAfterGanon_AdvanceTo02 = 0x8097251C; // type:func -DemoDu_CsAfterGanon_BackTo01 = 0x80972670; // type:func -DemoDu_UpdateCs_AG_00 = 0x8097270C; // type:func -DemoDu_UpdateCs_AG_01 = 0x8097272C; // type:func -DemoDu_UpdateCs_AG_02 = 0x80972774; // type:func -DemoDu_Draw_02 = 0x809727BC; // type:func -DemoDu_InitCs_Credits = 0x80972978; // type:func -DemoDu_CsCredits_UpdateShadowAlpha = 0x809729E4; // type:func -DemoDu_CsCredits_AdvanceTo01 = 0x80972A70; // type:func -DemoDu_CsCredits_AdvanceTo02 = 0x80972AA8; // type:func -DemoDu_CsCredits_AdvanceTo03 = 0x80972AF4; // type:func -DemoDu_CsCredits_AdvanceTo04 = 0x80972B34; // type:func -DemoDu_CsCredits_BackTo02 = 0x80972B74; // type:func -DemoDu_CsCredits_HandleCues = 0x80972BBC; // type:func -DemoDu_UpdateCs_CR_00 = 0x80972C68; // type:func -DemoDu_UpdateCs_CR_01 = 0x80972C88; // type:func -DemoDu_UpdateCs_CR_02 = 0x80972CD4; // type:func -DemoDu_UpdateCs_CR_03 = 0x80972D1C; // type:func -DemoDu_UpdateCs_CR_04 = 0x80972D64; // type:func -DemoDu_Update = 0x80972DA8; // type:func -DemoDu_Init = 0x80972DF0; // type:func -DemoDu_Draw_NoDraw = 0x80972E94; // type:func -DemoDu_Draw_01 = 0x80972EA4; // type:func -DemoDu_Draw = 0x8097304C; // type:func -func_80984BE0 = 0x80974230; // type:func -DemoIm_InitCollider = 0x809742B8; // type:func -DemoIm_DestroyCollider = 0x80974304; // type:func -DemoIm_UpdateCollider = 0x80974330; // type:func -func_80984DB8 = 0x80974374; // type:func -func_80984E58 = 0x80974418; // type:func -func_80984F10 = 0x809744D0; // type:func -func_80984F94 = 0x80974558; // type:func -DemoIm_UpdateBgCheckInfo = 0x809745E0; // type:func -DemoIm_UpdateSkelAnime = 0x80974628; // type:func -DemoIm_IsCutsceneIdle = 0x8097464C; // type:func -DemoIm_GetCue = 0x8097466C; // type:func -func_809850E8 = 0x809746B8; // type:func -func_80985134 = 0x80974704; // type:func -func_80985180 = 0x80974750; // type:func -func_80985200 = 0x809747D0; // type:func -DemoIm_ChangeAnim = 0x80974850; // type:func -func_80985310 = 0x809748E0; // type:func -func_80985358 = 0x80974928; // type:func -func_809853B4 = 0x80974984; // type:func -func_80985430 = 0x80974A00; // type:func -func_8098544C = 0x80974A20; // type:func -func_809854DC = 0x80974ABC; // type:func -func_8098557C = 0x80974B5C; // type:func -func_809855A8 = 0x80974B88; // type:func -func_80985640 = 0x80974C20; // type:func -func_809856AC = 0x80974C8C; // type:func -func_809856F8 = 0x80974CD8; // type:func -func_80985718 = 0x80974CF8; // type:func -func_80985738 = 0x80974D18; // type:func -func_80985770 = 0x80974D54; // type:func -func_809857B0 = 0x80974D9C; // type:func -func_809857F0 = 0x80974DE0; // type:func -func_80985830 = 0x80974E28; // type:func -func_80985860 = 0x80974E5C; // type:func -func_809858A8 = 0x80974EA0; // type:func -DemoIm_SpawnLightBall = 0x80974EC0; // type:func -func_80985948 = 0x80974F40; // type:func -func_809859E0 = 0x80974FDC; // type:func -func_80985B34 = 0x80975130; // type:func -func_80985C10 = 0x80975214; // type:func -func_80985C40 = 0x80975234; // type:func -func_80985C94 = 0x8097527C; // type:func -DemoIm_DrawTranslucent = 0x809752C4; // type:func -func_80985E60 = 0x8097540C; // type:func -func_80985EAC = 0x80975458; // type:func -func_80985EF4 = 0x809754A0; // type:func -func_80985F54 = 0x80975500; // type:func -func_80985F64 = 0x80975514; // type:func -func_80985FE8 = 0x80975598; // type:func -func_8098604C = 0x809755FC; // type:func -func_809860C8 = 0x80975678; // type:func -func_809860DC = 0x80975690; // type:func -func_80986148 = 0x809756FC; // type:func -func_809861C4 = 0x80975778; // type:func -func_8098629C = 0x8097583C; // type:func -func_809862E0 = 0x80975880; // type:func -func_809863BC = 0x80975948; // type:func -func_809863DC = 0x80975968; // type:func -func_80986430 = 0x809759C4; // type:func -func_80986494 = 0x80975A30; // type:func -func_809864D4 = 0x80975A78; // type:func -func_8098652C = 0x80975AD8; // type:func -func_80986570 = 0x80975B1C; // type:func -func_809865F8 = 0x80975BA4; // type:func -func_80986700 = 0x80975CB4; // type:func -func_80986710 = 0x80975CC8; // type:func -func_80986794 = 0x80975D4C; // type:func -func_8098680C = 0x80975DC4; // type:func -func_809868E8 = 0x80975E8C; // type:func -func_80986908 = 0x80975EAC; // type:func -func_80986948 = 0x80975EF4; // type:func -func_809869B0 = 0x80975F64; // type:func -func_809869F8 = 0x80975FA8; // type:func -func_80986A5C = 0x8097600C; // type:func -func_80986AD0 = 0x80976080; // type:func -func_80986B2C = 0x809760DC; // type:func -func_80986BA0 = 0x80976150; // type:func -func_80986BE4 = 0x80976194; // type:func -func_80986BF8 = 0x809761A8; // type:func -func_80986C30 = 0x809761E0; // type:func -func_80986CC8 = 0x80976284; // type:func -func_80986CFC = 0x809762B8; // type:func -func_80986D40 = 0x80976300; // type:func -func_80986DC8 = 0x80976368; // type:func -func_80986E20 = 0x809763C4; // type:func -func_80986E40 = 0x809763E4; // type:func -func_80986EAC = 0x80976458; // type:func -func_80986F08 = 0x809764BC; // type:func -func_80986F28 = 0x809764DC; // type:func -func_80986F88 = 0x80976544; // type:func -func_80986FA8 = 0x80976568; // type:func -func_80987018 = 0x809765E0; // type:func -func_80987064 = 0x80976628; // type:func -func_809870F0 = 0x809766B4; // type:func -func_80987128 = 0x809766EC; // type:func -func_80987174 = 0x80976738; // type:func -func_809871B4 = 0x80976778; // type:func -func_809871E8 = 0x809767AC; // type:func -func_80987288 = 0x80976838; // type:func -func_809872A8 = 0x80976858; // type:func -func_809872F0 = 0x809768A4; // type:func -func_80987330 = 0x809768EC; // type:func -DemoIm_Update = 0x80976930; // type:func -DemoIm_Init = 0x80976978; // type:func -DemoIm_Destroy = 0x80976AA0; // type:func -DemoIm_OverrideLimbDraw = 0x80976AC0; // type:func -DemoIm_PostLimbDraw = 0x80976B70; // type:func -DemoIm_DrawNothing = 0x80976BFC; // type:func -DemoIm_DrawSolid = 0x80976C0C; // type:func -DemoIm_Draw = 0x80976D50; // type:func -DemoTreLgt_Init = 0x809781A0; // type:func -DemoTreLgt_Destroy = 0x809781FC; // type:func -func_80993754 = 0x80978228; // type:func -func_8099375C = 0x80978234; // type:func -func_809937B4 = 0x8097828C; // type:func -func_80993848 = 0x80978324; // type:func -DemoTreLgt_Update = 0x809785D8; // type:func -DemoTreLgt_OverrideLimbDraw = 0x8097860C; // type:func -DemoTreLgt_Draw = 0x80978760; // type:func -EnFw_DoBounce = 0x809788B0; // type:func -EnFw_PlayerInRange = 0x80978978; // type:func -EnFw_GetPosAdjAroundCircle = 0x80978A74; // type:func -EnFw_CheckCollider = 0x80978B48; // type:func -EnFw_SpawnDust = 0x80978C08; // type:func -EnFw_Init = 0x80978E50; // type:func -EnFw_Destroy = 0x80978F58; // type:func -EnFw_Bounce = 0x80978F84; // type:func -EnFw_Run = 0x80978FF0; // type:func -EnFw_TurnToParentInitPos = 0x809795C4; // type:func -EnFw_JumpToParentInitPos = 0x809796B8; // type:func -EnFw_Update = 0x8097976C; // type:func -EnFw_OverrideLimbDraw = 0x8097984C; // type:func -EnFw_PostLimbDraw = 0x80979868; // type:func -EnFw_Draw = 0x80979904; // type:func -EnFw_SpawnEffectDust = 0x8097998C; // type:func -EnFw_UpdateEffects = 0x80979A30; // type:func -EnFw_DrawEffects = 0x80979B3C; // type:func -BgVbSima_Init = 0x8097A070; // type:func -BgVbSima_Destroy = 0x8097A0D8; // type:func -BgVbSima_SpawnEmber = 0x8097A10C; // type:func -BgVbSima_Update = 0x8097A1D8; // type:func -BgVbSima_Draw = 0x8097A638; // type:func -EnVbBall_Init = 0x8097A790; // type:func -EnVbBall_Destroy = 0x8097A910; // type:func -EnVbBall_SpawnDebris = 0x8097A94C; // type:func -EnVbBall_SpawnDust = 0x8097AA24; // type:func -EnVbBall_UpdateBones = 0x8097AAC4; // type:func -EnVbBall_Update = 0x8097ADA8; // type:func -EnVbBall_Draw = 0x8097B574; // type:func -BgHakaMegane_Init = 0x8097B940; // type:func -BgHakaMegane_Destroy = 0x8097B9F8; // type:func -func_8087DB24 = 0x8097BA2C; // type:func -func_8087DBF0 = 0x8097BAFC; // type:func -BgHakaMegane_DoNothing = 0x8097BB70; // type:func -BgHakaMegane_Update = 0x8097BB80; // type:func -BgHakaMegane_Draw = 0x8097BBA4; // type:func -BgHakaMeganeBG_Init = 0x8097BD40; // type:func -BgHakaMeganeBG_Destroy = 0x8097BEDC; // type:func -func_8087DFF8 = 0x8097BF10; // type:func -func_8087E040 = 0x8097BF58; // type:func -func_8087E10C = 0x8097C024; // type:func -func_8087E1E0 = 0x8097C0F8; // type:func -func_8087E258 = 0x8097C170; // type:func -func_8087E288 = 0x8097C1A0; // type:func -func_8087E2D8 = 0x8097C1F0; // type:func -func_8087E34C = 0x8097C264; // type:func -BgHakaMeganeBG_Update = 0x8097C274; // type:func -BgHakaMeganeBG_Draw = 0x8097C298; // type:func -BgHakaShip_Init = 0x8097C400; // type:func -BgHakaShip_Destroy = 0x8097C544; // type:func -BgHakaShip_ChildUpdatePosition = 0x8097C584; // type:func -BgHakaShip_WaitForSong = 0x8097C5E0; // type:func -BgHakaShip_CutsceneStationary = 0x8097C658; // type:func -BgHakaShip_Move = 0x8097C6F4; // type:func -BgHakaShip_SetupCrash = 0x8097C8B8; // type:func -BgHakaShip_CrashShake = 0x8097C914; // type:func -BgHakaShip_CrashFall = 0x8097C9A4; // type:func -BgHakaShip_Update = 0x8097CA64; // type:func -BgHakaShip_Draw = 0x8097CAA4; // type:func -BgHakaSgami_Init = 0x8097CE50; // type:func -BgHakaSgami_Destroy = 0x8097D0F8; // type:func -BgHakaSgami_SetupSpin = 0x8097D158; // type:func -BgHakaSgami_Spin = 0x8097D1D0; // type:func -BgHakaSgami_Update = 0x8097D6E4; // type:func -BgHakaSgami_Draw = 0x8097D738; // type:func -EnHeishi2_Init = 0x8097DA70; // type:func -EnHeishi2_Destroy = 0x8097DCF0; // type:func -EnHeishi2_DoNothing1 = 0x8097DD34; // type:func -EnHeishi_DoNothing2 = 0x8097DD44; // type:func -func_80A531E4 = 0x8097DD54; // type:func -func_80A53278 = 0x8097DDE8; // type:func -func_80A5344C = 0x8097DF68; // type:func -func_80A53538 = 0x8097E054; // type:func -func_80A535BC = 0x8097E0DC; // type:func -func_80A53638 = 0x8097E158; // type:func -func_80A5372C = 0x8097E244; // type:func -func_80A53850 = 0x8097E368; // type:func -func_80A53908 = 0x8097E420; // type:func -func_80A5399C = 0x8097E4B4; // type:func -func_80A53AD4 = 0x8097E5D8; // type:func -func_80A53C0C = 0x8097E714; // type:func -func_80A53C90 = 0x8097E79C; // type:func -func_80A53D0C = 0x8097E818; // type:func -func_80A53DF8 = 0x8097E8FC; // type:func -func_80A53F30 = 0x8097EA34; // type:func -func_80A54038 = 0x8097EB3C; // type:func -func_80A540C0 = 0x8097EBC8; // type:func -func_80A541FC = 0x8097ED04; // type:func -func_80A5427C = 0x8097ED88; // type:func -func_80A54320 = 0x8097EE2C; // type:func -func_80A543A0 = 0x8097EEAC; // type:func -func_80A544AC = 0x8097EFB8; // type:func -func_80A5455C = 0x8097F068; // type:func -func_80A546DC = 0x8097F1DC; // type:func -func_80A5475C = 0x8097F25C; // type:func -func_80A54954 = 0x8097F454; // type:func -func_80A549E8 = 0x8097F4E8; // type:func -EnHeishi2_Update = 0x8097F578; // type:func -EnHeishi2_OverrideLimbDraw = 0x8097F6C4; // type:func -EnHeishi2_PostLimbDraw = 0x8097F73C; // type:func -EnHeishi2_DrawKingGuard = 0x8097F774; // type:func -EnHeishi2_Draw = 0x8097F7E8; // type:func -EnEncount2_Init = 0x8097FC70; // type:func -EnEncount2_Wait = 0x8097FCE4; // type:func -EnEncount2_SpawnRocks = 0x8097FF3C; // type:func -EnEncount2_Update = 0x80980504; // type:func -EnEncount2_Draw = 0x809808D0; // type:func -EnEncount2_SpawnEffect = 0x809808F0; // type:func -EnEncount2_UpdateEffects = 0x809809A4; // type:func -EnEncount2_DrawEffects = 0x80980B78; // type:func -EnFireRock_Init = 0x80980EA0; // type:func -EnFireRock_Destroy = 0x80981290; // type:func -EnFireRock_Fall = 0x809812F4; // type:func -EnFireRock_SpawnMoreBrokenPieces = 0x80981648; // type:func -FireRock_WaitSpawnRocksFromCeiling = 0x809817C8; // type:func -FireRock_WaitOnFloor = 0x809818B8; // type:func -EnFireRock_Update = 0x8098199C; // type:func -EnFireRock_Draw = 0x80981C48; // type:func -EnBrob_Init = 0x80981FB0; // type:func -EnBrob_Destroy = 0x80982224; // type:func -EnBrob_SetupIdle = 0x8098227C; // type:func -EnBrob_SetupMoveUp = 0x809822E4; // type:func -EnBrob_SetupWobble = 0x80982344; // type:func -EnBrob_SetupStunned = 0x80982398; // type:func -EnBrob_SetupMoveDown = 0x8098242C; // type:func -EnBrob_SetupShock = 0x809824AC; // type:func -EnBrob_Idle = 0x809824F8; // type:func -EnBrob_MoveUp = 0x809825B8; // type:func -EnBrob_Wobble = 0x809826BC; // type:func -EnBrob_Stunned = 0x8098275C; // type:func -EnBrob_MoveDown = 0x809827F8; // type:func -EnBrob_Shock = 0x809828FC; // type:func -EnBrob_Update = 0x80982B14; // type:func -EnBrob_PostLimbDraw = 0x80982DB0; // type:func -EnBrob_Draw = 0x80982E84; // type:func -MirRay_SetupCollider = 0x809830A0; // type:func -MirRay_MakeShieldLight = 0x80983168; // type:func -MirRay_Init = 0x8098330C; // type:func -MirRay_Destroy = 0x809835A4; // type:func -MirRay_Update = 0x8098361C; // type:func -MirRay_SetIntensity = 0x80983708; // type:func -MirRay_SetupReflectionPolys = 0x809838BC; // type:func -MirRay_RemoveSimilarReflections = 0x80983A98; // type:func -MirRay_ReflectedBeam = 0x80983B9C; // type:func -MirRay_Draw = 0x8098410C; // type:func -MirRay_CheckInFrustum = 0x809843E8; // type:func -func_808B1AE0 = 0x80984950; // type:func -func_808B1BA0 = 0x80984A10; // type:func -func_808B1BEC = 0x80984A5C; // type:func -func_808B1C70 = 0x80984AE8; // type:func -func_808B1CEC = 0x80984B64; // type:func -func_808B1D18 = 0x80984B90; // type:func -func_808B1D44 = 0x80984BBC; // type:func -BgSpot09Obj_Init = 0x80984BFC; // type:func -BgSpot09Obj_Destroy = 0x80984C64; // type:func -BgSpot09Obj_Update = 0x80984CA4; // type:func -BgSpot09Obj_Draw = 0x80984CB4; // type:func -func_808B8910 = 0x80984E70; // type:func -func_808B8A5C = 0x80984F28; // type:func -func_808B8A98 = 0x80984F64; // type:func -func_808B8B08 = 0x80984FD4; // type:func -func_808B8B38 = 0x80985008; // type:func -func_808B8BB4 = 0x80985084; // type:func -func_808B8C90 = 0x80985168; // type:func -func_808B8CC8 = 0x809851A4; // type:func -BgSpot18Obj_Init = 0x809851F8; // type:func -BgSpot18Obj_Destroy = 0x80985254; // type:func -func_808B8DC0 = 0x80985288; // type:func -func_808B8DD0 = 0x8098529C; // type:func -func_808B8DDC = 0x809852AC; // type:func -func_808B8E20 = 0x809852F0; // type:func -func_808B8E64 = 0x80985334; // type:func -func_808B8E7C = 0x80985350; // type:func -func_808B8EE0 = 0x809853B4; // type:func -func_808B8F08 = 0x809853E0; // type:func -func_808B9030 = 0x8098550C; // type:func -func_808B9040 = 0x80985520; // type:func -BgSpot18Obj_Update = 0x80985540; // type:func -BgSpot18Obj_Draw = 0x80985574; // type:func -BossVa_SetupAction = 0x80985740; // type:func -BossVa_AttachToBody = 0x8098574C; // type:func -BossVa_BloodDroplets = 0x80985990; // type:func -BossVa_BloodSplatter = 0x80985A90; // type:func -BossVa_Gore = 0x80985BBC; // type:func -BossVa_Spark = 0x80985CEC; // type:func -BossVa_Tumor = 0x80985E70; // type:func -BossVa_SetSparkEnv = 0x80985FF4; // type:func -BossVa_SetDeathEnv = 0x80986040; // type:func -BossVa_FindBoomerang = 0x809860C0; // type:func -BossVa_KillBari = 0x80986100; // type:func -BossVa_Init = 0x809862EC; // type:func -BossVa_Destroy = 0x80986B3C; // type:func -BossVa_SetupIntro = 0x80986B8C; // type:func -BossVa_BodyIntro = 0x80986C1C; // type:func -BossVa_SetupBodyPhase1 = 0x80987C3C; // type:func -BossVa_BodyPhase1 = 0x80987CE0; // type:func -BossVa_SetupBodyPhase2 = 0x80987F78; // type:func -BossVa_BodyPhase2 = 0x809880A4; // type:func -BossVa_SetupBodyPhase3 = 0x809885A8; // type:func -BossVa_BodyPhase3 = 0x809885E4; // type:func -BossVa_SetupBodyPhase4 = 0x80988C4C; // type:func -BossVa_BodyPhase4 = 0x80988D00; // type:func -BossVa_SetupBodyDeath = 0x80989808; // type:func -BossVa_BodyDeath = 0x809898A0; // type:func -BossVa_SetupSupportIntro = 0x8098A3F8; // type:func -BossVa_SupportIntro = 0x8098A470; // type:func -BossVa_SetupSupportAttached = 0x8098A594; // type:func -BossVa_SupportAttached = 0x8098A618; // type:func -BossVa_SetupSupportCut = 0x8098A840; // type:func -BossVa_SupportCut = 0x8098A908; // type:func -BossVa_SetupStump = 0x8098ADDC; // type:func -BossVa_Stump = 0x8098AE60; // type:func -BossVa_SetupZapperIntro = 0x8098AEF8; // type:func -BossVa_ZapperIntro = 0x8098AF8C; // type:func -BossVa_SetupZapperAttack = 0x8098B04C; // type:func -BossVa_ZapperAttack = 0x8098B0E0; // type:func -BossVa_SetupZapperDamaged = 0x8098BB14; // type:func -BossVa_ZapperDamaged = 0x8098BC1C; // type:func -BossVa_SetupZapperDeath = 0x8098BD30; // type:func -BossVa_ZapperDeath = 0x8098BE04; // type:func -BossVa_SetupZapperEnraged = 0x8098C32C; // type:func -BossVa_ZapperEnraged = 0x8098C3B4; // type:func -BossVa_SetupZapperHold = 0x8098CB0C; // type:func -BossVa_ZapperHold = 0x8098CB8C; // type:func -BossVa_SetupBariIntro = 0x8098CC98; // type:func -BossVa_BariIntro = 0x8098CDA8; // type:func -BossVa_SetupBariPhase3Attack = 0x8098D300; // type:func -BossVa_BariPhase3Attack = 0x8098D3A8; // type:func -BossVa_SetupBariPhase2Attack = 0x8098D7A8; // type:func -BossVa_BariPhase2Attack = 0x8098D850; // type:func -BossVa_SetupBariPhase3Stunned = 0x8098DE68; // type:func -BossVa_BariPhase3Stunned = 0x8098DEC4; // type:func -BossVa_SetupBariDeath = 0x8098E0E0; // type:func -BossVa_BariDeath = 0x8098E138; // type:func -BossVa_SetupDoor = 0x8098E16C; // type:func -BossVa_Door = 0x8098E1BC; // type:func -BossVa_Update = 0x8098E230; // type:func -BossVa_BodyOverrideLimbDraw = 0x8098E43C; // type:func -BossVa_BodyPostLimbDraw = 0x8098E5E0; // type:func -BossVa_SupportOverrideLimbDraw = 0x8098EAE4; // type:func -BossVa_SupportPostLimbDraw = 0x8098EB28; // type:func -BossVa_ZapperOverrideLimbDraw = 0x8098ED78; // type:func -BossVa_ZapperPostLimbDraw = 0x8098EF54; // type:func -BossVa_BariOverrideLimbDraw = 0x8098F3B4; // type:func -BossVa_BariPostLimbDraw = 0x8098F444; // type:func -BossVa_Draw = 0x8098F5D0; // type:func -BossVa_UpdateEffects = 0x8098FBC8; // type:func -BossVa_DrawEffects = 0x80990568; // type:func -BossVa_SpawnSpark = 0x80991370; // type:func -BossVa_SpawnSparkBall = 0x80991660; // type:func -BossVa_SpawnBloodDroplets = 0x809917EC; // type:func -BossVa_SpawnBloodSplatter = 0x809919B8; // type:func -BossVa_SpawnTumor = 0x80991B54; // type:func -BossVa_SpawnGore = 0x80991CF8; // type:func -BossVa_SpawnZapperCharge = 0x80991F18; // type:func -BossVa_DrawDoor = 0x8099206C; // type:func -BgHakaTubo_Init = 0x8099C9D0; // type:func -BgHakaTubo_Destroy = 0x8099CACC; // type:func -BgHakaTubo_Idle = 0x8099CB24; // type:func -BgHakaTubo_DropCollectible = 0x8099CD90; // type:func -BgHakaTubo_Update = 0x8099D054; // type:func -BgHakaTubo_DrawFlameCircle = 0x8099D088; // type:func -BgHakaTubo_Draw = 0x8099D234; // type:func -BgHakaTrap_Init = 0x8099D3F0; // type:func -BgHakaTrap_Destroy = 0x8099D690; // type:func -func_8087FFC0 = 0x8099D714; // type:func -func_808801B8 = 0x8099D914; // type:func -func_808802D8 = 0x8099DA38; // type:func -func_80880484 = 0x8099DBE4; // type:func -func_808805C0 = 0x8099DD20; // type:func -func_808806BC = 0x8099DE1C; // type:func -func_808808F4 = 0x8099E054; // type:func -func_808809B0 = 0x8099E114; // type:func -func_808809E4 = 0x8099E148; // type:func -func_80880AE8 = 0x8099E254; // type:func -func_80880C0C = 0x8099E378; // type:func -BgHakaTrap_Update = 0x8099E3EC; // type:func -func_80880D68 = 0x8099E4DC; // type:func -BgHakaTrap_Draw = 0x8099E578; // type:func -BgHakaHuta_Init = 0x8099E9C0; // type:func -BgHakaHuta_Destroy = 0x8099EA80; // type:func -BgHakaHuta_SpawnDust = 0x8099EAB4; // type:func -BgHakaHuta_PlaySfx = 0x8099EC70; // type:func -BgHakaHuta_SpawnEnemies = 0x8099ECFC; // type:func -BgHakaHuta_Open = 0x8099EFC4; // type:func -BgHakaHuta_SlideOpen = 0x8099F078; // type:func -func_8087D720 = 0x8099F12C; // type:func -BgHakaHuta_DoNothing = 0x8099F2D0; // type:func -BgHakaHuta_Update = 0x8099F2E0; // type:func -BgHakaHuta_Draw = 0x8099F304; // type:func -BgHakaZou_Init = 0x8099F460; // type:func -BgHakaZou_Destroy = 0x8099F748; // type:func -func_808828F4 = 0x8099F798; // type:func -BgHakaZou_Wait = 0x8099F914; // type:func -func_80882BDC = 0x8099FA84; // type:func -func_80882CC4 = 0x8099FB6C; // type:func -func_80882E54 = 0x8099FCFC; // type:func -func_80883000 = 0x8099FEAC; // type:func -func_80883104 = 0x8099FFB0; // type:func -func_80883144 = 0x8099FFF0; // type:func -func_80883254 = 0x809A0100; // type:func -func_80883328 = 0x809A01D8; // type:func -func_808834D8 = 0x809A0388; // type:func -BgHakaZou_DoNothing = 0x809A0418; // type:func -BgHakaZou_Update = 0x809A0428; // type:func -BgHakaZou_Draw = 0x809A046C; // type:func -BgSpot17Funen_Init = 0x809A0650; // type:func -BgSpot17Funen_Destroy = 0x809A0678; // type:func -BgSpot17Funen_Update = 0x809A0688; // type:func -func_808B746C = 0x809A06AC; // type:func -func_808B7478 = 0x809A06BC; // type:func -EnSyatekiItm_Init = 0x809A08A0; // type:func -EnSyatekiItm_Destroy = 0x809A0A04; // type:func -EnSyatekiItm_Idle = 0x809A0A14; // type:func -EnSyatekiItm_StartRound = 0x809A0B24; // type:func -EnSyatekiItm_SpawnTargets = 0x809A0CA0; // type:func -EnSyatekiItm_CheckTargets = 0x809A1120; // type:func -EnSyatekiItm_CleanupGame = 0x809A11C4; // type:func -EnSyatekiItm_EndGame = 0x809A124C; // type:func -EnSyatekiItm_Update = 0x809A1298; // type:func -EnSyatekiMan_Init = 0x809A1640; // type:func -EnSyatekiMan_Destroy = 0x809A16F4; // type:func -EnSyatekiMan_Start = 0x809A1704; // type:func -EnSyatekiMan_SetupIdle = 0x809A1798; // type:func -EnSyatekiMan_Idle = 0x809A17F0; // type:func -EnSyatekiMan_Talk = 0x809A184C; // type:func -EnSyatekiMan_StopTalk = 0x809A19F4; // type:func -EnSyatekiMan_StartGame = 0x809A1A9C; // type:func -EnSyatekiMan_WaitForGame = 0x809A1B5C; // type:func -EnSyatekiMan_EndGame = 0x809A1C78; // type:func -EnSyatekiMan_GivePrize = 0x809A1EC8; // type:func -EnSyatekiMan_FinishPrize = 0x809A1F38; // type:func -EnSyatekiMan_RestartGame = 0x809A1FFC; // type:func -EnSyatekiMan_BlinkWait = 0x809A2064; // type:func -EnSyatekiMan_Blink = 0x809A2098; // type:func -EnSyatekiMan_Update = 0x809A2138; // type:func -EnSyatekiMan_OverrideLimbDraw = 0x809A21D8; // type:func -EnSyatekiMan_Draw = 0x809A2268; // type:func -EnTana_Init = 0x809A2400; // type:func -EnTana_Destroy = 0x809A2450; // type:func -EnTana_Update = 0x809A2460; // type:func -EnTana_DrawWoodenShelves = 0x809A2470; // type:func -EnTana_DrawStoneShelves = 0x809A2508; // type:func -EnNb_GetPath = 0x809A26B0; // type:func -EnNb_GetType = 0x809A26C4; // type:func -EnNb_UpdatePath = 0x809A26D4; // type:func -EnNb_SetupCollider = 0x809A2800; // type:func -EnNb_UpdateCollider = 0x809A284C; // type:func -EnNb_Destroy = 0x809A2890; // type:func -func_80AB0FBC = 0x809A28BC; // type:func -func_80AB1040 = 0x809A2944; // type:func -func_80AB10C4 = 0x809A29CC; // type:func -EnNb_UpdateEyes = 0x809A2A70; // type:func -func_80AB1284 = 0x809A2AF8; // type:func -EnNb_UpdateSkelAnime = 0x809A2B40; // type:func -EnNb_GetCue = 0x809A2B64; // type:func -EnNb_SetStartPosRotFromCue1 = 0x809A2B8C; // type:func -func_80AB1390 = 0x809A2C0C; // type:func -func_80AB13D8 = 0x809A2C58; // type:func -EnNb_SetStartPosRotFromCue2 = 0x809A2CA4; // type:func -EnNb_SetCurrentAnim = 0x809A2D24; // type:func -EnNb_SetChamberAnim = 0x809A2DB4; // type:func -EnNb_SpawnBlueWarp = 0x809A2DFC; // type:func -EnNb_GiveMedallion = 0x809A2E58; // type:func -EnNb_ComeUpImpl = 0x809A2ED4; // type:func -EnNb_SetupChamberCsImpl = 0x809A2EF4; // type:func -EnNb_SetupChamberWarpImpl = 0x809A2F90; // type:func -EnNb_SetupDefaultChamberIdle = 0x809A2FE0; // type:func -EnNb_SetupArmRaise = 0x809A300C; // type:func -EnNb_SetupRaisedArmTransition = 0x809A30A0; // type:func -EnNb_SetupMedallion = 0x809A310C; // type:func -EnNb_SetupChamberCs = 0x809A3158; // type:func -EnNb_SetupChamberWarp = 0x809A3178; // type:func -EnNb_ComeUp = 0x809A3198; // type:func -func_80AB193C = 0x809A31D4; // type:func -EnNb_RaiseArm = 0x809A321C; // type:func -func_80AB19BC = 0x809A3260; // type:func -func_80AB19FC = 0x809A32A8; // type:func -EnNb_SetupLightArrowOrSealingCs = 0x809A32DC; // type:func -EnNb_PlaySealingSfx = 0x809A3320; // type:func -EnNb_InitializeDemo6K = 0x809A3340; // type:func -EnNb_SetupHide = 0x809A33C0; // type:func -EnNb_CheckToFade = 0x809A3414; // type:func -EnNb_SetupLightOrb = 0x809A3568; // type:func -EnNb_Hide = 0x809A3604; // type:func -EnNb_Fade = 0x809A3624; // type:func -EnNb_CreateLightOrb = 0x809A366C; // type:func -EnNb_DrawTransparency = 0x809A36B4; // type:func -EnNb_InitKidnap = 0x809A37FC; // type:func -EnNb_PlayCrySFX = 0x809A3854; // type:func -EnNb_PlayAgonySFX = 0x809A388C; // type:func -EnNb_SetPosInPortal = 0x809A38C4; // type:func -EnNb_SetupCaptureCutsceneState = 0x809A39A8; // type:func -EnNb_SetRaisedArmCaptureAnim = 0x809A39DC; // type:func -EnNb_SetupLookAroundInKidnap = 0x809A3A3C; // type:func -EnNb_SetupKidnap = 0x809A3AB0; // type:func -EnNb_CheckKidnapCsMode = 0x809A3B28; // type:func -func_80AB23A8 = 0x809A3BF0; // type:func -EnNb_MovingInPortal = 0x809A3C28; // type:func -EnNb_SuckedInByPortal = 0x809A3C84; // type:func -EnNb_SetupConfrontation = 0x809A3CE0; // type:func -EnNb_PlayKnuckleDefeatSFX = 0x809A3D24; // type:func -EnNb_PlayKneelingOnGroundSFX = 0x809A3D68; // type:func -EnNb_PlayLookRightSFX = 0x809A3DCC; // type:func -EnNb_PlayLookLeftSFX = 0x809A3E18; // type:func -EnNb_InitDemo6KInConfrontation = 0x809A3E70; // type:func -func_80AB2688 = 0x809A3EE8; // type:func -func_80AB26C8 = 0x809A3F28; // type:func -func_80AB26DC = 0x809A3F40; // type:func -EnNb_SetupKneel = 0x809A3FD8; // type:func -EnNb_CheckIfKneeling = 0x809A4054; // type:func -EnNb_SetupLookRight = 0x809A40C0; // type:func -EnNb_CheckIfLookingRight = 0x809A4140; // type:func -EnNb_SetupLookLeft = 0x809A41AC; // type:func -EnNb_CheckIfLookLeft = 0x809A422C; // type:func -EnNb_SetupDemo6KInConfrontation = 0x809A428C; // type:func -EnNb_SetupRun = 0x809A42CC; // type:func -EnNb_SetupConfrontationDestroy = 0x809A434C; // type:func -EnNb_CheckConfrontationCsMode = 0x809A4364; // type:func -EnNb_CheckConfrontationCsModeWrapper = 0x809A444C; // type:func -func_80AB2C18 = 0x809A446C; // type:func -EnNb_Kneel = 0x809A44B8; // type:func -EnNb_LookRight = 0x809A4528; // type:func -EnNb_LookLeft = 0x809A4598; // type:func -EnNb_Run = 0x809A4600; // type:func -EnNb_ConfrontationDestroy = 0x809A4688; // type:func -func_80AB2E70 = 0x809A46DC; // type:func -func_80AB2FC0 = 0x809A47F8; // type:func -func_80AB2FE4 = 0x809A4820; // type:func -EnNb_SetupCreditsSpawn = 0x809A495C; // type:func -EnNb_SetAlphaInCredits = 0x809A49A4; // type:func -EnNb_SetupCreditsFadeIn = 0x809A4A30; // type:func -EnNb_SetupCreditsSit = 0x809A4A68; // type:func -EnNb_SetupCreditsHeadTurn = 0x809A4AB4; // type:func -EnNb_CheckIfLookingUp = 0x809A4AF4; // type:func -EnNb_CheckCreditsCsModeImpl = 0x809A4B28; // type:func -EnNb_CheckCreditsCsMode = 0x809A4BB4; // type:func -EnNb_CreditsFade = 0x809A4BD4; // type:func -func_80AB3428 = 0x809A4C20; // type:func -EnNb_LookUp = 0x809A4C68; // type:func -EnNb_CrawlspaceSpawnCheck = 0x809A4CAC; // type:func -func_80AB359C = 0x809A4DA8; // type:func -EnNb_SetNoticeSFX = 0x809A4E6C; // type:func -EnNb_GetNoticedStatus = 0x809A4E94; // type:func -func_80AB36DC = 0x809A4EEC; // type:func -EnNb_CheckNoticed = 0x809A4F9C; // type:func -EnNb_SetupIdleCrawlspace = 0x809A4FF4; // type:func -func_80AB3838 = 0x809A504C; // type:func -EnNb_SetupPathMovement = 0x809A50C8; // type:func -EnNb_SetTextIdAsChild = 0x809A5130; // type:func -func_80AB3A7C = 0x809A529C; // type:func -func_80AB3B04 = 0x809A5328; // type:func -func_80AB3B7C = 0x809A53B0; // type:func -EnNb_WaitForNotice = 0x809A53FC; // type:func -EnNb_StandUpAfterNotice = 0x809A5458; // type:func -EnNb_BlockCrawlspace = 0x809A54B8; // type:func -EnNb_InitCrawlspaceDialogue = 0x809A5520; // type:func -EnNb_FollowPath = 0x809A5588; // type:func -func_80AB3DB0 = 0x809A5608; // type:func -func_80AB3E10 = 0x809A5670; // type:func -EnNb_Update = 0x809A56D8; // type:func -EnNb_Init = 0x809A5720; // type:func -EnNb_OverrideLimbDraw = 0x809A583C; // type:func -EnNb_PostLimbDraw = 0x809A58CC; // type:func -EnNb_DrawNothing = 0x809A5958; // type:func -EnNb_DrawDefault = 0x809A5968; // type:func -EnNb_Draw = 0x809A5AAC; // type:func -BossMo_InitRand = 0x809A6C80; // type:func -BossMo_RandZeroOne = 0x809A6CA0; // type:func -BossMo_NearLand = 0x809A6DC8; // type:func -BossMo_SpawnRipple = 0x809A6EC0; // type:func -BossMo_SpawnDroplet = 0x809A6FE0; // type:func -BossMo_SpawnStillDroplet = 0x809A70BC; // type:func -BossMo_SpawnBubble = 0x809A7180; // type:func -BossMo_Init = 0x809A7234; // type:func -BossMo_Destroy = 0x809A761C; // type:func -BossMo_SetupTentacle = 0x809A766C; // type:func -BossMo_Tentacle = 0x809A76C0; // type:func -BossMo_TentCollisionCheck = 0x809AA480; // type:func -BossMo_IntroCs = 0x809AA72C; // type:func -BossMo_DeathCs = 0x809AB844; // type:func -BossMo_CoreCollisionCheck = 0x809AC400; // type:func -BossMo_Core = 0x809AC808; // type:func -BossMo_UpdateCore = 0x809ADE6C; // type:func -BossMo_UpdateTent = 0x809AE09C; // type:func -BossMo_UpdateTentColliders = 0x809AE8D4; // type:func -BossMo_DrawTentacle = 0x809AE980; // type:func -BossMo_DrawWater = 0x809AF0B0; // type:func -BossMo_DrawCore = 0x809AF2C0; // type:func -BossMo_DrawTent = 0x809AFB48; // type:func -BossMo_UpdateEffects = 0x809AFD7C; // type:func -BossMo_DrawEffects = 0x809B048C; // type:func -BossMo_SfxTest = 0x809B0BB8; // type:func -EnSb_Init = 0x809B7260; // type:func -EnSb_Destroy = 0x809B7348; // type:func -EnSb_SpawnBubbles = 0x809B7388; // type:func -EnSb_SetupWaitClosed = 0x809B7438; // type:func -EnSb_SetupOpen = 0x809B74B0; // type:func -EnSb_SetupWaitOpen = 0x809B752C; // type:func -EnSb_SetupLunge = 0x809B75A0; // type:func -EnSb_SetupBounce = 0x809B7648; // type:func -EnSb_SetupCooldown = 0x809B76C0; // type:func -EnSb_WaitClosed = 0x809B77C4; // type:func -EnSb_Open = 0x809B7844; // type:func -EnSb_WaitOpen = 0x809B790C; // type:func -EnSb_TurnAround = 0x809B79C0; // type:func -EnSb_Lunge = 0x809B7AAC; // type:func -EnSb_Bounce = 0x809B7B54; // type:func -EnSb_Cooldown = 0x809B7C88; // type:func -EnSb_IsVulnerable = 0x809B7CF0; // type:func -EnSb_UpdateDamage = 0x809B7E38; // type:func -EnSb_Update = 0x809B8114; // type:func -EnSb_PostLimbDraw = 0x809B8294; // type:func -EnSb_Draw = 0x809B82E4; // type:func -EnBigokuta_Init = 0x809B86A0; // type:func -EnBigokuta_Destroy = 0x809B880C; // type:func -func_809BCE3C = 0x809B8880; // type:func -func_809BCEBC = 0x809B88FC; // type:func -func_809BCF68 = 0x809B89AC; // type:func -func_809BD1C8 = 0x809B8C14; // type:func -func_809BD2E4 = 0x809B8D30; // type:func -func_809BD318 = 0x809B8D64; // type:func -func_809BD370 = 0x809B8DBC; // type:func -func_809BD3AC = 0x809B8DF8; // type:func -func_809BD3E0 = 0x809B8E30; // type:func -func_809BD3F8 = 0x809B8E4C; // type:func -func_809BD47C = 0x809B8ED0; // type:func -func_809BD4A4 = 0x809B8EFC; // type:func -func_809BD524 = 0x809B8F7C; // type:func -func_809BD5E0 = 0x809B9038; // type:func -func_809BD658 = 0x809B90B0; // type:func -func_809BD6B8 = 0x809B9110; // type:func -func_809BD768 = 0x809B91C0; // type:func -func_809BD7F0 = 0x809B9248; // type:func -func_809BD84C = 0x809B92A8; // type:func -func_809BD8DC = 0x809B9338; // type:func -func_809BDAE8 = 0x809B9544; // type:func -func_809BDB90 = 0x809B95EC; // type:func -func_809BDC08 = 0x809B9664; // type:func -func_809BDF34 = 0x809B9994; // type:func -func_809BDFC8 = 0x809B9A28; // type:func -func_809BE058 = 0x809B9AB8; // type:func -func_809BE180 = 0x809B9BE0; // type:func -func_809BE26C = 0x809B9CCC; // type:func -func_809BE3E4 = 0x809B9E44; // type:func -func_809BE4A4 = 0x809B9F04; // type:func -func_809BE518 = 0x809B9F78; // type:func -func_809BE568 = 0x809B9FC8; // type:func -func_809BE798 = 0x809BA1F8; // type:func -EnBigokuta_UpdateDamage = 0x809BA33C; // type:func -EnBigokuta_Update = 0x809BA42C; // type:func -EnBigokuta_OverrideLimbDraw = 0x809BA624; // type:func -EnBigokuta_Draw = 0x809BAA9C; // type:func -EnKarebaba_Init = 0x809BB1A0; // type:func -EnKarebaba_Destroy = 0x809BB2D4; // type:func -EnKarebaba_ResetCollider = 0x809BB314; // type:func -EnKarebaba_SetupGrow = 0x809BB350; // type:func -EnKarebaba_SetupIdle = 0x809BB3A0; // type:func -EnKarebaba_SetupAwaken = 0x809BB3F4; // type:func -EnKarebaba_SetupUpright = 0x809BB470; // type:func -EnKarebaba_SetupSpin = 0x809BB510; // type:func -EnKarebaba_SetupDying = 0x809BB52C; // type:func -EnKarebaba_SetupDeadItemDrop = 0x809BB5A0; // type:func -EnKarebaba_SetupRetract = 0x809BB640; // type:func -EnKarebaba_SetupDead = 0x809BB6C0; // type:func -EnKarebaba_SetupRegrow = 0x809BB74C; // type:func -EnKarebaba_Grow = 0x809BB7A0; // type:func -EnKarebaba_Idle = 0x809BB838; // type:func -EnKarebaba_Awaken = 0x809BB898; // type:func -EnKarebaba_Upright = 0x809BB96C; // type:func -EnKarebaba_Spin = 0x809BBA60; // type:func -EnKarebaba_Dying = 0x809BBBF4; // type:func -EnKarebaba_DeadItemDrop = 0x809BBEAC; // type:func -EnKarebaba_Retract = 0x809BBF14; // type:func -EnKarebaba_Dead = 0x809BBFE8; // type:func -EnKarebaba_Regrow = 0x809BC040; // type:func -EnKarebaba_Update = 0x809BC10C; // type:func -EnKarebaba_DrawBaseShadow = 0x809BC2C0; // type:func -EnKarebaba_Draw = 0x809BC3AC; // type:func -BgBdanObjects_GetProperty = 0x809BCA90; // type:func -BgBdanObjects_SetProperty = 0x809BCAE4; // type:func -BgBdanObjects_Init = 0x809BCB38; // type:func -BgBdanObjects_Destroy = 0x809BCDBC; // type:func -BgBdanObjects_OctoPlatform_WaitForRutoToStartCutscene = 0x809BCE0C; // type:func -BgBdanObjects_OctoPlatform_RaiseToUpperPosition = 0x809BCF60; // type:func -BgBdanObjects_OctoPlatform_WaitForRutoToAdvanceCutscene = 0x809BD05C; // type:func -BgBdanObjects_OctoPlatform_DescendWithBigOcto = 0x809BD198; // type:func -BgBdanObjects_OctoPlatform_PauseBeforeDescending = 0x809BD31C; // type:func -BgBdanObjects_OctoPlatform_WaitForBigOctoToStartBattle = 0x809BD380; // type:func -BgBdanObjects_OctoPlatform_BattleInProgress = 0x809BD3DC; // type:func -BgBdanObjects_SinkToFloorHeight = 0x809BD4B4; // type:func -BgBdanObjects_WaitForPlayerInRange = 0x809BD534; // type:func -BgBdanObjects_RaiseToUpperPosition = 0x809BD5A0; // type:func -BgBdanObjects_DoNothing = 0x809BD638; // type:func -BgBdanObjects_ElevatorOscillate = 0x809BD648; // type:func -BgBdanObjects_WaitForSwitch = 0x809BD77C; // type:func -BgBdanObjects_ChangeWaterBoxLevel = 0x809BD7C8; // type:func -BgBdanObjects_WaitForTimerExpired = 0x809BD890; // type:func -BgBdanObjects_WaitForPlayerOnTop = 0x809BD8E4; // type:func -BgBdanObjects_FallToLowerPos = 0x809BD968; // type:func -BgBdanObjects_Update = 0x809BDA24; // type:func -BgBdanObjects_Draw = 0x809BDA60; // type:func -DemoSa_Destroy = 0x809BDD60; // type:func -func_8098E480 = 0x809BDD84; // type:func -DemoSa_SetEyeIndex = 0x809BDE0C; // type:func -DemoSa_SetMouthIndex = 0x809BDE24; // type:func -func_8098E5C8 = 0x809BDE3C; // type:func -DemoSa_UpdateSkelAnime = 0x809BDE84; // type:func -DemoSa_GetCue = 0x809BDEA8; // type:func -func_8098E654 = 0x809BDED0; // type:func -func_8098E6A0 = 0x809BDF1C; // type:func -func_8098E6EC = 0x809BDF68; // type:func -func_8098E76C = 0x809BDFE8; // type:func -func_8098E7FC = 0x809BE078; // type:func -func_8098E86C = 0x809BE0E8; // type:func -func_8098E8C8 = 0x809BE144; // type:func -func_8098E944 = 0x809BE1C0; // type:func -func_8098E960 = 0x809BE1E0; // type:func -func_8098E9EC = 0x809BE278; // type:func -func_8098EA3C = 0x809BE2C8; // type:func -func_8098EA68 = 0x809BE2F4; // type:func -func_8098EB00 = 0x809BE38C; // type:func -func_8098EB6C = 0x809BE3F8; // type:func -func_8098EBB8 = 0x809BE444; // type:func -func_8098EBD8 = 0x809BE464; // type:func -func_8098EBF8 = 0x809BE484; // type:func -func_8098EC28 = 0x809BE4B8; // type:func -func_8098EC60 = 0x809BE4F8; // type:func -func_8098EC94 = 0x809BE530; // type:func -func_8098ECCC = 0x809BE570; // type:func -func_8098ECF4 = 0x809BE59C; // type:func -func_8098EDB0 = 0x809BE658; // type:func -func_8098EE08 = 0x809BE6B0; // type:func -func_8098EE28 = 0x809BE6D0; // type:func -func_8098EEA8 = 0x809BE750; // type:func -func_8098EEFC = 0x809BE7A4; // type:func -func_8098F050 = 0x809BE8F8; // type:func -func_8098F0E8 = 0x809BE994; // type:func -func_8098F118 = 0x809BE9B4; // type:func -func_8098F16C = 0x809BE9FC; // type:func -DemoSa_DrawXlu = 0x809BEA44; // type:func -func_8098F390 = 0x809BEBE4; // type:func -func_8098F3F0 = 0x809BEC44; // type:func -func_8098F420 = 0x809BEC78; // type:func -func_8098F480 = 0x809BECD4; // type:func -func_8098F50C = 0x809BED60; // type:func -func_8098F544 = 0x809BED98; // type:func -func_8098F590 = 0x809BEDE4; // type:func -func_8098F5D0 = 0x809BEE24; // type:func -func_8098F610 = 0x809BEE64; // type:func -func_8098F654 = 0x809BEEAC; // type:func -func_8098F714 = 0x809BEF58; // type:func -func_8098F734 = 0x809BEF78; // type:func -func_8098F77C = 0x809BEFC4; // type:func -func_8098F7BC = 0x809BF00C; // type:func -func_8098F7FC = 0x809BF054; // type:func -func_8098F83C = 0x809BF098; // type:func -func_8098F8F8 = 0x809BF154; // type:func -func_8098F984 = 0x809BF1E0; // type:func -func_8098F998 = 0x809BF1F8; // type:func -func_8098FA2C = 0x809BF28C; // type:func -func_8098FA84 = 0x809BF2E4; // type:func -func_8098FAE0 = 0x809BF340; // type:func -func_8098FB34 = 0x809BF394; // type:func -func_8098FB68 = 0x809BF3C8; // type:func -func_8098FC44 = 0x809BF490; // type:func -func_8098FC64 = 0x809BF4B0; // type:func -func_8098FC9C = 0x809BF4EC; // type:func -func_8098FCD4 = 0x809BF52C; // type:func -func_8098FD0C = 0x809BF56C; // type:func -DemoSa_Update = 0x809BF5B8; // type:func -DemoSa_Init = 0x809BF600; // type:func -DemoSa_OverrideLimbDraw = 0x809BF6C8; // type:func -DemoSa_DrawNothing = 0x809BF700; // type:func -DemoSa_DrawOpa = 0x809BF710; // type:func -DemoSa_Draw = 0x809BF8A4; // type:func -DemoGo_GetCueChannel = 0x809C0880; // type:func -func_8097C8A8 = 0x809C08BC; // type:func -DemoGo_Destroy = 0x809C0928; // type:func -func_8097C930 = 0x809C094C; // type:func -func_8097C9B8 = 0x809C09D4; // type:func -func_8097C9DC = 0x809C09FC; // type:func -func_8097CA30 = 0x809C0A54; // type:func -func_8097CA78 = 0x809C0A9C; // type:func -func_8097CB0C = 0x809C0B34; // type:func -func_8097CC08 = 0x809C0C34; // type:func -func_8097CCC0 = 0x809C0CEC; // type:func -func_8097CCE0 = 0x809C0D0C; // type:func -DemoGo_UpdateSkelAnime = 0x809C0DC4; // type:func -func_8097CDB0 = 0x809C0DE8; // type:func -func_8097CE10 = 0x809C0E54; // type:func -func_8097CE20 = 0x809C0E68; // type:func -func_8097CE78 = 0x809C0EC4; // type:func -func_8097CEEC = 0x809C0F3C; // type:func -func_8097CF20 = 0x809C0F74; // type:func -func_8097CF9C = 0x809C0FF0; // type:func -func_8097CFDC = 0x809C1030; // type:func -func_8097CFFC = 0x809C1050; // type:func -func_8097D01C = 0x809C1070; // type:func -func_8097D058 = 0x809C10B4; // type:func -func_8097D088 = 0x809C10EC; // type:func -func_8097D0D0 = 0x809C113C; // type:func -func_8097D130 = 0x809C11A4; // type:func -DemoGo_Update = 0x809C1204; // type:func -DemoGo_Init = 0x809C124C; // type:func -func_8097D290 = 0x809C12F8; // type:func -func_8097D29C = 0x809C1308; // type:func -DemoGo_Draw = 0x809C1418; // type:func -EnIn_GetTextIdChild = 0x809C15D0; // type:func -EnIn_GetTextIdAdult = 0x809C1630; // type:func -EnIn_GetTextId = 0x809C1788; // type:func -EnIn_UpdateTalkStateOnClosing = 0x809C17EC; // type:func -EnIn_UpdateTalkStateOnChoice = 0x809C1860; // type:func -EnIn_UpdateTalkStateOnEvent = 0x809C1AB0; // type:func -EnIn_UpdateTalkState = 0x809C1B1C; // type:func -func_80A795C8 = 0x809C1BE4; // type:func -func_80A79690 = 0x809C1CAC; // type:func -EnIn_ChangeAnim = 0x809C1D08; // type:func -func_80A7975C = 0x809C1D78; // type:func -EnIn_GetStartMode = 0x809C1E4C; // type:func -EnIn_UpdateEyes = 0x809C2048; // type:func -func_80A79AB4 = 0x809C20D0; // type:func -func_80A79BAC = 0x809C21C8; // type:func -func_80A79C78 = 0x809C2294; // type:func -EnIn_Init = 0x809C2488; // type:func -EnIn_Destroy = 0x809C2594; // type:func -EnIn_WaitForObject = 0x809C25D8; // type:func -func_80A7A304 = 0x809C2930; // type:func -func_80A7A4BC = 0x809C2AE8; // type:func -func_80A7A4C8 = 0x809C2AF8; // type:func -func_80A7A568 = 0x809C2B9C; // type:func -func_80A7A770 = 0x809C2DA4; // type:func -func_80A7A848 = 0x809C2E7C; // type:func -func_80A7A940 = 0x809C2F74; // type:func -func_80A7AA40 = 0x809C3074; // type:func -func_80A7ABD4 = 0x809C3208; // type:func -func_80A7AE84 = 0x809C34BC; // type:func -func_80A7AEF0 = 0x809C3528; // type:func -func_80A7B018 = 0x809C3654; // type:func -func_80A7B024 = 0x809C3664; // type:func -EnIn_Update = 0x809C3750; // type:func -EnIn_OverrideLimbDraw = 0x809C3964; // type:func -EnIn_PostLimbDraw = 0x809C3BB8; // type:func -EnIn_Draw = 0x809C3CC8; // type:func -EnTr_SetupAction = 0x809C4370; // type:func -EnTr_Init = 0x809C437C; // type:func -EnTr_Destroy = 0x809C44CC; // type:func -EnTr_CrySpellcast = 0x809C44DC; // type:func -EnTr_DoNothing = 0x809C458C; // type:func -EnTr_ChooseAction2 = 0x809C459C; // type:func -EnTr_FlyKidnapCutscene = 0x809C474C; // type:func -func_80B23254 = 0x809C48C8; // type:func -EnTr_ShrinkVanish = 0x809C4B48; // type:func -EnTr_Reappear = 0x809C4D04; // type:func -EnTr_WaitToReappear = 0x809C4E9C; // type:func -EnTr_TakeOff = 0x809C4F5C; // type:func -EnTr_TurnLookOverShoulder = 0x809C5024; // type:func -EnTr_ChooseAction1 = 0x809C5104; // type:func -EnTr_Update = 0x809C5238; // type:func -EnTr_OverrideLimbDraw = 0x809C53F0; // type:func -EnTr_Draw = 0x809C5520; // type:func -func_80B23FDC = 0x809C562C; // type:func -func_80B24038 = 0x809C568C; // type:func -EnTr_SetRotFromCue = 0x809C5888; // type:func -EnTr_SetStartPosRotFromCue = 0x809C5910; // type:func -func_808B4C30 = 0x809C5C70; // type:func -func_808B4C4C = 0x809C5C90; // type:func -func_808B4D04 = 0x809C5D44; // type:func -func_808B4D9C = 0x809C5DD8; // type:func -func_808B4E58 = 0x809C5E88; // type:func -BgSpot16Bombstone_Init = 0x809C6084; // type:func -BgSpot16Bombstone_Destroy = 0x809C6138; // type:func -BgSpot16Bombstone_SpawnDust = 0x809C6184; // type:func -func_808B5240 = 0x809C6220; // type:func -BgSpot16Bombstone_SpawnFragments = 0x809C6388; // type:func -func_808B561C = 0x809C6600; // type:func -func_808B56BC = 0x809C66A0; // type:func -func_808B57E0 = 0x809C679C; // type:func -func_808B5934 = 0x809C68F4; // type:func -func_808B5950 = 0x809C6914; // type:func -func_808B5A78 = 0x809C6A00; // type:func -func_808B5A94 = 0x809C6A20; // type:func -func_808B5AF0 = 0x809C6A84; // type:func -func_808B5B04 = 0x809C6A9C; // type:func -func_808B5B58 = 0x809C6AF4; // type:func -func_808B5B6C = 0x809C6B0C; // type:func -BgSpot16Bombstone_Update = 0x809C6C08; // type:func -BgSpot16Bombstone_Draw = 0x809C6C3C; // type:func -BgHidanKowarerukabe_InitDynaPoly = 0x809C71C0; // type:func -BgHidanKowarerukabe_InitColliderSphere = 0x809C725C; // type:func -BgHidanKowarerukabe_OffsetActorYPos = 0x809C72F0; // type:func -BgHidanKowarerukabe_Init = 0x809C731C; // type:func -BgHidanKowarerukabe_Destroy = 0x809C73CC; // type:func -BgHidanKowarerukabe_SpawnDust = 0x809C7414; // type:func -BgHidanKowarerukabe_FloorBreak = 0x809C7538; // type:func -func_8088A67C = 0x809C7804; // type:func -BgHidanKowarerukabe_LargeWallBreak = 0x809C7A9C; // type:func -BgHidanKowarerukabe_Break = 0x809C7D28; // type:func -BgHidanKowarerukabe_Update = 0x809C7DB8; // type:func -BgHidanKowarerukabe_Draw = 0x809C7E88; // type:func -BgBombwall_InitDynapoly = 0x809C80A0; // type:func -BgBombwall_RotateVec = 0x809C80F8; // type:func -BgBombwall_Init = 0x809C814C; // type:func -BgBombwall_DestroyCollision = 0x809C835C; // type:func -BgBombwall_Destroy = 0x809C83D8; // type:func -func_8086EB5C = 0x809C83F8; // type:func -func_8086ED50 = 0x809C85EC; // type:func -func_8086ED70 = 0x809C8610; // type:func -func_8086EDFC = 0x809C86A0; // type:func -func_8086EE40 = 0x809C86E4; // type:func -func_8086EE94 = 0x809C8738; // type:func -BgBombwall_Update = 0x809C8768; // type:func -BgBombwall_Draw = 0x809C8794; // type:func -EnRu2_InitCollider = 0x809C8960; // type:func -EnRu2_UpdateCollider = 0x809C89AC; // type:func -EnRu2_Destroy = 0x809C89F0; // type:func -EnRu2_UpdateEyes = 0x809C8A1C; // type:func -EnRu2_GetSwitchFlag = 0x809C8AA4; // type:func -EnRu2_GetType = 0x809C8AB8; // type:func -EnRu2_UpdateBgCheckInfo = 0x809C8AC8; // type:func -EnRu2_UpdateSkelAnime = 0x809C8B10; // type:func -EnRu2_GetCue = 0x809C8B34; // type:func -EnRu2_CheckCueMatchingId = 0x809C8B5C; // type:func -EnRu2_CheckCueNotMatchingId = 0x809C8BA8; // type:func -EnRu2_InitPositionFromCue = 0x809C8BF4; // type:func -EnRu2_AnimationChange = 0x809C8C74; // type:func -EnRu2_Rise = 0x809C8D04; // type:func -EnRu2_InitChamberOfSages = 0x809C8D24; // type:func -EnRu2_SpawnBlueWarp = 0x809C8D6C; // type:func -EnRu2_SpawnWaterMedallion = 0x809C8DC8; // type:func -EnRu2_CheckWaterMedallionCutscene = 0x809C8E44; // type:func -EnRu2_CheckIfBlueWarpShouldSpawn = 0x809C8EE0; // type:func -EnRu2_EndRise = 0x809C8F30; // type:func -EnRu2_CheckStartRaisingArms = 0x809C8F5C; // type:func -EnRu2_HoldArmsUp = 0x809C8FF0; // type:func -EnRu2_CheckIfWaterMedallionShouldSpawn = 0x809C9004; // type:func -EnRu2_SetupWaterMedallionCutscene = 0x809C9050; // type:func -EnRu2_AwaitBlueWarp = 0x809C9070; // type:func -EnRu2_RiseThroughBlueWarp = 0x809C9090; // type:func -EnRu2_SageOfWaterDialog = 0x809C90CC; // type:func -EnRu2_RaiseArms = 0x809C9114; // type:func -EnRu2_AwaitWaterMedallion = 0x809C9158; // type:func -EnRu2_FinishWaterMedallionCutscene = 0x809C91A0; // type:func -EnRu2_InitWaterTrial = 0x809C91D4; // type:func -EnRu2_PlayWhiteOutSound = 0x809C9218; // type:func -EnRu2_SpawnLightBall = 0x809C9238; // type:func -EnRu2_CheckFadeIn = 0x809C92B8; // type:func -EnRu2_Fade = 0x809C930C; // type:func -EnRu2_CheckFadeOut = 0x809C9460; // type:func -EnRu2_WaterTrialInvisible = 0x809C94FC; // type:func -EnRu2_WaterTrialFade = 0x809C951C; // type:func -EnRu2_AwaitSpawnLightBall = 0x809C9564; // type:func -EnRu2_DrawXlu = 0x809C95AC; // type:func -EnRu2_InitCredits = 0x809C96F4; // type:func -EnRu2_FadeInCredits = 0x809C973C; // type:func -EnRu2_InitCreditsPosition = 0x809C97C8; // type:func -EnRu2_CheckVisibleInCredits = 0x809C9800; // type:func -EnRu2_SetupTurnHeadDownLeftAnimation = 0x809C984C; // type:func -EnRu2_HoldLookingDownLeftPose = 0x809C988C; // type:func -EnRu2_NextCreditsAction = 0x809C98C0; // type:func -EnRu2_CreditsInvisible = 0x809C994C; // type:func -EnRu2_CreditsFadeIn = 0x809C996C; // type:func -EnRu2_CreditsVisible = 0x809C99B8; // type:func -EnRu2_CreditsTurnHeadDownLeft = 0x809C9A00; // type:func -EnRu2_SetEncounterSwitchFlag = 0x809C9A44; // type:func -EnRu2_GetEncounterSwitchFlag = 0x809C9A74; // type:func -EnRu2_InitWaterTempleEncounter = 0x809C9AA4; // type:func -EnRu2_PlayFanfare = 0x809C9B0C; // type:func -EnRu2_SwimUpProgress = 0x809C9B2C; // type:func -EnRu2_IsPlayerInRangeForEncounter = 0x809C9B98; // type:func -EnRu2_CheckRangeToStartEncounter = 0x809C9BD4; // type:func -EnRu2_StartEncounter = 0x809C9C34; // type:func -EnRu2_EncounterBeginningHandler = 0x809C9C70; // type:func -EnRu2_DialogCameraHandler = 0x809C9D40; // type:func -EnRu2_StartSwimmingUp = 0x809C9E2C; // type:func -EnRu2_EndSwimmingUp = 0x809C9EC4; // type:func -EnRu2_WaterTempleEncounterRangeCheck = 0x809C9F18; // type:func -EnRu2_WaterTempleEncounterUnconditional = 0x809C9F5C; // type:func -EnRu2_WaterTempleEncounterBegin = 0x809C9FC4; // type:func -EnRu2_WaterTempleEncounterDialog = 0x809CA020; // type:func -EnRu2_WaterTempleEncounterEnd = 0x809CA07C; // type:func -EnRu2_WaterTempleSwimmingUp = 0x809CA0D8; // type:func -EnRu2_Update = 0x809CA13C; // type:func -EnRu2_Init = 0x809CA184; // type:func -EnRu2_DrawNothing = 0x809CA27C; // type:func -EnRu2_DrawOpa = 0x809CA28C; // type:func -EnRu2_Draw = 0x809CA3C0; // type:func -ObjDekujr_Init = 0x809CB6E0; // type:func -ObjDekujr_Destroy = 0x809CB7EC; // type:func -ObjDekujr_GetCueStartPos = 0x809CB7FC; // type:func -ObjDekujr_GetCueEndPos = 0x809CB840; // type:func -ObjDekujr_ComeUp = 0x809CB884; // type:func -ObjDekujr_Update = 0x809CBA34; // type:func -ObjDekujr_Draw = 0x809CBB24; // type:func -BgMizuUzu_Init = 0x809CBD20; // type:func -BgMizuUzu_Destroy = 0x809CBD9C; // type:func -func_8089F788 = 0x809CBDD0; // type:func -BgMizuUzu_Update = 0x809CBE48; // type:func -BgMizuUzu_Draw = 0x809CBE6C; // type:func -BgSpot06Objects_Init = 0x809CBEF0; // type:func -BgSpot06Objects_Destroy = 0x809CC2BC; // type:func -BgSpot06Objects_GateSpawnBubbles = 0x809CC324; // type:func -BgSpot06Objects_GateWaitForSwitch = 0x809CC41C; // type:func -BgSpot06Objects_GateWaitToOpen = 0x809CC4B0; // type:func -BgSpot06Objects_GateOpen = 0x809CC4E4; // type:func -BgSpot06Objects_DoNothing = 0x809CC570; // type:func -BgSpot06Objects_LockSpawnWaterRipples = 0x809CC580; // type:func -BgSpot06Objects_LockSpawnBubbles = 0x809CC5E4; // type:func -BgSpot06Objects_LockWait = 0x809CC678; // type:func -BgSpot06Objects_LockPullOutward = 0x809CC89C; // type:func -BgSpot06Objects_LockSwimToSurface = 0x809CC954; // type:func -BgSpot06Objects_LockFloat = 0x809CCBCC; // type:func -BgSpot06Objects_Update = 0x809CCC4C; // type:func -BgSpot06Objects_DrawLakeHyliaWater = 0x809CCCAC; // type:func -BgSpot06Objects_Draw = 0x809CCE94; // type:func -BgSpot06Objects_WaterPlaneCutsceneWait = 0x809CCF58; // type:func -BgSpot06Objects_WaterPlaneCutsceneRise = 0x809CCF84; // type:func -BgIceObjects_Init = 0x809CD2F0; // type:func -BgIceObjects_Destroy = 0x809CD37C; // type:func -BgIceObjects_SetNextTarget = 0x809CD3B0; // type:func -BgIceObjects_CheckPits = 0x809CD830; // type:func -BgIceObjects_Idle = 0x809CD9B8; // type:func -BgIceObjects_Slide = 0x809CDABC; // type:func -BgIceObjects_Reset = 0x809CDE4C; // type:func -BgIceObjects_Stuck = 0x809CDEE8; // type:func -BgIceObjects_Update = 0x809CDF24; // type:func -BgIceObjects_Draw = 0x809CDF48; // type:func -BgHakaWater_Init = 0x809CE230; // type:func -BgHakaWater_Destroy = 0x809CE2BC; // type:func -BgHakaWater_LowerWater = 0x809CE2CC; // type:func -BgHakaWater_Wait = 0x809CE414; // type:func -BgHakaWater_ChangeWaterLevel = 0x809CE4D0; // type:func -BgHakaWater_Update = 0x809CE5D8; // type:func -BgHakaWater_Draw = 0x809CE5FC; // type:func -EnMa2_GetTextId = 0x809CEA30; // type:func -EnMa2_UpdateTalkState = 0x809CEAC8; // type:func -func_80AA1AE4 = 0x809CEB78; // type:func -func_80AA1B58 = 0x809CEBEC; // type:func -func_80AA1C68 = 0x809CECFC; // type:func -EnMa2_UpdateEyes = 0x809CED54; // type:func -EnMa2_ChangeAnim = 0x809CEDE0; // type:func -func_80AA1DB4 = 0x809CEE50; // type:func -EnMa2_Init = 0x809CEEDC; // type:func -EnMa2_Destroy = 0x809CF080; // type:func -func_80AA2018 = 0x809CF0C0; // type:func -func_80AA204C = 0x809CF0F4; // type:func -func_80AA20E4 = 0x809CF190; // type:func -func_80AA21C8 = 0x809CF27C; // type:func -EnMa2_Update = 0x809CF31C; // type:func -EnMa2_OverrideLimbDraw = 0x809CF40C; // type:func -EnMa2_PostLimbDraw = 0x809CF64C; // type:func -EnMa2_Draw = 0x809CF700; // type:func -EnBomChu_Init = 0x809CFA90; // type:func -EnBomChu_Destroy = 0x809CFC30; // type:func -EnBomChu_Explode = 0x809CFC80; // type:func -EnBomChu_CrossProduct = 0x809CFDA0; // type:func -EnBomChu_UpdateFloorPoly = 0x809CFE14; // type:func -EnBomChu_WaitForRelease = 0x809D0048; // type:func -EnBomChu_Move = 0x809D01B8; // type:func -EnBomChu_WaitForKill = 0x809D06D0; // type:func -EnBomChu_ModelToWorld = 0x809D0710; // type:func -EnBomChu_SpawnRipples = 0x809D07C0; // type:func -EnBomChu_Update = 0x809D084C; // type:func -EnBomChu_Draw = 0x809D0C10; // type:func -EnHorseGameCheck_InitIngoRace = 0x809D1130; // type:func -EnHorseGameCheck_DestroyIngoRace = 0x809D11EC; // type:func -EnHorseGameCheck_FinishIngoRace = 0x809D1200; // type:func -EnHorseGameCheck_UpdateIngoRace = 0x809D134C; // type:func -EnHorseGameCheck_InitGerudoArchery = 0x809D17C4; // type:func -EnHorseGameCheck_DestroyGerudoArchery = 0x809D17E4; // type:func -EnHorseGameCheck_UpdateGerudoArchery = 0x809D17F8; // type:func -EnHorseGameCheck_InitType3 = 0x809D1840; // type:func -EnHorseGameCheck_DestroyType3 = 0x809D185C; // type:func -EnHorseGameCheck_UpdateType3 = 0x809D1870; // type:func -EnHorseGameCheck_InitMalonRace = 0x809D1884; // type:func -EnHorseGameCheck_DestroyMalonRace = 0x809D18D4; // type:func -EnHorseGameCheck_FinishMalonRace = 0x809D18E8; // type:func -EnHorseGameCheck_UpdateMalonRace = 0x809D19DC; // type:func -EnHorseGameCheck_Init = 0x809D1EF4; // type:func -EnHorseGameCheck_Destroy = 0x809D1F78; // type:func -EnHorseGameCheck_Update = 0x809D1FB4; // type:func -EnHorseGameCheck_Draw = 0x809D1FF0; // type:func -BossTw_AddDotEffect = 0x809D2200; // type:func -BossTw_AddDmgCloud = 0x809D22F4; // type:func -BossTw_AddRingEffect = 0x809D23F0; // type:func -BossTw_AddPlayerFreezeEffect = 0x809D24F4; // type:func -BossTw_AddFlameEffect = 0x809D25A0; // type:func -BossTw_AddMergeFlameEffect = 0x809D2678; // type:func -BossTw_AddShieldBlastEffect = 0x809D2780; // type:func -BossTw_AddShieldDeflectEffect = 0x809D2868; // type:func -BossTw_AddShieldHitEffect = 0x809D2A30; // type:func -BossTw_Init = 0x809D2BF8; // type:func -BossTw_Destroy = 0x809D3414; // type:func -BossTw_SetupTurnToPlayer = 0x809D347C; // type:func -BossTw_TurnToPlayer = 0x809D34CC; // type:func -BossTw_SetupFlyTo = 0x809D35EC; // type:func -BossTw_FlyTo = 0x809D37F0; // type:func -BossTw_SetupShootBeam = 0x809D3A24; // type:func -BossTw_SpawnGroundBlast = 0x809D3B0C; // type:func -BossTw_BeamHitPlayerCheck = 0x809D3E88; // type:func -BossTw_CheckBeamReflection = 0x809D4080; // type:func -BossTw_BeamReflHitCheck = 0x809D4308; // type:func -BossTw_GetFloorY = 0x809D4430; // type:func -BossTw_ShootBeam = 0x809D4704; // type:func -BossTw_SetupFinishBeamShoot = 0x809D56BC; // type:func -BossTw_FinishBeamShoot = 0x809D5718; // type:func -BossTw_SetupHitByBeam = 0x809D57B0; // type:func -BossTw_HitByBeam = 0x809D5818; // type:func -BossTw_SetupLaugh = 0x809D5AE0; // type:func -BossTw_Laugh = 0x809D5B44; // type:func -BossTw_SetupSpin = 0x809D5BD4; // type:func -BossTw_Spin = 0x809D5C50; // type:func -BossTw_SetupMergeCS = 0x809D5CF0; // type:func -BossTw_MergeCS = 0x809D5D3C; // type:func -BossTw_SetupWait = 0x809D5D80; // type:func -BossTw_Wait = 0x809D5DB8; // type:func -BossTw_TwinrovaSetupMergeCS = 0x809D5E5C; // type:func -BossTw_TwinrovaMergeCS = 0x809D5E7C; // type:func -BossTw_SetupDeathCS = 0x809D6948; // type:func -BossTw_DeathCS = 0x809D69B0; // type:func -BossTw_SetupCSWait = 0x809D6AB8; // type:func -BossTw_CSWait = 0x809D6AF0; // type:func -BossTw_TwinrovaSetupIntroCS = 0x809D6B00; // type:func -BossTw_TwinrovaIntroCS = 0x809D6B38; // type:func -BossTw_DeathBall = 0x809D838C; // type:func -BossTw_TwinrovaSetupDeathCS = 0x809D8688; // type:func -BossTw_DeathCSMsgSfx = 0x809D8744; // type:func -BossTw_TwinrovaDeathCS = 0x809D8F64; // type:func -BossTw_Update = 0x809D9C58; // type:func -BossTw_TwinrovaUpdate = 0x809DA2CC; // type:func -BossTw_OverrideLimbDraw = 0x809DAC48; // type:func -BossTw_PostLimbDraw = 0x809DACFC; // type:func -func_80941BC0 = 0x809DB114; // type:func -func_80942180 = 0x809DB68C; // type:func -func_809426F0 = 0x809DBBA8; // type:func -func_80942C70 = 0x809DC0F0; // type:func -func_80943028 = 0x809DC460; // type:func -BossTw_Draw = 0x809DC664; // type:func -BossTw_TwinrovaOverrideLimbDraw = 0x809DCD20; // type:func -BossTw_TwinrovaPostLimbDraw = 0x809DD14C; // type:func -BossTw_ShieldChargeDraw = 0x809DD288; // type:func -BossTw_SpawnPortalDraw = 0x809DDAF0; // type:func -func_80944C50 = 0x809DDF28; // type:func -BossTw_TwinrovaDraw = 0x809DE30C; // type:func -BossTw_BlastFire = 0x809DE644; // type:func -BossTw_BlastIce = 0x809DEF7C; // type:func -BossTw_BlastShieldCheck = 0x809DFAF0; // type:func -BossTw_BlastUpdate = 0x809DFD80; // type:func -BossTw_BlastDraw = 0x809DFEFC; // type:func -BossTw_DrawDeathBall = 0x809E0480; // type:func -BossTw_UpdateEffects = 0x809E09E0; // type:func -BossTw_InitRand = 0x809E1738; // type:func -BossTw_RandZeroOne = 0x809E1758; // type:func -BossTw_DrawEffects = 0x809E1880; // type:func -BossTw_TwinrovaSetupArriveAtTarget = 0x809E26B4; // type:func -BossTw_TwinrovaArriveAtTarget = 0x809E2728; // type:func -BossTw_TwinrovaSetupChargeBlast = 0x809E2854; // type:func -BossTw_TwinrovaChargeBlast = 0x809E28B4; // type:func -BossTw_TwinrovaSetupShootBlast = 0x809E2AA0; // type:func -BossTw_TwinrovaShootBlast = 0x809E2B28; // type:func -BossTw_TwinrovaSetupDoneBlastShoot = 0x809E2D78; // type:func -BossTw_TwinrovaDoneBlastShoot = 0x809E2DC4; // type:func -BossTw_TwinrovaDamage = 0x809E2E5C; // type:func -BossTw_TwinrovaStun = 0x809E2F88; // type:func -BossTw_TwinrovaSetupGetUp = 0x809E323C; // type:func -BossTw_TwinrovaGetUp = 0x809E32A0; // type:func -BossTw_TwinrovaSetupFly = 0x809E3334; // type:func -BossTw_TwinrovaFly = 0x809E350C; // type:func -BossTw_TwinrovaSetupSpin = 0x809E3780; // type:func -BossTw_TwinrovaSpin = 0x809E37D8; // type:func -BossTw_TwinrovaSetupLaugh = 0x809E3850; // type:func -BossTw_TwinrovaLaugh = 0x809E38B4; // type:func -EnRr_Init = 0x809E7DD0; // type:func -EnRr_Destroy = 0x809E7F70; // type:func -EnRr_Move = 0x809E7FB0; // type:func -EnRr_SetupReach = 0x809E7FD8; // type:func -EnRr_SetupNeutral = 0x809E80D8; // type:func -EnRr_SetupGrabPlayer = 0x809E81A4; // type:func -EnRr_GetMessage = 0x809E82AC; // type:func -EnRr_SetupReleasePlayer = 0x809E8300; // type:func -EnRr_SetupDamage = 0x809E84FC; // type:func -EnRr_SetupApproach = 0x809E85C8; // type:func -EnRr_SetupDeath = 0x809E8680; // type:func -EnRr_SetupStunned = 0x809E8720; // type:func -EnRr_CollisionCheck = 0x809E882C; // type:func -EnRr_InitBodySegments = 0x809E8BBC; // type:func -EnRr_UpdateBodySegments = 0x809E8D7C; // type:func -EnRr_Approach = 0x809E8F00; // type:func -EnRr_Reach = 0x809E8FC0; // type:func -EnRr_GrabPlayer = 0x809E90DC; // type:func -EnRr_Damage = 0x809E91D4; // type:func -EnRr_Death = 0x809E924C; // type:func -EnRr_Retreat = 0x809E95C0; // type:func -EnRr_Stunned = 0x809E9654; // type:func -EnRr_Update = 0x809E96BC; // type:func -EnRr_Draw = 0x809E9AE8; // type:func -EnBa_SetupAction = 0x809EA300; // type:func -EnBa_Init = 0x809EA30C; // type:func -EnBa_Destroy = 0x809EA4F8; // type:func -EnBa_SetupIdle = 0x809EA524; // type:func -EnBa_Idle = 0x809EA564; // type:func -EnBa_SetupFallAsBlob = 0x809EA990; // type:func -EnBa_FallAsBlob = 0x809EAA00; // type:func -EnBa_SetupSwingAtPlayer = 0x809EAAC0; // type:func -EnBa_SwingAtPlayer = 0x809EAB14; // type:func -func_809B7174 = 0x809EB134; // type:func -EnBa_RecoilFromDamage = 0x809EB1B0; // type:func -func_809B75A0 = 0x809EB564; // type:func -EnBa_Die = 0x809EB7E0; // type:func -EnBa_Update = 0x809EBB10; // type:func -EnBa_Draw = 0x809EBBF0; // type:func -EnBx_Init = 0x809EC1D0; // type:func -EnBx_Destroy = 0x809EC3D8; // type:func -func_809D1D0C = 0x809EC404; // type:func -EnBx_Update = 0x809EC4D4; // type:func -EnBx_Draw = 0x809EC7F8; // type:func -EnAnubice_Hover = 0x809ECCD0; // type:func -EnAnubice_AimFireball = 0x809ECD74; // type:func -EnAnubice_Init = 0x809ECE54; // type:func -EnAnubice_Destroy = 0x809ECF6C; // type:func -EnAnubice_FindFlameCircles = 0x809ECFC8; // type:func -EnAnubice_SetupIdle = 0x809ED050; // type:func -EnAnubice_Idle = 0x809ED0F8; // type:func -EnAnubice_GoToHome = 0x809ED1D8; // type:func -EnAnubice_SetupShootFireball = 0x809ED328; // type:func -EnAnubice_ShootFireball = 0x809ED3B0; // type:func -EnAnubice_SetupDie = 0x809ED4B0; // type:func -EnAnubice_Die = 0x809ED580; // type:func -EnAnubice_Update = 0x809ED834; // type:func -EnAnubice_OverrideLimbDraw = 0x809EDC38; // type:func -EnAnubice_PostLimbDraw = 0x809EDC84; // type:func -EnAnubice_Draw = 0x809EDD40; // type:func -EnAnubiceFire_Init = 0x809EDF80; // type:func -EnAnubiceFire_Destroy = 0x809EE0A0; // type:func -func_809B26EC = 0x809EE0CC; // type:func -func_809B27D8 = 0x809EE1B8; // type:func -func_809B2B48 = 0x809EE528; // type:func -EnAnubiceFire_Update = 0x809EE6D4; // type:func -EnAnubiceFire_Draw = 0x809EE8D0; // type:func -BgMoriHashigo_InitDynapoly = 0x809EED40; // type:func -BgMoriHashigo_InitCollider = 0x809EED98; // type:func -BgMoriHashigo_SpawnLadder = 0x809EEE44; // type:func -BgMoriHashigo_InitClasp = 0x809EEEFC; // type:func -BgMoriHashigo_InitLadder = 0x809EEF88; // type:func -BgMoriHashigo_Init = 0x809EEFCC; // type:func -BgMoriHashigo_Destroy = 0x809EF090; // type:func -BgMoriHashigo_SetupWaitForMoriTex = 0x809EF0E8; // type:func -BgMoriHashigo_WaitForMoriTex = 0x809EF0FC; // type:func -BgMoriHashigo_SetupClasp = 0x809EF17C; // type:func -BgMoriHashigo_Clasp = 0x809EF190; // type:func -BgMoriHashigo_SetupLadderWait = 0x809EF1F4; // type:func -BgMoriHashigo_LadderWait = 0x809EF208; // type:func -BgMoriHashigo_SetupLadderFall = 0x809EF23C; // type:func -BgMoriHashigo_LadderFall = 0x809EF278; // type:func -BgMoriHashigo_SetupLadderRest = 0x809EF358; // type:func -BgMoriHashigo_Update = 0x809EF37C; // type:func -BgMoriHashigo_Draw = 0x809EF3B8; // type:func -BgMoriHashira4_SetupAction = 0x809EF600; // type:func -BgMoriHashira4_InitDynaPoly = 0x809EF60C; // type:func -BgMoriHashira4_Init = 0x809EF664; // type:func -BgMoriHashira4_Destroy = 0x809EF778; // type:func -BgMoriHashira4_SetupWaitForMoriTex = 0x809EF7AC; // type:func -BgMoriHashira4_WaitForMoriTex = 0x809EF7D0; // type:func -BgMoriHashira4_SetupPillarsRotate = 0x809EF84C; // type:func -BgMoriHashira4_PillarsRotate = 0x809EF870; // type:func -BgMoriHashira4_GateWait = 0x809EF8A8; // type:func -BgMoriHashira4_GateOpen = 0x809EF954; // type:func -BgMoriHashira4_Update = 0x809EF9AC; // type:func -BgMoriHashira4_Draw = 0x809EF9D8; // type:func -BgMoriIdomizu_SetupAction = 0x809EFB90; // type:func -BgMoriIdomizu_SetWaterLevel = 0x809EFB9C; // type:func -BgMoriIdomizu_Init = 0x809EFBC4; // type:func -BgMoriIdomizu_Destroy = 0x809EFCE8; // type:func -BgMoriIdomizu_SetupWaitForMoriTex = 0x809EFD08; // type:func -BgMoriIdomizu_WaitForMoriTex = 0x809EFD2C; // type:func -BgMoriIdomizu_SetupMain = 0x809EFD84; // type:func -BgMoriIdomizu_Main = 0x809EFDA8; // type:func -BgMoriIdomizu_Update = 0x809EFF6C; // type:func -BgMoriIdomizu_Draw = 0x809EFF98; // type:func -BgSpot16Doughnut_Init = 0x809F01D0; // type:func -BgSpot16Doughnut_Destroy = 0x809F0344; // type:func -BgSpot16Doughnut_Update = 0x809F0354; // type:func -BgSpot16Doughnut_UpdateExpanding = 0x809F03E8; // type:func -BgSpot16Doughnut_Draw = 0x809F0450; // type:func -BgSpot16Doughnut_DrawExpanding = 0x809F0608; // type:func -BgBdanSwitch_InitDynaPoly = 0x809F0790; // type:func -BgBdanSwitch_InitCollision = 0x809F07E8; // type:func -func_8086D0EC = 0x809F083C; // type:func -BgBdanSwitch_Init = 0x809F09A8; // type:func -BgBdanSwitch_Destroy = 0x809F0B64; // type:func -func_8086D4B4 = 0x809F0BD0; // type:func -func_8086D548 = 0x809F0C64; // type:func -func_8086D5C4 = 0x809F0CE0; // type:func -func_8086D5E0 = 0x809F0D00; // type:func -func_8086D67C = 0x809F0D9C; // type:func -func_8086D694 = 0x809F0DB8; // type:func -func_8086D730 = 0x809F0E58; // type:func -func_8086D754 = 0x809F0E80; // type:func -func_8086D7FC = 0x809F0F28; // type:func -func_8086D80C = 0x809F0F3C; // type:func -func_8086D86C = 0x809F0F9C; // type:func -func_8086D888 = 0x809F0FBC; // type:func -func_8086D8BC = 0x809F0FF4; // type:func -func_8086D8CC = 0x809F1008; // type:func -func_8086D944 = 0x809F1080; // type:func -func_8086D95C = 0x809F109C; // type:func -func_8086D9F8 = 0x809F113C; // type:func -func_8086DA1C = 0x809F1164; // type:func -func_8086DAB4 = 0x809F1200; // type:func -func_8086DAC4 = 0x809F1214; // type:func -func_8086DB24 = 0x809F1274; // type:func -func_8086DB40 = 0x809F1294; // type:func -func_8086DB4C = 0x809F12A4; // type:func -func_8086DB68 = 0x809F12C4; // type:func -func_8086DC30 = 0x809F138C; // type:func -func_8086DC48 = 0x809F13A8; // type:func -func_8086DCCC = 0x809F142C; // type:func -func_8086DCE8 = 0x809F144C; // type:func -func_8086DDA8 = 0x809F150C; // type:func -func_8086DDC0 = 0x809F1528; // type:func -BgBdanSwitch_Update = 0x809F15BC; // type:func -func_8086DF58 = 0x809F16C0; // type:func -BgBdanSwitch_Draw = 0x809F1730; // type:func -EnMa1_GetTextId = 0x809F1BC0; // type:func -EnMa1_UpdateTalkState = 0x809F1CA8; // type:func -EnMa1_ShouldSpawn = 0x809F1DF4; // type:func -EnMa1_UpdateEyes = 0x809F1F40; // type:func -EnMa1_ChangeAnim = 0x809F1FB8; // type:func -EnMa1_UpdateTracking = 0x809F2028; // type:func -EnMa1_UpdateSinging = 0x809F20A8; // type:func -EnMa1_Init = 0x809F2120; // type:func -EnMa1_Destroy = 0x809F2288; // type:func -EnMa1_Idle = 0x809F22C8; // type:func -EnMa1_GiveWeirdEgg = 0x809F23E0; // type:func -EnMa1_FinishGivingWeirdEgg = 0x809F2440; // type:func -EnMa1_IdleTeachSong = 0x809F2488; // type:func -EnMa1_StartTeachSong = 0x809F25B4; // type:func -EnMa1_TeachSong = 0x809F2638; // type:func -EnMa1_WaitForPlayback = 0x809F26A0; // type:func -EnMa1_DoNothing = 0x809F2718; // type:func -EnMa1_Update = 0x809F2728; // type:func -EnMa1_OverrideLimbDraw = 0x809F2814; // type:func -EnMa1_PostLimbDraw = 0x809F29A4; // type:func -EnMa1_Draw = 0x809F2A00; // type:func -BossGanonEff_SpawnWindowShard = 0x809F2EA0; // type:func -BossGanonEff_SpawnSparkle = 0x809F2FE0; // type:func -BossGanonEff_SpawnLightRay = 0x809F30DC; // type:func -BossGanonEff_SpawnShock = 0x809F3220; // type:func -BossGanonEff_SpawnLightning = 0x809F32EC; // type:func -BossGanonEff_SpawnDustDark = 0x809F3390; // type:func -BossGanonEff_SpawnDustLight = 0x809F3484; // type:func -BossGanonEff_SpawnShockwave = 0x809F3568; // type:func -BossGanonEff_SpawnBlackDot = 0x809F3660; // type:func -BossGanon_SetColliderPos = 0x809F371C; // type:func -BossGanon_SetAnimationObject = 0x809F3760; // type:func -BossGanon_Init = 0x809F37D0; // type:func -BossGanon_Destroy = 0x809F3D74; // type:func -BossGanon_SetupIntroCutscene = 0x809F3DD8; // type:func -BossGanon_SetIntroCsCamera = 0x809F3EBC; // type:func -BossGanon_IntroCutscene = 0x809F3F5C; // type:func -BossGanon_SetupDeathCutscene = 0x809F565C; // type:func -BossGanon_SetupTowerCutscene = 0x809F5740; // type:func -BossGanon_ShatterWindows = 0x809F5844; // type:func -BossGanon_DeathAndTowerCutscene = 0x809F5988; // type:func -BossGanon_SetupPoundFloor = 0x809F7330; // type:func -BossGanon_PoundFloor = 0x809F736C; // type:func -BossGanon_SetupChargeBigMagic = 0x809F78C0; // type:func -BossGanon_ChargeBigMagic = 0x809F7930; // type:func -BossGanon_SetupWait = 0x809F8138; // type:func -BossGanon_Wait = 0x809F81C0; // type:func -BossGanon_SetupChargeLightBall = 0x809F850C; // type:func -BossGanon_ChargeLightBall = 0x809F857C; // type:func -BossGanon_SetupPlayTennis = 0x809F8730; // type:func -BossGanon_PlayTennis = 0x809F8798; // type:func -BossGanon_SetupBlock = 0x809F8A68; // type:func -BossGanon_Block = 0x809F8B20; // type:func -BossGanon_SetupHitByLightBall = 0x809F8CB0; // type:func -BossGanon_HitByLightBall = 0x809F8DA4; // type:func -BossGanon_SetupVulnerable = 0x809F8FFC; // type:func -BossGanon_Vulnerable = 0x809F91CC; // type:func -BossGanon_SetupDamaged = 0x809F9738; // type:func -BossGanon_Damaged = 0x809F97A0; // type:func -BossGanon_UpdateDamage = 0x809F9860; // type:func -BossGanon_Update = 0x809F9C28; // type:func -BossGanon_OverrideLimbDraw = 0x809FAD90; // type:func -BossGanon_PostLimbDraw = 0x809FAFD0; // type:func -BossGanon_InitRand = 0x809FB32C; // type:func -BossGanon_RandZeroOne = 0x809FB34C; // type:func -BossGanon_DrawShock = 0x809FB474; // type:func -BossGanon_DrawHandLightBall = 0x809FB820; // type:func -BossGanon_DrawBigMagicCharge = 0x809FBA74; // type:func -BossGanon_DrawTriforce = 0x809FC104; // type:func -BossGanon_DrawDarkVortex = 0x809FC4C8; // type:func -func_808E0254 = 0x809FC720; // type:func -BossGanon_GenShadowTexture = 0x809FCBC8; // type:func -BossGanon_DrawShadowTexture = 0x809FCF08; // type:func -BossGanon_Draw = 0x809FD184; // type:func -BossGanon_CheckFallingPlatforms = 0x809FD3CC; // type:func -BossGanon_LightBall_Update = 0x809FD4B4; // type:func -BossGanon_LightBall_Draw = 0x809FDFD4; // type:func -func_808E1EB4 = 0x809FE2E8; // type:func -func_808E229C = 0x809FE6D8; // type:func -func_808E2544 = 0x809FE948; // type:func -func_808E324C = 0x809FF65C; // type:func -BossGanon_UpdateEffects = 0x809FF930; // type:func -BossGanon_DrawEffects = 0x80A00158; // type:func -BossSst_Init = 0x80A18CD0; // type:func -BossSst_Destroy = 0x80A19158; // type:func -BossSst_HeadSetupLurk = 0x80A191A4; // type:func -BossSst_HeadLurk = 0x80A191D8; // type:func -BossSst_HeadSetupIntro = 0x80A19214; // type:func -BossSst_HeadIntro = 0x80A19360; // type:func -BossSst_HeadSetupWait = 0x80A1A178; // type:func -BossSst_HeadWait = 0x80A1A1C8; // type:func -BossSst_HeadSetupNeutral = 0x80A1A244; // type:func -BossSst_HeadNeutral = 0x80A1A264; // type:func -BossSst_HeadSetupDamagedHand = 0x80A1A408; // type:func -BossSst_HeadDamagedHand = 0x80A1A470; // type:func -BossSst_HeadSetupReadyCharge = 0x80A1A568; // type:func -BossSst_HeadReadyCharge = 0x80A1A5C0; // type:func -BossSst_HeadSetupCharge = 0x80A1A664; // type:func -BossSst_HeadCharge = 0x80A1A720; // type:func -BossSst_HeadSetupEndCharge = 0x80A1A980; // type:func -BossSst_HeadEndCharge = 0x80A1AA04; // type:func -BossSst_HeadSetupFrozenHand = 0x80A1AA74; // type:func -BossSst_HeadFrozenHand = 0x80A1AAC8; // type:func -BossSst_HeadSetupUnfreezeHand = 0x80A1AB10; // type:func -BossSst_HeadUnfreezeHand = 0x80A1AB5C; // type:func -BossSst_HeadSetupStunned = 0x80A1AB98; // type:func -BossSst_HeadStunned = 0x80A1AC38; // type:func -BossSst_HeadSetupVulnerable = 0x80A1AEBC; // type:func -BossSst_HeadVulnerable = 0x80A1AF5C; // type:func -BossSst_HeadSetupDamage = 0x80A1B05C; // type:func -BossSst_HeadDamage = 0x80A1B12C; // type:func -BossSst_HeadSetupRecover = 0x80A1B17C; // type:func -BossSst_HeadRecover = 0x80A1B208; // type:func -BossSst_SetCameraTargets = 0x80A1B39C; // type:func -BossSst_UpdateDeathCamera = 0x80A1B4C8; // type:func -BossSst_HeadSetupDeath = 0x80A1B654; // type:func -BossSst_HeadDeath = 0x80A1B7E8; // type:func -BossSst_HeadSetupThrash = 0x80A1BA38; // type:func -BossSst_HeadThrash = 0x80A1BAA0; // type:func -BossSst_HeadSetupDarken = 0x80A1BB1C; // type:func -BossSst_HeadDarken = 0x80A1BB64; // type:func -BossSst_HeadSetupFall = 0x80A1BD8C; // type:func -BossSst_HeadFall = 0x80A1BE24; // type:func -BossSst_HeadSetupMelt = 0x80A1BEC0; // type:func -BossSst_HeadMelt = 0x80A1BF10; // type:func -BossSst_HeadSetupFinish = 0x80A1BFC8; // type:func -BossSst_HeadFinish = 0x80A1C024; // type:func -BossSst_HandSetupWait = 0x80A1C31C; // type:func -BossSst_HandWait = 0x80A1C398; // type:func -BossSst_HandSetupDownbeat = 0x80A1C508; // type:func -BossSst_HandDownbeat = 0x80A1C57C; // type:func -BossSst_HandSetupDownbeatEnd = 0x80A1C6CC; // type:func -BossSst_HandDownbeatEnd = 0x80A1C728; // type:func -BossSst_HandSetupOffbeat = 0x80A1C81C; // type:func -BossSst_HandOffbeat = 0x80A1C890; // type:func -BossSst_HandSetupOffbeatEnd = 0x80A1C970; // type:func -BossSst_HandOffbeatEnd = 0x80A1C9BC; // type:func -BossSst_HandSetupEndSlam = 0x80A1CB00; // type:func -BossSst_HandEndSlam = 0x80A1CB74; // type:func -BossSst_HandSetupRetreat = 0x80A1CBB0; // type:func -BossSst_HandRetreat = 0x80A1CC58; // type:func -BossSst_HandSetupReadySlam = 0x80A1CE84; // type:func -BossSst_HandReadySlam = 0x80A1CEF0; // type:func -BossSst_HandSetupSlam = 0x80A1CFE0; // type:func -BossSst_HandSlam = 0x80A1D070; // type:func -BossSst_HandSetupReadySweep = 0x80A1D254; // type:func -BossSst_HandReadySweep = 0x80A1D2FC; // type:func -BossSst_HandSetupSweep = 0x80A1D420; // type:func -BossSst_HandSweep = 0x80A1D4AC; // type:func -BossSst_HandSetupReadyPunch = 0x80A1D6BC; // type:func -BossSst_HandReadyPunch = 0x80A1D724; // type:func -BossSst_HandSetupPunch = 0x80A1D780; // type:func -BossSst_HandPunch = 0x80A1D808; // type:func -BossSst_HandSetupReadyClap = 0x80A1D94C; // type:func -BossSst_HandReadyClap = 0x80A1DA3C; // type:func -BossSst_HandSetupClap = 0x80A1DC2C; // type:func -BossSst_HandClap = 0x80A1DC9C; // type:func -BossSst_HandSetupEndClap = 0x80A1DEC8; // type:func -BossSst_HandEndClap = 0x80A1DF34; // type:func -BossSst_HandSetupReadyGrab = 0x80A1DFD8; // type:func -BossSst_HandReadyGrab = 0x80A1E05C; // type:func -BossSst_HandSetupGrab = 0x80A1E104; // type:func -BossSst_HandGrab = 0x80A1E190; // type:func -BossSst_HandSetupCrush = 0x80A1E43C; // type:func -BossSst_HandCrush = 0x80A1E494; // type:func -BossSst_HandSetupEndCrush = 0x80A1E5AC; // type:func -BossSst_HandEndCrush = 0x80A1E5FC; // type:func -BossSst_HandSetupSwing = 0x80A1E638; // type:func -BossSst_HandSwing = 0x80A1E6C0; // type:func -BossSst_HandSetupReel = 0x80A1E9F4; // type:func -BossSst_HandReel = 0x80A1EA8C; // type:func -BossSst_HandSetupReadyShake = 0x80A1EBE4; // type:func -BossSst_HandReadyShake = 0x80A1EC34; // type:func -BossSst_HandSetupShake = 0x80A1ED9C; // type:func -BossSst_HandShake = 0x80A1EDB8; // type:func -BossSst_HandSetupReadyCharge = 0x80A1EF4C; // type:func -BossSst_HandReadyCharge = 0x80A1EFA0; // type:func -BossSst_HandSetupStunned = 0x80A1F118; // type:func -BossSst_HandStunned = 0x80A1F1C4; // type:func -BossSst_HandSetupDamage = 0x80A1F320; // type:func -BossSst_HandDamage = 0x80A1F37C; // type:func -BossSst_HandSetupThrash = 0x80A1F454; // type:func -BossSst_HandThrash = 0x80A1F4F0; // type:func -BossSst_HandSetupDarken = 0x80A1F6E4; // type:func -BossSst_HandDarken = 0x80A1F734; // type:func -BossSst_HandSetupFall = 0x80A1F7A8; // type:func -BossSst_HandFall = 0x80A1F7F8; // type:func -BossSst_HandSetupMelt = 0x80A1F87C; // type:func -BossSst_HandMelt = 0x80A1F8B8; // type:func -BossSst_HandSetupFinish = 0x80A1F930; // type:func -BossSst_HandFinish = 0x80A1F95C; // type:func -BossSst_HandSetupRecover = 0x80A1F988; // type:func -BossSst_HandRecover = 0x80A1F9DC; // type:func -BossSst_HandSetupFrozen = 0x80A1FA74; // type:func -BossSst_HandFrozen = 0x80A1FB40; // type:func -BossSst_HandSetupReadyBreakIce = 0x80A1FCA0; // type:func -BossSst_HandReadyBreakIce = 0x80A1FD54; // type:func -BossSst_HandSetupBreakIce = 0x80A1FE70; // type:func -BossSst_HandBreakIce = 0x80A1FE98; // type:func -BossSst_HandGrabPlayer = 0x80A2002C; // type:func -BossSst_HandReleasePlayer = 0x80A200CC; // type:func -BossSst_MoveAround = 0x80A20150; // type:func -BossSst_HandSelectAttack = 0x80A202DC; // type:func -BossSst_HandSetDamage = 0x80A203D8; // type:func -BossSst_HandSetInvulnerable = 0x80A20444; // type:func -BossSst_HeadSfx = 0x80A20484; // type:func -BossSst_HandCollisionCheck = 0x80A204B0; // type:func -BossSst_HeadCollisionCheck = 0x80A2063C; // type:func -BossSst_UpdateHand = 0x80A20788; // type:func -BossSst_UpdateHead = 0x80A20A98; // type:func -BossSst_OverrideHandDraw = 0x80A20D08; // type:func -BossSst_PostHandDraw = 0x80A20D58; // type:func -BossSst_OverrideHandTrailDraw = 0x80A20D94; // type:func -BossSst_DrawHand = 0x80A20DD8; // type:func -BossSst_OverrideHeadDraw = 0x80A21184; // type:func -BossSst_PostHeadDraw = 0x80A21988; // type:func -BossSst_DrawHead = 0x80A21A30; // type:func -BossSst_SpawnHeadShadow = 0x80A21E80; // type:func -BossSst_SpawnHandShadow = 0x80A21FAC; // type:func -BossSst_SpawnShockwave = 0x80A22060; // type:func -BossSst_SpawnIceCrystal = 0x80A2213C; // type:func -BossSst_SpawnIceShard = 0x80A223F8; // type:func -BossSst_IceShatter = 0x80A2264C; // type:func -BossSst_UpdateEffects = 0x80A22818; // type:func -BossSst_DrawEffects = 0x80A22ABC; // type:func -EnNy_Init = 0x80A252A0; // type:func -EnNy_Destroy = 0x80A253DC; // type:func -func_80ABCD40 = 0x80A25408; // type:func -func_80ABCD84 = 0x80A25450; // type:func -func_80ABCD94 = 0x80A25464; // type:func -func_80ABCDAC = 0x80A25480; // type:func -func_80ABCDBC = 0x80A25494; // type:func -EnNy_SetupTurnToStone = 0x80A254D8; // type:func -func_80ABCE38 = 0x80A25514; // type:func -func_80ABCE50 = 0x80A25530; // type:func -func_80ABCE90 = 0x80A25570; // type:func -func_80ABCEEC = 0x80A255CC; // type:func -EnNy_Move = 0x80A2562C; // type:func -EnNy_TurnToStone = 0x80A25740; // type:func -func_80ABD11C = 0x80A25800; // type:func -EnNy_CollisionCheck = 0x80A25874; // type:func -func_80ABD3B8 = 0x80A25A9C; // type:func -EnNy_Update = 0x80A25B84; // type:func -EnNy_SetupDie = 0x80A25E10; // type:func -EnNy_Die = 0x80A26094; // type:func -EnNy_UpdateDeath = 0x80A262A0; // type:func -EnNy_UpdateUnused = 0x80A262E0; // type:func -EnNy_Draw = 0x80A26410; // type:func -EnNy_DrawDeathEffect = 0x80A266E4; // type:func -EnFr_OrientUnderwater = 0x80A26BE0; // type:func -EnFr_Init = 0x80A26CF4; // type:func -EnFr_DrawIdle = 0x80A26DAC; // type:func -EnFr_DrawActive = 0x80A26DD4; // type:func -EnFr_Update = 0x80A26DE8; // type:func -EnFr_Destroy = 0x80A270E0; // type:func -EnFr_IsDivingIntoWater = 0x80A27114; // type:func -EnFr_DivingIntoWater = 0x80A27198; // type:func -EnFr_IsBelowLogSpot = 0x80A27244; // type:func -EnFr_IsAboveAndWithin30DistXZ = 0x80A272A0; // type:func -EnFr_DecrementBlinkTimer = 0x80A2731C; // type:func -EnFr_DecrementBlinkTimerUpdate = 0x80A27344; // type:func -EnFr_SetupJumpingOutOfWater = 0x80A273D4; // type:func -EnFr_JumpingOutOfWater = 0x80A27474; // type:func -EnFr_OrientOnLogSpot = 0x80A27614; // type:func -EnFr_ChooseJumpFromLogSpot = 0x80A276D4; // type:func -EnFr_JumpingUp = 0x80A277E8; // type:func -EnFr_JumpingBackIntoWater = 0x80A27928; // type:func -EnFr_SetScaleActive = 0x80A27A80; // type:func -EnFr_ButterflyPath = 0x80A27B88; // type:func -EnFr_UpdateActive = 0x80A27CE4; // type:func -EnFr_SetupJumpingUp = 0x80A27DC8; // type:func -EnFr_Idle = 0x80A27E68; // type:func -EnFr_Activate = 0x80A27F48; // type:func -EnFr_ActivateCheckFrogSong = 0x80A27FB0; // type:func -func_80A1BE98 = 0x80A28054; // type:func -EnFr_ListeningToOcarinaNotes = 0x80A280CC; // type:func -EnFr_ChildSong = 0x80A28218; // type:func -EnFr_ChildSongFirstTime = 0x80A28350; // type:func -EnFr_TalkBeforeFrogSong = 0x80A283A8; // type:func -EnFr_CheckOcarinaInputFrogSong = 0x80A28410; // type:func -EnFr_DeactivateButterfly = 0x80A2850C; // type:func -EnFr_GetNextNoteFrogSong = 0x80A28554; // type:func -EnFr_SetupFrogSong = 0x80A285D0; // type:func -EnFr_IsFrogSongComplete = 0x80A28644; // type:func -EnFr_OcarinaMistake = 0x80A286F4; // type:func -EnFr_ContinueFrogSong = 0x80A28750; // type:func -EnFr_SetupReward = 0x80A288F4; // type:func -EnFr_PrintTextBox = 0x80A28970; // type:func -EnFr_TalkBeforeReward = 0x80A289B0; // type:func -EnFr_SetReward = 0x80A28A18; // type:func -EnFr_Deactivate = 0x80A28B2C; // type:func -EnFr_GiveReward = 0x80A28C2C; // type:func -EnFr_SetIdle = 0x80A28C8C; // type:func -EnFr_UpdateIdle = 0x80A28CE0; // type:func -EnFr_OverrideLimbDraw = 0x80A28D0C; // type:func -EnFr_PostLimbDraw = 0x80A28D38; // type:func -EnFr_Draw = 0x80A28DF0; // type:func -ItemShield_SetupAction = 0x80A29670; // type:func -ItemShield_Init = 0x80A2967C; // type:func -ItemShield_Destroy = 0x80A297E4; // type:func -func_80B86AC8 = 0x80A29810; // type:func -func_80B86BC8 = 0x80A29914; // type:func -func_80B86CA8 = 0x80A299FC; // type:func -func_80B86F68 = 0x80A29CC0; // type:func -ItemShield_Update = 0x80A29DCC; // type:func -ItemShield_Draw = 0x80A29DF0; // type:func -BgIceShelter_InitColliders = 0x80A2A080; // type:func -BgIceShelter_InitDynaPoly = 0x80A2A1B4; // type:func -BgIceShelter_RotateY = 0x80A2A20C; // type:func -BgIceShelter_Init = 0x80A2A28C; // type:func -BgIceShelter_Destroy = 0x80A2A408; // type:func -BgIceShelter_SpawnSteamAround = 0x80A2A494; // type:func -BgIceShelter_SpawnSteamAlong = 0x80A2A708; // type:func -BgIceShelter_SetupIdle = 0x80A2A96C; // type:func -BgIceShelter_Idle = 0x80A2A988; // type:func -BgIceShelter_SetupMelt = 0x80A2AAC8; // type:func -BgIceShelter_Melt = 0x80A2AAE4; // type:func -BgIceShelter_Update = 0x80A2ACA8; // type:func -BgIceShelter_Draw = 0x80A2ACCC; // type:func -EnIceHono_XZDistanceSquared = 0x80A2B2C0; // type:func -EnIceHono_InitCapturableFlame = 0x80A2B2F0; // type:func -EnIceHono_InitDroppedFlame = 0x80A2B394; // type:func -EnIceHono_InitSmallFlame = 0x80A2B49C; // type:func -EnIceHono_Init = 0x80A2B504; // type:func -EnIceHono_Destroy = 0x80A2B664; // type:func -EnIceHono_InBottleRange = 0x80A2B6BC; // type:func -EnIceHono_SetupActionCapturableFlame = 0x80A2B7AC; // type:func -EnIceHono_CapturableFlame = 0x80A2B7D4; // type:func -EnIceHono_SetupActionDroppedFlame = 0x80A2B884; // type:func -EnIceHono_DropFlame = 0x80A2B8A8; // type:func -EnIceHono_SetupActionSpreadFlames = 0x80A2BA68; // type:func -EnIceHono_SpreadFlames = 0x80A2BA8C; // type:func -EnIceHono_SetupActionSmallFlame = 0x80A2BCE8; // type:func -EnIceHono_SmallFlameMove = 0x80A2BDBC; // type:func -EnIceHono_Update = 0x80A2BF14; // type:func -EnIceHono_Draw = 0x80A2C0A8; // type:func -ItemOcarina_SetupAction = 0x80A2C4B0; // type:func -ItemOcarina_Init = 0x80A2C4BC; // type:func -ItemOcarina_Destroy = 0x80A2C644; // type:func -ItemOcarina_Fly = 0x80A2C654; // type:func -ItemOcarina_GetThrown = 0x80A2C800; // type:func -func_80B864EC = 0x80A2C858; // type:func -func_80B865E0 = 0x80A2C94C; // type:func -ItemOcarina_DoNothing = 0x80A2C9AC; // type:func -ItemOcarina_StartSoTCutscene = 0x80A2C9BC; // type:func -ItemOcarina_WaitInWater = 0x80A2CA30; // type:func -ItemOcarina_Update = 0x80A2CB04; // type:func -ItemOcarina_Draw = 0x80A2CB28; // type:func -MagicDark_Init = 0x80A2CC80; // type:func -MagicDark_Destroy = 0x80A2CD64; // type:func -MagicDark_DiamondUpdate = 0x80A2CD9C; // type:func -MagicDark_DimLighting = 0x80A2CFE4; // type:func -MagicDark_OrbUpdate = 0x80A2D130; // type:func -MagicDark_DiamondDraw = 0x80A2D2D8; // type:func -MagicDark_OrbDraw = 0x80A2D540; // type:func -Demo6K_SetupAction = 0x80A2E4D0; // type:func -Demo6K_Init = 0x80A2E4DC; // type:func -Demo6K_Destroy = 0x80A2E8C4; // type:func -Demo6K_WaitForObject = 0x80A2E8F8; // type:func -func_80966E04 = 0x80A2E950; // type:func -func_80966E98 = 0x80A2E9E8; // type:func -func_80966F84 = 0x80A2EADC; // type:func -func_809670AC = 0x80A2EC04; // type:func -func_8096712C = 0x80A2EC84; // type:func -func_80967244 = 0x80A2ED9C; // type:func -func_80967410 = 0x80A2EF68; // type:func -func_809674E0 = 0x80A2F038; // type:func -func_809676A4 = 0x80A2F1FC; // type:func -func_8096784C = 0x80A2F3A4; // type:func -func_80967A04 = 0x80A2F560; // type:func -func_80967AD0 = 0x80A2F62C; // type:func -func_80967BF8 = 0x80A2F758; // type:func -func_80967DBC = 0x80A2F91C; // type:func -func_80967F10 = 0x80A2FA68; // type:func -Demo6K_Update = 0x80A2FB34; // type:func -func_80967FFC = 0x80A2FB58; // type:func -func_80968298 = 0x80A2FDB4; // type:func -func_8096865C = 0x80A30138; // type:func -func_809688C4 = 0x80A30358; // type:func -func_80968B70 = 0x80A305D4; // type:func -func_80968FB0 = 0x80A309D4; // type:func -func_809691BC = 0x80A30B98; // type:func -EnAnubiceTag_Init = 0x80A31230; // type:func -EnAnubiceTag_Destroy = 0x80A31280; // type:func -EnAnubiceTag_SpawnAnubis = 0x80A31290; // type:func -EnAnubiceTag_ManageAnubis = 0x80A31308; // type:func -EnAnubiceTag_Update = 0x80A3146C; // type:func -EnAnubiceTag_Draw = 0x80A31490; // type:func -BgHakaGate_Init = 0x80A31500; // type:func -BgHakaGate_Destroy = 0x80A317D0; // type:func -BgHakaGate_DoNothing = 0x80A3182C; // type:func -BgHakaGate_StatueInactive = 0x80A3183C; // type:func -BgHakaGate_StatueIdle = 0x80A31878; // type:func -BgHakaGate_StatueTurn = 0x80A31990; // type:func -BgHakaGate_FloorClosed = 0x80A31B74; // type:func -BgHakaGate_FloorOpen = 0x80A31CFC; // type:func -BgHakaGate_GateWait = 0x80A31D88; // type:func -BgHakaGate_GateOpen = 0x80A31DD8; // type:func -BgHakaGate_SkullOfTruth = 0x80A31E68; // type:func -BgHakaGate_FalseSkull = 0x80A31EC4; // type:func -BgHakaGate_Update = 0x80A31F44; // type:func -BgHakaGate_DrawFlame = 0x80A31F8C; // type:func -BgHakaGate_Draw = 0x80A32164; // type:func -BgSpot15Saku_Init = 0x80A325A0; // type:func -BgSpot15Saku_Destroy = 0x80A32654; // type:func -func_808B4930 = 0x80A32688; // type:func -func_808B4978 = 0x80A326D0; // type:func -func_808B4A04 = 0x80A3275C; // type:func -BgSpot15Saku_Update = 0x80A3278C; // type:func -BgSpot15Saku_Draw = 0x80A327C0; // type:func -BgJyaGoroiwa_UpdateCollider = 0x80A328E0; // type:func -BgJyaGoroiwa_InitCollider = 0x80A32938; // type:func -BgJyaGoroiwa_UpdateRotation = 0x80A329A0; // type:func -BgJyaGoroiwa_Init = 0x80A329E0; // type:func -BgJyaGoroiwa_Destroy = 0x80A32A74; // type:func -BgJyaGoroiwa_SetupMove = 0x80A32AA0; // type:func -BgJyaGoroiwa_Move = 0x80A32AD0; // type:func -BgJyaGoroiwa_SetupWait = 0x80A32D64; // type:func -BgJyaGoroiwa_Wait = 0x80A32D7C; // type:func -BgJyaGoroiwa_Update = 0x80A32DCC; // type:func -BgJyaGoroiwa_Draw = 0x80A32EB8; // type:func -BgJyaZurerukabe_InitDynaPoly = 0x80A33060; // type:func -func_8089B4C8 = 0x80A330B8; // type:func -BgJyaZurerukabe_Init = 0x80A33254; // type:func -BgJyaZurerukabe_Destroy = 0x80A33314; // type:func -func_8089B7B4 = 0x80A33360; // type:func -func_8089B7C4 = 0x80A33374; // type:func -func_8089B80C = 0x80A333C0; // type:func -func_8089B870 = 0x80A33428; // type:func -BgJyaZurerukabe_Update = 0x80A334F0; // type:func -BgJyaZurerukabe_Draw = 0x80A33548; // type:func -func_808958F0 = 0x80A33710; // type:func -BgJyaCobra_InitDynapoly = 0x80A33764; // type:func -BgJyaCobra_SpawnRay = 0x80A337BC; // type:func -func_80895A70 = 0x80A33824; // type:func -func_80895BEC = 0x80A339A4; // type:func -func_80895C74 = 0x80A33A28; // type:func -BgJyaCobra_UpdateShadowFromSide = 0x80A33CA8; // type:func -BgJyaCobra_UpdateShadowFromTop = 0x80A342D0; // type:func -BgJyaCobra_Init = 0x80A3458C; // type:func -BgJyaCobra_Destroy = 0x80A34678; // type:func -func_80896918 = 0x80A346AC; // type:func -func_80896950 = 0x80A346E8; // type:func -func_808969F8 = 0x80A34790; // type:func -func_80896ABC = 0x80A34858; // type:func -BgJyaCobra_Update = 0x80A349EC; // type:func -func_80896CB4 = 0x80A34A60; // type:func -func_80896D78 = 0x80A34AE8; // type:func -BgJyaCobra_DrawShadow = 0x80A34C14; // type:func -BgJyaCobra_Draw = 0x80A34E98; // type:func -BgJyaKanaami_InitDynaPoly = 0x80A35450; // type:func -BgJyaKanaami_Init = 0x80A354A8; // type:func -BgJyaKanaami_Destroy = 0x80A35528; // type:func -func_80899880 = 0x80A3555C; // type:func -func_80899894 = 0x80A35574; // type:func -func_8089993C = 0x80A3561C; // type:func -func_80899950 = 0x80A35634; // type:func -func_80899A08 = 0x80A356EC; // type:func -BgJyaKanaami_Update = 0x80A35700; // type:func -BgJyaKanaami_Draw = 0x80A35734; // type:func -Fishing_SetColliderElement = 0x80A35800; // type:func -Fishing_SeedRand = 0x80A35890; // type:func -Fishing_RandZeroOne = 0x80A358B0; // type:func -Fishing_SmoothStepToS = 0x80A35A68; // type:func -Fishing_SpawnRipple = 0x80A35AF4; // type:func -Fishing_SpawnDustSplash = 0x80A35C68; // type:func -Fishing_SpawnWaterDust = 0x80A35DB8; // type:func -Fishing_SpawnBubble = 0x80A35EF8; // type:func -Fishing_SpawnRainDrop = 0x80A3603C; // type:func -Fishing_InitPondProps = 0x80A36138; // type:func -Fishing_Init = 0x80A36424; // type:func -Fishing_Destroy = 0x80A36D34; // type:func -Fishing_UpdateEffects = 0x80A36DA0; // type:func -Fishing_DrawEffects = 0x80A3749C; // type:func -Fishing_DrawStreamSplash = 0x80A38014; // type:func -Fishing_IsAboveCounter = 0x80A38198; // type:func -Fishing_UpdateLine = 0x80A38258; // type:func -Fishing_UpdateLinePos = 0x80A387C4; // type:func -Fishing_DrawLureHook = 0x80A38974; // type:func -Fishing_UpdateSinkingLure = 0x80A38E20; // type:func -Fishing_DrawSinkingLure = 0x80A39110; // type:func -Fishing_DrawLureAndLine = 0x80A3940C; // type:func -Fishing_DrawRod = 0x80A39C70; // type:func -Fishing_UpdateLure = 0x80A3A564; // type:func -Fishing_SplashBySize = 0x80A3C0C8; // type:func -Fishing_SplashBySize2 = 0x80A3C368; // type:func -func_80B70ED4 = 0x80A3C550; // type:func -Fishing_FishLeapSfx = 0x80A3C8C4; // type:func -Fishing_HandleAquariumDialog = 0x80A3C984; // type:func -Fishing_UpdateFish = 0x80A3CADC; // type:func -Fishing_FishOverrideLimbDraw = 0x80A40904; // type:func -Fishing_FishPostLimbDraw = 0x80A409E0; // type:func -Fishing_LoachOverrideLimbDraw = 0x80A40A10; // type:func -Fishing_LoachPostLimbDraw = 0x80A40A74; // type:func -Fishing_DrawFish = 0x80A40AA4; // type:func -Fishing_HandleReedContact = 0x80A40CCC; // type:func -Fishing_HandleLilyPadContact = 0x80A40D8C; // type:func -Fishing_UpdatePondProps = 0x80A40E7C; // type:func -Fishing_DrawPondProps = 0x80A41130; // type:func -Fishing_UpdateGroupFishes = 0x80A41614; // type:func -Fishing_DrawGroupFishes = 0x80A41F34; // type:func -Fishing_HandleOwnerDialog = 0x80A42148; // type:func -Fishing_UpdateOwner = 0x80A42CBC; // type:func -Fishing_OwnerOverrideLimbDraw = 0x80A4469C; // type:func -Fishing_OwnerPostLimbDraw = 0x80A446C8; // type:func -Fishing_DrawOwner = 0x80A447A0; // type:func -ObjOshihiki_InitDynapoly = 0x80A4ED40; // type:func -ObjOshihiki_RotateXZ = 0x80A4ED98; // type:func -ObjOshihiki_StrongEnough = 0x80A4EDEC; // type:func -ObjOshihiki_ResetFloors = 0x80A4EE70; // type:func -ObjOshihiki_GetBlockUnder = 0x80A4EE9C; // type:func -ObjOshihiki_UpdateInitPos = 0x80A4EF2C; // type:func -ObjOshihiki_NoSwitchPress = 0x80A4F05C; // type:func -ObjOshihiki_CheckType = 0x80A4F128; // type:func -ObjOshihiki_SetScale = 0x80A4F178; // type:func -ObjOshihiki_SetTexture = 0x80A4F1B0; // type:func -ObjOshihiki_SetColor = 0x80A4F210; // type:func -ObjOshihiki_Init = 0x80A4F2B8; // type:func -ObjOshihiki_Destroy = 0x80A4F3E0; // type:func -ObjOshihiki_SetFloors = 0x80A4F414; // type:func -ObjOshihiki_GetHighestFloor = 0x80A4F574; // type:func -ObjOshihiki_SetGround = 0x80A4F6C0; // type:func -ObjOshihiki_CheckFloor = 0x80A4F718; // type:func -ObjOshihiki_CheckGround = 0x80A4F770; // type:func -ObjOshihiki_CheckWall = 0x80A4F7E8; // type:func -ObjOshihiki_MoveWithBlockUnder = 0x80A4FA3C; // type:func -ObjOshihiki_SetupOnScene = 0x80A4FB38; // type:func -ObjOshihiki_OnScene = 0x80A4FB70; // type:func -ObjOshihiki_SetupOnActor = 0x80A4FC5C; // type:func -ObjOshihiki_OnActor = 0x80A4FC9C; // type:func -ObjOshihiki_SetupPush = 0x80A4FE94; // type:func -ObjOshihiki_Push = 0x80A4FEC0; // type:func -ObjOshihiki_SetupFall = 0x80A500DC; // type:func -ObjOshihiki_Fall = 0x80A50134; // type:func -ObjOshihiki_Update = 0x80A50238; // type:func -ObjOshihiki_Draw = 0x80A502C0; // type:func -BgGateShutter_Init = 0x80A507F0; // type:func -BgGateShutter_Destroy = 0x80A508D8; // type:func -func_8087828C = 0x80A5090C; // type:func -func_80878300 = 0x80A50980; // type:func -func_808783AC = 0x80A50A30; // type:func -func_808783D4 = 0x80A50A58; // type:func -BgGateShutter_Update = 0x80A50B14; // type:func -BgGateShutter_Draw = 0x80A50B48; // type:func -EffDust_SetupAction = 0x80A50C80; // type:func -EffDust_SetupDraw = 0x80A50C8C; // type:func -EffDust_InitPosAndDistance = 0x80A50C98; // type:func -EffDust_Init = 0x80A50D10; // type:func -EffDust_Destroy = 0x80A50ED0; // type:func -EffDust_UpdateFunc_8099DB28 = 0x80A50EE0; // type:func -EffDust_UpdateFunc_8099DD74 = 0x80A5112C; // type:func -EffDust_UpdateFunc_8099DFC0 = 0x80A51378; // type:func -EffDust_Update = 0x80A5188C; // type:func -EffDust_DrawFunc_8099E4F4 = 0x80A518B0; // type:func -EffDust_DrawFunc_8099E784 = 0x80A51B04; // type:func -EffDust_Draw = 0x80A51E68; // type:func -BgSpot01Fusya_SetupAction = 0x80A52050; // type:func -BgSpot01Fusya_Init = 0x80A5205C; // type:func -BgSpot01Fusya_Destroy = 0x80A520D8; // type:func -func_808AAA50 = 0x80A520E8; // type:func -BgSpot01Fusya_Update = 0x80A521A8; // type:func -BgSpot01Fusya_Draw = 0x80A521CC; // type:func -BgSpot01Idohashira_PlayBreakSfx1 = 0x80A522F0; // type:func -BgSpot01Idohashira_PlayBreakSfx2 = 0x80A52318; // type:func -func_808AAD3C = 0x80A52350; // type:func -func_808AAE6C = 0x80A52488; // type:func -func_808AAF34 = 0x80A52554; // type:func -BgSpot01Idohashira_Destroy = 0x80A52718; // type:func -BgSpot01Idohashira_NotInCsMode = 0x80A5274C; // type:func -BgSpot01Idohashira_GetCue = 0x80A5276C; // type:func -func_808AB18C = 0x80A527B8; // type:func -func_808AB1DC = 0x80A5280C; // type:func -func_808AB29C = 0x80A528B0; // type:func -func_808AB3E8 = 0x80A529FC; // type:func -func_808AB3F8 = 0x80A52A10; // type:func -func_808AB414 = 0x80A52A30; // type:func -func_808AB444 = 0x80A52A5C; // type:func -func_808AB504 = 0x80A52B08; // type:func -func_808AB510 = 0x80A52B18; // type:func -func_808AB530 = 0x80A52B38; // type:func -func_808AB570 = 0x80A52B7C; // type:func -BgSpot01Idohashira_Update = 0x80A52B9C; // type:func -BgSpot01Idohashira_Init = 0x80A52BE4; // type:func -func_808AB700 = 0x80A52CFC; // type:func -BgSpot01Idohashira_Draw = 0x80A52D8C; // type:func -BgSpot01Idomizu_Init = 0x80A52EF0; // type:func -BgSpot01Idomizu_Destroy = 0x80A52F88; // type:func -BgSpot01Idomizu_UpdateWaterLevel = 0x80A52F98; // type:func -BgSpot01Idomizu_Update = 0x80A5304C; // type:func -BgSpot01Idomizu_Draw = 0x80A53070; // type:func -BgPoSyokudai_Init = 0x80A53210; // type:func -BgPoSyokudai_Destroy = 0x80A534B0; // type:func -BgPoSyokudai_Update = 0x80A53520; // type:func -BgPoSyokudai_Draw = 0x80A535A0; // type:func -BgGanonOtyuka_Init = 0x80A53B80; // type:func -BgGanonOtyuka_Destroy = 0x80A53C1C; // type:func -BgGanonOtyuka_WaitToFall = 0x80A53C50; // type:func -BgGanonOtyuka_Fall = 0x80A53EA0; // type:func -BgGanonOtyuka_DoNothing = 0x80A542E0; // type:func -BgGanonOtyuka_Update = 0x80A542F0; // type:func -BgGanonOtyuka_Draw = 0x80A54338; // type:func -func_808B3960 = 0x80A561C0; // type:func -BgSpot15Rrbox_RotatePoint = 0x80A56218; // type:func -func_808B3A34 = 0x80A5626C; // type:func -func_808B3A40 = 0x80A5627C; // type:func -func_808B3AAC = 0x80A562EC; // type:func -BgSpot15Rrbox_Init = 0x80A563D4; // type:func -BgSpot15Rrbox_Destroy = 0x80A564A4; // type:func -BgSpot15Rrbox_TrySnapToCheckedPoint = 0x80A564E0; // type:func -BgSpot15Rrbox_GetFloorHeight = 0x80A56620; // type:func -BgSpot15Rrbox_TrySnapToFloor = 0x80A567A0; // type:func -func_808B4010 = 0x80A56860; // type:func -func_808B4084 = 0x80A568D4; // type:func -func_808B40AC = 0x80A56900; // type:func -func_808B4178 = 0x80A569CC; // type:func -func_808B4194 = 0x80A569EC; // type:func -func_808B4380 = 0x80A56BD8; // type:func -func_808B43D0 = 0x80A56C28; // type:func -func_808B44B8 = 0x80A56CF4; // type:func -func_808B44CC = 0x80A56D0C; // type:func -BgSpot15Rrbox_Update = 0x80A56D30; // type:func -BgSpot15Rrbox_Draw = 0x80A56D9C; // type:func -BgUmaJump_Init = 0x80A56FA0; // type:func -BgUmaJump_Destroy = 0x80A5705C; // type:func -BgUmaJump_Update = 0x80A57090; // type:func -BgUmaJump_Draw = 0x80A570A0; // type:func -EnInsect_InitFlags = 0x80A57130; // type:func -EnInsect_XZDistanceSquared = 0x80A57154; // type:func -EnInsect_InBottleRange = 0x80A57184; // type:func -EnInsect_SetCrawlAnim = 0x80A57274; // type:func -EnInsect_TryFindNearbySoil = 0x80A572C0; // type:func -EnInsect_UpdateCrawlSfx = 0x80A57378; // type:func -EnInsect_Init = 0x80A5740C; // type:func -EnInsect_Destroy = 0x80A57658; // type:func -EnInsect_SetupSlowDown = 0x80A576C8; // type:func -EnInsect_SlowDown = 0x80A57718; // type:func -EnInsect_SetupCrawl = 0x80A578BC; // type:func -EnInsect_Crawl = 0x80A5790C; // type:func -EnInsect_SetupRunFromPlayer = 0x80A57B38; // type:func -EnInsect_RunFromPlayer = 0x80A57B88; // type:func -EnInsect_SetupCaught = 0x80A57D80; // type:func -EnInsect_Caught = 0x80A57DEC; // type:func -EnInsect_SetupDig = 0x80A57EE4; // type:func -EnInsect_Dig = 0x80A57F5C; // type:func -EnInsect_SetupWalkOnWater = 0x80A58180; // type:func -EnInsect_WalkOnWater = 0x80A581E0; // type:func -EnInsect_SetupDrown = 0x80A58514; // type:func -EnInsect_Drown = 0x80A5858C; // type:func -EnInsect_SetupDropped = 0x80A586BC; // type:func -EnInsect_Dropped = 0x80A58784; // type:func -EnInsect_Update = 0x80A58EB4; // type:func -EnInsect_Draw = 0x80A590FC; // type:func -EnButte_SelectFlightParams = 0x80A59650; // type:func -EnButte_ResetTransformationEffect = 0x80A596D4; // type:func -EnButte_UpdateTransformationEffect = 0x80A596F0; // type:func -EnButte_DrawTransformationEffect = 0x80A59728; // type:func -EnButte_Init = 0x80A59964; // type:func -EnButte_Destroy = 0x80A59AD8; // type:func -func_809CD56C = 0x80A59B04; // type:func -func_809CD634 = 0x80A59BCC; // type:func -EnButte_Turn = 0x80A59C94; // type:func -EnButte_SetupFlyAround = 0x80A59D30; // type:func -EnButte_FlyAround = 0x80A59D7C; // type:func -EnButte_SetupFollowLink = 0x80A5A160; // type:func -EnButte_FollowLink = 0x80A5A1AC; // type:func -EnButte_SetupTransformIntoFairy = 0x80A5A560; // type:func -EnButte_TransformIntoFairy = 0x80A5A5B0; // type:func -EnButte_SetupWaitToDie = 0x80A5A66C; // type:func -EnButte_WaitToDie = 0x80A5A68C; // type:func -EnButte_Update = 0x80A5A6BC; // type:func -EnButte_Draw = 0x80A5A7FC; // type:func -EnFish_XZDistanceSquared = 0x80A5AC20; // type:func -EnFish_SetInWaterAnimation = 0x80A5AC50; // type:func -EnFish_SetOutOfWaterAnimation = 0x80A5ACB4; // type:func -EnFish_BeginRespawn = 0x80A5AD18; // type:func -EnFish_SetCutsceneData = 0x80A5AD4C; // type:func -EnFish_ClearCutsceneData = 0x80A5ADE4; // type:func -EnFish_Init = 0x80A5AE0C; // type:func -EnFish_Destroy = 0x80A5AF50; // type:func -EnFish_SetYOffset = 0x80A5AF7C; // type:func -EnFish_InBottleRange = 0x80A5B034; // type:func -EnFish_CheckXZDistanceToPlayer = 0x80A5B124; // type:func -EnFish_Respawning_SetupSlowDown = 0x80A5B154; // type:func -EnFish_Respawning_SlowDown = 0x80A5B1AC; // type:func -EnFish_Respawning_SetupFollowChild = 0x80A5B2A0; // type:func -EnFish_Respawning_FollowChild = 0x80A5B2F8; // type:func -EnFish_Respawning_SetupFleePlayer = 0x80A5B48C; // type:func -EnFish_Respawning_FleePlayer = 0x80A5B4E4; // type:func -EnFish_Respawning_SetupApproachPlayer = 0x80A5B6D4; // type:func -EnFish_Respawning_ApproachPlayer = 0x80A5B72C; // type:func -EnFish_Dropped_SetupFall = 0x80A5B8F0; // type:func -EnFish_Dropped_Fall = 0x80A5B950; // type:func -EnFish_Dropped_SetupFlopOnGround = 0x80A5BA58; // type:func -EnFish_Dropped_FlopOnGround = 0x80A5BB9C; // type:func -EnFish_Dropped_SetupSwimAway = 0x80A5BD78; // type:func -EnFish_Dropped_SwimAway = 0x80A5BDEC; // type:func -EnFish_Unique_SetupSwimIdle = 0x80A5BFB4; // type:func -EnFish_Unique_SwimIdle = 0x80A5C00C; // type:func -EnFish_Cutscene_FlopOnGround = 0x80A5C234; // type:func -EnFish_Cutscene_WiggleFlyingThroughAir = 0x80A5C364; // type:func -EnFish_UpdateCutscene = 0x80A5C400; // type:func -EnFish_OrdinaryUpdate = 0x80A5C5C0; // type:func -EnFish_RespawningUpdate = 0x80A5C744; // type:func -EnFish_Update = 0x80A5C858; // type:func -EnFish_Draw = 0x80A5C904; // type:func -BgSpot08Iceblock_SetupAction = 0x80A5CD30; // type:func -BgSpot08Iceblock_InitDynaPoly = 0x80A5CD3C; // type:func -BgSpot08Iceblock_CheckParams = 0x80A5CD94; // type:func -BgSpot08Iceblock_Bobbing = 0x80A5CDF4; // type:func -BgSpot08Iceblock_SinkUnderPlayer = 0x80A5CE50; // type:func -BgSpot08Iceblock_SetWaterline = 0x80A5CF00; // type:func -BgSpot08Iceblock_MultVectorScalar = 0x80A5CF20; // type:func -BgSpot08Iceblock_CrossProduct = 0x80A5CF54; // type:func -BgSpot08Iceblock_NormalizeVector = 0x80A5CFC8; // type:func -BgSpot08Iceblock_Roll = 0x80A5D064; // type:func -BgSpot08Iceblock_SpawnTwinFloe = 0x80A5D3D8; // type:func -BgSpot08Iceblock_Init = 0x80A5D4D8; // type:func -BgSpot08Iceblock_Destroy = 0x80A5D6CC; // type:func -BgSpot08Iceblock_SetupFloatNonrotating = 0x80A5D700; // type:func -BgSpot08Iceblock_FloatNonrotating = 0x80A5D724; // type:func -BgSpot08Iceblock_SetupFloatRotating = 0x80A5D778; // type:func -BgSpot08Iceblock_FloatRotating = 0x80A5D79C; // type:func -BgSpot08Iceblock_SetupFloatOrbitingTwins = 0x80A5D7FC; // type:func -BgSpot08Iceblock_FloatOrbitingTwins = 0x80A5D820; // type:func -BgSpot08Iceblock_SetupNoAction = 0x80A5D8F8; // type:func -BgSpot08Iceblock_Update = 0x80A5D918; // type:func -BgSpot08Iceblock_Draw = 0x80A5D9B4; // type:func -ItemEtcetera_SetupAction = 0x80A5DD70; // type:func -ItemEtcetera_Init = 0x80A5DD7C; // type:func -ItemEtcetera_Destroy = 0x80A5DEFC; // type:func -ItemEtcetera_WaitForObject = 0x80A5DF0C; // type:func -func_80B85824 = 0x80A5DF64; // type:func -func_80B858B4 = 0x80A5DFFC; // type:func -ItemEtcetera_SpawnSparkles = 0x80A5E0DC; // type:func -ItemEtcetera_MoveFireArrowDown = 0x80A5E1EC; // type:func -func_80B85B28 = 0x80A5E27C; // type:func -ItemEtcetera_UpdateFireArrow = 0x80A5E2C4; // type:func -ItemEtcetera_Update = 0x80A5E344; // type:func -ItemEtcetera_DrawThroughLens = 0x80A5E368; // type:func -ItemEtcetera_Draw = 0x80A5E3C0; // type:func -ArrowFire_SetupAction = 0x80A5E640; // type:func -ArrowFire_Init = 0x80A5E64C; // type:func -ArrowFire_Destroy = 0x80A5E6C8; // type:func -ArrowFire_Charge = 0x80A5E6EC; // type:func -func_80865ECC = 0x80A5E7E0; // type:func -ArrowFire_Hit = 0x80A5E838; // type:func -ArrowFire_Fly = 0x80A5EA04; // type:func -ArrowFire_Update = 0x80A5EB58; // type:func -ArrowFire_Draw = 0x80A5EBAC; // type:func -ArrowIce_SetupAction = 0x80A60520; // type:func -ArrowIce_Init = 0x80A6052C; // type:func -ArrowIce_Destroy = 0x80A605A8; // type:func -ArrowIce_Charge = 0x80A605CC; // type:func -func_80867E8C = 0x80A606C0; // type:func -ArrowIce_Hit = 0x80A60718; // type:func -ArrowIce_Fly = 0x80A608E4; // type:func -ArrowIce_Update = 0x80A60A38; // type:func -ArrowIce_Draw = 0x80A60A8C; // type:func -ArrowLight_SetupAction = 0x80A62420; // type:func -ArrowLight_Init = 0x80A6242C; // type:func -ArrowLight_Destroy = 0x80A624A8; // type:func -ArrowLight_Charge = 0x80A624CC; // type:func -func_80869E6C = 0x80A625C0; // type:func -ArrowLight_Hit = 0x80A62618; // type:func -ArrowLight_Fly = 0x80A627E4; // type:func -ArrowLight_Update = 0x80A62938; // type:func -ArrowLight_Draw = 0x80A6298C; // type:func -ObjKibako_SpawnCollectible = 0x80A64330; // type:func -ObjKibako_ApplyGravity = 0x80A64390; // type:func -ObjKibako_InitCollider = 0x80A643C4; // type:func -ObjKibako_Init = 0x80A6441C; // type:func -ObjKibako_Destroy = 0x80A64494; // type:func -ObjKibako_AirBreak = 0x80A644C0; // type:func -ObjKibako_WaterBreak = 0x80A64740; // type:func -ObjKibako_SetupIdle = 0x80A649C0; // type:func -ObjKibako_Idle = 0x80A649DC; // type:func -ObjKibako_SetupHeld = 0x80A64BD8; // type:func -ObjKibako_Held = 0x80A64C0C; // type:func -ObjKibako_SetupThrown = 0x80A64CD8; // type:func -ObjKibako_Thrown = 0x80A64D38; // type:func -ObjKibako_Update = 0x80A64E74; // type:func -ObjKibako_Draw = 0x80A64E98; // type:func -ObjTsubo_SpawnCollectible = 0x80A65030; // type:func -ObjTsubo_ApplyGravity = 0x80A65090; // type:func -ObjTsubo_SnapToFloor = 0x80A650C4; // type:func -ObjTsubo_InitCollider = 0x80A65160; // type:func -ObjTsubo_Init = 0x80A651B8; // type:func -ObjTsubo_Destroy = 0x80A65288; // type:func -ObjTsubo_AirBreak = 0x80A652B4; // type:func -ObjTsubo_WaterBreak = 0x80A6553C; // type:func -ObjTsubo_SetupWaitForObject = 0x80A657D4; // type:func -ObjTsubo_WaitForObject = 0x80A657E8; // type:func -ObjTsubo_SetupIdle = 0x80A6585C; // type:func -ObjTsubo_Idle = 0x80A65870; // type:func -ObjTsubo_SetupLiftedUp = 0x80A65A80; // type:func -ObjTsubo_LiftedUp = 0x80A65AC4; // type:func -ObjTsubo_SetupThrown = 0x80A65B4C; // type:func -ObjTsubo_Thrown = 0x80A65C14; // type:func -ObjTsubo_Update = 0x80A65DA8; // type:func -ObjTsubo_Draw = 0x80A65DCC; // type:func -EnWonderItem_Destroy = 0x80A66020; // type:func -EnWonderItem_DropCollectible = 0x80A66064; // type:func -EnWonderItem_Init = 0x80A661C0; // type:func -EnWonderItem_MultitagFree = 0x80A6650C; // type:func -EnWonderItem_ProximityDrop = 0x80A66654; // type:func -EnWonderItem_InteractSwitch = 0x80A666BC; // type:func -EnWonderItem_ProximitySwitch = 0x80A666F0; // type:func -EnWonderItem_MultitagOrdered = 0x80A6677C; // type:func -EnWonderItem_BombSoldier = 0x80A668D8; // type:func -EnWonderItem_RollDrop = 0x80A66968; // type:func -EnWonderItem_Update = 0x80A669DC; // type:func -EnIk_Destroy = 0x80A66D50; // type:func -EnIk_SetupAction = 0x80A66DD0; // type:func -EnIk_InitImpl = 0x80A66DDC; // type:func -EnIk_HandleBlocking = 0x80A67028; // type:func -EnIk_FindBreakableProp = 0x80A670B8; // type:func -EnIk_SetupStandUp = 0x80A67158; // type:func -EnIk_StandUp = 0x80A67204; // type:func -EnIk_SetupIdle = 0x80A672E4; // type:func -EnIk_Idle = 0x80A67374; // type:func -EnIk_SetupWalkOrRun = 0x80A674F4; // type:func -EnIk_WalkOrRun = 0x80A675EC; // type:func -EnIk_SetupVerticalAttack = 0x80A67874; // type:func -EnIk_VerticalAttack = 0x80A67904; // type:func -EnIk_SetupPullOutAxe = 0x80A67AB8; // type:func -EnIk_PullOutAxe = 0x80A67B58; // type:func -EnIk_SetupDoubleHorizontalAttack = 0x80A67C14; // type:func -EnIk_DoubleHorizontalAttack = 0x80A67CAC; // type:func -EnIk_SetupRecoverFromHorizontalAttack = 0x80A67E1C; // type:func -EnIk_RecoverFromHorizontalAttack = 0x80A67EA8; // type:func -EnIk_SetupSingleHorizontalAttack = 0x80A67EF0; // type:func -EnIk_SingleHorizontalAttack = 0x80A67F80; // type:func -EnIk_SetupStopAndBlock = 0x80A68040; // type:func -EnIk_StopAndBlock = 0x80A680CC; // type:func -EnIk_SetupReactToAttack = 0x80A681E0; // type:func -EnIk_ReactToAttack = 0x80A68300; // type:func -EnIk_SetupDie = 0x80A683DC; // type:func -EnIk_Die = 0x80A68488; // type:func -EnIk_UpdateDamage = 0x80A68684; // type:func -EnIk_UpdateEnemy = 0x80A689F0; // type:func -EnIk_SetPrimEnvColors = 0x80A68C08; // type:func -EnIk_OverrideLimbDrawEnemy = 0x80A68CC0; // type:func -EnIk_PostLimbDrawEnemy = 0x80A68D80; // type:func -EnIk_DrawEnemy = 0x80A69194; // type:func -EnIk_StartMinibossBgm = 0x80A695CC; // type:func -EnIk_UpdateAction2Sfx = 0x80A695EC; // type:func -EnIk_PlayAxeSpawnSfx = 0x80A697B8; // type:func -EnIk_SpawnAxeSmoke = 0x80A69808; // type:func -EnIk_UpdateBgCheckInfo = 0x80A69A14; // type:func -EnIk_UpdateSkelAnime = 0x80A69A5C; // type:func -EnIk_GetCue = 0x80A69A80; // type:func -EnIk_SetStartPosRotFromCue = 0x80A69AA8; // type:func -EnIk_GetAnimCurFrame = 0x80A69B28; // type:func -EnIk_SetupCsAction0 = 0x80A69B34; // type:func -EnIk_SetupCsAction1 = 0x80A69B48; // type:func -EnIk_SetupCsAction2 = 0x80A69BD4; // type:func -EnIk_HandleEnemyChange = 0x80A69C54; // type:func -EnIk_PlayArmorFallSfx = 0x80A69C94; // type:func -EnIk_PlayDeathSfx = 0x80A69CDC; // type:func -EnIk_SetupCsAction3 = 0x80A69D50; // type:func -EnIk_SetupCsAction4 = 0x80A69E28; // type:func -EnIk_SetupCsAction5 = 0x80A69E64; // type:func -EnIk_CsAction3 = 0x80A69E80; // type:func -EnIk_CsAction4 = 0x80A69EB8; // type:func -EnIk_CsAction5 = 0x80A69EF8; // type:func -EnIk_OverrideLimbDrawDefeat = 0x80A69F34; // type:func -EnIk_PostLimbDrawDefeat = 0x80A69FA0; // type:func -EnIk_CsDrawDefeat = 0x80A6A1EC; // type:func -EnIk_HandleCsCues = 0x80A6A350; // type:func -EnIk_CsAction0 = 0x80A6A44C; // type:func -EnIk_CsAction1 = 0x80A6A46C; // type:func -EnIk_CsAction2 = 0x80A6A4A4; // type:func -EnIk_UpdateCutscene = 0x80A6A508; // type:func -EnIk_OverrideLimbDrawIntro = 0x80A6A550; // type:func -EnIk_PostLimbDrawIntro = 0x80A6A5D4; // type:func -EnIk_CsDrawNothing = 0x80A6A7C0; // type:func -EnIk_CsDrawIntro = 0x80A6A7D0; // type:func -EnIk_DrawCutscene = 0x80A6A934; // type:func -EnIk_CsInit = 0x80A6A97C; // type:func -EnIk_ChangeToEnemy = 0x80A6A9EC; // type:func -EnIk_StartDefeatCutscene = 0x80A6AA58; // type:func -EnIk_Init = 0x80A6AAEC; // type:func -DemoIk_Destroy = 0x80A6B3B0; // type:func -DemoIk_BgCheck = 0x80A6B3C0; // type:func -DemoIk_UpdateSkelAnime = 0x80A6B408; // type:func -DemoIk_GetCue = 0x80A6B42C; // type:func -DemoIk_CheckForCue = 0x80A6B454; // type:func -DemoIk_SetMove = 0x80A6B494; // type:func -DemoIk_EndMove = 0x80A6B4D4; // type:func -DemoIk_GetCurFrame = 0x80A6B4E8; // type:func -DemoIk_SetColors = 0x80A6B4F4; // type:func -DemoIk_GetCueChannel = 0x80A6B598; // type:func -DemoIk_Type1PlaySfx = 0x80A6B5C4; // type:func -DemoIk_SpawnDeadDb = 0x80A6B6C4; // type:func -DemoIk_MoveToStartPos = 0x80A6B868; // type:func -DemoIk_Type1Init = 0x80A6B8E8; // type:func -func_8098393C = 0x80A6BA04; // type:func -func_8098394C = 0x80A6BA18; // type:func -func_809839AC = 0x80A6BA7C; // type:func -func_809839D0 = 0x80A6BAA4; // type:func -DemoIk_Type1Action0 = 0x80A6BB64; // type:func -DemoIk_Type1Action1 = 0x80A6BB84; // type:func -DemoIk_Type1Action2 = 0x80A6BBBC; // type:func -DemoIk_Type1PostLimbDraw = 0x80A6BC24; // type:func -DemoIk_Type1Draw = 0x80A6BD20; // type:func -DemoIk_Type2Init = 0x80A6BE78; // type:func -DemoIk_Type2PlaySfxOnFrame = 0x80A6BF80; // type:func -DemoIk_Type2PlaySfx = 0x80A6BFE0; // type:func -func_80983FDC = 0x80A6C030; // type:func -func_80983FEC = 0x80A6C044; // type:func -func_8098402C = 0x80A6C084; // type:func -func_80984048 = 0x80A6C0A4; // type:func -DemoIk_Type2Action0 = 0x80A6C16C; // type:func -DemoIk_Type2Action1 = 0x80A6C18C; // type:func -DemoIk_Type2Action2 = 0x80A6C1AC; // type:func -DemoIk_Type2OverrideLimbDraw = 0x80A6C1E8; // type:func -DemoIk_Type2PostLimbDraw = 0x80A6C244; // type:func -DemoIk_Type2Draw = 0x80A6C414; // type:func -DemoIk_Update = 0x80A6C578; // type:func -DemoIk_DrawNothing = 0x80A6C5C0; // type:func -DemoIk_Draw = 0x80A6C5D0; // type:func -DemoIk_Init = 0x80A6C618; // type:func -EnSkj_ChangeAnim = 0x80A6C8C0; // type:func -EnSkj_SetupAction = 0x80A6C948; // type:func -EnSkj_CalculateCenter = 0x80A6C9A0; // type:func -EnSkj_SetNaviId = 0x80A6CA38; // type:func -EnSkj_Init = 0x80A6CABC; // type:func -EnSkj_Destroy = 0x80A6CE08; // type:func -EnSkj_RangeCheck = 0x80A6CE34; // type:func -EnSkj_GetItemXzRange = 0x80A6CEB0; // type:func -EnSkj_GetItemYRange = 0x80A6CEF8; // type:func -EnSkj_ShootNeedle = 0x80A6CF24; // type:func -EnSkj_SpawnBlood = 0x80A6D03C; // type:func -EnSkj_CollisionCheck = 0x80A6D194; // type:func -func_80AFEDF8 = 0x80A6D350; // type:func -EnSkj_Backflip = 0x80A6D3DC; // type:func -EnSkj_Fade = 0x80A6D424; // type:func -EnSkj_SetupWaitToShootNeedle = 0x80A6D4B4; // type:func -EnSkj_WaitToShootNeedle = 0x80A6D4F0; // type:func -EnSkj_SetupResetFight = 0x80A6D590; // type:func -EnSkj_SariasSongKidIdle = 0x80A6D5D4; // type:func -EnSkj_SetupDie = 0x80A6D6CC; // type:func -EnSkj_WaitForDeathAnim = 0x80A6D700; // type:func -func_80AFF1F0 = 0x80A6D754; // type:func -EnSkj_PickNextFightAction = 0x80A6D788; // type:func -func_80AFF2A0 = 0x80A6D808; // type:func -EnSkj_WaitForLandAnim = 0x80A6D84C; // type:func -func_80AFF334 = 0x80A6D8A0; // type:func -EnSkj_ResetFight = 0x80A6D8EC; // type:func -EnSkj_SetupStand = 0x80A6D93C; // type:func -EnSkj_Fight = 0x80A6D990; // type:func -EnSkj_SetupNeedleRecover = 0x80A6DB5C; // type:func -EnSkj_NeedleRecover = 0x80A6DB90; // type:func -EnSkj_SetupSpawnDeathEffect = 0x80A6DBCC; // type:func -EnSkj_SpawnDeathEffect = 0x80A6DBF4; // type:func -EnSkj_SetupWaitInRange = 0x80A6DD0C; // type:func -EnSkj_WaitInRange = 0x80A6DD44; // type:func -EnSkj_SetupWaitForSong = 0x80A6DF58; // type:func -EnSkj_WaitForSong = 0x80A6DF7C; // type:func -EnSkj_SetupAfterSong = 0x80A6E250; // type:func -EnSkj_AfterSong = 0x80A6E284; // type:func -EnSkj_SetupTalk = 0x80A6E2D8; // type:func -EnSkj_SariaSongTalk = 0x80A6E2F8; // type:func -func_80AFFE24 = 0x80A6E39C; // type:func -func_80AFFE44 = 0x80A6E3BC; // type:func -EnSkj_SetupPostSariasSong = 0x80A6E434; // type:func -EnSkj_ChangeModeAfterSong = 0x80A6E454; // type:func -EnSkj_SetupMaskTrade = 0x80A6E4BC; // type:func -EnSkj_StartMaskTrade = 0x80A6E4DC; // type:func -EnSkj_JumpFromStump = 0x80A6E544; // type:func -EnSkj_WaitForLanding = 0x80A6E5A8; // type:func -EnSkj_SetupWaitForLandAnimFinish = 0x80A6E5F8; // type:func -EnSkj_WaitForLandAnimFinish = 0x80A6E62C; // type:func -EnSkj_SetupWalkToPlayer = 0x80A6E680; // type:func -EnSkj_WalkToPlayer = 0x80A6E6C4; // type:func -EnSkj_SetupAskForMask = 0x80A6E760; // type:func -EnSkj_AskForMask = 0x80A6E7A8; // type:func -EnSkj_SetupTakeMask = 0x80A6E840; // type:func -EnSkj_TakeMask = 0x80A6E878; // type:func -EnSkj_SetupWaitForMaskTextClear = 0x80A6E910; // type:func -EnSkj_WaitForMaskTextClear = 0x80A6E930; // type:func -EnSkj_SetupWrongSong = 0x80A6E998; // type:func -EnSkj_WrongSong = 0x80A6E9D0; // type:func -EnSkj_SetupWaitForTextClear = 0x80A6EA24; // type:func -EnSkj_SariasSongWaitForTextClear = 0x80A6EA44; // type:func -EnSkj_OcarinaGameSetupWaitForPlayer = 0x80A6EABC; // type:func -EnSkj_OcarinaGameWaitForPlayer = 0x80A6EAFC; // type:func -EnSkj_IsLeavingGame = 0x80A6EB38; // type:func -EnSkj_SetupIdle = 0x80A6EB88; // type:func -EnSkj_Appear = 0x80A6EBBC; // type:func -EnSkj_OcarinaGameIdle = 0x80A6EBE4; // type:func -EnSkj_SetupPlayOcarinaGame = 0x80A6EC30; // type:func -EnSkj_PlayOcarinaGame = 0x80A6EC64; // type:func -EnSkj_SetupLeaveOcarinaGame = 0x80A6ECB0; // type:func -EnSkj_LeaveOcarinaGame = 0x80A6ECF8; // type:func -EnSkj_Update = 0x80A6ED40; // type:func -EnSkj_SariasSongShortStumpUpdate = 0x80A6EF24; // type:func -EnSkj_TurnPlayer = 0x80A6EF4C; // type:func -EnSkj_SetupWaitForOcarina = 0x80A6EF98; // type:func -EnSkj_WaitForOcarina = 0x80A6F054; // type:func -EnSkj_StartOcarinaMinigame = 0x80A6F0FC; // type:func -EnSkj_WaitForPlayback = 0x80A6F188; // type:func -EnSkj_FailedMiniGame = 0x80A6F3F8; // type:func -EnSkj_WaitForNextRound = 0x80A6F438; // type:func -EnSkj_OfferNextRound = 0x80A6F488; // type:func -EnSkj_WaitForOfferResponse = 0x80A6F4C4; // type:func -EnSkj_WonOcarinaMiniGame = 0x80A6F56C; // type:func -EnSkj_WaitToGiveReward = 0x80A6F5AC; // type:func -EnSkj_GiveOcarinaGameReward = 0x80A6F634; // type:func -EnSkj_FinishOcarinaGameRound = 0x80A6F6A8; // type:func -EnSkj_CleanupOcarinaGame = 0x80A6F744; // type:func -EnSkj_OcarinaMinigameShortStumpUpdate = 0x80A6F7C0; // type:func -EnSkj_OverrideLimbDraw = 0x80A6F844; // type:func -EnSkj_PostLimbDraw = 0x80A6F860; // type:func -EnSkj_TranslucentDL = 0x80A6F930; // type:func -EnSkj_OpaqueDL = 0x80A6F988; // type:func -EnSkj_Draw = 0x80A6F9C0; // type:func -EnSkjneedle_Init = 0x80A70210; // type:func -EnSkjneedle_Destroy = 0x80A702A8; // type:func -EnSkjNeedle_CollisionCheck = 0x80A702D4; // type:func -EnSkjneedle_Update = 0x80A70304; // type:func -EnSkjneedle_Draw = 0x80A703F4; // type:func -EnGSwitch_Init = 0x80A70520; // type:func -EnGSwitch_Destroy = 0x80A707B8; // type:func -EnGSwitch_Break = 0x80A707E4; // type:func -EnGSwitch_WaitForObject = 0x80A7098C; // type:func -EnGSwitch_SilverRupeeTracker = 0x80A70A24; // type:func -EnGSwitch_SilverRupeeIdle = 0x80A70B08; // type:func -EnGSwitch_SilverRupeeCollected = 0x80A70BF0; // type:func -EnGSwitch_GalleryRupee = 0x80A70CD4; // type:func -EnGSwitch_ArcheryPot = 0x80A71074; // type:func -EnGSwitch_Kill = 0x80A7135C; // type:func -EnGSwitch_Update = 0x80A7138C; // type:func -EnGSwitch_DrawPot = 0x80A714C0; // type:func -EnGSwitch_DrawRupee = 0x80A71554; // type:func -EnGSwitch_SpawnEffects = 0x80A71684; // type:func -EnGSwitch_UpdateEffects = 0x80A71798; // type:func -EnGSwitch_DrawEffects = 0x80A71958; // type:func -DemoExt_Destroy = 0x80A71D40; // type:func -DemoExt_Init = 0x80A71D50; // type:func -DemoExt_PlayVortexSFX = 0x80A71E08; // type:func -DemoExt_GetCue = 0x80A71E90; // type:func -DemoExt_SetupWait = 0x80A71EB8; // type:func -DemoExt_SetupMaintainVortex = 0x80A71EC8; // type:func -DemoExt_SetupDispellVortex = 0x80A71F54; // type:func -DemoExt_FinishClosing = 0x80A71F6C; // type:func -DemoExt_HandleCues = 0x80A71FD8; // type:func -DemoExt_SetScrollAndRotation = 0x80A72084; // type:func -DemoExt_SetColorsAndScales = 0x80A720D4; // type:func -DemoExt_Wait = 0x80A72210; // type:func -DemoExt_MaintainVortex = 0x80A72230; // type:func -DemoExt_DispellVortex = 0x80A7226C; // type:func -DemoExt_Update = 0x80A722AC; // type:func -DemoExt_DrawNothing = 0x80A722F4; // type:func -DemoExt_DrawVortex = 0x80A72304; // type:func -DemoExt_Draw = 0x80A72584; // type:func -DemoShd_SetupAction = 0x80A72690; // type:func -DemoShd_Init = 0x80A7269C; // type:func -DemoShd_Destroy = 0x80A726EC; // type:func -func_80991298 = 0x80A726FC; // type:func -DemoShd_Update = 0x80A72854; // type:func -DemoShd_Draw = 0x80A72878; // type:func -EnDns_Init = 0x80A74AA0; // type:func -EnDns_Destroy = 0x80A74C14; // type:func -EnDns_ChangeAnim = 0x80A74C40; // type:func -EnDns_CanBuyDekuNuts = 0x80A74CC8; // type:func -EnDns_CanBuyDekuSticks = 0x80A74D80; // type:func -EnDns_CanBuyPrice = 0x80A74E38; // type:func -EnDns_CanBuyDekuSeeds = 0x80A74E68; // type:func -EnDns_CanBuyDekuShield = 0x80A74F30; // type:func -EnDns_CanBuyBombs = 0x80A74F84; // type:func -EnDns_CanBuyArrows = 0x80A75024; // type:func -EnDns_CanBuyBottle = 0x80A750D4; // type:func -EnDns_PayPrice = 0x80A7512C; // type:func -EnDns_PayForDekuNuts = 0x80A75160; // type:func -EnDns_PayForHeartPiece = 0x80A75194; // type:func -EnDns_PayForBombs = 0x80A751DC; // type:func -EnDns_PayForArrows = 0x80A75210; // type:func -EnDns_PayForDekuStickUpgrade = 0x80A75244; // type:func -EnDns_PayForDekuNutUpgrade = 0x80A7528C; // type:func -EnDns_SetupIdle = 0x80A752D4; // type:func -EnDns_Idle = 0x80A75318; // type:func -EnDns_Talk = 0x80A753EC; // type:func -EnDns_OfferSaleItem = 0x80A75524; // type:func -EnDns_SetupSale = 0x80A7563C; // type:func -EnDns_Sale = 0x80A756A8; // type:func -EnDns_SetupBurrow = 0x80A756F4; // type:func -EnDns_SetupNoSaleBurrow = 0x80A757E8; // type:func -EnDns_Burrow = 0x80A75860; // type:func -EnDns_PostBurrow = 0x80A758DC; // type:func -EnDns_Update = 0x80A759E0; // type:func -EnDns_Draw = 0x80A75AD0; // type:func -ElfMsg_SetupAction = 0x80A75E30; // type:func -ElfMsg_KillCheck = 0x80A75E3C; // type:func -ElfMsg_Init = 0x80A75F74; // type:func -ElfMsg_Destroy = 0x80A76068; // type:func -ElfMsg_GetMessageId = 0x80A76078; // type:func -ElfMsg_CallNaviCuboid = 0x80A760A4; // type:func -ElfMsg_WithinXZDistance = 0x80A76174; // type:func -ElfMsg_CallNaviCylinder = 0x80A761C8; // type:func -ElfMsg_Update = 0x80A76290; // type:func -EnHonotrap_FlameCollisionCheck = 0x80A76420; // type:func -EnHonotrap_GetNormal = 0x80A764B4; // type:func -EnHonotrap_InitEye = 0x80A76548; // type:func -EnHonotrap_InitFlame = 0x80A766E4; // type:func -EnHonotrap_Init = 0x80A76824; // type:func -EnHonotrap_Destroy = 0x80A7687C; // type:func -EnHonotrap_SetupEyeIdle = 0x80A768C8; // type:func -EnHonotrap_EyeIdle = 0x80A768E4; // type:func -EnHonotrap_SetupEyeOpen = 0x80A7699C; // type:func -EnHonotrap_EyeOpen = 0x80A769F0; // type:func -EnHonotrap_SetupEyeAttack = 0x80A76AC0; // type:func -EnHonotrap_EyeAttack = 0x80A76AD8; // type:func -EnHonotrap_SetupEyeClose = 0x80A76B08; // type:func -EnHonotrap_EyeClose = 0x80A76B1C; // type:func -EnHonotrap_SetupFlameGrow = 0x80A76B68; // type:func -EnHonotrap_FlameGrow = 0x80A76B7C; // type:func -EnHonotrap_SetupFlameDrop = 0x80A76C10; // type:func -EnHonotrap_FlameDrop = 0x80A76C78; // type:func -EnHonotrap_SetupFlameMove = 0x80A76DBC; // type:func -EnHonotrap_FlameMove = 0x80A76E48; // type:func -EnHonotrap_SetupFlameChase = 0x80A77014; // type:func -EnHonotrap_FlameChase = 0x80A77054; // type:func -EnHonotrap_SetupFlameVanish = 0x80A77208; // type:func -EnHonotrap_FlameVanish = 0x80A7721C; // type:func -EnHonotrap_Update = 0x80A772AC; // type:func -EnHonotrap_DrawEye = 0x80A773F4; // type:func -EnHonotrap_DrawFlame = 0x80A774E4; // type:func -EnHonotrap_Draw = 0x80A7767C; // type:func -EnTuboTrap_Init = 0x80A77980; // type:func -EnTuboTrap_Destroy = 0x80A77A04; // type:func -EnTuboTrap_DropCollectible = 0x80A77A30; // type:func -EnTuboTrap_SpawnEffectsOnLand = 0x80A77A90; // type:func -EnTuboTrap_SpawnEffectsInWater = 0x80A77D04; // type:func -EnTuboTrap_HandleImpact = 0x80A77F84; // type:func -EnTuboTrap_WaitForProximity = 0x80A781AC; // type:func -EnTuboTrap_Levitate = 0x80A782B8; // type:func -EnTuboTrap_Fly = 0x80A78344; // type:func -EnTuboTrap_Update = 0x80A78414; // type:func -EnTuboTrap_Draw = 0x80A784D4; // type:func -ObjIcePoly_Init = 0x80A78620; // type:func -ObjIcePoly_Destroy = 0x80A787E0; // type:func -ObjIcePoly_Idle = 0x80A78830; // type:func -ObjIcePoly_Melt = 0x80A78A60; // type:func -ObjIcePoly_Update = 0x80A78D18; // type:func -ObjIcePoly_Draw = 0x80A78D3C; // type:func -BgSpot03Taki_ApplyOpeningAlpha = 0x80A78FD0; // type:func -BgSpot03Taki_Init = 0x80A7930C; // type:func -BgSpot03Taki_Destroy = 0x80A793BC; // type:func -BgSpot03Taki_HandleWaterfallState = 0x80A793F0; // type:func -BgSpot03Taki_Update = 0x80A795C4; // type:func -BgSpot03Taki_Draw = 0x80A795E8; // type:func -BgSpot07Taki_Init = 0x80A798F0; // type:func -BgSpot07Taki_Destroy = 0x80A7999C; // type:func -BgSpot07Taki_DoNothing = 0x80A799D0; // type:func -BgSpot07Taki_Update = 0x80A799E0; // type:func -BgSpot07Taki_Draw = 0x80A79A04; // type:func -EnFz_Init = 0x80A79EE0; // type:func -EnFz_Destroy = 0x80A7A060; // type:func -EnFz_UpdateTargetPos = 0x80A7A0B0; // type:func -EnFz_ReachedTarget = 0x80A7A1D0; // type:func -EnFz_Damaged = 0x80A7A220; // type:func -EnFz_SpawnIceSmokeHiddenState = 0x80A7A414; // type:func -EnFz_SpawnIceSmokeGrowingState = 0x80A7A420; // type:func -EnFz_SpawnIceSmokeActiveState = 0x80A7A500; // type:func -EnFz_ApplyDamage = 0x80A7A5C4; // type:func -EnFz_SetYawTowardsPlayer = 0x80A7A82C; // type:func -EnFz_SetupDisappear = 0x80A7A86C; // type:func -EnFz_Disappear = 0x80A7A89C; // type:func -EnFz_SetupWait = 0x80A7A91C; // type:func -EnFz_Wait = 0x80A7A95C; // type:func -EnFz_SetupAppear = 0x80A7A9AC; // type:func -EnFz_Appear = 0x80A7A9D8; // type:func -EnFz_SetupAimForMove = 0x80A7AA68; // type:func -EnFz_AimForMove = 0x80A7AAAC; // type:func -EnFz_SetupMoveTowardsPlayer = 0x80A7AAE8; // type:func -EnFz_MoveTowardsPlayer = 0x80A7AB1C; // type:func -EnFz_SetupAimForFreeze = 0x80A7AB58; // type:func -EnFz_AimForFreeze = 0x80A7AB88; // type:func -EnFz_SetupBlowSmoke = 0x80A7ABC4; // type:func -EnFz_BlowSmoke = 0x80A7ABFC; // type:func -EnFz_SetupDespawn = 0x80A7ADE8; // type:func -EnFz_Despawn = 0x80A7AE88; // type:func -EnFz_SetupMelt = 0x80A7AEB8; // type:func -EnFz_Melt = 0x80A7AEFC; // type:func -EnFz_SetupBlowSmokeStationary = 0x80A7AFC4; // type:func -EnFz_BlowSmokeStationary = 0x80A7B008; // type:func -EnFz_Update = 0x80A7B200; // type:func -EnFz_Draw = 0x80A7B390; // type:func -EnFz_SpawnIceSmokeNoFreeze = 0x80A7B54C; // type:func -EnFz_SpawnIceSmokeFreeze = 0x80A7B5F0; // type:func -EnFz_UpdateIceSmoke = 0x80A7B6AC; // type:func -EnFz_DrawEffects = 0x80A7B998; // type:func -EnPoRelay_Init = 0x80A7BEF0; // type:func -EnPoRelay_Destroy = 0x80A7C078; // type:func -EnPoRelay_SetupIdle = 0x80A7C0C0; // type:func -EnPoRelay_Vec3sToVec3f = 0x80A7C0FC; // type:func -EnPoRelay_SetupRace = 0x80A7C140; // type:func -EnPoRelay_SetupEndRace = 0x80A7C208; // type:func -EnPoRelay_CorrectY = 0x80A7C248; // type:func -EnPoRelay_Idle = 0x80A7C2F0; // type:func -EnPoRelay_Talk = 0x80A7C3AC; // type:func -EnPoRelay_Race = 0x80A7C420; // type:func -EnPoRelay_EndRace = 0x80A7C934; // type:func -EnPoRelay_Talk2 = 0x80A7C9F4; // type:func -EnPoRelay_DisappearAndReward = 0x80A7CACC; // type:func -EnPoRelay_Update = 0x80A7CF98; // type:func -EnPoRelay_PostLimbDraw = 0x80A7D08C; // type:func -EnPoRelay_Draw = 0x80A7D280; // type:func -BgRelayObjects_Init = 0x80A7D600; // type:func -BgRelayObjects_Destroy = 0x80A7D840; // type:func -func_808A90F4 = 0x80A7D8AC; // type:func -func_808A91AC = 0x80A7D968; // type:func -func_808A9234 = 0x80A7D9F0; // type:func -BgRelayObjects_DoNothing = 0x80A7DADC; // type:func -func_808A932C = 0x80A7DAEC; // type:func -func_808A939C = 0x80A7DB5C; // type:func -BgRelayObjects_Update = 0x80A7DC30; // type:func -BgRelayObjects_Draw = 0x80A7DC54; // type:func -EnDivingGame_Init = 0x80A7DDB0; // type:func -EnDivingGame_Destroy = 0x80A7DECC; // type:func -EnDivingGame_SpawnRuppy = 0x80A7DF0C; // type:func -EnDivingGame_HasMinigameFinished = 0x80A7E038; // type:func -func_809EDCB0 = 0x80A7E1E4; // type:func -EnDivingGame_Talk = 0x80A7E280; // type:func -EnDivingGame_HandlePlayChoice = 0x80A7E410; // type:func -func_809EE048 = 0x80A7E57C; // type:func -func_809EE0FC = 0x80A7E630; // type:func -func_809EE194 = 0x80A7E6C8; // type:func -EnDivingGame_SetupRupeeThrow = 0x80A7E728; // type:func -EnDivingGame_RupeeThrow = 0x80A7E93C; // type:func -EnDivingGame_SetupUnderwaterViewCs = 0x80A7EBFC; // type:func -func_809EE780 = 0x80A7ECB4; // type:func -func_809EE800 = 0x80A7ED34; // type:func -func_809EE8F0 = 0x80A7EE24; // type:func -func_809EE96C = 0x80A7EEA4; // type:func -func_809EEA00 = 0x80A7EF38; // type:func -func_809EEA90 = 0x80A7EFC8; // type:func -func_809EEAF8 = 0x80A7F034; // type:func -EnDivingGame_Update = 0x80A7F0C4; // type:func -EnDivingGame_EmptyDList = 0x80A7F2F0; // type:func -EnDivingGame_OverrideLimbDraw = 0x80A7F314; // type:func -EnDivingGame_Draw = 0x80A7F474; // type:func -EnKusa_SetupAction = 0x80A7F760; // type:func -EnKusa_SnapToFloor = 0x80A7F770; // type:func -EnKusa_DropCollectible = 0x80A7F814; // type:func -EnKusa_UpdateVelY = 0x80A7F8E0; // type:func -EnKusa_RandScaleVecToZero = 0x80A7F914; // type:func -EnKusa_SetScaleSmall = 0x80A7F998; // type:func -EnKusa_SpawnFragments = 0x80A7F9BC; // type:func -EnKusa_SpawnBugs = 0x80A7FD14; // type:func -EnKusa_InitCollider = 0x80A7FDD0; // type:func -EnKusa_Init = 0x80A7FE28; // type:func -EnKusa_Destroy = 0x80A7FF50; // type:func -EnKusa_SetupWaitForObject = 0x80A7FF7C; // type:func -EnKusa_WaitForObject = 0x80A7FFA0; // type:func -EnKusa_SetupMain = 0x80A80030; // type:func -EnKusa_Main = 0x80A80068; // type:func -EnKusa_SetupLiftedUp = 0x80A80230; // type:func -EnKusa_LiftedUp = 0x80A8026C; // type:func -EnKusa_SetupFall = 0x80A8034C; // type:func -EnKusa_Fall = 0x80A803B8; // type:func -EnKusa_SetupCut = 0x80A80648; // type:func -EnKusa_CutWaitRegrow = 0x80A80698; // type:func -EnKusa_DoNothing = 0x80A806CC; // type:func -EnKusa_SetupUprootedWaitRegrow = 0x80A806DC; // type:func -EnKusa_UprootedWaitRegrow = 0x80A80748; // type:func -EnKusa_SetupRegrow = 0x80A807AC; // type:func -EnKusa_Regrow = 0x80A80804; // type:func -EnKusa_Update = 0x80A8089C; // type:func -EnKusa_Draw = 0x80A80900; // type:func -ObjBean_InitCollider = 0x80A80C40; // type:func -ObjBean_InitDynaPoly = 0x80A80C98; // type:func -ObjBean_FindFloor = 0x80A80CF0; // type:func -func_80B8EBC8 = 0x80A80D58; // type:func -ObjBean_UpdatePosition = 0x80A80D78; // type:func -func_80B8EDF4 = 0x80A80F88; // type:func -func_80B8EE24 = 0x80A80FB8; // type:func -ObjBean_Move = 0x80A81090; // type:func -ObjBean_SetDrawMode = 0x80A810C0; // type:func -ObjBean_SetupPathCount = 0x80A810E4; // type:func -ObjBean_SetupPath = 0x80A81124; // type:func -ObjBean_FollowPath = 0x80A811A0; // type:func -ObjBean_CheckForHorseTrample = 0x80A81448; // type:func -ObjBean_Break = 0x80A814D8; // type:func -ObjBean_UpdateLeaves = 0x80A81750; // type:func -ObjBean_SetupLeavesStill = 0x80A8180C; // type:func -ObjBean_LeavesStill = 0x80A8187C; // type:func -ObjBean_SetupShakeLeaves = 0x80A818C0; // type:func -ObjBean_ShakeLeaves = 0x80A81938; // type:func -ObjBean_SetupShakeLeavesFast = 0x80A819BC; // type:func -ObjBean_ShakeLeavesFast = 0x80A81A00; // type:func -ObjBean_SetupGrow = 0x80A81A88; // type:func -ObjBean_Grow = 0x80A81A9C; // type:func -ObjBean_SetupFlattenLeaves = 0x80A81B00; // type:func -ObjBean_FlattenLeaves = 0x80A81B1C; // type:func -ObjBean_SetupGrown = 0x80A81B98; // type:func -ObjBean_Grown = 0x80A81BDC; // type:func -ObjBean_Init = 0x80A81C38; // type:func -ObjBean_Destroy = 0x80A81DF4; // type:func -ObjBean_SetupWaitForBean = 0x80A81E70; // type:func -ObjBean_WaitForBean = 0x80A81EA8; // type:func -func_80B8FE00 = 0x80A81F24; // type:func -func_80B8FE3C = 0x80A81F5C; // type:func -func_80B8FE6C = 0x80A81F8C; // type:func -func_80B8FEAC = 0x80A81FCC; // type:func -func_80B8FF50 = 0x80A82070; // type:func -func_80B8FF8C = 0x80A820A8; // type:func -func_80B90010 = 0x80A8212C; // type:func -func_80B90050 = 0x80A82168; // type:func -ObjBean_SetupWaitForWater = 0x80A82228; // type:func -ObjBean_WaitForWater = 0x80A82270; // type:func -ObjBean_SetupGrowWaterPhase1 = 0x80A82368; // type:func -ObjBean_GrowWaterPhase1 = 0x80A823A8; // type:func -ObjBean_SetupGrowWaterPhase2 = 0x80A823EC; // type:func -ObjBean_GrowWaterPhase2 = 0x80A82428; // type:func -ObjBean_SetupGrowWaterPhase3 = 0x80A824D8; // type:func -ObjBean_GrowWaterPhase3 = 0x80A82510; // type:func -ObjBean_SetupGrowWaterPhase4 = 0x80A82624; // type:func -ObjBean_GrowWaterPhase4 = 0x80A8265C; // type:func -ObjBean_SetupGrowWaterPhase5 = 0x80A826F8; // type:func -ObjBean_GrowWaterPhase5 = 0x80A82730; // type:func -ObjBean_SetupWaitForPlayer = 0x80A82788; // type:func -ObjBean_WaitForPlayer = 0x80A827B4; // type:func -ObjBean_SetupFly = 0x80A82828; // type:func -ObjBean_Fly = 0x80A8286C; // type:func -ObjBean_SetupWaitForStepOff = 0x80A8299C; // type:func -ObjBean_WaitForStepOff = 0x80A829C8; // type:func -func_80B908EC = 0x80A82A08; // type:func -func_80B90918 = 0x80A82A34; // type:func -func_80B90970 = 0x80A82A90; // type:func -func_80B909B0 = 0x80A82AD0; // type:func -func_80B909F8 = 0x80A82B18; // type:func -func_80B90A34 = 0x80A82B50; // type:func -ObjBean_Update = 0x80A82BF0; // type:func -ObjBean_DrawSoftSoilSpot = 0x80A82D80; // type:func -ObjBean_DrawBeanstalk = 0x80A82E08; // type:func -ObjBean_Draw = 0x80A82E94; // type:func -ObjBombiwa_InitCollision = 0x80A833D0; // type:func -ObjBombiwa_Init = 0x80A83428; // type:func -ObjBombiwa_Destroy = 0x80A834F4; // type:func -ObjBombiwa_Break = 0x80A83520; // type:func -ObjBombiwa_Update = 0x80A83720; // type:func -ObjBombiwa_Draw = 0x80A83830; // type:func -ObjSwitch_RotateY = 0x80A83940; // type:func -ObjSwitch_InitDynaPoly = 0x80A839C0; // type:func -ObjSwitch_InitJntSphCollider = 0x80A83A18; // type:func -ObjSwitch_InitTrisCollider = 0x80A83AB4; // type:func -ObjSwitch_SpawnIce = 0x80A83BD4; // type:func -ObjSwitch_SetOn = 0x80A83C48; // type:func -ObjSwitch_SetOff = 0x80A83CF4; // type:func -ObjSwitch_UpdateTwoTexScrollXY = 0x80A83D7C; // type:func -ObjSwitch_Init = 0x80A83DC4; // type:func -ObjSwitch_Destroy = 0x80A8405C; // type:func -ObjSwitch_FloorUpInit = 0x80A84100; // type:func -ObjSwitch_FloorUp = 0x80A84120; // type:func -ObjSwitch_FloorPressInit = 0x80A84290; // type:func -ObjSwitch_FloorPress = 0x80A842AC; // type:func -ObjSwitch_FloorDownInit = 0x80A8436C; // type:func -ObjSwitch_FloorDown = 0x80A84394; // type:func -ObjSwitch_FloorReleaseInit = 0x80A844E0; // type:func -ObjSwitch_FloorRelease = 0x80A844FC; // type:func -ObjSwitch_EyeIsHit = 0x80A845E0; // type:func -ObjSwitch_EyeFrozenInit = 0x80A84650; // type:func -ObjSwitch_EyeInit = 0x80A84664; // type:func -ObjSwitch_EyeOpenInit = 0x80A846BC; // type:func -ObjSwitch_EyeOpen = 0x80A846D4; // type:func -ObjSwitch_EyeClosingInit = 0x80A84740; // type:func -ObjSwitch_EyeClosing = 0x80A8475C; // type:func -ObjSwitch_EyeClosedInit = 0x80A847D8; // type:func -ObjSwitch_EyeClosed = 0x80A847F4; // type:func -ObjSwitch_EyeOpeningInit = 0x80A848B4; // type:func -ObjSwitch_EyeOpening = 0x80A848D0; // type:func -ObjSwitch_CrystalOffInit = 0x80A84960; // type:func -ObjSwitch_CrystalOff = 0x80A8498C; // type:func -ObjSwitch_CrystalTurnOnInit = 0x80A84AC4; // type:func -ObjSwitch_CrystalTurnOn = 0x80A84AE0; // type:func -ObjSwitch_CrystalOnInit = 0x80A84B68; // type:func -ObjSwitch_CrystalOn = 0x80A84B98; // type:func -ObjSwitch_CrystalTurnOffInit = 0x80A84C60; // type:func -ObjSwitch_CrystalTurnOff = 0x80A84C7C; // type:func -ObjSwitch_Update = 0x80A84D04; // type:func -ObjSwitch_DrawFloor = 0x80A84E40; // type:func -ObjSwitch_DrawFloorRusty = 0x80A84E84; // type:func -ObjSwitch_DrawEye = 0x80A84EB4; // type:func -ObjSwitch_DrawCrystal = 0x80A84FC8; // type:func -ObjSwitch_Draw = 0x80A85224; // type:func -ObjElevator_SetupAction = 0x80A85720; // type:func -func_80B92B08 = 0x80A8572C; // type:func -ObjElevator_Init = 0x80A85784; // type:func -ObjElevator_Destroy = 0x80A85814; // type:func -func_80B92C5C = 0x80A85848; // type:func -func_80B92C80 = 0x80A8586C; // type:func -func_80B92D20 = 0x80A8590C; // type:func -func_80B92D44 = 0x80A85930; // type:func -ObjElevator_Update = 0x80A859B4; // type:func -ObjElevator_Draw = 0x80A859E8; // type:func -ObjLift_SetupAction = 0x80A85AE0; // type:func -ObjLift_InitDynaPoly = 0x80A85AEC; // type:func -ObjLift_SpawnFragments = 0x80A85B44; // type:func -ObjLift_Init = 0x80A85DC8; // type:func -ObjLift_Destroy = 0x80A85EC8; // type:func -ObjLift_SetupWait = 0x80A85EFC; // type:func -ObjLift_Wait = 0x80A85F40; // type:func -ObjLift_SetupShake = 0x80A86030; // type:func -ObjLift_Shake = 0x80A8605C; // type:func -ObjLift_SetupFall = 0x80A861A4; // type:func -ObjLift_Fall = 0x80A86228; // type:func -ObjLift_Update = 0x80A8632C; // type:func -ObjLift_Draw = 0x80A86360; // type:func -ObjHsblock_SetupAction = 0x80A86500; // type:func -func_80B93B68 = 0x80A8650C; // type:func -func_80B93BF0 = 0x80A86564; // type:func -ObjHsblock_Init = 0x80A865E8; // type:func -ObjHsblock_Destroy = 0x80A866B8; // type:func -func_80B93D90 = 0x80A866EC; // type:func -func_80B93DB0 = 0x80A8670C; // type:func -func_80B93DF4 = 0x80A86750; // type:func -func_80B93E38 = 0x80A86798; // type:func -func_80B93E5C = 0x80A867BC; // type:func -ObjHsblock_Update = 0x80A86864; // type:func -ObjHsblock_Draw = 0x80A868B0; // type:func -EnOkarinaTag_Destroy = 0x80A86AD0; // type:func -EnOkarinaTag_Init = 0x80A86AE0; // type:func -func_80ABEF2C = 0x80A86C48; // type:func -func_80ABF0CC = 0x80A86DAC; // type:func -func_80ABF28C = 0x80A86F6C; // type:func -func_80ABF4C8 = 0x80A871B4; // type:func -func_80ABF708 = 0x80A873F4; // type:func -func_80ABF7CC = 0x80A874BC; // type:func -EnOkarinaTag_Update = 0x80A87580; // type:func -EnYabusameMark_Destroy = 0x80A87FD0; // type:func -EnYabusameMark_Init = 0x80A87FFC; // type:func -func_80B42F74 = 0x80A8813C; // type:func -EnYabusameMark_Update = 0x80A88380; // type:func -EnGoroiwa_UpdateCollider = 0x80A886A0; // type:func -EnGoroiwa_InitCollider = 0x80A8870C; // type:func -EnGoroiwa_UpdateFlags = 0x80A88774; // type:func -EnGoroiwa_Vec3fNormalize = 0x80A88798; // type:func -EnGoroiwa_SetSpeed = 0x80A8881C; // type:func -EnGoroiwa_FaceNextWaypoint = 0x80A88844; // type:func -EnGoroiwa_GetPrevWaypointDiff = 0x80A8891C; // type:func -EnGoroiw_CheckEndOfPath = 0x80A88A78; // type:func -EnGoroiwa_SetNextWaypoint = 0x80A88B2C; // type:func -EnGoroiwa_ReverseDirection = 0x80A88B5C; // type:func -EnGoroiwa_InitPath = 0x80A88B84; // type:func -EnGoroiwa_TeleportToWaypoint = 0x80A88BC4; // type:func -EnGoroiwa_InitRotation = 0x80A88C68; // type:func -EnGoroiwa_GetAscendDirection = 0x80A88C84; // type:func -EnGoroiwa_SpawnDust = 0x80A88D48; // type:func -EnGoroiwa_SpawnWaterEffects = 0x80A88F38; // type:func -EnGoroiwa_MoveAndFall = 0x80A8906C; // type:func -EnGoroiwa_Move = 0x80A891A0; // type:func -EnGoroiwa_MoveUpToNextWaypoint = 0x80A893CC; // type:func -EnGoroiwa_MoveDownToNextWaypoint = 0x80A894EC; // type:func -EnGoroiwa_UpdateRotation = 0x80A8984C; // type:func -EnGoroiwa_NextWaypoint = 0x80A899EC; // type:func -EnGoroiwa_SpawnFragments = 0x80A89A74; // type:func -EnGoroiwa_Init = 0x80A89D90; // type:func -EnGoroiwa_Destroy = 0x80A89EC0; // type:func -EnGoroiwa_SetupRoll = 0x80A89EEC; // type:func -EnGoroiwa_Roll = 0x80A89F2C; // type:func -EnGoroiwa_SetupMoveAndFallToGround = 0x80A8A1B0; // type:func -EnGoroiwa_MoveAndFallToGround = 0x80A8A224; // type:func -EnGoroiwa_SetupWait = 0x80A8A2C4; // type:func -EnGoroiwa_Wait = 0x80A8A320; // type:func -EnGoroiwa_SetupMoveUp = 0x80A8A360; // type:func -EnGoroiwa_MoveUp = 0x80A8A3B0; // type:func -EnGoroiwa_SetupMoveDown = 0x80A8A470; // type:func -EnGoroiwa_MoveDown = 0x80A8A4DC; // type:func -EnGoroiwa_Update = 0x80A8A5A4; // type:func -EnGoroiwa_Draw = 0x80A8A704; // type:func -EnExRuppy_Init = 0x80A8AA60; // type:func -EnExRuppy_Destroy = 0x80A8AE38; // type:func -EnExRuppy_SpawnSparkles = 0x80A8AE48; // type:func -EnExRuppy_DropIntoWater = 0x80A8B064; // type:func -EnExRuppy_EnterWater = 0x80A8B144; // type:func -EnExRuppy_Sink = 0x80A8B2B0; // type:func -EnExRuppy_WaitInGame = 0x80A8B3B0; // type:func -EnExRuppy_Kill = 0x80A8B508; // type:func -EnExRuppy_WaitToBlowUp = 0x80A8B54C; // type:func -EnExRuppy_WaitAsCollectible = 0x80A8B678; // type:func -EnExRuppy_GalleryTarget = 0x80A8B6FC; // type:func -EnExRuppy_Update = 0x80A8B75C; // type:func -EnExRuppy_Draw = 0x80A8B7E8; // type:func -EnToryo_Init = 0x80A8BB20; // type:func -EnToryo_Destroy = 0x80A8BD64; // type:func -EnToryo_TalkRespond = 0x80A8BD90; // type:func -EnToryo_DoneTalking = 0x80A8BF84; // type:func -EnToryo_ReactToExchangeItem = 0x80A8BFF0; // type:func -EnToryo_GetTextId = 0x80A8C05C; // type:func -EnToryo_HandleTalking = 0x80A8C128; // type:func -EnToryo_Idle = 0x80A8C2D8; // type:func -EnToryo_Update = 0x80A8C33C; // type:func -EnToryo_Draw = 0x80A8C474; // type:func -EnToryo_OverrideLimbDraw = 0x80A8C4D4; // type:func -EnToryo_PostLimbDraw = 0x80A8C564; // type:func -EnDaiku_ChangeAnim = 0x80A8C7B0; // type:func -EnDaiku_Init = 0x80A8C864; // type:func -EnDaiku_Destroy = 0x80A8CBAC; // type:func -EnDaiku_UpdateTalking = 0x80A8CBD8; // type:func -EnDaiku_UpdateText = 0x80A8CCF4; // type:func -EnDaiku_TentIdle = 0x80A8CFC4; // type:func -EnDaiku_Jailed = 0x80A8CFFC; // type:func -EnDaiku_WaitFreedom = 0x80A8D0CC; // type:func -EnDaiku_InitEscape = 0x80A8D130; // type:func -EnDaiku_EscapeRotate = 0x80A8D338; // type:func -EnDaiku_InitSubCamera = 0x80A8D3A4; // type:func -EnDaiku_UpdateSubCamera = 0x80A8D530; // type:func -EnDaiku_EscapeSuccess = 0x80A8D5E8; // type:func -EnDaiku_EscapeRun = 0x80A8D724; // type:func -EnDaiku_Update = 0x80A8D930; // type:func -EnDaiku_Draw = 0x80A8DA48; // type:func -EnDaiku_OverrideLimbDraw = 0x80A8DB70; // type:func -EnDaiku_PostLimbDraw = 0x80A8DBF4; // type:func -EnNwc_SetUpdate = 0x80A8DEF0; // type:func -EnNwc_ChickNoop = 0x80A8DEFC; // type:func -EnNwc_ChickBgCheck = 0x80A8DF10; // type:func -EnNwc_ChickFall = 0x80A8E00C; // type:func -EnNwc_UpdateChicks = 0x80A8E078; // type:func -EnNwc_DrawChicks = 0x80A8E278; // type:func -EnNwc_Init = 0x80A8E5D4; // type:func -EnNwc_Destroy = 0x80A8E760; // type:func -EnNwc_Idle = 0x80A8E78C; // type:func -EnNwc_Update = 0x80A8E7AC; // type:func -EnNwc_Draw = 0x80A8E800; // type:func -EnBlkobj_SetupAction = 0x80A8E910; // type:func -EnBlkobj_Init = 0x80A8E920; // type:func -EnBlkobj_Destroy = 0x80A8E9D0; // type:func -EnBlkobj_Wait = 0x80A8EA04; // type:func -EnBlkobj_SpawnDarkLink = 0x80A8EA58; // type:func -EnBlkobj_DarkLinkFight = 0x80A8EAD0; // type:func -EnBlkobj_DoNothing = 0x80A8EBAC; // type:func -EnBlkobj_Update = 0x80A8EBBC; // type:func -EnBlkobj_DrawAlpha = 0x80A8EBE0; // type:func -EnBlkobj_Draw = 0x80A8EC5C; // type:func -ItemInbox_Init = 0x80A8EE70; // type:func -ItemInbox_Destroy = 0x80A8EEA4; // type:func -ItemInbox_Wait = 0x80A8EEB4; // type:func -ItemInbox_Update = 0x80A8EEFC; // type:func -ItemInbox_Draw = 0x80A8EF20; // type:func -EnGe1_Init = 0x80A8EFD0; // type:func -EnGe1_Destroy = 0x80A8F294; // type:func -EnGe1_SetTalkAction = 0x80A8F2C0; // type:func -EnGe1_SetAnimationIdle = 0x80A8F3A0; // type:func -EnGe1_CheckAllCarpentersRescued = 0x80A8F424; // type:func -EnGe1_KickPlayer = 0x80A8F460; // type:func -EnGe1_SpotPlayer = 0x80A8F540; // type:func -EnGe1_WatchForPlayerFrontOnly = 0x80A8F5A0; // type:func -EnGe1_ChooseActionFromTextId = 0x80A8F658; // type:func -EnGe1_SetNormalText = 0x80A8F6EC; // type:func -EnGe1_WatchForAndSensePlayer = 0x80A8F71C; // type:func -EnGe1_GetReaction_ValleyFloor = 0x80A8F7E8; // type:func -EnGe1_WaitTillOpened_GTGGuard = 0x80A8F83C; // type:func -EnGe1_Open_GTGGuard = 0x80A8F88C; // type:func -EnGe1_SetupOpen_GTGGuard = 0x80A8F93C; // type:func -EnGe1_RefuseEntryTooPoor_GTGGuard = 0x80A8F9FC; // type:func -EnGe1_OfferOpen_GTGGuard = 0x80A8FA3C; // type:func -EnGe1_RefuseOpenNoCard_GTGGuard = 0x80A8FB2C; // type:func -EnGe1_CheckForCard_GTGGuard = 0x80A8FB70; // type:func -EnGe1_WaitGateOpen_GateOp = 0x80A8FBD8; // type:func -EnGe1_WaitUntilGateOpened_GateOp = 0x80A8FC4C; // type:func -EnGe1_OpenGate_GateOp = 0x80A8FC9C; // type:func -EnGe1_SetupOpenGate_GateOp = 0x80A8FD4C; // type:func -EnGe1_CheckGate_GateOp = 0x80A8FE18; // type:func -EnGe1_Talk_GateGuard = 0x80A8FE94; // type:func -EnGe1_GetReaction_GateGuard = 0x80A8FED8; // type:func -EnGe1_SetupWait_Archery = 0x80A8FF8C; // type:func -EnGe1_WaitTillItemGiven_Archery = 0x80A8FFC4; // type:func -EnGe1_BeginGiveItem_Archery = 0x80A900B8; // type:func -EnGe1_TalkWinPrize_Archery = 0x80A90180; // type:func -EnGe1_TalkTooPoor_Archery = 0x80A901E0; // type:func -EnGe1_WaitDoNothing = 0x80A90244; // type:func -EnGe1_BeginGame_Archery = 0x80A90254; // type:func -EnGe1_TalkOfferPlay_Archery = 0x80A903F4; // type:func -EnGe1_TalkNoPrize_Archery = 0x80A90454; // type:func -EnGe1_TalkAfterGame_Archery = 0x80A904A0; // type:func -EnGe1_TalkNoHorse_Archery = 0x80A905A4; // type:func -EnGe1_Wait_Archery = 0x80A905E8; // type:func -EnGe1_TurnToFacePlayer = 0x80A90680; // type:func -EnGe1_LookAtPlayer = 0x80A90798; // type:func -EnGe1_Update = 0x80A90874; // type:func -EnGe1_CueUpAnimation = 0x80A909BC; // type:func -EnGe1_StopFidget = 0x80A909FC; // type:func -EnGe1_OverrideLimbDraw = 0x80A90A54; // type:func -EnGe1_PostLimbDraw = 0x80A90BA8; // type:func -EnGe1_Draw = 0x80A90C14; // type:func -ObjBlockstop_Init = 0x80A91000; // type:func -ObjBlockstop_Destroy = 0x80A9105C; // type:func -ObjBlockstop_Update = 0x80A9106C; // type:func -EnSda_Init = 0x80A911A0; // type:func -EnSda_Destroy = 0x80A911B0; // type:func -EnSda_Update = 0x80A911C0; // type:func -EnSda_Draw = 0x80A911FC; // type:func -func_80AF8F60 = 0x80A91290; // type:func -func_80AF95C4 = 0x80A918F4; // type:func -func_80AF9C70 = 0x80A91F70; // type:func -EnClearTag_CreateDebrisEffect = 0x80A92890; // type:func -EnClearTag_CreateFireEffect = 0x80A92988; // type:func -EnClearTag_CreateSmokeEffect = 0x80A92A78; // type:func -EnClearTag_CreateFlashEffect = 0x80A92B9C; // type:func -EnClearTag_Destroy = 0x80A92C74; // type:func -EnClearTag_Init = 0x80A92CA0; // type:func -EnClearTag_CalculateFloorTangent = 0x80A92E64; // type:func -EnClearTag_Update = 0x80A92F20; // type:func -EnClearTag_Draw = 0x80A93CD4; // type:func -EnClearTag_UpdateEffects = 0x80A94268; // type:func -EnClearTag_DrawEffects = 0x80A94630; // type:func -EnNiwLady_Init = 0x80A9DE30; // type:func -EnNiwLady_Destroy = 0x80A9DF18; // type:func -EnNiwLady_ChoseAnimation = 0x80A9DF44; // type:func -func_80AB9F24 = 0x80A9E10C; // type:func -func_80ABA21C = 0x80A9E408; // type:func -func_80ABA244 = 0x80A9E434; // type:func -func_80ABA654 = 0x80A9E7B4; // type:func -func_80ABA778 = 0x80A9E8AC; // type:func -func_80ABA878 = 0x80A9E980; // type:func -func_80ABA9B8 = 0x80A9EAC4; // type:func -func_80ABAA9C = 0x80A9EBA8; // type:func -func_80ABAB08 = 0x80A9EC18; // type:func -func_80ABAC00 = 0x80A9ED10; // type:func -func_80ABAC84 = 0x80A9ED98; // type:func -func_80ABAD38 = 0x80A9EE40; // type:func -func_80ABAD7C = 0x80A9EE60; // type:func -EnNiwLady_Update = 0x80A9EF24; // type:func -EnNiwLady_EmptyDList = 0x80A9F18C; // type:func -EnNiwLady_OverrideLimbDraw = 0x80A9F1B0; // type:func -EnNiwLady_Draw = 0x80A9F30C; // type:func -EnGm_Init = 0x80A9F730; // type:func -EnGm_Destroy = 0x80A9F790; // type:func -func_80A3D7C8 = 0x80A9F7BC; // type:func -func_80A3D838 = 0x80A9F82C; // type:func -EnGm_UpdateEye = 0x80A9F9CC; // type:func -EnGm_SetTextID = 0x80A9FA44; // type:func -func_80A3DB04 = 0x80A9FAF8; // type:func -func_80A3DBF4 = 0x80A9FBE8; // type:func -func_80A3DC44 = 0x80A9FC3C; // type:func -func_80A3DD7C = 0x80A9FD78; // type:func -EnGm_ProcessChoiceIndex = 0x80A9FE10; // type:func -func_80A3DF00 = 0x80A9FF00; // type:func -func_80A3DF60 = 0x80A9FF64; // type:func -func_80A3DFBC = 0x80A9FFC4; // type:func -EnGm_Update = 0x80AA0078; // type:func -func_80A3E090 = 0x80AA009C; // type:func -EnGm_Draw = 0x80AA01FC; // type:func -EnMs_SetOfferText = 0x80AA0460; // type:func -EnMs_Init = 0x80AA04DC; // type:func -EnMs_Destroy = 0x80AA0600; // type:func -EnMs_Wait = 0x80AA062C; // type:func -EnMs_Talk = 0x80AA06D8; // type:func -EnMs_Sell = 0x80AA07F4; // type:func -EnMs_TalkAfterPurchase = 0x80AA0890; // type:func -EnMs_Update = 0x80AA08F0; // type:func -EnMs_Draw = 0x80AA09E8; // type:func -func_80A6E3A0 = 0x80AA0B50; // type:func -EnHs_Init = 0x80AA0B5C; // type:func -EnHs_Destroy = 0x80AA0CA0; // type:func -func_80A6E53C = 0x80AA0CCC; // type:func -func_80A6E5EC = 0x80AA0D80; // type:func -func_80A6E630 = 0x80AA0DC4; // type:func -func_80A6E6B0 = 0x80AA0E44; // type:func -func_80A6E6D8 = 0x80AA0E6C; // type:func -func_80A6E70C = 0x80AA0EA4; // type:func -func_80A6E740 = 0x80AA0EDC; // type:func -func_80A6E7BC = 0x80AA0F5C; // type:func -func_80A6E8CC = 0x80AA106C; // type:func -func_80A6E9AC = 0x80AA1148; // type:func -EnHs_Update = 0x80AA1290; // type:func -EnHs_OverrideLimbDraw = 0x80AA13FC; // type:func -EnHs_PostLimbDraw = 0x80AA14B8; // type:func -EnHs_Draw = 0x80AA14F8; // type:func -BgInGate_SetupAction = 0x80AA16F0; // type:func -BgInGate_Init = 0x80AA16FC; // type:func -BgInGate_Destroy = 0x80AA1818; // type:func -func_80892890 = 0x80AA184C; // type:func -BgInGate_DoNothing = 0x80AA194C; // type:func -BgInGate_Update = 0x80AA195C; // type:func -BgInGate_Draw = 0x80AA1980; // type:func -EnKanban_SetFloorRot = 0x80AA1A80; // type:func -EnKanban_Init = 0x80AA1B3C; // type:func -EnKanban_Destroy = 0x80AA1C64; // type:func -EnKanban_Message = 0x80AA1C9C; // type:func -EnKanban_Update = 0x80AA1D54; // type:func -EnKanban_Draw = 0x80AA35D0; // type:func -EnHeishi3_Init = 0x80AA4BD0; // type:func -EnHeishi3_Destroy = 0x80AA4CFC; // type:func -EnHeishi3_SetupGuardType = 0x80AA4D28; // type:func -EnHeishi3_StandSentinelInGrounds = 0x80AA4DD8; // type:func -EnHeishi3_StandSentinelInCastle = 0x80AA4F34; // type:func -EnHeishi3_CatchStart = 0x80AA50A4; // type:func -func_80A55BD4 = 0x80AA514C; // type:func -EnHeishi3_ResetAnimationToIdle = 0x80AA51E4; // type:func -func_80A55D00 = 0x80AA5278; // type:func -EnHeishi3_Update = 0x80AA5328; // type:func -EnHeishi3_OverrideLimbDraw = 0x80AA5408; // type:func -EnHeishi3_Draw = 0x80AA5470; // type:func -EnSyatekiNiw_Init = 0x80AA55A0; // type:func -EnSyatekiNiw_Destroy = 0x80AA56E8; // type:func -EnSyatekiNiw_UpdateRotations = 0x80AA5714; // type:func -EnSyatekiNiw_SetupDefault = 0x80AA5A70; // type:func -EnSyatekiNiw_Default = 0x80AA5AFC; // type:func -EnSyatekiNiw_SetupArchery = 0x80AA602C; // type:func -EnSyatekiNiw_Archery = 0x80AA60E4; // type:func -EnSyatekiNiw_ExitArchery = 0x80AA6560; // type:func -EnSyatekiNiw_SetupRemove = 0x80AA6580; // type:func -EnSyatekiNiw_Remove = 0x80AA6678; // type:func -EnSyatekiNiw_CheckHit = 0x80AA6834; // type:func -EnSyatekiNiw_Update = 0x80AA6904; // type:func -SyatekiNiw_OverrideLimbDraw = 0x80AA6C74; // type:func -EnSyatekiNiw_Draw = 0x80AA6DA4; // type:func -EnSyatekiNiw_SpawnFeather = 0x80AA6E50; // type:func -EnSyatekiNiw_UpdateEffects = 0x80AA6F40; // type:func -EnSyatekiNiw_DrawEffects = 0x80AA70FC; // type:func -EnAttackNiw_Init = 0x80AA7630; // type:func -EnAttackNiw_Destroy = 0x80AA7764; // type:func -func_809B5268 = 0x80AA7798; // type:func -func_809B55EC = 0x80AA7B20; // type:func -func_809B5670 = 0x80AA7BA4; // type:func -func_809B59B0 = 0x80AA7EE4; // type:func -func_809B5C18 = 0x80AA8154; // type:func -EnAttackNiw_Update = 0x80AA8218; // type:func -func_809B5F98 = 0x80AA84DC; // type:func -EnAttackNiw_Draw = 0x80AA8634; // type:func -BgSpot01Idosoko_SetupAction = 0x80AA8890; // type:func -BgSpot01Idosoko_Init = 0x80AA889C; // type:func -BgSpot01Idosoko_Destroy = 0x80AA893C; // type:func -func_808ABF54 = 0x80AA8970; // type:func -BgSpot01Idosoko_Update = 0x80AA8980; // type:func -BgSpot01Idosoko_Draw = 0x80AA89A4; // type:func -func_80AF5560 = 0x80AA8AA0; // type:func -EnSa_GetTextId = 0x80AA8B20; // type:func -EnSa_UpdateTalkState = 0x80AA8C34; // type:func -func_80AF57D8 = 0x80AA8D18; // type:func -func_80AF5894 = 0x80AA8DD8; // type:func -func_80AF58B8 = 0x80AA8E00; // type:func -func_80AF594C = 0x80AA8E94; // type:func -func_80AF59E0 = 0x80AA8F28; // type:func -func_80AF5A74 = 0x80AA8FBC; // type:func -func_80AF5B10 = 0x80AA9058; // type:func -func_80AF5BA4 = 0x80AA90EC; // type:func -func_80AF5C40 = 0x80AA9188; // type:func -func_80AF5CD4 = 0x80AA921C; // type:func -func_80AF5CE4 = 0x80AA9234; // type:func -EnSa_ChangeAnim = 0x80AA92DC; // type:func -func_80AF5DFC = 0x80AA934C; // type:func -func_80AF5F34 = 0x80AA9484; // type:func -func_80AF603C = 0x80AA958C; // type:func -func_80AF609C = 0x80AA95EC; // type:func -func_80AF6130 = 0x80AA9688; // type:func -func_80AF6170 = 0x80AA96CC; // type:func -EnSa_Init = 0x80AA9710; // type:func -EnSa_Destroy = 0x80AA9980; // type:func -func_80AF6448 = 0x80AA99AC; // type:func -func_80AF67D0 = 0x80AA9D38; // type:func -func_80AF683C = 0x80AA9DAC; // type:func -func_80AF68E4 = 0x80AA9E54; // type:func -func_80AF6B20 = 0x80AAA094; // type:func -EnSa_Update = 0x80AAA154; // type:func -EnSa_OverrideLimbDraw = 0x80AAA2E4; // type:func -EnSa_PostLimbDraw = 0x80AAA48C; // type:func -EnSa_Draw = 0x80AAA4E8; // type:func -EnWonderTalk_Destroy = 0x80AAAD10; // type:func -EnWonderTalk_Init = 0x80AAAD20; // type:func -func_80B391CC = 0x80AAADC8; // type:func -func_80B3943C = 0x80AAAF58; // type:func -func_80B395F0 = 0x80AAB0AC; // type:func -EnWonderTalk_Update = 0x80AAB29C; // type:func -BgGjyoBridge_Init = 0x80AAB3A0; // type:func -BgGjyoBridge_Destroy = 0x80AAB458; // type:func -func_808787A4 = 0x80AAB48C; // type:func -BgGjyoBridge_TriggerCutscene = 0x80AAB49C; // type:func -BgGjyoBridge_SpawnBridge = 0x80AAB5F4; // type:func -BgGjyoBridge_Update = 0x80AAB670; // type:func -BgGjyoBridge_Draw = 0x80AAB694; // type:func -EnDs_Init = 0x80AAB890; // type:func -EnDs_Destroy = 0x80AAB960; // type:func -EnDs_Talk = 0x80AAB970; // type:func -EnDs_TalkNoEmptyBottle = 0x80AAB9C0; // type:func -EnDs_TalkAfterGiveOddPotion = 0x80AABA2C; // type:func -EnDs_DisplayOddPotionText = 0x80AABA88; // type:func -EnDs_GiveOddPotion = 0x80AABAE8; // type:func -EnDs_TalkAfterBrewOddPotion = 0x80AABB54; // type:func -EnDs_BrewOddPotion3 = 0x80AABBD4; // type:func -EnDs_BrewOddPotion2 = 0x80AABC78; // type:func -EnDs_BrewOddPotion1 = 0x80AABCCC; // type:func -EnDs_OfferOddPotion = 0x80AABD6C; // type:func -EnDs_CheckRupeesAndBottle = 0x80AABE38; // type:func -EnDs_GiveBluePotion = 0x80AABE88; // type:func -EnDs_OfferBluePotion = 0x80AABEEC; // type:func -EnDs_Wait = 0x80AAC024; // type:func -EnDs_Update = 0x80AAC1A8; // type:func -EnDs_OverrideLimbDraw = 0x80AAC2B0; // type:func -EnDs_PostLimbDraw = 0x80AAC2F8; // type:func -EnDs_Draw = 0x80AAC338; // type:func -EnMk_Init = 0x80AAC4B0; // type:func -EnMk_Destroy = 0x80AAC5C8; // type:func -func_80AACA40 = 0x80AAC5F4; // type:func -func_80AACA94 = 0x80AAC644; // type:func -func_80AACB14 = 0x80AAC6CC; // type:func -func_80AACB6C = 0x80AAC728; // type:func -func_80AACBAC = 0x80AAC764; // type:func -func_80AACC04 = 0x80AAC7BC; // type:func -func_80AACCA0 = 0x80AAC858; // type:func -func_80AACD48 = 0x80AAC900; // type:func -func_80AACE2C = 0x80AAC9E4; // type:func -func_80AACEE8 = 0x80AACAA0; // type:func -func_80AACFA0 = 0x80AACB58; // type:func -func_80AAD014 = 0x80AACBD0; // type:func -EnMk_Wait = 0x80AACC3C; // type:func -EnMk_Update = 0x80AACE90; // type:func -EnMk_OverrideLimbDraw = 0x80AAD0DC; // type:func -EnMk_PostLimbDraw = 0x80AAD124; // type:func -EnMk_Draw = 0x80AAD164; // type:func -EnBomBowlMan_Init = 0x80AAD340; // type:func -EnBomBowlMan_Destroy = 0x80AAD500; // type:func -EnBomBowlMan_SetupWaitAsleep = 0x80AAD510; // type:func -EnBomBowlMan_WaitAsleep = 0x80AAD598; // type:func -EnBomBowlMan_TalkAsleep = 0x80AAD64C; // type:func -EnBomBowlMan_WakeUp = 0x80AAD6C4; // type:func -EnBomBowlMan_BlinkAwake = 0x80AAD748; // type:func -EnBomBowlMan_CheckBeatenDC = 0x80AAD844; // type:func -EnBomBowlMan_WaitNotBeatenDC = 0x80AAD970; // type:func -EnBomBowlMan_TalkNotBeatenDC = 0x80AAD9CC; // type:func -EnBomBowlMan_SetupRunGame = 0x80AADA3C; // type:func -EnBomBowlMan_RunGame = 0x80AADAC0; // type:func -EnBomBowlMan_HandlePlayChoice = 0x80AADCD0; // type:func -func_809C41FC = 0x80AADE8C; // type:func -EnBomBowlMan_SetupChooseShowPrize = 0x80AADFA8; // type:func -EnBomBowlMan_ChooseShowPrize = 0x80AAE0AC; // type:func -EnBomBowlMan_BeginPlayGame = 0x80AAE2F4; // type:func -EnBomBowlMan_Update = 0x80AAE3B0; // type:func -EnBomBowlMan_OverrideLimbDraw = 0x80AAE528; // type:func -EnBomBowlMan_Draw = 0x80AAE570; // type:func -EnBomBowlPit_Init = 0x80AAE880; // type:func -EnBomBowlPit_Destroy = 0x80AAE898; // type:func -EnBomBowlPit_SetupDetectHit = 0x80AAE8A8; // type:func -EnBomBowlPit_DetectHit = 0x80AAE8D4; // type:func -EnBomBowlPit_CameraDollyIn = 0x80AAEBCC; // type:func -EnBomBowlPit_SpawnPrize = 0x80AAEDA8; // type:func -EnBomBowlPit_SetupGivePrize = 0x80AAEE38; // type:func -EnBomBowlPit_GivePrize = 0x80AAEEF0; // type:func -EnBomBowlPit_WaitTillPrizeGiven = 0x80AAEFF4; // type:func -EnBomBowlPit_Reset = 0x80AAF050; // type:func -EnBomBowlPit_Update = 0x80AAF0D0; // type:func -EnOwl_Init = 0x80AAF1F0; // type:func -EnOwl_Destroy = 0x80AAF5D4; // type:func -EnOwl_LookAtLink = 0x80AAF600; // type:func -EnOwl_CheckInitTalk = 0x80AAF63C; // type:func -func_80ACA558 = 0x80AAF7A8; // type:func -func_80ACA5C8 = 0x80AAF81C; // type:func -func_80ACA62C = 0x80AAF87C; // type:func -func_80ACA690 = 0x80AAF8C8; // type:func -func_80ACA6C0 = 0x80AAF8F8; // type:func -func_80ACA71C = 0x80AAF954; // type:func -func_80ACA76C = 0x80AAF9A0; // type:func -func_80ACA7E0 = 0x80AAFA14; // type:func -EnOwl_ConfirmKokiriMessage = 0x80AAFAC0; // type:func -EnOwl_WaitOutsideKokiri = 0x80AAFB60; // type:func -func_80ACA998 = 0x80AAFBD8; // type:func -func_80ACAA54 = 0x80AAFC98; // type:func -func_80ACAAC0 = 0x80AAFD08; // type:func -EnOwl_WaitHyruleCastle = 0x80AAFD78; // type:func -func_80ACAB88 = 0x80AAFDDC; // type:func -func_80ACAC6C = 0x80AAFEC4; // type:func -EnOwl_WaitKakariko = 0x80AAFF34; // type:func -func_80ACAD34 = 0x80AAFF98; // type:func -func_80ACADF0 = 0x80AB0058; // type:func -EnOwl_WaitGerudo = 0x80AB00C8; // type:func -func_80ACAEB8 = 0x80AB012C; // type:func -func_80ACAF74 = 0x80AB01EC; // type:func -EnOwl_WaitLakeHylia = 0x80AB025C; // type:func -func_80ACB03C = 0x80AB02C0; // type:func -EnOwl_WaitZoraRiver = 0x80AB0334; // type:func -func_80ACB148 = 0x80AB03D4; // type:func -EnOwl_WaitHyliaShortcut = 0x80AB0434; // type:func -func_80ACB22C = 0x80AB04C0; // type:func -func_80ACB274 = 0x80AB050C; // type:func -EnOwl_WaitDeathMountainShortcut = 0x80AB0550; // type:func -func_80ACB344 = 0x80AB05E4; // type:func -func_80ACB3E0 = 0x80AB0684; // type:func -func_80ACB440 = 0x80AB06EC; // type:func -func_80ACB4FC = 0x80AB07AC; // type:func -EnOwl_WaitLWPreSaria = 0x80AB081C; // type:func -func_80ACB5C4 = 0x80AB0880; // type:func -func_80ACB680 = 0x80AB0940; // type:func -EnOwl_WaitLWPostSaria = 0x80AB09B0; // type:func -func_80ACB748 = 0x80AB0A14; // type:func -func_80ACB904 = 0x80AB0BD0; // type:func -func_80ACB994 = 0x80AB0C68; // type:func -EnOwl_WaitDefault = 0x80AB0D00; // type:func -func_80ACBAB8 = 0x80AB0D94; // type:func -func_80ACBC0C = 0x80AB0EE8; // type:func -func_80ACBD4C = 0x80AB1024; // type:func -func_80ACBEA0 = 0x80AB1178; // type:func -func_80ACBF50 = 0x80AB1228; // type:func -func_80ACC00C = 0x80AB12E4; // type:func -func_80ACC23C = 0x80AB14A8; // type:func -func_80ACC30C = 0x80AB1574; // type:func -func_80ACC390 = 0x80AB15F8; // type:func -func_80ACC460 = 0x80AB16C8; // type:func -func_80ACC540 = 0x80AB17A8; // type:func -func_80ACC5CC = 0x80AB1834; // type:func -func_80ACC624 = 0x80AB188C; // type:func -EnOwl_Update = 0x80AB1908; // type:func -EnOwl_OverrideLimbDraw = 0x80AB2058; // type:func -EnOwl_PostLimbUpdate = 0x80AB2184; // type:func -EnOwl_Draw = 0x80AB2208; // type:func -EnOwl_ChangeMode = 0x80AB22D4; // type:func -func_80ACD130 = 0x80AB234C; // type:func -func_80ACD1C4 = 0x80AB23E0; // type:func -func_80ACD220 = 0x80AB2440; // type:func -func_80ACD2CC = 0x80AB24EC; // type:func -func_80ACD4D4 = 0x80AB26F4; // type:func -EnIshi_InitCollider = 0x80AB2D90; // type:func -EnIshi_SnapToFloor = 0x80AB2E08; // type:func -EnIshi_SpawnFragmentsSmall = 0x80AB2EAC; // type:func -EnIshi_SpawnFragmentsLarge = 0x80AB3128; // type:func -EnIshi_SpawnDustSmall = 0x80AB3414; // type:func -EnIshi_SpawnDustLarge = 0x80AB3508; // type:func -EnIshi_DropCollectible = 0x80AB35FC; // type:func -EnIshi_Fall = 0x80AB366C; // type:func -func_80A7ED94 = 0x80AB36A0; // type:func -EnIshi_SpawnBugs = 0x80AB3724; // type:func -EnIshi_Init = 0x80AB37E0; // type:func -EnIshi_Destroy = 0x80AB397C; // type:func -EnIshi_SetupWait = 0x80AB39A8; // type:func -EnIshi_Wait = 0x80AB39BC; // type:func -EnIshi_SetupLiftedUp = 0x80AB3C14; // type:func -EnIshi_LiftedUp = 0x80AB3C3C; // type:func -EnIshi_SetupFly = 0x80AB3D10; // type:func -EnIshi_Fly = 0x80AB3E3C; // type:func -EnIshi_Update = 0x80AB41A8; // type:func -EnIshi_DrawSmall = 0x80AB41CC; // type:func -EnIshi_DrawLarge = 0x80AB41FC; // type:func -EnIshi_Draw = 0x80AB42A4; // type:func -ObjHana_Init = 0x80ABBEE0; // type:func -ObjHana_Destroy = 0x80ABBFDC; // type:func -ObjHana_Update = 0x80ABC028; // type:func -ObjHana_Draw = 0x80ABC098; // type:func -ObjLightswitch_InitCollider = 0x80ABC1F0; // type:func -ObjLightswitch_SetSwitchFlag = 0x80ABC28C; // type:func -ObjLightswitch_ClearSwitchFlag = 0x80ABC350; // type:func -ObjLightswitch_SpawnDisappearEffects = 0x80ABC3D0; // type:func -ObjLightswitch_Init = 0x80ABC5F8; // type:func -ObjLightswitch_Destroy = 0x80ABC78C; // type:func -ObjLightswitch_SetupOff = 0x80ABC7B8; // type:func -ObjLightswitch_Off = 0x80ABC7EC; // type:func -ObjLightswitch_SetupTurnOn = 0x80ABC8CC; // type:func -ObjLightswitch_TurnOn = 0x80ABC8F0; // type:func -ObjLightswitch_SetupOn = 0x80ABC9E4; // type:func -ObjLightswitch_On = 0x80ABCA20; // type:func -ObjLightswitch_SetupTurnOff = 0x80ABCB34; // type:func -ObjLightswitch_TurnOff = 0x80ABCB60; // type:func -ObjLightswitch_SetupDisappearDelay = 0x80ABCC50; // type:func -ObjLightswitch_DisappearDelay = 0x80ABCC6C; // type:func -ObjLightswitch_SetupDisappear = 0x80ABCCB4; // type:func -ObjLightswitch_Disappear = 0x80ABCCD0; // type:func -ObjLightswitch_Update = 0x80ABCD14; // type:func -ObjLightswitch_DrawOpa = 0x80ABCDF8; // type:func -ObjLightswitch_DrawXlu = 0x80ABD120; // type:func -ObjLightswitch_Draw = 0x80ABD3D0; // type:func -ObjMure2_SetPosShrubCircle = 0x80ABD620; // type:func -ObjMure2_SetPosShrubScattered = 0x80ABD73C; // type:func -ObjMure2_SetPosRockCircle = 0x80ABD83C; // type:func -ObjMure2_SetActorSpawnParams = 0x80ABD948; // type:func -ObjMure2_SpawnActors = 0x80ABD99C; // type:func -ObjMure2_CleanupAndDie = 0x80ABDAF8; // type:func -func_80B9A534 = 0x80ABDBF8; // type:func -ObjMure2_Init = 0x80ABDC8C; // type:func -ObjMure2_SetupWait = 0x80ABDCEC; // type:func -ObjMure2_Wait = 0x80ABDD00; // type:func -func_80B9A658 = 0x80ABDD24; // type:func -func_80B9A668 = 0x80ABDD38; // type:func -func_80B9A6E8 = 0x80ABDDB8; // type:func -func_80B9A6F8 = 0x80ABDDCC; // type:func -ObjMure2_Update = 0x80ABDE5C; // type:func -EnGo_SetupAction = 0x80ABE040; // type:func -EnGo_GetTextID = 0x80ABE04C; // type:func -EnGo_UpdateTalkState = 0x80ABE3DC; // type:func -EnGo_UpdateTalking = 0x80ABE7FC; // type:func -EnGo_ChangeAnim = 0x80ABE8BC; // type:func -EnGo_IsActorSpawned = 0x80ABE96C; // type:func -EnGo_GetPlayerTrackingYOffset = 0x80ABEACC; // type:func -func_80A3F060 = 0x80ABEB44; // type:func -func_80A3F0E4 = 0x80ABEBC8; // type:func -EnGo_IsCameraModified = 0x80ABEC40; // type:func -EnGo_ReverseAnimation = 0x80ABED44; // type:func -EnGo_UpdateShadow = 0x80ABED5C; // type:func -EnGo_FollowPath = 0x80ABEDE8; // type:func -EnGo_SetMovedPos = 0x80ABEFA4; // type:func -EnGo_SpawnDust = 0x80ABF07C; // type:func -EnGo_IsRollingOnGround = 0x80ABF2A8; // type:func -func_80A3F908 = 0x80ABF3F4; // type:func -EnGo_Init = 0x80ABF624; // type:func -EnGo_Destroy = 0x80ABF974; // type:func -func_80A3FEB4 = 0x80ABF9B4; // type:func -EnGo_StopRolling = 0x80ABF9F8; // type:func -func_80A4008C = 0x80ABFB8C; // type:func -EnGo_GoronLinkRolling = 0x80ABFC1C; // type:func -EnGo_FireGenericActionFunc = 0x80ABFD14; // type:func -EnGo_CurledUp = 0x80ABFD24; // type:func -EnGo_WakeUp = 0x80ABFE24; // type:func -func_80A40494 = 0x80ABFFA0; // type:func -func_80A405CC = 0x80AC00D8; // type:func -EnGo_BiggoronActionFunc = 0x80AC01EC; // type:func -func_80A408D8 = 0x80AC03E4; // type:func -func_80A40A54 = 0x80AC0560; // type:func -func_80A40B1C = 0x80AC0628; // type:func -EnGo_GetItem = 0x80AC0680; // type:func -func_80A40C78 = 0x80AC0788; // type:func -EnGo_Eyedrops = 0x80AC0870; // type:func -func_80A40DCC = 0x80AC08E0; // type:func -EnGo_Update = 0x80AC0964; // type:func -EnGo_DrawCurledUp = 0x80AC0A74; // type:func -EnGo_DrawRolling = 0x80AC0B40; // type:func -EnGo_OverrideLimbDraw = 0x80AC0C6C; // type:func -EnGo_PostLimbDraw = 0x80AC0E88; // type:func -EnGo_Draw = 0x80AC0EE4; // type:func -EnGo_SpawnEffectDust = 0x80AC1084; // type:func -EnGo_UpdateEffects = 0x80AC1128; // type:func -EnGo_DrawEffects = 0x80AC1234; // type:func -EnFu_Init = 0x80AC2680; // type:func -EnFu_Destroy = 0x80AC2794; // type:func -func_80A1D94C = 0x80AC27C0; // type:func -func_80A1DA04 = 0x80AC287C; // type:func -EnFu_WaitChild = 0x80AC2918; // type:func -func_80A1DB60 = 0x80AC29DC; // type:func -func_80A1DBA0 = 0x80AC2A1C; // type:func -func_80A1DBD4 = 0x80AC2A54; // type:func -EnFu_WaitForPlayback = 0x80AC2BC4; // type:func -EnFu_TeachSong = 0x80AC2C2C; // type:func -EnFu_WaitAdult = 0x80AC2CA8; // type:func -EnFu_Update = 0x80AC2DF8; // type:func -EnFu_OverrideLimbDraw = 0x80AC2FA0; // type:func -EnFu_PostLimbDraw = 0x80AC30FC; // type:func -EnFu_Draw = 0x80AC313C; // type:func -EnChanger_Destroy = 0x80AC33D0; // type:func -EnChanger_Init = 0x80AC33E0; // type:func -EnChanger_Wait = 0x80AC38FC; // type:func -EnChanger_OpenChests = 0x80AC39A0; // type:func -EnChanger_SetHeartPieceFlag = 0x80AC3B50; // type:func -EnChanger_Update = 0x80AC3BA0; // type:func -BgJyaMegami_InitDynaPoly = 0x80AC3DB0; // type:func -BgJyaMegami_InitCollider = 0x80AC3E08; // type:func -BgJyaMegami_SpawnEffect = 0x80AC3E5C; // type:func -BgJyaMegami_SetupSpawnEffect = 0x80AC40A0; // type:func -BgJyaMegami_Init = 0x80AC419C; // type:func -BgJyaMegami_Destroy = 0x80AC4230; // type:func -BgJyaMegami_SetupDetectLight = 0x80AC4278; // type:func -BgJyaMegami_DetectLight = 0x80AC4294; // type:func -BgJyaMegami_SetupExplode = 0x80AC4420; // type:func -BgJyaMegami_Explode = 0x80AC44B8; // type:func -BgJyaMegami_Update = 0x80AC4840; // type:func -BgJyaMegami_DrawFace = 0x80AC4864; // type:func -BgJyaMegami_DrawExplode = 0x80AC49A8; // type:func -BgJyaMegami_Draw = 0x80AC4B74; // type:func -BgJyaLift_InitDynapoly = 0x80AC4FA0; // type:func -BgJyaLift_Init = 0x80AC4FF8; // type:func -BgJyaLift_Destroy = 0x80AC50B4; // type:func -BgJyaLift_SetInitPosY = 0x80AC50F8; // type:func -BgJyaLift_DelayMove = 0x80AC511C; // type:func -BgJyaLift_SetupMove = 0x80AC51A0; // type:func -BgJyaLift_Move = 0x80AC51B4; // type:func -BgJyaLift_SetFinalPosY = 0x80AC52D8; // type:func -BgJyaLift_Update = 0x80AC52F0; // type:func -BgJyaLift_Draw = 0x80AC53E0; // type:func -BgJyaBigmirror_SetRoomFlag = 0x80AC54F0; // type:func -BgJyaBigmirror_HandleCobra = 0x80AC5560; // type:func -BgJyaBigmirror_SetBombiwaFlag = 0x80AC56F8; // type:func -BgJyaBigmirror_HandleMirRay = 0x80AC574C; // type:func -BgJyaBigmirror_Init = 0x80AC58F4; // type:func -BgJyaBigmirror_Destroy = 0x80AC5978; // type:func -BgJyaBigmirror_Update = 0x80AC5998; // type:func -BgJyaBigmirror_DrawLightBeam = 0x80AC59E8; // type:func -BgJyaBigmirror_Draw = 0x80AC5B74; // type:func -BgJyaBombchuiwa_SetupCollider = 0x80AC5D40; // type:func -BgJyaBombchuiwa_SetDrawFlags = 0x80AC5D94; // type:func -BgJyaBombchuiwa_Init = 0x80AC5DB8; // type:func -BgJyaBombchuiwa_Destroy = 0x80AC5E38; // type:func -BgJyaBombchuiwa_Break = 0x80AC5E64; // type:func -BgJyaBombchuiwa_SetupWaitForExplosion = 0x80AC60F0; // type:func -BgJyaBombchuiwa_WaitForExplosion = 0x80AC6128; // type:func -BgJyaBombchuiwa_CleanUpAfterExplosion = 0x80AC620C; // type:func -func_808949B8 = 0x80AC6264; // type:func -BgJyaBombchuiwa_SpawnLightRay = 0x80AC62F0; // type:func -BgJyaBombchuiwa_Update = 0x80AC6368; // type:func -BgJyaBombchuiwa_DrawRock = 0x80AC6394; // type:func -BgJyaBombchuiwa_DrawLight = 0x80AC641C; // type:func -BgJyaBombchuiwa_Draw = 0x80AC6678; // type:func -BgJyaAmishutter_InitDynaPoly = 0x80AC6880; // type:func -BgJyaAmishutter_Init = 0x80AC68D8; // type:func -BgJyaAmishutter_Destroy = 0x80AC6920; // type:func -BgJyaAmishutter_SetupWaitForPlayer = 0x80AC6954; // type:func -BgJyaAmishutter_WaitForPlayer = 0x80AC6968; // type:func -func_80893428 = 0x80AC69C4; // type:func -func_80893438 = 0x80AC69D8; // type:func -func_808934B0 = 0x80AC6A50; // type:func -func_808934C0 = 0x80AC6A64; // type:func -func_808934FC = 0x80AC6AA0; // type:func -func_8089350C = 0x80AC6AB4; // type:func -BgJyaAmishutter_Update = 0x80AC6B18; // type:func -BgJyaAmishutter_Draw = 0x80AC6B40; // type:func -BgJyaBombiwa_SetupDynaPoly = 0x80AC6C10; // type:func -BgJyaBombiwa_InitCollider = 0x80AC6C68; // type:func -BgJyaBombiwa_Init = 0x80AC6CBC; // type:func -BgJyaBombiwa_Destroy = 0x80AC6D3C; // type:func -BgJyaBombiwa_Break = 0x80AC6D84; // type:func -BgJyaBombiwa_Update = 0x80AC7018; // type:func -BgJyaBombiwa_Draw = 0x80AC70A8; // type:func -func_808B7710 = 0x80AC71D0; // type:func -func_808B7770 = 0x80AC722C; // type:func -BgSpot18Basket_Init = 0x80AC73E8; // type:func -BgSpot18Basket_Destroy = 0x80AC7534; // type:func -func_808B7AEC = 0x80AC757C; // type:func -func_808B7AFC = 0x80AC7590; // type:func -func_808B7B58 = 0x80AC75EC; // type:func -func_808B7B6C = 0x80AC7604; // type:func -func_808B7BB0 = 0x80AC7648; // type:func -func_808B7BCC = 0x80AC7668; // type:func -func_808B7D38 = 0x80AC77D4; // type:func -func_808B7D50 = 0x80AC77F0; // type:func -func_808B7F74 = 0x80AC7A14; // type:func -func_808B7FC0 = 0x80AC7A64; // type:func -func_808B818C = 0x80AC7C30; // type:func -func_808B81A0 = 0x80AC7C48; // type:func -BgSpot18Basket_Update = 0x80AC7EE0; // type:func -BgSpot18Basket_Draw = 0x80AC7FA4; // type:func -EnGanonOrgan_Init = 0x80AC81C0; // type:func -EnGanonOrgan_Destroy = 0x80AC81DC; // type:func -EnGanonOrgan_Update = 0x80AC81EC; // type:func -EnGanonOrgan_EmptyDList = 0x80AC8230; // type:func -func_80A280BC = 0x80AC8254; // type:func -func_80A28148 = 0x80AC82CC; // type:func -EnGanonOrgan_Draw = 0x80AC833C; // type:func -EnSiofuki_Init = 0x80ACF200; // type:func -EnSiofuki_Destroy = 0x80ACF41C; // type:func -func_80AFBDC8 = 0x80ACF450; // type:func -func_80AFBE8C = 0x80ACF510; // type:func -func_80AFC1D0 = 0x80ACF85C; // type:func -func_80AFC218 = 0x80ACF8A4; // type:func -func_80AFC34C = 0x80ACF9E0; // type:func -func_80AFC3C8 = 0x80ACFA64; // type:func -func_80AFC478 = 0x80ACFB1C; // type:func -func_80AFC544 = 0x80ACFBF0; // type:func -EnSiofuki_Update = 0x80ACFC28; // type:func -EnSiofuki_Draw = 0x80ACFC4C; // type:func -EnStream_SetupAction = 0x80ACFFB0; // type:func -EnStream_Init = 0x80ACFFBC; // type:func -EnStream_Destroy = 0x80AD0024; // type:func -func_80B0B81C = 0x80AD0034; // type:func -EnStream_SuckPlayer = 0x80AD0154; // type:func -EnStream_WaitForPlayer = 0x80AD02EC; // type:func -EnStream_Update = 0x80AD0340; // type:func -EnStream_Draw = 0x80AD0374; // type:func -EnMm_ChangeAnim = 0x80AD0540; // type:func -EnMm_Init = 0x80AD0664; // type:func -EnMm_Destroy = 0x80AD0820; // type:func -func_80AADA70 = 0x80AD084C; // type:func -func_80AADAA0 = 0x80AD0880; // type:func -EnMm_GetTextId = 0x80AD0A14; // type:func -func_80AADCD0 = 0x80AD0AB4; // type:func -EnMm_GetPointCount = 0x80AD0C34; // type:func -func_80AADE60 = 0x80AD0C48; // type:func -func_80AADEF0 = 0x80AD0CDC; // type:func -func_80AAE224 = 0x80AD1014; // type:func -func_80AAE294 = 0x80AD1084; // type:func -func_80AAE50C = 0x80AD12FC; // type:func -func_80AAE598 = 0x80AD1388; // type:func -EnMm_Update = 0x80AD1430; // type:func -EnMm_Draw = 0x80AD14A4; // type:func -EnMm_OverrideLimbDraw = 0x80AD1738; // type:func -EnMm_PostLimbDraw = 0x80AD17CC; // type:func -EnKo_AreObjectsAvailable = 0x80AD1BA0; // type:func -EnKo_AreObjectsLoaded = 0x80AD1CB8; // type:func -EnKo_IsOsAnimeAvailable = 0x80AD1D40; // type:func -EnKo_IsOsAnimeLoaded = 0x80AD1D90; // type:func -EnKo_GetTextIdChild = 0x80AD1DD0; // type:func -EnKo_GetTextIdAdult = 0x80AD2138; // type:func -EnKo_GetTextId = 0x80AD2410; // type:func -EnKo_UpdateTalkState = 0x80AD253C; // type:func -EnKo_GetForestQuestState = 0x80AD293C; // type:func -func_80A97BC0 = 0x80AD29C4; // type:func -func_80A97C7C = 0x80AD2A80; // type:func -EnKo_IsWithinTalkAngle = 0x80AD2B04; // type:func -func_80A97D68 = 0x80AD2B70; // type:func -func_80A97E18 = 0x80AD2C20; // type:func -func_80A97EB0 = 0x80AD2CBC; // type:func -func_80A97F20 = 0x80AD2D30; // type:func -func_80A97F70 = 0x80AD2D80; // type:func -func_80A98034 = 0x80AD2E44; // type:func -func_80A98124 = 0x80AD2F38; // type:func -func_80A98174 = 0x80AD2F88; // type:func -EnKo_ChildStart = 0x80AD306C; // type:func -EnKo_ChildStone = 0x80AD3174; // type:func -EnKo_ChildSaria = 0x80AD327C; // type:func -EnKo_AdultEnemy = 0x80AD3384; // type:func -EnKo_AdultSaved = 0x80AD348C; // type:func -func_80A9877C = 0x80AD3594; // type:func -EnKo_CanSpawn = 0x80AD3750; // type:func -EnKo_Blink = 0x80AD3A34; // type:func -func_80A98CD8 = 0x80AD3AF4; // type:func -EnKo_GetForestQuestState2 = 0x80AD3B4C; // type:func -func_80A98DB4 = 0x80AD3BD8; // type:func -func_80A98ECC = 0x80AD3CF0; // type:func -EnKo_Init = 0x80AD3DB8; // type:func -EnKo_Destroy = 0x80AD3E48; // type:func -func_80A99048 = 0x80AD3E74; // type:func -func_80A99384 = 0x80AD41A4; // type:func -func_80A99438 = 0x80AD4258; // type:func -func_80A99504 = 0x80AD4324; // type:func -func_80A99560 = 0x80AD4384; // type:func -func_80A995CC = 0x80AD43F4; // type:func -EnKo_Update = 0x80AD4530; // type:func -EnKo_OverrideLimbDraw = 0x80AD4694; // type:func -EnKo_PostLimbDraw = 0x80AD49F4; // type:func -EnKo_SetEnvColor = 0x80AD4AC4; // type:func -EnKo_Draw = 0x80AD4B30; // type:func -EnKz_GetTextIdChild = 0x80AD5CE0; // type:func -EnKz_GetTextIdAdult = 0x80AD5D3C; // type:func -EnKz_GetTextId = 0x80AD5DEC; // type:func -EnKz_UpdateTalkState = 0x80AD5E54; // type:func -EnKz_UpdateEyes = 0x80AD6078; // type:func -EnKz_UpdateTalking = 0x80AD60F0; // type:func -func_80A9CB18 = 0x80AD62AC; // type:func -EnKz_FollowPath = 0x80AD646C; // type:func -EnKz_SetMovedPos = 0x80AD65D8; // type:func -EnKz_Init = 0x80AD66A0; // type:func -EnKz_Destroy = 0x80AD682C; // type:func -EnKz_PreMweepWait = 0x80AD6858; // type:func -EnKz_SetupMweep = 0x80AD68C8; // type:func -EnKz_Mweep = 0x80AD69F4; // type:func -EnKz_StopMweep = 0x80AD6B60; // type:func -EnKz_Wait = 0x80AD6BC4; // type:func -EnKz_SetupGetItem = 0x80AD6C2C; // type:func -EnKz_StartTimer = 0x80AD6CC0; // type:func -EnKz_Update = 0x80AD6D58; // type:func -EnKz_OverrideLimbDraw = 0x80AD6E14; // type:func -EnKz_PostLimbDraw = 0x80AD6EE4; // type:func -EnKz_Draw = 0x80AD6F40; // type:func -EnWeatherTag_SetupAction = 0x80AD7280; // type:func -EnWeatherTag_Destroy = 0x80AD728C; // type:func -EnWeatherTag_Init = 0x80AD729C; // type:func -WeatherTag_CheckEnableWeatherEffect = 0x80AD7470; // type:func -WeatherTag_CheckRestoreWeather = 0x80AD7648; // type:func -EnWeatherTag_DisabledCloudyHyruleMarket = 0x80AD7808; // type:func -EnWeatherTag_EnabledCloudyHyruleMarket = 0x80AD7864; // type:func -EnWeatherTag_DisabledCloudyLonLonRanch = 0x80AD78B8; // type:func -EnWeatherTag_EnabledCloudyLonLonRanch = 0x80AD7914; // type:func -EnWeatherTag_DisabledCloudyDeathMountain = 0x80AD7968; // type:func -EnWeatherTag_EnabledCloudyDeathMountain = 0x80AD79C4; // type:func -EnWeatherTag_DisabledCloudySnow = 0x80AD7A18; // type:func -EnWeatherTag_EnabledCloudySnow = 0x80AD7A90; // type:func -EnWeatherTag_DisabledRainLakeHylia = 0x80AD7AFC; // type:func -EnWeatherTag_EnabledRainLakeHylia = 0x80AD7B80; // type:func -EnWeatherTag_DisabledCloudyRainThunderKakariko = 0x80AD7BF8; // type:func -EnWeatherTag_EnabledCloudyRainThunderKakariko = 0x80AD7C90; // type:func -EnWeatherTag_SetSandstormIntensity = 0x80AD7D1C; // type:func -EnWeatherTag_DisabledRainThunder = 0x80AD7E18; // type:func -EnWeatherTag_EnabledRainThunder = 0x80AD7EBC; // type:func -EnWeatherTag_Update = 0x80AD7F70; // type:func -BgSstFloor_Init = 0x80AD8170; // type:func -BgSstFloor_Destroy = 0x80AD81D8; // type:func -BgSstFloor_Update = 0x80AD820C; // type:func -BgSstFloor_Draw = 0x80AD8580; // type:func -EnAni_SetupAction = 0x80AD86D0; // type:func -EnAni_Init = 0x80AD86DC; // type:func -EnAni_Destroy = 0x80AD87F4; // type:func -EnAni_SetText = 0x80AD8820; // type:func -func_809B04F0 = 0x80AD885C; // type:func -func_809B0524 = 0x80AD8894; // type:func -func_809B0558 = 0x80AD88CC; // type:func -func_809B05F0 = 0x80AD8968; // type:func -func_809B064C = 0x80AD89CC; // type:func -func_809B07F8 = 0x80AD8B78; // type:func -func_809B0988 = 0x80AD8D08; // type:func -func_809B0994 = 0x80AD8D18; // type:func -func_809B0A28 = 0x80AD8DAC; // type:func -func_809B0A6C = 0x80AD8DF0; // type:func -EnAni_Update = 0x80AD8E9C; // type:func -EnAni_OverrideLimbDraw = 0x80AD9118; // type:func -EnAni_PostLimbDraw = 0x80AD9160; // type:func -EnAni_Draw = 0x80AD91A0; // type:func -EnExItem_Destroy = 0x80AD9440; // type:func -EnExItem_Init = 0x80AD9450; // type:func -EnExItem_WaitForObject = 0x80AD95AC; // type:func -EnExItem_BowlPrize = 0x80AD9928; // type:func -EnExItem_SetupBowlCounter = 0x80AD9B14; // type:func -EnExItem_BowlCounter = 0x80AD9B3C; // type:func -EnExItem_ExitChest = 0x80AD9B74; // type:func -EnExItem_FairyMagic = 0x80AD9BDC; // type:func -EnExItem_TargetPrizeApproach = 0x80AD9BF4; // type:func -EnExItem_TargetPrizeGive = 0x80AD9E48; // type:func -EnExItem_TargetPrizeFinish = 0x80AD9ED4; // type:func -EnExItem_Update = 0x80AD9F34; // type:func -EnExItem_Draw = 0x80AD9F88; // type:func -EnExItem_DrawItems = 0x80ADA038; // type:func -EnExItem_DrawHeartPiece = 0x80ADA09C; // type:func -EnExItem_DrawMagic = 0x80ADA0D0; // type:func -EnExItem_DrawKey = 0x80ADA118; // type:func -EnExItem_DrawRupee = 0x80ADA208; // type:func -BgJyaIronobj_InitCylinder = 0x80ADA5C0; // type:func -BgJyaIronobj_SpawnPillarParticles = 0x80ADA640; // type:func -BgJyaIronobj_SpawnThroneParticles = 0x80ADAABC; // type:func -BgJyaIronobj_Init = 0x80ADAEE8; // type:func -BgJyaIronobj_Destroy = 0x80ADAF7C; // type:func -func_808992D8 = 0x80ADAFC4; // type:func -func_808992E8 = 0x80ADAFD8; // type:func -BgJyaIronobj_Update = 0x80ADB118; // type:func -BgJyaIronobj_Draw = 0x80ADB13C; // type:func -En_Js_SetupAction = 0x80ADB370; // type:func -EnJs_Init = 0x80ADB37C; // type:func -EnJs_Destroy = 0x80ADB4A0; // type:func -func_80A88F64 = 0x80ADB4CC; // type:func -func_80A89008 = 0x80ADB574; // type:func -func_80A89078 = 0x80ADB5E8; // type:func -func_80A890C0 = 0x80ADB634; // type:func -func_80A8910C = 0x80ADB684; // type:func -func_80A89160 = 0x80ADB6D8; // type:func -func_80A891C4 = 0x80ADB740; // type:func -func_80A89294 = 0x80ADB814; // type:func -func_80A89304 = 0x80ADB888; // type:func -EnJs_Update = 0x80ADB8C0; // type:func -EnJs_OverrideLimbDraw = 0x80ADBB4C; // type:func -EnJs_PostLimbDraw = 0x80ADBB84; // type:func -EnJs_Draw = 0x80ADBBC4; // type:func -EnJsjutan_Init = 0x80ADBD40; // type:func -EnJsjutan_Destroy = 0x80ADBDD4; // type:func -func_80A89860 = 0x80ADBE08; // type:func -func_80A89A6C = 0x80ADC014; // type:func -EnJsjutan_Update = 0x80ADCAF4; // type:func -EnJsjutan_Draw = 0x80ADCBCC; // type:func -EnCs_ChangeAnim = 0x80AE1670; // type:func -EnCs_Init = 0x80AE1794; // type:func -EnCs_Destroy = 0x80AE1928; // type:func -EnCs_GetTalkState = 0x80AE1954; // type:func -EnCs_GetTextId = 0x80AE1A88; // type:func -EnCs_HandleTalking = 0x80AE1B0C; // type:func -EnCs_GetwaypointCount = 0x80AE1C58; // type:func -EnCs_GetPathPoint = 0x80AE1C6C; // type:func -EnCs_HandleWalking = 0x80AE1D00; // type:func -EnCs_Walk = 0x80AE1F18; // type:func -EnCs_Wait = 0x80AE20B8; // type:func -EnCs_Talk = 0x80AE2144; // type:func -EnCs_Update = 0x80AE2208; // type:func -EnCs_Draw = 0x80AE2378; // type:func -EnCs_OverrideLimbDraw = 0x80AE252C; // type:func -EnCs_PostLimbDraw = 0x80AE25BC; // type:func -EnMd_ReverseAnimation = 0x80AE28A0; // type:func -EnMd_UpdateAnimSequence_IdleToHalt = 0x80AE28C8; // type:func -EnMd_UpdateAnimSequence_HaltToCurious = 0x80AE295C; // type:func -EnMd_UpdateAnimSequence_WalkAway = 0x80AE29F0; // type:func -EnMd_UpdateAnimSequence_TwitchIdle_Unused = 0x80AE2AC8; // type:func -EnMd_UpdateAnimSequence_HaltToIdle = 0x80AE2B5C; // type:func -EnMd_UpdateAnimSequence_SurpriseToAnnoyed = 0x80AE2BF8; // type:func -EnMd_UpdateAnimSequence_SurpriseToIdle = 0x80AE2C8C; // type:func -EnMd_UpdateAnimSequence_CuriousToAnnoyed = 0x80AE2D28; // type:func -EnMd_UpdateAnimSequence_AnnoyedToHalt = 0x80AE2DBC; // type:func -EnMd_UpdateAnimSequence_IdleToAnnoyed = 0x80AE2E50; // type:func -EnMd_UpdateAnimSequence_StopWalking = 0x80AE2EE4; // type:func -EnMd_SetAnimSequence = 0x80AE2F80; // type:func -EnMd_UpdateAnimSequence = 0x80AE2F98; // type:func -EnMd_UpdateAnimSequence_WithTalking = 0x80AE3080; // type:func -EnMd_TrackMessageState = 0x80AE32D4; // type:func -EnMd_GetTextIdKokiriForest = 0x80AE3354; // type:func -EnMd_GetTextIdMidosHouse = 0x80AE343C; // type:func -EnMd_GetTextIdLostWoods = 0x80AE3470; // type:func -EnMd_GetTextId = 0x80AE34F0; // type:func -EnMd_UpdateTalkState = 0x80AE3560; // type:func -EnMd_ShouldSpawn = 0x80AE3698; // type:func -EnMd_UpdateEyes = 0x80AE373C; // type:func -EnMd_UpdateTalking = 0x80AE37B4; // type:func -EnMd_FollowPath = 0x80AE39D0; // type:func -EnMd_SetMovedPos = 0x80AE3B3C; // type:func -EnMd_UpdateAlphaByDistance = 0x80AE3C04; // type:func -EnMd_Init = 0x80AE3CB0; // type:func -EnMd_Destroy = 0x80AE3EAC; // type:func -EnMd_Idle = 0x80AE3ED8; // type:func -EnMd_Watch = 0x80AE3F5C; // type:func -EnMd_BlockPath = 0x80AE3FAC; // type:func -EnMd_ListenToOcarina = 0x80AE427C; // type:func -EnMd_Walk = 0x80AE4378; // type:func -EnMd_Update = 0x80AE44A0; // type:func -EnMd_OverrideLimbDraw = 0x80AE4560; // type:func -EnMd_PostLimbDraw = 0x80AE477C; // type:func -EnMd_Draw = 0x80AE47D8; // type:func -EnHy_FindSkelAndHeadObjects = 0x80AE4F10; // type:func -EnHy_AreSkelAndHeadObjectsLoaded = 0x80AE5024; // type:func -EnHy_FindOsAnimeObject = 0x80AE50AC; // type:func -EnHy_IsOsAnimeObjectLoaded = 0x80AE50FC; // type:func -EnHy_GiveItem = 0x80AE513C; // type:func -EnHy_GetTextId = 0x80AE5180; // type:func -EnHy_UpdateTalkState = 0x80AE59C8; // type:func -EnHy_UpdateEyes = 0x80AE5F14; // type:func -EnHy_InitCollider = 0x80AE5FD0; // type:func -EnHy_InitSetProperties = 0x80AE600C; // type:func -EnHy_UpdateCollider = 0x80AE60A4; // type:func -EnHy_OfferBuyBottledItem = 0x80AE61A8; // type:func -EnHy_UpdateNPC = 0x80AE62F0; // type:func -EnHy_ShouldSpawn = 0x80AE6460; // type:func -EnHy_Init = 0x80AE66FC; // type:func -EnHy_Destroy = 0x80AE678C; // type:func -EnHy_WaitForObjects = 0x80AE67B8; // type:func -EnHy_WatchDog = 0x80AE6A84; // type:func -EnHy_Walk = 0x80AE6B40; // type:func -EnHy_Fidget = 0x80AE6C0C; // type:func -EnHy_DoNothing = 0x80AE6C44; // type:func -EnHy_SetupPace = 0x80AE6C54; // type:func -EnHy_Pace = 0x80AE6CE0; // type:func -EnHy_WaitDogFoundRewardGiven = 0x80AE6E5C; // type:func -EnHy_FinishGivingDogFoundReward = 0x80AE6ECC; // type:func -EnHy_Update = 0x80AE6F7C; // type:func -EnHy_OverrideLimbDraw = 0x80AE705C; // type:func -EnHy_PostLimbDraw = 0x80AE73C8; // type:func -EnHy_SetEnvColor = 0x80AE74D4; // type:func -EnHy_Draw = 0x80AE7540; // type:func -EnGanonMant_Init = 0x80AE8850; // type:func -EnGanonMant_Destroy = 0x80AE886C; // type:func -EnGanonMant_Tear = 0x80AE887C; // type:func -EnGanonMant_UpdateStrand = 0x80AE8AD8; // type:func -EnGanonMant_UpdateVertices = 0x80AE909C; // type:func -EnGanonMant_Update = 0x80AE92C0; // type:func -EnGanonMant_DrawCloak = 0x80AE937C; // type:func -EnGanonMant_Draw = 0x80AE9498; // type:func -EnOkarinaEffect_SetupAction = 0x80AECA80; // type:func -EnOkarinaEffect_Destroy = 0x80AECA8C; // type:func -EnOkarinaEffect_Init = 0x80AECB0C; // type:func -EnOkarinaEffect_TriggerStorm = 0x80AECB54; // type:func -EnOkarinaEffect_ManageStorm = 0x80AECBE0; // type:func -EnOkarinaEffect_Update = 0x80AECDB0; // type:func -EnMag_ResetSram = 0x80AECE40; // type:func -EnMag_Init = 0x80AED004; // type:func -EnMag_Destroy = 0x80AED2A8; // type:func -EnMag_CheckSramResetCode = 0x80AED2B0; // type:func -EnMag_Update = 0x80AED3FC; // type:func -EnMag_DrawTextureI8 = 0x80AEDC5C; // type:func -EnMag_DrawEffectTextures = 0x80AEDE8C; // type:func -EnMag_DrawImageRGBA32 = 0x80AEE2EC; // type:func -EnMag_DrawCharTexture = 0x80AEE744; // type:func -EnMag_DrawInner = 0x80AEE8F8; // type:func -EnMag_Draw = 0x80AEFAC0; // type:func -DoorGerudo_Init = 0x80AF1E80; // type:func -DoorGerudo_Destroy = 0x80AF1F30; // type:func -func_809946BC = 0x80AF1F64; // type:func -func_80994750 = 0x80AF1FFC; // type:func -func_8099485C = 0x80AF2108; // type:func -func_8099496C = 0x80AF2218; // type:func -func_809949C8 = 0x80AF2274; // type:func -DoorGerudo_Update = 0x80AF22D0; // type:func -DoorGerudo_Draw = 0x80AF22F4; // type:func -ElfMsg2_SetupAction = 0x80AF2470; // type:func -ElfMsg2_KillCheck = 0x80AF247C; // type:func -ElfMsg2_Init = 0x80AF25B4; // type:func -ElfMsg2_Destroy = 0x80AF2674; // type:func -ElfMsg2_GetMessageId = 0x80AF2684; // type:func -ElfMsg2_WaitForTextClose = 0x80AF2698; // type:func -ElfMsg2_WaitForTextRead = 0x80AF2718; // type:func -ElfMsg2_WaitUntilActivated = 0x80AF2750; // type:func -ElfMsg2_Update = 0x80AF27CC; // type:func -DemoGt_Destroy = 0x80AF28E0; // type:func -DemoGt_PlayEarthquakeSfx = 0x80AF2928; // type:func -DemoGt_PlayExplosion1Sfx = 0x80AF2948; // type:func -DemoGt_PlayExplosion2Sfx = 0x80AF296C; // type:func -DemoGt_Rumble = 0x80AF2990; // type:func -DemoGt_SpawnDust = 0x80AF29C0; // type:func -func_8097D7D8 = 0x80AF2A50; // type:func -DemoGt_SpawnCloudRing = 0x80AF2BD8; // type:func -DemoGt_SpawnExplosionWithSound = 0x80AF2C38; // type:func -DemoGt_SpawnExplosionNoSound = 0x80AF2CEC; // type:func -func_8097DAC8 = 0x80AF2D40; // type:func -func_8097DD28 = 0x80AF2FA0; // type:func -func_8097DF70 = 0x80AF31E8; // type:func -func_8097E1D4 = 0x80AF344C; // type:func -func_8097E454 = 0x80AF36CC; // type:func -DemoGt_IsCutsceneIdle = 0x80AF391C; // type:func -DemoGt_GetCue = 0x80AF393C; // type:func -func_8097E704 = 0x80AF3988; // type:func -func_8097E744 = 0x80AF39C8; // type:func -func_8097E824 = 0x80AF3AA8; // type:func -func_8097ED64 = 0x80AF3FE4; // type:func -DemoGt_IsCutsceneLayer = 0x80AF401C; // type:func -func_8097EDD8 = 0x80AF4044; // type:func -func_8097EE44 = 0x80AF40BC; // type:func -func_8097EEA8_Init0 = 0x80AF4120; // type:func -func_8097EF00 = 0x80AF4178; // type:func -func_8097EF34 = 0x80AF41AC; // type:func -func_8097EF40 = 0x80AF41BC; // type:func -func_8097F0AC = 0x80AF4314; // type:func -func_8097F19C = 0x80AF43F8; // type:func -func_8097F1D8 = 0x80AF443C; // type:func -func_8097F280 = 0x80AF44E4; // type:func -func_8097F3EC = 0x80AF4658; // type:func -DemoGt_Update0 = 0x80AF4698; // type:func -DemoGt_Update8 = 0x80AF4710; // type:func -DemoGt_Draw1 = 0x80AF4788; // type:func -func_8097F904_Init1 = 0x80AF4B4C; // type:func -func_8097F960 = 0x80AF4BA8; // type:func -func_8097F96C = 0x80AF4BB8; // type:func -func_8097FA1C = 0x80AF4C4C; // type:func -func_8097FAFC = 0x80AF4D14; // type:func -func_8097FC1C = 0x80AF4E1C; // type:func -func_8097FCE4 = 0x80AF4ED0; // type:func -func_8097FD70 = 0x80AF4F4C; // type:func -func_8097FDDC = 0x80AF4FC0; // type:func -func_8097FED8 = 0x80AF50C0; // type:func -DemoGt_Update1 = 0x80AF5100; // type:func -DemoGt_Update9 = 0x80AF5150; // type:func -DemoGt_Draw2 = 0x80AF5198; // type:func -func_80980110_Init2 = 0x80AF52CC; // type:func -func_8098016C = 0x80AF5328; // type:func -func_80980178 = 0x80AF5338; // type:func -func_80980184 = 0x80AF5348; // type:func -func_80980218 = 0x80AF53DC; // type:func -func_809802AC = 0x80AF5470; // type:func -func_8098036C = 0x80AF5534; // type:func -func_80980430 = 0x80AF55FC; // type:func -func_80980504 = 0x80AF56BC; // type:func -func_809805D8 = 0x80AF577C; // type:func -func_809806B8 = 0x80AF5844; // type:func -func_8098078C = 0x80AF5904; // type:func -func_8098085C = 0x80AF59C0; // type:func -func_809809C0 = 0x80AF5B0C; // type:func -func_80980AD4 = 0x80AF5C10; // type:func -func_80980B68 = 0x80AF5C90; // type:func -func_80980BFC = 0x80AF5D10; // type:func -func_80980C90 = 0x80AF5D90; // type:func -func_80980D74 = 0x80AF5E7C; // type:func -DemoGt_Update2 = 0x80AF5EBC; // type:func -DemoGt_Update10 = 0x80AF5F00; // type:func -DemoGt_Draw3 = 0x80AF5F3C; // type:func -func_80980F00_Init5 = 0x80AF5FD8; // type:func -func_80980F58 = 0x80AF6030; // type:func -func_80980F8C = 0x80AF6068; // type:func -func_8098103C = 0x80AF611C; // type:func -DemoGt_Update3 = 0x80AF6180; // type:func -DemoGt_Update11 = 0x80AF61C4; // type:func -DemoGt_Update16 = 0x80AF6200; // type:func -DemoGt_Draw4 = 0x80AF6298; // type:func -func_809813CC_Init6 = 0x80AF6480; // type:func -func_80981424 = 0x80AF64D8; // type:func -func_80981458 = 0x80AF6510; // type:func -func_80981524 = 0x80AF65C8; // type:func -DemoGt_Update4 = 0x80AF662C; // type:func -DemoGt_Update12 = 0x80AF6670; // type:func -DemoGt_Update17 = 0x80AF66AC; // type:func -DemoGt_Draw5 = 0x80AF6744; // type:func -func_809818A4_Init7 = 0x80AF6920; // type:func -func_809818FC = 0x80AF6978; // type:func -func_80981930 = 0x80AF69B0; // type:func -DemoGt_Update5 = 0x80AF6A14; // type:func -DemoGt_Update13 = 0x80AF6A58; // type:func -DemoGt_Update18 = 0x80AF6A94; // type:func -DemoGt_Draw6 = 0x80AF6B2C; // type:func -func_80981C94_Init23 = 0x80AF6CE4; // type:func -func_80981CEC = 0x80AF6D3C; // type:func -func_80981D20 = 0x80AF6D74; // type:func -func_80981DC8 = 0x80AF6E1C; // type:func -DemoGt_Update6 = 0x80AF6E5C; // type:func -DemoGt_Update14 = 0x80AF6EA0; // type:func -DemoGt_Draw7 = 0x80AF6EE4; // type:func -func_80982054_Init24 = 0x80AF707C; // type:func -func_809820AC = 0x80AF70D4; // type:func -func_809820E0 = 0x80AF710C; // type:func -func_80982188 = 0x80AF71B4; // type:func -DemoGt_Update7 = 0x80AF71F4; // type:func -DemoGt_Update15 = 0x80AF7238; // type:func -DemoGt_Draw8 = 0x80AF727C; // type:func -DemoGt_Update = 0x80AF7418; // type:func -DemoGt_Init = 0x80AF7460; // type:func -DemoGt_Draw0 = 0x80AF7524; // type:func -DemoGt_Draw = 0x80AF7534; // type:func -EnPoField_Init = 0x80AF7EF0; // type:func -EnPoField_Destroy = 0x80AF80F8; // type:func -EnPoField_SetupWaitForSpawn = 0x80AF8158; // type:func -EnPoField_SetupAppear = 0x80AF821C; // type:func -EnPoField_SetupCirclePlayer = 0x80AF833C; // type:func -EnPoField_SetupFlee = 0x80AF83E4; // type:func -EnPoField_SetupDamage = 0x80AF8478; // type:func -EnPoField_SetupDeath = 0x80AF8534; // type:func -EnPoField_SetupDisappear = 0x80AF8588; // type:func -EnPoField_SetupSoulIdle = 0x80AF8600; // type:func -func_80AD42B0 = 0x80AF86B0; // type:func -func_80AD4384 = 0x80AF8784; // type:func -EnPoField_SetupSoulDisappear = 0x80AF883C; // type:func -EnPoField_SetupInteractWithSoul = 0x80AF8850; // type:func -EnPoField_CorrectYPos = 0x80AF8878; // type:func -EnPoField_SetFleeSpeed = 0x80AF895C; // type:func -EnPoField_WaitForSpawn = 0x80AF8A6C; // type:func -EnPoField_Appear = 0x80AF8CD4; // type:func -EnPoField_CirclePlayer = 0x80AF8E70; // type:func -EnPoField_Flee = 0x80AF90B0; // type:func -EnPoField_Damage = 0x80AF9254; // type:func -EnPoField_Death = 0x80AF92E4; // type:func -EnPoField_Disappear = 0x80AF96FC; // type:func -EnPoField_SoulIdle = 0x80AF97FC; // type:func -EnPoField_SoulUpdateProperties = 0x80AF98E0; // type:func -func_80AD587C = 0x80AF9C88; // type:func -func_80AD58D4 = 0x80AF9CE0; // type:func -EnPoField_SoulDisappear = 0x80AF9EE4; // type:func -EnPoField_SoulInteract = 0x80AF9F24; // type:func -EnPoField_TestForDamage = 0x80AFA084; // type:func -EnPoField_SpawnFlame = 0x80AFA11C; // type:func -EnPoField_UpdateFlame = 0x80AFA170; // type:func -EnPoField_DrawFlame = 0x80AFA29C; // type:func -func_80AD619C = 0x80AFA574; // type:func -func_80AD6330 = 0x80AFA708; // type:func -EnPoField_Update = 0x80AFA87C; // type:func -EnPoField_OverrideLimbDraw2 = 0x80AFA9A8; // type:func -EnPoField_PostLimDraw2 = 0x80AFAAB0; // type:func -EnPoField_Draw = 0x80AFACC0; // type:func -EnPoField_UpdateDead = 0x80AFAFA4; // type:func -EnPoField_DrawSoul = 0x80AFB000; // type:func -EfcErupc_SetupAction = 0x80AFB980; // type:func -EfcErupc_Init = 0x80AFB98C; // type:func -EfcErupc_Destroy = 0x80AFB9F8; // type:func -EfcErupc_UpdateAction = 0x80AFBA08; // type:func -EfcErupc_Update = 0x80AFBC54; // type:func -EfcErupc_Draw = 0x80AFBC90; // type:func -EfcErupc_DrawEffects = 0x80AFBFD0; // type:func -EfcErupc_UpdateEffects = 0x80AFC18C; // type:func -EfcErupc_SpawnEffect = 0x80AFC2B0; // type:func -EfcErupc_InitEffects = 0x80AFC37C; // type:func -BgZg_Destroy = 0x80AFC470; // type:func -func_808C0C50 = 0x80AFC4A4; // type:func -func_808C0C98 = 0x80AFC4EC; // type:func -func_808C0CC8 = 0x80AFC520; // type:func -func_808C0CD4 = 0x80AFC530; // type:func -func_808C0D08 = 0x80AFC564; // type:func -BgZg_Update = 0x80AFC608; // type:func -BgZg_Init = 0x80AFC650; // type:func -func_808C0EEC = 0x80AFC73C; // type:func -BgZg_Draw = 0x80AFC7B8; // type:func -EnHeishi4_Init = 0x80AFC8C0; // type:func -EnHeishi4_Destroy = 0x80AFCAA0; // type:func -func_80A56328 = 0x80AFCACC; // type:func -func_80A563BC = 0x80AFCB60; // type:func -func_80A56544 = 0x80AFCCE8; // type:func -func_80A56614 = 0x80AFCDAC; // type:func -func_80A5673C = 0x80AFCED4; // type:func -func_80A56874 = 0x80AFCFE8; // type:func -func_80A56900 = 0x80AFD074; // type:func -func_80A56994 = 0x80AFD108; // type:func -func_80A56A50 = 0x80AFD1C4; // type:func -func_80A56ACC = 0x80AFD240; // type:func -func_80A56B40 = 0x80AFD2B4; // type:func -EnHeishi4_Update = 0x80AFD428; // type:func -EnHeishi_OverrideLimbDraw = 0x80AFD58C; // type:func -EnHeishi4_Draw = 0x80AFD5F4; // type:func -func_80B533B0 = 0x80AFD7C0; // type:func -func_80B533FC = 0x80AFD80C; // type:func -EnZl3_Destroy = 0x80AFD850; // type:func -func_80B53468 = 0x80AFD87C; // type:func -func_80B53488 = 0x80AFD89C; // type:func -EnZl3_UpdateEyes = 0x80AFD8E8; // type:func -EnZl3_setEyeIndex = 0x80AFD970; // type:func -EnZl3_setMouthIndex = 0x80AFD988; // type:func -func_80B5357C = 0x80AFD9A0; // type:func -func_80B53614 = 0x80AFDA3C; // type:func -func_80B5366C = 0x80AFDA94; // type:func -func_80B536B4 = 0x80AFDADC; // type:func -func_80B536C4 = 0x80AFDAF0; // type:func -func_80B53764 = 0x80AFDB94; // type:func -func_80B537E8 = 0x80AFDC1C; // type:func -func_80B538B0 = 0x80AFDCE4; // type:func -EnZl3_UpdateSkelAnime = 0x80AFDD80; // type:func -func_80B5396C = 0x80AFDDA4; // type:func -func_80B53974 = 0x80AFDDB0; // type:func -func_80B53980 = 0x80AFDDC4; // type:func -func_80B53B64 = 0x80AFDFAC; // type:func -func_80B54360 = 0x80AFE7BC; // type:func -func_80B5458C = 0x80AFE9EC; // type:func -EnZl3_PostLimbDraw = 0x80AFF0E8; // type:func -func_80B54DB4 = 0x80AFF1B4; // type:func -func_80B54DC4 = 0x80AFF1C8; // type:func -func_80B54DD4 = 0x80AFF1DC; // type:func -func_80B54DE0 = 0x80AFF1EC; // type:func -func_80B54E14 = 0x80AFF224; // type:func -func_80B54EA4 = 0x80AFF2B4; // type:func -func_80B54EF4 = 0x80AFF308; // type:func -func_80B54F18 = 0x80AFF330; // type:func -func_80B54FB4 = 0x80AFF3D0; // type:func -func_80B55054 = 0x80AFF454; // type:func -func_80B550F0 = 0x80AFF4F4; // type:func -func_80B55144 = 0x80AFF548; // type:func -func_80B551E0 = 0x80AFF5E8; // type:func -func_80B55220 = 0x80AFF628; // type:func -func_80B55268 = 0x80AFF670; // type:func -func_80B552A8 = 0x80AFF6B0; // type:func -func_80B552DC = 0x80AFF6E4; // type:func -func_80B55334 = 0x80AFF740; // type:func -func_80B55368 = 0x80AFF774; // type:func -func_80B553B4 = 0x80AFF7C0; // type:func -func_80B553E8 = 0x80AFF7F4; // type:func -func_80B55408 = 0x80AFF814; // type:func -func_80B55444 = 0x80AFF850; // type:func -func_80B55550 = 0x80AFF954; // type:func -func_80B555A4 = 0x80AFF9B0; // type:func -func_80B55604 = 0x80AFFA18; // type:func -func_80B5566C = 0x80AFFA88; // type:func -func_80B556CC = 0x80AFFAF0; // type:func -func_80B5572C = 0x80AFFB58; // type:func -func_80B55780 = 0x80AFFBB4; // type:func -func_80B55808 = 0x80AFFC18; // type:func -func_80B5582C = 0x80AFFC40; // type:func -func_80B5585C = 0x80AFFC70; // type:func -func_80B558A8 = 0x80AFFCBC; // type:func -func_80B559C4 = 0x80AFFDDC; // type:func -func_80B55A58 = 0x80AFFE6C; // type:func -func_80B55A84 = 0x80AFFE98; // type:func -func_80B55AC4 = 0x80AFFED8; // type:func -func_80B55B04 = 0x80AFFF18; // type:func -func_80B55B38 = 0x80AFFF4C; // type:func -func_80B55B78 = 0x80AFFF8C; // type:func -func_80B55BAC = 0x80AFFFC0; // type:func -func_80B55C0C = 0x80B00024; // type:func -func_80B55C4C = 0x80B00064; // type:func -func_80B55C70 = 0x80B0008C; // type:func -func_80B55CCC = 0x80B000E4; // type:func -func_80B55D00 = 0x80B00118; // type:func -func_80B55DB0 = 0x80B001CC; // type:func -func_80B55E08 = 0x80B00224; // type:func -func_80B55E48 = 0x80B00264; // type:func -func_80B55E7C = 0x80B00298; // type:func -func_80B55EBC = 0x80B002D8; // type:func -func_80B55EF0 = 0x80B0030C; // type:func -func_80B55F38 = 0x80B00354; // type:func -func_80B55F6C = 0x80B00388; // type:func -func_80B5604C = 0x80B0046C; // type:func -func_80B56090 = 0x80B004B0; // type:func -func_80B56108 = 0x80B0052C; // type:func -func_80B56160 = 0x80B00584; // type:func -func_80B561A0 = 0x80B005C4; // type:func -func_80B561E0 = 0x80B00604; // type:func -func_80B56214 = 0x80B00638; // type:func -func_80B562F4 = 0x80B0071C; // type:func -func_80B5634C = 0x80B00774; // type:func -func_80B5638C = 0x80B007B4; // type:func -func_80B563C0 = 0x80B007E8; // type:func -func_80B56400 = 0x80B00828; // type:func -func_80B56434 = 0x80B0085C; // type:func -func_80B56474 = 0x80B0089C; // type:func -func_80B564A8 = 0x80B008D0; // type:func -func_80B56658 = 0x80B00A70; // type:func -func_80B566AC = 0x80B00ACC; // type:func -func_80B5670C = 0x80B00B34; // type:func -func_80B5676C = 0x80B00B9C; // type:func -func_80B567CC = 0x80B00C04; // type:func -func_80B5682C = 0x80B00C6C; // type:func -func_80B568B4 = 0x80B00CFC; // type:func -func_80B5691C = 0x80B00D6C; // type:func -func_80B5697C = 0x80B00DD4; // type:func -func_80B569E4 = 0x80B00E44; // type:func -func_80B56A68 = 0x80B00ED0; // type:func -func_80B56AE0 = 0x80B00F50; // type:func -func_80B56B54 = 0x80B00FCC; // type:func -func_80B56BA8 = 0x80B01028; // type:func -func_80B56C24 = 0x80B010AC; // type:func -func_80B56C84 = 0x80B01114; // type:func -func_80B56CE4 = 0x80B0117C; // type:func -func_80B56D44 = 0x80B011E4; // type:func -func_80B56DA4 = 0x80B0124C; // type:func -func_80B56DC8 = 0x80B01270; // type:func -func_80B56DEC = 0x80B01298; // type:func -func_80B56E38 = 0x80B012E4; // type:func -func_80B56EB8 = 0x80B01364; // type:func -func_80B56EE4 = 0x80B01394; // type:func -func_80B56F10 = 0x80B013C4; // type:func -func_80B56F8C = 0x80B01418; // type:func -func_80B56FAC = 0x80B01438; // type:func -func_80B57034 = 0x80B014C4; // type:func -func_80B57104 = 0x80B01598; // type:func -func_80B571A8 = 0x80B01640; // type:func -func_80B571FC = 0x80B01694; // type:func -func_80B57240 = 0x80B016D8; // type:func -func_80B57298 = 0x80B01730; // type:func -func_80B572F0 = 0x80B01788; // type:func -func_80B57324 = 0x80B017C0; // type:func -func_80B57350 = 0x80B017EC; // type:func -func_80B573C8 = 0x80B01864; // type:func -func_80B573FC = 0x80B01898; // type:func -func_80B57458 = 0x80B018F4; // type:func -func_80B57564 = 0x80B01A04; // type:func -func_80B575B0 = 0x80B01A58; // type:func -func_80B575D0 = 0x80B01A78; // type:func -func_80B575F0 = 0x80B01A98; // type:func -func_80B5764C = 0x80B01AF4; // type:func -func_80B576C8 = 0x80B01B74; // type:func -func_80B57704 = 0x80B01BB8; // type:func -func_80B5772C = 0x80B01BE4; // type:func -func_80B57754 = 0x80B01C10; // type:func -func_80B577BC = 0x80B01C7C; // type:func -func_80B57858 = 0x80B01D1C; // type:func -func_80B57890 = 0x80B01D58; // type:func -func_80B57A74 = 0x80B01F40; // type:func -func_80B57AAC = 0x80B01F78; // type:func -func_80B57AE0 = 0x80B01FAC; // type:func -func_80B57C54 = 0x80B02124; // type:func -func_80B57C7C = 0x80B0214C; // type:func -func_80B57C8C = 0x80B02160; // type:func -func_80B57CB4 = 0x80B02188; // type:func -func_80B57D60 = 0x80B02230; // type:func -func_80B57D80 = 0x80B02254; // type:func -func_80B57EAC = 0x80B0238C; // type:func -func_80B57EEC = 0x80B023D4; // type:func -func_80B57F1C = 0x80B02408; // type:func -func_80B57F84 = 0x80B02474; // type:func -func_80B58014 = 0x80B0250C; // type:func -func_80B58214 = 0x80B02718; // type:func -func_80B58268 = 0x80B02770; // type:func -func_80B582C8 = 0x80B027D0; // type:func -func_80B584B4 = 0x80B029BC; // type:func -func_80B58624 = 0x80B02B2C; // type:func -func_80B5884C = 0x80B02D5C; // type:func -func_80B58898 = 0x80B02DA8; // type:func -func_80B588E8 = 0x80B02DF8; // type:func -func_80B58938 = 0x80B02E48; // type:func -func_80B5899C = 0x80B02EB0; // type:func -func_80B58A1C = 0x80B02F30; // type:func -func_80B58A50 = 0x80B02F6C; // type:func -func_80B58AAC = 0x80B02FCC; // type:func -func_80B58C08 = 0x80B03128; // type:func -func_80B58D50 = 0x80B03270; // type:func -func_80B58DB0 = 0x80B032D8; // type:func -func_80B58E10 = 0x80B03340; // type:func -func_80B58E7C = 0x80B033B4; // type:func -func_80B58EF4 = 0x80B03434; // type:func -func_80B58F6C = 0x80B034B4; // type:func -func_80B58FDC = 0x80B0352C; // type:func -func_80B5904C = 0x80B035A4; // type:func -func_80B590BC = 0x80B0361C; // type:func -func_80B5912C = 0x80B03694; // type:func -func_80B591BC = 0x80B0372C; // type:func -func_80B5922C = 0x80B037A4; // type:func -func_80B592A8 = 0x80B03828; // type:func -func_80B59340 = 0x80B038C8; // type:func -func_80B593D0 = 0x80B03960; // type:func -func_80B5944C = 0x80B039E4; // type:func -func_80B59698 = 0x80B03BE0; // type:func -func_80B59768 = 0x80B03CB0; // type:func -func_80B59828 = 0x80B03D70; // type:func -func_80B59A80 = 0x80B03FD0; // type:func -func_80B59AD0 = 0x80B04020; // type:func -func_80B59B6C = 0x80B040BC; // type:func -func_80B59DB8 = 0x80B04304; // type:func -EnZl3_Update = 0x80B04374; // type:func -EnZl3_Init = 0x80B043BC; // type:func -EnZl3_OverrideLimbDraw = 0x80B0447C; // type:func -func_80B59FE8 = 0x80B044E4; // type:func -func_80B59FF4 = 0x80B044F4; // type:func -func_80B5A1D0 = 0x80B046A0; // type:func -EnZl3_Draw = 0x80B04848; // type:func -BossGanon2_InitRand = 0x80B05610; // type:func -BossGanon2_RandZeroOne = 0x80B05630; // type:func -func_808FD080 = 0x80B05758; // type:func -BossGanon2_SetObjectSegment = 0x80B057E8; // type:func -func_808FD210 = 0x80B0589C; // type:func -func_808FD27C = 0x80B0590C; // type:func -BossGanon2_Init = 0x80B059EC; // type:func -BossGanon2_Destroy = 0x80B05B1C; // type:func -func_808FD4D4 = 0x80B05B6C; // type:func -func_808FD5C4 = 0x80B05C5C; // type:func -func_808FD5F4 = 0x80B05C90; // type:func -func_808FF898 = 0x80B07F40; // type:func -func_808FFA24 = 0x80B080CC; // type:func -func_808FFAC8 = 0x80B08170; // type:func -func_808FFBBC = 0x80B08268; // type:func -func_808FFC84 = 0x80B08334; // type:func -func_808FFCFC = 0x80B083AC; // type:func -func_808FFDB0 = 0x80B08460; // type:func -func_808FFEBC = 0x80B08570; // type:func -func_808FFF90 = 0x80B08644; // type:func -func_808FFFE0 = 0x80B08694; // type:func -func_809000A0 = 0x80B08754; // type:func -func_80900104 = 0x80B087B4; // type:func -func_80900210 = 0x80B088C0; // type:func -func_8090026C = 0x80B0891C; // type:func -func_809002CC = 0x80B08980; // type:func -func_80900344 = 0x80B089F4; // type:func -func_80900580 = 0x80B08C30; // type:func -func_80900650 = 0x80B08D00; // type:func -func_80900818 = 0x80B08EC8; // type:func -func_80900890 = 0x80B08F40; // type:func -func_80901020 = 0x80B096D4; // type:func -func_8090109C = 0x80B09750; // type:func -func_8090120C = 0x80B098C0; // type:func -func_80902348 = 0x80B0AA04; // type:func -BossGanon2_CollisionCheck = 0x80B0ABE4; // type:func -BossGanon2_Update = 0x80B0AED8; // type:func -func_809034E4 = 0x80B0BBA4; // type:func -func_80903F38 = 0x80B0C5F8; // type:func -func_80904108 = 0x80B0C784; // type:func -func_80904340 = 0x80B0C988; // type:func -func_8090464C = 0x80B0CC78; // type:func -BossGanon2_OverrideLimbDraw = 0x80B0CE0C; // type:func -BossGanon2_PostLimbDraw = 0x80B0CF44; // type:func -func_80904D88 = 0x80B0D308; // type:func -func_80904FC8 = 0x80B0D50C; // type:func -func_8090523C = 0x80B0D730; // type:func -BossGanon2_PostLimbDraw2 = 0x80B0D9C0; // type:func -func_80905674 = 0x80B0DAEC; // type:func -BossGanon2_Draw = 0x80B0DD34; // type:func -BossGanon2_UpdateEffects = 0x80B0E1B4; // type:func -BossGanon2_DrawEffects = 0x80B0E4F8; // type:func -func_80906538 = 0x80B0E8F0; // type:func -BossGanon2_GenShadowTexture = 0x80B0EDB0; // type:func -BossGanon2_DrawShadowTexture = 0x80B0EE68; // type:func -EnKakasi_Destroy = 0x80B18480; // type:func -EnKakasi_Init = 0x80B184AC; // type:func -func_80A8F28C = 0x80B18574; // type:func -func_80A8F320 = 0x80B18608; // type:func -func_80A8F660 = 0x80B18948; // type:func -func_80A8F75C = 0x80B18A44; // type:func -func_80A8F8D0 = 0x80B18BC0; // type:func -func_80A8F9C8 = 0x80B18CAC; // type:func -func_80A8FAA4 = 0x80B18D8C; // type:func -func_80A8FBB8 = 0x80B18E90; // type:func -EnKakasi_Update = 0x80B18F28; // type:func -EnKakasi_Draw = 0x80B1902C; // type:func -EnTakaraMan_Destroy = 0x80B191C0; // type:func -EnTakaraMan_Init = 0x80B191D0; // type:func -func_80B176E0 = 0x80B1931C; // type:func -func_80B1778C = 0x80B193C8; // type:func -func_80B17934 = 0x80B19570; // type:func -func_80B17A6C = 0x80B196A8; // type:func -func_80B17AC4 = 0x80B19704; // type:func -func_80B17B14 = 0x80B19758; // type:func -EnTakaraMan_Update = 0x80B197BC; // type:func -EnTakaraMan_OverrideLimbDraw = 0x80B19894; // type:func -EnTakaraMan_Draw = 0x80B198FC; // type:func -ObjMakeoshihiki_Init = 0x80B19A80; // type:func -ObjMakeoshihiki_Draw = 0x80B19BF4; // type:func -OceffSpot_SetupAction = 0x80B19F10; // type:func -OceffSpot_Init = 0x80B19F1C; // type:func -OceffSpot_Destroy = 0x80B1A078; // type:func -OceffSpot_End = 0x80B1A108; // type:func -OceffSpot_Wait = 0x80B1A1D0; // type:func -OceffSpot_GrowCylinder = 0x80B1A20C; // type:func -OceffSpot_Update = 0x80B1A270; // type:func -OceffSpot_Draw = 0x80B1A548; // type:func -EndTitle_Init = 0x80B1AE40; // type:func -EndTitle_Destroy = 0x80B1AE6C; // type:func -EndTitle_Update = 0x80B1AE74; // type:func -EndTitle_DrawFull = 0x80B1AE7C; // type:func -EndTitle_DrawNintendoLogo = 0x80B1B4D8; // type:func -EnTorch_Init = 0x80B20880; // type:func -DemoEc_Destroy = 0x80B20970; // type:func -DemoEc_Init = 0x80B20994; // type:func -DemoEc_UpdateSkelAnime = 0x80B209DC; // type:func -DemoEc_UpdateBgFlags = 0x80B20A00; // type:func -func_8096D594 = 0x80B20A48; // type:func -func_8096D5D4 = 0x80B20A88; // type:func -func_8096D64C = 0x80B20B00; // type:func -DemoEc_UpdateEyes = 0x80B20B40; // type:func -DemoEc_SetEyeTexIndex = 0x80B20BC8; // type:func -DemoEc_InitSkelAnime = 0x80B20BE0; // type:func -DemoEc_ChangeAnimation = 0x80B20C58; // type:func -DemoEc_AllocColorDList = 0x80B20D14; // type:func -DemoEc_DrawSkeleton = 0x80B20D6C; // type:func -DemoEc_DrawSkeletonCustomColor = 0x80B20EFC; // type:func -DemoEc_UseDrawObject = 0x80B2115C; // type:func -DemoEc_UseAnimationObject = 0x80B211B8; // type:func -DemoEc_GetCue = 0x80B211F0; // type:func -DemoEc_SetStartPosRotFromCue = 0x80B21218; // type:func -DemoEc_InitIngo = 0x80B21298; // type:func -DemoEc_UpdateIngo = 0x80B21338; // type:func -DemoEc_DrawIngo = 0x80B21378; // type:func -DemoEc_InitTalon = 0x80B213AC; // type:func -DemoEc_UpdateTalon = 0x80B2144C; // type:func -DemoEc_DrawTalon = 0x80B2148C; // type:func -DemoEc_InitWindmillMan = 0x80B214C0; // type:func -DemoEc_UpdateWindmillMan = 0x80B21560; // type:func -DemoEc_DrawWindmillMan = 0x80B215A0; // type:func -DemoEc_InitKokiriBoy = 0x80B215D4; // type:func -DemoEc_InitDancingKokiriBoy = 0x80B21674; // type:func -DemoEc_UpdateKokiriBoy = 0x80B21718; // type:func -DemoEc_UpdateDancingKokiriBoy = 0x80B21758; // type:func -DemoEc_DrawKokiriBoy = 0x80B21778; // type:func -DemoEc_InitKokiriGirl = 0x80B217BC; // type:func -DemoEc_InitDancingKokiriGirl = 0x80B2185C; // type:func -DemoEc_UpdateKokiriGirl = 0x80B21900; // type:func -DemoEc_UpdateDancingKokiriGirl = 0x80B21948; // type:func -DemoEc_DrawKokiriGirl = 0x80B21968; // type:func -DemoEc_InitOldMan = 0x80B219BC; // type:func -DemoEc_UpdateOldMan = 0x80B21A5C; // type:func -DemoEc_DrawOldMan = 0x80B21AA4; // type:func -DemoEc_InitBeardedMan = 0x80B21AF8; // type:func -DemoEc_UpdateBeardedMan = 0x80B21B98; // type:func -DemoEc_DrawBeardedMan = 0x80B21BE0; // type:func -DemoEc_InitWoman = 0x80B21C34; // type:func -DemoEc_UpdateWoman = 0x80B21CD4; // type:func -DemoEc_DrawWoman = 0x80B21D1C; // type:func -DemoEc_InitOldWoman = 0x80B21D58; // type:func -DemoEc_UpdateOldWoman = 0x80B21DF8; // type:func -DemoEc_DrawOldWoman = 0x80B21E38; // type:func -DemoEc_InitBossCarpenter = 0x80B21E68; // type:func -DemoEc_UpdateBossCarpenter = 0x80B21F08; // type:func -DemoEc_DrawBossCarpenter = 0x80B21F48; // type:func -DemoEc_InitCarpenter = 0x80B21F74; // type:func -DemoEc_UpdateCarpenter = 0x80B22014; // type:func -DemoEc_CarpenterOverrideLimbDraw = 0x80B22054; // type:func -DemoEc_GetCarpenterPostLimbDList = 0x80B22158; // type:func -DemoEc_CarpenterPostLimbDraw = 0x80B221C0; // type:func -DemoEc_DrawCarpenter = 0x80B22244; // type:func -DemoEc_InitGerudo = 0x80B22280; // type:func -DemoEc_UpdateGerudo = 0x80B22324; // type:func -DemoEc_GetGerudoPostLimbDList = 0x80B2236C; // type:func -DemoEc_GerudoPostLimbDraw = 0x80B223C0; // type:func -DemoEc_DrawGerudo = 0x80B22444; // type:func -DemoEc_InitDancingZora = 0x80B22488; // type:func -DemoEc_UpdateDancingZora = 0x80B2252C; // type:func -DemoEc_DrawDancingZora = 0x80B22574; // type:func -DemoEc_InitKingZora = 0x80B225B0; // type:func -func_8096F1D4 = 0x80B22660; // type:func -func_8096F224 = 0x80B226B0; // type:func -func_8096F26C = 0x80B226F8; // type:func -func_8096F2B0 = 0x80B22740; // type:func -DemoEc_UpdateKingZora = 0x80B227A4; // type:func -func_8096F378 = 0x80B2280C; // type:func -func_8096F3D4 = 0x80B2286C; // type:func -DemoEc_DrawKingZora = 0x80B228B4; // type:func -DemoEc_InitMido = 0x80B228F0; // type:func -func_8096F4FC = 0x80B229A0; // type:func -func_8096F544 = 0x80B229E8; // type:func -func_8096F578 = 0x80B22A1C; // type:func -DemoEc_UpdateMido = 0x80B22A80; // type:func -func_8096F640 = 0x80B22AE8; // type:func -DemoEc_DrawMido = 0x80B22B48; // type:func -DemoEc_InitCucco = 0x80B22B84; // type:func -DemoEc_UpdateCucco = 0x80B22C54; // type:func -DemoEc_DrawCucco = 0x80B22C94; // type:func -DemoEc_InitCuccoLady = 0x80B22CC0; // type:func -DemoEc_UpdateCuccoLady = 0x80B22D64; // type:func -DemoEc_DrawCuccoLady = 0x80B22DAC; // type:func -DemoEc_InitPotionShopOwner = 0x80B22DE8; // type:func -DemoEc_UpdatePotionShopOwner = 0x80B22E8C; // type:func -DemoEc_DrawPotionShopOwner = 0x80B22ED4; // type:func -DemoEc_InitMaskShopOwner = 0x80B22F10; // type:func -DemoEc_UpdateMaskShopOwner = 0x80B22FB4; // type:func -DemoEc_DrawMaskShopOwner = 0x80B22FF4; // type:func -DemoEc_InitFishingOwner = 0x80B23024; // type:func -DemoEc_UpdateFishingOwner = 0x80B230C8; // type:func -DemoEc_FishingOwnerPostLimbDraw = 0x80B23110; // type:func -DemoEc_DrawFishingOwner = 0x80B23190; // type:func -DemoEc_InitBombchuShopOwner = 0x80B231D4; // type:func -DempEc_UpdateBombchuShopOwner = 0x80B23278; // type:func -DemoEc_DrawBombchuShopOwner = 0x80B232C0; // type:func -DemoEc_InitGorons = 0x80B232FC; // type:func -DemoEc_UpdateGorons = 0x80B23434; // type:func -DemoEc_DrawGorons = 0x80B2347C; // type:func -DemoEc_InitMalon = 0x80B234BC; // type:func -DemoEc_UpdateMalon = 0x80B23560; // type:func -DemoEc_DrawMalon = 0x80B235A8; // type:func -DemoEc_InitNpc = 0x80B235E8; // type:func -DemoEc_InitCommon = 0x80B23634; // type:func -DemoEc_Update = 0x80B23708; // type:func -DemoEc_DrawCommon = 0x80B23780; // type:func -DemoEc_Draw = 0x80B23790; // type:func -ShotSun_Init = 0x80B241D0; // type:func -ShotSun_Destroy = 0x80B2428C; // type:func -ShotSun_SpawnFairy = 0x80B242D0; // type:func -ShotSun_TriggerFairy = 0x80B24378; // type:func -ShotSun_UpdateFairySpawner = 0x80B24414; // type:func -ShotSun_UpdateHyliaSun = 0x80B24564; // type:func -ShotSun_Update = 0x80B2479C; // type:func -EnDyExtra_Destroy = 0x80B24890; // type:func -EnDyExtra_Init = 0x80B248A0; // type:func -EnDyExtra_WaitForTrigger = 0x80B24914; // type:func -EnDyExtra_FallAndKill = 0x80B249A8; // type:func -EnDyExtra_Update = 0x80B24A60; // type:func -EnDyExtra_Draw = 0x80B24ACC; // type:func -EnWonderTalk2_Destroy = 0x80B24E30; // type:func -EnWonderTalk2_Init = 0x80B24E40; // type:func -func_80B3A10C = 0x80B24FD0; // type:func -func_80B3A15C = 0x80B25020; // type:func -func_80B3A3D4 = 0x80B251A0; // type:func -func_80B3A4F8 = 0x80B25288; // type:func -EnWonderTalk2_DoNothing = 0x80B253D8; // type:func -EnWonderTalk2_Update = 0x80B253E8; // type:func -EnGe2_ChangeAction = 0x80B254D0; // type:func -EnGe2_Init = 0x80B25578; // type:func -EnGe2_Destroy = 0x80B25790; // type:func -Ge2_DetectPlayerInAction = 0x80B257BC; // type:func -Ge2_DetectPlayerInUpdate = 0x80B25868; // type:func -EnGe2_CheckAllCarpentersRescued = 0x80B25998; // type:func -EnGe2_CaptureClose = 0x80B259C4; // type:func -EnGe2_CaptureCharge = 0x80B25A98; // type:func -EnGe2_CaptureTurn = 0x80B25BCC; // type:func -EnGe2_KnockedOut = 0x80B25C44; // type:func -EnGe2_TurnPlayerSpotted = 0x80B25D3C; // type:func -EnGe2_AboutTurn = 0x80B25E44; // type:func -EnGe2_Walk = 0x80B25EFC; // type:func -EnGe2_Stand = 0x80B25FC4; // type:func -EnGe2_TurnToFacePlayer = 0x80B26004; // type:func -EnGe2_LookAtPlayer = 0x80B2611C; // type:func -EnGe2_SetActionAfterTalk = 0x80B26230; // type:func -EnGe2_WaitLookAtPlayer = 0x80B262F4; // type:func -EnGe2_WaitTillCardGiven = 0x80B26314; // type:func -EnGe2_GiveCard = 0x80B26378; // type:func -EnGe2_ForceTalk = 0x80B2640C; // type:func -EnGe2_SetupCapturePlayer = 0x80B26490; // type:func -EnGe2_MaintainColliderAndSetAnimState = 0x80B26500; // type:func -EnGe2_MoveAndBlink = 0x80B265A8; // type:func -EnGe2_UpdateFriendly = 0x80B26634; // type:func -EnGe2_UpdateAfterTalk = 0x80B2670C; // type:func -EnGe2_Update = 0x80B26760; // type:func -EnGe2_UpdateStunned = 0x80B26948; // type:func -EnGe2_OverrideLimbDraw = 0x80B26A7C; // type:func -EnGe2_PostLimbDraw = 0x80B26AC4; // type:func -EnGe2_Draw = 0x80B26B04; // type:func -ObjRoomtimer_Init = 0x80B26E70; // type:func -ObjRoomtimer_Destroy = 0x80B26EC4; // type:func -func_80B9D054 = 0x80B26EF8; // type:func -func_80B9D0B0 = 0x80B26F58; // type:func -ObjRoomtimer_Update = 0x80B27034; // type:func -EnSsh_SetupAction = 0x80B270C0; // type:func -EnSsh_SpawnShockwave = 0x80B270CC; // type:func -EnSsh_CreateBlureEffect = 0x80B27154; // type:func -EnSsh_CheckCeilingPos = 0x80B27250; // type:func -EnSsh_AddBlureVertex = 0x80B272E8; // type:func -EnSsh_AddBlureSpace = 0x80B273F0; // type:func -EnSsh_InitColliders = 0x80B2741C; // type:func -EnSsh_SetAnimation = 0x80B2755C; // type:func -EnSsh_SetWaitAnimation = 0x80B27690; // type:func -EnSsh_SetReturnAnimation = 0x80B276B0; // type:func -EnSsh_SetLandAnimation = 0x80B276E4; // type:func -EnSsh_SetDropAnimation = 0x80B27728; // type:func -EnSsh_SetStunned = 0x80B27778; // type:func -EnSsh_SetColliderScale = 0x80B277A4; // type:func -EnSsh_Damaged = 0x80B27918; // type:func -EnSsh_Turn = 0x80B279F4; // type:func -EnSsh_Stunned = 0x80B27AC8; // type:func -EnSsh_UpdateYaw = 0x80B27B68; // type:func -EnSsh_Bob = 0x80B27BA4; // type:func -EnSsh_IsCloseToLink = 0x80B27C10; // type:func -EnSsh_IsCloseToHome = 0x80B27CF8; // type:func -EnSsh_IsCloseToGround = 0x80B27D30; // type:func -EnSsh_Sway = 0x80B27D70; // type:func -EnSsh_CheckBodyStickHit = 0x80B27EB4; // type:func -EnSsh_CheckHitPlayer = 0x80B27F28; // type:func -EnSsh_CheckHitFront = 0x80B28030; // type:func -EnSsh_CheckHitBack = 0x80B2808C; // type:func -EnSsh_CollisionCheck = 0x80B28164; // type:func -EnSsh_SetBodyCylinderAC = 0x80B28218; // type:func -EnSsh_SetLegsCylinderAC = 0x80B2825C; // type:func -EnSsh_SetCylinderOC = 0x80B28314; // type:func -EnSsh_SetColliders = 0x80B284EC; // type:func -EnSsh_Init = 0x80B285B4; // type:func -EnSsh_Destroy = 0x80B28748; // type:func -EnSsh_Wait = 0x80B287C8; // type:func -EnSsh_Talk = 0x80B28824; // type:func -EnSsh_Idle = 0x80B28870; // type:func -EnSsh_Land = 0x80B28B08; // type:func -EnSsh_Drop = 0x80B28BF0; // type:func -EnSsh_Return = 0x80B28CF0; // type:func -EnSsh_UpdateColliderScale = 0x80B28DC4; // type:func -EnSsh_Start = 0x80B28E6C; // type:func -EnSsh_Update = 0x80B28EF4; // type:func -EnSsh_OverrideLimbDraw = 0x80B29014; // type:func -EnSsh_PostLimbDraw = 0x80B29104; // type:func -EnSsh_Draw = 0x80B29140; // type:func -EnSth_SetupAction = 0x80B296B0; // type:func -EnSth_Init = 0x80B296BC; // type:func -EnSth_SetupShapeColliderUpdate2AndDraw = 0x80B297B8; // type:func -EnSth_SetupAfterObjectLoaded = 0x80B2983C; // type:func -EnSth_Destroy = 0x80B29960; // type:func -EnSth_WaitForObject = 0x80B2998C; // type:func -EnSth_FacePlayer = 0x80B299E0; // type:func -EnSth_LookAtPlayer = 0x80B29AF8; // type:func -EnSth_RewardObtainedTalk = 0x80B29C0C; // type:func -EnSth_ParentRewardObtainedWait = 0x80B29C88; // type:func -EnSth_GivePlayerItem = 0x80B29D14; // type:func -EnSth_GiveReward = 0x80B29DB0; // type:func -EnSth_RewardUnobtainedTalk = 0x80B29E30; // type:func -EnSth_RewardUnobtainedWait = 0x80B29EAC; // type:func -EnSth_ChildRewardObtainedWait = 0x80B29F50; // type:func -EnSth_Update = 0x80B29FFC; // type:func -EnSth_Update2 = 0x80B2A020; // type:func -EnSth_OverrideLimbDraw = 0x80B2A124; // type:func -EnSth_PostLimbDraw = 0x80B2A280; // type:func -EnSth_AllocColorDList = 0x80B2A2F8; // type:func -EnSth_Draw = 0x80B2A364; // type:func -OceffWipe_Init = 0x80B2D770; // type:func -OceffWipe_Destroy = 0x80B2D7CC; // type:func -OceffWipe_Update = 0x80B2D818; // type:func -OceffWipe_Draw = 0x80B2D878; // type:func -EffectSsDust_Init = 0x80B2E4F0; // type:func -EffectSsDust_Draw = 0x80B2E6A4; // type:func -EffectSsDust_Update = 0x80B2E9EC; // type:func -EffectSsDust_UpdateFire = 0x80B2EAE4; // type:func -EffectSsKiraKira_Init = 0x80B2ED30; // type:func -EffectSsKiraKira_Draw = 0x80B2EED0; // type:func -func_809AABF0 = 0x80B2F0EC; // type:func -func_809AACAC = 0x80B2F1A4; // type:func -func_809AAD6C = 0x80B2F260; // type:func -EffectSsBomb_Init = 0x80B2F3A0; // type:func -EffectSsBomb_Draw = 0x80B2F468; // type:func -EffectSsBomb_Update = 0x80B2F6A0; // type:func -EffectSsBomb2_Init = 0x80B2F7D0; // type:func -EffectSsBomb2_DrawFade = 0x80B2F8C8; // type:func -EffectSsBomb2_DrawLayered = 0x80B2FAB8; // type:func -EffectSsBomb2_Update = 0x80B2FDEC; // type:func -EffectSsBlast_Init = 0x80B300D0; // type:func -EffectSsBlast_Draw = 0x80B3022C; // type:func -EffectSsBlast_Update = 0x80B30398; // type:func -EffectSsGSpk_Init = 0x80B30460; // type:func -EffectSsGSpk_Draw = 0x80B305D0; // type:func -EffectSsGSpk_Update = 0x80B307C4; // type:func -EffectSsGSpk_UpdateNoAccel = 0x80B308CC; // type:func -EffectSsDFire_Init = 0x80B30A10; // type:func -EffectSsDFire_Draw = 0x80B30B5C; // type:func -EffectSsDFire_Update = 0x80B30DA4; // type:func -EffectSsBubble_Init = 0x80B30F00; // type:func -EffectSsBubble_Draw = 0x80B31090; // type:func -EffectSsBubble_Update = 0x80B311E4; // type:func -EffectSsGRipple_Init = 0x80B31380; // type:func -EffectSsGRipple_DrawRipple = 0x80B314FC; // type:func -EffectSsGRipple_Draw = 0x80B316F8; // type:func -EffectSsGRipple_Update = 0x80B31730; // type:func -EffectSsGSplash_Init = 0x80B318E0; // type:func -EffectSsGSplash_Draw = 0x80B31B00; // type:func -EffectSsGSplash_Update = 0x80B31C08; // type:func -EffectSsGMagma_Init = 0x80B31D90; // type:func -EffectSsGMagma_Draw = 0x80B31EE8; // type:func -EffectSsGMagma_Update = 0x80B31F44; // type:func -EffectSsGFire_Init = 0x80B31FF0; // type:func -EffectSsGFire_Draw = 0x80B32130; // type:func -EffectSsGFire_Update = 0x80B321D8; // type:func -EffectSsLightning_Init = 0x80B32280; // type:func -EffectSsLightning_NewLightning = 0x80B32368; // type:func -EffectSsLightning_Draw = 0x80B3240C; // type:func -EffectSsLightning_Update = 0x80B326A4; // type:func -EffectSsDtBubble_Init = 0x80B32950; // type:func -EffectSsDtBubble_Draw = 0x80B32BA4; // type:func -EffectSsDtBubble_Update = 0x80B32DE4; // type:func -EffectSsHahen_CheckForObject = 0x80B32EE0; // type:func -EffectSsHahen_Init = 0x80B32F54; // type:func -EffectSsHahen_Draw = 0x80B330F0; // type:func -EffectSsHahen_DrawGray = 0x80B33250; // type:func -EffectSsHahen_Update = 0x80B333F8; // type:func -EffectSsStick_Init = 0x80B33520; // type:func -EffectSsStick_Draw = 0x80B33680; // type:func -EffectSsStick_Update = 0x80B33820; // type:func -EffectSsSibuki_Init = 0x80B338C0; // type:func -EffectSsSibuki_Draw = 0x80B33A78; // type:func -EffectSsSibuki_Update = 0x80B33C28; // type:func -EffectSsSibuki2_Init = 0x80B33F90; // type:func -EffectSsSibuki2_Draw = 0x80B34040; // type:func -EffectSsSibuki2_Update = 0x80B34224; // type:func -EffectSsGMagma2_Init = 0x80B342C0; // type:func -EffectSsGMagma2_Draw = 0x80B3448C; // type:func -EffectSsGMagma2_Update = 0x80B346A4; // type:func -EffectSsStone1_Init = 0x80B347D0; // type:func -EffectSsStone1_Draw = 0x80B3485C; // type:func -EffectSsStone1_Update = 0x80B34A58; // type:func -EffectSsHitMark_Init = 0x80B34B50; // type:func -EffectSsHitMark_Draw = 0x80B34C50; // type:func -EffectSsHitMark_Update = 0x80B34E5C; // type:func -EffectSsFhgFlash_Init = 0x80B350A0; // type:func -EffectSsFhgFlash_DrawLightBall = 0x80B353EC; // type:func -EffectSsFhgFlash_DrawShock = 0x80B355E0; // type:func -EffectSsFhgFlash_UpdateLightBall = 0x80B357EC; // type:func -EffectSsFhgFlash_UpdateShock = 0x80B35884; // type:func -EffectSsKFire_Init = 0x80B36020; // type:func -EffectSsKFire_Draw = 0x80B360F0; // type:func -EffectSsKFire_Update = 0x80B36358; // type:func -EffectSsSolderSrchBall_Init = 0x80B36460; // type:func -EffectSsSolderSrchBall_Update = 0x80B364E0; // type:func -EffectSsKakera_Init = 0x80B36610; // type:func -func_809A9818 = 0x80B3679C; // type:func -EffectSsKakera_Draw = 0x80B367D8; // type:func -func_809A9BA8 = 0x80B36AC4; // type:func -func_809A9C10 = 0x80B36B30; // type:func -func_809A9DC0 = 0x80B36CE0; // type:func -func_809A9DD8 = 0x80B36CFC; // type:func -func_809A9DEC = 0x80B36D18; // type:func -func_809A9E28 = 0x80B36D54; // type:func -func_809A9E68 = 0x80B36D94; // type:func -func_809A9E88 = 0x80B36DB4; // type:func -func_809A9F10 = 0x80B36E44; // type:func -func_809A9F4C = 0x80B36E84; // type:func -func_809A9FD8 = 0x80B36F18; // type:func -func_809AA0B8 = 0x80B36FF4; // type:func -func_809AA0EC = 0x80B3702C; // type:func -func_809AA230 = 0x80B37174; // type:func -EffectSsKakera_Update = 0x80B37374; // type:func -EffectSsIcePiece_Init = 0x80B376A0; // type:func -EffectSsIcePiece_Draw = 0x80B377EC; // type:func -EffectSsIcePiece_Update = 0x80B37A20; // type:func -EffectSsEnIce_Init = 0x80B37AE0; // type:func -EffectSsEnIce_Draw = 0x80B37D88; // type:func -EffectSsEnIce_UpdateFlying = 0x80B380F8; // type:func -EffectSsEnIce_Update = 0x80B382D0; // type:func -EffectSsFireTail_Init = 0x80B383A0; // type:func -EffectSsFireTail_Draw = 0x80B384BC; // type:func -EffectSsFireTail_Update = 0x80B389C4; // type:func -EffectSsEnFire_Init = 0x80B38AA0; // type:func -EffectSsEnFire_Draw = 0x80B38C68; // type:func -EffectSsEnFire_Update = 0x80B38F70; // type:func -EffectSsExtra_Init = 0x80B391F0; // type:func -EffectSsExtra_Draw = 0x80B39334; // type:func -EffectSsExtra_Update = 0x80B394E8; // type:func -EffectSsFcircle_Init = 0x80B395B0; // type:func -EffectSsFcircle_Draw = 0x80B39670; // type:func -EffectSsFcircle_Update = 0x80B3993C; // type:func -EffectSsDeadDb_Init = 0x80B39A60; // type:func -EffectSsDeadDb_Draw = 0x80B39B7C; // type:func -EffectSsDeadDb_Update = 0x80B39D50; // type:func -EffectSsDeadDd_Init = 0x80B39F40; // type:func -EffectSsDeadDd_Draw = 0x80B3A208; // type:func -EffectSsDeadDd_Update = 0x80B3A3D8; // type:func -EffectSsDeadDs_Init = 0x80B3A4D0; // type:func -EffectSsDeadDs_Draw = 0x80B3A5B8; // type:func -EffectSsDeadDs_Update = 0x80B3A88C; // type:func -EffectSsDeadSound_Init = 0x80B3A950; // type:func -EffectSsDeadSound_Update = 0x80B3A9DC; // type:func -OceffStorm_SetupAction = 0x80B3AA90; // type:func -OceffStorm_Init = 0x80B3AA9C; // type:func -OceffStorm_Destroy = 0x80B3AB6C; // type:func -OceffStorm_DefaultAction = 0x80B3ABB8; // type:func -OceffStorm_UnkAction = 0x80B3AD7C; // type:func -OceffStorm_Update = 0x80B3AD9C; // type:func -OceffStorm_Draw2 = 0x80B3AE08; // type:func -OceffStorm_Draw = 0x80B3AFB8; // type:func -EnWeiyer_Init = 0x80B3C640; // type:func -EnWeiyer_Destroy = 0x80B3C710; // type:func -func_80B32384 = 0x80B3C73C; // type:func -func_80B32434 = 0x80B3C7F0; // type:func -func_80B32494 = 0x80B3C850; // type:func -func_80B32508 = 0x80B3C8C4; // type:func -func_80B32538 = 0x80B3C8F8; // type:func -func_80B325A0 = 0x80B3C964; // type:func -func_80B32660 = 0x80B3CA24; // type:func -func_80B32724 = 0x80B3CAE8; // type:func -func_80B327B0 = 0x80B3CB74; // type:func -func_80B327D8 = 0x80B3CBA0; // type:func -func_80B32804 = 0x80B3CBD0; // type:func -func_80B328E8 = 0x80B3CCB4; // type:func -func_80B32C2C = 0x80B3CFF8; // type:func -func_80B32D30 = 0x80B3D0FC; // type:func -func_80B32DEC = 0x80B3D1B8; // type:func -func_80B32E34 = 0x80B3D204; // type:func -func_80B33018 = 0x80B3D3EC; // type:func -func_80B331CC = 0x80B3D5A0; // type:func -func_80B332B4 = 0x80B3D688; // type:func -func_80B33338 = 0x80B3D70C; // type:func -func_80B333B8 = 0x80B3D78C; // type:func -func_80B3349C = 0x80B3D870; // type:func -func_80B3368C = 0x80B3DA64; // type:func -EnWeiyer_Update = 0x80B3DB44; // type:func -EnWeiyer_OverrideLimbDraw = 0x80B3DCB8; // type:func -EnWeiyer_Draw = 0x80B3DCE8; // type:func -BgSpot05Soko_Init = 0x80B3E040; // type:func -BgSpot05Soko_Destroy = 0x80B3E14C; // type:func -func_808AE5A8 = 0x80B3E180; // type:func -func_808AE5B4 = 0x80B3E190; // type:func -func_808AE630 = 0x80B3E20C; // type:func -BgSpot05Soko_Update = 0x80B3E274; // type:func -BgSpot05Soko_Draw = 0x80B3E298; // type:func -BgJya1flift_InitDynapoly = 0x80B3E360; // type:func -BgJya1flift_InitCollision = 0x80B3E3B8; // type:func -BgJya1flift_Init = 0x80B3E40C; // type:func -BgJya1flift_Destroy = 0x80B3E504; // type:func -BgJya1flift_SetupWaitForSwitch = 0x80B3E55C; // type:func -BgJya1flift_WaitForSwitch = 0x80B3E57C; // type:func -BgJya1flift_SetupDoNothing = 0x80B3E5C0; // type:func -BgJya1flift_DoNothing = 0x80B3E5E0; // type:func -BgJya1flift_ChangeDirection = 0x80B3E5F0; // type:func -BgJya1flift_Move = 0x80B3E618; // type:func -BgJya1flift_ResetMoveDelay = 0x80B3E6FC; // type:func -BgJya1flift_DelayMove = 0x80B3E714; // type:func -BgJya1flift_Update = 0x80B3E754; // type:func -BgJya1flift_Draw = 0x80B3E870; // type:func -BgJyaHaheniron_ColliderInit = 0x80B3E9F0; // type:func -BgJyaHaheniron_SpawnFragments = 0x80B3EA44; // type:func -BgJyaHaheniron_Init = 0x80B3EC70; // type:func -BgJyaHaheniron_Destroy = 0x80B3ED3C; // type:func -BgJyaHaheniron_SetupChairCrumble = 0x80B3ED74; // type:func -BgJyaHaheniron_ChairCrumble = 0x80B3ED88; // type:func -BgJyaHaheniron_SetupPillarCrumble = 0x80B3EEC4; // type:func -BgJyaHaheniron_PillarCrumble = 0x80B3EED8; // type:func -BgJyaHaheniron_SetupRubbleCollide = 0x80B3EF58; // type:func -BgJyaHaheniron_RubbleCollide = 0x80B3EF6C; // type:func -BgJyaHaheniron_Update = 0x80B3EFD0; // type:func -BgJyaHaheniron_Draw = 0x80B3EFFC; // type:func -BgSpot12Gate_InitDynaPoly = 0x80B3F1E0; // type:func -BgSpot12Gate_Init = 0x80B3F238; // type:func -BgSpot12Gate_Destroy = 0x80B3F2B8; // type:func -func_808B30C0 = 0x80B3F2EC; // type:func -func_808B30D8 = 0x80B3F308; // type:func -func_808B3134 = 0x80B3F364; // type:func -func_808B314C = 0x80B3F380; // type:func -func_808B317C = 0x80B3F3B0; // type:func -func_808B318C = 0x80B3F3C4; // type:func -func_808B3274 = 0x80B3F4AC; // type:func -func_808B3298 = 0x80B3F4D4; // type:func -BgSpot12Gate_Update = 0x80B3F4E4; // type:func -BgSpot12Gate_Draw = 0x80B3F518; // type:func -func_808B3420 = 0x80B3F5F0; // type:func -BgSpot12Saku_Init = 0x80B3F648; // type:func -BgSpot12Saku_Destroy = 0x80B3F6C8; // type:func -func_808B3550 = 0x80B3F6FC; // type:func -func_808B357C = 0x80B3F72C; // type:func -func_808B35E4 = 0x80B3F794; // type:func -func_808B3604 = 0x80B3F7B4; // type:func -func_808B3714 = 0x80B3F8C4; // type:func -func_808B37AC = 0x80B3F958; // type:func -BgSpot12Saku_Update = 0x80B3F968; // type:func -BgSpot12Saku_Draw = 0x80B3F99C; // type:func -EnHintnuts_Init = 0x80B3FAB0; // type:func -EnHintnuts_Destroy = 0x80B3FC50; // type:func -EnHintnuts_HitByScrubProjectile1 = 0x80B3FC8C; // type:func -EnHintnuts_SetupWait = 0x80B3FD10; // type:func -EnHintnuts_SetupLookAround = 0x80B3FD90; // type:func -EnHintnuts_SetupThrowScrubProjectile = 0x80B3FDD8; // type:func -EnHintnuts_SetupStand = 0x80B3FE18; // type:func -EnHintnuts_SetupBurrow = 0x80B3FE80; // type:func -EnHintnuts_HitByScrubProjectile2 = 0x80B3FED0; // type:func -EnHintnuts_SetupRun = 0x80B3FFC0; // type:func -EnHintnuts_SetupTalk = 0x80B40008; // type:func -EnHintnuts_SetupLeave = 0x80B40054; // type:func -EnHintnuts_SetupFreeze = 0x80B40114; // type:func -EnHintnuts_Wait = 0x80B401C0; // type:func -EnHintnuts_LookAround = 0x80B40424; // type:func -EnHintnuts_Stand = 0x80B404A8; // type:func -EnHintnuts_ThrowNut = 0x80B4056C; // type:func -EnHintnuts_Burrow = 0x80B406A8; // type:func -EnHintnuts_BeginRun = 0x80B407BC; // type:func -EnHintnuts_BeginFreeze = 0x80B40820; // type:func -EnHintnuts_CheckProximity = 0x80B4085C; // type:func -EnHintnuts_Run = 0x80B408F0; // type:func -EnHintnuts_Talk = 0x80B40B80; // type:func -EnHintnuts_Leave = 0x80B40BEC; // type:func -EnHintnuts_Freeze = 0x80B40DA8; // type:func -EnHintnuts_ColliderCheck = 0x80B40ED4; // type:func -EnHintnuts_Update = 0x80B40F88; // type:func -EnHintnuts_OverrideLimbDraw = 0x80B41110; // type:func -EnHintnuts_Draw = 0x80B41244; // type:func -EnNutsball_Init = 0x80B414E0; // type:func -EnNutsball_Destroy = 0x80B4159C; // type:func -func_80ABBB34 = 0x80B415C8; // type:func -func_80ABBBA8 = 0x80B41640; // type:func -EnNutsball_Update = 0x80B41810; // type:func -EnNutsball_Draw = 0x80B4192C; // type:func -BgSpot00Break_Init = 0x80B41B00; // type:func -BgSpot00Break_Destroy = 0x80B41BAC; // type:func -BgSpot00Break_Update = 0x80B41BE0; // type:func -BgSpot00Break_Draw = 0x80B41BF0; // type:func -EnShopnuts_Init = 0x80B41CA0; // type:func -EnShopnuts_Destroy = 0x80B41DDC; // type:func -EnShopnuts_SetupIdle = 0x80B41E08; // type:func -EnShopnuts_SetupLookAround = 0x80B41E70; // type:func -EnShopnuts_SetupThrowNut = 0x80B41EB8; // type:func -EnShopnuts_SetupPeek = 0x80B41EF8; // type:func -EnShopnuts_SetupBurrow = 0x80B41F60; // type:func -EnShopnuts_SetupSpawnSalesman = 0x80B41FB0; // type:func -EnShopnuts_Idle = 0x80B42008; // type:func -EnShopnuts_LookAround = 0x80B4226C; // type:func -EnShopnuts_Peek = 0x80B422F0; // type:func -EnShopnuts_ThrowNut = 0x80B423B4; // type:func -EnShopnuts_Burrow = 0x80B424F0; // type:func -EnShopnuts_SpawnSalesman = 0x80B425B4; // type:func -EnShopnuts_ColliderCheck = 0x80B42650; // type:func -EnShopnuts_Update = 0x80B426B0; // type:func -EnShopnuts_OverrideLimbDraw = 0x80B427F0; // type:func -EnShopnuts_PostLimbDraw = 0x80B42828; // type:func -EnShopnuts_Draw = 0x80B429C8; // type:func -EnIt_Init = 0x80B42BB0; // type:func -EnIt_Destroy = 0x80B42C1C; // type:func -EnIt_Update = 0x80B42C48; // type:func -EnGeldB_SetupAction = 0x80B42D40; // type:func -EnGeldB_Init = 0x80B42D4C; // type:func -EnGeldB_Destroy = 0x80B42F70; // type:func -EnGeldB_ReactToPlayer = 0x80B42FD8; // type:func -EnGeldB_SetupWait = 0x80B433B0; // type:func -EnGeldB_Wait = 0x80B43444; // type:func -EnGeldB_SetupFlee = 0x80B435C8; // type:func -EnGeldB_Flee = 0x80B43660; // type:func -EnGeldB_SetupReady = 0x80B43788; // type:func -EnGeldB_Ready = 0x80B43810; // type:func -EnGeldB_SetupAdvance = 0x80B43AF4; // type:func -EnGeldB_Advance = 0x80B43B74; // type:func -EnGeldB_SetupRollForward = 0x80B44020; // type:func -EnGeldB_RollForward = 0x80B440D4; // type:func -EnGeldB_SetupPivot = 0x80B4422C; // type:func -EnGeldB_Pivot = 0x80B44278; // type:func -EnGeldB_SetupCircle = 0x80B44458; // type:func -EnGeldB_Circle = 0x80B4452C; // type:func -EnGeldB_SetupSpinDodge = 0x80B44B08; // type:func -EnGeldB_SpinDodge = 0x80B44C70; // type:func -EnGeldB_SetupSlash = 0x80B450C0; // type:func -EnGeldB_Slash = 0x80B45130; // type:func -EnGeldB_SetupSpinAttack = 0x80B45380; // type:func -EnGeldB_SpinAttack = 0x80B45414; // type:func -EnGeldB_SetupRollBack = 0x80B457C8; // type:func -EnGeldB_RollBack = 0x80B45844; // type:func -EnGeldB_SetupStunned = 0x80B45948; // type:func -EnGeldB_Stunned = 0x80B459F4; // type:func -EnGeldB_SetupDamaged = 0x80B45AB0; // type:func -EnGeldB_Damaged = 0x80B45B48; // type:func -EnGeldB_SetupJump = 0x80B45CF0; // type:func -EnGeldB_Jump = 0x80B45DA8; // type:func -EnGeldB_SetupBlock = 0x80B45E90; // type:func -EnGeldB_Block = 0x80B45F48; // type:func -EnGeldB_SetupSidestep = 0x80B46234; // type:func -EnGeldB_Sidestep = 0x80B463C4; // type:func -EnGeldB_SetupDefeated = 0x80B46AE4; // type:func -EnGeldB_Defeated = 0x80B46B88; // type:func -EnGeldB_TurnHead = 0x80B46C44; // type:func -EnGeldB_CollisionCheck = 0x80B46D44; // type:func -EnGeldB_Update = 0x80B46F10; // type:func -EnGeldB_OverrideLimbDraw = 0x80B470FC; // type:func -EnGeldB_PostLimbDraw = 0x80B47244; // type:func -EnGeldB_Draw = 0x80B474BC; // type:func -EnGeldB_DodgeRanged = 0x80B4782C; // type:func -OceffWipe2_Init = 0x80B480F0; // type:func -OceffWipe2_Destroy = 0x80B4814C; // type:func -OceffWipe2_Update = 0x80B48198; // type:func -OceffWipe2_Draw = 0x80B481F8; // type:func -OceffWipe3_Init = 0x80B49860; // type:func -OceffWipe3_Destroy = 0x80B498BC; // type:func -OceffWipe3_Update = 0x80B49908; // type:func -OceffWipe3_Draw = 0x80B49968; // type:func -EnNiwGirl_Init = 0x80B4AFB0; // type:func -EnNiwGirl_Destroy = 0x80B4B150; // type:func -EnNiwGirl_Jump = 0x80B4B160; // type:func -func_80AB9210 = 0x80B4B1E4; // type:func -EnNiwGirl_Talk = 0x80B4B398; // type:func -func_80AB94D0 = 0x80B4B4A8; // type:func -EnNiwGirl_Update = 0x80B4B59C; // type:func -EnNiwGirlOverrideLimbDraw = 0x80B4B7C4; // type:func -EnNiwGirl_Draw = 0x80B4B82C; // type:func -EnDog_PlayWalkSFX = 0x80B4BA80; // type:func -EnDog_PlayRunSFX = 0x80B4BAE8; // type:func -EnDog_PlayBarkSFX = 0x80B4BB50; // type:func -EnDog_PlayAnimAndSFX = 0x80B4BBB8; // type:func -EnDog_CanFollow = 0x80B4BD50; // type:func -EnDog_UpdateWaypoint = 0x80B4BDD4; // type:func -EnDog_Orient = 0x80B4BE60; // type:func -EnDog_Init = 0x80B4BF04; // type:func -EnDog_Destroy = 0x80B4C154; // type:func -EnDog_FollowPath = 0x80B4C180; // type:func -EnDog_ChooseMovement = 0x80B4C318; // type:func -EnDog_FollowPlayer = 0x80B4C408; // type:func -EnDog_RunAway = 0x80B4C588; // type:func -EnDog_FaceLink = 0x80B4C62C; // type:func -EnDog_Wait = 0x80B4C734; // type:func -EnDog_Update = 0x80B4C78C; // type:func -EnDog_OverrideLimbDraw = 0x80B4C858; // type:func -EnDog_PostLimbDraw = 0x80B4C874; // type:func -EnDog_Draw = 0x80B4C88C; // type:func -EnSi_Init = 0x80B4CC30; // type:func -EnSi_Destroy = 0x80B4CCC0; // type:func -func_80AFB748 = 0x80B4CCEC; // type:func -func_80AFB768 = 0x80B4CD10; // type:func -func_80AFB89C = 0x80B4CE44; // type:func -func_80AFB950 = 0x80B4CEFC; // type:func -EnSi_Update = 0x80B4CF90; // type:func -EnSi_Draw = 0x80B4D004; // type:func -BgSpot01Objects2_Init = 0x80B4D130; // type:func -BgSpot01Objects2_Destroy = 0x80B4D20C; // type:func -func_808AC22C = 0x80B4D21C; // type:func -func_808AC2BC = 0x80B4D2B0; // type:func -func_808AC474 = 0x80B4D460; // type:func -BgSpot01Objects2_Update = 0x80B4D470; // type:func -func_808AC4A4 = 0x80B4D494; // type:func -ObjComb_Break = 0x80B4D5F0; // type:func -ObjComb_ChooseItemDrop = 0x80B4D8E0; // type:func -ObjComb_Init = 0x80B4D9B0; // type:func -ObjComb_Destroy = 0x80B4DA20; // type:func -ObjComb_SetupWait = 0x80B4DA4C; // type:func -ObjComb_Wait = 0x80B4DA60; // type:func -ObjComb_Update = 0x80B4DB4C; // type:func -ObjComb_Draw = 0x80B4DBC4; // type:func -func_808B2180 = 0x80B4DE50; // type:func -func_808B2218 = 0x80B4DEE4; // type:func -BgSpot11Bakudankabe_Init = 0x80B4E1FC; // type:func -BgSpot11Bakudankabe_Destroy = 0x80B4E298; // type:func -BgSpot11Bakudankabe_Update = 0x80B4E2E0; // type:func -BgSpot11Bakudankabe_Draw = 0x80B4E37C; // type:func -ObjKibako2_InitCollider = 0x80B4E490; // type:func -ObjKibako2_Break = 0x80B4E4E8; // type:func -ObjKibako2_SpawnCollectible = 0x80B4E764; // type:func -ObjKibako2_Init = 0x80B4E7B4; // type:func -ObjKibako2_Destroy = 0x80B4E860; // type:func -ObjKibako2_Idle = 0x80B4E8A8; // type:func -ObjKibako2_Kill = 0x80B4E980; // type:func -ObjKibako2_Update = 0x80B4EA04; // type:func -ObjKibako2_Draw = 0x80B4EA28; // type:func -EnDntDemo_Destroy = 0x80B4EB50; // type:func -EnDntDemo_Init = 0x80B4EB60; // type:func -EnDntDemo_Judge = 0x80B4ECD0; // type:func -EnDntDemo_Results = 0x80B4F2F0; // type:func -EnDntDemo_Prize = 0x80B4F564; // type:func -EnDntDemo_Update = 0x80B4F640; // type:func -EnDntJiji_Init = 0x80B4F870; // type:func -EnDntJiji_Destroy = 0x80B4F950; // type:func -EnDntJiji_SetFlower = 0x80B4F97C; // type:func -EnDntJiji_SetupWait = 0x80B4F9BC; // type:func -EnDntJiji_Wait = 0x80B4FA6C; // type:func -EnDntJiji_SetupUp = 0x80B4FB24; // type:func -EnDntJiji_Up = 0x80B4FC08; // type:func -EnDntJiji_SetupUnburrow = 0x80B4FC78; // type:func -EnDntJiji_Unburrow = 0x80B4FD5C; // type:func -EnDntJiji_SetupWalk = 0x80B4FDE4; // type:func -EnDntJiji_Walk = 0x80B4FE94; // type:func -EnDntJiji_SetupBurrow = 0x80B4FFD0; // type:func -EnDntJiji_Burrow = 0x80B500C0; // type:func -EnDntJiji_SetupCower = 0x80B500EC; // type:func -EnDntJiji_Cower = 0x80B5022C; // type:func -EnDntJiji_SetupTalk = 0x80B502D0; // type:func -EnDntJiji_Talk = 0x80B50364; // type:func -EnDntJiji_SetupGivePrize = 0x80B50430; // type:func -EnDntJiji_GivePrize = 0x80B504A0; // type:func -EnDntJiji_SetupHide = 0x80B505B0; // type:func -EnDntJiji_Hide = 0x80B50648; // type:func -EnDntJiji_SetupReturn = 0x80B506B4; // type:func -EnDntJiji_Return = 0x80B50764; // type:func -EnDntJiji_Update = 0x80B508DC; // type:func -EnDntJiji_Draw = 0x80B50AB4; // type:func -EnDntNomal_Init = 0x80B50D90; // type:func -EnDntNomal_Destroy = 0x80B50EB8; // type:func -EnDntNomal_WaitForObject = 0x80B50F04; // type:func -EnDntNomal_SetFlower = 0x80B51054; // type:func -EnDntNomal_SetupTargetWait = 0x80B510AC; // type:func -EnDntNomal_TargetWait = 0x80B51154; // type:func -EnDntNomal_SetupTargetUnburrow = 0x80B51430; // type:func -EnDntNomal_TargetUnburrow = 0x80B5154C; // type:func -EnDntNomal_SetupTargetWalk = 0x80B515B8; // type:func -EnDntNomal_TargetWalk = 0x80B5165C; // type:func -EnDntNomal_TargetFacePlayer = 0x80B51748; // type:func -EnDntNomal_SetupTargetTalk = 0x80B517FC; // type:func -EnDntNomal_TargetTalk = 0x80B518A8; // type:func -EnDntNomal_SetupTargetGivePrize = 0x80B51950; // type:func -EnDntNomal_TargetGivePrize = 0x80B519E8; // type:func -EnDntNomal_TargetReturn = 0x80B51B50; // type:func -EnDntNomal_TargetBurrow = 0x80B51D20; // type:func -EnDntNomal_SetupStageWait = 0x80B51D8C; // type:func -EnDntNomal_StageWait = 0x80B51E44; // type:func -EnDntNomal_SetupStageUp = 0x80B51E70; // type:func -EnDntNomal_StageUp = 0x80B51F7C; // type:func -EnDntNomal_SetupStageUnburrow = 0x80B521B0; // type:func -EnDntNomal_StageUnburrow = 0x80B522A4; // type:func -EnDntNomal_SetupStageCelebrate = 0x80B5237C; // type:func -EnDntNomal_StageCelebrate = 0x80B52424; // type:func -EnDntNomal_SetupStageDance = 0x80B5262C; // type:func -EnDntNomal_StageDance = 0x80B5273C; // type:func -EnDntNomal_SetupStageHide = 0x80B528A0; // type:func -EnDntNomal_StageHide = 0x80B5297C; // type:func -EnDntNomal_StageAttackHide = 0x80B52B40; // type:func -EnDntNomal_SetupStageAttack = 0x80B52B74; // type:func -EnDntNomal_StageAttack = 0x80B52C40; // type:func -EnDntNomal_StageSetupReturn = 0x80B52F04; // type:func -EnDntNomal_StageReturn = 0x80B52FA8; // type:func -EnDntNomal_Update = 0x80B530AC; // type:func -EnDntNomal_OverrideLimbDraw = 0x80B53370; // type:func -EnDntNomal_PostLimbDraw = 0x80B53420; // type:func -EnDntNomal_DrawStageScrub = 0x80B534A8; // type:func -EnDntNomal_DrawTargetScrub = 0x80B53698; // type:func -EnGuest_Init = 0x80B53B90; // type:func -EnGuest_Destroy = 0x80B53BF0; // type:func -EnGuest_Update = 0x80B53C1C; // type:func -func_80A5046C = 0x80B53D8C; // type:func -func_80A50518 = 0x80B53E38; // type:func -func_80A5057C = 0x80B53EA0; // type:func -func_80A505CC = 0x80B53EF4; // type:func -func_80A50708 = 0x80B54034; // type:func -EnGuest_OverrideLimbDraw = 0x80B540A0; // type:func -EnGuest_Draw = 0x80B542C8; // type:func -BgBomGuard_SetupAction = 0x80B54530; // type:func -BgBomGuard_Init = 0x80B5453C; // type:func -BgBomGuard_Destroy = 0x80B545D8; // type:func -func_8086E638 = 0x80B5460C; // type:func -BgBomGuard_Update = 0x80B546D8; // type:func -EnHs2_Init = 0x80B54750; // type:func -EnHs2_Destroy = 0x80B54830; // type:func -func_80A6F0B4 = 0x80B5485C; // type:func -func_80A6F164 = 0x80B54910; // type:func -func_80A6F1A4 = 0x80B5494C; // type:func -EnHs2_Update = 0x80B54998; // type:func -EnHs2_OverrideLimbDraw = 0x80B54B04; // type:func -EnHs2_PostLimbDraw = 0x80B54B8C; // type:func -EnHs2_Draw = 0x80B54BCC; // type:func -DemoKekkai_CheckEventFlag = 0x80B54D30; // type:func -DemoKekkai_Init = 0x80B54D74; // type:func -DemoKekkai_Destroy = 0x80B54FA4; // type:func -DemoKekkai_SpawnParticles = 0x80B54FE4; // type:func -DemoKekkai_TowerBarrier = 0x80B55238; // type:func -DemoKekkai_Update = 0x80B55354; // type:func -DemoKekkai_TrialBarrierDispel = 0x80B55480; // type:func -DemoKekkai_TrialBarrierIdle = 0x80B555E0; // type:func -DemoKekkai_DrawTrialBarrier = 0x80B55704; // type:func -DemoKekkai_DrawTowerBarrier = 0x80B55C18; // type:func -func_808B02D0 = 0x80B56020; // type:func -func_808B0324 = 0x80B56074; // type:func -BgSpot08Bakudankabe_Init = 0x80B5636C; // type:func -BgSpot08Bakudankabe_Destroy = 0x80B5640C; // type:func -BgSpot08Bakudankabe_Update = 0x80B56454; // type:func -BgSpot08Bakudankabe_Draw = 0x80B56508; // type:func -func_808B6BC0 = 0x80B566C0; // type:func -BgSpot17Bakudankabe_Init = 0x80B569F0; // type:func -BgSpot17Bakudankabe_Destroy = 0x80B56A84; // type:func -BgSpot17Bakudankabe_Update = 0x80B56AB8; // type:func -BgSpot17Bakudankabe_Draw = 0x80B56B4C; // type:func -func_80B9A9D0 = 0x80B56DB0; // type:func -func_80B9AA90 = 0x80B56E70; // type:func -func_80B9ABA0 = 0x80B56F80; // type:func -func_80B9ACE4 = 0x80B570C4; // type:func -func_80B9ADCC = 0x80B571B0; // type:func -ObjMure3_Init = 0x80B572A4; // type:func -ObjMure3_Destroy = 0x80B57304; // type:func -func_80B9AF24 = 0x80B57314; // type:func -func_80B9AF34 = 0x80B57328; // type:func -func_80B9AF54 = 0x80B5734C; // type:func -func_80B9AF64 = 0x80B57360; // type:func -func_80B9AFEC = 0x80B573E8; // type:func -func_80B9AFFC = 0x80B573FC; // type:func -ObjMure3_Update = 0x80B57478; // type:func -EnTg_GetTextId = 0x80B57580; // type:func -EnTg_UpdateTalkState = 0x80B5761C; // type:func -EnTg_Init = 0x80B576D8; // type:func -EnTg_Destroy = 0x80B577AC; // type:func -EnTg_SpinIfNotTalking = 0x80B577EC; // type:func -EnTg_Update = 0x80B57810; // type:func -EnTg_OverrideLimbDraw = 0x80B57930; // type:func -EnTg_PostLimbDraw = 0x80B5794C; // type:func -EnTg_SetColor = 0x80B579A8; // type:func -EnTg_Draw = 0x80B57A14; // type:func -EnMu_SetupAction = 0x80B57C60; // type:func -EnMu_Interact = 0x80B57C6C; // type:func -EnMu_GetTextId = 0x80B57DCC; // type:func -EnMu_UpdateTalkState = 0x80B57E10; // type:func -EnMu_Init = 0x80B57E7C; // type:func -EnMu_Destroy = 0x80B57F54; // type:func -EnMu_Pose = 0x80B57F78; // type:func -EnMu_Update = 0x80B57FB0; // type:func -EnMu_OverrideLimbDraw = 0x80B580F8; // type:func -EnMu_PostLimbDraw = 0x80B581E4; // type:func -EnMu_DisplayListSetColor = 0x80B581FC; // type:func -EnMu_Draw = 0x80B58268; // type:func -EnGo2_SpawnEffectDust = 0x80B58580; // type:func -EnGo2_UpdateEffects = 0x80B58624; // type:func -EnGo2_DrawEffects = 0x80B58730; // type:func -EnGo2_SpawnDust = 0x80B58A28; // type:func -EnGo2_GetItem = 0x80B58C40; // type:func -EnGo2_GetDialogState = 0x80B58C84; // type:func -EnGo2_GoronFireGenericGetTextId = 0x80B58D04; // type:func -EnGo2_GetTextIdGoronCityRollingBig = 0x80B58D80; // type:func -EnGo2_UpdateTalkStateGoronCityRollingBig = 0x80B58E08; // type:func -EnGo2_GetTextIdGoronDmtBombFlower = 0x80B58F00; // type:func -EnGo2_UpdateTalkStateGoronDmtBombFlower = 0x80B58F3C; // type:func -EnGo2_GetTextIdGoronDmtRollingSmall = 0x80B59054; // type:func -EnGo2_UpdateTalkStateGoronDmtRollingSmall = 0x80B590AC; // type:func -EnGo2_GetTextIdGoronDmtDcEntrance = 0x80B590E8; // type:func -EnGo2_UpdateTalkStateGoronDmtDcEntrance = 0x80B59184; // type:func -EnGo2_GetTextIdGoronCityEntrance = 0x80B591E4; // type:func -EnGo2_UpdateTalkStateGoronCityEntrance = 0x80B59264; // type:func -EnGo2_GetTextIdGoronCityIsland = 0x80B592C4; // type:func -EnGo2_UpdateTalkStateGoronCityIsland = 0x80B59344; // type:func -EnGo2_GetTextIdGoronCityLowestFloor = 0x80B593A4; // type:func -EnGo2_UpdateTalkStateGoronCityLowestFloor = 0x80B59480; // type:func -EnGo2_GetTextIdGoronCityLink = 0x80B594E0; // type:func -EnGo2_UpdateTalkStateGoronCityLink = 0x80B595BC; // type:func -EnGo2_GetTextIdGoronDmtBiggoron = 0x80B597D4; // type:func -EnGo2_UpdateTalkStateGoronDmtBiggoron = 0x80B59854; // type:func -EnGo2_GetTextIdGoronFireGeneric = 0x80B59A68; // type:func -EnGo2_UpdateTalkStateGoronFireGeneric = 0x80B59AA0; // type:func -EnGo2_GetTextIdGoronCityStairwell = 0x80B59B3C; // type:func -EnGo2_UpdateTalkStateGoronCityStairwell = 0x80B59B8C; // type:func -EnGo2_GetTextIdGoronMarketBazaar = 0x80B59BEC; // type:func -EnGo2_UpdateTalkStateGoronMarketBazaar = 0x80B59C00; // type:func -EnGo2_GetTextIdGoronCityLostWoods = 0x80B59C3C; // type:func -EnGo2_UpdateTalkStateGoronCityLostWoods = 0x80B59CAC; // type:func -EnGo2_GetTextIdGoronDmtFairyHint = 0x80B59D0C; // type:func -EnGo2_UpdateTalkStateGoronDmtFairyHint = 0x80B59D64; // type:func -EnGo2_GetTextId = 0x80B59DA0; // type:func -EnGo2_UpdateTalkState = 0x80B59EE4; // type:func -func_80A44790 = 0x80B59FFC; // type:func -EnGo2_SetColliderDim = 0x80B5A0F8; // type:func -EnGo2_SetShape = 0x80B5A134; // type:func -EnGo2_CheckCollision = 0x80B5A1AC; // type:func -EnGo2_SwapInitialFrameAnimFrameCount = 0x80B5A308; // type:func -func_80A44AB0 = 0x80B5A320; // type:func -EnGo2_UpdateWaypoint = 0x80B5A4DC; // type:func -EnGo2_Orient = 0x80B5A558; // type:func -func_80A44D84 = 0x80B5A5FC; // type:func -EnGo2_IsWakingUp = 0x80B5A634; // type:func -EnGo2_IsRollingOnGround = 0x80B5A764; // type:func -EnGo2_BiggoronSetTextId = 0x80B5A900; // type:func -func_80A45288 = 0x80B5AB00; // type:func -func_80A45360 = 0x80B5ABDC; // type:func -EnGo2_RollForward = 0x80B5ACE8; // type:func -func_80A454CC = 0x80B5AD48; // type:func -EnGo2_GetTargetXZSpeed = 0x80B5ADF4; // type:func -EnGo2_IsCameraModified = 0x80B5AE98; // type:func -EnGo2_DefaultWakingUp = 0x80B5AFB4; // type:func -EnGo2_WakingUp = 0x80B5B00C; // type:func -EnGo2_BiggoronWakingUp = 0x80B5B07C; // type:func -EnGo2_SelectGoronWakingUp = 0x80B5B0CC; // type:func -EnGo2_EyeMouthTexState = 0x80B5B1B0; // type:func -EnGo2_SitDownAnimation = 0x80B5B284; // type:func -EnGo2_GetDustData = 0x80B5B39C; // type:func -EnGo2_RollingAnimation = 0x80B5B424; // type:func -EnGo2_WakeUp = 0x80B5B4D8; // type:func -EnGo2_GetItemAnimation = 0x80B5B5CC; // type:func -EnGo2_SetupRolling = 0x80B5B630; // type:func -EnGo2_StopRolling = 0x80B5B6D8; // type:func -EnGo2_IsFreeingGoronInFire = 0x80B5B798; // type:func -EnGo2_IsGoronDmtBombFlower = 0x80B5B830; // type:func -EnGo2_IsGoronRollingBig = 0x80B5B8B0; // type:func -EnGo2_IsGoronFireGeneric = 0x80B5B910; // type:func -EnGo2_IsGoronLinkReversing = 0x80B5B94C; // type:func -EnGo2_IsRolling = 0x80B5B9A8; // type:func -EnGo2_GoronLinkAnimation = 0x80B5BA3C; // type:func -EnGo2_GoronFireCamera = 0x80B5BB70; // type:func -EnGo2_GoronFireClearCamera = 0x80B5BC70; // type:func -EnGo2_BiggoronAnimation = 0x80B5BCB0; // type:func -EnGo2_Init = 0x80B5BD64; // type:func -EnGo2_Destroy = 0x80B5C1F8; // type:func -EnGo2_CurledUp = 0x80B5C208; // type:func -func_80A46B40 = 0x80B5C3DC; // type:func -EnGo2_GoronDmtBombFlowerAnimation = 0x80B5C574; // type:func -EnGo2_GoronRollingBigContinueRolling = 0x80B5C5F8; // type:func -EnGo2_ContinueRolling = 0x80B5C658; // type:func -EnGo2_SlowRolling = 0x80B5C6F0; // type:func -EnGo2_GroundRolling = 0x80B5C828; // type:func -EnGo2_ReverseRolling = 0x80B5C8C4; // type:func -EnGo2_SetupGetItem = 0x80B5C98C; // type:func -EnGo2_SetGetItem = 0x80B5CA00; // type:func -EnGo2_BiggoronEyedrops = 0x80B5CB08; // type:func -EnGo2_GoronLinkStopRolling = 0x80B5CD3C; // type:func -EnGo2_GoronFireGenericAction = 0x80B5CE2C; // type:func -EnGo2_Update = 0x80B5D158; // type:func -EnGo2_DrawCurledUp = 0x80B5D26C; // type:func -EnGo2_DrawRolling = 0x80B5D330; // type:func -EnGo2_OverrideLimbDraw = 0x80B5D46C; // type:func -EnGo2_PostLimbDraw = 0x80B5D688; // type:func -EnGo2_Draw = 0x80B5D6E4; // type:func -EnWf_SetupAction = 0x80B5E5C0; // type:func -EnWf_Init = 0x80B5E5CC; // type:func -EnWf_Destroy = 0x80B5E800; // type:func -EnWf_ChangeAction = 0x80B5E89C; // type:func -EnWf_SetupWaitToAppear = 0x80B5EC6C; // type:func -EnWf_WaitToAppear = 0x80B5ED14; // type:func -EnWf_SetupWait = 0x80B5EE48; // type:func -EnWf_Wait = 0x80B5EED0; // type:func -EnWf_SetupRunAtPlayer = 0x80B5F0EC; // type:func -EnWf_RunAtPlayer = 0x80B5F16C; // type:func -EnWf_SetupSearchForPlayer = 0x80B5F5EC; // type:func -EnWf_SearchForPlayer = 0x80B5F638; // type:func -EnWf_SetupRunAroundPlayer = 0x80B5F818; // type:func -EnWf_RunAroundPlayer = 0x80B5F914; // type:func -EnWf_SetupSlash = 0x80B5FE34; // type:func -EnWf_Slash = 0x80B5FEB0; // type:func -EnWf_SetupRecoilFromBlockedSlash = 0x80B60204; // type:func -EnWf_RecoilFromBlockedSlash = 0x80B602A0; // type:func -EnWf_SetupBackflipAway = 0x80B60498; // type:func -EnWf_BackflipAway = 0x80B60514; // type:func -EnWf_SetupStunned = 0x80B6061C; // type:func -EnWf_Stunned = 0x80B60694; // type:func -EnWf_SetupDamaged = 0x80B60750; // type:func -EnWf_Damaged = 0x80B607E8; // type:func -EnWf_SetupSomersaultAndAttack = 0x80B609F0; // type:func -EnWf_SomersaultAndAttack = 0x80B60AA8; // type:func -EnWf_SetupBlocking = 0x80B60B90; // type:func -EnWf_Blocking = 0x80B60C30; // type:func -EnWf_SetupSidestep = 0x80B60EB4; // type:func -EnWf_Sidestep = 0x80B6104C; // type:func -EnWf_SetupDie = 0x80B6159C; // type:func -EnWf_Die = 0x80B6164C; // type:func -func_80B36F40 = 0x80B61854; // type:func -EnWf_UpdateDamage = 0x80B6194C; // type:func -EnWf_Update = 0x80B61B1C; // type:func -EnWf_OverrideLimbDraw = 0x80B61D70; // type:func -EnWf_PostLimbDraw = 0x80B61DB4; // type:func -EnWf_Draw = 0x80B61F5C; // type:func -EnWf_DodgeRanged = 0x80B62118; // type:func -EnSkb_SetupAction = 0x80B628D0; // type:func -EnSkb_SpawnDebris = 0x80B628DC; // type:func -EnSkb_Init = 0x80B62A8C; // type:func -EnSkb_Destroy = 0x80B62C44; // type:func -EnSkb_DecideNextAction = 0x80B62C9C; // type:func -EnSkb_SetupRiseFromGround = 0x80B62D38; // type:func -EnSkb_RiseFromGround = 0x80B62D9C; // type:func -EnSkb_SetupDespawn = 0x80B62E88; // type:func -EnSkb_Despawn = 0x80B62F30; // type:func -EnSkb_SetupWalkForward = 0x80B62FE4; // type:func -EnSkb_WalkForward = 0x80B6307C; // type:func -EnSkb_SetupAttack = 0x80B6327C; // type:func -EnSkb_Attack = 0x80B63314; // type:func -EnSkb_SetupRecoil = 0x80B633C0; // type:func -EnSkb_Recoil = 0x80B6344C; // type:func -EnSkb_SetupStunned = 0x80B63488; // type:func -EnSkb_Stunned = 0x80B634E4; // type:func -EnSkb_SetupTakeDamage = 0x80B6358C; // type:func -EnSkb_TakeDamage = 0x80B63614; // type:func -EnSkb_SetupDeath = 0x80B63700; // type:func -EnSkb_Death = 0x80B637CC; // type:func -EnSkb_CheckDamage = 0x80B638B8; // type:func -EnSkb_Update = 0x80B63B68; // type:func -EnSkb_OverrideLimbDraw = 0x80B63C90; // type:func -EnSkb_PostLimbDraw = 0x80B63E60; // type:func -EnSkb_Draw = 0x80B63F08; // type:func -DemoGj_GetCollectibleType = 0x80B641C0; // type:func -DemoGj_GetCollectibleAmount = 0x80B641D4; // type:func -DemoGj_GetType = 0x80B641E8; // type:func -DemoGj_InitCylinder = 0x80B641F8; // type:func -DemoGj_HitByExplosion = 0x80B64240; // type:func -DemoGj_DestroyCylinder = 0x80B64278; // type:func -DemoGj_Destroy = 0x80B64330; // type:func -DemoGj_PlayExplosionSfx = 0x80B64374; // type:func -DemoGj_SpawnSmoke = 0x80B643AC; // type:func -DemoGj_DropCollectible = 0x80B64440; // type:func -DemoGj_Explode = 0x80B644D4; // type:func -DemoGj_IsCutsceneLayer = 0x80B64770; // type:func -DemoGj_FindGanon = 0x80B64798; // type:func -DemoGj_InitCommon = 0x80B647E4; // type:func -DemoGj_InitSetIndices = 0x80B6485C; // type:func -DemoGj_DrawCommon = 0x80B648C0; // type:func -DemoGj_DrawRotated = 0x80B6495C; // type:func -DemoGj_SetupRotation = 0x80B64A38; // type:func -func_809797E4 = 0x80B64FD0; // type:func -DemoGj_IsGanondorfRisingFromRubble = 0x80B65004; // type:func -DemoGj_IsGanondorfFloatingInAir = 0x80B65028; // type:func -DemoGj_SetupMovement = 0x80B6504C; // type:func -DemoGj_CheckIfTransformedIntoGanon = 0x80B65770; // type:func -DemoGj_InitRubblePile1 = 0x80B657A8; // type:func -func_8097A000 = 0x80B657D8; // type:func -DemoGj_SpawnSmokePreBattle1 = 0x80B65854; // type:func -func_8097A0E4 = 0x80B658C0; // type:func -func_8097A130 = 0x80B65914; // type:func -DemoGj_Update01 = 0x80B65948; // type:func -DemoGj_Update08 = 0x80B65980; // type:func -DemoGj_DrawRubble2 = 0x80B659B8; // type:func -DemoGj_DrawRotatedRubble2 = 0x80B659DC; // type:func -DemoGj_InitRubblePile2 = 0x80B65A00; // type:func -func_8097A238 = 0x80B65A30; // type:func -DemoGj_SpawnSmokePreBattle2 = 0x80B65AAC; // type:func -func_8097A320 = 0x80B65B1C; // type:func -func_8097A36C = 0x80B65B70; // type:func -DemoGj_Update02 = 0x80B65BA4; // type:func -DemoGj_Update09 = 0x80B65BDC; // type:func -DemoGj_DrawRubble3 = 0x80B65C14; // type:func -DemoGj_DrawRotatedRubble3 = 0x80B65C38; // type:func -DemoGj_InitRubblePile3 = 0x80B65C5C; // type:func -func_8097A474 = 0x80B65C8C; // type:func -func_8097A4F0 = 0x80B65D08; // type:func -func_8097A53C = 0x80B65D5C; // type:func -DemoGj_Update03 = 0x80B65D90; // type:func -DemoGj_Update10 = 0x80B65DC8; // type:func -DemoGj_DrawRubble4 = 0x80B65E00; // type:func -DemoGj_DrawRotatedRubble4 = 0x80B65E24; // type:func -DemoGj_InitRubblePile4 = 0x80B65E48; // type:func -func_8097A644 = 0x80B65E78; // type:func -func_8097A6C0 = 0x80B65EF4; // type:func -func_8097A70C = 0x80B65F48; // type:func -DemoGj_Update04 = 0x80B65F7C; // type:func -DemoGj_Update11 = 0x80B65FB4; // type:func -DemoGj_DrawRubble5 = 0x80B65FEC; // type:func -DemoGj_DrawRotatedRubble5 = 0x80B66010; // type:func -DemoGj_InitRubblePile5 = 0x80B66034; // type:func -func_8097A814 = 0x80B66064; // type:func -func_8097A890 = 0x80B660E0; // type:func -func_8097A8DC = 0x80B66134; // type:func -DemoGj_Update05 = 0x80B66168; // type:func -DemoGj_Update12 = 0x80B661A0; // type:func -DemoGj_DrawRubble6 = 0x80B661D8; // type:func -DemoGj_DrawRotatedRubble6 = 0x80B661FC; // type:func -DemoGj_InitRubblePile6 = 0x80B66220; // type:func -func_8097A9E4 = 0x80B66250; // type:func -func_8097AA60 = 0x80B662CC; // type:func -func_8097AAAC = 0x80B66320; // type:func -DemoGj_Update06 = 0x80B66354; // type:func -DemoGj_Update13 = 0x80B6638C; // type:func -DemoGj_DrawRubble7 = 0x80B663C4; // type:func -DemoGj_DrawRotatedRubble7 = 0x80B663E8; // type:func -DemoGj_InitRubblePile7 = 0x80B6640C; // type:func -func_8097ABB4 = 0x80B6643C; // type:func -DemoGj_SpawnSmokePreBattle3 = 0x80B664B8; // type:func -func_8097AC9C = 0x80B66528; // type:func -func_8097ACE8 = 0x80B6657C; // type:func -DemoGj_Update07 = 0x80B665B0; // type:func -DemoGj_Update14 = 0x80B665E8; // type:func -DemoGj_DrawRubbleTall = 0x80B66620; // type:func -DemoGj_DrawRotatedRubbleTall = 0x80B66644; // type:func -DemoGj_InitRubbleAroundArena = 0x80B66668; // type:func -DemoGj_UpdateRubbleAroundArena = 0x80B66698; // type:func -DemoGj_DrawRubbleAroundArena = 0x80B666E8; // type:func -DemoGj_InitDestructableRubble1 = 0x80B6670C; // type:func -func_8097AEE8 = 0x80B66794; // type:func -DemoGj_SetCylindersAsAC = 0x80B66928; // type:func -DemoGj_DirectedExplosion = 0x80B66994; // type:func -func_8097B128 = 0x80B669D0; // type:func -DemoGj_HasCylinderAnyExploded = 0x80B66A60; // type:func -func_8097B22C = 0x80B66ADC; // type:func -DemoGj_Update15 = 0x80B66BF4; // type:func -DemoGj_Update18 = 0x80B66C2C; // type:func -DemoGj_DrawDestructableRubble1 = 0x80B66C4C; // type:func -DemoGj_InitDestructableRubble2 = 0x80B66C70; // type:func -func_8097B450 = 0x80B66CF8; // type:func -DemoGj_SetCylindersAsAC2 = 0x80B66E48; // type:func -DemoGj_HasCylinderAnyExploded2 = 0x80B66EB4; // type:func -DemoGj_DirectedExplosion2 = 0x80B66F30; // type:func -func_8097B6C4 = 0x80B66F6C; // type:func -func_8097B750 = 0x80B66FFC; // type:func -DemoGj_Update16 = 0x80B67114; // type:func -DemoGj_Update19 = 0x80B6714C; // type:func -DemoGj_DemoGj_InitDestructableRubble2 = 0x80B6716C; // type:func -DemoGj_InitDestructableRubbleTall = 0x80B67190; // type:func -DemoGj_DirectedDoubleExplosion = 0x80B671DC; // type:func -func_8097B9BC = 0x80B67260; // type:func -func_8097BA48 = 0x80B672F0; // type:func -DemoGj_Update17 = 0x80B67424; // type:func -DemoGj_Update20 = 0x80B6745C; // type:func -DemoGj_DemoGj_InitDestructableRubbleTall = 0x80B6747C; // type:func -DemoGj_Update = 0x80B674A0; // type:func -DemoGj_Init = 0x80B674E8; // type:func -DemoGj_DrawNothing = 0x80B675F0; // type:func -DemoGj_Draw = 0x80B67600; // type:func -DemoGeff_Destroy = 0x80B67E70; // type:func -DemoGeff_Init = 0x80B67E80; // type:func -func_80977EA8 = 0x80B67EC8; // type:func -func_80977F80 = 0x80B67F64; // type:func -func_80978030 = 0x80B67FC0; // type:func -func_809781FC = 0x80B6818C; // type:func -func_809782A0 = 0x80B68230; // type:func -func_80978308 = 0x80B68298; // type:func -func_80978344 = 0x80B682D0; // type:func -func_80978370 = 0x80B68300; // type:func -func_809783D4 = 0x80B6834C; // type:func -DemoGeff_Update = 0x80B683E8; // type:func -func_809784D4 = 0x80B68430; // type:func -DemoGeff_Draw = 0x80B68440; // type:func -BgGndFiremeiro_Init = 0x80B68690; // type:func -BgGndFiremeiro_Destroy = 0x80B68744; // type:func -BgGndFiremeiro_Sink = 0x80B68784; // type:func -BgGndFiremeiro_Shake = 0x80B68840; // type:func -BgGndFiremeiro_Rise = 0x80B689E4; // type:func -BgGndFiremeiro_Update = 0x80B68AA4; // type:func -BgGndFiremeiro_Draw = 0x80B68AC8; // type:func -BgGndDarkmeiro_ToggleBlock = 0x80B68BE0; // type:func -BgGndDarkmeiro_Init = 0x80B68C6C; // type:func -BgGndDarkmeiro_Destroy = 0x80B68E98; // type:func -BgGndDarkmeiro_Noop = 0x80B68EE0; // type:func -BgGndDarkmeiro_UpdateBlockTimer = 0x80B68EF0; // type:func -BgGndDarkmeiro_UpdateStaticBlock = 0x80B690E4; // type:func -BgGndDarkmeiro_UpdateSwitchBlock = 0x80B690F4; // type:func -BgGndDarkmeiro_Update = 0x80B69158; // type:func -BgGndDarkmeiro_DrawInvisiblePath = 0x80B6917C; // type:func -BgGndDarkmeiro_DrawSwitchBlock = 0x80B691AC; // type:func -BgGndDarkmeiro_DrawStaticBlock = 0x80B692C4; // type:func -BgGndSoulmeiro_Init = 0x80B693A0; // type:func -BgGndSoulmeiro_Destroy = 0x80B694E4; // type:func -func_8087AF38 = 0x80B69520; // type:func -func_8087B284 = 0x80B6986C; // type:func -func_8087B350 = 0x80B69938; // type:func -BgGndSoulmeiro_Update = 0x80B6998C; // type:func -BgGndSoulmeiro_Draw = 0x80B699B8; // type:func -BgGndNisekabe_Init = 0x80B69C00; // type:func -BgGndNisekabe_Destroy = 0x80B69C3C; // type:func -BgGndNisekabe_Update = 0x80B69C4C; // type:func -BgGndNisekabe_Draw = 0x80B69C80; // type:func -BgGndIceblock_Init = 0x80B69D70; // type:func -BgGndIceblock_Destroy = 0x80B69E5C; // type:func -BgGndIceblock_SetPosition = 0x80B69E90; // type:func -BgGndIceblock_CheckForBlock = 0x80B69F9C; // type:func -BgGndIceblock_NextAction = 0x80B69FD8; // type:func -BgGndIceblock_SetNextPosition = 0x80B6A024; // type:func -BgGndIceblock_Idle = 0x80B6A354; // type:func -BgGndIceblock_Reset = 0x80B6A410; // type:func -BgGndIceblock_Fall = 0x80B6A4D4; // type:func -BgGndIceblock_Hole = 0x80B6A58C; // type:func -BgGndIceblock_Slide = 0x80B6A628; // type:func -BgGndIceblock_Update = 0x80B6A958; // type:func -BgGndIceblock_Draw = 0x80B6A97C; // type:func -BgYdanSp_Init = 0x80B6AE70; // type:func -BgYdanSp_Destroy = 0x80B6B258; // type:func -BgYdanSp_UpdateFloorWebCollision = 0x80B6B2A0; // type:func -BgYdanSp_BurnWeb = 0x80B6B374; // type:func -BgYdanSp_BurnFloorWeb = 0x80B6B3E4; // type:func -BgYdanSp_FloorWebBroken = 0x80B6B6B8; // type:func -BgYdanSp_FloorWebBreaking = 0x80B6B6F8; // type:func -BgYdanSp_FloorWebIdle = 0x80B6B8B8; // type:func -BgYdanSp_BurnWallWeb = 0x80B6BB94; // type:func -BgYdanSp_WallWebIdle = 0x80B6BECC; // type:func -BgYdanSp_Update = 0x80B6C00C; // type:func -BgYdanSp_Draw = 0x80B6C030; // type:func -func_80A2F180 = 0x80B6C590; // type:func -EnGb_Init = 0x80B6C5C0; // type:func -EnGb_Destroy = 0x80B6C9C0; // type:func -func_80A2F608 = 0x80B6CA1C; // type:func -func_80A2F760 = 0x80B6CB74; // type:func -func_80A2F7C0 = 0x80B6CBD4; // type:func -func_80A2F83C = 0x80B6CC50; // type:func -func_80A2F94C = 0x80B6CD6C; // type:func -func_80A2F9C0 = 0x80B6CDE4; // type:func -func_80A2FA50 = 0x80B6CE78; // type:func -func_80A2FB40 = 0x80B6CF68; // type:func -func_80A2FBB0 = 0x80B6CFDC; // type:func -func_80A2FC0C = 0x80B6D03C; // type:func -func_80A2FC70 = 0x80B6D0A4; // type:func -EnGb_Update = 0x80B6D1A8; // type:func -EnGb_Draw = 0x80B6D2E0; // type:func -EnGb_UpdateCagedSouls = 0x80B6D400; // type:func -EnGb_DrawCagedSouls = 0x80B6D758; // type:func -EnGs_Init = 0x80B6DCC0; // type:func -EnGs_Destroy = 0x80B6DD84; // type:func -func_80A4E3EC = 0x80B6DD94; // type:func -func_80A4E470 = 0x80B6DE1C; // type:func -func_80A4E648 = 0x80B6DFDC; // type:func -func_80A4E754 = 0x80B6E0EC; // type:func -func_80A4E910 = 0x80B6E2AC; // type:func -func_80A4EA08 = 0x80B6E3A8; // type:func -func_80A4EB3C = 0x80B6E4DC; // type:func -func_80A4ED34 = 0x80B6E6D4; // type:func -func_80A4F13C = 0x80B6EAE0; // type:func -func_80A4F700 = 0x80B6F0A4; // type:func -func_80A4F734 = 0x80B6F0D8; // type:func -func_80A4F77C = 0x80B6F120; // type:func -EnGs_Update = 0x80B6F19C; // type:func -EnGs_Draw = 0x80B6F334; // type:func -BgMizuBwall_RotateVec3f = 0x80B6FB30; // type:func -BgMizuBwall_Init = 0x80B6FB84; // type:func -BgMizuBwall_Destroy = 0x80B70400; // type:func -BgMizuBwall_SetAlpha = 0x80B70448; // type:func -BgMizuBwall_SpawnDebris = 0x80B705CC; // type:func -BgMizuBwall_Idle = 0x80B708A0; // type:func -BgMizuBwall_Break = 0x80B709A0; // type:func -BgMizuBwall_DoNothing = 0x80B709CC; // type:func -BgMizuBwall_Update = 0x80B709DC; // type:func -BgMizuBwall_Draw = 0x80B70A00; // type:func -BgMizuShutter_Init = 0x80B71000; // type:func -BgMizuShutter_Destroy = 0x80B71260; // type:func -BgMizuShutter_WaitForSwitch = 0x80B71294; // type:func -BgMizuShutter_WaitForCutscene = 0x80B71328; // type:func -BgMizuShutter_Move = 0x80B71374; // type:func -BgMizuShutter_WaitForTimer = 0x80B71560; // type:func -BgMizuShutter_Update = 0x80B715E0; // type:func -BgMizuShutter_Draw = 0x80B71604; // type:func -EnDaikuKakariko_ChangeAnim = 0x80B71800; // type:func -EnDaikuKakariko_Init = 0x80B718B4; // type:func -EnDaikuKakariko_Destroy = 0x80B71C0C; // type:func -EnDaikuKakariko_GetTalkState = 0x80B71C38; // type:func -EnDaikuKakariko_HandleTalking = 0x80B71CDC; // type:func -EnDaikuKakariko_Talk = 0x80B71E98; // type:func -EnDaikuKakariko_Wait = 0x80B71F6C; // type:func -EnDaikuKakariko_StopRunning = 0x80B72008; // type:func -EnDaikuKakariko_Run = 0x80B720B8; // type:func -EnDaikuKakariko_Update = 0x80B72438; // type:func -EnDaikuKakariko_OverrideLimbDraw = 0x80B725B0; // type:func -EnDaikuKakariko_PostLimbDraw = 0x80B72770; // type:func -EnDaikuKakariko_Draw = 0x80B727EC; // type:func -BgBowlWall_Init = 0x80B72BC0; // type:func -BgBowlWall_Destroy = 0x80B72C78; // type:func -BgBowlWall_SpawnBullseyes = 0x80B72CAC; // type:func -BgBowlWall_WaitForHit = 0x80B72E7C; // type:func -BgBowlWall_FallDoEffects = 0x80B72EA0; // type:func -BgBowlWall_FinishFall = 0x80B73154; // type:func -BgBowlWall_Reset = 0x80B73234; // type:func -BgBowlWall_Update = 0x80B732CC; // type:func -BgBowlWall_Draw = 0x80B73300; // type:func -EnWallTubo_Init = 0x80B73540; // type:func -EnWallTubo_Destroy = 0x80B73570; // type:func -EnWallTubo_FindGirl = 0x80B73580; // type:func -EnWallTubo_DetectChu = 0x80B735C4; // type:func -EnWallTubo_SetWallFall = 0x80B737E0; // type:func -EnWallTubo_Update = 0x80B7394C; // type:func -EnPoDesert_Init = 0x80B73A30; // type:func -EnPoDesert_Destroy = 0x80B73BA0; // type:func -EnPoDesert_SetNextPathPoint = 0x80B73BE8; // type:func -EnPoDesert_SetupMoveToNextPoint = 0x80B73D44; // type:func -EnPoDesert_SetupDisappear = 0x80B73D88; // type:func -EnPoDesert_UpdateSpeedModifier = 0x80B73DE8; // type:func -EnPoDesert_WaitForPlayer = 0x80B73E58; // type:func -EnPoDesert_MoveToNextPoint = 0x80B73F24; // type:func -EnPoDesert_Disappear = 0x80B740B8; // type:func -EnPoDesert_Update = 0x80B741A0; // type:func -EnPoDesert_OverrideLimbDraw = 0x80B74294; // type:func -EnPoDesert_PostLimbDraw = 0x80B74320; // type:func -EnPoDesert_Draw = 0x80B74574; // type:func -EnCrow_Init = 0x80B747F0; // type:func -EnCrow_Destroy = 0x80B748E0; // type:func -EnCrow_SetupFlyIdle = 0x80B7490C; // type:func -EnCrow_SetupDiveAttack = 0x80B74940; // type:func -EnCrow_SetupDamaged = 0x80B74974; // type:func -EnCrow_SetupDie = 0x80B74C94; // type:func -EnCrow_SetupTurnAway = 0x80B74CAC; // type:func -EnCrow_SetupRespawn = 0x80B74D34; // type:func -EnCrow_FlyIdle = 0x80B74E28; // type:func -EnCrow_DiveAttack = 0x80B75254; // type:func -EnCrow_Damaged = 0x80B753F8; // type:func -EnCrow_Die = 0x80B75520; // type:func -EnCrow_TurnAway = 0x80B755D0; // type:func -EnCrow_Respawn = 0x80B75674; // type:func -EnCrow_UpdateDamage = 0x80B75740; // type:func -EnCrow_Update = 0x80B757F0; // type:func -EnCrow_OverrideLimbDraw = 0x80B75A0C; // type:func -EnCrow_PostLimbDraw = 0x80B75AF8; // type:func -EnCrow_Draw = 0x80B75BB8; // type:func -DoorKiller_Init = 0x80B75E90; // type:func -DoorKiller_Destroy = 0x80B761E8; // type:func -DoorKiller_SpawnRubble = 0x80B76238; // type:func -DoorKiller_FallAsRubble = 0x80B763E0; // type:func -DoorKiller_IsHit = 0x80B764A0; // type:func -DoorKiller_SetAC = 0x80B764D4; // type:func -DoorKiller_Die = 0x80B76534; // type:func -DoorKiller_RiseBackUp = 0x80B76584; // type:func -DoorKiller_FallOver = 0x80B76734; // type:func -DoorKiller_Wobble = 0x80B76B00; // type:func -DoorKiller_WaitBeforeWobble = 0x80B76C70; // type:func -DoorKiller_Wait = 0x80B76CA4; // type:func -DoorKiller_UpdateTexture = 0x80B76F04; // type:func -DoorKiller_WaitForObject = 0x80B76F98; // type:func -DoorKiller_Update = 0x80B7704C; // type:func -DoorKiller_SetTexture = 0x80B77070; // type:func -DoorKiller_DrawDoor = 0x80B7709C; // type:func -DoorKiller_DrawRubble = 0x80B770F8; // type:func -func_808B27F0 = 0x80B77400; // type:func -func_808B280C = 0x80B77420; // type:func -BgSpot11Oasis_Init = 0x80B77534; // type:func -func_808B2970 = 0x80B77588; // type:func -func_808B2980 = 0x80B7759C; // type:func -func_808B29E0 = 0x80B775FC; // type:func -func_808B29F0 = 0x80B77610; // type:func -func_808B2AA8 = 0x80B776C8; // type:func -func_808B2AB8 = 0x80B776DC; // type:func -BgSpot11Oasis_Update = 0x80B776EC; // type:func -BgSpot11Oasis_Draw = 0x80B778E0; // type:func -BgSpot18Futa_Init = 0x80B77B30; // type:func -BgSpot18Futa_Destroy = 0x80B77B9C; // type:func -BgSpot18Futa_Update = 0x80B77BD0; // type:func -BgSpot18Futa_Draw = 0x80B77C34; // type:func -BgSpot18Shutter_Init = 0x80B77CD0; // type:func -BgSpot18Shutter_Destroy = 0x80B77E80; // type:func -func_808B95AC = 0x80B77EB4; // type:func -func_808B95B8 = 0x80B77EC4; // type:func -func_808B9618 = 0x80B77F24; // type:func -func_808B9698 = 0x80B77FAC; // type:func -func_808B971C = 0x80B78030; // type:func -BgSpot18Shutter_Update = 0x80B7810C; // type:func -BgSpot18Shutter_Draw = 0x80B78130; // type:func -EnMa3_GetTextId = 0x80B78220; // type:func -EnMa3_UpdateTalkState = 0x80B78358; // type:func -func_80AA2E54 = 0x80B785D8; // type:func -func_80AA2EC8 = 0x80B7864C; // type:func -func_80AA2F28 = 0x80B786B0; // type:func -EnMa3_UpdateEyes = 0x80B78708; // type:func -EnMa3_ChangeAnim = 0x80B78794; // type:func -EnMa3_Init = 0x80B78804; // type:func -EnMa3_Destroy = 0x80B78958; // type:func -func_80AA3200 = 0x80B78998; // type:func -EnMa3_Update = 0x80B789CC; // type:func -EnMa3_OverrideLimbDraw = 0x80B78AE0; // type:func -EnMa3_PostLimbDraw = 0x80B78D20; // type:func -EnMa3_Draw = 0x80B78DD4; // type:func -EnCow_RotateY = 0x80B791D0; // type:func -EnCow_SetColliderPos = 0x80B79268; // type:func -EnCow_SetTailPos = 0x80B7935C; // type:func -EnCow_Init = 0x80B793D8; // type:func -EnCow_Destroy = 0x80B79810; // type:func -EnCow_UpdateAnimation = 0x80B7985C; // type:func -EnCow_TalkEnd = 0x80B79A84; // type:func -EnCow_GiveMilkEnd = 0x80B79AFC; // type:func -EnCow_GiveMilkWait = 0x80B79B44; // type:func -EnCow_GiveMilk = 0x80B79BA8; // type:func -EnCow_CheckForEmptyBottle = 0x80B79C44; // type:func -EnCow_Talk = 0x80B79CD4; // type:func -EnCow_Idle = 0x80B79D48; // type:func -EnCow_IdleTail = 0x80B79E64; // type:func -EnCow_Update = 0x80B79FFC; // type:func -EnCow_UpdateTail = 0x80B7A278; // type:func -EnCow_OverrideLimbDraw = 0x80B7A364; // type:func -EnCow_PostLimbDraw = 0x80B7A3B4; // type:func -EnCow_Draw = 0x80B7A3F4; // type:func -EnCow_DrawTail = 0x80B7A454; // type:func -BgIceTurara_Init = 0x80B7A630; // type:func -BgIceTurara_Destroy = 0x80B7A70C; // type:func -BgIceTurara_Break = 0x80B7A754; // type:func -BgIceTurara_Stalagmite = 0x80B7A934; // type:func -BgIceTurara_Wait = 0x80B7A99C; // type:func -BgIceTurara_Shiver = 0x80B7A9D4; // type:func -BgIceTurara_Fall = 0x80B7AB40; // type:func -BgIceTurara_Regrow = 0x80B7AC98; // type:func -BgIceTurara_Update = 0x80B7ACE8; // type:func -BgIceTurara_Draw = 0x80B7AD0C; // type:func -func_80891AC0 = 0x80B7AE60; // type:func -BgIceShutter_Init = 0x80B7AEE8; // type:func -BgIceShutter_Destroy = 0x80B7B068; // type:func -func_80891CF4 = 0x80B7B09C; // type:func -func_80891D6C = 0x80B7B114; // type:func -func_80891DD4 = 0x80B7B17C; // type:func -BgIceShutter_Update = 0x80B7B1E4; // type:func -BgIceShutter_Draw = 0x80B7B208; // type:func -EnKakasi2_Init = 0x80B7B2D0; // type:func -EnKakasi2_Destroy = 0x80B7B42C; // type:func -func_80A90264 = 0x80B7B458; // type:func -func_80A904D8 = 0x80B7B5B0; // type:func -func_80A90578 = 0x80B7B650; // type:func -func_80A9062C = 0x80B7B704; // type:func -func_80A906C4 = 0x80B7B79C; // type:func -EnKakasi2_Update = 0x80B7B80C; // type:func -func_80A90948 = 0x80B7B8CC; // type:func -EnKakasi3_Destroy = 0x80B7B9F0; // type:func -EnKakasi3_Init = 0x80B7BA1C; // type:func -func_80A90E28 = 0x80B7BAE4; // type:func -func_80A90EBC = 0x80B7BB78; // type:func -func_80A911F0 = 0x80B7BEAC; // type:func -func_80A91284 = 0x80B7BF40; // type:func -func_80A91348 = 0x80B7C004; // type:func -func_80A915B8 = 0x80B7C27C; // type:func -func_80A91620 = 0x80B7C2E8; // type:func -func_80A91760 = 0x80B7C428; // type:func -func_80A917FC = 0x80B7C4C8; // type:func -func_80A9187C = 0x80B7C550; // type:func -func_80A918E4 = 0x80B7C5BC; // type:func -func_80A91A90 = 0x80B7C700; // type:func -EnKakasi3_Update = 0x80B7C800; // type:func -EnKakasi3_Draw = 0x80B7C8F8; // type:func -OceffWipe4_Init = 0x80B7CAD0; // type:func -OceffWipe4_Destroy = 0x80B7CB2C; // type:func -OceffWipe4_Update = 0x80B7CB50; // type:func -OceffWipe4_Draw = 0x80B7CBB0; // type:func -EnEg_PlayVoidOutSFX = 0x80B7DAB0; // type:func -EnEg_Destroy = 0x80B7DAD0; // type:func -EnEg_Init = 0x80B7DAE0; // type:func -func_809FFDC8 = 0x80B7DAF0; // type:func -EnEg_Update = 0x80B7DB88; // type:func -EnEg_Draw = 0x80B7DBD0; // type:func -BgMenkuriNisekabe_Init = 0x80B7DC60; // type:func -BgMenkuriNisekabe_Destroy = 0x80B7DC88; // type:func -BgMenkuriNisekabe_Update = 0x80B7DC98; // type:func -BgMenkuriNisekabe_Draw = 0x80B7DCCC; // type:func -EnZo_SpawnRipple = 0x80B7DDB0; // type:func -EnZo_SpawnBubble = 0x80B7DE44; // type:func -EnZo_SpawnSplash = 0x80B7DF74; // type:func -EnZo_UpdateEffectsRipples = 0x80B7E0E0; // type:func -EnZo_UpdateEffectsBubbles = 0x80B7E19C; // type:func -EnZo_UpdateEffectsSplashes = 0x80B7E2CC; // type:func -EnZo_DrawEffectsRipples = 0x80B7E404; // type:func -EnZo_DrawEffectsBubbles = 0x80B7E5B4; // type:func -EnZo_DrawEffectsSplashes = 0x80B7E760; // type:func -EnZo_TreadWaterRipples = 0x80B7E918; // type:func -EnZo_SpawnSplashes = 0x80B7E994; // type:func -EnZo_GetTextId = 0x80B7EB08; // type:func -EnZo_UpdateTalkState = 0x80B7ED7C; // type:func -EnZo_Blink = 0x80B7EEE0; // type:func -EnZo_Dialog = 0x80B7EF58; // type:func -EnZo_PlayerInProximity = 0x80B7F038; // type:func -EnZo_SetAnimation = 0x80B7F0D8; // type:func -EnZo_Init = 0x80B7F1D0; // type:func -EnZo_Destroy = 0x80B7F3D8; // type:func -EnZo_Standing = 0x80B7F3E8; // type:func -EnZo_Submerged = 0x80B7F4CC; // type:func -EnZo_Surface = 0x80B7F50C; // type:func -EnZo_TreadWater = 0x80B7F5F0; // type:func -EnZo_Dive = 0x80B7F7A0; // type:func -EnZo_Update = 0x80B7F8E8; // type:func -EnZo_OverrideLimbDraw = 0x80B7FAC8; // type:func -EnZo_PostLimbDraw = 0x80B7FCE8; // type:func -EnZo_Draw = 0x80B7FD44; // type:func -EffectSsIceSmoke_Init = 0x80B80370; // type:func -EffectSsIceSmoke_Draw = 0x80B80490; // type:func -EffectSsIceSmoke_Update = 0x80B80770; // type:func -ObjMakekinsuta_Init = 0x80B80850; // type:func -func_80B98320 = 0x80B80868; // type:func -ObjMakekinsuta_DoNothing = 0x80B8091C; // type:func -ObjMakekinsuta_Update = 0x80B8092C; // type:func -EnGe3_ChangeAction = 0x80B809A0; // type:func -EnGe3_Init = 0x80B80A48; // type:func -EnGe3_Destroy = 0x80B80B50; // type:func -EnGe3_TurnToFacePlayer = 0x80B80B7C; // type:func -EnGe3_LookAtPlayer = 0x80B80C94; // type:func -EnGe3_Wait = 0x80B80DA8; // type:func -EnGe3_WaitLookAtPlayer = 0x80B80E0C; // type:func -EnGe3_WaitTillCardGiven = 0x80B80E2C; // type:func -EnGe3_GiveCard = 0x80B80E90; // type:func -EnGe3_ForceTalk = 0x80B80F24; // type:func -EnGe3_UpdateCollision = 0x80B80FDC; // type:func -EnGe3_MoveAndBlink = 0x80B81084; // type:func -EnGe3_UpdateWhenNotTalking = 0x80B81110; // type:func -EnGe3_Update = 0x80B811C4; // type:func -EnGe3_OverrideLimbDraw = 0x80B81210; // type:func -EnGe3_PostLimbDraw = 0x80B81364; // type:func -EnGe3_Draw = 0x80B813C0; // type:func -ObjTimeblock_CalculateIsVisible = 0x80B815E0; // type:func -ObjTimeblock_SpawnDemoEffect = 0x80B816A0; // type:func -ObjTimeblock_ToggleSwitchFlag = 0x80B81714; // type:func -ObjTimeblock_Init = 0x80B8175C; // type:func -ObjTimeblock_Destroy = 0x80B81910; // type:func -ObjTimeblock_PlayerIsInRange = 0x80B81944; // type:func -ObjTimeblock_WaitForOcarina = 0x80B81A24; // type:func -ObjTimeblock_WaitForSong = 0x80B81AA4; // type:func -ObjTimeblock_SetupDoNothing = 0x80B81B1C; // type:func -ObjTimeblock_DoNothing = 0x80B81B30; // type:func -ObjTimeblock_SetupNormal = 0x80B81B40; // type:func -ObjTimeblock_Normal = 0x80B81B54; // type:func -func_80BA06AC = 0x80B81CD0; // type:func -ObjTimeblock_SetupAltBehaviorVisible = 0x80B81D80; // type:func -ObjTimeblock_AltBehaviorVisible = 0x80B81D94; // type:func -ObjTimeblock_SetupAltBehaviourNotVisible = 0x80B81E60; // type:func -ObjTimeblock_AltBehaviourNotVisible = 0x80B81E74; // type:func -ObjTimeblock_Update = 0x80B81F44; // type:func -ObjTimeblock_Draw = 0x80B81FCC; // type:func -ObjHamishi_InitCollision = 0x80B82230; // type:func -ObjHamishi_Shake = 0x80B82288; // type:func -ObjHamishi_Break = 0x80B82404; // type:func -ObjHamishi_Init = 0x80B826B0; // type:func -ObjHamishi_Destroy = 0x80B82798; // type:func -ObjHamishi_Update = 0x80B827C4; // type:func -ObjHamishi_Draw = 0x80B828F4; // type:func -EnZl4_SetActiveCamDir = 0x80B82A80; // type:func -EnZl4_SetActiveCamMove = 0x80B82B58; // type:func -EnZl4_GetTextId = 0x80B82BDC; // type:func -EnZl4_UpdateTalkState = 0x80B82C80; // type:func -EnZl4_UpdateFace = 0x80B82CBC; // type:func -EnZl4_SetMove = 0x80B82E0C; // type:func -func_80B5BB78 = 0x80B82E4C; // type:func -EnZl4_GetCueStartPos = 0x80B82E98; // type:func -EnZl4_SetupFromLegendCs = 0x80B82EDC; // type:func -EnZl4_InMovingAnim = 0x80B82FB4; // type:func -EnZl4_Init = 0x80B83084; // type:func -EnZl4_Destroy = 0x80B83240; // type:func -EnZl4_SetNextAnim = 0x80B8326C; // type:func -EnZl4_ReverseAnimation = 0x80B832C0; // type:func -EnZl4_CsWaitForPlayer = 0x80B832E8; // type:func -EnZl4_CsMeetPlayer = 0x80B83448; // type:func -EnZl4_CsAskStone = 0x80B83740; // type:func -EnZl4_CsAskName = 0x80B83C6C; // type:func -EnZl4_CsTellLegend = 0x80B84258; // type:func -EnZl4_CsLookWindow = 0x80B846B4; // type:func -EnZl4_CsWarnAboutGanon = 0x80B848F8; // type:func -EnZl4_CsMakePlan = 0x80B84DC0; // type:func -EnZl4_Cutscene = 0x80B85104; // type:func -EnZl4_Idle = 0x80B8537C; // type:func -EnZl4_TheEnd = 0x80B853F4; // type:func -EnZl4_Update = 0x80B855A4; // type:func -EnZl4_OverrideLimbDraw = 0x80B85654; // type:func -EnZl4_PostLimbDraw = 0x80B857E4; // type:func -EnZl4_Draw = 0x80B85840; // type:func -EnMm2_ChangeAnim = 0x80B874B0; // type:func -func_80AAEF70 = 0x80B875D4; // type:func -EnMm2_Init = 0x80B876A4; // type:func -EnMm2_Destroy = 0x80B8785C; // type:func -func_80AAF224 = 0x80B87888; // type:func -func_80AAF2BC = 0x80B87924; // type:func -func_80AAF330 = 0x80B87998; // type:func -func_80AAF3C0 = 0x80B87A28; // type:func -func_80AAF57C = 0x80B87BE4; // type:func -func_80AAF5EC = 0x80B87C58; // type:func -func_80AAF668 = 0x80B87CD4; // type:func -EnMm2_Update = 0x80B87DC8; // type:func -EnMm2_Draw = 0x80B87F10; // type:func -EnMm2_OverrideLimbDraw = 0x80B87FDC; // type:func -EnMm2_PostLimbDraw = 0x80B88064; // type:func -BgJyaBlock_Init = 0x80B88270; // type:func -BgJyaBlock_Destroy = 0x80B88328; // type:func -BgJyaBlock_Update = 0x80B8835C; // type:func -BgJyaBlock_Draw = 0x80B88380; // type:func -ObjWarp2block_Spawn = 0x80B884E0; // type:func -func_80BA1ECC = 0x80B885BC; // type:func -ObjWarp2block_SwapWithChild = 0x80B8873C; // type:func -func_80BA2218 = 0x80B8890C; // type:func -func_80BA228C = 0x80B8898C; // type:func -func_80BA2304 = 0x80B88A04; // type:func -ObjWarp2block_Init = 0x80B88A48; // type:func -ObjWarp2block_Destroy = 0x80B88B68; // type:func -ObjWarp2block_SetInactive = 0x80B88BA8; // type:func -ObjWarp2block_DoNothing = 0x80B88BC0; // type:func -func_80BA24E8 = 0x80B88BD0; // type:func -func_80BA24F8 = 0x80B88BE4; // type:func -func_80BA2600 = 0x80B88CC8; // type:func -func_80BA2610 = 0x80B88CDC; // type:func -ObjWarp2block_Update = 0x80B88D8C; // type:func -ObjWarp2block_Draw = 0x80B88DC8; // type:func diff --git a/tools/disasm/ique-cn/variables.txt b/tools/disasm/ique-cn/variables.txt deleted file mode 100644 index 3103f86a63..0000000000 --- a/tools/disasm/ique-cn/variables.txt +++ /dev/null @@ -1,23 +0,0 @@ -gCartHandle = 0x80009D60; // size:0x4 type:OSPiHandle* -gCurrentRegion = 0x80009F00; // size:0x4 type:u32 -__osRunQueue = 0x80009F38; // size:0x4 type:OSThread* -__osRunningThread = 0x80009F40; // size:0x4 type:OSThread* -__osFaultedThread = 0x80009F44; // size:0x4 type:OSThread* -__osHwIntTable = 0x8000A070; // size:0x28 -__osPiIntTable = 0x8000A098; // size:0x8 -__osShutdown = 0x8000A0FC; // size:0x4 type:u32 -__OSGlobalIntMask = 0x8000A100; // type:OSHWIntr -__osIntOffTable = 0x8000A670; // size:0x20 type:u8 -__osIntTable = 0x8000A690; // size:0x24 -__osRcpImTable = 0x8000A6C0; // type:u16 -__DriveRomHandle = 0x80010760; // size:0x74 type:OSPiHandle -__osThreadSave = 0x80012BE0; // type:OSThread -__osEventStateTab = 0x80012F40; // size:0x78 -gGameStateOverlayTable = 0x800F8F30; // size:0x120 type:GameStateOverlay -gRegEditor = 0x80127760; // size:0x4 type:RegEditor* -sZeldaArena = 0x80127C50; // size:0x24 type:Arena -gSegments = 0x80129048; // size:0x40 -sFaultDrawer = 0x8012E030; // size:0x3C type:FaultDrawer -sArenaLockMsg = 0x80137E40; // size:0x4 type:OSMesg -gSystemArena = 0x80137E50; // type:Arena -gSaveContext = 0x80137F40; // size:0x1428 type:SaveContext diff --git a/tools/endian.h b/tools/endian.h new file mode 100644 index 0000000000..d69e2e6670 --- /dev/null +++ b/tools/endian.h @@ -0,0 +1,67 @@ +#ifndef ENDIAN_H_ +#define ENDIAN_H_ + +#if defined(__linux__) || defined(__CYGWIN__) +#include +#elif defined(__APPLE__) +#include + +#define htobe16(x) OSSwapHostToBigInt16(x) +#define htole16(x) OSSwapHostToLittleInt16(x) +#define be16toh(x) OSSwapBigToHostInt16(x) +#define le16toh(x) OSSwapLittleToHostInt16(x) + +#define htobe32(x) OSSwapHostToBigInt32(x) +#define htole32(x) OSSwapHostToLittleInt32(x) +#define be32toh(x) OSSwapBigToHostInt32(x) +#define le32toh(x) OSSwapLittleToHostInt32(x) + +#define htobe64(x) OSSwapHostToBigInt64(x) +#define htole64(x) OSSwapHostToLittleInt64(x) +#define be64toh(x) OSSwapBigToHostInt64(x) +#define le64toh(x) OSSwapLittleToHostInt64(x) +#else + +#if !defined(__BYTE_ORDER__) +#error "No endian define provided by compiler" +#endif + +#if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) + +#define htobe16(x) (x) +#define htole16(x) __builtin_bswap16(x) +#define be16toh(x) (x) +#define le16toh(x) __builtin_bswap16(x) + +#define htobe32(x) (x) +#define htole32(x) __builtin_bswap32(x) +#define be32toh(x) (x) +#define le32toh(x) __builtin_bswap32(x) + +#define htobe64(x) (x) +#define htole64(x) __builtin_bswap64(x) +#define be64toh(x) (x) +#define le64toh(x) __builtin_bswap64(x) + +#else + +#define htobe16(x) __builtin_bswap16(x) +#define htole16(x) (x) +#define be16toh(x) __builtin_bswap16(x) +#define le16toh(x) (x) + +#define htobe32(x) __builtin_bswap32(x) +#define htole32(x) (x) +#define be32toh(x) __builtin_bswap32(x) +#define le32toh(x) (x) + +#define htobe64(x) __builtin_bswap64(x) +#define htole64(x) (x) +#define be64toh(x) __builtin_bswap64(x) +#define le64toh(x) (x) + +#endif + +#endif + +#endif diff --git a/tools/extract_assets.py b/tools/extract_assets.py deleted file mode 100755 index 09519cb1ea..0000000000 --- a/tools/extract_assets.py +++ /dev/null @@ -1,208 +0,0 @@ -#!/usr/bin/env python3 - -import argparse -import json -import os -import signal -import time -import multiprocessing -from pathlib import Path - -import version_config - - -def SignalHandler(sig, frame): - print(f'Signal {sig} received. Aborting...') - mainAbort.set() - # Don't exit immediately to update the extracted assets file. - -def ExtractFile(assetConfig: version_config.AssetConfig, outputPath: Path, outputSourcePath: Path): - name = assetConfig.name - xmlPath = assetConfig.xml_path - version = globalVersionConfig.version - if globalAbort.is_set(): - # Don't extract if another file wasn't extracted properly. - return - - zapdPath = Path("tools") / "ZAPD" / "ZAPD.out" - configPath = Path("tools") / "ZAPDConfigs" / version / "Config.xml" - - outputPath.mkdir(parents=True, exist_ok=True) - outputSourcePath.mkdir(parents=True, exist_ok=True) - - execStr = f"{zapdPath} e -eh -i {xmlPath} -b {globalBaseromSegmentsDir} -o {outputPath} -osf {outputSourcePath} -gsf 1 -rconf {configPath} --cs-float both {ZAPDArgs}" - - if name.startswith("code/") or name.startswith("n64dd/") or name.startswith("overlays/"): - assert assetConfig.start_offset is not None - assert assetConfig.end_offset is not None - - execStr += f" --start-offset 0x{assetConfig.start_offset:X}" - execStr += f" --end-offset 0x{assetConfig.end_offset:X}" - - if name.startswith("overlays/"): - overlayName = name.split("/")[1] - baseAddress = globalVersionConfig.dmadata_segments[overlayName].vram + assetConfig.start_offset - - execStr += f" --base-address 0x{baseAddress:X}" - execStr += " --static" - - if globalUnaccounted: - execStr += " -Wunaccounted" - - print(execStr) - exitValue = os.system(execStr) - if exitValue != 0: - globalAbort.set() - print("\n") - print(f"Error when extracting from file {xmlPath}", file=os.sys.stderr) - print("Aborting...", file=os.sys.stderr) - print("\n") - -def ExtractFunc(assetConfig: version_config.AssetConfig): - objectName = assetConfig.name - xml_path = assetConfig.xml_path - xml_path_str = str(xml_path) - - outPath = globalOutputDir / objectName - outSourcePath = outPath - - if xml_path_str in globalExtractedAssetsTracker: - timestamp = globalExtractedAssetsTracker[xml_path_str]["timestamp"] - modificationTime = int(os.path.getmtime(xml_path)) - if modificationTime < timestamp: - # XML has not been modified since last extraction. - return - - currentTimeStamp = int(time.time()) - - ExtractFile(assetConfig, outPath, outSourcePath) - - if not globalAbort.is_set(): - # Only update timestamp on successful extractions - if xml_path_str not in globalExtractedAssetsTracker: - globalExtractedAssetsTracker[xml_path_str] = globalManager.dict() - globalExtractedAssetsTracker[xml_path_str]["timestamp"] = currentTimeStamp - -def initializeWorker(versionConfig: version_config.VersionConfig, abort, unaccounted: bool, extractedAssetsTracker: dict, manager, baseromSegmentsDir: Path, outputDir: Path): - global globalVersionConfig - global globalAbort - global globalUnaccounted - global globalExtractedAssetsTracker - global globalManager - global globalBaseromSegmentsDir - global globalOutputDir - globalVersionConfig = versionConfig - globalAbort = abort - globalUnaccounted = unaccounted - globalExtractedAssetsTracker = extractedAssetsTracker - globalManager = manager - globalBaseromSegmentsDir = baseromSegmentsDir - globalOutputDir = outputDir - -def processZAPDArgs(argsZ): - badZAPDArg = False - for z in argsZ: - if z[0] == '-': - print(f'error: argument "{z}" starts with "-", which is not supported.', file=os.sys.stderr) - badZAPDArg = True - - if badZAPDArg: - exit(1) - - ZAPDArgs = " ".join(f"-{z}" for z in argsZ) - print("Using extra ZAPD arguments: " + ZAPDArgs) - return ZAPDArgs - -def main(): - parser = argparse.ArgumentParser(description="baserom asset extractor") - parser.add_argument( - "baserom_segments_dir", - type=Path, - help="Directory of uncompressed ROM segments", - ) - parser.add_argument( - "output_dir", - type=Path, - help="Output directory to place files in", - ) - parser.add_argument("-v", "--version", dest="oot_version", help="OOT game version", default="gc-eu-mq-dbg") - parser.add_argument("-s", "--single", help="Extract a single asset by name, e.g. objects/gameplay_keep") - parser.add_argument("-f", "--force", help="Force the extraction of every xml instead of checking the touched ones (overwriting current files).", action="store_true") - parser.add_argument("-j", "--jobs", help="Number of cpu cores to extract with.") - parser.add_argument("-u", "--unaccounted", help="Enables ZAPD unaccounted detector warning system.", action="store_true") - parser.add_argument("-Z", help="Pass the argument on to ZAPD, e.g. `-ZWunaccounted` to warn about unaccounted blocks in XMLs. Each argument should be passed separately, *without* the leading dash.", metavar="ZAPD_ARG", action="append") - args = parser.parse_args() - - baseromSegmentsDir: Path = args.baserom_segments_dir - version: str = args.oot_version - outputDir: Path = args.output_dir - - args.output_dir.mkdir(parents=True, exist_ok=True) - - versionConfig = version_config.load_version_config(version) - - global ZAPDArgs - ZAPDArgs = processZAPDArgs(args.Z) if args.Z else "" - - global mainAbort - mainAbort = multiprocessing.Event() - manager = multiprocessing.Manager() - signal.signal(signal.SIGINT, SignalHandler) - - extraction_times_p = outputDir / "assets_extraction_times.json" - extractedAssetsTracker = manager.dict() - if extraction_times_p.exists() and not args.force: - with extraction_times_p.open(encoding='utf-8') as f: - extractedAssetsTracker.update(json.load(f, object_hook=manager.dict)) - - singleAssetName = args.single - if singleAssetName is not None: - assetConfig = None - for asset in versionConfig.assets: - if asset.name == singleAssetName: - assetConfig = asset - break - else: - print(f"Error. Asset {singleAssetName} not found in config.", file=os.sys.stderr) - exit(1) - - initializeWorker(versionConfig, mainAbort, args.unaccounted, extractedAssetsTracker, manager, baseromSegmentsDir, outputDir) - # Always extract if -s is used. - xml_path_str = str(assetConfig.xml_path) - if xml_path_str in extractedAssetsTracker: - del extractedAssetsTracker[xml_path_str] - ExtractFunc(assetConfig) - else: - class CannotMultiprocessError(Exception): - pass - - try: - numCores = int(args.jobs or 0) - if numCores <= 0: - numCores = 1 - print("Extracting assets with " + str(numCores) + " CPU core" + ("s" if numCores > 1 else "") + ".") - try: - mp_context = multiprocessing.get_context("fork") - except ValueError as e: - raise CannotMultiprocessError() from e - with mp_context.Pool(numCores, initializer=initializeWorker, initargs=(versionConfig, mainAbort, args.unaccounted, extractedAssetsTracker, manager, baseromSegmentsDir, outputDir)) as p: - p.map(ExtractFunc, versionConfig.assets) - except (multiprocessing.ProcessError, TypeError, CannotMultiprocessError): - print("Warning: Multiprocessing exception occurred.", file=os.sys.stderr) - print("Disabling mutliprocessing.", file=os.sys.stderr) - - initializeWorker(versionConfig, mainAbort, args.unaccounted, extractedAssetsTracker, manager, baseromSegmentsDir, outputDir) - for assetConfig in versionConfig.assets: - ExtractFunc(assetConfig) - - with extraction_times_p.open('w', encoding='utf-8') as f: - serializableDict = dict() - for xml, data in extractedAssetsTracker.items(): - serializableDict[xml] = dict(data) - json.dump(dict(serializableDict), f, ensure_ascii=False, indent=4) - - if mainAbort.is_set(): - exit(1) - -if __name__ == "__main__": - main() diff --git a/tools/extract_assets.sh b/tools/extract_assets.sh new file mode 100755 index 0000000000..bda2b587da --- /dev/null +++ b/tools/extract_assets.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +# SPDX-FileCopyrightText: © 2024 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +if [ $# -eq 0 ] +then + echo "Usage: $0 [args...]" + exit 1 +fi + +v=$1 +.venv/bin/python3 -m tools.assets.extract extracted/$v/baserom extracted/$v -v $v "${@:2}" diff --git a/tools/extract_audio.py b/tools/extract_audio.py index ab5d5b3fb4..c67d7b1650 100644 --- a/tools/extract_audio.py +++ b/tools/extract_audio.py @@ -14,7 +14,8 @@ from audio.extraction.disassemble_sequence import MMLVersion, SequenceTableSpec, if __name__ == '__main__': parser = argparse.ArgumentParser(description="baserom audio asset extractor") - parser.add_argument("-o", "--extracted-dir", required=True, help="path to extracted directory") + parser.add_argument("-b", "--baserom-segments-dir", required=True, help="Directory of uncompressed ROM segments") + parser.add_argument("-o", "--output-dir", required=True, help="path to output directory") parser.add_argument("-v", "--version", required=True, help="version name") parser.add_argument("--read-xml", required=False, action="store_true", help="Read extraction xml files") parser.add_argument("--write-xml", required=False, action="store_true", help="Write extraction xml files") @@ -196,4 +197,4 @@ if __name__ == '__main__': audiotable_buffer_bugs, seq_disas_tables) - extract_audio_for_version(version_info, args.extracted_dir, args.read_xml, args.write_xml) + extract_audio_for_version(version_info, args.output_dir, args.baserom_segments_dir, args.read_xml, args.write_xml) diff --git a/tools/fix_bss.py b/tools/fix_bss.py index 2a775765af..743085cd17 100755 --- a/tools/fix_bss.py +++ b/tools/fix_bss.py @@ -82,7 +82,8 @@ class Pointer: @dataclass class BssSection: - start_address: int + base_start_address: int + build_start_address: int pointers: list[Pointer] @@ -170,9 +171,9 @@ def get_file_pointers( # For relocations against a global symbol, subtract the addend so that the pointer # is for the start of the symbol. This can help deal with things like STACK_TOP - # (where the pointer is past the end of the symbol) or negative addends. If the - # relocation is against a section however, it's not useful to subtract the addend, - # so we keep it as-is and hope for the best. + # (where the pointer is past the end of the symbol) or negative addends. We can't + # do this for relocations against a section though, since we need the addend to + # distinguish between different static variables. if reloc.name.startswith("."): # section addend = reloc.addend else: # symbol @@ -294,7 +295,26 @@ def compare_pointers(version: str) -> dict[Path, BssSection]: object_file = Path("src/code/z_message.o") c_file = object_file.with_suffix(".c") - bss_sections[c_file] = BssSection(file.vram, pointers_in_section) + + # For the baserom, assume that the lowest address is the start of the BSS section. This might + # not be true if the first BSS variable is not referenced so account for that specifically. + + base_start_address = ( + min(p.base_value for p in pointers_in_section) + if pointers_in_section + else 0 + ) + # Account for the fact that z_rumble starts with unreferenced bss + if str(c_file) == "src/code/z_rumble.c": + base_start_address -= 0x10 + elif str(c_file) == "src/boot/z_locale.c": + base_start_address -= 0x18 + + build_start_address = file.vram + + bss_sections[c_file] = BssSection( + base_start_address, build_start_address, pointers_in_section + ) return bss_sections @@ -436,23 +456,21 @@ def determine_base_bss_ordering( build_bss_symbols: list[BssSymbol], bss_section: BssSection, ) -> list[BssSymbol]: - base_start_address = min(p.base_value for p in bss_section.pointers) - found_symbols: dict[str, BssSymbol] = {} for p in bss_section.pointers: - base_offset = p.base_value - base_start_address - build_offset = p.build_value - bss_section.start_address + base_offset = p.base_value - bss_section.base_start_address + build_offset = p.build_value - bss_section.build_start_address new_symbol = None new_offset = 0 for symbol in build_bss_symbols: - if ( - symbol.offset <= build_offset - and build_offset < symbol.offset + symbol.size - ): + # To handle one-past-the-end pointers, we check <= instead of < for the symbol end. + # This won't work if there is another symbol right after this one, since we'll + # attribute this pointer to that symbol instead. This could prevent us from solving + # BSS ordering, but often the two symbols are adjacent in the baserom too so it works anyway. + if symbol.offset <= build_offset <= symbol.offset + symbol.size: new_symbol = symbol new_offset = base_offset - (build_offset - symbol.offset) - break if new_symbol is None: if p.addend > 0: @@ -814,18 +832,10 @@ def main(): for file, bss_section in bss_sections.items(): if not bss_section.pointers: continue - # The following heuristic doesn't work for z_locale, since the first pointer into BSS is not - # at the start of the section. Fortunately z_locale either has one BSS variable (in GC versions) - # or none (in N64 versions), so we can just skip it. - if str(file) == "src/boot/z_locale.c": - continue - # For the baserom, assume that the lowest address is the start of the BSS section. This might - # not be true if the first BSS variable is not referenced, but in practice this doesn't happen - # (except for z_locale above). - base_min_address = min(p.base_value for p in bss_section.pointers) - build_min_address = bss_section.start_address + if not all( - p.build_value - build_min_address == p.base_value - base_min_address + p.build_value - bss_section.build_start_address + == p.base_value - bss_section.base_start_address for p in bss_section.pointers ): files_with_reordering.append(file) diff --git a/tools/ido_block_numbers.py b/tools/ido_block_numbers.py index 292a14d387..188cf8f36d 100755 --- a/tools/ido_block_numbers.py +++ b/tools/ido_block_numbers.py @@ -483,7 +483,7 @@ def find_compiler_command_line( found = 0 for line in make_log: parts = line.split() - if "-o" in parts and str(filename) in parts: + if "./tools/preprocess.sh" in parts and "-o" in parts and str(filename) in parts: compiler_command_line = parts found += 1 @@ -551,7 +551,7 @@ def main(): command_line = find_compiler_command_line(make_log, args.filename) if command_line is None: print( - f"Error: could not determine compiler command line for {filename}", + f"Error: could not determine compiler command line for {args.filename}", file=sys.stderr, ) sys.exit(1) diff --git a/tools/patch_data_with_rodata_mdebug.py b/tools/patch_data_with_rodata_mdebug.py new file mode 100755 index 0000000000..48059c51e1 --- /dev/null +++ b/tools/patch_data_with_rodata_mdebug.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python3 + +# SPDX-FileCopyrightText: © 2025 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +import argparse +import struct + +import elftools.elf.elffile + +# Patches mdebug for files linked with data_with_rodata.ld by replacing storage +# class stData with stRData, since .data symbols are now in the .rodata section + +SC_MASK = 0x03E00000 +SC_SHIFT = 21 + + +def read_u32(f, offset): + f.seek(offset) + return struct.unpack(">I", f.read(4))[0] + + +def write_u32(f, offset, value): + f.seek(offset) + f.write(struct.pack(">I", value)) + + +def patch_sc(f, offset): + value = read_u32(f, offset) + sc = (value & SC_MASK) >> SC_SHIFT + if sc == 2: # scData + value = (value & ~SC_MASK) | (15 << SC_SHIFT) # scRData + write_u32(f, offset, value) + + +def main(): + parser = argparse.ArgumentParser() + + parser.add_argument("file", help="input file") + args = parser.parse_args() + + with open(args.file, "r+b") as f: + elf = elftools.elf.elffile.ELFFile(f) + + mdebug_offset = 0 + for section in elf.iter_sections(): + if section.name == ".mdebug": + mdebug_offset = section["sh_offset"] + break + + if mdebug_offset == 0: + return + + isymMax = read_u32(f, mdebug_offset + 0x20) + cbSymOffset = read_u32(f, mdebug_offset + 0x24) + iextMax = read_u32(f, mdebug_offset + 0x58) + cbExtOffset = read_u32(f, mdebug_offset + 0x5C) + + for i in range(isymMax): + patch_sc(f, cbSymOffset + i * 0xC + 0x8) + + for i in range(iextMax): + patch_sc(f, cbExtOffset + i * 0x10 + 0xC) + + +if __name__ == "__main__": + main()