1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-05-09 18:43:45 +00:00

Merge remote-tracking branch 'upstream/main' into meta_new_assets_2025

This commit is contained in:
Dragorn421 2025-05-06 18:26:20 +02:00
commit 877d867fa8
No known key found for this signature in database
GPG key ID: 381AEBAF3D429335
644 changed files with 2946 additions and 1682 deletions

View file

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

View file

@ -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`.

8
include/array_count.h Normal file
View file

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

View file

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

13
include/avoid_ub.h Normal file
View file

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

View file

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

8
include/build.h Normal file
View file

@ -0,0 +1,8 @@
#ifndef BUILD_H
#define BUILD_H
extern const char gBuildCreator[];
extern const char gBuildDate[];
extern const char gBuildMakeOption[];
#endif

8
include/carthandle.h Normal file
View file

@ -0,0 +1,8 @@
#ifndef CARTHANDLE_H
#define CARTHANDLE_H
#include "ultra64.h"
extern OSPiHandle* gCartHandle;
#endif

View file

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

View file

@ -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);

8
include/flag_set.h Normal file
View file

@ -0,0 +1,8 @@
#ifndef FLAG_SET_H
#define FLAG_SET_H
struct PlayState;
void FlagSet_Update(struct PlayState* play);
#endif

View file

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

View file

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

View file

@ -1,9 +0,0 @@
#ifndef GLOBAL_H
#define GLOBAL_H
#include "functions.h"
#include "variables.h"
#include "macros.h"
#include "versions.h"
#endif

12
include/idle.h Normal file
View file

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

10
include/inflate.h Normal file
View file

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

18
include/is_debug.h Normal file
View file

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

12
include/language_array.h Normal file
View file

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

View file

@ -32,5 +32,6 @@ void SystemArena_Display(void);
#endif
extern Arena gSystemArena;
extern s32 gSystemArenaLogSeverity;
#endif

View file

@ -0,0 +1,6 @@
#ifndef LIBU64_RCP_UTILS_H
#define LIBU64_RCP_UTILS_H
void RcpUtils_Reset(void);
#endif

8
include/libu64/runtime.h Normal file
View file

@ -0,0 +1,8 @@
#ifndef LIBU64_RUNTIME_H
#define LIBU64_RUNTIME_H
#include "ultra64.h"
void Runtime_Init(void* start, u32 size);
#endif

View file

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

View file

@ -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);

9
include/memory_utils.h Normal file
View file

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

8
include/mio0.h Normal file
View file

@ -0,0 +1,8 @@
#ifndef MIO0_H
#define MIO0_H
#include "ultra64.h"
void Mio0_Decompress(u8* src, u8* dst);
#endif

View file

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

51
include/printf.h Normal file
View file

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

View file

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

View file

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

View file

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

View file

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

10
include/sys_cfb.h Normal file
View file

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

View file

@ -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);

View file

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

24
include/transition_fade.h Normal file
View file

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

30
include/transition_tile.h Normal file
View file

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

View file

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

30
include/transition_wipe.h Normal file
View file

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

16
include/translation.h Normal file
View file

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

View file

@ -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);

View file

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

View file

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

View file

@ -1,6 +1,8 @@
#ifndef GS2DEX_H
#define GS2DEX_H
#include "ultratypes.h"
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif

8
include/ultra64/os_pi.h Normal file
View file

@ -0,0 +1,8 @@
#ifndef ULTRA64_OS_PI_H
#define ULTRA64_OS_PI_H
#include "pi.h"
extern OSPiHandle* __osPiTable;
#endif

View file

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

11
include/ultra64/os_vi.h Normal file
View file

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

22
include/ultra64/osint.h Normal file
View file

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

11
include/ultra64/piint.h Normal file
View file

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

8
include/ultra64/siint.h Normal file
View file

@ -0,0 +1,8 @@
#ifndef ULTRA64_SIINT_H
#define ULTRA64_SIINT_H
#include "pfs.h"
extern u8 __osPfsInodeCacheBank;
#endif

View file

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

View file

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

View file

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

10
include/yaz0.h Normal file
View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -203,4 +203,6 @@ void Message_Update(struct PlayState* play);
void Message_SetTables(void);
void Message_Init(struct PlayState* play);
extern s16 gOcarinaSongItemMap[];
#endif

View file

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

View file

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

View file

@ -4,6 +4,7 @@
#include "ultra64.h"
#include "prerender.h"
#include "transition_tile.h"
#include "z64actor.h"
#include "z64bgcheck.h"
#include "z64camera.h"

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
#ifndef Z64VIEW_H
#define Z64VIEW_H
#include "macros.h"
#include "avoid_ub.h"
#include "ultra64.h"
#include "z64math.h"

View file

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

View file

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

View file

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

View file

@ -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]);

View file

@ -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);
}
}

View file

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

View file

@ -1,4 +1,4 @@
#include "global.h"
#include "z64audio.h"
AudioContext gAudioCtx;
AudioCustomUpdateFunction gAudioCustomUpdateFunction;

View file

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

View file

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

View file

@ -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) \

View file

@ -1,4 +1,6 @@
#include "global.h"
#include "alignment.h"
#include "ultra64.h"
#include "z64audio.h"
// clang-format off
ALIGNED(16) s16 gSawtoothWaveSample[] = {

View file

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

View file

@ -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);

View file

@ -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));
}

View file

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

View file

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

View file

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

View file

@ -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);

View file

@ -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();
}

View file

@ -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);
}

View file

@ -3,7 +3,6 @@
// Symbol definition
extern AudioTable gSampleBankTable;
#pragma weak gSampleBankTable = sSampleBankTableHeader
// Externs for table

View file

@ -4,7 +4,6 @@
// Symbol definition
extern AudioTable gSequenceTable;
#pragma weak gSequenceTable = sSequenceTableHeader
// Externs for table

View file

@ -3,7 +3,6 @@
// Symbol definition
extern AudioTable gSoundFontTable;
#pragma weak gSoundFontTable = sSoundFontTableHeader
// Externs for table

View file

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

View file

@ -1,3 +1,5 @@
#include "build.h"
#include "versions.h"
const char gBuildCreator[] = BUILD_CREATOR;

View file

@ -1,3 +1,3 @@
#include "ultra64.h"
#include "carthandle.h"
OSPiHandle* gCartHandle = NULL;

View file

@ -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);

View file

@ -1,4 +1,4 @@
#include "global.h"
#include "ultra64.h"
OSPiHandle __DriveRomHandle;

View file

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

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