diff --git a/Makefile b/Makefile index 949bdb19f4..12582d24a6 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! @@ -368,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 @@ -387,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 @@ -396,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 @@ -468,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)) @@ -502,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)/*.u64.png) $(wildcard $(dir)/*.u32.png)) TEXTURE_FILES_PNG_COMMITTED := $(foreach dir,$(ASSET_BIN_DIRS_COMMITTED),$(wildcard $(dir)/*.u64.png) $(wildcard $(dir)/*.u32.png)) @@ -538,7 +536,7 @@ 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/lib/seqplayer.o: CPP_DEFINES += -DMML_VERSION=MML_VERSION_OOT +$(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 @@ -622,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) @@ -796,7 +794,7 @@ setup: venv $(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_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) @@ -833,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 \ @@ -858,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) $< $@ @@ -870,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 @@ -879,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 $@ $< @@ -904,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 @@ -925,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 @@ -942,6 +946,8 @@ $(BUILD_DIR)/src/code/z_message_z_game_over.o: $(BUILD_DIR)/src/code/z_message.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 @@ -949,34 +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) $(PYTHON) tools/patch_data_with_rodata_mdebug.py $@ - @$(OBJDUMP) $(OBJDUMP_FLAGS) $@ > $(@:.o=.s) + $(OBJDUMP_CMD) ifeq ($(PLATFORM),IQUE) ifneq ($(NON_MATCHING),1) @@ -1077,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 @@ -1102,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) @@ -1140,9 +1131,7 @@ $(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 $@ 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/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/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 index e74719c440..2a690d2730 100644 --- a/include/buffers.h +++ b/include/buffers.h @@ -2,7 +2,6 @@ #define BUFFERS_H #include "gfx.h" -#include "macros.h" #include "ultra64.h" extern u16 gZBuffer[SCREEN_HEIGHT][SCREEN_WIDTH]; // 0x25800 bytes 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/fault.h b/include/fault.h index 7418246f46..af895927d0 100644 --- a/include/fault.h +++ b/include/fault.h @@ -1,9 +1,10 @@ #ifndef FAULT_H #define FAULT_H -#include "ultra64.h" -#include "attributes.h" +#include "libu64/debug.h" #include "libu64/pad.h" +#include "attributes.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/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 63255443dc..0000000000 --- a/include/functions.h +++ /dev/null @@ -1,107 +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 -#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 SaveContext_Init(void); - -void* MemCpy(void* dest, const void* src, s32 len); - -void MapMark_Init(PlayState* play); -void MapMark_ClearPointers(PlayState* play); -void MapMark_Draw(PlayState* play); -void Sched_FlushTaskQueue(void); - -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 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 Graph_ThreadEntry(void*); - -void SysCfb_Init(s32 n64dd); -void* SysCfb_GetFbPtr(s32 idx); -void* SysCfb_GetFbEnd(void); - -void RcpUtils_PrintRegisterStatus(void); -void RcpUtils_Reset(void); - -void SystemHeap_Init(void* start, u32 size); - -f32 absf(f32); - -void Regs_InitData(PlayState* play); - -#endif diff --git a/include/gfx.h b/include/gfx.h index a4c17281ca..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 @@ -119,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/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/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 25233c51c5..02540e3530 100644 --- a/include/libc64/malloc.h +++ b/include/libc64/malloc.h @@ -32,5 +32,6 @@ void SystemArena_Display(void); #endif extern Arena gSystemArena; +extern s32 gSystemArenaLogSeverity; #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/macros.h b/include/macros.h deleted file mode 100644 index aa81ef061b..0000000000 --- a/include/macros.h +++ /dev/null @@ -1,150 +0,0 @@ -#ifndef MACROS_H -#define MACROS_H - -#include "terminal.h" -#include "versions.h" - -#define SCREEN_WIDTH 320 -#define SCREEN_HEIGHT 240 - -#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 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 - -#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 88c5d9279a..ef82c03554 100644 --- a/include/map.h +++ b/include/map.h @@ -68,6 +68,7 @@ typedef struct MapData { #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); 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/prerender.h b/include/prerender.h index 4231234a8d..0674fac020 100644 --- a/include/prerender.h +++ b/include/prerender.h @@ -26,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 6eccca7701..8ea4e058ec 100644 --- a/include/regs.h +++ b/include/regs.h @@ -4,6 +4,8 @@ #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 @@ -410,6 +412,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/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/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/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/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_matrix.h b/include/sys_matrix.h index 11d494c8c8..2708af81ee 100644 --- a/include/sys_matrix.h +++ b/include/sys_matrix.h @@ -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/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 9972a4dfe8..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); 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/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 612b3051b1..0000000000 --- a/include/variables.h +++ /dev/null @@ -1,168 +0,0 @@ -#ifndef VARIABLES_H -#define VARIABLES_H - -#include "z64.h" -#include "libc64/os_malloc.h" -#include "segment_symbols.h" - -struct MapData; - -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 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 s16 gSpoilingItems[3]; -extern s16 gSpoilingItemReverts[3]; - -// 4 16-colors palettes -extern u64 gMojiFontTLUTs[4][4]; // original name: "moji_tlut" -extern u64 gMojiFontTex[]; // original name: "font_ff" -extern u8 gBossMarkState; - -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 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 struct MapData* gMapData; -extern f32 gBossMarkScale; -extern u32 D_8016139C; -extern PauseMapMarksData* gLoadedPauseMarkDataTable; - -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; - -#endif diff --git a/include/vi_mode.h b/include/vi_mode.h index 89de610a88..5c2f1bace2 100644 --- a/include/vi_mode.h +++ b/include/vi_mode.h @@ -42,4 +42,14 @@ 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 index a0ba2873d7..bb2518e6ec 100644 --- a/include/z64.h +++ b/include/z64.h @@ -1,26 +1,20 @@ #ifndef Z64_H #define Z64_H +// TODO: This file still exists ONLY to provide neccesary headers to extracted assets. +// After assets are modified to include the headers they need directly, delete this file. + +#include "array_count.h" +#include "gfx.h" +#include "sequence.h" +#include "sys_matrix.h" #include "ultra64.h" -#include "ultra64/gs2dex.h" -#include "attributes.h" -#include "versions.h" -#include "z64player.h" -#include "z64audio.h" -#include "z64ocarina.h" -#include "z64curve.h" -#include "z64effect.h" +#include "z64play.h" #include "z64animation.h" #include "z64animation_legacy.h" -#include "z64play.h" +#include "z64curve.h" #include "z64skin.h" -#include "z64skin_matrix.h" -#include "alignment.h" -#include "audiothread_cmd.h" -#include "sfx.h" -#include "color.h" -#include "sys_matrix.h" // in room assets, gIdentityMtx - -// TODO: include all files listed above into the right place, and then delete this file. +#include "z64player.h" +#include "z64ocarina.h" #endif diff --git a/include/z64actor.h b/include/z64actor.h index 2709356b99..1a8b503297 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -160,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) 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 3673811ac9..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 @@ -75,12 +73,12 @@ typedef enum SoundSetting { /* 3 */ SOUND_SETTING_SURROUND } SoundSetting; -typedef enum SoundMode { - /* 0 */ SOUNDMODE_STEREO, - /* 1 */ SOUNDMODE_HEADSET, - /* 2 */ SOUNDMODE_SURROUND, - /* 3 */ SOUNDMODE_MONO -} SoundMode; +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, @@ -936,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; @@ -1204,7 +1202,7 @@ void func_800F64E0(u8 arg0); void Audio_ToggleMalonSinging(u8 malonSingingDisabled); void Audio_SetEnvReverb(s8 reverb); void Audio_SetCodeReverb(s8 reverb); -void Audio_SetSoundMode(s8 soundSetting); +void Audio_SetSoundOutputMode(s8 soundSetting); void Audio_SetBaseFilter(u8); void Audio_SetExtraFilter(u8); void Audio_SetCutsceneFlag(s8 flag); @@ -1221,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/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/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/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/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 3758b690fd..3dfa196d97 100644 --- a/include/z64message.h +++ b/include/z64message.h @@ -203,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/z64pause.h b/include/z64pause.h index 3a698f5328..9116003e86 100644 --- a/include/z64pause.h +++ b/include/z64pause.h @@ -250,4 +250,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 4ca9e0b024..4853ac8f47 100644 --- a/include/z64play.h +++ b/include/z64play.h @@ -4,6 +4,7 @@ #include "ultra64.h" #include "prerender.h" +#include "transition_tile.h" #include "z64actor.h" #include "z64bgcheck.h" #include "z64camera.h" diff --git a/include/z64save.h b/include/z64save.h index 5edfc35d92..71b1414052 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -592,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)) @@ -996,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 eacd62ed8a..09b342c047 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -1,7 +1,7 @@ #ifndef Z64SCENE_H #define Z64SCENE_H -#include "macros.h" +#include "avoid_ub.h" #include "ultra64.h" #include "z64bgcheck.h" #include "z64environment.h" 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 3832eb5f6f..83bdf0fe84 100644 --- a/include/z64view.h +++ b/include/z64view.h @@ -1,7 +1,7 @@ #ifndef Z64VIEW_H #define Z64VIEW_H -#include "macros.h" +#include "avoid_ub.h" #include "ultra64.h" #include "z64math.h" 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 a41254001e..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: - Audio_SetSoundMode(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 99% rename from src/audio/general.c rename to src/audio/game/general.c index ddf13f4cff..f04f203a1f 100644 --- a/src/audio/general.c +++ b/src/audio/game/general.c @@ -1,13 +1,17 @@ #include "libu64/gfxprint.h" -#include "ultra64.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 "versions.h" - -#include "global.h" +#include "z64audio.h" +#include "z64ocarina.h" #define ABS_ALT(x) ((x) < 0 ? -(x) : (x)) @@ -141,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; @@ -2631,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; @@ -2643,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) { @@ -2675,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; @@ -2882,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) { @@ -3773,32 +3777,40 @@ void Audio_SetCodeReverb(s8 reverb) { } } -void Audio_SetSoundMode(s8 soundSetting) { - 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 (soundSetting) { case SOUND_SETTING_STEREO: - soundModeIndex = SOUNDMODE_STEREO; - sSoundMode = SOUNDMODE_STEREO; + soundOutputMode = SOUND_OUTPUT_STEREO; + sSoundOutputMode = SOUND_OUTPUT_STEREO; break; case SOUND_SETTING_MONO: - soundModeIndex = SOUNDMODE_MONO; - sSoundMode = SOUNDMODE_MONO; + soundOutputMode = SOUND_OUTPUT_MONO; + sSoundOutputMode = SOUND_OUTPUT_MONO; break; case SOUND_SETTING_HEADSET: - soundModeIndex = SOUNDMODE_HEADSET; - sSoundMode = SOUNDMODE_HEADSET; + soundOutputMode = SOUND_OUTPUT_HEADSET; + sSoundOutputMode = SOUND_OUTPUT_HEADSET; break; case SOUND_SETTING_SURROUND: - soundModeIndex = SOUNDMODE_STEREO; - sSoundMode = SOUNDMODE_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) { @@ -4046,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 a6d5003cc4..a311e4e73d 100644 --- a/src/audio/sequence.c +++ b/src/audio/game/sequence.c @@ -17,10 +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 "ultra64.h" -#include "global.h" -#include "ultra64/abi.h" +#include "array_count.h" +#include "audiothread_cmd.h" #include "seqcmd.h" +#include "sfx.h" +#include "ultra64.h" +#include "ultra64/abi.h" +#include "z64audio.h" // Direct audio command (skips the queueing system) #define SEQCMD_SET_SEQPLAYER_VOLUME_NOW(seqPlayerIndex, duration, volume) \ @@ -370,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 97% rename from src/audio/session_init.c rename to src/audio/game/session_init.c index d04a955bca..3c3d9c4aeb 100644 --- a/src/audio/session_init.c +++ b/src/audio/game/session_init.c @@ -1,8 +1,7 @@ +#include "array_count.h" #include "buffers.h" #include "z64audio.h" -#include "global.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 e6d2324886..7e3d01d3a7 100644 --- a/src/audio/lib/effects.c +++ b/src/audio/internal/effects.c @@ -1,7 +1,6 @@ #include "ultra64.h" #include "attributes.h" - -#include "global.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 d4c1ea8644..f723e5b836 100644 --- a/src/audio/lib/load.c +++ b/src/audio/internal/load.c @@ -1,9 +1,14 @@ -#include "ultra64.h" +/** + * Original Filename: system.c + */ + +#include "array_count.h" #include "attributes.h" #include "buffers.h" +#include "segment_symbols.h" +#include "ultra64.h" #include "versions.h" - -#include "global.h" +#include "z64audio.h" #define MK_ASYNC_MSG(retData, tableType, id, loadStatus) \ (((retData) << 24) | ((tableType) << 16) | ((id) << 8) | (loadStatus)) @@ -76,6 +81,9 @@ void* sUnusedHandler = NULL; s32 gAudioContextInitialized = false; +/** + * original name: Nas_WaveDmaFrameWork + */ void AudioLoad_DecreaseSampleDmaTtls(void) { u32 i; @@ -108,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; @@ -202,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; @@ -271,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; @@ -283,6 +300,9 @@ s32 AudioLoad_IsFontLoadComplete(s32 fontId) { } } +/** + * original name: Nas_CheckIDseq + */ s32 AudioLoad_IsSeqLoadComplete(s32 seqId) { if (seqId == 0xFF) { return true; @@ -295,6 +315,9 @@ s32 AudioLoad_IsSeqLoadComplete(s32 seqId) { } } +/** + * original name: Nas_CheckIDwave + */ s32 AudioLoad_IsSampleLoadComplete(s32 sampleBankId) { if (sampleBankId == 0xFF) { return true; @@ -308,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) { @@ -333,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; @@ -352,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; @@ -378,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; @@ -392,6 +436,9 @@ void AudioLoad_SyncLoadSeqParts(s32 seqId, s32 arg1) { } } +/** + * original name: __Nas_LoadVoice_Inner + */ s32 AudioLoad_SyncLoadSample(Sample* sample, s32 fontId) { void* sampleAddr; @@ -416,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); @@ -442,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]; @@ -470,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]; @@ -485,6 +553,9 @@ void AudioLoad_DiscardSeqFonts(s32 seqId) { } } +/** + * original name: __Kill_Bank + */ void AudioLoad_DiscardFont(s32 fontId) { u32 i; AudioCache* pool = &gAudioCtx.fontCache; @@ -506,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; @@ -519,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; @@ -529,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; @@ -571,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; @@ -582,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; @@ -618,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; @@ -657,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; @@ -741,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); @@ -751,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; @@ -767,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; @@ -792,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 @@ -922,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; @@ -946,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; @@ -986,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; @@ -1101,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]; @@ -1126,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; @@ -1192,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; @@ -1228,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; @@ -1261,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; @@ -1316,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; @@ -1347,6 +1496,9 @@ Sample* AudioLoad_GetFontSample(s32 fontId, s32 instId) { void AudioLoad_Unused2(void) { } +/** + * original name: __SwapLoadLps + */ void AudioLoad_FinishSlowLoad(AudioSlowLoad* slowLoad) { Sample* sample; @@ -1364,6 +1516,9 @@ void AudioLoad_FinishSlowLoad(AudioSlowLoad* slowLoad) { sample->medium = MEDIUM_RAM; } +/** + * original name: LpsDma + */ void AudioLoad_ProcessSlowLoads(s32 resetStatus) { AudioSlowLoad* slowLoad; s32 i; @@ -1413,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); @@ -1420,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; @@ -1460,6 +1624,9 @@ s32 AudioLoad_SlowLoadSeq(s32 seqId, u8* ramAddr, s8* status) { return 0; } +/** + * original name: Nas_BgCopyInit + */ void AudioLoad_InitAsyncLoads(void) { s32 i; @@ -1468,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; @@ -1483,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; @@ -1525,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; @@ -1559,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; @@ -1602,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; @@ -1650,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); @@ -1658,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) { } @@ -1667,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 @@ -1723,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 @@ -1830,6 +2025,9 @@ void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* fontData } } +/** + * original name: Nas_CheckBgWave + */ s32 AudioLoad_ProcessSamplePreloads(s32 resetStatus) { Sample* sample; AudioPreloadReq* preload; @@ -1892,6 +2090,9 @@ s32 AudioLoad_ProcessSamplePreloads(s32 resetStatus) { return true; } +/** + * original name: __AddList + */ s32 AudioLoad_AddToSampleSet(Sample* sample, s32 numSamples, Sample** sampleSet) { s32 i; @@ -1909,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; @@ -1942,6 +2146,9 @@ s32 AudioLoad_GetSamplesForFont(s32 fontId, Sample** sampleSet) { return numSamples; } +/** + * original name: __Reload + */ void AudioLoad_AddUsedSample(TunedSample* tunedSample) { Sample* sample = tunedSample->sample; @@ -1950,6 +2157,9 @@ void AudioLoad_AddUsedSample(TunedSample* tunedSample) { } } +/** + * original name: WaveReload + */ void AudioLoad_PreloadSamplesForFont(s32 fontId, s32 async, SampleBankRelocInfo* sampleBankReloc) { s32 numDrums; s32 numInstruments; @@ -2085,6 +2295,9 @@ void AudioLoad_PreloadSamplesForFont(s32 fontId, s32 async, SampleBankRelocInfo* } } +/** + * original name: EmemReload + */ void AudioLoad_LoadPermanentSamples(void) { s32 pad; u32 fontId; @@ -2117,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; @@ -2137,6 +2362,9 @@ void AudioLoad_ScriptLoad(s32 tableType, s32 id, s8* status) { } } +/** + * original name: MK_FrameWork + */ void AudioLoad_ProcessScriptLoads(void) { u32 temp; u32 sp20; @@ -2151,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 98% rename from src/audio/lib/seqplayer.c rename to src/audio/internal/seqplayer.c index 1a1d40c4d2..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,12 +14,12 @@ * - All three sets share a common pool of control flow instructions (>= 0xF2). * Otherwise, each set of instructions has its own command interpreter */ -#include "ultra64.h" +#include "audio/aseq.h" +#include "array_count.h" #include "assert.h" #include "attributes.h" -#include "audio/aseq.h" - -#include "global.h" +#include "ultra64.h" +#include "z64audio.h" static_assert(MML_VERSION == MML_VERSION_OOT, "This file implements the OoT version of the MML"); @@ -163,6 +164,8 @@ u8 sSeqInstructionArgsTable[] = { * Read and return the argument from the sequence script for a control flow instruction. * 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]; @@ -184,6 +187,8 @@ 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) { @@ -255,6 +260,9 @@ s32 AudioSeq_HandleScriptFlowControl(SequencePlayer* seqPlayer, SeqScriptState* return 0; } +/** + * original name: Nas_InitSubTrack + */ void AudioSeq_InitSequenceChannel(SequenceChannel* channel) { s32 i; @@ -310,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; @@ -357,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) { @@ -369,6 +383,9 @@ void AudioSeq_SeqLayerDisable(SequenceLayer* layer) { } } +/** + * original name: Nas_CloseNoteTrack + */ void AudioSeq_SeqLayerFree(SequenceChannel* channel, s32 layerIndex) { SequenceLayer* layer = channel->layers[layerIndex]; @@ -379,6 +396,9 @@ void AudioSeq_SeqLayerFree(SequenceChannel* channel, s32 layerIndex) { } } +/** + * original name: Nas_ReleaseSubTrack + */ void AudioSeq_SequenceChannelDisable(SequenceChannel* channel) { s32 i; @@ -391,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; @@ -406,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; @@ -418,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; @@ -435,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; @@ -478,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; @@ -489,6 +527,9 @@ void AudioSeq_AudioListPushBack(AudioListItem* list, AudioListItem* item) { } } +/** + * original name: Nas_GetList + */ void* AudioSeq_AudioListPopBack(AudioListItem* list) { AudioListItem* item = list->prev; @@ -504,6 +545,9 @@ void* AudioSeq_AudioListPopBack(AudioListItem* list) { return item->u.value; } +/** + * original name: Nas_InitNoteList + */ void AudioSeq_InitLayerFreelist(void) { s32 i; @@ -519,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; @@ -530,6 +580,9 @@ s16 AudioSeq_ScriptReadS16(SeqScriptState* state) { return ret; } +/** + * original name: Nas_ReadLengthData + */ u16 AudioSeq_ScriptReadCompressedU16(SeqScriptState* state) { u16 ret = *(state->pc++); @@ -540,6 +593,9 @@ u16 AudioSeq_ScriptReadCompressedU16(SeqScriptState* state) { return ret; } +/** + * original name: Nas_NoteSeq + */ void AudioSeq_SeqLayerProcessScript(SequenceLayer* layer) { s32 cmd; @@ -581,6 +637,9 @@ void AudioSeq_SeqLayerProcessScript(SequenceLayer* layer) { } } +/** + * original name: __Stop_Note + */ void AudioSeq_SeqLayerProcessScriptStep1(SequenceLayer* layer) { if (!layer->continuousNotes) { Audio_SeqLayerNoteDecay(layer); @@ -595,6 +654,9 @@ void AudioSeq_SeqLayerProcessScriptStep1(SequenceLayer* layer) { layer->notePropertiesNeedInit = true; } +/** + * original name: __SetChannel + */ s32 AudioSeq_SeqLayerProcessScriptStep5(SequenceLayer* layer, s32 sameTunedSample) { Note* note; @@ -633,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; @@ -789,6 +854,9 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) { } } +/** + * original name: __SetVoice + */ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) { s32 sameTunedSample = true; s32 instOrWave; @@ -997,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; @@ -1110,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; @@ -1121,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); @@ -1140,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 @@ -1165,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; @@ -1728,6 +1814,9 @@ exit_loop: } } +/** + * original name: Nas_GroupSeq + */ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { u8 cmd; u8 cmdLowBits; @@ -2055,6 +2144,9 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { } } +/** + * original name: Nas_MySeqMain + */ void AudioSeq_ProcessSequences(s32 arg0) { SequencePlayer* seqPlayer; u32 i; @@ -2072,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); @@ -2080,6 +2175,9 @@ void AudioSeq_SkipForwardSequence(SequencePlayer* seqPlayer) { } } +/** + * original name: Nas_InitMySeq + */ void AudioSeq_ResetSequencePlayer(SequencePlayer* seqPlayer) { s32 i; @@ -2107,6 +2205,9 @@ void AudioSeq_ResetSequencePlayer(SequencePlayer* seqPlayer) { } } +/** + * original name: Nas_AssignSubTrack + */ void AudioSeq_InitSequencePlayerChannels(s32 playerIdx) { SequenceChannel* channel; SequencePlayer* seqPlayer = &gAudioCtx.seqPlayers[playerIdx]; @@ -2129,6 +2230,9 @@ void AudioSeq_InitSequencePlayerChannels(s32 playerIdx) { } } +/** + * original name: __InitGroup + */ void AudioSeq_InitSequencePlayer(SequencePlayer* seqPlayer) { s32 i; s32 j; @@ -2154,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/boot_main.c b/src/boot/boot_main.c index 75c1b9cf89..2f948b9d6a 100644 --- a/src/boot/boot_main.c +++ b/src/boot/boot_main.c @@ -1,4 +1,9 @@ #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 @@ -7,8 +12,6 @@ #include "z_locale.h" #include "z64thread.h" -#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:128" StackEntry sBootThreadInfo; 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 29b04f2a8a..fadae3a181 100644 --- a/src/boot/cic6105.c +++ b/src/boot/cic6105.c @@ -1,10 +1,11 @@ -#pragma increment_block_number "ntsc-1.2:0" -#include "global.h" +#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 "audiomgr.h" +#include "build.h" #include "cic6105.h" +#include "fault.h" #include "regs.h" #include "sched.h" -#include "fault.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 be4c9f7cbf..743219d94c 100644 --- a/src/boot/idle.c +++ b/src/boot/idle.c @@ -1,16 +1,21 @@ +#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" -#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" \ - "ntsc-1.0:138 ntsc-1.1:138 ntsc-1.2:138 pal-1.0:136 pal-1.1:136" +#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 912b759843..6d63118853 100644 --- a/src/boot/is_debug.c +++ b/src/boot/is_debug.c @@ -1,5 +1,6 @@ -#include "global.h" -#include "attributes.h" +#include "is_debug.h" + +#include "ultra64.h" typedef struct ISVDbg { /* 0x00 */ u32 magic; // "IS64" 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 2d6a4ec7c5..eb3ce23317 100644 --- a/src/boot/yaz0.c +++ b/src/boot/yaz0.c @@ -1,4 +1,8 @@ -#include "global.h" +#include "yaz0.h" + +#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" diff --git a/src/boot/z_locale.c b/src/boot/z_locale.c index f54be014ba..a517f561ce 100644 --- a/src/boot/z_locale.c +++ b/src/boot/z_locale.c @@ -1,15 +1,16 @@ #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 "vi_mode.h" #include "z_locale.h" -#include "macros.h" -#include "global.h" - s32 gCurrentRegion = 0; typedef struct LocaleCartInfo { diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index 7cbf009946..de2a19e57c 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -21,22 +21,32 @@ #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 "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" -#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" \ - "ntsc-1.2:12 pal-1.0:10 pal-1.1:10" +#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/zbuffer.c b/src/buffers/zbuffer.c index 0eda889219..69c445b633 100644 --- a/src/buffers/zbuffer.c +++ b/src/buffers/zbuffer.c @@ -1,6 +1,5 @@ #include "alignment.h" #include "buffers.h" -#include "macros.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 9dcb28f3a4..ddf6b473ea 100644 --- a/src/code/PreRender.c +++ b/src/code/PreRender.c @@ -10,11 +10,9 @@ #include "color.h" #include "gfx.h" #include "prerender.h" +#include "printf.h" #include "regs.h" -#include "macros.h" -#include "global.h" - void PreRender_SetValuesSave(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf, void* cvg) { this->widthSave = width; this->heightSave = height; 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/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 8837601f8f..57f530a4b8 100644 --- a/src/code/audio_thread_manager.c +++ b/src/code/audio_thread_manager.c @@ -5,13 +5,14 @@ * and sending the audio rsp tasks generated by the driver to the task scheduler. */ +#include "array_count.h" #include "audiomgr.h" +#include "printf.h" #include "regs.h" #include "speed_meter.h" +#include "translation.h" #include "z64dma.h" -#include "macros.h" - void AudioMgr_NotifyTaskDone(AudioMgr* audioMgr) { AudioTask* task = audioMgr->rspTask; diff --git a/src/code/db_camera.c b/src/code/db_camera.c index f316505872..a275cae523 100644 --- a/src/code/db_camera.c +++ b/src/code/db_camera.c @@ -1,10 +1,12 @@ #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" diff --git a/src/code/debug_malloc.c b/src/code/debug_malloc.c index acfca47ca5..ad7c786f34 100644 --- a/src/code/debug_malloc.c +++ b/src/code/debug_malloc.c @@ -1,7 +1,7 @@ #include "libc64/os_malloc.h" #include "debug_arena.h" - -#include "macros.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 29d04071c6..b2bb9d13d4 100644 --- a/src/code/fault_gc.c +++ b/src/code/fault_gc.c @@ -40,22 +40,24 @@ * 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:128 gc-eu-mq:128 gc-eu-mq-dbg:96 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128" \ - "gc-us-mq:128 ique-cn:128" -#include "global.h" +#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 "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" -#include "macros.h" - void Fault_Init(void); void Fault_SetOsSyncPrintfEnabled(u32 enabled); void Fault_DrawRecImpl(s32 xStart, s32 yStart, s32 xEnd, s32 yEnd, u16 color); 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 ecfc87f10f..75fc704b91 100644 --- a/src/code/fault_n64.c +++ b/src/code/fault_n64.c @@ -1,19 +1,19 @@ #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" -#include "macros.h" -#include "global.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" +#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 5f4316d7f0..88f32a3e4e 100644 --- a/src/code/flg_set.c +++ b/src/code/flg_set.c @@ -1,3 +1,5 @@ +#include "flag_set.h" + #include "libu64/gfxprint.h" #include "libu64/pad.h" #include "gfx.h" diff --git a/src/code/game.c b/src/code/game.c index 6db35e5630..5b80355cbb 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -1,6 +1,8 @@ #include "libc64/malloc.h" +#include "libc64/os_malloc.h" #include "libu64/debug.h" #include "libu64/gfxprint.h" +#include "array_count.h" #include "audiomgr.h" #include "buffers.h" #include "controller.h" @@ -8,28 +10,28 @@ #include "gfx.h" #include "gfxalloc.h" #include "fault.h" -#include "libc64/os_malloc.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" -#include "macros.h" -#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" SpeedMeter D_801664D0; @@ -470,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 47591fd00b..506ef7721e 100644 --- a/src/code/gamealloc.c +++ b/src/code/gamealloc.c @@ -1,8 +1,7 @@ #include "libc64/malloc.h" #include "libu64/debug.h" #include "gamealloc.h" - -#include "macros.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 4fc7a56ac9..86543cc50d 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -1,7 +1,7 @@ #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" @@ -12,28 +12,29 @@ #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 "vi_mode.h" #include "z_game_dlftbls.h" #include "z64audio.h" #include "z64save.h" #include "z64play.h" -#include "macros.h" -#include "global.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 ique-cn:128" \ - "ntsc-1.0:96 ntsc-1.1:96 ntsc-1.2:96 pal-1.0:96 pal-1.1:96" + "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 d741612e28..ced883f7a0 100644 --- a/src/code/irqmgr.c +++ b/src/code/irqmgr.c @@ -33,14 +33,15 @@ * @see sched.c */ #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" -#include "macros.h" - vu32 gIrqMgrResetStatus = IRQ_RESET_STATUS_IDLE; volatile OSTime sIrqMgrResetTime = 0; volatile OSTime gIrqMgrRetraceTime = 0; diff --git a/src/code/main.c b/src/code/main.c index 8a52882d07..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]; @@ -13,16 +17,24 @@ extern struct PadMgr gPadMgr; extern struct IrqMgr gIrqMgr; #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" @@ -31,10 +43,8 @@ extern struct IrqMgr gIrqMgr; #include "z64debug.h" #include "z64thread.h" -#include "global.h" - -#pragma increment_block_number "gc-eu:32 gc-eu-mq:32 gc-jp:32 gc-jp-ce:32 gc-jp-mq:32 gc-us:32 gc-us-mq:32 ique-cn:32" \ - "ntsc-1.0:13 ntsc-1.1:13 ntsc-1.2:13 pal-1.0:11 pal-1.1:11" +#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[]; @@ -108,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 f316f0ea31..850c478b93 100644 --- a/src/code/mempak.c +++ b/src/code/mempak.c @@ -9,8 +9,7 @@ */ #include "mempak.h" #include "padmgr.h" - -#include "macros.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 9e6d1ae14a..01a952c876 100644 --- a/src/code/padmgr.c +++ b/src/code/padmgr.c @@ -30,10 +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 4fb5a33760..c573bf97f6 100644 --- a/src/code/sched.c +++ b/src/code/sched.c @@ -40,18 +40,20 @@ * @see irqmgr.c */ #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" -#include "macros.h" -#include "global.h" - #define RSP_DONE_MSG 667 #define RDP_DONE_MSG 668 #define NOTIFY_MSG 670 // original name: ENTRY_MSG diff --git a/src/code/shrink_window.c b/src/code/shrink_window.c index e952a0c3fd..3c92ede0e1 100644 --- a/src/code/shrink_window.c +++ b/src/code/shrink_window.c @@ -1,8 +1,7 @@ #include "letterbox.h" +#include "printf.h" #include "regs.h" -#include "macros.h" - typedef enum LetterboxState { /* 0 */ LETTERBOX_STATE_IDLE, /* 1 */ LETTERBOX_STATE_GROWING, diff --git a/src/code/speed_meter.c b/src/code/speed_meter.c index dabfac7aaa..bb3624fa86 100644 --- a/src/code/speed_meter.c +++ b/src/code/speed_meter.c @@ -1,8 +1,10 @@ -#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.0:128 pal-1.1: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: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" 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_freeze.c b/src/code/sys_freeze.c index ea50a89491..2957155559 100644 --- a/src/code/sys_freeze.c +++ b/src/code/sys_freeze.c @@ -1,10 +1,9 @@ #include "libc64/sleep.h" #include "attributes.h" +#include "printf.h" #include "sys_freeze.h" #include "terminal.h" -#include "macros.h" - NORETURN void func_800D31A0(void) { PRINTF(VT_FGCOL(RED) "\n**** Freeze!! ****\n" VT_RST); for (;;) { diff --git a/src/code/sys_math3d.c b/src/code/sys_math3d.c index 4a1ddaf0bb..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:120 gc-eu-mq:120 gc-jp:120 gc-jp-ce:120 gc-jp-mq:120 gc-us:120 gc-us-mq:120" \ - "ique-cn:120 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: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_math_atan.c b/src/code/sys_math_atan.c index 8dabed7d72..0c99eaced4 100644 --- a/src/code/sys_math_atan.c +++ b/src/code/sys_math_atan.c @@ -1,6 +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 081a292765..2ca4882601 100644 --- a/src/code/sys_matrix.c +++ b/src/code/sys_matrix.c @@ -3,7 +3,7 @@ #if DEBUG_FEATURES #include "fault.h" #endif -#include "macros.h" +#include "printf.h" #include "sys_matrix.h" #include "ultra64.h" #include "z_lib.h" diff --git a/src/code/title_setup.c b/src/code/title_setup.c index ba259e72a1..0272022474 100644 --- a/src/code/title_setup.c +++ b/src/code/title_setup.c @@ -1,7 +1,8 @@ #include "console_logo_state.h" #include "setup_state.h" - -#include "global.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 0684dcd5dc..8d1ff6cd77 100644 --- a/src/code/ucode_disas.c +++ b/src/code/ucode_disas.c @@ -1,10 +1,11 @@ +#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" -#include "ultra64/gs2dex.h" -#include "libu64/mtxuty-cvt.h" -#include "segmented_address.h" - -#include "macros.h" #if DEBUG_FEATURES @@ -59,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 501fed21a6..ad2cdff118 100644 --- a/src/code/z_DLF.c +++ b/src/code/z_DLF.c @@ -1,11 +1,11 @@ #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" -#include "macros.h" - void Overlay_LoadGameState(GameStateOverlay* overlayEntry) { if (overlayEntry->loadedRamAddr != NULL) { PRINTF(T("既にリンクされています\n", "Already linked\n")); diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 9e2036f0d0..83105d23ec 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -1,8 +1,10 @@ #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" @@ -12,11 +14,13 @@ #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" @@ -24,8 +28,6 @@ #include "z64save.h" #include "z64skin_matrix.h" -#include "global.h" - #include "overlays/actors/ovl_Arms_Hook/z_arms_hook.h" #include "overlays/actors/ovl_En_Part/z_en_part.h" @@ -592,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); @@ -928,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) { @@ -3464,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 accce471cb..1e3c6c96ba 100644 --- a/src/code/z_actor_dlftbls.c +++ b/src/code/z_actor_dlftbls.c @@ -1,9 +1,8 @@ #include "fault.h" +#include "printf.h" #include "segment_symbols.h" #include "z_actor_dlftbls.h" -#include "macros.h" - // Linker symbol declarations (used in the table below) #define DEFINE_ACTOR(name, _1, _2, _3) DECLARE_OVERLAY_SEGMENT(name) #define DEFINE_ACTOR_INTERNAL(_0, _1, _2, _3) 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_bgcheck.c b/src/code/z_bgcheck.c index 71733baef5..945051552a 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -1,17 +1,20 @@ #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:208 ntsc-1.1:208 ntsc-1.2:208" +#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 79516f0171..cf18c3634a 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -1,17 +1,20 @@ #include "libc64/math64.h" #include "libc64/qrand.h" -#include "ultra64.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" @@ -23,8 +26,8 @@ #include "z64save.h" #include "overlays/actors/ovl_En_Horse/z_en_horse.h" -#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: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: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" s16 Camera_RequestSettingImpl(Camera* camera, s16 requestedSetting, s16 flags); s32 Camera_RequestModeImpl(Camera* camera, s16 requestedMode, u8 forceModeChange); @@ -3658,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:95 ntsc-1.1:95 ntsc-1.2:95 pal-1.0:93 pal-1.1:93" + "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; diff --git a/src/code/z_camera_data.inc.c b/src/code/z_camera_data.inc.c index 07a527afe8..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; 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 e05bb44d17..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,7 +16,8 @@ #include "overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.h" #include "z_lib.h" -#pragma increment_block_number "ique-cn:0 ntsc-1.0:248 ntsc-1.1:248 ntsc-1.2:248 pal-1.0:248 pal-1.1:248" +#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*); diff --git a/src/code/z_construct.c b/src/code/z_construct.c index 4696cb76e4..aa92850b37 100644 --- a/src/code/z_construct.c +++ b/src/code/z_construct.c @@ -1,6 +1,8 @@ #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" diff --git a/src/code/z_cutscene_spline.c b/src/code/z_cutscene_spline.c index d95b2ca7fd..137f9f544c 100644 --- a/src/code/z_cutscene_spline.c +++ b/src/code/z_cutscene_spline.c @@ -2,7 +2,6 @@ #include "z64math.h" #include "z64camera.h" #include "z64cutscene_spline.h" -#include "macros.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 ed02754fc1..d5804cd7ee 100644 --- a/src/code/z_debug.c +++ b/src/code/z_debug.c @@ -1,6 +1,7 @@ #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" @@ -10,8 +11,6 @@ #include "ultra64.h" #include "z64debug.h" -#include "macros.h" - typedef struct DebugCamTextBufferEntry { /* 0x0 */ u8 x; /* 0x1 */ u8 y; @@ -24,8 +23,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:160 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 921613bd80..d5135b99d1 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -1,14 +1,17 @@ -#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" -#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" \ + "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" @@ -16,11 +19,13 @@ #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" @@ -144,8 +149,8 @@ u16 gCamAtSplinePointsAppliedFrame; u16 gCamEyePointAppliedFrame; u16 gCamAtPointAppliedFrame; -#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:128 ntsc-1.1:128 ntsc-1.2:0 pal-1.0:128 pal-1.1:128" +#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 d44007bb76..614cfa5b5b 100644 --- a/src/code/z_eff_blure.c +++ b/src/code/z_eff_blure.c @@ -1,15 +1,15 @@ #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 "macros.h" -#include "global.h" - +#include "z64.h" // required for gameplay keep, the header doesnt include any external dependencies #include "assets/objects/gameplay_keep/gameplay_keep.h" void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2) { diff --git a/src/code/z_eff_shield_particle.c b/src/code/z_eff_shield_particle.c index e4e331964e..865bd8ec93 100644 --- a/src/code/z_eff_shield_particle.c +++ b/src/code/z_eff_shield_particle.c @@ -1,15 +1,15 @@ #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 "macros.h" -#include "global.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 f14c8160fe..57ce3d9ba1 100644 --- a/src/code/z_eff_spark.c +++ b/src/code/z_eff_spark.c @@ -1,14 +1,14 @@ #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 "macros.h" -#include "global.h" - #include "assets/objects/gameplay_keep/gameplay_keep.h" // original name: "spark" diff --git a/src/code/z_effect.c b/src/code/z_effect.c index 02ba00a8dd..c0a39cc4bd 100644 --- a/src/code/z_effect.c +++ b/src/code/z_effect.c @@ -1,4 +1,6 @@ #include "gfx.h" +#include "printf.h" +#include "translation.h" #include "z64effect.h" #include "z64frame_advance.h" #include "z64play.h" diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c index 2acddc4bf0..061b6d70da 100644 --- a/src/code/z_effect_soft_sprite.c +++ b/src/code/z_effect_soft_sprite.c @@ -1,6 +1,9 @@ #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" 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 c04e76128e..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,5 @@ #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "rand.h" @@ -70,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_en_item00.c b/src/code/z_en_item00.c index aa757f8643..f0c627b250 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -22,7 +22,7 @@ #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.0: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 9ad7e7a024..164ff1dde4 100644 --- a/src/code/z_env_flags.c +++ b/src/code/z_env_flags.c @@ -1,3 +1,4 @@ +#include "array_count.h" #include "ultra64.h" #include "z64cutscene_flags.h" #include "z64play.h" diff --git a/src/code/z_fbdemo.c b/src/code/z_fbdemo.c index 246e27b1a3..2621f1c129 100644 --- a/src/code/z_fbdemo.c +++ b/src/code/z_fbdemo.c @@ -9,15 +9,16 @@ * @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 "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" -#include "macros.h" - // color framebuffer extern u16 D_0F000000[]; diff --git a/src/code/z_fbdemo_circle.c b/src/code/z_fbdemo_circle.c index f8c5dc0eda..a5ec044e9d 100644 --- a/src/code/z_fbdemo_circle.c +++ b/src/code/z_fbdemo_circle.c @@ -1,6 +1,8 @@ -#include "gfx.h" +#include "transition_circle.h" -#include "global.h" +#include "color.h" +#include "gfx.h" +#include "sfx.h" typedef enum TransitionCircleDirection { /* 0 */ TRANS_CIRCLE_DIR_IN, diff --git a/src/code/z_fbdemo_fade.c b/src/code/z_fbdemo_fade.c index 3375628cb0..1be97d5f51 100644 --- a/src/code/z_fbdemo_fade.c +++ b/src/code/z_fbdemo_fade.c @@ -1,13 +1,14 @@ -#include "ultra64.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" -#include "macros.h" - typedef enum TransitionFadeDirection { /* 0 */ TRANS_FADE_DIR_IN, /* 1 */ TRANS_FADE_DIR_OUT diff --git a/src/code/z_fbdemo_triforce.c b/src/code/z_fbdemo_triforce.c index 022b565fee..80dc643430 100644 --- a/src/code/z_fbdemo_triforce.c +++ b/src/code/z_fbdemo_triforce.c @@ -1,4 +1,6 @@ -#include "global.h" +#include "transition_triforce.h" + +#include "printf.h" #include "assets/code/fbdemo_triforce/code.c" diff --git a/src/code/z_fbdemo_wipe1.c b/src/code/z_fbdemo_wipe1.c index 82fda9d09b..25b45e7e2c 100644 --- a/src/code/z_fbdemo_wipe1.c +++ b/src/code/z_fbdemo_wipe1.c @@ -1,3 +1,5 @@ +#include "transition_wipe.h" + #include "gfx.h" #include "z64save.h" #include "z64transition_instances.h" 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 3797449312..e5d1f1fbb3 100644 --- a/src/code/z_fcurve_data_skelanime.c +++ b/src/code/z_fcurve_data_skelanime.c @@ -26,9 +26,11 @@ */ #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" diff --git a/src/code/z_frame_advance.c b/src/code/z_frame_advance.c index 5c8f685f22..6ca410a759 100644 --- a/src/code/z_frame_advance.c +++ b/src/code/z_frame_advance.c @@ -4,7 +4,6 @@ #include "controller.h" #include "libu64/pad.h" -#include "macros.h" void FrameAdvance_Init(FrameAdvanceContext* frameAdvCtx) { frameAdvCtx->timer = 0; diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index 20814a4c74..f73616116d 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -1,3 +1,4 @@ +#include "array_count.h" #include "letterbox.h" #include "regs.h" #include "rumble.h" @@ -7,9 +8,6 @@ #include "z64play.h" #include "z64save.h" -#include "macros.h" -#include "global.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 800f72c738..d61af32e7e 100644 --- a/src/code/z_horse.c +++ b/src/code/z_horse.c @@ -1,6 +1,9 @@ +#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" diff --git a/src/code/z_inventory.c b/src/code/z_inventory.c index bb4bb5f850..c31d4d926f 100644 --- a/src/code/z_inventory.c +++ b/src/code/z_inventory.c @@ -1,4 +1,6 @@ #include "ultra64.h" +#include "printf.h" +#include "translation.h" #include "z64play.h" #include "z64player.h" #include "z64save.h" diff --git a/src/code/z_jpeg.c b/src/code/z_jpeg.c index 81e2999462..4413e8ae69 100644 --- a/src/code/z_jpeg.c +++ b/src/code/z_jpeg.c @@ -1,11 +1,13 @@ -#include "global.h" -#include "ultra64.h" -#include "attributes.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 "macros.h" +#include "translation.h" +#include "ultra64.h" #define MARKER_ESCAPE 0x00 #define MARKER_SOI 0xD8 @@ -46,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 9fa8f5ebc3..d9bca732e5 100644 --- a/src/code/z_kaleido_manager.c +++ b/src/code/z_kaleido_manager.c @@ -1,12 +1,13 @@ #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" -#include "macros.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 cacd46abe3..2707db8265 100644 --- a/src/code/z_kaleido_scope_call.c +++ b/src/code/z_kaleido_scope_call.c @@ -1,15 +1,15 @@ -#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:144 ntsc-1.1:144 ntsc-1.2:144 pal-1.0:144 pal-1.1:144" +#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 "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" -#include "global.h" - void (*sKaleidoScopeUpdateFunc)(PlayState* play); void (*sKaleidoScopeDrawFunc)(PlayState* play); f32 gBossMarkScale; diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index cc1621947d..3b88de28c3 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -3,6 +3,7 @@ #if PLATFORM_N64 #include "n64dd.h" #endif +#include "printf.h" #include "regs.h" #include "z64audio.h" #include "z64play.h" diff --git a/src/code/z_kanfont.c b/src/code/z_kanfont.c index 21ba416b35..89f5bbd3b7 100644 --- a/src/code/z_kanfont.c +++ b/src/code/z_kanfont.c @@ -1,13 +1,13 @@ #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" -#include "macros.h" - /** * Loads a texture from kanji for the requested `character` into the character texture buffer * at `codePointIndex`. The value of `character` is the SHIFT-JIS encoding of the character. diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 9439e3f14e..8bcd78175d 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -3,11 +3,13 @@ #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" @@ -19,6 +21,7 @@ #include "sys_math3d.h" #include "sys_matrix.h" #include "terminal.h" +#include "translation.h" #include "versions.h" #include "z_lib.h" #include "z64audio.h" @@ -903,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_lights.c b/src/code/z_lights.c index e9f5338503..d0b003f77c 100644 --- a/src/code/z_lights.c +++ b/src/code/z_lights.c @@ -1,3 +1,4 @@ +#include "avoid_ub.h" #include "buffers.h" #include "gfx.h" #include "gfx_setupdl.h" 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_exp.c b/src/code/z_map_exp.c index 78371084b5..e46c70bd10 100644 --- a/src/code/z_map_exp.c +++ b/src/code/z_map_exp.c @@ -5,16 +5,18 @@ #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 "global.h" - #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/textures/parameter_static/parameter_static.h" diff --git a/src/code/z_map_mark.c b/src/code/z_map_mark.c index 600aa2189c..402d942d66 100644 --- a/src/code/z_map_mark.c +++ b/src/code/z_map_mark.c @@ -1,19 +1,20 @@ #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 "assets/textures/parameter_static/parameter_static.h" -#if PLATFORM_N64 -#include "n64dd.h" -#endif +#include "translation.h" #include "z64map_mark.h" #include "z64play.h" #include "z64save.h" -#include "global.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 88c219d37d..046d3ff886 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -1,17 +1,22 @@ #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" #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" @@ -19,12 +24,10 @@ #include "z64player.h" #include "z64save.h" -#include "global.h" - #include "assets/textures/parameter_static/parameter_static.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" +#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:128 pal-1.1:128" #if !PLATFORM_IQUE #define MSG_BUF_DECODED (msgCtx->msgBufDecoded) diff --git a/src/code/z_moji.c b/src/code/z_moji.c index 33abd83f7f..e26ce68e7f 100644 --- a/src/code/z_moji.c +++ b/src/code/z_moji.c @@ -3,9 +3,7 @@ */ #include "gfx.h" - -#include "macros.h" -#include "global.h" +#include "printf.h" // how big to draw the characters on screen #define DISP_CHAR_WIDTH 8 diff --git a/src/code/z_onepointdemo.c b/src/code/z_onepointdemo.c index 6a4c896ac7..94c3bc9e11 100644 --- a/src/code/z_onepointdemo.c +++ b/src/code/z_onepointdemo.c @@ -1,6 +1,9 @@ +#include "one_point_cutscene.h" + #include "libc64/math64.h" #include "libc64/qrand.h" -#include "one_point_cutscene.h" +#include "array_count.h" +#include "printf.h" #include "quake.h" #include "sfx.h" #include "terminal.h" diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 2c9b219501..1498db0fba 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -1,9 +1,13 @@ +#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" @@ -11,6 +15,7 @@ #include "sfx.h" #include "sys_matrix.h" #include "terminal.h" +#include "translation.h" #include "versions.h" #include "z64audio.h" #include "z64lifemeter.h" @@ -20,8 +25,6 @@ #include "z64player.h" #include "z64save.h" -#include "global.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" @@ -2160,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); } } diff --git a/src/code/z_play.c b/src/code/z_play.c index 13ce984512..d4d28422c3 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -1,7 +1,9 @@ #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 "file_select_state.h" @@ -14,6 +16,7 @@ #include "n64dd.h" #endif #include "one_point_cutscene.h" +#include "printf.h" #include "quake.h" #include "regs.h" #include "rumble.h" @@ -24,9 +27,16 @@ #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" @@ -37,10 +47,8 @@ #include "z64save.h" #include "z64vis.h" -#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 ique-cn:0" \ - "ntsc-1.0:224 ntsc-1.1:224 ntsc-1.2:224 pal-1.0:224 pal-1.1:224" +#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; @@ -576,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)) { @@ -1137,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); @@ -1598,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_lib.c b/src/code/z_player_lib.c index adefea26a7..1ac27fdb6c 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -1525,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); @@ -1879,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); @@ -2057,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 bda115d462..6bf73b0577 100644 --- a/src/code/z_prenmi.c +++ b/src/code/z_prenmi.c @@ -1,12 +1,11 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "prenmi_state.h" +#include "printf.h" #include "regs.h" #include "terminal.h" #include "versions.h" - -#include "macros.h" -#include "global.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 17ef0b78c9..3c45d7e540 100644 --- a/src/code/z_prenmi_buff.c +++ b/src/code/z_prenmi_buff.c @@ -1,5 +1,4 @@ #include "prenmi_buff.h" -#include "global.h" #define COLD_RESET 0 #define NMI 1 diff --git a/src/code/z_quake.c b/src/code/z_quake.c index 2e83a7c10e..d3ba17810d 100644 --- a/src/code/z_quake.c +++ b/src/code/z_quake.c @@ -1,5 +1,6 @@ #include "libc64/qrand.h" -#include "macros.h" +#include "array_count.h" +#include "printf.h" #include "quake.h" #include "terminal.h" #include "z_lib.h" diff --git a/src/code/z_room.c b/src/code/z_room.c index a9daab2047..7bc9e4801d 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -1,5 +1,6 @@ #include "libu64/debug.h" #include "ultra64/gs2dex.h" +#include "array_count.h" #include "buffers.h" #include "fault.h" #include "gfx.h" @@ -10,11 +11,13 @@ #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" @@ -713,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)); @@ -728,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 52897d6294..fc811cfccb 100644 --- a/src/code/z_rumble.c +++ b/src/code/z_rumble.c @@ -15,6 +15,7 @@ #include "padmgr.h" #include "z64math.h" +static s32 sUnused[4]; RumbleMgr sRumbleMgr; /** diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 77206ce6f8..feef5ffc62 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -1,9 +1,13 @@ +#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" @@ -106,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) { @@ -262,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_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 be5f275647..4e4fd97e9a 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -1,18 +1,19 @@ #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" -#include "macros.h" - #define ANIM_INTERP 1 s32 LinkAnimation_Loop(PlayState* play, SkelAnime* skelAnime); diff --git a/src/code/z_skin.c b/src/code/z_skin.c index 508943cdd9..7861acb897 100644 --- a/src/code/z_skin.c +++ b/src/code/z_skin.c @@ -6,13 +6,8 @@ #include "z64skin.h" #include "z64skin_matrix.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" - 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; diff --git a/src/code/z_skin_awb.c b/src/code/z_skin_awb.c index 8a175ed15f..196ce9aae4 100644 --- a/src/code/z_skin_awb.c +++ b/src/code/z_skin_awb.c @@ -1,4 +1,4 @@ -#include "overlays/actors/ovl_En_fHG/z_en_fhg.h" +#include "array_count.h" #include "segmented_address.h" #include "zelda_arena.h" #include "z64actor.h" @@ -6,6 +6,8 @@ #include "z64skin.h" #include "z64skin_matrix.h" +#include "overlays/actors/ovl_En_fHG/z_en_fhg.h" + /** * Initialises the Vtx buffers used for limb at index `limbIndex` */ diff --git a/src/code/z_skin_matrix.c b/src/code/z_skin_matrix.c index f83cb8295d..36d7a02791 100644 --- a/src/code/z_skin_matrix.c +++ b/src/code/z_skin_matrix.c @@ -1,9 +1,10 @@ -#include "gfx.h" -#include "terminal.h" -#include "z_lib.h" #include "z64skin_matrix.h" -#include "macros.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 de2f1ce72e..2eef6db036 100644 --- a/src/code/z_sram.c +++ b/src/code/z_sram.c @@ -1,16 +1,22 @@ +#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 "z64sram.h" #include "z64ss_sram.h" -#include "global.h" - #define SLOT_SIZE (sizeof(SaveContext) + 0x28) #define CHECKSUM_SIZE (sizeof(Save) / 2) @@ -1058,7 +1064,7 @@ void Sram_InitSram(GameState* gameState, SramContext* sramCtx) { PRINTF("Na_SetSoundOutputMode = %d\n", gSaveContext.soundSetting); PRINTF("Na_SetSoundOutputMode = %d\n", gSaveContext.soundSetting); PRINTF_RST(); - Audio_SetSoundMode(gSaveContext.soundSetting); + Audio_SetSoundOutputMode(gSaveContext.soundSetting); } void Sram_Alloc(GameState* gameState, SramContext* sramCtx) { diff --git a/src/code/z_ss_sram.c b/src/code/z_ss_sram.c index 330f5ca4ac..94e97639aa 100644 --- a/src/code/z_ss_sram.c +++ b/src/code/z_ss_sram.c @@ -1,9 +1,7 @@ #include "ultra64.h" +#include "printf.h" #include "z64ss_sram.h" -#include "macros.h" -#include "global.h" - typedef struct SsSramContext { /* 0x00 */ OSPiHandle piHandle; /* 0x74 */ OSIoMesg ioMesg; diff --git a/src/code/z_view.c b/src/code/z_view.c index dd4608cde3..6fe82aaeb3 100644 --- a/src/code/z_view.c +++ b/src/code/z_view.c @@ -1,12 +1,16 @@ +#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 "z64view.h" +#include "translation.h" vu32 sLogOnNextViewInit = true; diff --git a/src/code/z_vimode.c b/src/code/z_vimode.c index d1f472057e..6eceeaa7e7 100644 --- a/src/code/z_vimode.c +++ b/src/code/z_vimode.c @@ -3,13 +3,12 @@ #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" -#include "global.h" -#include "macros.h" - void ViMode_LogPrint(OSViMode* osViMode) { LOG_ADDRESS("osvimodep", osViMode, "../z_vimode.c", 87); LOG_HEX32("osvimodep->comRegs.ctrl", osViMode->comRegs.ctrl, "../z_vimode.c", 88); diff --git a/src/code/z_viscvg.c b/src/code/z_viscvg.c index 5fff1a460f..51fc6f8e5d 100644 --- a/src/code/z_viscvg.c +++ b/src/code/z_viscvg.c @@ -23,8 +23,6 @@ #include "gfx.h" #include "z64vis.h" -#include "macros.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 e3cecda5c1..517f2ada60 100644 --- a/src/code/z_vismono.c +++ b/src/code/z_vismono.c @@ -15,8 +15,6 @@ #include "gfxalloc.h" #include "z64vis.h" -#include "macros.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 // the half of TMEM dedicated to color-indexed data. diff --git a/src/code/z_viszbuf.c b/src/code/z_viszbuf.c index 8f8265bfda..431d7f6d9a 100644 --- a/src/code/z_viszbuf.c +++ b/src/code/z_viszbuf.c @@ -35,8 +35,6 @@ #include "gfx.h" #include "z64vis.h" -#include "macros.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. #define VISZBUF_ZBUFFRAG_HEIGHT (TMEM_SIZE / (SCREEN_WIDTH * G_IM_SIZ_16b_BYTES)) diff --git a/src/code/z_vr_box.c b/src/code/z_vr_box.c index cd8c1b2b8f..2fa2122acf 100644 --- a/src/code/z_vr_box.c +++ b/src/code/z_vr_box.c @@ -1,6 +1,13 @@ -#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 { 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 f2a6edba9a..b51eb333ed 100644 --- a/src/libc64/math64.c +++ b/src/libc64/math64.c @@ -1,6 +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 aa9c0feda7..d4f6f5100b 100644 --- a/src/libleo/api/cacreateleomanager.c +++ b/src/libleo/api/cacreateleomanager.c @@ -5,7 +5,7 @@ #include "libc/stdint.h" #include "attributes.h" -#include "global.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 4cd6ab0018..23f9da8226 100644 --- a/src/libleo/api/cjcreateleomanager.c +++ b/src/libleo/api/cjcreateleomanager.c @@ -5,7 +5,7 @@ #include "libc/stdint.h" #include "attributes.h" -#include "global.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 7a678dc675..d7887d4944 100644 --- a/src/libleo/leo/leocmdex.c +++ b/src/libleo/leo/leocmdex.c @@ -3,7 +3,7 @@ #include "ultra64/leodrive.h" #include "attributes.h" -#include "global.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 98de987f71..d0804f033c 100644 --- a/src/libleo/leo/leomecha.c +++ b/src/libleo/leo/leomecha.c @@ -3,7 +3,7 @@ #include "ultra64/leodrive.h" #include "attributes.h" -#include "global.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 c2c5d98b54..f6c7fdfc05 100644 --- a/src/libleo/leo/leotimer.c +++ b/src/libleo/leo/leotimer.c @@ -3,7 +3,7 @@ #include "ultra64/leodrive.h" #include "attributes.h" -#include "global.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 7a1c37e08c..c47d52a3a5 100644 --- a/src/libu64/gfxprint.c +++ b/src/libu64/gfxprint.c @@ -1,8 +1,7 @@ #include "libc64/aprintf.h" #include "libu64/gfxprint.h" #include "attributes.h" - -#include "macros.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 6211d119b2..340780a130 100644 --- a/src/libu64/load_gc.c +++ b/src/libu64/load_gc.c @@ -1,9 +1,9 @@ #include "libu64/overlay.h" #include "ultra64.h" +#include "printf.h" +#include "translation.h" #include "z64dma.h" -#include "macros.h" - size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd, void* allocatedRamAddr) { s32 pad[3]; uintptr_t end; diff --git a/src/libu64/loadfragment2_gc.c b/src/libu64/loadfragment2_gc.c index 191b2ee076..5ad556e506 100644 --- a/src/libu64/loadfragment2_gc.c +++ b/src/libu64/loadfragment2_gc.c @@ -1,7 +1,6 @@ #include "libc64/malloc.h" #include "libu64/overlay.h" - -#include "macros.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 015e1d1d6b..be0e5295d9 100644 --- a/src/libu64/loadfragment2_n64.c +++ b/src/libu64/loadfragment2_n64.c @@ -8,10 +8,9 @@ */ #include "libc64/malloc.h" #include "libu64/overlay.h" +#include "translation.h" #include "z64dma.h" -#include "macros.h" - s32 gOverlayLogSeverity = 2; // Extract MIPS register rs from an instruction word 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 9307d67cc6..91d7eaf790 100644 --- a/src/libu64/relocation_gc.c +++ b/src/libu64/relocation_gc.c @@ -8,10 +8,9 @@ */ #include "libu64/overlay.h" #include "attributes.h" +#include "printf.h" #include "ultra64.h" -#include "macros.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 76% rename from src/libu64/system_heap.c rename to src/libu64/runtime.c index 3a98ef3cef..aa0c507b7d 100644 --- a/src/libu64/system_heap.c +++ b/src/libu64/runtime.c @@ -1,3 +1,5 @@ +#include "libu64/runtime.h" + #include "libc64/malloc.h" #include "libc64/os_malloc.h" @@ -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 f98e828eae..69fe224ee8 100644 --- a/src/libu64/stackcheck.c +++ b/src/libu64/stackcheck.c @@ -1,9 +1,9 @@ #include "libu64/debug.h" #include "attributes.h" +#include "printf.h" #include "stackcheck.h" #include "terminal.h" - -#include "macros.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/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 3c4c644078..4ad8ccc820 100644 --- a/src/libultra/os/settimer.c +++ b/src/libultra/os/settimer.c @@ -1,7 +1,7 @@ #include "ultra64.h" #include "attributes.h" -#include "global.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 8c6c91a9ce..2212fe43fb 100644 --- a/src/n64dd/n64dd_801C8000.c +++ b/src/n64dd/n64dd_801C8000.c @@ -1,5 +1,8 @@ // Does some command processing + #include "n64dd.h" + +#include "array_count.h" #include "versions.h" #include "z_locale.h" diff --git a/src/n64dd/n64dd_801C8940.c b/src/n64dd/n64dd_801C8940.c index a0d1ff84b3..132222b689 100644 --- a/src/n64dd/n64dd_801C8940.c +++ b/src/n64dd/n64dd_801C8940.c @@ -1,10 +1,9 @@ // Lower-level command processing in a background thread #include "n64dd.h" + #include "libc64/sleep.h" #include "attributes.h" -#include "global.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_801CA0B0.c b/src/n64dd/n64dd_801CA0B0.c index d564d46caa..e3ba1be18d 100644 --- a/src/n64dd/n64dd_801CA0B0.c +++ b/src/n64dd/n64dd_801CA0B0.c @@ -1,8 +1,8 @@ #include "n64dd.h" + #include "libc64/aprintf.h" #include "attributes.h" - -#include "global.h" +#include "array_count.h" // Draws text to framebuffer typedef struct struct_801CA704 { 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/z_n64dd.c b/src/n64dd/z_n64dd.c index 17aff6416c..a8ce0674c7 100644 --- a/src/n64dd/z_n64dd.c +++ b/src/n64dd/z_n64dd.c @@ -1,10 +1,14 @@ // Main interface for the 64DD from the rest of the game. Starts background // threads and provides functions to submit commands to them. + +#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 "n64dd.h" #include "stack.h" #include "stackcheck.h" #include "sys_freeze.h" @@ -12,7 +16,7 @@ #include "z64audio.h" #include "z64thread.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" +#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_Bg_Bdan_Objects/z_bg_bdan_objects.c b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c index c927465569..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,10 +8,12 @@ #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" @@ -107,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; } } @@ -124,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 4fdf0d7dea..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 } @@ -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_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 b97d4c80bc..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); } } @@ -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_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_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 15adb7bf94..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,10 +7,10 @@ #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" 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 eb35f52494..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,12 +11,14 @@ #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" @@ -102,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 @@ -113,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 @@ -251,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) { @@ -277,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 9385ed95bf..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,9 +8,11 @@ #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" @@ -60,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_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_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 3d67136b73..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 @@ -133,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_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_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 a20a0a0421..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,8 +10,10 @@ #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" @@ -85,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; } @@ -98,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_Hamstep/z_bg_hidan_hamstep.c b/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c index 92ba5dd5b0..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" @@ -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_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 27312b4fae..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" @@ -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_Rsekizou/z_bg_hidan_rsekizou.c b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c index 715ecc5fba..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" 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 1c86d7d851..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" 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 20b3717087..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 @@ -6,6 +6,7 @@ #include "z_bg_hidan_sima.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" 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 0b19f74e6a..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 @@ -10,8 +10,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" @@ -135,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_Jya_1flift/z_bg_jya_1flift.c b/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c index 94fd0883d4..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 @@ -7,7 +7,9 @@ #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" @@ -85,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 } @@ -102,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_Amishutter/z_bg_jya_amishutter.c b/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c index e97451e861..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 @@ -7,7 +7,9 @@ #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" @@ -60,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_Bigmirror/z_bg_jya_bigmirror.c b/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c index 7a3606213a..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 @@ -9,7 +9,9 @@ #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" @@ -83,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 { @@ -94,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); } } } @@ -162,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 } @@ -194,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_Bombchuiwa/z_bg_jya_bombchuiwa.c b/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c index 5b1c869eac..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 @@ -6,8 +6,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 "z64effect.h" #include "z64play.h" @@ -193,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_Bombiwa/z_bg_jya_bombiwa.c b/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c index ea2dd59eb2..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 @@ -9,8 +9,10 @@ #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" @@ -81,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 } @@ -100,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); @@ -113,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_Cobra/z_bg_jya_cobra.c b/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c index 6380e0cf6a..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 @@ -5,9 +5,11 @@ #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" @@ -137,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 } @@ -151,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 @@ -437,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_Haheniron/z_bg_jya_haheniron.c b/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c index f19f5f9baf..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 @@ -8,6 +8,7 @@ #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" 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 3ecb0cb2f8..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 @@ -9,7 +9,9 @@ #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" @@ -117,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 @@ -183,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 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 7aead74061..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 @@ -8,8 +8,10 @@ #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" @@ -59,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 } @@ -75,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_Lift/z_bg_jya_lift.c b/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c index 50571f8ac5..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 @@ -8,7 +8,9 @@ #include "ichain.h" #include "one_point_cutscene.h" +#include "printf.h" #include "sfx.h" +#include "translation.h" #include "z_lib.h" #include "z64play.h" @@ -66,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))) { @@ -85,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_Megami/z_bg_jya_megami.c b/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c index 4e9d88d7ce..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 @@ -8,6 +8,7 @@ #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" 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 4dea268824..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 @@ -6,9 +6,12 @@ #include "z_bg_jya_zurerukabe.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" @@ -78,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 } @@ -133,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_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c b/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c index 0bc0649065..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 @@ -54,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_Mizu_Bwall/z_bg_mizu_bwall.c b/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c index 787739822f..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 @@ -8,11 +8,14 @@ #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" @@ -208,8 +211,9 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { Collider_InitTris(play, &this->collider); if (!Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInitFloor, this->colliderElements)) { - PRINTF("Error : コリジョンデータセット失敗(%s %d)(arg_data 0x%04x)\n", "../z_bg_mizu_bwall.c", 484, - this->dyna.actor.params); + 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); @@ -248,8 +252,9 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { Collider_InitTris(play, &this->collider); if (!Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInitRutoWall, this->colliderElements)) { - PRINTF("Error : コリジョンデータセット失敗(%s %d)(arg_data 0x%04x)\n", "../z_bg_mizu_bwall.c", 558, - this->dyna.actor.params); + 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); @@ -288,8 +293,9 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { Collider_InitTris(play, &this->collider); if (!Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInitUnusedWall, this->colliderElements)) { - PRINTF("Error : コリジョンデータセット失敗(%s %d)(arg_data 0x%04x)\n", "../z_bg_mizu_bwall.c", 638, - this->dyna.actor.params); + 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); @@ -330,8 +336,9 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { Collider_InitTris(play, &this->collider); if (!Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInitStingerWall, this->colliderElements)) { - PRINTF("Error : コリジョンデータセット失敗(%s %d)(arg_data 0x%04x)\n", "../z_bg_mizu_bwall.c", 724, - this->dyna.actor.params); + 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); @@ -372,8 +379,9 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { Collider_InitTris(play, &this->collider); if (!Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInitStingerWall, this->colliderElements)) { - PRINTF("Error : コリジョンデータセット失敗(%s %d)(arg_data 0x%04x)\n", "../z_bg_mizu_bwall.c", 798, - this->dyna.actor.params); + 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_Water/z_bg_mizu_water.c b/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c index 5a59ddd683..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 @@ -10,10 +10,12 @@ #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" @@ -120,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_Mjin/z_bg_mjin.c b/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c index 6fa9814a1b..bf00812fc6 100644 --- a/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c +++ b/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c @@ -117,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_Mori_Bigst/z_bg_mori_bigst.c b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c index 9bc16b1fe4..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 @@ -10,9 +10,11 @@ #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" @@ -72,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 } @@ -83,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; @@ -150,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); } @@ -212,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); @@ -221,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_Elevator/z_bg_mori_elevator.c b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c index 53206ecf72..2230b86d35 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 @@ -4,8 +4,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 "z64audio.h" #include "z64play.h" #include "z64player.h" @@ -103,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); @@ -131,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; } @@ -155,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); @@ -217,7 +219,9 @@ void BgMoriElevator_SetPosition(BgMoriElevator* this, PlayState* play) { 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_Hashigo/z_bg_mori_hashigo.c b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c index b75117adca..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 @@ -6,10 +6,13 @@ #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" @@ -99,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 } @@ -137,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; } } @@ -179,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_Hashira4/z_bg_mori_hashira4.c b/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c index 9f3b50dadb..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 @@ -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" @@ -70,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 } @@ -93,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)) { @@ -104,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_Idomizu/z_bg_mori_idomizu.c b/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c index 051e7c6874..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 @@ -9,8 +9,10 @@ #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" @@ -78,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_Kaitenkabe/z_bg_mori_kaitenkabe.c b/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c index 8bf43c9a18..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 @@ -9,8 +9,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 "z64play.h" #include "z64player.h" @@ -60,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); @@ -69,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_Rakkatenjo/z_bg_mori_rakkatenjo.c b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c index b331b15b27..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 @@ -6,13 +6,16 @@ #include "z_bg_mori_rakkatenjo.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" @@ -65,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_Spot01_Fusya/z_bg_spot01_fusya.c b/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c index 33f96d5476..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 @@ -9,6 +9,7 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" +#include "sfx.h" #include "sys_matrix.h" #include "z_lib.h" #include "z64audio.h" @@ -74,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_Idohashira/z_bg_spot01_idohashira.c b/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c index d5a21a8b6b..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 @@ -9,10 +9,12 @@ #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" @@ -191,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; } @@ -266,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; @@ -296,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); @@ -347,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_Objects2/z_bg_spot01_objects2.c b/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c index 4b7e9eed8a..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 @@ -7,7 +7,9 @@ #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" @@ -67,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; } @@ -98,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_Spot06_Objects/z_bg_spot06_objects.c b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c index 45b2b1e9f2..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 @@ -10,6 +10,7 @@ #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" 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 b54226cec8..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 @@ -8,6 +8,7 @@ #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" 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 4f0bb37567..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,8 +9,10 @@ #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" @@ -61,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 } @@ -75,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: @@ -298,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 449091faa0..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 @@ -6,10 +6,13 @@ #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" @@ -145,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_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c b/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c index 1aafed8831..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 @@ -8,7 +8,9 @@ #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" @@ -128,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_Oasis/z_bg_spot11_oasis.c b/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c index 1af76df476..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 @@ -8,6 +8,7 @@ #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" 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 9a36eb287d..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 @@ -8,8 +8,10 @@ #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" @@ -62,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_Saku/z_bg_spot12_saku.c b/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c index 1edeb59461..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 @@ -8,7 +8,9 @@ #include "ichain.h" #include "one_point_cutscene.h" +#include "printf.h" #include "sfx.h" +#include "translation.h" #include "z_lib.h" #include "z64play.h" @@ -59,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_Spot15_Rrbox/z_bg_spot15_rrbox.c b/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c index 02dbe68e3a..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 @@ -6,9 +6,12 @@ #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" @@ -76,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 } @@ -142,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) { @@ -329,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_Spot16_Bombstone/z_bg_spot16_bombstone.c b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c index b014d7faff..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 @@ -3,14 +3,17 @@ #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" @@ -187,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); @@ -237,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; } @@ -269,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 @@ -280,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) { @@ -403,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_Doughnut/z_bg_spot16_doughnut.c b/src/overlays/actors/ovl_Bg_Spot16_Doughnut/z_bg_spot16_doughnut.c index c6cf246bca..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 @@ -9,8 +9,10 @@ #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" @@ -83,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_Spot17_Funen/z_bg_spot17_funen.c b/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c index 84973d0b11..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 @@ -9,7 +9,9 @@ #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" @@ -42,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_Spot18_Basket/z_bg_spot18_basket.c b/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c index 2f36cd5034..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,11 +1,14 @@ #include "z_bg_spot18_basket.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" @@ -168,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_Obj/z_bg_spot18_obj.c b/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c index 7012e9023c..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 @@ -7,9 +7,12 @@ #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" @@ -105,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; } @@ -114,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_Zg/z_bg_zg.c b/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c index 68bacc26c8..7a12637b9d 100644 --- a/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c +++ b/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c @@ -9,10 +9,12 @@ #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" @@ -108,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); } @@ -155,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_Boss_Fd/z_boss_fd.c b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c index aad89ee93f..c66883ddd8 100644 --- a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c +++ b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c @@ -12,10 +12,12 @@ #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" 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 27c5d82e96..856f9e34ea 100644 --- a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c +++ b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c @@ -8,10 +8,12 @@ #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" 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 97bf27b6f9..0ca8e3c843 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" @@ -124,8 +125,8 @@ 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; @@ -359,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[] = { @@ -522,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; @@ -570,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; @@ -1117,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), @@ -1207,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; @@ -1220,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; @@ -1255,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); @@ -2834,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 f0e1656fa0..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" @@ -379,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); @@ -1342,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 cc30350bc4..848707f002 100644 --- a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c +++ b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c @@ -13,10 +13,12 @@ #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" 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 c1719b8e6d..bfd115b535 100644 --- a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c +++ b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c @@ -11,10 +11,12 @@ #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" 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 cbb82fd9a6..c8e6e15450 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -9,12 +9,14 @@ #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" @@ -32,8 +34,6 @@ #include "z64save.h" #include "z64skin_matrix.h" -#include "global.h" - #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_mo/object_mo.h" 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 1425b63c8b..89ba5fab34 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -32,8 +32,8 @@ #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:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn: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" \ + "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 | \ @@ -917,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 { @@ -2713,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))) { @@ -2818,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; @@ -2897,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) { @@ -2924,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_Tw/z_boss_tw.c b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c index 51b5bef624..4b03b3b7dd 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -3,11 +3,13 @@ #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" 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 d5454d30e8..aec25c7cf2 100644 --- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -8,6 +8,7 @@ #include "overlays/actors/ovl_En_Boom/z_en_boom.h" #include "libc64/qrand.h" +#include "array_count.h" #include "attributes.h" #include "gfx.h" #include "gfx_setupdl.h" @@ -28,8 +29,8 @@ #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: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" +#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 | \ 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 d61720cdf6..1673a99601 100644 --- a/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c +++ b/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c @@ -9,6 +9,7 @@ #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "rand.h" #include "segmented_address.h" #include "sequence.h" 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 9a1993da17..a4fba78e7b 100644 --- a/src/overlays/actors/ovl_Demo_Du/z_demo_du.c +++ b/src/overlays/actors/ovl_Demo_Du/z_demo_du.c @@ -5,10 +5,12 @@ #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" @@ -977,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); @@ -1048,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_Ec/z_demo_ec.c b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c index 303c4f7240..7528a2a6a2 100644 --- a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c +++ b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c @@ -6,10 +6,13 @@ #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" @@ -328,7 +331,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); @@ -337,7 +340,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) { @@ -1334,8 +1337,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); @@ -1367,8 +1370,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_Effect/z_demo_effect.c b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c index 78517cad0f..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" 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 55713d4134..129b99d926 100644 --- a/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c +++ b/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c @@ -8,10 +8,12 @@ #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" @@ -183,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); } @@ -237,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_Geff/z_demo_geff.c b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c index b70210c38a..27cb963a4b 100644 --- a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c +++ b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c @@ -9,10 +9,12 @@ #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" @@ -101,7 +103,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) {} @@ -218,7 +220,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); @@ -232,7 +235,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_Gj/z_demo_gj.c b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c index 1cfb0ef82b..6bc60ac276 100644 --- a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c +++ b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c @@ -8,13 +8,16 @@ #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" @@ -1375,8 +1378,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; } @@ -1467,8 +1470,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_Go/z_demo_go.c b/src/overlays/actors/ovl_Demo_Go/z_demo_go.c index 139e38a45f..4ea8f4b685 100644 --- a/src/overlays/actors/ovl_Demo_Go/z_demo_go.c +++ b/src/overlays/actors/ovl_Demo_Go/z_demo_go.c @@ -8,10 +8,12 @@ #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" @@ -330,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); @@ -371,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_Gt/z_demo_gt.c b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c index 7b86c2bc25..98552aec93 100644 --- a/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c +++ b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c @@ -5,12 +5,14 @@ #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" @@ -1735,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; } @@ -1791,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_Ik/z_demo_ik.c b/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c index cab53df6ac..af3ddeb000 100644 --- a/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c +++ b/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c @@ -1,10 +1,13 @@ #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" @@ -478,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); @@ -499,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_Im/z_demo_im.c b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c index 95d68dd2b5..0eef345821 100644 --- a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c +++ b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c @@ -10,11 +10,13 @@ #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" @@ -1122,7 +1124,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); @@ -1233,7 +1236,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_Kankyo/z_demo_kankyo.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c index 14dc48c70f..5518ce754e 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -4,6 +4,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" 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 3b6ed448d8..38a44165d5 100644 --- a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c +++ b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c @@ -10,11 +10,13 @@ #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" @@ -779,7 +781,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); @@ -849,7 +852,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_Tre_Lgt/z_demo_tre_lgt.c b/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c index dcafdfed20..c1f7983ce8 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 @@ -3,6 +3,7 @@ #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "sfx.h" #include "z64curve.h" #include "z64play.h" 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 7c00f0118c..15d92cb18a 100644 --- a/src/overlays/actors/ovl_Door_Killer/z_door_killer.c +++ b/src/overlays/actors/ovl_Door_Killer/z_door_killer.c @@ -8,6 +8,7 @@ #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "rand.h" #include "segmented_address.h" #include "sfx.h" @@ -471,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_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index 1252d7db59..05eec20ffa 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -7,10 +7,12 @@ #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" 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 7c5709434f..79f4feca86 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" @@ -16,6 +17,9 @@ #include "assets/objects/object_warp1/object_warp1.h" +#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:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" + #define FLAGS 0 void DoorWarp1_Init(Actor* thisx, PlayState* play); 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 5165520c6d..22c96a08d4 100644 --- a/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c +++ b/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c @@ -10,6 +10,7 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" +#include "printf.h" #include "regs.h" #include "sys_matrix.h" #include "terminal.h" 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 562eef8a42..f6beb6cc82 100644 --- a/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c +++ b/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c @@ -10,6 +10,7 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" +#include "printf.h" #include "regs.h" #include "sys_matrix.h" #include "terminal.h" 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 d68f1c8502..5c03ab9632 100644 --- a/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c +++ b/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c @@ -9,8 +9,10 @@ #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" 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 bdb3c312c0..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 @@ -7,6 +7,7 @@ #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" 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 d5c951d346..9c9d7bacfa 100644 --- a/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c +++ b/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c @@ -10,6 +10,7 @@ #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" 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 a321a43a0e..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,5 +1,6 @@ #include "z_en_bigokuta.h" +#include "array_count.h" #include "libc64/qrand.h" #include "gfx.h" #include "gfx_setupdl.h" 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 8edeca7cf5..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" 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 20ea5fb0db..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,6 +1,7 @@ #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" 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 3af6e87eca..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" 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 ac30a23d5f..c4ef15919a 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -6,6 +6,7 @@ #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" @@ -639,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_Butte/z_en_butte.c b/src/overlays/actors/ovl_En_Butte/z_en_butte.c index cd9776b988..c206adfbf5 100644 --- a/src/overlays/actors/ovl_En_Butte/z_en_butte.c +++ b/src/overlays/actors/ovl_En_Butte/z_en_butte.c @@ -11,6 +11,7 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" +#include "printf.h" #include "segmented_address.h" #include "sfx.h" #include "sys_math3d.h" 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 d6f0ab74e0..95debf0273 100644 --- a/src/overlays/actors/ovl_En_Changer/z_en_changer.c +++ b/src/overlays/actors/ovl_En_Changer/z_en_changer.c @@ -9,6 +9,7 @@ #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" 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 619630cf7b..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 @@ -5,6 +5,7 @@ #include "attributes.h" #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "rand.h" #include "sfx.h" #include "sys_matrix.h" 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 c5eb8ff56b..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 @@ -10,6 +10,7 @@ #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" 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 ab7b8e4285..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,6 +1,7 @@ #include "z_en_dekubaba.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" 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 6de6666028..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 @@ -10,6 +10,7 @@ #include "libc64/qrand.h" #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "rand.h" #include "regs.h" #include "segmented_address.h" 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 cc823ecdcb..c690638570 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -9,6 +9,7 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" +#include "printf.h" #include "sfx.h" #include "terminal.h" #include "z_en_item00.h" 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 e23c50b448..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 @@ -10,6 +10,7 @@ #include "attributes.h" #include "one_point_cutscene.h" +#include "printf.h" #include "rand.h" #include "regs.h" #include "seqcmd.h" 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 b0be17234b..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 @@ -12,6 +12,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" 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 bcf0978433..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 @@ -14,6 +14,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" @@ -191,7 +192,7 @@ void EnDntNomal_Destroy(Actor* thisx, PlayState* play) { 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; 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 b3f71481d9..9f5bd8723e 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -7,6 +7,7 @@ #include "z_en_door.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" 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 9023f99eac..b4da54551d 100644 --- a/src/overlays/actors/ovl_En_Eg/z_en_eg.c +++ b/src/overlays/actors/ovl_En_Eg/z_en_eg.c @@ -6,11 +6,13 @@ #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" @@ -73,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_Encount1/z_en_encount1.c b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c index b60eb08a6d..92374ad12a 100644 --- a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c +++ b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c @@ -2,9 +2,11 @@ #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" 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 0fd64079e6..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" 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 b7232a5c45..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" 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 88e2d884c2..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 @@ -4,6 +4,7 @@ #include "libc64/qrand.h" #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "rand.h" #include "segmented_address.h" #include "sfx.h" 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 26848dd956..475c476bb5 100644 --- a/src/overlays/actors/ovl_En_Fd/z_en_fd.c +++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.c @@ -244,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); } @@ -684,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_Fire/z_en_fd_fire.c b/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c index 815d8c654d..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,5 +1,6 @@ #include "z_en_fd_fire.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "rand.h" 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 308c9f5137..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 @@ -14,6 +14,7 @@ #include "attributes.h" #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "rand.h" #include "rumble.h" #include "segmented_address.h" 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 f9af6f916d..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,6 +4,7 @@ #include "attributes.h" #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "rand.h" #include "regs.h" #include "sfx.h" 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 6634d2cf2c..9de3dbe4f8 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -10,6 +10,7 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" +#include "printf.h" #include "sfx.h" #include "terminal.h" #include "z_lib.h" 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 d365822f59..a9d9036e9f 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -293,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_Fr/z_en_fr.c b/src/overlays/actors/ovl_En_Fr/z_en_fr.c index 9bfa0c0ff2..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,10 +1,12 @@ #include "z_en_fr.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" @@ -21,8 +23,6 @@ #include "z64player.h" #include "z64save.h" -#include "global.h" - #include "assets/objects/gameplay_field_keep/gameplay_field_keep.h" #include "assets/objects/object_fr/object_fr.h" 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 b9a678d699..ba002aefbe 100644 --- a/src/overlays/actors/ovl_En_Fw/z_en_fw.c +++ b/src/overlays/actors/ovl_En_Fw/z_en_fw.c @@ -376,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_G_Switch/z_en_g_switch.c b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c index cbc6fff801..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 @@ -12,6 +12,7 @@ #include "libc64/qrand.h" #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "rand.h" #include "regs.h" #include "segmented_address.h" @@ -220,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_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 30f18393a0..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 @@ -8,6 +8,7 @@ #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "sys_matrix.h" #include "z64play.h" 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 0bc9d51d95..9565ceba98 100644 --- a/src/overlays/actors/ovl_En_Gb/z_en_gb.c +++ b/src/overlays/actors/ovl_En_Gb/z_en_gb.c @@ -7,6 +7,7 @@ #include "z_en_gb.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" 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 745fa4a493..c47c8271e5 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -9,6 +9,7 @@ #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" 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 2ff3ec7b51..cae8d14bf1 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.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_GirlA/z_en_girla.c b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c index 08c47da269..aebb758cd7 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c @@ -6,6 +6,7 @@ #include "z_en_girla.h" +#include "printf.h" #include "rand.h" #include "sys_matrix.h" #include "terminal.h" 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 75bf9b4357..4b6a979b58 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -10,6 +10,7 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" +#include "printf.h" #include "rand.h" #include "segmented_address.h" #include "sys_matrix.h" @@ -117,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; @@ -286,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_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 9c15e9e7a3..61c3d5f6e1 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -2,6 +2,7 @@ #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" 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 bf25b3bc5d..10ba10d18d 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -9,6 +9,7 @@ #include "libc64/qrand.h" #include "ichain.h" +#include "printf.h" #include "quake.h" #include "regs.h" #include "segmented_address.h" 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 117f891c10..474912abb6 100644 --- a/src/overlays/actors/ovl_En_Guest/z_en_guest.c +++ b/src/overlays/actors/ovl_En_Guest/z_en_guest.c @@ -9,6 +9,7 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" +#include "printf.h" #include "rand.h" #include "segmented_address.h" #include "sys_matrix.h" @@ -93,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); @@ -171,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_Heishi1/z_en_heishi1.c b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c index 7f5af16a74..0736896895 100644 --- a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c +++ b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c @@ -7,8 +7,10 @@ #include "z_en_heishi1.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" 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 d9428562fe..c071d40c53 100644 --- a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c +++ b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c @@ -11,6 +11,7 @@ #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "rand.h" #include "sfx.h" #include "sys_matrix.h" 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 91ccd4d516..354c3f3058 100644 --- a/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c +++ b/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c @@ -8,6 +8,7 @@ #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "sfx.h" #include "terminal.h" #include "versions.h" 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 b139288ba1..b90c778114 100644 --- a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c +++ b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c @@ -2,6 +2,7 @@ #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "terminal.h" #include "z64face_reaction.h" #include "z64play.h" 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 bdee0a8ad0..5f884f8997 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c @@ -10,6 +10,7 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" +#include "printf.h" #include "segmented_address.h" #include "sfx.h" #include "sys_math.h" 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 08f58dbce2..dded516560 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -9,6 +9,7 @@ #include "libc64/math64.h" #include "libc64/qrand.h" +#include "array_count.h" #include "controller.h" #include "gfx.h" #include "gfx_setupdl.h" 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 ac1ae2f420..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 @@ -9,6 +9,7 @@ #include "libu64/debug.h" #include "line_numbers.h" +#include "printf.h" #include "regs.h" #include "sfx.h" #include "seqcmd.h" 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 7a3307bc05..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 @@ -6,6 +6,7 @@ #include "z_en_horse_link_child.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" 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 1ddc46944b..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 @@ -8,6 +8,7 @@ #include "libc64/math64.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" 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 059f88c3ae..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 @@ -7,6 +7,7 @@ #include "z_en_horse_zelda.h" #include "libc64/math64.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" 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 88a548a41a..935fdedd97 100644 --- a/src/overlays/actors/ovl_En_Hs/z_en_hs.c +++ b/src/overlays/actors/ovl_En_Hs/z_en_hs.c @@ -8,6 +8,7 @@ #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "sfx.h" #include "sys_matrix.h" #include "terminal.h" 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 4914be17ed..71005a3afb 100644 --- a/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c +++ b/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c @@ -8,6 +8,7 @@ #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "sys_matrix.h" #include "terminal.h" #include "z_lib.h" 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 3af23db48b..655ebd4789 100644 --- a/src/overlays/actors/ovl_En_Hy/z_en_hy.c +++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.c @@ -1162,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); @@ -1350,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); @@ -1377,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; @@ -1386,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) { @@ -1423,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_Ice_Hono/z_en_ice_hono.c b/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c index 4c230f210b..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 @@ -10,6 +10,7 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" +#include "printf.h" #include "sfx.h" #include "sys_matrix.h" #include "z_lib.h" 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 61573e535f..9b49e35f78 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -7,14 +7,17 @@ #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" @@ -1412,7 +1415,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; } @@ -1506,7 +1510,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_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index fec8487235..521b8dcbfa 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -2,9 +2,11 @@ #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" 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 9135ccd110..bc3640c4ac 100644 --- a/src/overlays/actors/ovl_En_Insect/z_en_insect.c +++ b/src/overlays/actors/ovl_En_Insect/z_en_insect.c @@ -11,6 +11,7 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" +#include "printf.h" #include "sfx.h" #include "sys_math3d.h" #include "terminal.h" 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 41058b811a..bcf59dfbe7 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c @@ -9,9 +9,11 @@ #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 "printf.h" #include "rand.h" #include "rumble.h" #include "sfx.h" 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 5a73461f5d..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,7 @@ #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" 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 7a38ebc937..d2d807cd28 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -6,9 +6,11 @@ #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" 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 d2b70ada73..7651842925 100644 --- a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c +++ b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c @@ -8,6 +8,7 @@ #include "gfx_setupdl.h" #include "one_point_cutscene.h" +#include "printf.h" #include "regs.h" #include "sfx.h" #include "terminal.h" 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 6ae299d966..8f4d21e36d 100644 --- a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c +++ b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c @@ -6,9 +6,11 @@ #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" 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 5c2b652437..844a7ee2a8 100644 --- a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c +++ b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c @@ -8,9 +8,11 @@ #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" 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 4426d8c4f7..2ba0af36ef 100644 --- a/src/overlays/actors/ovl_En_Ko/z_en_ko.c +++ b/src/overlays/actors/ovl_En_Ko/z_en_ko.c @@ -8,6 +8,7 @@ #include "attributes.h" #include "gfx.h" +#include "printf.h" #include "segmented_address.h" #include "sfx.h" #include "sys_matrix.h" @@ -1185,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); @@ -1304,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); @@ -1337,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; @@ -1345,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; @@ -1373,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_Kusa/z_en_kusa.c b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c index eb6b0f1c23..aa955365dd 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -9,7 +9,9 @@ #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" 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 3431445989..5c1e68f77d 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -6,6 +6,8 @@ #include "z_en_mag.h" +#include "array_count.h" +#include "avoid_ub.h" #include "controller.h" #include "gfx.h" #include "gfx_setupdl.h" @@ -13,8 +15,10 @@ #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" @@ -71,7 +75,7 @@ void EnMag_ResetSram(void) { SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8007800), buffer, 0x800, 1); gSaveContext.soundSetting = gSaveContext.zTargetSetting = 0; // SOUND_SETTING_STEREO/Z_TARGET_SETTING_SWITCH - Audio_SetSoundMode(gSaveContext.soundSetting); + Audio_SetSoundOutputMode(gSaveContext.soundSetting); } #endif 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 3958fce494..d2f444a193 100644 --- a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c +++ b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c @@ -10,6 +10,7 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" +#include "printf.h" #include "segmented_address.h" #include "sys_matrix.h" #include "terminal.h" 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 32ac753571..18ebac054a 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.c +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.c @@ -9,6 +9,7 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" +#include "printf.h" #include "z64face_reaction.h" #include "z64play.h" #include "z64save.h" 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 4b615342c0..e0d2edddf3 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -8,8 +8,10 @@ #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" @@ -17,6 +19,7 @@ #include "sfx.h" #include "sys_matrix.h" #include "terminal.h" +#include "translation.h" #include "z_lib.h" #include "z64face_reaction.h" #include "z64play.h" @@ -1458,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; } @@ -1566,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_Niw/z_en_niw.c b/src/overlays/actors/ovl_En_Niw/z_en_niw.c index 00fde6a469..6be5e39db0 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -9,11 +9,13 @@ #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" 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 2250042f84..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 @@ -10,6 +10,7 @@ #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" 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 33881ed73f..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 @@ -4,6 +4,7 @@ #include "attributes.h" #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "rand.h" #include "regs.h" #include "segmented_address.h" @@ -170,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); @@ -533,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_Ny/z_en_ny.c b/src/overlays/actors/ovl_En_Ny/z_en_ny.c index bf71620dc3..d7f4537512 100644 --- a/src/overlays/actors/ovl_En_Ny/z_en_ny.c +++ b/src/overlays/actors/ovl_En_Ny/z_en_ny.c @@ -5,6 +5,7 @@ #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_En_Okarina_Effect/z_en_okarina_effect.c b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c index 49c4756c29..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 @@ -6,6 +6,7 @@ #include "z_en_okarina_effect.h" +#include "printf.h" #include "regs.h" #include "sequence.h" #include "terminal.h" 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 c6ac85502c..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 @@ -7,6 +7,7 @@ #include "z_en_okarina_tag.h" #include "attributes.h" +#include "printf.h" #include "regs.h" #include "segmented_address.h" #include "sfx.h" 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 620d70e215..9d70c9019a 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -8,6 +8,7 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" +#include "printf.h" #include "regs.h" #include "segmented_address.h" #include "sfx.h" @@ -2024,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; @@ -2035,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; @@ -2044,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; @@ -2227,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) { @@ -2397,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_Owl/z_en_owl.c b/src/overlays/actors/ovl_En_Owl/z_en_owl.c index 827bf75c03..3ec065c696 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -11,6 +11,7 @@ #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" @@ -19,6 +20,7 @@ #include "sys_math3d.h" #include "sys_matrix.h" #include "terminal.h" +#include "translation.h" #include "z_lib.h" #include "z64audio.h" #include "z64play.h" 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 57ef9a85b6..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 @@ -226,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; @@ -246,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_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index 0f24ad4d0d..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 @@ -6,6 +6,7 @@ #include "z_en_po_sisters.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "one_point_cutscene.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 fb3f20bc6c..856958e81e 100644 --- a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c +++ b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c @@ -12,6 +12,7 @@ #include "attributes.h" #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "rand.h" #include "regs.h" #include "sfx.h" 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 56e27591fc..ff57761161 100644 --- a/src/overlays/actors/ovl_En_Rl/z_en_rl.c +++ b/src/overlays/actors/ovl_En_Rl/z_en_rl.c @@ -8,9 +8,11 @@ #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" @@ -349,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); @@ -398,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_Rr/z_en_rr.c b/src/overlays/actors/ovl_En_Rr/z_en_rr.c index 07bb916640..b4e136a75a 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -10,6 +10,7 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" +#include "printf.h" #include "rand.h" #include "rumble.h" #include "sfx.h" 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 16bc86f02a..85ef778479 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -8,8 +8,10 @@ #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" @@ -17,6 +19,7 @@ #include "sfx.h" #include "sys_matrix.h" #include "terminal.h" +#include "translation.h" #include "versions.h" #include "z_lib.h" #include "z64effect.h" @@ -2266,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; } @@ -2420,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_Ru2/z_en_ru2.c b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c index 402bb2329a..db44d32ed0 100644 --- a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c +++ b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c @@ -7,14 +7,17 @@ #include "z_en_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" @@ -921,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); @@ -982,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_Sb/z_en_sb.c b/src/overlays/actors/ovl_En_Sb/z_en_sb.c index d1a2d3715f..152f5ea753 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.c +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.c @@ -8,6 +8,7 @@ #include "attributes.h" #include "ichain.h" +#include "printf.h" #include "rand.h" #include "sfx.h" #include "terminal.h" 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 95a1f773e6..7cec1579b8 100644 --- a/src/overlays/actors/ovl_En_Sda/z_en_sda.c +++ b/src/overlays/actors/ovl_En_Sda/z_en_sda.c @@ -8,6 +8,7 @@ #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "regs.h" #include "sys_matrix.h" #include "z64play.h" 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 d1597d0827..b5bf27be16 100644 --- a/src/overlays/actors/ovl_En_Si/z_en_si.c +++ b/src/overlays/actors/ovl_En_Si/z_en_si.c @@ -88,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); @@ -121,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_Skj/z_en_skj.c b/src/overlays/actors/ovl_En_Skj/z_en_skj.c index c5024ec78f..52b1c4ae3f 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -4,6 +4,7 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" +#include "printf.h" #include "rand.h" #include "regs.h" #include "sequence.h" 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 46c4d7559a..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,5 +1,6 @@ #include "z_en_ssh.h" +#include "array_count.h" #include "gfx.h" #include "segmented_address.h" #include "sfx.h" 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 3b36545dba..7f8bf6497a 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.c +++ b/src/overlays/actors/ovl_En_St/z_en_st.c @@ -7,6 +7,7 @@ #include "z_en_st.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "sfx.h" 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 2535b03254..9eb1679a56 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.c +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.c @@ -8,6 +8,7 @@ #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "segmented_address.h" #include "sys_matrix.h" #include "terminal.h" @@ -157,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]); @@ -400,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_Syateki_Itm/z_en_syateki_itm.c b/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c index 993e6bdbf0..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 @@ -3,6 +3,7 @@ #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" 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 3ddfb5d78f..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 @@ -5,6 +5,7 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "one_point_cutscene.h" +#include "printf.h" #include "regs.h" #include "seqcmd.h" #include "sequence.h" 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 01b9c77979..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" 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 7e13bf3679..68335d64b2 100644 --- a/src/overlays/actors/ovl_En_Ta/z_en_ta.c +++ b/src/overlays/actors/ovl_En_Ta/z_en_ta.c @@ -8,9 +8,11 @@ #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" 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 6370bef893..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 @@ -8,6 +8,7 @@ #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "rand.h" #include "segmented_address.h" #include "terminal.h" 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 28397c9c53..ddb9e8d8d9 100644 --- a/src/overlays/actors/ovl_En_Tana/z_en_tana.c +++ b/src/overlays/actors/ovl_En_Tana/z_en_tana.c @@ -8,6 +8,7 @@ #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "segmented_address.h" #include "sys_matrix.h" #include "z64play.h" 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 0f9a9aa228..61628f342c 100644 --- a/src/overlays/actors/ovl_En_Test/z_en_test.c +++ b/src/overlays/actors/ovl_En_Test/z_en_test.c @@ -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_Tite/z_en_tite.c b/src/overlays/actors/ovl_En_Tite/z_en_tite.c index e2f39597b5..3435b040fc 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -12,6 +12,7 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" +#include "printf.h" #include "segmented_address.h" #include "sfx.h" #include "sys_matrix.h" 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 c6b1b0906e..4f697c29b8 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -8,6 +8,7 @@ #include "libc64/math64.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "rand.h" 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 d9965bfe1f..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 @@ -8,6 +8,7 @@ #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" 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 5db75cbfe2..165065d714 100644 --- a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c +++ b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c @@ -9,6 +9,7 @@ #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" @@ -140,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); @@ -151,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); } @@ -504,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_Vm/z_en_vm.c b/src/overlays/actors/ovl_En_Vm/z_en_vm.c index d5d2ec1b06..2ee230d9bd 100644 --- a/src/overlays/actors/ovl_En_Vm/z_en_vm.c +++ b/src/overlays/actors/ovl_En_Vm/z_en_vm.c @@ -10,6 +10,7 @@ #include "libc64/qrand.h" #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "rand.h" #include "segmented_address.h" #include "sfx.h" 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 28411c959f..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,6 +12,7 @@ #include "rand.h" #include "regs.h" #include "sfx.h" +#include "printf.h" #include "quake.h" #include "terminal.h" #include "z_lib.h" 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 85de2cd564..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 @@ -6,6 +6,7 @@ #include "z_en_weather_tag.h" +#include "printf.h" #include "regs.h" #include "terminal.h" #include "versions.h" 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 95f1061d62..4014597de7 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -8,9 +8,11 @@ #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" 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 94dca26a3b..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 @@ -6,9 +6,11 @@ #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" 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 71a1e5d8fd..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 @@ -6,6 +6,7 @@ #include "z_en_wonder_talk.h" +#include "printf.h" #include "regs.h" #include "terminal.h" #include "z64debug_display.h" 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 b843b64a8b..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 @@ -6,6 +6,7 @@ #include "z_en_wonder_talk2.h" +#include "printf.h" #include "regs.h" #include "terminal.h" #include "z64debug_display.h" 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 833973d4e4..764791e0df 100644 --- a/src/overlays/actors/ovl_En_Xc/z_en_xc.c +++ b/src/overlays/actors/ovl_En_Xc/z_en_xc.c @@ -8,8 +8,10 @@ #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" @@ -17,6 +19,7 @@ #include "sys_math3d.h" #include "sys_matrix.h" #include "terminal.h" +#include "translation.h" #include "z_lib.h" #include "z64audio.h" #include "z64effect.h" @@ -30,8 +33,8 @@ #include "assets/scenes/indoors/tokinoma/tokinoma_scene.h" #include "assets/scenes/dungeons/ice_doukutu/ice_doukutu_scene.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: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" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -1412,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:64" \ - "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:128 gc-eu-mq:64 gc-jp:128 gc-jp-ce:128 gc-jp-mq:64 gc-us:128 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; @@ -2349,7 +2352,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); } @@ -2466,8 +2470,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_Yabusame_Mark/z_en_yabusame_mark.c b/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c index 4be5360be4..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 @@ -6,6 +6,7 @@ #include "z_en_yabusame_mark.h" +#include "printf.h" #include "regs.h" #include "sequence.h" #include "sfx.h" 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 843669b4ec..b49481e881 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -7,6 +7,7 @@ #include "z_en_zf.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" 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 3665e8c6e5..0d03f72301 100644 --- a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c +++ b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c @@ -10,21 +10,19 @@ #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" -#if PLATFORM_N64 -#include "global.h" -#endif - #include "assets/objects/object_zl2/object_zl2.h" #include "assets/objects/object_zl2_anime1/object_zl2_anime1.h" @@ -594,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) { @@ -1632,7 +1630,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); @@ -1728,7 +1727,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_Zl3/z_en_zl3.c b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c index a07a2576d1..28cf2833bb 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,6 +21,7 @@ #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" @@ -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) { @@ -2690,7 +2693,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 +2803,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_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c index 5332ab6788..95a9f6e07c 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -7,6 +7,7 @@ #include "z_en_zo.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "segmented_address.h" 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 1818bea858..02e24ff540 100644 --- a/src/overlays/actors/ovl_En_fHG/z_en_fhg.c +++ b/src/overlays/actors/ovl_En_fHG/z_en_fhg.c @@ -14,6 +14,7 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" +#include "printf.h" #include "segmented_address.h" #include "seqcmd.h" #include "sequence.h" diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index bb66678a65..d16fa2fc5f 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" 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 e0e0e88d83..3909fb72f9 100644 --- a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c +++ b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c @@ -8,6 +8,7 @@ #include "libc64/qrand.h" #include "libu64/debug.h" +#include "printf.h" #include "rand.h" #include "z64draw.h" #include "z64effect.h" 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 357e1e8f71..2f281a17d2 100644 --- a/src/overlays/actors/ovl_Item_Shield/z_item_shield.c +++ b/src/overlays/actors/ovl_Item_Shield/z_item_shield.c @@ -8,6 +8,7 @@ #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "rand.h" #include "segmented_address.h" #include "sys_math.h" 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 0dfabfee4c..d2912c7ea5 100644 --- a/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c +++ b/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c @@ -6,6 +6,7 @@ #include "z_magic_dark.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "sfx.h" 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 f93ded2f02..e60e524b84 100644 --- a/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c +++ b/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c @@ -241,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_Wind/z_magic_wind.c b/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c index 2872bdc70c..57761244ba 100644 --- a/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c +++ b/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c @@ -7,8 +7,10 @@ #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" 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 1dc67c448f..861d72881f 100644 --- a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c +++ b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c @@ -10,6 +10,7 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" +#include "printf.h" #include "sfx.h" #include "sys_math3d.h" #include "sys_matrix.h" 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 f2837d8481..13443bffdb 100644 --- a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c +++ b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c @@ -9,12 +9,14 @@ #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" @@ -161,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 } 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 9563d5d2b4..c6d7b1da3f 100644 --- a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c +++ b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c @@ -8,6 +8,7 @@ #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" 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 fd9d335b65..2163114cd2 100644 --- a/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c +++ b/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c @@ -7,7 +7,9 @@ #include "z_obj_elevator.h" #include "ichain.h" +#include "printf.h" #include "sfx.h" +#include "translation.h" #include "z_lib.h" #include "z64play.h" @@ -61,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_Hamishi/z_obj_hamishi.c b/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c index f7ec91ca08..39d6de7d65 100644 --- a/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c +++ b/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c @@ -7,6 +7,7 @@ #include "z_obj_hamishi.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" 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 e76c104657..c057c6b875 100644 --- a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c +++ b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c @@ -9,8 +9,10 @@ #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" @@ -73,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_Kibako/z_obj_kibako.c b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c index cb90bd2ce1..e417659024 100644 --- a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c +++ b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c @@ -9,6 +9,7 @@ #include "libc64/qrand.h" #include "ichain.h" +#include "printf.h" #include "sfx.h" #include "z_en_item00.h" #include "z_lib.h" 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 591909a579..d81ec6f0c9 100644 --- a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c +++ b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c @@ -9,6 +9,7 @@ #include "libc64/qrand.h" #include "ichain.h" +#include "printf.h" #include "sfx.h" #include "z_en_item00.h" #include "z_lib.h" 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 1545430f1a..0a5866d1d1 100644 --- a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c +++ b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c @@ -8,9 +8,12 @@ #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" @@ -81,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_Lightswitch/z_obj_lightswitch.c b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c index a433834d66..52d71f3d7f 100644 --- a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c +++ b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c @@ -12,6 +12,7 @@ #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" 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 93c4b9cdf3..cd25733300 100644 --- a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c +++ b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c @@ -6,6 +6,7 @@ #include "z_obj_makekinsuta.h" +#include "printf.h" #include "terminal.h" #include "z64play.h" #include "z64player.h" 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 5004472a56..d7a80212c1 100644 --- a/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c +++ b/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c @@ -7,6 +7,7 @@ #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" 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 5d1f63d6b6..b86e27a258 100644 --- a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c +++ b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c @@ -9,6 +9,7 @@ #include "libc64/qrand.h" #include "ichain.h" +#include "printf.h" #include "z64play.h" #define FLAGS 0 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 ecffdfbe7c..365a0e37c3 100644 --- a/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c +++ b/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c @@ -7,6 +7,7 @@ #include "z_obj_mure2.h" #include "ichain.h" +#include "printf.h" #include "sys_math3d.h" #include "z_lib.h" #include "z64play.h" 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 2817c14f2a..8c62e888f3 100644 --- a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c +++ b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c @@ -7,13 +7,16 @@ #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" @@ -108,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 } 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 45c8594c6e..b21c99e2ea 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c @@ -6,15 +6,18 @@ #include "z_obj_switch.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" @@ -215,9 +218,9 @@ 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 } 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 fdd18ef60a..ad927dca9a 100644 --- a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c +++ b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c @@ -10,6 +10,7 @@ #include "gfx_setupdl.h" #include "ichain.h" #include "one_point_cutscene.h" +#include "printf.h" #include "sfx.h" #include "sys_matrix.h" #include "z_lib.h" 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 2f4cc15c76..d5171ad128 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -9,6 +9,7 @@ #include "libc64/qrand.h" #include "ichain.h" +#include "printf.h" #include "sfx.h" #include "z_en_item00.h" #include "z_lib.h" 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 aed6b65e70..78e1cdf3a4 100644 --- a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c +++ b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c @@ -10,6 +10,7 @@ #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" 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 bdf1ff693c..c170279758 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -7,6 +7,7 @@ #include "z_object_kankyo.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "segmented_address.h" 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 c9d6470d63..8a24d5cf2c 100644 --- a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c +++ b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c @@ -9,6 +9,7 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" +#include "printf.h" #include "regs.h" #include "sys_matrix.h" #include "terminal.h" 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 011b112061..36177c0729 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c +++ b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c @@ -8,6 +8,7 @@ #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "sys_matrix.h" #include "terminal.h" #include "z_lib.h" 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 5885dd0ac9..db8171b362 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c +++ b/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c @@ -8,6 +8,7 @@ #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "sys_matrix.h" #include "terminal.h" #include "z_lib.h" 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 580d2cfece..7aec9136f2 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c +++ b/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c @@ -8,6 +8,7 @@ #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "sys_matrix.h" #include "terminal.h" #include "z_lib.h" 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 7263cd16f4..0828ba289f 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c +++ b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c @@ -8,6 +8,7 @@ #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "sys_matrix.h" #include "terminal.h" #include "z_lib.h" 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 de537e434b..7a38b72139 100644 --- a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c +++ b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c @@ -9,6 +9,7 @@ #include "overlays/actors/ovl_En_Elf/z_en_elf.h" #include "one_point_cutscene.h" +#include "printf.h" #include "segmented_address.h" #include "sfx.h" #include "sys_math3d.h" diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 4b327e8654..189f56d8c3 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -18,6 +18,8 @@ #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" @@ -25,6 +27,7 @@ #include "letterbox.h" #include "map.h" #include "one_point_cutscene.h" +#include "printf.h" #include "quake.h" #include "rand.h" #include "regs.h" @@ -373,8 +376,8 @@ static s32 sSavedCurrentMask; static Vec3f sInteractWallCheckResult; static Input* sControlInput; -#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:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" +#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:160 gc-jp-ce:160 gc-jp-mq:160 gc-us:160 gc-us-mq:160" \ + "ique-cn:160 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" // .data @@ -1736,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) { @@ -2555,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; @@ -4000,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 { @@ -6174,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)) { @@ -6289,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) && @@ -11375,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) { @@ -11997,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; @@ -12561,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; } @@ -16152,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_Bomb/z_eff_ss_bomb.c b/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c index a6f909b56a..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 @@ -7,6 +7,7 @@ #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" 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 b66766dd19..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 @@ -87,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); @@ -103,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_Dead_Dd/z_eff_ss_dead_dd.c b/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c index 0b3ef078e9..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 @@ -9,6 +9,7 @@ #include "libc64/qrand.h" #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "z64effect.h" #include "z64play.h" #include "z64skin_matrix.h" 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_En_Ice/z_eff_ss_en_ice.c b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_eff_ss_en_ice.c index f4f8e01d1c..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 @@ -8,6 +8,7 @@ #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "rand.h" #include "sys_math.h" #include "sys_matrix.h" 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 3af854c502..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 @@ -39,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; @@ -71,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_Fhg_Flash/z_eff_ss_fhg_flash.c b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c index 3bdadb99f7..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 @@ -10,6 +10,7 @@ #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" @@ -54,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; @@ -110,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_G_Magma2/z_eff_ss_g_magma2.c b/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c index 9ee5cbe831..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 @@ -53,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; @@ -92,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_Ice_Smoke/z_eff_ss_ice_smoke.c b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c index 5c1b5fc164..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 @@ -8,6 +8,7 @@ #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "segmented_address.h" #include "sys_matrix.h" #include "z_lib.h" @@ -39,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); @@ -75,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_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/gamestates/ovl_file_choose/z_file_choose.c b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index 4517fc7e72..c3d9302ee8 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -5,13 +5,15 @@ #include "controller.h" #include "gfx.h" #include "gfx_setupdl.h" +#include "language_array.h" #include "letterbox.h" -#include "macros.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" @@ -31,8 +33,6 @@ #include "z64ss_sram.h" #include "z64view.h" -#include "global.h" - #if OOT_PAL_N64 #include "assets/objects/object_mag/object_mag.h" #endif 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 4cb4fa5c85..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 @@ -2,14 +2,13 @@ #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" -#include "macros.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 2c1e49fb59..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,9 +1,12 @@ #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" @@ -13,9 +16,6 @@ #include "z64audio.h" #include "z64save.h" -#include "macros.h" -#include "global.h" - #include "assets/textures/title_static/title_static.h" #include "assets/overlays/ovl_file_choose/ovl_file_choose.h" @@ -1369,7 +1369,7 @@ void FileSelect_UpdateOptionsMenu(GameState* thisx) { PRINTF("Na_SetSoundOutputMode = %d\n", gSaveContext.soundSetting); PRINTF("Na_SetSoundOutputMode = %d\n", gSaveContext.soundSetting); PRINTF_RST(); - Audio_SetSoundMode(gSaveContext.soundSetting); + Audio_SetSoundOutputMode(gSaveContext.soundSetting); PRINTF("終了\n"); return; } diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index 633986cd66..84b1cb69ae 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -6,8 +6,8 @@ #include "libc64/qrand.h" #include "libu64/gfxprint.h" -#include "ultra64.h" #include "alloca.h" +#include "array_count.h" #include "console_logo_state.h" #include "controller.h" #include "gfx.h" @@ -16,18 +16,19 @@ #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" -#include "macros.h" - void MapSelect_LoadTitle(MapSelectState* this) { this->state.running = false; SET_NEXT_GAMESTATE(&this->state, ConsoleLogo_Init, ConsoleLogoState); diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index 175c43f9ea..588588b243 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -11,10 +11,12 @@ #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" @@ -27,8 +29,6 @@ #include "z64environment.h" #include "z64save.h" -#include "global.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 4690ccade8..2f086413bc 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c @@ -1,15 +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 "global.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 3339bc3250..a8433e9f2e 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c @@ -5,6 +5,7 @@ #include "gfx.h" #include "gfx_setupdl.h" #include "gfxalloc.h" +#include "printf.h" #include "z64play.h" #include "z64save.h" 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 8a8b627995..75c942820d 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c @@ -3,6 +3,7 @@ #include "controller.h" #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "regs.h" #include "sfx.h" #include "z64play.h" @@ -124,8 +125,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; @@ -591,8 +594,12 @@ void KaleidoScope_DrawEquipment(PlayState* play) { } if ((pauseCtx->mainState == PAUSE_MAIN_STATE_7) && (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 e76c6a7cea..97458d024f 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c @@ -4,6 +4,7 @@ #include "controller.h" #include "gfx.h" #include "gfx_setupdl.h" +#include "printf.h" #include "regs.h" #include "sfx.h" #include "z64play.h" 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 09a85cb039..c090b77fb9 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.c @@ -2,7 +2,9 @@ #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" @@ -10,8 +12,6 @@ #include "z64play.h" #include "z64save.h" -#include "global.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_scope.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c index 5c0bfab0d3..2e4bda50cb 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c @@ -1,13 +1,17 @@ #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 "printf.h" #include "regs.h" #include "segment_symbols.h" #include "segmented_address.h" @@ -23,8 +27,6 @@ #include "z64player.h" #include "z64save.h" -#include "global.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 @@ -37,7 +39,8 @@ #endif #include "assets/textures/icon_item_gameover_static/icon_item_gameover_static.h" -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 ntsc-1.0:0 ntsc-1.1:128 ntsc-1.2:128 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" \ + "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 @@ -3660,7 +3663,7 @@ void KaleidoScope_Update(PlayState* play) { DMA_REQUEST_SYNC(pauseCtx->iconItemSegment, (uintptr_t)_icon_item_staticSegmentRomStart, size0, "../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 5a99234432..27454ee1f7 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h @@ -184,7 +184,9 @@ Gfx* KaleidoScope_QuadTextureIA4(Gfx* gfx, void* texture, s16 width, s16 height, Gfx* KaleidoScope_QuadTextureIA8(Gfx* gfx, void* texture, s16 width, s16 height, u16 point); void KaleidoScope_MoveCursorToSpecialPos(struct PlayState* play, u16 specialPos); void KaleidoScope_DrawQuadTextureRGBA32(GraphicsContext* gfxCtx, void* texture, u16 width, u16 height, u16 point); -void KaleidoScope_ProcessPlayerPreRender(); +#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); 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 126ceca4f1..ec2c566ece 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c @@ -7,8 +7,6 @@ #include "z_lib.h" #include "z64play.h" -#include "global.h" - #include "assets/textures/parameter_static/parameter_static.h" typedef struct PauseMapMarkInfo { diff --git a/sym_info.py b/sym_info.py index 301e80110f..0b8936bb54 100755 --- a/sym_info.py +++ b/sym_info.py @@ -6,11 +6,13 @@ 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 @@ -228,9 +230,13 @@ def find_symbols_by_name( return infos -def print_map_file(map_file: mapfile_parser.mapfile.MapFile): +def print_map_file(map_file: mapfile_parser.mapfile.MapFile, *, colors: bool): for segment in map_file: - print(f"{segment.name}") + 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 ( @@ -239,7 +245,11 @@ def print_map_file(map_file: mapfile_parser.mapfile.MapFile): or file.sectionType.startswith(".mdebug") ): continue - print(f" {file.asStr()}") + 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: @@ -265,6 +275,12 @@ def sym_info_main(): 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", @@ -275,6 +291,17 @@ def sym_info_main(): 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" @@ -301,7 +328,7 @@ def sym_info_main(): sym_name = args.symname if sym_name is None: - print_map_file(map_file) + print_map_file(map_file, colors=colors) sys.exit(0) infos: list[mapfile_parser.mapfile.FoundSymbolInfo] = [] diff --git a/tools/assets/extract/extase/__init__.py b/tools/assets/extract/extase/__init__.py index 87579edf18..9320879c48 100644 --- a/tools/assets/extract/extase/__init__.py +++ b/tools/assets/extract/extase/__init__.py @@ -645,9 +645,7 @@ class File: headers_includes = ( '#include "ultra64.h"\n', '#include "z64.h"\n', - '#include "macros.h"\n', '#include "segment_symbols.h"\n', - '#include "variables.h"\n', ) # Paths to files to be included 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/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 61cb4985d8..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] @@ -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,12 +456,10 @@ 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 @@ -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)