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

Merge branch 'main' into save_flags_redo

This commit is contained in:
mzxrules 2025-01-22 16:36:30 -05:00
commit 02e8382a55
287 changed files with 27665 additions and 16105 deletions

View file

@ -1,6 +1,6 @@
Checks: '-*,readability-braces-around-statements,readability-inconsistent-declaration-parameter-name'
WarningsAsErrors: ''
HeaderFilterRegex: '(src|include)\/.*\.h$'
HeaderFilterRegex: '(src|include)\/.*(\.h|\.inc\.c)$'
FormatStyle: 'file'
CheckOptions:
# Require argument names to match exactly (instead of allowing a name to be a prefix/suffix of another)

191
Makefile
View file

@ -57,11 +57,6 @@ N64_EMULATOR ?=
# This may also be used to disable debug features on debug ROMs by setting DEBUG_FEATURES to 0
# DEBUG_FEATURES ?= 1
CFLAGS ?=
CCASFLAGS ?=
CPPFLAGS ?=
CPP_DEFINES ?=
# Version-specific settings
REGIONAL_CHECKSUM := 0
ifeq ($(VERSION),ntsc-1.0)
@ -209,7 +204,6 @@ EXTRACTED_DIR := extracted/$(VERSION)
VENV := .venv
MAKE = make
CPPFLAGS += -P -xc -fno-dollars-in-identifiers
ifeq ($(PLATFORM),N64)
CPP_DEFINES += -DPLATFORM_N64=1 -DPLATFORM_GC=0 -DPLATFORM_IQUE=0
@ -231,9 +225,11 @@ endif
VERSION_MACRO := $(shell echo $(VERSION) | tr a-z-. A-Z__)
CPP_DEFINES += -DOOT_VERSION=$(VERSION_MACRO) -DOOT_REVISION=$(REVISION)
CPP_DEFINES += -DOOT_REGION=REGION_$(REGION)
CPP_DEFINES += -DBUILD_CREATOR="\"$(BUILD_CREATOR)\"" -DBUILD_DATE="\"$(BUILD_DATE)\"" -DBUILD_TIME="\"$(BUILD_TIME)\""
CPP_DEFINES += -DLIBULTRA_VERSION=LIBULTRA_VERSION_$(LIBULTRA_VERSION)
CPP_DEFINES += -DLIBULTRA_PATCH=$(LIBULTRA_PATCH)
ifeq ($(PLATFORM),IQUE)
CPP_DEFINES += -DBBPLAYER
endif
ifeq ($(DEBUG_FEATURES),1)
CPP_DEFINES += -DDEBUG_FEATURES=1
@ -287,6 +283,11 @@ ifeq ($(ORIG_COMPILER),1)
CCAS := $(CC)
endif
# EGCS Compiler
EGCS_PREFIX := tools/egcs/$(DETECTED_OS)/
EGCS_CC := $(EGCS_PREFIX)gcc -B $(EGCS_PREFIX)
EGCS_CCAS := $(EGCS_CC) -x assembler-with-cpp
AS := $(MIPS_BINUTILS_PREFIX)as
LD := $(MIPS_BINUTILS_PREFIX)ld
OBJCOPY := $(MIPS_BINUTILS_PREFIX)objcopy
@ -294,6 +295,12 @@ OBJDUMP := $(MIPS_BINUTILS_PREFIX)objdump
NM := $(MIPS_BINUTILS_PREFIX)nm
STRIP := $(MIPS_BINUTILS_PREFIX)strip
# Command prefix to preprocess a file before running the compiler
PREPROCESS :=
# Command to patch certain object files after they are built
POSTPROCESS_OBJ := @:
# The default iconv on macOS has some differences from GNU iconv, so we use the Homebrew version instead
ifeq ($(UNAME_S),Darwin)
ICONV := $(shell brew --prefix)/opt/libiconv/bin/iconv
@ -335,10 +342,6 @@ SEQ_CPPFLAGS := -D_LANGUAGE_ASEQ -DMML_VERSION=MML_VERSION_OOT $(CPP_DEFINES) -
SBCFLAGS := --matching
SFCFLAGS := --matching
CFLAGS += $(CPP_DEFINES)
CCASFLAGS := $(CPP_DEFINES)
CPPFLAGS += $(CPP_DEFINES)
# Extra debugging steps
ifeq ($(DEBUG_OBJECTS),1)
OBJDUMP_CMD = @$(OBJDUMP) $(OBJDUMP_FLAGS) $@ > $(@:.o=.s)
@ -360,21 +363,24 @@ ifeq ($(DEBUG_FEATURES),1)
GBI_DEFINES += -DGBI_DEBUG
endif
CFLAGS += $(GBI_DEFINES)
ASFLAGS := -march=vr4300 -32 -no-pad-sections -Iinclude -I$(EXTRACTED_DIR)
CPPFLAGS += -P -xc -fno-dollars-in-identifiers $(CPP_DEFINES)
ASFLAGS += -march=vr4300 -32 -no-pad-sections -Iinclude -I$(EXTRACTED_DIR)
ifeq ($(COMPILER),gcc)
CFLAGS += -G 0 -nostdinc $(INC) -march=vr4300 -mfix4300 -mabi=32 -mno-abicalls -mdivide-breaks -fno-PIC -fno-common -ffreestanding -fbuiltin -fno-builtin-sinf -fno-builtin-cosf $(CHECK_WARNINGS) -funsigned-char
CCASFLAGS += -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 $(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
MIPS_VERSION := -mips3
else
# Suppress warnings for wrong number of macro arguments (to fake variadic
# macros) and Microsoft extensions such as anonymous structs (which the
# compiler does support but warns for their usage).
CFLAGS += -G 0 -non_shared -fullwarn -verbose -Xcpluscomm $(INC) -Wab,-r4300_mul -woff 516,609,649,838,712,807
CCASFLAGS += -G 0 -non_shared -fullwarn -verbose -Xcpluscomm $(INC) -Wab,-r4300_mul -woff 516,609,649,838,712,807 -o32
CFLAGS += $(CPP_DEFINES) $(GBI_DEFINES) -G 0 -non_shared -fullwarn -verbose -Xcpluscomm $(INC) -Wab,-r4300_mul -woff 516,609,649,838,712,807
CCASFLAGS += $(CPP_DEFINES) $(GBI_DEFINES) -G 0 -non_shared -fullwarn -verbose -Xcpluscomm $(INC) -Wab,-r4300_mul -woff 516,609,649,838,712,807 -o32
MIPS_VERSION := -mips2
EGCS_CFLAGS += $(CPP_DEFINES) $(GBI_DEFINES) -DEGCS -G 0 -nostdinc $(INC) -mcpu=vr4300 -mabi=32 -mgp32 -mfp32 -fno-PIC
EGCS_CCASFLAGS := -Wall -nostdinc $(CPP_DEFINES) -DEGCS $(INC) -c -G 0 -Wa,-irix-symtab -D_ABIO32=1 -D_ABI64=3 -D_MIPS_SIM_ABI64=_ABI64 -D_MIPS_SIM_ABI32=_ABIO32 -DMIPSEB -D_LANGUAGE_ASSEMBLY -mabi=32 -fno-PIC -non_shared -mcpu=4300 -mfix4300
EGCS_ASOPTFLAGS :=
endif
ifeq ($(COMPILER),ido)
@ -402,14 +408,13 @@ ROMC := $(ROM:.z64=-compressed.z64)
ELF := $(ROM:.z64=.elf)
MAP := $(ROM:.z64=.map)
LDSCRIPT := $(ROM:.z64=.ld)
# description of ROM segments
SPEC := spec
SPEC_INCLUDES := $(wildcard spec_includes/*.inc)
ifeq ($(COMPILER),ido)
SRC_DIRS := $(shell find src -type d -not -path src/gcc_fix)
else
SRC_DIRS := $(shell find src -type d)
endif
UNDECOMPILED_DATA_DIRS := $(shell find data -type d)
ifneq ($(wildcard $(EXTRACTED_DIR)/assets/audio),)
SAMPLE_EXTRACT_DIRS := $(shell find $(EXTRACTED_DIR)/assets/audio/samples -type d)
@ -485,33 +490,19 @@ ASSET_BIN_DIRS := $(ASSET_BIN_DIRS_EXTRACTED) $(ASSET_BIN_DIRS_COMMITTED)
ASSET_FILES_BIN_EXTRACTED := $(foreach dir,$(ASSET_BIN_DIRS_EXTRACTED),$(wildcard $(dir)/*.bin))
ASSET_FILES_BIN_COMMITTED := $(foreach dir,$(ASSET_BIN_DIRS_COMMITTED),$(wildcard $(dir)/*.bin))
ASSET_FILES_OUT := $(foreach f,$(ASSET_FILES_BIN_EXTRACTED:.bin=.bin.inc.c),$(f:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%)) \
$(foreach f,$(ASSET_FILES_BIN_COMMITTED:.bin=.bin.inc.c),$(BUILD_DIR)/$f) \
$(foreach f,$(wildcard assets/text/*.c),$(BUILD_DIR)/$(f:.c=.o))
$(foreach f,$(ASSET_FILES_BIN_COMMITTED:.bin=.bin.inc.c),$(BUILD_DIR)/$f)
UNDECOMPILED_DATA_DIRS := $(shell find data -type d)
# Find all .o files included in the spec
SPEC_O_FILES := $(shell $(CPP) $(CPPFLAGS) $(SPEC) | $(BUILD_DIR_REPLACE) | sed -n -E 's/^[ \t]*include[ \t]*"([a-zA-Z0-9/_.-]+\.o)"/\1/p')
BASEROM_BIN_FILES := $(wildcard $(EXTRACTED_DIR)/baserom/*)
# source files
ASSET_C_FILES_EXTRACTED := $(filter-out %.inc.c,$(foreach dir,$(ASSET_BIN_DIRS_EXTRACTED),$(wildcard $(dir)/*.c)))
ASSET_C_FILES_COMMITTED := $(filter-out %.inc.c,$(foreach dir,$(ASSET_BIN_DIRS_COMMITTED),$(wildcard $(dir)/*.c)))
SRC_C_FILES := $(filter-out %.inc.c,$(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c)))
S_FILES := $(foreach dir,$(SRC_DIRS) $(UNDECOMPILED_DATA_DIRS),$(wildcard $(dir)/*.s))
O_FILES := $(foreach f,$(S_FILES:.s=.o),$(BUILD_DIR)/$f) \
$(foreach f,$(SRC_C_FILES:.c=.o),$(BUILD_DIR)/$f) \
$(foreach f,$(ASSET_C_FILES_EXTRACTED:.c=.o),$(f:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%)) \
$(foreach f,$(ASSET_C_FILES_COMMITTED:.c=.o),$(BUILD_DIR)/$f) \
$(foreach f,$(BASEROM_BIN_FILES),$(BUILD_DIR)/baserom/$(notdir $f).o) \
$(BUILD_DIR)/src/code/z_message_z_game_over.o \
$(BUILD_DIR)/src/makerom/ipl3.o
OVL_RELOC_FILES := $(shell $(CPP) $(CPPFLAGS) $(SPEC) | $(BUILD_DIR_REPLACE) | grep -o '[^"]*_reloc.o' )
# Split out reloc files
O_FILES := $(filter-out %_reloc.o,$(SPEC_O_FILES))
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)
TEXTURE_FILES_PNG_EXTRACTED := $(foreach dir,$(ASSET_BIN_DIRS_EXTRACTED),$(wildcard $(dir)/*.png))
TEXTURE_FILES_PNG_COMMITTED := $(foreach dir,$(ASSET_BIN_DIRS_COMMITTED),$(wildcard $(dir)/*.png))
TEXTURE_FILES_JPG_EXTRACTED := $(foreach dir,$(ASSET_BIN_DIRS_EXTRACTED),$(wildcard $(dir)/*.jpg))
@ -523,7 +514,8 @@ TEXTURE_FILES_OUT := $(foreach f,$(TEXTURE_FILES_PNG_EXTRACTED:.png=.inc.c),$(f:
# create build directories
$(shell mkdir -p $(BUILD_DIR)/baserom \
$(BUILD_DIR)/assets/text)
$(BUILD_DIR)/assets/text \
$(BUILD_DIR)/linker_scripts)
$(shell mkdir -p $(foreach dir, \
$(SRC_DIRS) \
$(UNDECOMPILED_DATA_DIRS) \
@ -543,9 +535,20 @@ $(shell mkdir -p $(foreach dir, \
$(dir:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%)))
endif
$(BUILD_DIR)/src/boot/build.o: CPP_DEFINES += -DBUILD_CREATOR="\"$(BUILD_CREATOR)\"" -DBUILD_DATE="\"$(BUILD_DATE)\"" -DBUILD_TIME="\"$(BUILD_TIME)\""
ifeq ($(COMPILER),ido)
$(BUILD_DIR)/src/boot/driverominit.o: OPTFLAGS := -O2
ifeq ($(PLATFORM),IQUE)
# iQue's driverominit.o seems to have been patched manually. For non-matching builds we edit the source code instead.
ifneq ($(NON_MATCHING),1)
$(BUILD_DIR)/src/boot/driverominit.o: POSTPROCESS_OBJ := $(PYTHON) tools/patch_ique_driverominit.py
endif
$(BUILD_DIR)/src/boot/viconfig.o: OPTFLAGS := -O2
endif
$(BUILD_DIR)/src/code/jpegutils.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/code/jpegdecoder.o: OPTFLAGS := -O2
@ -564,7 +567,43 @@ endif
$(BUILD_DIR)/src/code/jpegutils.o: CC := $(CC_OLD)
$(BUILD_DIR)/src/code/jpegdecoder.o: CC := $(CC_OLD)
ifeq ($(DEBUG_FEATURES),1)
ifeq ($(PLATFORM),IQUE)
# Some files are compiled with EGCS on iQue
EGCS_O_FILES += $(BUILD_DIR)/src/boot/boot_main.o
EGCS_O_FILES += $(BUILD_DIR)/src/boot/idle.o
EGCS_O_FILES += $(BUILD_DIR)/src/boot/inflate.o
EGCS_O_FILES += $(BUILD_DIR)/src/boot/is_debug_ique.o
EGCS_O_FILES += $(BUILD_DIR)/src/boot/z_locale.o
EGCS_O_FILES += $(BUILD_DIR)/src/boot/z_std_dma.o
EGCS_O_FILES += $(BUILD_DIR)/src/code/z_actor.o
EGCS_O_FILES += $(BUILD_DIR)/src/code/z_common_data.o
EGCS_O_FILES += $(BUILD_DIR)/src/code/z_construct.o
EGCS_O_FILES += $(BUILD_DIR)/src/code/z_kanfont.o
# EGCS_O_FILES += $(BUILD_DIR)/src/code/z_message.o
EGCS_O_FILES += $(BUILD_DIR)/src/code/z_parameter.o
EGCS_O_FILES += $(BUILD_DIR)/src/code/z_sram.o
EGCS_O_FILES += $(BUILD_DIR)/src/overlays/actors/ovl_En_Mag/z_en_mag.o
EGCS_O_FILES += $(BUILD_DIR)/src/overlays/actors/ovl_End_Title/z_end_title.o
EGCS_O_FILES += $(BUILD_DIR)/src/overlays/actors/ovl_Fishing/z_fishing.o
# EGCS_O_FILES += $(BUILD_DIR)/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.o
EGCS_O_FILES += $(BUILD_DIR)/src/overlays/gamestates/ovl_opening/z_opening.o
EGCS_O_FILES += $(BUILD_DIR)/src/overlays/gamestates/ovl_title/z_title.o
EGCS_O_FILES += $(BUILD_DIR)/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map.o
EGCS_O_FILES += $(BUILD_DIR)/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.o
$(EGCS_O_FILES): CC := $(EGCS_CC)
$(EGCS_O_FILES): CFLAGS := $(EGCS_CFLAGS) -mno-abicalls
$(EGCS_O_FILES): MIPS_VERSION :=
endif
ifeq ($(PLATFORM),IQUE)
$(BUILD_DIR)/src/libc/%.o: CC := $(EGCS_CC)
$(BUILD_DIR)/src/libc/%.o: CCAS := $(EGCS_CCAS)
$(BUILD_DIR)/src/libc/%.o: CFLAGS := $(EGCS_CFLAGS) -mno-abicalls
$(BUILD_DIR)/src/libc/%.o: CCASFLAGS := $(EGCS_CCASFLAGS)
$(BUILD_DIR)/src/libc/%.o: OPTFLAGS := -O1
$(BUILD_DIR)/src/libc/%.o: MIPS_VERSION :=
else ifeq ($(DEBUG_FEATURES),1)
$(BUILD_DIR)/src/libc/%.o: OPTFLAGS := -g
$(BUILD_DIR)/src/libc/%.o: ASOPTFLAGS := -g
else
@ -589,14 +628,40 @@ endif
$(BUILD_DIR)/src/audio/sfx.o: CFLAGS += -use_readwrite_const
$(BUILD_DIR)/src/audio/sequence.o: CFLAGS += -use_readwrite_const
ifeq ($(PLATFORM),IQUE)
$(BUILD_DIR)/src/libultra/%.o: CC := $(EGCS_CC)
$(BUILD_DIR)/src/libultra/%.o: CCAS := $(EGCS_CCAS)
$(BUILD_DIR)/src/libultra/%.o: CFLAGS := $(EGCS_CFLAGS) -mno-abicalls
$(BUILD_DIR)/src/libultra/%.o: CCASFLAGS := $(EGCS_CCASFLAGS)
$(BUILD_DIR)/src/libultra/%.o: ASOPTFLAGS := $(EGCS_ASOPTFLAGS)
$(BUILD_DIR)/src/libultra/reg/_%.o: OPTFLAGS := -O0
$(BUILD_DIR)/src/libultra/reg/_%.o: MIPS_VERSION := -mgp64 -mfp64 -mips3
$(BUILD_DIR)/src/libultra/audio/%.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/libultra/libc/ll.o: OPTFLAGS := -O0
$(BUILD_DIR)/src/libultra/libc/llcvt.o: OPTFLAGS := -O0
$(BUILD_DIR)/src/libultra/os/exceptasm.o: MIPS_VERSION := -mips3
$(BUILD_DIR)/src/libultra/os/invaldcache.o: MIPS_VERSION := -mips3
$(BUILD_DIR)/src/libultra/os/invalicache.o: MIPS_VERSION := -mips3
$(BUILD_DIR)/src/libultra/os/writebackdcache.o: MIPS_VERSION := -mips3
$(BUILD_DIR)/src/libultra/os/writebackdcacheall.o: MIPS_VERSION := -mips3
else
$(BUILD_DIR)/src/libultra/%.o: CC := $(CC_OLD)
$(BUILD_DIR)/src/libultra/libc/ll.o: OPTFLAGS := -O1
$(BUILD_DIR)/src/libultra/libc/ll.o: MIPS_VERSION := -mips3 -32
$(BUILD_DIR)/src/libultra/libc/ll.o: POSTPROCESS_OBJ := $(PYTHON) tools/set_o32abi_bit.py
$(BUILD_DIR)/src/libultra/libc/llcvt.o: OPTFLAGS := -O1
$(BUILD_DIR)/src/libultra/libc/llcvt.o: MIPS_VERSION := -mips3 -32
$(BUILD_DIR)/src/libultra/libc/llcvt.o: POSTPROCESS_OBJ := $(PYTHON) tools/set_o32abi_bit.py
$(BUILD_DIR)/src/libultra/os/exceptasm.o: MIPS_VERSION := -mips3 -32
$(BUILD_DIR)/src/libultra/os/exceptasm.o: POSTPROCESS_OBJ := $(PYTHON) tools/set_o32abi_bit.py
endif
$(BUILD_DIR)/src/code/%.o: ASOPTFLAGS := -O2
$(BUILD_DIR)/src/libleo/%.o: ASOPTFLAGS := -O2
@ -642,20 +707,32 @@ else
$(BUILD_DIR)/src/libultra/gu/%.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/libultra/io/%.o: OPTFLAGS := -O2
$(BUILD_DIR)/src/libultra/libc/%.o: OPTFLAGS := -O2
ifeq ($(PLATFORM),IQUE)
$(BUILD_DIR)/src/libultra/os/%.o: OPTFLAGS := -O0
else
$(BUILD_DIR)/src/libultra/os/%.o: OPTFLAGS := -O1
endif
endif
$(BUILD_DIR)/src/libleo/%.o: CC := $(CC_OLD)
$(BUILD_DIR)/src/libleo/%.o: OPTFLAGS := -O2
ifeq ($(PLATFORM),IQUE)
$(BUILD_DIR)/src/libgcc/%.o: CC := $(EGCS_CC)
$(BUILD_DIR)/src/libgcc/%.o: CFLAGS := $(EGCS_CFLAGS)
endif
$(BUILD_DIR)/assets/misc/z_select_static/%.o: GBI_DEFINES := -DF3DEX_GBI
# For using asm_processor on some files:
#$(BUILD_DIR)/.../%.o: CC := $(PYTHON) tools/asm_processor/build.py $(CC) -- $(AS) $(ASFLAGS) --
ifeq ($(PLATFORM),IQUE)
$(BUILD_DIR)/src/makerom/%.o: CCAS := $(EGCS_CCAS)
$(BUILD_DIR)/src/makerom/%.o: CCASFLAGS := $(EGCS_CCASFLAGS)
$(BUILD_DIR)/src/makerom/%.o: ASOPTFLAGS := $(EGCS_ASOPTFLAGS)
endif
ifeq ($(PERMUTER),) # permuter + preprocess.py misbehaves, permuter doesn't care about rodata diffs or bss ordering so just don't use it in that case
# Handle encoding (UTF-8 -> EUC-JP) and custom pragmas
$(BUILD_DIR)/src/%.o: CC := ./tools/preprocess.sh -v $(VERSION) -i $(ICONV) -- $(CC)
$(BUILD_DIR)/src/%.o: PREPROCESS := ./tools/preprocess.sh -v $(VERSION) -i $(ICONV) --
endif
else
@ -666,11 +743,6 @@ $(BUILD_DIR)/src/libultra/libc/ll.o: OPTFLAGS := -Ofast
$(BUILD_DIR)/src/overlays/%.o: CFLAGS += -fno-merge-constants -mno-explicit-relocs -mno-split-addresses
endif
SET_ABI_BIT = @:
$(BUILD_DIR)/src/libultra/os/exceptasm.o: SET_ABI_BIT = $(PYTHON) tools/set_o32abi_bit.py $@
$(BUILD_DIR)/src/libultra/libc/ll.o: SET_ABI_BIT = $(PYTHON) tools/set_o32abi_bit.py $@
$(BUILD_DIR)/src/libultra/libc/llcvt.o: SET_ABI_BIT = $(PYTHON) tools/set_o32abi_bit.py $@
#### Main Targets ###
all: rom compress
@ -753,10 +825,13 @@ $(ROMC): $(ROM) $(ELF) $(BUILD_DIR)/compress_ranges.txt
$(PYTHON) tools/compress.py --in $(ROM) --out $@ --dmadata-start `./tools/dmadata_start.sh $(NM) $(ELF)` --compress `cat $(BUILD_DIR)/compress_ranges.txt` --threads $(N_THREADS) $(COMPRESS_ARGS)
$(PYTHON) -m ipl3checksum sum --cic $(CIC) --update $@
$(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(O_FILES) $(OVL_RELOC_FILES) $(LDSCRIPT) $(BUILD_DIR)/undefined_syms.txt \
$(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(O_FILES) $(OVL_RELOC_FILES) $(LDSCRIPT) $(BUILD_DIR)/linker_scripts/makerom.ld $(BUILD_DIR)/undefined_syms.txt \
$(SAMPLEBANK_O_FILES) $(SOUNDFONT_O_FILES) $(SEQUENCE_O_FILES) \
$(BUILD_DIR)/assets/audio/sequence_font_table.o $(BUILD_DIR)/assets/audio/audiobank_padding.o
$(LD) -T $(LDSCRIPT) -T $(BUILD_DIR)/undefined_syms.txt --no-check-sections --accept-unknown-input-arch --emit-relocs -Map $(MAP) -o $@
$(LD) -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) -o $@
$(BUILD_DIR)/linker_scripts/makerom.ld: linker_scripts/makerom.ld
$(CPP) -I include $(CPPFLAGS) $< > $@
## Order-only prerequisites
# These ensure e.g. the O_FILES are built before the OVL_RELOC_FILES.
@ -770,7 +845,7 @@ $(O_FILES): | asset_files
.PHONY: o_files asset_files
$(BUILD_DIR)/$(SPEC): $(SPEC)
$(BUILD_DIR)/$(SPEC): $(SPEC) $(SPEC_INCLUDES)
$(CPP) $(CPPFLAGS) $< | $(BUILD_DIR_REPLACE) > $@
$(LDSCRIPT): $(BUILD_DIR)/$(SPEC)
@ -844,10 +919,10 @@ ifeq ($(COMPILER),ido)
# 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) $@
$(SET_ABI_BIT)
else
$(CCAS) -c $(CCASFLAGS) $(MIPS_VERSION) $(ASOPTFLAGS) -o $@ $<
endif
$(POSTPROCESS_OBJ) $@
$(OBJDUMP_CMD)
# Incremental link to move z_message and z_game_over data into rodata
@ -877,8 +952,8 @@ $(BUILD_DIR)/src/%.o: src/%.c
ifneq ($(RUN_CC_CHECK),0)
$(CC_CHECK) $<
endif
$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
$(SET_ABI_BIT)
$(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

View file

@ -1,45 +1,45 @@
dmadata_start: 0xB7A0
text_lang: CN
incbins: # TODO: fix these
incbins:
- name: ipl3
segment: makerom
vram: 0x80000040
size: 0xFC0
- name: rspbootText
segment: boot
vram: 0x800065C0
size: 0x160
vram: 0x80009C30
size: 0xD0
- name: aspMainText
segment: code
vram: 0x800E3600
vram: 0x800EBF70
size: 0xFB0
- name: gspF3DZEX2_NoN_PosLight_fifoText
segment: code
vram: 0x800E45B0
size: 0x1390
- name: gspS2DEX2d_fifoText
segment: code
vram: 0x800E5940
vram: 0x800ECF20
size: 0x18C0
- name: njpgdspMainText
segment: code
vram: 0x800E7200
vram: 0x800EE7E0
size: 0xAF0
- name: aspMainData
segment: code
vram: 0x80114990
vram: 0x8011FE20
size: 0x2E0
- name: gspF3DZEX2_NoN_PosLight_fifoText
segment: code
vram: 0x80120100
size: 0x1630
- name: gspF3DZEX2_NoN_PosLight_fifoData
segment: code
vram: 0x80114C70
vram: 0x80121730
size: 0x420
- name: gspS2DEX2d_fifoData
segment: code
vram: 0x80115090
vram: 0x80121B50
size: 0x390
- name: njpgdspMainData
segment: code
vram: 0x80115420
vram: 0x80121EE0
size: 0x60
variables:
gMtxClear: 0x80106980

63
docs/compilers.md Normal file
View file

@ -0,0 +1,63 @@
# Compilers
Ocarina of Time was written mostly in C, compiled to MIPS machine code. For the
N64 and GameCube versions, all code was compiled with the IDO compiler. For the
iQue Player versions, some of the code (namely libultra, and some game files
such as those related to Chinese text) was compiled with the EGCS compiler instead.
## IDO
Ocarina of Time was originally developed on
[Silicon Graphics "Indy"](https://en.wikipedia.org/wiki/SGI_Indy) workstations,
and IDO (IRIS Development Option) was the C compiler toolchain that shipped with
these. Two different versions of IDO were used for Ocarina of Time: IDO 5.3 was
used for some libraries (namely libultra, libleo, and the JPEG library) while
IDO 7.1 was used for the other libraries and all of the "main" game code.
These Silicon Graphics workstations ran the MIPS-based IRIX operating system, so
the original compiler binaries can't run on modern systems. Originally this
project used [qemu-irix](https://github.com/n64decomp/qemu-irix) (now
unmaintained) to run emulate IRIX on modern systems, but nowadays we use the
more lightweight
[ido-static-recomp](https://github.com/decompals/ido-static-recomp) instead.
## EGCS
[EGCS (Experimental/Enhanced GNU Compiler System)](https://en.wikipedia.org/wiki/GNU_Compiler_Collection#EGCS_fork)
was a fork of the GCC compiler. The Linux-based iQue SDK included a patched
version of EGCS release 1.1.2. The original compiler can still run on modern Linux
systems, but we use a
[modified version](https://github.com/decompals/mips-gcc-egcs-2.91.66)
that includes Mac support and a few other minor improvements (such as anonymous
struct/union support).
This version of the EGCS compiler has a bug where code that indexes into an array member can
fail to compile if the array member is at a large (>= 0x8000) offset in a struct. For
example, when run on the source code
```c
struct Foo {
char a[0x8000];
int b[1];
};
int test(struct Foo* foo, int i) {
return foo->b[i];
}
```
the compiler errors with
```
Compiler error: src.c: In function `test':
src.c:8: internal error--unrecognizable insn:
(insn 20 18 22 (set (reg:SI 85)
(plus:SI (reg:SI 81)
(const_int 32768))) -1 (nil)
(nil))
../../gcc/toplev.c:1367: Internal compiler error in function fatal_insn
```
In some recompiled files, the game developers had to modify the code to work
around this bug, for example by storing a pointer to the array in a temporary
variable before indexing into it.

View file

@ -97,8 +97,7 @@ def run_clang_apply_replacements(tmp_dir: str):
def cleanup_whitespace(file: str):
"""
Remove whitespace at the end of lines,
ensure the file ends with an empty line.
Remove whitespace at the end of lines, and ensure all lines end with a newline.
"""
file_p = Path(file)
contents = file_p.read_text(encoding="UTF-8")
@ -108,7 +107,7 @@ def cleanup_whitespace(file: str):
if n_subst != 0:
modified = True
if not contents.endswith("\n"):
if contents and not contents.endswith("\n"):
contents += "\n"
modified = True

View file

@ -8,12 +8,22 @@
#endif
#define UNUSED __attribute__((unused))
#define FALLTHROUGH __attribute__((fallthrough))
#define NORETURN __attribute__((noreturn))
#define NO_REORDER __attribute__((no_reorder))
#define SECTION_DATA __attribute__((section(".data")))
#ifdef __GNUC__
#if __GNUC__ >= 7
#define FALLTHROUGH __attribute__((fallthrough))
#else
#define FALLTHROUGH
#endif
#if defined(__GNUC__) && defined(NON_MATCHING)
#define NORETURN __attribute__((noreturn))
#else
#define NORETURN
#endif
#if defined(__GNUC__) && defined(NON_MATCHING)
#define UNREACHABLE() __builtin_unreachable()
#else
#define UNREACHABLE()

View file

@ -9,10 +9,11 @@ void Main_ThreadEntry(void* arg);
void Idle_ThreadEntry(void* arg);
void ViConfig_UpdateVi(u32 black);
void ViConfig_UpdateBlack(void);
void* Yaz0_FirstDMA(void);
void* Yaz0_NextDMA(u8* curSrcPos);
void Yaz0_DecompressImpl(u8* src, u8* dst);
#if !PLATFORM_IQUE
void Yaz0_Decompress(uintptr_t romStart, u8* dst, size_t size);
#else
void gzip_decompress(uintptr_t romStart, u8* dst, size_t size);
#endif
void Locale_Init(void);
void Locale_ResetRegion(void);
#if DEBUG_FEATURES
@ -73,6 +74,9 @@ void CutsceneFlags_Unset(PlayState* play, s16 flag);
s32 CutsceneFlags_Get(PlayState* play, s16 flag);
s32 Kanji_OffsetFromShiftJIS(s32 character);
#if PLATFORM_IQUE
void Font_LoadCharCHN(Font* font, u16 character, u16 codePointIndex);
#endif
void Font_LoadCharWide(Font* font, u16 character, u16 codePointIndex);
void Font_LoadChar(Font* font, u8 character, u16 codePointIndex);
void Font_LoadMessageBoxIcon(Font* font, u16 icon);

View file

@ -29,7 +29,7 @@ __attribute__((noreturn)) void __assert(const char* assertion, const char* file,
// Static/compile-time assertions
#if !defined(__sgi) && (defined(__GNUC__) || (__STDC_VERSION__ >= 201112L))
#if !defined(__sgi) && (__GNUC__ >= 5 || __STDC_VERSION__ >= 201112L)
# define static_assert(cond, msg) _Static_assert(cond, msg)
#else
# ifndef GLUE

View file

@ -1,16 +1,7 @@
#ifndef STDARG_H
#define STDARG_H
// When building with GCC, use the official vaarg macros to avoid warnings and possibly bad codegen.
#ifdef __GNUC__
#define va_list __builtin_va_list
#define va_start __builtin_va_start
#define va_arg __builtin_va_arg
#define va_end __builtin_va_end
#else
#if defined(__sgi) /* IDO */
#ifndef _VA_LIST_
# define _VA_LIST_
@ -52,6 +43,37 @@ typedef char* va_list;
/* No cleanup processing is required for the end of a varargs list: */
#define va_end(__list)
#endif /* __GNUC__ */
#elif defined(EGCS) /* EGCS */
typedef char * __gnuc_va_list;
#define __va_rounded_size(__TYPE) \
(((sizeof (__TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
#define va_start(__AP, __LASTARG) \
(__AP = (__gnuc_va_list) __builtin_next_arg (__LASTARG))
#define va_end(__AP) ((void)0)
/* We cast to void * and then to TYPE * because this avoids
a warning about increasing the alignment requirement. */
#define va_arg(__AP, __type) \
((__type *) (void *) (__AP = (char *) ((__alignof__(__type) > 4 \
? ((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8 \
: ((__PTRDIFF_TYPE__)__AP + 4 - 1) & -4) \
+ __va_rounded_size (__type))), \
*(__type *) (void *) (__AP - __va_rounded_size (__type)))
typedef __gnuc_va_list va_list;
#else /* Modern GCC */
// When building with modern GCC, use the official vaarg macros to avoid warnings and possibly bad codegen.
#define va_list __builtin_va_list
#define va_start __builtin_va_start
#define va_arg __builtin_va_arg
#define va_end __builtin_va_end
#endif
#endif

View file

@ -15,7 +15,7 @@ typedef unsigned long size_t;
#endif
#ifdef __GNUC__
#if __GNUC__ >= 4
#define offsetof(structure, member) __builtin_offsetof (structure, member)
#else
#define offsetof(structure, member) ((size_t)&(((structure*)0)->member))

View file

@ -64,7 +64,7 @@ void __osFreeDebug(Arena* arena, void* ptr, const char* file, int line);
void* __osReallocDebug(Arena* arena, void* ptr, u32 newSize, const char* file, int line);
#endif
#if PLATFORM_GC && DEBUG_FEATURES
#if !PLATFORM_N64 && DEBUG_FEATURES
void __osDisplayArena(Arena* arena);
extern u32 __osMalloc_FreeBlockTest_Enable;
#endif

View file

@ -52,16 +52,16 @@
#define LN2(ntsc_1_0, ntsc_1_1, other) \
LN(ntsc_1_0, ntsc_1_1, other, other, other, other, other, other, other, other, other, other, other, other)
// NTSC 1.0, Gamecube, and all the other versions
#define LN3(ntsc_1_0, other, gc) \
LN(ntsc_1_0, other, other, other, other, gc, gc, gc, gc, gc, gc, gc, gc, gc)
// NTSC 1.0, iQue, GameCube, and all the other versions
#define LN3(ntsc_1_0, other, ique, gc) \
LN(ntsc_1_0, other, other, other, other, gc, gc, gc, gc, gc, gc, gc, gc, ique)
// NTSC 1.0, NTSC 1.1, Gamecube, and all the other versions
#define LN4(ntsc_1_0, ntsc_1_1, other, gc, ique) \
// NTSC 1.0, NTSC 1.1, iQue, GameCube, and all the other versions
#define LN4(ntsc_1_0, ntsc_1_1, other, ique, gc) \
LN(ntsc_1_0, ntsc_1_1, other, other, other, gc, gc, gc, gc, gc, gc, gc, gc, ique)
// NTSC 1.0, NTSC 1.1, NTSC 1.2/PAL 1.0, Gamecube US/JP, Gamecube EU, and Gamecube CE
#define LN5(ntsc_1_0, ntsc_1_1, other, pal_1_1, gc_ntsc, gc_eu, gc_jp_ce) \
LN(ntsc_1_0, ntsc_1_1, other, other, pal_1_1, gc_ntsc, gc_ntsc, gc_ntsc, gc_ntsc, gc_eu, gc_eu, gc_eu, gc_jp_ce, gc_jp_ce)
// NTSC 1.0, NTSC 1.1, NTSC 1.2/PAL 1.0, iQue, Gamecube US/JP, Gamecube EU, and Gamecube CE
#define LN5(ntsc_1_0, ntsc_1_1, other, pal_1_1, ique, gc_ntsc, gc_eu, gc_jp_ce) \
LN(ntsc_1_0, ntsc_1_1, other, other, pal_1_1, gc_ntsc, gc_ntsc, gc_ntsc, gc_ntsc, gc_eu, gc_eu, gc_eu, gc_jp_ce, ique)
#endif

View file

@ -1,6 +1,7 @@
#ifndef MACROS_H
#define MACROS_H
#include "terminal.h"
#include "versions.h"
#ifndef AVOID_UB
@ -51,12 +52,40 @@
#if DEBUG_FEATURES
#define PRINTF osSyncPrintf
#elif defined(EGCS)
#define PRINTF(format, args...) while (0) osSyncPrintf(format, ##args)
#elif IDO_PRINTF_WORKAROUND
#define PRINTF(args) (void)0
#else
#define PRINTF(format, ...) (void)0
#endif
#if DEBUG_FEATURES
#define PRINTF_COLOR_BLACK() PRINTF(VT_FGCOL(BLACK))
#define PRINTF_COLOR_RED() PRINTF(VT_FGCOL(RED))
#define PRINTF_COLOR_GREEN() PRINTF(VT_FGCOL(GREEN))
#define PRINTF_COLOR_YELLOW() PRINTF(VT_FGCOL(YELLOW))
#define PRINTF_COLOR_BLUE() PRINTF(VT_FGCOL(BLUE))
#define PRINTF_COLOR_MAGENTA() PRINTF(VT_FGCOL(MAGENTA))
#define PRINTF_COLOR_CYAN() PRINTF(VT_FGCOL(CYAN))
#define PRINTF_COLOR_WHITE() PRINTF(VT_FGCOL(WHITE))
#define PRINTF_COLOR_WARNING() PRINTF(VT_COL(YELLOW, BLACK))
#define PRINTF_COLOR_ERROR() PRINTF(VT_COL(RED, WHITE))
#define PRINTF_RST() PRINTF(VT_RST)
#else
#define PRINTF_COLOR_BLACK() (void)0
#define PRINTF_COLOR_RED() (void)0
#define PRINTF_COLOR_GREEN() (void)0
#define PRINTF_COLOR_YELLOW() (void)0
#define PRINTF_COLOR_BLUE() (void)0
#define PRINTF_COLOR_MAGENTA() (void)0
#define PRINTF_COLOR_CYAN() (void)0
#define PRINTF_COLOR_WHITE() (void)0
#define PRINTF_COLOR_WARNING() (void)0
#define PRINTF_COLOR_ERROR() (void)0
#define PRINTF_RST() (void)0
#endif
#if DEBUG_FEATURES
#define LOG(exp, value, format, file, line) \
do { \
@ -76,12 +105,12 @@
#define LOG_FLOAT(exp, value, file, line) LOG(exp, value, "%f", file, line)
#define SET_NEXT_GAMESTATE(curState, newInit, newStruct) \
do { \
if (1) { \
GameState* state = curState; \
\
(state)->init = newInit; \
(state)->size = sizeof(newStruct); \
} while (0)
} (void)0
#if DEBUG_FEATURES

View file

@ -47,9 +47,6 @@ typedef struct MessageTableEntry {
#define DEFINE_MESSAGE_FFFC(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
DEFINE_MESSAGE_JPN(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage)
#define FONT_MESSAGE_OFFSET (_message_0xFFFC_jpn - (const char*)_jpn_message_data_staticSegmentStart)
#define FONT_MESSAGE_LENGTH (_message_0xFFFD_jpn - _message_0xFFFC_jpn)
#else
#define DEFINE_MESSAGE_NES(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
extern const char _message_##textId##_nes[]; \
@ -61,9 +58,6 @@ typedef struct MessageTableEntry {
#define DEFINE_MESSAGE_FFFC(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
DEFINE_MESSAGE_NES(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage)
#define FONT_MESSAGE_OFFSET (_message_0xFFFC_nes - (const char*)_nes_message_data_staticSegmentStart)
#define FONT_MESSAGE_LENGTH (_message_0xFFFD_nes - _message_0xFFFC_nes)
#endif
#define DEFINE_MESSAGE(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \

View file

@ -70,7 +70,6 @@ void* osViGetNextFramebuffer(void);
void osCreatePiManager(OSPri pri, OSMesgQueue* cmdQueue, OSMesg* cmdBuf, s32 cmdMsgCnt);
void __osDevMgrMain(void* arg);
s32 __osPiRawStartDma(s32 dir, u32 cartAddr, void* dramAddr, size_t size);
u32 osVirtualToPhysical(void* vaddr);
void osViBlack(u8 active);
s32 __osSiRawReadIo(void* devAddr, u32* dst);
OSId osGetThreadId(OSThread* thread);

View file

@ -4,10 +4,8 @@
#ifdef _LANGUAGE_C
#include "ultratypes.h"
#define U32(x) ((u32)x)
#define C_REG(x) (x)
#else
#define U32(x) (x)
#define C_REG(x) $x
#endif
/* Segment base addresses and sizes */
@ -312,33 +310,64 @@
#define WATCHHI_VALIDMASK 0x0000000F
/* Coprocessor 0 registers */
#define C0_INX C_REG(0)
#define C0_RAND C_REG(1)
#define C0_ENTRYLO0 C_REG(2)
#define C0_ENTRYLO1 C_REG(3)
#define C0_CONTEXT C_REG(4)
#define C0_PAGEMASK C_REG(5) /* page mask */
#define C0_WIRED C_REG(6) /* # wired entries in tlb */
#define C0_BADVADDR C_REG(8)
#define C0_COUNT C_REG(9) /* free-running counter */
#define C0_ENTRYHI C_REG(10)
#define C0_COMPARE C_REG(11) /* counter comparison reg. */
#define C0_SR C_REG(12)
#define C0_CAUSE C_REG(13)
#define C0_EPC C_REG(14)
#define C0_PRID C_REG(15) /* revision identifier */
#define C0_CONFIG C_REG(16) /* hardware configuration */
#define C0_LLADDR C_REG(17) /* load linked address */
#define C0_WATCHLO C_REG(18) /* watchpoint */
#define C0_WATCHHI C_REG(19) /* watchpoint */
#define C0_ECC C_REG(26) /* S-cache ECC and primary parity */
#define C0_CACHE_ERR C_REG(27) /* cache error status */
#define C0_TAGLO C_REG(28) /* cache operations */
#define C0_TAGHI C_REG(29) /* cache operations */
#define C0_ERROR_EPC C_REG(30) /* ECC error prg. counter */
#ifdef _LANGUAGE_C
#define C0_INX 0
#define C0_RAND 1
#define C0_ENTRYLO0 2
#define C0_ENTRYLO1 3
#define C0_CONTEXT 4
#define C0_PAGEMASK 5 /* page mask */
#define C0_WIRED 6 /* # wired entries in tlb */
#define C0_BADVADDR 8
#define C0_COUNT 9 /* free-running counter */
#define C0_ENTRYHI 10
#define C0_COMPARE 11 /* counter comparison reg. */
#define C0_SR 12
#define C0_CAUSE 13
#define C0_EPC 14
#define C0_PRID 15 /* revision identifier */
#define C0_CONFIG 16 /* hardware configuration */
#define C0_LLADDR 17 /* load linked address */
#define C0_WATCHLO 18 /* watchpoint */
#define C0_WATCHHI 19 /* watchpoint */
#define C0_ECC 26 /* S-cache ECC and primary parity */
#define C0_CACHE_ERR 27 /* cache error status */
#define C0_TAGLO 28 /* cache operations */
#define C0_TAGHI 29 /* cache operations */
#define C0_ERROR_EPC 30 /* ECC error prg. counter */
#else
#define C0_INX $0
#define C0_RAND $1
#define C0_ENTRYLO0 $2
#define C0_ENTRYLO1 $3
#define C0_CONTEXT $4
#define C0_PAGEMASK $5 /* page mask */
#define C0_WIRED $6 /* # wired entries in tlb */
#define C0_BADVADDR $8
#define C0_COUNT $9 /* free-running counter */
#define C0_ENTRYHI $10
#define C0_COMPARE $11 /* counter comparison reg. */
#define C0_SR $12
#define C0_CAUSE $13
#define C0_EPC $14
#define C0_PRID $15 /* revision identifier */
#define C0_CONFIG $16 /* hardware configuration */
#define C0_LLADDR $17 /* load linked address */
#define C0_WATCHLO $18 /* watchpoint */
#define C0_WATCHHI $19 /* watchpoint */
#define C0_ECC $26 /* S-cache ECC and primary parity */
#define C0_CACHE_ERR $27 /* cache error status */
#define C0_TAGLO $28 /* cache operations */
#define C0_TAGHI $29 /* cache operations */
#define C0_ERROR_EPC $30 /* ECC error prg. counter */
#endif
/* floating-point status register */
#define C1_FPCSR C_REG(31)
#ifdef _LANGUAGE_C
#define C1_FPCSR 31
#else
#define C1_FPCSR $31
#endif
#define FPCSR_FS 0x01000000 /* flush denorm to zero */
#define FPCSR_C 0x00800000 /* condition bit */

View file

@ -78,6 +78,9 @@
#define MTC0(dst, src) \
.set noreorder; mtc0 dst, src; .set reorder
#define CACHE(op, base) \
.set noreorder; cache op, base; .set reorder
#define CFC1(dst, src) \
.set noreorder; cfc1 dst, src; .set reorder
#define CTC1(src, dst) \
@ -95,7 +98,7 @@
#define TLBP \
.set noreorder; tlbp; .set reorder
#ifdef __sgi
#ifndef __GNUC__
#define ABS(x, y) \
.globl x; \
x = y

272
include/ultra64/bbskapi.h Normal file
View file

@ -0,0 +1,272 @@
/**
* @file bbskapi.h
*
* This file contains the external API for the iQue Player's Secure Kernel Calls.
*
* Applications require permission to call particular Secure Kernel Calls, defined in the associated Ticket.
* Most are not callable by games.
*/
#ifndef BB_SKAPI_H
#define BB_SKAPI_H
#include "ultratypes.h"
#define SKC_OK 0
#define SKC_RECRYPT_INVALID 1
#define SKC_RECRYPT_2 2 // Complete?
#define SKC_RECRYPT_3 3 // Partial?
#define SKC_RECRYPT_4 4 // Beginning?
#define SKC_INVALID_ARGS -1
#define SKC_INVALID_TSRL -2
#define SKC_INVALID_CARL -3
#define SKC_INVALID_CPRL -4
#define SKC_INVALID_CERT -9
#define SKC_NO_PERMISSION -11
typedef struct BbAppLaunchCrls BbAppLaunchCrls;
typedef struct BbCertBase BbCertBase;
typedef struct BbEccSig BbEccSig;
typedef struct BbRecryptList BbRecryptList;
typedef struct BbShaHash BbShaHash;
typedef struct BbTicketBundle BbTicketBundle;
/**
* Retrieves the console's unique BBID.
*
* @param bbId Location to write the BBID to. Must be a pointer to cached DRAM with 4-byte alignment.
* @return
* SKC_NO_PERMISSION If called with insufficient permission.
* SKC_INVALID_ARGS If the supplied pointer is not valid.
* SKC_OK Otherwise.
*/
s32 skGetId(u32* bbId);
/**
* Prepares to launch an application.
* The provided ticket bundle is verified and made the active ticket bundle.
* The AES decryption hardware is prepared.
*
* @param bundle Ticket Bundle associated with this application.
* @param crls Application Certificate Revocation Lists to check when verifying the ticket bundle.
* The ticket bundle must be signed by the Root signature without going through any
* revoked certificates.
* @param recryptList System Recrypt List (encrypted and digitally signed)
* @return
* SKC_INVALID_ARGS If any inputs are or contain invalid pointers,
* or the ticket is not for this console,
* or the ticket is for a trial that has expired.
* SKC_INVALID_TSRL If the provided TSRL revocation list is invalid.
* SKC_INVALID_CARL If the provided CARL revocation list is invalid.
* SKC_INVALID_CPRL If the provided CPRL revocation list is invalid.
* SKC_INVALID_CERT If a digital certificate was revoked by one of the revocation lists.
* SKC_RECRYPT_3 If the recrypt state for this app is not in an acceptable state to be launched.
* SKC_RECRYPT_4 If the recrypt state for this app is not in an acceptable state to be launched.
* SKC_NO_PERMISSION If called with insufficient permission.
* SKC_OK Otherwise.
*/
s32 skLaunchSetup(BbTicketBundle* bundle, BbAppLaunchCrls* crls, BbRecryptList* recryptList);
/**
* Launches a prepared application that is assumed to have been loaded into memory at the entrypoint between calling
* skLaunchSetup and calling this. skLaunchSetup must have been called prior to set the active ticket bundle.
*
* @param entrypoint The entrypoint address of the app to launch.
*
* @return
* SKC_INVALID_ARGS If the entrypoint is an invalid pointer,
* or if content failed a hash check for non-recrypted apps,
* or if the content is an expired trial.
* SKC_NO_PERMISSION If called with insufficient permission.
* @note Does not return if the call is successful.
*/
s32 skLaunch(void* entrypoint);
/**
* Verifies whether a provided Recrypt List is valid.
*
* @param recryptList Pointer to the (encrypted and digitally signed) recrypt list to verify.
* @return
* SKC_OK If the recrypt list is valid
* SKC_INVALID_ARGS If the recrypt list is invalid
* (e.g. contains invalid pointers or its ECDSA signature fails to verify)
* SKC_NO_PERMISSION If called with insufficient permission.
*/
s32 skRecryptListValid(BbRecryptList* recryptList);
/**
* Begins a new recryption task. Content downloaded is initially encrypted with the Common Key but may be re-encrypted
* with a new randomly generated AES key if the recrypt flag is set in the content metadata. Like with skLaunchSetup,
* the provided ticket bundle is first verified before being made the active ticket bundle.
*
* @param bundle The ticket bundle associated with the content that will be recrypted.
* @param crls Application Certificate Revocation Lists to check when verifying the ticket bundle.
* The ticket bundle must be signed by the Root signature without going through any
* revoked certificates.
* @param recryptList The recrypt list that the AES key will be saved to, after being encrypted with the
* console-specific recrypt list key.
* @return
* SKC_RECRYPT_INVALID If called on a ticket bundle that does not have the recrypt flag set.
* SKC_INVALID_ARGS If any inputs are or contain invalid pointers,
* or the ticket is not for this console,
* or the ticket is for a trial that has expired.
* SKC_INVALID_TSRL If the provided TSRL revocation list is invalid.
* SKC_INVALID_CARL If the provided CARL revocation list is invalid.
* SKC_INVALID_CPRL If the provided CPRL revocation list is invalid.
* SKC_INVALID_CERT If a digital certificate was revoked by one of the revocation lists.
* SKC_NO_PERMISSION If called with insufficient permission.
* Otherwise, one of SKC_RECRYPT_* will be returned communicating the initial state of the recryption process.
*/
s32 skRecryptBegin(BbTicketBundle* bundle, BbAppLaunchCrls* crls, BbRecryptList* recryptList);
/**
* Recrypts the provided data, using the previously set context.
* Must be called following skRecryptBegin.
*
* @param buf Pointer to app content to encrypt and hash.
* @param size Amount of data to process in this buffer.
* @return
* SKC_INVALID_ARGS If the provided buffer is not fully contained in RAM or is otherwise invalid.
* SKC_NO_PERMISSION If called with insufficient permission.
* SKC_OK Otherwise.
*/
s32 skRecryptData(u8* buf, u32 size);
/**
* Resumes a partially-complete recryption. The last chunk of successfully-recrypted data must be provided in order to
* set the AES-128-CBC Initialization Vector to continue recryption of the next chunk.
* Must be called following skRecryptBegin.
*
* @param buf Pointer to last chunk of successfully-recrypted content.
* @param size Amount of data available.
* @return
* SKC_INVALID_ARGS If the provided buffer is not fully contained in RAM or is otherwise invalid.
* SKC_NO_PERMISSION If called with insufficient permission.
* SKC_OK Otherwise.
*/
s32 skRecryptComputeState(u8* buf, u32 size);
/**
* Concludes the recryption process. The SHA-1 hash of the content, computed during recryption, is checked against the
* hash in the active ticket bundle; if it passes, the recrypt list entry for the active content is updated to indicate
* that recryption is complete and was successful.
*
* @param recryptList The (encrypted and digitally signed) recrypt list to update.
* @return
* SKC_OK If recryption succeeded.
* SKC_INVALID_ARGS If recryption failed (e.g. if the hash of the content did not match the hash in the ticket bundle)
* or if the provided recrypt list is invalid or cannot find the entry for the content.
* SKC_NO_PERMISSION If called with insufficient permission.
*/
s32 skRecryptEnd(BbRecryptList* recryptList);
/**
* Generates a digital signature for the provided SHA-1 hash (treated as a message) using the Elliptic Curve Digital
* Signature Algorithm (ECDSA) on the curve sect233r1 with the console's ECDSA Private Key. Appends an identity of 1 to
* the end of the message prior to signing.
*
* @param hash The SHA-1 hash to sign.
* @param outSignature The resulting ECDSA digital signature.
* @return
* SKC_INVALID_ARGS If either of the arguments is an invalid pointer.
* SKC_NO_PERMISSION If called with insufficient permission.
* SKC_OK Otherwise.
*/
s32 skSignHash(BbShaHash* hash, BbEccSig* outSignature);
/**
* Verifies a SHA-1 hash (treated as a message) against a digital signature using either the Elliptic Curve Digital
* Signature Algorithm (ECDSA) or the RSA Digital Signature Algorithm. For RSA, either 2048-bit or 4096-bit signatures
* can be recognized.
*
* For verifying self-signed (e.g. via skSignHash) ECDSA signatures the certificate chain and revocation lists are not
* required and may be passed as NULL, the public key is the console's own ECDSA public key. For verifying other types
* of signatures, a valid certificate chain and certificate revocation lists must be provided, in which case the
* signature must be signed by the Root certificate without going through any revoked certificates.
*
* This can only verify hashes signed with an identity of 1, such as those signed via skSignHash.
*
* @param hash The SHA-1 hash to check the signature of.
* @param signature The signature to compare against. May be an ECDSA, RSA2048 or RSA4096 signature.
* @param certChain Certificate Chain, NULL-terminated list of certificate pointers.
* Not required for self-signed ECDSA signatures and must be NULL in that case.
* Should not be more than 5 certificates long.
* Should end on the Root signature.
* @param crls Certificate Revocation Lists to check certificates against. Not required for self-signed ECDSA signatures.
* @return
* SKC_OK If the hash was successfully verified against the signature.
* SKC_INVALID_ARGS If any arguments are invalid pointers,
* or the hash could not be verified against the digital signature,
* or the certificate chain was invalid,
* or if any certificate revocation lists were invalid.
* SKC_INVALID_CERT If a digital certificate was revoked by one of the revocation lists.
* SKC_NO_PERMISSION If called with insufficient permission.
*/
s32 skVerifyHash(BbShaHash* hash, u32* signature, BbCertBase** certChain, BbAppLaunchCrls* crls);
/**
* Retrieves the consumption counters for all currently-tracked applications and the Ticket ID (TID) Window.
*
* The TID Window determines the TID for the first counter (cc[0]), the other counters (cc[i]) are associated with
* tidWindow + i.
*
* The consumption counters track either the number of minutes that a trial app has been played for, or the number of
* times a trial app has been launched.
*
* @param tidWindow The location to save the TID window to.
* @param cc An array of 26 u16s to save the consumption counters into.
* @return
* SKC_INVALID_ARGS If either pointer is invalid or there is not enough room to save all the consumption counters.
* SKC_NO_PERMISSION If called with insufficient permission.
* SKC_OK Otherwise.
*/
s32 skGetConsumption(u16* tidWindow, u16 cc[26]);
/**
* Increments the Ticket ID Window by 1 and moves all consumption counters down by 1 slot to match the new window. The
* counter previously at position 0 is forgotten.
*
* @return
* SKC_NO_PERMISSION If called with insufficient permission.
* SKC_INVALID_ARGS If the resulting state could not be saved internally.
* SKC_OK If success.
*/
s32 skAdvanceTicketWindow(void);
/**
* Overrides the trial limit and trial type stored in the currently loaded ticket.
*
* @param limit The new trial limit. Either a length of time or the number of allowed launches, depending on trial type.
* @param code The new trial type
* 0 = Time-limited in minutes, call skKeepAlive periodically
* 1 = Limited by number of launches
* 2 = Time-limited in minutes, no need to call skKeepAlive (TOVERIFY)
* @return
* SKC_OK If success.
* SKC_INVALID_ARGS If no ticket is currently loaded.
* SKC_NO_PERMISSION If called with insufficient permission.
*/
s32 skSetLimit(u16 limit, u16 code);
/**
* Returns to the system menu.
*
* @return
* SKC_NO_PERMISSION If called with insufficient permission.
* @note Does not return if called with permission.
*/
s32 skExit(void);
/**
* Keeps trial applications alive.
*
* The hardware trial timer does not have a very long period so must be refreshed periodically by calling this function.
* This function updates the timer and checks for an expiry.
*
* @return
* SKC_NO_PERMISSION If called with insufficient permission.
* SKC_OK Otherwise.
* @note This function may not return if it detects the trial has expired.
*/
s32 skKeepAlive(void);
#endif

275
include/ultra64/bcp.h Normal file
View file

@ -0,0 +1,275 @@
#ifndef BCP_H
#define BCP_H
#include "rcp.h"
/******************************************************************************
* Additional MIPS Interface (MI) Registers
*/
/**
* Accesses to this register outside of Secure Mode cause an NMI to transfer control
* to the Secure Kernel.
*
* [25] ?: System software writes to this bit when launching an app or game
* [24] SK RAM Access: Set to 1 to enable access to 0x8000 bytes at 0x1FC40000
* [7] Secure Trap Cause: Memory card removed
* [6] Secure Trap Cause: Power button pressed
* [5] Secure Trap Cause: MI Error
* [4] Secure Trap Cause: PI Error
* [3] Secure Trap Cause: Timer expired
* [2] Secure Trap Cause: Syscall via read of this register outside of secure mode
* [1] Boot ROM Swap: 0 = SK mapped at 0x1FC00000, Boot ROM mapped at 0x1FC20000
* 1 = Boot ROM mapped at 0x1FC00000, SK mapped at 0x1FC20000
* [0] Secure Mode: 0 = not in secure mode
* 1 = in secure mode
*/
#define MI_SECURE_EXCEPTION_REG (MI_BASE_REG + 0x14)
/**
* Read:
* [25] MD (active, 1 if card is currently disconnected else 0)
* [24] Power Button (active, 1 if button is currently pressed else 0)
* [13] MD (pending interrupt)
* [12] Power Button (pending interrupt)
* [11] USB1
* [10] USB0
* [ 9] PI_ERR
* [ 8] IDE
* [ 7] AES
* [ 6] FLASH
* [ 5] DP
* [ 4] PI
* [ 3] VI
* [ 2] AI
* [ 1] SI
* [ 0] SP
*
* Write:
* [13] Clear MD Interrupt
*/
#define MI_EX_INTR_REG (MI_BASE_REG + 0x38)
/*
* MI_EX_INTR_REG: read bits
*/
#define MI_EX_INTR_SP (1 << 0)
#define MI_EX_INTR_SI (1 << 1)
#define MI_EX_INTR_AI (1 << 2)
#define MI_EX_INTR_VI (1 << 3)
#define MI_EX_INTR_PI (1 << 4)
#define MI_EX_INTR_DP (1 << 5)
#define MI_EX_INTR_FLASH (1 << 6)
#define MI_EX_INTR_AES (1 << 7)
#define MI_EX_INTR_IDE (1 << 8)
#define MI_EX_INTR_PI_ERR (1 << 9)
#define MI_EX_INTR_USB0 (1 << 10)
#define MI_EX_INTR_USB1 (1 << 11)
#define MI_EX_INTR_PWR_BTN (1 << 12)
#define MI_EX_INTR_MD (1 << 13)
#define MI_EX_INTR_PWR_BTN_PRESSED (1 << 24) /* updated in real-time, unrelated to interrupt */
#define MI_EX_INTR_CARD_NOT_PRESENT (1 << 25) /* updated in real-time, unrelated to interrupt */
#define MI_EX_INTR_ALL \
(MI_EX_INTR_FLASH | MI_EX_INTR_AES | MI_EX_INTR_IDE | MI_EX_INTR_PI_ERR | \
MI_EX_INTR_USB0 | MI_EX_INTR_USB1 | MI_EX_INTR_PWR_BTN | MI_EX_INTR_MD)
/*
* MI_EX_INTR_REG: write bits
*/
#define MI_EX_INTR_CLR_MD (1 << 13)
/**
* Write:
* [27:26] Set/Clear MD
* [25:24] Set/Clear BUTTON
* [23:22] Set/Clear USB1
* [21:20] Set/Clear USB0
* [19:18] Set/Clear PI_ERR
* [17:16] Set/Clear IDE
* [15:14] Set/Clear AES
* [13:12] Set/Clear FLASH
* [11:10] Set/Clear DP
* [ 9: 8] Set/Clear PI
* [ 7: 6] Set/Clear VI
* [ 5: 4] Set/Clear AI
* [ 3: 2] Set/Clear SI
* [ 1: 0] Set/Clear SP
*
* Read:
* [13] MD
* [12] BUTTON
* [11] USB1
* [10] USB0
* [ 9] PI_ERR
* [ 8] IDE
* [ 7] AES
* [ 6] FLASH
* [ 5] DP
* [ 4] PI
* [ 3] VI
* [ 2] AI
* [ 1] SI
* [ 0] SP
*/
#define MI_EX_INTR_MASK_REG (MI_BASE_REG + 0x3C)
/*
* MI_EX_INTR_MASK_REG: write bits
*/
#define MI_EX_INTR_MASK_CLR_SP (1 << 0) /* clear SP mask */
#define MI_EX_INTR_MASK_SET_SP (1 << 1) /* set SP mask */
#define MI_EX_INTR_MASK_CLR_SI (1 << 2) /* clear SI mask */
#define MI_EX_INTR_MASK_SET_SI (1 << 3) /* set SI mask */
#define MI_EX_INTR_MASK_CLR_AI (1 << 4) /* clear AI mask */
#define MI_EX_INTR_MASK_SET_AI (1 << 5) /* set AI mask */
#define MI_EX_INTR_MASK_CLR_VI (1 << 6) /* clear VI mask */
#define MI_EX_INTR_MASK_SET_VI (1 << 7) /* set VI mask */
#define MI_EX_INTR_MASK_CLR_PI (1 << 8) /* clear PI mask */
#define MI_EX_INTR_MASK_SET_PI (1 << 9) /* set PI mask */
#define MI_EX_INTR_MASK_CLR_DP (1 << 10) /* clear DP mask */
#define MI_EX_INTR_MASK_SET_DP (1 << 11) /* set DP mask */
#define MI_EX_INTR_MASK_CLR_FLASH (1 << 12) /* clear FLASH mask */
#define MI_EX_INTR_MASK_SET_FLASH (1 << 13) /* set FLASH mask */
#define MI_EX_INTR_MASK_CLR_AES (1 << 14) /* clear AES mask */
#define MI_EX_INTR_MASK_SET_AES (1 << 15) /* set AES mask */
#define MI_EX_INTR_MASK_CLR_IDE (1 << 16) /* clear IDE mask */
#define MI_EX_INTR_MASK_SET_IDE (1 << 17) /* set IDE mask */
#define MI_EX_INTR_MASK_CLR_PI_ERR (1 << 18) /* clear PI_ERR mask */
#define MI_EX_INTR_MASK_SET_PI_ERR (1 << 19) /* set PI_ERR mask */
#define MI_EX_INTR_MASK_CLR_USB0 (1 << 20) /* clear USB0 mask */
#define MI_EX_INTR_MASK_SET_USB0 (1 << 21) /* set USB0 mask */
#define MI_EX_INTR_MASK_CLR_USB1 (1 << 22) /* clear USB1 mask */
#define MI_EX_INTR_MASK_SET_USB1 (1 << 23) /* set USB1 mask */
#define MI_EX_INTR_MASK_CLR_PWR_BTN (1 << 24) /* clear PWR_BTN mask */
#define MI_EX_INTR_MASK_SET_PWR_BTN (1 << 25) /* set PWR_BTN mask */
#define MI_EX_INTR_MASK_CLR_MD (1 << 26) /* clear MD mask */
#define MI_EX_INTR_MASK_SET_MD (1 << 27) /* set MD mask */
/*
* MI_EX_INTR_MASK_REG: read bits
*/
#define MI_EX_INTR_MASK_SP (1 << 0) /* SP intr mask */
#define MI_EX_INTR_MASK_SI (1 << 1) /* SI intr mask */
#define MI_EX_INTR_MASK_AI (1 << 2) /* AI intr mask */
#define MI_EX_INTR_MASK_VI (1 << 3) /* VI intr mask */
#define MI_EX_INTR_MASK_PI (1 << 4) /* PI intr mask */
#define MI_EX_INTR_MASK_DP (1 << 5) /* DP intr mask */
#define MI_EX_INTR_MASK_FLASH (1 << 6) /* FLASH intr mask */
#define MI_EX_INTR_MASK_AES (1 << 7) /* AES intr mask */
#define MI_EX_INTR_MASK_IDE (1 << 8) /* IDE intr mask */
#define MI_EX_INTR_MASK_PI_ERR (1 << 9) /* PI_ERR intr mask */
#define MI_EX_INTR_MASK_USB0 (1 << 10) /* USB0 intr mask */
#define MI_EX_INTR_MASK_USB1 (1 << 11) /* USB1 intr mask */
#define MI_EX_INTR_MASK_PWR_BTN (1 << 12) /* PWR_BTN intr mask */
#define MI_EX_INTR_MASK_MD (1 << 13) /* MD intr mask */
/******************************************************************************
* Additional Parallel Interface (PI) Registers
*/
/**
* Write:
* [31] Execute command after write
* [30] Interrupt when done
* [29:24] ?
* [23:16] NAND Command
* [15] ?
* [14] Buffer Select
* [13:12] Device Select
* [11] Do Error Correction
* [10] NAND Command is Multi-Cycle
* [ 9: 0] Data Transfer Length in Bytes
*
* Writing 0 to this register clears the interrupt
*
* Read:
* [31] Busy
* [11] Single-Bit Error Corrected
* [10] Double-Bit Error Uncorrectable
*/
#define PI_NAND_CTRL_REG (PI_BASE_REG + 0x48)
/**
* PI internal buffer DMA read length. Writes initiate a DMA from RDRAM to the PI buffer.
*/
#define PI_EX_RD_LEN_REG (PI_BASE_REG + 0x58)
/**
* PI internal buffer DMA write length. Writes initiate a DMA from the PI buffer to RDRAM.
*/
#define PI_EX_WR_LEN_REG (PI_BASE_REG + 0x5C)
/**
* [31:16] Box ID
* [31:30] Hardware Revision? (osInitialize checks this and sets __osBbIsBb to 2 if != 0)
* [29:27] ?? (not seen)
* [26:25] ?? (system clock speed identifier?)
* [24:22] ?? (bootrom, checked against MI_10_REG and copied there if mismatch)
* [21:16] ?? (not seen)
* [ 7: 4] GPIO direction control
* [7] RTC Data output enable
* [6] RTC Clock output enable
* [5] Error LED output enable
* [4] Power Control output enable
* [ 3: 0] GPIO in/out value
* [3] RTC Data output value (0=low, 1=high)
* [2] RTC Clock output value (0=low, 1=high)
* [1] Error LED (0=on, 1=off)
* [0] Power Control (0=off, 1=on)
*/
#define PI_GPIO_REG (PI_BASE_REG + 0x60)
/* Box ID */
#define PI_GPIO_GET_BOXID(reg) ((reg) >> 16)
#define PI_GPIO_IS_HW_V2(reg) ((reg) & (3 << 30))
/* GPIO: Input/Output enables */
#define PI_GPIO_I_PWR ((0 << 0) << 4)
#define PI_GPIO_O_PWR ((1 << 0) << 4)
#define PI_GPIO_I_LED ((0 << 1) << 4)
#define PI_GPIO_O_LED ((1 << 1) << 4)
#define PI_GPIO_I_RTC_CLK ((0 << 2) << 4)
#define PI_GPIO_O_RTC_CLK ((1 << 2) << 4)
#define PI_GPIO_I_RTC_DAT ((0 << 3) << 4)
#define PI_GPIO_O_RTC_DAT ((1 << 3) << 4)
/* GPIO: Output controls */
/* Power */
#define PI_GPIO_PWR_OFF (0 << 0)
#define PI_GPIO_PWR_ON (1 << 0)
/* LED */
#define PI_GPIO_LED_ON (0 << 1)
#define PI_GPIO_LED_OFF (1 << 1)
/* RTC */
#define PI_GPIO_RTC_CLK_LO (0 << 2)
#define PI_GPIO_RTC_CLK_HI (1 << 2)
#define PI_GPIO_RTC_DAT_LO (0 << 3)
#define PI_GPIO_RTC_DAT_HI (1 << 3)
/* GPIO: Input getters */
#define PI_GPIO_GET_PWR(reg) (((reg) >> 0) & 1)
#define PI_GPIO_GET_LED(reg) (((reg) >> 1) & 1)
#define PI_GPIO_GET_RTC_CLK(reg) (((reg) >> 2) & 1)
#define PI_GPIO_GET_RTC_DAT(reg) (((reg) >> 3) & 1)
/**
* [31] ?
*/
#define PI_64_REG (PI_BASE_REG + 0x64)
/******************************************************************************
* Additional Serial Interface (SI) Registers
*/
/**
* ?
*/
#define SI_0C_REG (SI_BASE_REG + 0x0C)
/**
* ?
*/
#define SI_1C_REG (SI_BASE_REG + 0x1C)
#endif

View file

@ -17,6 +17,7 @@
#define CONT_CMD_WRITE_MEMPACK 3
#define CONT_CMD_READ_EEPROM 4
#define CONT_CMD_WRITE_EEPROM 5
#define CONT_CMD_CHANNEL_RESET 0xFD
#define CONT_CMD_RESET 0xFF
#define CONT_CMD_REQUEST_STATUS_TX 1

View file

@ -15,4 +15,6 @@
#define OS_PHYSICAL_TO_K0(x) (void*)(((u32)(x)+0x80000000))
#define OS_PHYSICAL_TO_K1(x) (void*)(((u32)(x)+0xA0000000))
u32 osVirtualToPhysical(void* vaddr);
#endif

View file

@ -5,7 +5,7 @@
void osSyncPrintf(const char* fmt, ...);
#ifdef __GNUC__
#if defined(__GNUC__) && defined(NON_MATCHING)
void bzero(void* __s, unsigned int __n);
int bcmp(const void* __sl, const void* __s2, unsigned int __n);
void bcopy(const void* __src, void* __dest, unsigned int __n);

View file

@ -21,6 +21,16 @@
#define OS_EVENT_FAULT 12 /* CPU fault event: used by rmon */
#define OS_EVENT_THREADSTATUS 13 /* CPU thread status: used by rmon */
#define OS_EVENT_PRENMI 14 /* Pre NMI interrupt */
#ifdef BBPLAYER
#define OS_EVENT_FLASH 23 /* NAND flash operation complete */
#define OS_EVENT_AES 24 /* AES decryption complete */
#define OS_EVENT_IDE 25 /* IDE transfer complete */
#define OS_EVENT_PI_ERR 26 /* PI Error? */
#define OS_EVENT_USB0 27 /* USB Controller 0 */
#define OS_EVENT_USB1 28 /* USB Controller 1 */
#define OS_EVENT_UNK_29 29 /* ? */
#define OS_EVENT_MD 30 /* Memory card removed */
#endif
#ifdef _LANGUAGE_C

View file

@ -35,5 +35,12 @@
#define ORIGIN(v) (v)
#define VINTR(v) (v)
#define HSTART(start, end) START(start, end)
#define VSTART(start, end) START(start, end)
#ifdef BBPLAYER
#define VI_CTRL_PIXEL_ADV_DEFAULT VI_CTRL_PIXEL_ADV(1)
#else
#define VI_CTRL_PIXEL_ADV_DEFAULT VI_CTRL_PIXEL_ADV(3)
#endif
#endif

View file

@ -9,11 +9,24 @@ extern Mtx D_01000000;
extern void* osRomBase;
extern s32 osTvType;
extern u32 osRomType;
extern u32 osVersion;
extern s32 osResetType;
extern s32 osCicId;
extern u32 osMemSize;
extern u8 osAppNMIBuffer[0x40];
extern u32 __osBbIsBb;
extern u32 __osBbEepromSize;
extern u32 __osBbPakSize;
extern u32 __osBbFlashSize;
extern u32 __osBbEepromAddress;
extern u32 __osBbPakAddress[4];
extern u32 __osBbFlashAddress;
extern u32 __osBbSramSize;
extern u32 __osBbSramAddress;
extern u32 __osBbHackFlags;
extern s8 D_80009430;
extern vu8 gViConfigBlack;
extern u8 gViConfigAdditionalScanLines;

View file

@ -971,7 +971,7 @@ void Flags_SetEventChkInf(s32 flag);
s32 Flags_GetInfTable(s32 flag);
void Flags_SetInfTable(s32 flag);
u16 func_80037C30(struct PlayState* play, s16 arg1);
s32 func_80037D98(struct PlayState* play, Actor* actor, s16 arg2, s32* arg3);
s32 func_80037D98(struct PlayState* play, Actor* actor, s32 arg2, s32* arg3);
s32 Actor_TrackPlayer(struct PlayState* play, Actor* actor, Vec3s* headRot, Vec3s* torsoRot, Vec3f focusPos);
#endif

View file

@ -201,11 +201,9 @@ typedef struct AdpcmBookHeader {
* The procedure used to design the codeBook is based on an adaptive clustering algorithm.
* The size of the codeBook is (8 * order * numPredictors) and is 8-byte aligned
*/
typedef s16 AdpcmBookData[];
typedef struct AdpcmBook {
/* 0x00 */ AdpcmBookHeader header;
/* 0x08 */ AdpcmBookData book; // size 8 * order * numPredictors. 8-byte aligned
/* 0x08 */ s16 book[1]; // size 8 * order * numPredictors. 8-byte aligned
} AdpcmBook; // size >= 0x8
typedef struct Sample {

View file

@ -130,7 +130,7 @@ f32 func_800BFCB8(PlayState* this, MtxF* mf, Vec3f* pos);
void* Play_LoadFile(PlayState* this, RomFile* file);
void Play_GetScreenPos(PlayState* this, Vec3f* src, Vec3f* dest);
s16 Play_CreateSubCamera(PlayState* this);
s16 Play_GetActiveCamId(PlayState* this);
s32 Play_GetActiveCamId(PlayState* this);
s16 Play_ChangeCameraStatus(PlayState* this, s16 camId, s16 status);
void Play_ClearCamera(PlayState* this, s16 camId);
void Play_ClearAllSubCameras(PlayState* this);

View file

@ -84,6 +84,10 @@ typedef struct Inventory {
/* 0x5C */ s16 gsTokens;
} Inventory; // size = 0x5E
typedef struct Checksum {
/* 0x00 */ u16 value;
} Checksum; // size = 0x02
typedef struct SavedSceneFlags {
/* 0x00 */ u32 chest;
/* 0x04 */ u32 swch;
@ -254,7 +258,7 @@ typedef struct SaveInfo {
/* 0x12AA 0x12C6 */ u8 scarecrowSpawnSong[0x80];
/* 0x132A 0x1346 */ char unk_1346[0x02];
/* 0x132C 0x1348 */ HorseData horseData;
/* 0x1336 0x1352 */ u16 checksum; // "check_sum"
/* 0x1336 0x1352 */ Checksum checksum; // "check_sum"
} SaveInfo;
typedef struct Save {
@ -420,8 +424,8 @@ typedef enum LinkAge {
#define CUR_EQUIP_VALUE(equip) ((s32)(gSaveContext.save.info.equips.equipment & gEquipMasks[equip]) >> gEquipShifts[equip])
#define OWNED_EQUIP_FLAG(equip, value) (gBitFlags[value] << gEquipShifts[equip])
#define OWNED_EQUIP_FLAG_ALT(equip, value) ((1 << (value)) << gEquipShifts[equip])
#define CHECK_OWNED_EQUIP(equip, value) (OWNED_EQUIP_FLAG(equip, value) & gSaveContext.save.info.inventory.equipment)
#define CHECK_OWNED_EQUIP_ALT(equip, value) (gBitFlags[(value) + (equip) * 4] & gSaveContext.save.info.inventory.equipment)
#define CHECK_OWNED_EQUIP(equip, value) (gSaveContext.save.info.inventory.equipment & OWNED_EQUIP_FLAG(equip, value))
#define CHECK_OWNED_EQUIP_ALT(equip, value) (gSaveContext.save.info.inventory.equipment & gBitFlags[(value) + (equip) * 4])
#define SWORD_EQUIP_TO_PLAYER(swordEquip) (swordEquip)
#define SHIELD_EQUIP_TO_PLAYER(shieldEquip) (shieldEquip)
@ -432,7 +436,7 @@ typedef enum LinkAge {
#define CAPACITY(upg, value) gUpgradeCapacities[upg][value]
#define CUR_CAPACITY(upg) CAPACITY(upg, CUR_UPG_VALUE(upg))
#define CHECK_QUEST_ITEM(item) (gBitFlags[item] & gSaveContext.save.info.inventory.questItems)
#define CHECK_QUEST_ITEM(item) (gSaveContext.save.info.inventory.questItems & gBitFlags[item])
#define CHECK_DUNGEON_ITEM(item, dungeonIndex) (gSaveContext.save.info.inventory.dungeonItems[dungeonIndex] & gBitFlags[item])
#define GET_GS_FLAGS(index) \
@ -1035,21 +1039,25 @@ typedef enum IngoRaceState {
#define EVENTINF_MARATHON_ACTIVE 0x10
// EVENTINF 0x20-0x24
#define EVENTINF_INDEX_HAGGLING_TOWNSFOLK (EVENTINF_20 >> 4)
#define EVENTINF_20 0x20
#define EVENTINF_21 0x21
#define EVENTINF_22 0x22
#define EVENTINF_23 0x23
#define EVENTINF_24 0x24
#define EVENTINF_INDEX_HAGGLING_TOWNSFOLK 0x2
#define EVENTINF_HAGGLING_TOWNSFOLK_MESG_0 0x20
#define EVENTINF_HAGGLING_TOWNSFOLK_MESG_1 0x21
#define EVENTINF_HAGGLING_TOWNSFOLK_MESG_2 0x22
#define EVENTINF_HAGGLING_TOWNSFOLK_MESG_3 0x23
#define EVENTINF_HAGGLING_TOWNSFOLK_MESG_4 0x24
#define EVENTINF_HAGGLING_TOWNSFOLK_MASK \
(EVENTINF_MASK(EVENTINF_20) | EVENTINF_MASK(EVENTINF_21) | EVENTINF_MASK(EVENTINF_22) | \
EVENTINF_MASK(EVENTINF_23) | EVENTINF_MASK(EVENTINF_24))
#define EVENTINF_HAGGLING_TOWNSFOLK_MASK \
(EVENTINF_MASK(EVENTINF_HAGGLING_TOWNSFOLK_MESG_0) | EVENTINF_MASK(EVENTINF_HAGGLING_TOWNSFOLK_MESG_1) | \
EVENTINF_MASK(EVENTINF_HAGGLING_TOWNSFOLK_MESG_2) | EVENTINF_MASK(EVENTINF_HAGGLING_TOWNSFOLK_MESG_3) | \
EVENTINF_MASK(EVENTINF_HAGGLING_TOWNSFOLK_MESG_4))
#define ENMU_GET_TALK_FLAGS() \
#define GET_EVENTINF_ENMU_TALK_FLAGS() \
gSaveContext.eventInf[EVENTINF_INDEX_HAGGLING_TOWNSFOLK] & EVENTINF_HAGGLING_TOWNSFOLK_MASK
#define ENMU_RESET_TALK_FLAGS() \
#define SET_EVENTINF_ENMU_TALK_FLAGS(talkFlags) \
gSaveContext.eventInf[EVENTINF_INDEX_HAGGLING_TOWNSFOLK] |= (talkFlags);
#define RESET_EVENTINF_ENMU_TALK_FLAGS() \
gSaveContext.eventInf[EVENTINF_INDEX_HAGGLING_TOWNSFOLK] &= ~(EVENTINF_HAGGLING_TOWNSFOLK_MASK);
#define EVENTINF_30 0x30

View file

@ -14,7 +14,7 @@ typedef enum SramHeaderField {
/* 0x00 */ SRAM_HEADER_SOUND,
/* 0x01 */ SRAM_HEADER_ZTARGET,
/* 0x02 */ SRAM_HEADER_LANGUAGE,
/* 0x03 */ SRAM_HEADER_MAGIC // must be the value of `sZeldaMagic` for save to be considered valid
/* 0x03 */ SRAM_HEADER_MAGIC // must be the value in `sSramDefaultHeader` for save to be considered valid
} SramHeaderField;
#endif

View file

@ -15,10 +15,10 @@ typedef struct Viewport {
#define SET_FULLSCREEN_VIEWPORT(view) \
{ \
Viewport viewport; \
viewport.bottomY = SCREEN_HEIGHT; \
viewport.rightX = SCREEN_WIDTH; \
viewport.topY = 0; \
viewport.bottomY = SCREEN_HEIGHT; \
viewport.leftX = 0; \
viewport.rightX = SCREEN_WIDTH; \
View_SetViewport(view, &viewport); \
} \
(void)0

13
linker_scripts/makerom.ld Normal file
View file

@ -0,0 +1,13 @@
#include "boot.h"
/* These are only here due to iQue entry.s using ori to load the lower halves of symbols
* rather than addiu, so the usual relocation operators %hi() and %lo() can't be used. */
_bootSegmentBssStart_HI = _bootSegmentBssStart >> 16;
_bootSegmentBssSize_HI = _bootSegmentBssSize >> 16;
bootproc_HI = bootproc >> 16;
BOOT_STACK_TOP = (sBootThreadStack + BOOT_STACK_SIZE);
BOOT_STACK_TOP_HI = BOOT_STACK_TOP >> 16;

14913
spec

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,91 @@
include "$(BUILD_DIR)/src/libultra/io/piacs.o"
include "$(BUILD_DIR)/src/libultra/os/sendmesg.o"
include "$(BUILD_DIR)/src/libultra/os/stopthread.o"
include "$(BUILD_DIR)/src/libultra/io/viextendvstart.o"
include "$(BUILD_DIR)/src/libultra/io/vimodepallan1.o"
include "$(BUILD_DIR)/src/libultra/os/recvmesg.o"
include "$(BUILD_DIR)/src/libultra/os/initialize.o"
include "$(BUILD_DIR)/src/libultra/libc/ll.o"
include "$(BUILD_DIR)/src/libultra/os/exceptasm.o"
include "$(BUILD_DIR)/src/libultra/os/thread.o"
include "$(BUILD_DIR)/src/libultra/os/destroythread.o"
include "$(BUILD_DIR)/src/libultra/libc/bzero.o"
include "$(BUILD_DIR)/src/libultra/os/parameters.o"
include "$(BUILD_DIR)/src/libultra/os/createthread.o"
include "$(BUILD_DIR)/src/libultra/os/setsr.o"
include "$(BUILD_DIR)/src/libultra/os/getsr.o"
include "$(BUILD_DIR)/src/libultra/os/writebackdcache.o"
include "$(BUILD_DIR)/src/libultra/io/vigetnextframebuf.o"
include "$(BUILD_DIR)/src/libultra/io/pimgr.o"
include "$(BUILD_DIR)/src/libultra/io/devmgr.o"
include "$(BUILD_DIR)/src/libultra/io/pirawdma.o"
include "$(BUILD_DIR)/src/libultra/os/virtualtophysical.o"
include "$(BUILD_DIR)/src/libultra/io/viblack.o"
include "$(BUILD_DIR)/src/libultra/io/sirawread.o"
include "$(BUILD_DIR)/src/libultra/os/getthreadid.o"
include "$(BUILD_DIR)/src/libultra/os/setintmask.o"
include "$(BUILD_DIR)/src/libultra/io/visetmode.o"
include "$(BUILD_DIR)/src/libultra/os/probetlb.o"
include "$(BUILD_DIR)/src/libultra/os/getmemsize.o"
include "$(BUILD_DIR)/src/libultra/os/seteventmesg.o"
#if DEBUG_FEATURES
include "$(BUILD_DIR)/src/libultra/libc/xprintf.o"
#endif
include "$(BUILD_DIR)/src/libultra/os/unmaptlball.o"
include "$(BUILD_DIR)/src/libultra/io/epidma.o"
#if DEBUG_FEATURES
include "$(BUILD_DIR)/src/libultra/libc/string.o"
#endif
include "$(BUILD_DIR)/src/libultra/os/invalicache.o"
include "$(BUILD_DIR)/src/libultra/os/createmesgqueue.o"
include "$(BUILD_DIR)/src/libultra/os/invaldcache.o"
include "$(BUILD_DIR)/src/libultra/io/si.o"
include "$(BUILD_DIR)/src/libultra/os/jammesg.o"
include "$(BUILD_DIR)/src/libultra/os/setthreadpri.o"
include "$(BUILD_DIR)/src/libultra/os/getthreadpri.o"
include "$(BUILD_DIR)/src/libultra/io/epirawread.o"
include "$(BUILD_DIR)/src/libultra/io/viswapbuf.o"
include "$(BUILD_DIR)/src/libultra/io/epirawdma.o"
include "$(BUILD_DIR)/src/libultra/libc/bcmp.o"
include "$(BUILD_DIR)/src/libultra/os/gettime.o"
include "$(BUILD_DIR)/src/libultra/os/timerintr.o"
include "$(BUILD_DIR)/src/libultra/os/getcount.o"
include "$(BUILD_DIR)/src/libultra/os/setglobalintmask.o"
include "$(BUILD_DIR)/src/libultra/os/setcompare.o"
include "$(BUILD_DIR)/src/libultra/libc/bcopy.o"
include "$(BUILD_DIR)/src/libultra/os/resetglobalintmask.o"
include "$(BUILD_DIR)/src/libultra/os/interrupt.o"
include "$(BUILD_DIR)/src/libultra/io/vimodentsclan1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodempallan1.o"
include "$(BUILD_DIR)/src/libultra/io/vi.o"
include "$(BUILD_DIR)/src/libultra/io/viswapcontext.o"
include "$(BUILD_DIR)/src/libultra/io/pigetcmdq.o"
include "$(BUILD_DIR)/src/libultra/io/epiread.o"
include "$(BUILD_DIR)/src/libultra/io/visetspecial.o"
include "$(BUILD_DIR)/src/libultra/io/cartrominit.o"
#if DEBUG_FEATURES
include "$(BUILD_DIR)/src/libultra/io/vimodefpallan1.o"
#endif
include "$(BUILD_DIR)/src/libultra/os/setfpccsr.o"
include "$(BUILD_DIR)/src/libultra/os/getfpccsr.o"
#if DEBUG_FEATURES
include "$(BUILD_DIR)/src/libultra/io/epiwrite.o"
#endif
include "$(BUILD_DIR)/src/libultra/os/maptlbrdb.o"
include "$(BUILD_DIR)/src/libultra/os/yieldthread.o"
include "$(BUILD_DIR)/src/libultra/os/getcause.o"
include "$(BUILD_DIR)/src/libultra/io/epirawwrite.o"
#if DEBUG_FEATURES
include "$(BUILD_DIR)/src/libultra/libc/xlitob.o"
include "$(BUILD_DIR)/src/libultra/libc/ldiv.o"
include "$(BUILD_DIR)/src/libultra/libc/xldtob.o"
#endif
include "$(BUILD_DIR)/src/libultra/io/sirawwrite.o"
include "$(BUILD_DIR)/src/libultra/io/vimgr.o"
include "$(BUILD_DIR)/src/libultra/io/vigetcurrcontext.o"
include "$(BUILD_DIR)/src/libultra/os/startthread.o"
include "$(BUILD_DIR)/src/libultra/io/visetyscale.o"
include "$(BUILD_DIR)/src/libultra/io/visetxscale.o"
include "$(BUILD_DIR)/src/libultra/os/sethwintrroutine.o"
include "$(BUILD_DIR)/src/libultra/os/gethwintrroutine.o"
include "$(BUILD_DIR)/src/libultra/os/setwatchlo.o"

View file

@ -0,0 +1,72 @@
include "$(BUILD_DIR)/src/libultra/os/invaldcache.o"
include "$(BUILD_DIR)/src/libultra/os/invalicache.o"
include "$(BUILD_DIR)/src/libultra/libc/bcmp.o"
include "$(BUILD_DIR)/src/libultra/libc/bzero.o"
include "$(BUILD_DIR)/src/libultra/os/createmesgqueue.o"
include "$(BUILD_DIR)/src/libultra/os/recvmesg.o"
include "$(BUILD_DIR)/src/libultra/os/sendmesg.o"
include "$(BUILD_DIR)/src/libultra/os/getfpccsr.o"
include "$(BUILD_DIR)/src/libultra/os/getsr.o"
include "$(BUILD_DIR)/src/libultra/os/setfpccsr.o"
include "$(BUILD_DIR)/src/libultra/os/setsr.o"
include "$(BUILD_DIR)/src/libultra/os/createthread.o"
include "$(BUILD_DIR)/src/libultra/os/setthreadpri.o"
include "$(BUILD_DIR)/src/libultra/os/startthread.o"
include "$(BUILD_DIR)/src/libultra/os/stopthread.o"
include "$(BUILD_DIR)/src/libultra/os/thread.o"
include "$(BUILD_DIR)/src/libultra/os/gettime.o"
include "$(BUILD_DIR)/src/libultra/os/timerintr.o"
include "$(BUILD_DIR)/src/libultra/io/vigetnextframebuf.o"
include "$(BUILD_DIR)/src/libultra/io/vimgr.o"
include "$(BUILD_DIR)/src/libultra/io/vimodentsclan1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodepallan1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodempallan1.o"
include "$(BUILD_DIR)/src/libultra/io/visetmode.o"
include "$(BUILD_DIR)/src/libultra/io/visetspecial.o"
include "$(BUILD_DIR)/src/libultra/io/visetxscale.o"
include "$(BUILD_DIR)/src/libultra/io/visetyscale.o"
include "$(BUILD_DIR)/src/libultra/io/viswapbuf.o"
include "$(BUILD_DIR)/src/libultra/io/viswapcontext.o"
include "$(BUILD_DIR)/src/libultra/io/viblack.o"
include "$(BUILD_DIR)/src/libultra/io/viextendvstart.o"
include "$(BUILD_DIR)/src/libultra/os/exceptasm.o"
include "$(BUILD_DIR)/src/libultra/os/interrupt.o"
include "$(BUILD_DIR)/src/libultra/os/setintmask.o"
include "$(BUILD_DIR)/src/libultra/os/sethwintrroutine.o"
include "$(BUILD_DIR)/src/libultra/os/gethwintrroutine.o"
include "$(BUILD_DIR)/src/libultra/io/pimgr.o"
include "$(BUILD_DIR)/src/libultra/io/epirawdma.o"
include "$(BUILD_DIR)/src/libultra/io/epiread.o"
include "$(BUILD_DIR)/src/libultra/io/epidma.o"
include "$(BUILD_DIR)/src/libultra/io/cartrominit.o"
include "$(BUILD_DIR)/src/libultra/io/devmgr.o"
include "$(BUILD_DIR)/src/libultra/io/piacs.o"
include "$(BUILD_DIR)/src/libultra/os/parameters.o"
include "$(BUILD_DIR)/src/libultra/os/getmemsize.o"
include "$(BUILD_DIR)/src/libultra/os/initialize.o"
include "$(BUILD_DIR)/src/libultra/os/writebackdcache.o"
include "$(BUILD_DIR)/src/libultra/os/virtualtophysical.o"
include "$(BUILD_DIR)/src/libultra/libc/bcopy.o"
include "$(BUILD_DIR)/src/libultra/os/jammesg.o"
include "$(BUILD_DIR)/src/libultra/os/seteventmesg.o"
include "$(BUILD_DIR)/src/libultra/os/getcause.o"
include "$(BUILD_DIR)/src/libultra/os/setwatchlo.o"
include "$(BUILD_DIR)/src/libultra/reg/_getcount.o"
include "$(BUILD_DIR)/src/libultra/reg/_setcompare.o"
include "$(BUILD_DIR)/src/libultra/io/sirawread.o"
include "$(BUILD_DIR)/src/libultra/io/sirawwrite.o"
include "$(BUILD_DIR)/src/libultra/os/destroythread.o"
include "$(BUILD_DIR)/src/libultra/os/getthreadpri.o"
include "$(BUILD_DIR)/src/libultra/os/yieldthread.o"
include "$(BUILD_DIR)/src/libultra/os/probetlb.o"
include "$(BUILD_DIR)/src/libultra/os/maptlbrdb.o"
include "$(BUILD_DIR)/src/libultra/os/unmaptlball.o"
include "$(BUILD_DIR)/src/libultra/io/vi.o"
include "$(BUILD_DIR)/src/libultra/io/vigetcurrcontext.o"
include "$(BUILD_DIR)/src/libultra/os/setglobalintmask.o"
include "$(BUILD_DIR)/src/libultra/os/resetglobalintmask.o"
include "$(BUILD_DIR)/src/libultra/io/pirawdma.o"
include "$(BUILD_DIR)/src/libultra/io/pigetcmdq.o"
include "$(BUILD_DIR)/src/libultra/io/epirawread.o"
include "$(BUILD_DIR)/src/libultra/io/epirawwrite.o"
include "$(BUILD_DIR)/src/libultra/io/si.o"

View file

@ -0,0 +1,94 @@
include "$(BUILD_DIR)/src/libultra/io/piacs.o"
include "$(BUILD_DIR)/src/libultra/os/sendmesg.o"
include "$(BUILD_DIR)/src/libultra/os/stopthread.o"
#if OOT_VERSION >= PAL_1_0
include "$(BUILD_DIR)/src/libultra/io/viextendvstart.o"
include "$(BUILD_DIR)/src/libultra/io/vimodepallan1.o"
#endif
include "$(BUILD_DIR)/src/libultra/os/recvmesg.o"
include "$(BUILD_DIR)/src/libultra/libc/ll.o"
include "$(BUILD_DIR)/src/libultra/os/exceptasm.o"
include "$(BUILD_DIR)/src/libultra/os/thread.o"
include "$(BUILD_DIR)/src/libultra/os/destroythread.o"
include "$(BUILD_DIR)/src/libultra/libc/bzero.o"
include "$(BUILD_DIR)/src/libultra/os/createthread.o"
include "$(BUILD_DIR)/src/libultra/os/initialize.o"
include "$(BUILD_DIR)/src/libultra/os/parameters.o"
include "$(BUILD_DIR)/src/libultra/os/setsr.o"
include "$(BUILD_DIR)/src/libultra/os/getsr.o"
include "$(BUILD_DIR)/src/libultra/os/writebackdcache.o"
include "$(BUILD_DIR)/src/libultra/io/vigetnextframebuf.o"
include "$(BUILD_DIR)/src/libultra/io/pimgr.o"
include "$(BUILD_DIR)/src/libultra/io/devmgr.o"
include "$(BUILD_DIR)/src/libultra/io/pirawdma.o"
include "$(BUILD_DIR)/src/libultra/os/virtualtophysical.o"
include "$(BUILD_DIR)/src/libultra/io/viblack.o"
include "$(BUILD_DIR)/src/libultra/io/sirawread.o"
include "$(BUILD_DIR)/src/libultra/os/getthreadid.o"
include "$(BUILD_DIR)/src/libultra/os/setintmask.o"
include "$(BUILD_DIR)/src/libultra/io/visetmode.o"
include "$(BUILD_DIR)/src/libultra/os/probetlb.o"
include "$(BUILD_DIR)/src/libultra/os/getmemsize.o"
include "$(BUILD_DIR)/src/libultra/os/seteventmesg.o"
include "$(BUILD_DIR)/src/libultra/os/unmaptlball.o"
include "$(BUILD_DIR)/src/libultra/io/epidma.o"
include "$(BUILD_DIR)/src/libultra/os/invalicache.o"
include "$(BUILD_DIR)/src/libultra/os/createmesgqueue.o"
include "$(BUILD_DIR)/src/libultra/os/invaldcache.o"
include "$(BUILD_DIR)/src/libultra/io/si.o"
include "$(BUILD_DIR)/src/libultra/os/jammesg.o"
include "$(BUILD_DIR)/src/libultra/os/setthreadpri.o"
include "$(BUILD_DIR)/src/libultra/os/getthreadpri.o"
include "$(BUILD_DIR)/src/libultra/io/epirawread.o"
#if OOT_VERSION >= PAL_1_0
include "$(BUILD_DIR)/src/libultra/io/viswapbuf.o"
#endif
include "$(BUILD_DIR)/src/libultra/io/epirawdma.o"
include "$(BUILD_DIR)/src/libultra/os/gettime.o"
include "$(BUILD_DIR)/src/libultra/os/timerintr.o"
include "$(BUILD_DIR)/src/libultra/os/getcount.o"
include "$(BUILD_DIR)/src/libultra/os/setglobalintmask.o"
include "$(BUILD_DIR)/src/libultra/os/setcompare.o"
include "$(BUILD_DIR)/src/libultra/libc/bcopy.o"
include "$(BUILD_DIR)/src/libultra/os/resetglobalintmask.o"
include "$(BUILD_DIR)/src/libultra/os/interrupt.o"
#if OOT_NTSC
include "$(BUILD_DIR)/src/libultra/io/vimodentsclan1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodempallan1.o"
#endif
include "$(BUILD_DIR)/src/libultra/io/vi.o"
#if OOT_PAL
include "$(BUILD_DIR)/src/libultra/io/vimodentsclan1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodempallan1.o"
#endif
#if OOT_VERSION < PAL_1_0
include "$(BUILD_DIR)/src/libultra/io/vimodepallan1.o"
#endif
include "$(BUILD_DIR)/src/libultra/io/viswapcontext.o"
include "$(BUILD_DIR)/src/libultra/io/pigetcmdq.o"
include "$(BUILD_DIR)/src/libultra/io/epiread.o"
#if OOT_VERSION >= PAL_1_0
include "$(BUILD_DIR)/src/libultra/io/visetspecial.o"
#endif
include "$(BUILD_DIR)/src/libultra/io/cartrominit.o"
#if OOT_PAL
include "$(BUILD_DIR)/src/libultra/io/vimodefpallan1.o"
#endif
include "$(BUILD_DIR)/src/libultra/os/setfpccsr.o"
include "$(BUILD_DIR)/src/libultra/os/getfpccsr.o"
include "$(BUILD_DIR)/src/libultra/io/epiwrite.o"
include "$(BUILD_DIR)/src/libultra/os/maptlbrdb.o"
include "$(BUILD_DIR)/src/libultra/os/yieldthread.o"
include "$(BUILD_DIR)/src/libultra/os/getcause.o"
include "$(BUILD_DIR)/src/libultra/io/epirawwrite.o"
include "$(BUILD_DIR)/src/libultra/os/settimer.o"
include "$(BUILD_DIR)/src/libultra/io/sirawwrite.o"
include "$(BUILD_DIR)/src/libultra/io/vimgr.o"
include "$(BUILD_DIR)/src/libultra/io/vigetcurrcontext.o"
include "$(BUILD_DIR)/src/libultra/os/startthread.o"
#if OOT_VERSION >= PAL_1_0
include "$(BUILD_DIR)/src/libultra/io/visetyscale.o"
include "$(BUILD_DIR)/src/libultra/io/visetxscale.o"
#endif
include "$(BUILD_DIR)/src/libultra/os/sethwintrroutine.o"
include "$(BUILD_DIR)/src/libultra/os/gethwintrroutine.o"

View file

@ -0,0 +1,95 @@
#if DEBUG_FEATURES
include "$(BUILD_DIR)/src/libultra/io/pfsfreeblocks.o"
#endif
include "$(BUILD_DIR)/src/libultra/mgu/scale.o"
include "$(BUILD_DIR)/src/libultra/gu/sinf.o"
include "$(BUILD_DIR)/src/libultra/gu/sins.o"
include "$(BUILD_DIR)/src/libultra/io/sptask.o"
include "$(BUILD_DIR)/src/libultra/io/motor.o"
include "$(BUILD_DIR)/src/libultra/io/siacs.o"
include "$(BUILD_DIR)/src/libultra/io/controller.o"
include "$(BUILD_DIR)/src/libultra/io/contreaddata.o"
include "$(BUILD_DIR)/src/libultra/gu/perspective.o"
include "$(BUILD_DIR)/src/libultra/io/sprawdma.o"
include "$(BUILD_DIR)/src/libultra/io/sirawdma.o"
include "$(BUILD_DIR)/src/libultra/io/sptaskyield.o"
#if DEBUG_FEATURES
include "$(BUILD_DIR)/src/libultra/io/pfsreadwritefile.o"
include "$(BUILD_DIR)/src/libultra/io/pfsgetstatus.o"
#endif
include "$(BUILD_DIR)/src/libultra/mgu/mtxidentf.o"
include "$(BUILD_DIR)/src/libultra/gu/lookat.o"
#if DEBUG_FEATURES
include "$(BUILD_DIR)/src/libultra/io/pfsallocatefile.o"
#endif
include "$(BUILD_DIR)/src/libultra/os/stoptimer.o"
#if DEBUG_FEATURES
include "$(BUILD_DIR)/src/libultra/io/contpfs.o"
include "$(BUILD_DIR)/src/libultra/mgu/mtxl2f.o"
include "$(BUILD_DIR)/src/libultra/io/pfsfindfile.o"
#endif
include "$(BUILD_DIR)/src/libultra/gu/sqrtf.o"
include "$(BUILD_DIR)/src/libultra/os/afterprenmi.o"
include "$(BUILD_DIR)/src/libultra/io/contquery.o"
include "$(BUILD_DIR)/src/libultra/gu/lookathil.o"
#if !DEBUG_FEATURES
include "$(BUILD_DIR)/src/libultra/libc/xprintf.o"
include "$(BUILD_DIR)/src/libultra/libc/string.o"
#endif
include "$(BUILD_DIR)/src/libultra/io/sp.o"
include "$(BUILD_DIR)/src/libultra/mgu/mtxident.o"
include "$(BUILD_DIR)/src/libultra/gu/position.o"
include "$(BUILD_DIR)/src/libultra/io/sptaskyielded.o"
include "$(BUILD_DIR)/src/libultra/gu/rotate.o"
include "$(BUILD_DIR)/src/libultra/io/aisetfreq.o"
include "$(BUILD_DIR)/src/libultra/os/getactivequeue.o"
include "$(BUILD_DIR)/src/libultra/mgu/normalize.o"
include "$(BUILD_DIR)/src/libultra/io/dpgetstat.o"
include "$(BUILD_DIR)/src/libultra/io/dpsetstat.o"
#if DEBUG_FEATURES
include "$(BUILD_DIR)/src/libultra/io/pfsdeletefile.o"
#endif
include "$(BUILD_DIR)/src/libultra/gu/ortho.o"
include "$(BUILD_DIR)/src/libultra/gu/cosf.o"
include "$(BUILD_DIR)/src/libultra/gu/libm_vals.o"
include "$(BUILD_DIR)/src/libultra/gu/coss.o"
include "$(BUILD_DIR)/src/libultra/io/visetevent.o"
#if DEBUG_FEATURES
include "$(BUILD_DIR)/src/libultra/io/pfsisplug.o"
#endif
include "$(BUILD_DIR)/src/libultra/gu/us2dex.o"
include "$(BUILD_DIR)/src/libultra/io/pfsselectbank.o"
include "$(BUILD_DIR)/src/libultra/io/contsetch.o"
#if DEBUG_FEATURES
include "$(BUILD_DIR)/src/libultra/io/pfsfilestate.o"
include "$(BUILD_DIR)/src/libultra/io/pfsinitpak.o"
include "$(BUILD_DIR)/src/libultra/io/pfschecker.o"
#endif
include "$(BUILD_DIR)/src/libultra/io/aigetlen.o"
include "$(BUILD_DIR)/src/libultra/mgu/translate.o"
include "$(BUILD_DIR)/src/libultra/io/contramwrite.o"
#if !DEBUG_FEATURES
include "$(BUILD_DIR)/src/libultra/io/vimodefpallan1.o"
include "$(BUILD_DIR)/src/libultra/io/pfsgetstatus.o"
include "$(BUILD_DIR)/src/libultra/io/contpfs.o"
#endif
include "$(BUILD_DIR)/src/libultra/io/contramread.o"
include "$(BUILD_DIR)/src/libultra/io/crc.o"
#if !DEBUG_FEATURES
include "$(BUILD_DIR)/src/libultra/io/pfsisplug.o"
#endif
include "$(BUILD_DIR)/src/libultra/os/settimer.o"
#if !DEBUG_FEATURES
include "$(BUILD_DIR)/src/libultra/libc/xldtob.o"
include "$(BUILD_DIR)/src/libultra/libc/ldiv.o"
include "$(BUILD_DIR)/src/libultra/libc/xlitob.o"
#endif
include "$(BUILD_DIR)/src/libultra/io/spgetstat.o"
include "$(BUILD_DIR)/src/libultra/io/spsetstat.o"
include "$(BUILD_DIR)/src/libultra/os/writebackdcacheall.o"
include "$(BUILD_DIR)/src/libultra/os/getcurrfaultedthread.o"
include "$(BUILD_DIR)/src/libultra/mgu/mtxf2l.o"
include "$(BUILD_DIR)/src/libultra/libc/llcvt.o"
include "$(BUILD_DIR)/src/libultra/io/vigetcurrframebuf.o"
include "$(BUILD_DIR)/src/libultra/io/spsetpc.o"
include "$(BUILD_DIR)/src/libc/sqrt.o"

View file

@ -0,0 +1,125 @@
include "$(BUILD_DIR)/src/libultra/io/aigetlen.o"
include "$(BUILD_DIR)/src/libultra/io/aisetfreq.o"
include "$(BUILD_DIR)/src/libultra/audio/sl.o"
include "$(BUILD_DIR)/src/libultra/audio/synthesizer.o"
include "$(BUILD_DIR)/src/libultra/audio/syndelete.o"
include "$(BUILD_DIR)/src/libultra/audio/synallocfx.o"
include "$(BUILD_DIR)/src/libultra/os/writebackdcacheall.o"
include "$(BUILD_DIR)/src/libultra/io/contquery.o"
include "$(BUILD_DIR)/src/libultra/io/contreaddata.o"
include "$(BUILD_DIR)/src/libultra/io/controller.o"
include "$(BUILD_DIR)/src/libultra/io/contsetch.o"
include "$(BUILD_DIR)/src/libultra/gu/sqrtf.o"
include "$(BUILD_DIR)/src/libultra/gu/cosf.o"
include "$(BUILD_DIR)/src/libultra/gu/coss.o"
include "$(BUILD_DIR)/src/libultra/gu/lookat.o"
include "$(BUILD_DIR)/src/libultra/gu/lookathil.o"
include "$(BUILD_DIR)/src/libultra/gu/ortho.o"
include "$(BUILD_DIR)/src/libultra/gu/perspective.o"
include "$(BUILD_DIR)/src/libultra/gu/position.o"
include "$(BUILD_DIR)/src/libultra/gu/sinf.o"
include "$(BUILD_DIR)/src/libultra/gu/sins.o"
include "$(BUILD_DIR)/src/libultra/gu/us2dex.o"
include "$(BUILD_DIR)/src/libultra/libc/ll.o"
include "$(BUILD_DIR)/src/libultra/libc/llcvt.o"
include "$(BUILD_DIR)/src/libultra/libc/string.o"
include "$(BUILD_DIR)/src/libultra/libc/xprintf.o"
include "$(BUILD_DIR)/src/libultra/io/dpgetstat.o"
include "$(BUILD_DIR)/src/libultra/io/dpsetstat.o"
include "$(BUILD_DIR)/src/libultra/io/spgetstat.o"
include "$(BUILD_DIR)/src/libultra/io/spsetstat.o"
include "$(BUILD_DIR)/src/libultra/io/sptask.o"
include "$(BUILD_DIR)/src/libultra/io/sptaskyield.o"
include "$(BUILD_DIR)/src/libultra/io/sptaskyielded.o"
include "$(BUILD_DIR)/src/libultra/io/sirawdma.o"
include "$(BUILD_DIR)/src/libultra/io/siacs.o"
include "$(BUILD_DIR)/src/libultra/os/getthreadid.o"
include "$(BUILD_DIR)/src/libultra/os/getactivequeue.o"
include "$(BUILD_DIR)/src/libultra/os/settimer.o"
include "$(BUILD_DIR)/src/libultra/os/stoptimer.o"
include "$(BUILD_DIR)/src/libultra/io/vigetcurrframebuf.o"
include "$(BUILD_DIR)/src/libultra/io/visetevent.o"
include "$(BUILD_DIR)/src/libultra/io/vitbl.o"
include "$(BUILD_DIR)/src/libultra/io/vimodentsclpn1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodentsclpf1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodentsclaf1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodentsclpn2.o"
include "$(BUILD_DIR)/src/libultra/io/vimodentsclpf2.o"
include "$(BUILD_DIR)/src/libultra/io/vimodentsclan2.o"
include "$(BUILD_DIR)/src/libultra/io/vimodentsclaf2.o"
include "$(BUILD_DIR)/src/libultra/io/vimodentschpn1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodentschpf1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodentschan1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodentschaf1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodentschpn2.o"
include "$(BUILD_DIR)/src/libultra/io/vimodentschpf2.o"
include "$(BUILD_DIR)/src/libultra/io/vimodepallpn1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodepallpf1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodepallaf1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodepallpn2.o"
include "$(BUILD_DIR)/src/libultra/io/vimodepallpf2.o"
include "$(BUILD_DIR)/src/libultra/io/vimodepallan2.o"
include "$(BUILD_DIR)/src/libultra/io/vimodepallaf2.o"
include "$(BUILD_DIR)/src/libultra/io/vimodepalhpn1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodepalhpf1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodepalhan1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodepalhaf1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodepalhpn2.o"
include "$(BUILD_DIR)/src/libultra/io/vimodepalhpf2.o"
include "$(BUILD_DIR)/src/libultra/io/vimodempallpn1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodempallpf1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodempallaf1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodempallpn2.o"
include "$(BUILD_DIR)/src/libultra/io/vimodempallpf2.o"
include "$(BUILD_DIR)/src/libultra/io/vimodempallan2.o"
include "$(BUILD_DIR)/src/libultra/io/vimodempallaf2.o"
include "$(BUILD_DIR)/src/libultra/io/vimodempalhpn1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodempalhpf1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodempalhan1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodempalhaf1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodempalhpn2.o"
include "$(BUILD_DIR)/src/libultra/io/vimodempalhpf2.o"
include "$(BUILD_DIR)/src/libultra/io/vimodefpallpn1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodefpallpf1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodefpallan1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodefpallaf1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodefpallpn2.o"
include "$(BUILD_DIR)/src/libultra/io/vimodefpallpf2.o"
include "$(BUILD_DIR)/src/libultra/io/vimodefpallan2.o"
include "$(BUILD_DIR)/src/libultra/io/vimodefpallaf2.o"
include "$(BUILD_DIR)/src/libultra/io/vimodefpalhpn1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodefpalhpf1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodefpalhan1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodefpalhaf1.o"
include "$(BUILD_DIR)/src/libultra/io/vimodefpalhpn2.o"
include "$(BUILD_DIR)/src/libultra/io/vimodefpalhpf2.o"
include "$(BUILD_DIR)/src/libultra/mgu/mtxident.o"
include "$(BUILD_DIR)/src/libultra/mgu/mtxidentf.o"
include "$(BUILD_DIR)/src/libultra/mgu/mtxf2l.o"
include "$(BUILD_DIR)/src/libultra/mgu/scale.o"
include "$(BUILD_DIR)/src/libultra/mgu/translate.o"
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"
include "$(BUILD_DIR)/src/libultra/bb/sa/common.o"
include "$(BUILD_DIR)/src/libultra/io/motor.o"
include "$(BUILD_DIR)/src/libultra/os/afterprenmi.o"
include "$(BUILD_DIR)/src/libultra/audio/drvrnew.o"
include "$(BUILD_DIR)/src/libultra/audio/load.o"
include "$(BUILD_DIR)/src/libultra/audio/auxbus.o"
include "$(BUILD_DIR)/src/libultra/audio/env.o"
include "$(BUILD_DIR)/src/libultra/audio/filter.o"
include "$(BUILD_DIR)/src/libultra/audio/mainbus.o"
include "$(BUILD_DIR)/src/libultra/audio/resample.o"
include "$(BUILD_DIR)/src/libultra/audio/reverb.o"
include "$(BUILD_DIR)/src/libultra/audio/save.o"
include "$(BUILD_DIR)/src/libultra/audio/heapalloc.o"
include "$(BUILD_DIR)/src/libultra/audio/copy.o"
include "$(BUILD_DIR)/src/libultra/gu/libm_vals.o"
include "$(BUILD_DIR)/src/libultra/libc/xlitob.o"
include "$(BUILD_DIR)/src/libultra/libc/xldtob.o"
include "$(BUILD_DIR)/src/libultra/io/sp.o"
include "$(BUILD_DIR)/src/libultra/io/spsetpc.o"
include "$(BUILD_DIR)/src/libultra/io/sprawdma.o"
include "$(BUILD_DIR)/src/libultra/mgu/normalize.o"
include "$(BUILD_DIR)/src/libultra/libc/ldiv.o"

View file

@ -0,0 +1,72 @@
include "$(BUILD_DIR)/src/libultra/os/getintmask.o"
include "$(BUILD_DIR)/src/libultra/gu/scale.o"
include "$(BUILD_DIR)/src/libultra/gu/sinf.o"
include "$(BUILD_DIR)/src/libultra/gu/sins.o"
include "$(BUILD_DIR)/src/libultra/io/sptask.o"
include "$(BUILD_DIR)/src/libultra/io/motor.o"
include "$(BUILD_DIR)/src/libultra/io/siacs.o"
include "$(BUILD_DIR)/src/libultra/io/controller.o"
include "$(BUILD_DIR)/src/libultra/io/contreaddata.o"
include "$(BUILD_DIR)/src/libultra/gu/perspective.o"
include "$(BUILD_DIR)/src/libultra/io/sprawdma.o"
include "$(BUILD_DIR)/src/libultra/io/sirawdma.o"
include "$(BUILD_DIR)/src/libultra/io/sptaskyield.o"
include "$(BUILD_DIR)/src/libultra/gu/mtxutil.o"
include "$(BUILD_DIR)/src/libultra/gu/lookat.o"
include "$(BUILD_DIR)/src/libultra/os/stoptimer.o"
include "$(BUILD_DIR)/src/libultra/gu/sqrtf.o"
include "$(BUILD_DIR)/src/libultra/os/afterprenmi.o"
include "$(BUILD_DIR)/src/libultra/io/contquery.o"
include "$(BUILD_DIR)/src/libultra/gu/lookathil.o"
include "$(BUILD_DIR)/src/libultra/libc/xprintf.o"
include "$(BUILD_DIR)/src/libultra/libc/string.o"
include "$(BUILD_DIR)/src/libultra/io/sp.o"
#if OOT_VERSION < PAL_1_0
include "$(BUILD_DIR)/src/libultra/io/viswapbuf.o"
#endif
include "$(BUILD_DIR)/src/libultra/gu/position.o"
include "$(BUILD_DIR)/src/libultra/io/sptaskyielded.o"
include "$(BUILD_DIR)/src/libultra/gu/rotate.o"
include "$(BUILD_DIR)/src/libultra/io/aisetfreq.o"
include "$(BUILD_DIR)/src/libultra/os/getactivequeue.o"
include "$(BUILD_DIR)/src/libultra/gu/normalize.o"
include "$(BUILD_DIR)/src/libultra/io/dpgetstat.o"
include "$(BUILD_DIR)/src/libultra/io/dpsetstat.o"
include "$(BUILD_DIR)/src/libultra/gu/ortho.o"
include "$(BUILD_DIR)/src/libultra/gu/cosf.o"
include "$(BUILD_DIR)/src/libultra/gu/libm_vals.o"
#if OOT_VERSION < PAL_1_0
include "$(BUILD_DIR)/src/libultra/io/visetspecial.o"
#endif
include "$(BUILD_DIR)/src/libultra/gu/coss.o"
include "$(BUILD_DIR)/src/libultra/os/settime.o"
include "$(BUILD_DIR)/src/libultra/io/visetevent.o"
include "$(BUILD_DIR)/src/libultra/gu/us2dex.o"
include "$(BUILD_DIR)/src/libultra/io/pfsselectbank.o"
include "$(BUILD_DIR)/src/libultra/io/contsetch.o"
include "$(BUILD_DIR)/src/libultra/io/aigetlen.o"
include "$(BUILD_DIR)/src/libultra/gu/translate.o"
include "$(BUILD_DIR)/src/libultra/io/contramwrite.o"
#if OOT_VERSION == NTSC_1_2
include "$(BUILD_DIR)/src/libultra/io/vimodefpallan1.o"
#endif
include "$(BUILD_DIR)/src/libultra/io/pfsgetstatus.o"
include "$(BUILD_DIR)/src/libultra/io/contpfs.o"
include "$(BUILD_DIR)/src/libultra/libc/bcmp.o"
include "$(BUILD_DIR)/src/libultra/io/contramread.o"
include "$(BUILD_DIR)/src/libultra/io/crc.o"
include "$(BUILD_DIR)/src/libultra/io/pfsisplug.o"
include "$(BUILD_DIR)/src/libultra/libc/xlitob.o"
include "$(BUILD_DIR)/src/libultra/libc/ldiv.o"
include "$(BUILD_DIR)/src/libultra/libc/xldtob.o"
include "$(BUILD_DIR)/src/libultra/io/spgetstat.o"
include "$(BUILD_DIR)/src/libultra/io/spsetstat.o"
include "$(BUILD_DIR)/src/libultra/os/writebackdcacheall.o"
include "$(BUILD_DIR)/src/libultra/os/getcurrfaultedthread.o"
include "$(BUILD_DIR)/src/libultra/libc/llcvt.o"
#if OOT_VERSION < PAL_1_0
include "$(BUILD_DIR)/src/libultra/io/visetyscale.o"
#endif
include "$(BUILD_DIR)/src/libultra/io/vigetcurrframebuf.o"
include "$(BUILD_DIR)/src/libultra/io/spsetpc.o"
include "$(BUILD_DIR)/src/libc/sqrt.o"

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

3911
spec_includes/scenes_n64.inc Normal file

File diff suppressed because it is too large Load diff

View file

@ -3,7 +3,14 @@
OSPiHandle __DriveRomHandle;
OSPiHandle* osDriveRomInit(void) {
#if PLATFORM_IQUE && defined(NON_MATCHING)
// On iQue, the compiled output of this file is patched so that the
// `!first` check is always taken. For non-matching builds, we edit the
// source code instead.
static u32 first = false;
#else
static u32 first = true;
#endif
register s32 status;
register u32 value;
register u32 prevInt;

View file

@ -57,7 +57,7 @@ void Idle_ThreadEntry(void* arg) {
PRINTF(T("作製者 : %s\n", "Created by: %s\n"), gBuildCreator);
PRINTF(T("作成日時 : %s\n", "Created : %s\n"), gBuildDate);
PRINTF("MAKEOPTION: %s\n", gBuildMakeOption);
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
PRINTF(T("RAMサイズは %d キロバイトです(osMemSize/osGetMemSize)\n",
"RAM size is %d kilobytes (osMemSize/osGetMemSize)\n"),
(s32)osMemSize / 1024);
@ -70,7 +70,7 @@ void Idle_ThreadEntry(void* arg) {
PRINTF(T("YIELDバッファのサイズは %d キロバイトです\n", "YIELD buffer size is %d kilobytes\n"), 3);
PRINTF(T("オーディオヒープのサイズは %d キロバイトです\n", "Audio heap size is %d kilobytes\n"),
((intptr_t)&gAudioHeap[ARRAY_COUNT(gAudioHeap)] - (intptr_t)gAudioHeap) / 1024);
PRINTF(VT_RST);
PRINTF_RST();
osCreateViManager(OS_PRIORITY_VIMGR);

1003
src/boot/inflate.c Normal file

File diff suppressed because it is too large Load diff

8
src/boot/is_debug_ique.c Normal file
View file

@ -0,0 +1,8 @@
void osSyncPrintfUnused() {
}
void osSyncPrintf() {
}
void rmonPrintf() {
}

View file

@ -7,7 +7,7 @@
s32 gCurrentRegion = 0;
void Locale_Init(void) {
#if PLATFORM_N64
#if !PLATFORM_GC
ALIGNED(4) u8 regionInfo[4];
u8 countryCode;
@ -24,6 +24,7 @@ void Locale_Init(void) {
countryCode = sCartInfo.countryCode;
#endif
#if !PLATFORM_IQUE
switch (countryCode) {
case 'J': // "NTSC-J (Japan)"
gCurrentRegion = REGION_JP;
@ -37,16 +38,19 @@ void Locale_Init(void) {
break;
#endif
default:
PRINTF(VT_COL(RED, WHITE));
PRINTF_COLOR_ERROR();
PRINTF(T("z_locale_init: 日本用かアメリカ用か判別できません\n",
"z_locale_init: Can't tell if it's for Japan or America\n"));
LogUtils_HungupThread("../z_locale.c", LN4(86, 92, 101, 118, UNK_LINE));
LogUtils_HungupThread("../z_locale.c", LN4(86, 92, 101, UNK_LINE, 118));
PRINTF(VT_RST);
break;
}
PRINTF(T("z_locale_init:日本用かアメリカ用か3コンで判断させる\n",
"z_locale_init: Determine whether it is for Japan or America using 3 controls\n"));
#else
gCurrentRegion = REGION_US;
#endif
}
void Locale_ResetRegion(void) {

View file

@ -28,7 +28,7 @@
#endif
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \
"ntsc-1.2:82 pal-1.0:80 pal-1.1:80"
"ntsc-1.2:66 pal-1.0:64 pal-1.1:64"
StackEntry sDmaMgrStackInfo;
OSMesgQueue sDmaMgrMsgQueue;
@ -53,11 +53,20 @@ const char* sDmaMgrFileNames[] = {
#include "tables/dmadata_table.h"
};
#endif
#undef DEFINE_DMA_ENTRY
#if PLATFORM_N64 || DEBUG_FEATURES
#endif
#define SET_IOMSG(ioMsg, queue, rom, ram, buffSize) \
do { \
(ioMsg).hdr.pri = OS_MESG_PRI_NORMAL; \
(ioMsg).hdr.retQueue = (queue); \
(ioMsg).devAddr = (rom); \
(ioMsg).dramAddr = (ram); \
(ioMsg).size = (buffSize); \
} while (0)
#if !PLATFORM_GC || DEBUG_FEATURES
/**
* Compares `str1` and `str2`.
*
@ -66,7 +75,7 @@ const char* sDmaMgrFileNames[] = {
* -1 if the first character that does not match has a smaller value in str1 than str2,
* +1 if the first character that does not match has a greater value in str1 than str2
*/
s32 DmaMgr_StrCmp(const char* str1, const char* str2) {
s32 DmaMgr_StrCmp(const u8* str1, const u8* str2) {
while (*str1 != '\0') {
if (*str1 > *str2) {
return 1;
@ -103,6 +112,9 @@ s32 DmaMgr_DmaRomToRam(uintptr_t rom, void* ram, size_t size) {
OSMesg msg;
s32 ret;
size_t buffSize = gDmaMgrDmaBuffSize;
#if DEBUG_FEATURES
UNUSED s32 pad;
#endif
if (buffSize == 0) {
buffSize = DMAMGR_DEFAULT_BUFSIZE;
@ -116,13 +128,7 @@ s32 DmaMgr_DmaRomToRam(uintptr_t rom, void* ram, size_t size) {
// The system avoids large DMAs as these would stall the PI for too long, potentially causing issues with
// audio. To allow audio to continue to DMA whenever it needs to, other DMAs are split into manageable chunks.
if (1) {} // Necessary to match
ioMsg.hdr.pri = OS_MESG_PRI_NORMAL;
ioMsg.hdr.retQueue = &queue;
ioMsg.devAddr = rom;
ioMsg.dramAddr = ram;
ioMsg.size = buffSize;
SET_IOMSG(ioMsg, &queue, rom, ram, buffSize);
if (gDmaMgrVerbose == 10) {
PRINTF(T("%10lld ノーマルDMA %08x %08x %08x (%d)\n", "%10lld Normal DMA %08x %08x %08x (%d)\n"),
@ -151,15 +157,9 @@ s32 DmaMgr_DmaRomToRam(uintptr_t rom, void* ram, size_t size) {
ram = (u8*)ram + buffSize;
}
if (1) { // Also necessary to match
s32 pad[2];
}
SET_IOMSG(ioMsg, &queue, rom, ram, size);
ioMsg.hdr.pri = OS_MESG_PRI_NORMAL;
ioMsg.hdr.retQueue = &queue;
ioMsg.devAddr = rom;
ioMsg.dramAddr = ram;
ioMsg.size = size;
{ UNUSED s32 pad2; }
if (gDmaMgrVerbose == 10) {
PRINTF(T("%10lld ノーマルDMA %08x %08x %08x (%d)\n", "%10lld Normal DMA %08x %08x %08x (%d)\n"),
@ -242,11 +242,7 @@ void DmaMgr_DmaFromDriveRom(void* ram, uintptr_t rom, size_t size) {
osInvalDCache(ram, size);
osCreateMesgQueue(&queue, &msg, 1);
ioMsg.hdr.retQueue = &queue;
ioMsg.hdr.pri = OS_MESG_PRI_NORMAL;
ioMsg.devAddr = rom;
ioMsg.dramAddr = ram;
ioMsg.size = size;
SET_IOMSG(ioMsg, &queue, rom, ram, size);
handle->transferInfo.cmdType = 2;
osEPiStartDma(handle, &ioMsg, OS_READ);
@ -272,7 +268,7 @@ NORETURN void DmaMgr_Error(DmaRequest* req, const char* filename, const char* er
char buff2[80];
PRINTF("%c", BEL);
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("DMA致命的エラー(%s)\nROM:%X RAM:%X SIZE:%X %s\n", "DMA Fatal Error (%s)\nROM:%X RAM:%X SIZE:%X %s\n"),
errorDesc != NULL ? errorDesc : (errorName != NULL ? errorName : "???"), vrom, ram, size,
filename != NULL ? filename : "???");
@ -283,7 +279,7 @@ NORETURN void DmaMgr_Error(DmaRequest* req, const char* filename, const char* er
PRINTF("DMA ERROR: %s %d", sDmaMgrCurFileName, sDmaMgrCurFileLine);
}
PRINTF(VT_RST);
PRINTF_RST();
if (req->filename != NULL) {
sprintf(buff1, "DMA ERROR: %s %d", req->filename, req->line);
@ -342,7 +338,8 @@ const char* DmaMgr_GetFileName(uintptr_t vrom) {
return "(unknown)";
}
if (DmaMgr_StrCmp(ret, "kanji") == 0 || DmaMgr_StrCmp(ret, "link_animetion") == 0) {
if (DmaMgr_StrCmp((const u8*)ret, (const u8*)"kanji") == 0 ||
DmaMgr_StrCmp((const u8*)ret, (const u8*)"link_animetion") == 0) {
// This check may be related to these files being too large to be loaded all at once, however a NULL filename
// does not prevent them from being loaded.
return NULL;
@ -350,7 +347,7 @@ const char* DmaMgr_GetFileName(uintptr_t vrom) {
return ret;
#elif PLATFORM_GC
return "";
#elif PLATFORM_N64
#else
return "??";
#endif
}
@ -380,19 +377,17 @@ void DmaMgr_ProcessRequest(DmaRequest* req) {
if (vrom >= iter->file.vromStart && vrom < iter->file.vromEnd) {
// Found the region this request falls into
#if PLATFORM_N64
// Based on the MM Debug ROM, these strings are part of the condition for the empty if statement below,
// as `... && DmaMgr_StrCmp("", "kanji") != 0 && DmaMgr_StrCmp("", "link_animetion") != 0`
(void)"";
(void)"kanji";
(void)"";
(void)"link_animetion";
#endif
if (0) {
// The string is defined in .rodata of debug builds but not used, suggesting a debug print is here
// but was optimized out in some way.
PRINTF("DMA ROM:%08X RAM:%08X SIZE:%08X %s\n", vrom, ram, size, filename);
#if !PLATFORM_GC
// Based on the MM Debug ROM, these strings are part of the condition for the empty if statement below
if (DmaMgr_StrCmp((const u8*)"", (const u8*)"kanji") != 0 &&
DmaMgr_StrCmp((const u8*)"", (const u8*)"link_animetion") != 0)
#endif
{
// The string is defined in .rodata of debug builds but not used, suggesting a debug print is here
// but was optimized out in some way.
PRINTF("DMA ROM:%08X RAM:%08X SIZE:%08X %s\n", vrom, ram, size, filename);
}
}
if (iter->romEnd == 0) {
@ -405,10 +400,10 @@ void DmaMgr_ProcessRequest(DmaRequest* req) {
DMA_ERROR(req, filename, "Segment Alignment Error",
T("セグメント境界をまたがってDMA転送することはできません",
"DMA transfers cannot cross segment boundaries"),
"../z_std_dma.c", LN3(575, 578, 726));
"../z_std_dma.c", LN3(575, 578, 595, 726));
}
DmaMgr_DmaRomToRam(iter->romStart + (vrom - iter->file.vromStart), ram, size);
DmaMgr_DmaRomToRam(iter->romStart + vrom - iter->file.vromStart, ram, size);
found = true;
if (0) {
@ -417,16 +412,16 @@ void DmaMgr_ProcessRequest(DmaRequest* req) {
} else {
// File is compressed. Files that are stored compressed must be loaded into RAM all at once.
romStart = iter->romStart;
romSize = iter->romEnd - iter->romStart;
romStart = iter->romStart;
if (vrom != iter->file.vromStart) {
if (iter->file.vromStart != vrom) {
// Error, requested vrom is not the start of a file
DMA_ERROR(req, filename, "Can't Transfer Segment",
T("圧縮されたセグメントの途中からはDMA転送することはできません",
"DMA transfer cannot be performed from the middle of a compressed segment"),
"../z_std_dma.c", LN3(595, 598, 746));
"../z_std_dma.c", LN3(595, 598, 615, 746));
}
if (size != iter->file.vromEnd - iter->file.vromStart) {
@ -435,13 +430,19 @@ void DmaMgr_ProcessRequest(DmaRequest* req) {
DMA_ERROR(req, filename, "Can't Transfer Segment",
T("圧縮されたセグメントの一部だけをDMA転送することはできません",
"It is not possible to DMA only part of a compressed segment"),
"../z_std_dma.c", LN3(601, 604, 752));
"../z_std_dma.c", LN3(601, 604, 621, 752));
}
// Reduce the thread priority and decompress the file, the decompression routine handles the DMA
// in chunks. Restores the thread priority when done.
osSetThreadPri(NULL, THREAD_PRI_DMAMGR_LOW);
#if !PLATFORM_IQUE
Yaz0_Decompress(romStart, ram, romSize);
#else
gzip_decompress(romStart, ram, romSize);
#endif
osSetThreadPri(NULL, THREAD_PRI_DMAMGR);
found = true;
@ -452,7 +453,7 @@ void DmaMgr_ProcessRequest(DmaRequest* req) {
break;
}
#if PLATFORM_N64
#if !PLATFORM_GC
if (i != 0) {
i += 4;
}
@ -469,11 +470,12 @@ void DmaMgr_ProcessRequest(DmaRequest* req) {
DMA_ERROR(req, NULL, "DATA DON'T EXIST",
T("該当するデータが存在しません", "Corresponding data does not exist"), "../z_std_dma.c",
LN3(621, 624, 771));
LN3(621, 624, 641, 771));
return;
} else {
// ROM is uncompressed, allow arbitrary DMA even if the region is not marked in the filesystem
DmaMgr_DmaRomToRam(vrom, ram, size);
romStart = vrom;
DmaMgr_DmaRomToRam(romStart, ram, size);
if (0) {
PRINTF(T("No Press ROM:%08X RAM:%08X SIZE:%08X (非公式)\n",
@ -534,6 +536,10 @@ s32 DmaMgr_RequestAsync(DmaRequest* req, void* ram, uintptr_t vrom, size_t size,
OSMesg msg) {
static s32 sDmaMgrQueueFullLogged = 0;
#if PLATFORM_IQUE
PRINTF("dmacopy_bg(%x, %x, %x, %x, %x, %x, %x)\n", req, ram, vrom, size, unk, queue, msg);
#endif
#if DEBUG_FEATURES
if ((ram == NULL) || (osMemSize < OS_K0_TO_PHYSICAL(ram) + size) || (vrom & 1) || (vrom > 0x4000000) ||
(size == 0) || (size & 1)) {
@ -562,12 +568,12 @@ s32 DmaMgr_RequestAsync(DmaRequest* req, void* ram, uintptr_t vrom, size_t size,
if (1 && (sDmaMgrQueueFullLogged == 0) && MQ_IS_FULL(&sDmaMgrMsgQueue)) {
sDmaMgrQueueFullLogged++;
PRINTF("%c", BEL);
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("dmaEntryMsgQが一杯です。キューサイズの再検討をおすすめします。",
"dmaEntryMsgQ is full. Reconsider your queue size."));
LOG_NUM("(sizeof(dmaEntryMsgBufs) / sizeof(dmaEntryMsgBufs[0]))", ARRAY_COUNT(sDmaMgrMsgBuf), "../z_std_dma.c",
952);
PRINTF(VT_RST);
PRINTF_RST();
}
#endif
@ -608,9 +614,10 @@ void DmaMgr_Init(void) {
// DMA the dma data table to RAM
DmaMgr_DmaRomToRam((uintptr_t)_dmadataSegmentRomStart, _dmadataSegmentStart,
(u32)(_dmadataSegmentRomEnd - _dmadataSegmentRomStart));
PRINTF("dma_rom_ad[]\n");
#if DEBUG_FEATURES
PRINTF("dma_rom_ad[]\n");
name = sDmaMgrFileNames;
iter = gDmaDataTable;
idx = 0;
@ -641,7 +648,7 @@ void DmaMgr_Init(void) {
PRINTF("_bootSegmentRomStart(%08x) != dma_rom_ad[0].rom_b(%08x)\n", _bootSegmentRomStart,
gDmaDataTable[0].file.vromEnd);
//! @bug The main code file where fault.c resides is not yet loaded
Fault_AddHungupAndCrash("../z_std_dma.c", LN3(837, 840, 1055));
Fault_AddHungupAndCrash("../z_std_dma.c", LN3(837, 840, 859, 1055));
}
// Start the DMA manager

View file

@ -1 +0,0 @@

View file

@ -1,7 +1,5 @@
#include "global.h"
#if DEBUG_FEATURES
#define DEBUG_CAM_CONTROLLER_PORT 2
static PlayState* sPlay;
@ -2368,5 +2366,3 @@ void func_800BB060(void) {
int func_800BB06C(void) {
return sDebugCamPtr->unk_00 == 2 && sDebugCamAnim.unk_0A != 0;
}
#endif

View file

@ -40,10 +40,8 @@
* DPad-Up may be pressed to enable sending fault pages over osSyncPrintf as well as displaying them on-screen.
* DPad-Down disables sending fault pages over osSyncPrintf.
*/
#if !PLATFORM_N64
#pragma increment_block_number "gc-eu:160 gc-eu-mq:160 gc-eu-mq-dbg:160 gc-jp:176 gc-jp-ce:176 gc-jp-mq:176 gc-us:176" \
"gc-us-mq:176"
#pragma increment_block_number "gc-eu:160 gc-eu-mq:160 gc-eu-mq-dbg:144 gc-jp:160 gc-jp-ce:160 gc-jp-mq:160 gc-us:160" \
"gc-us-mq:160"
#include "global.h"
#include "alloca.h"
@ -1340,5 +1338,3 @@ NORETURN void Fault_AddHungupAndCrash(const char* file, int line) {
sprintf(msg, "HungUp %s:%d", file, line);
Fault_AddHungupAndCrashImpl(msg, NULL);
}
#endif

View file

@ -9,8 +9,6 @@
#include "terminal.h"
#pragma increment_block_number "gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128"
#if !PLATFORM_N64
typedef struct FaultDrawer {
/* 0x00 */ u16* fb;
/* 0x04 */ u16 w;
@ -344,5 +342,3 @@ void Fault_InitDrawer(void) {
bcopy(&sFaultDrawerDefault, &sFaultDrawer, sizeof(FaultDrawer));
sFaultDrawer.fb = (u16*)(PHYS_TO_K0(osMemSize) - sizeof(u16[SCREEN_HEIGHT][SCREEN_WIDTH]));
}
#endif

View file

@ -1,5 +1,3 @@
#if PLATFORM_N64
#pragma increment_block_number "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0"
#include "global.h"
@ -849,5 +847,3 @@ NORETURN void Fault_AddHungupAndCrash(const char* file, int line) {
sprintf(msg, "HungUp %s:%d", file, line);
Fault_AddHungupAndCrashImpl(msg, NULL);
}
#endif

View file

@ -409,12 +409,12 @@ void GameState_Realloc(GameState* gameState, size_t size) {
SystemArena_GetSizes(&systemMaxFree, &systemFree, &systemAlloc);
if ((systemMaxFree - 0x10) < size) {
PRINTF("%c", BEL);
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("メモリが足りません。ハイラルサイズを可能な最大値に変更します\n",
"Not enough memory. Change Hyrule size to maximum possible value\n"));
PRINTF("(hyral=%08x max=%08x free=%08x alloc=%08x)\n", size, systemMaxFree, systemFree, systemAlloc);
PRINTF(VT_RST);
PRINTF_RST();
size = systemMaxFree - 0x10;
}
@ -557,9 +557,9 @@ void* GameState_Alloc(GameState* gameState, size_t size, const char* file, int l
}
}
if (ret != NULL) {
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
PRINTF("game_alloc(%08x) %08x-%08x [%s:%d]\n", size, ret, (uintptr_t)ret + size, file, line);
PRINTF(VT_RST);
PRINTF_RST();
}
return ret;
}

View file

@ -188,9 +188,9 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx) {
if (msg == (OSMesg)666) {
#if DEBUG_FEATURES
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("RCPが帰ってきませんでした。", "RCP did not return."));
PRINTF(VT_RST);
PRINTF_RST();
LogUtils_LogHexDump((void*)PHYS_TO_K1(SP_BASE_REG), 0x20);
LogUtils_LogHexDump((void*)PHYS_TO_K1(DPC_BASE_REG), 0x20);
@ -380,7 +380,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
PRINTF("%c", BEL);
PRINTF(VT_COL(RED, WHITE) T("ダイナミック領域先頭が破壊されています\n", "Dynamic area head is destroyed\n")
VT_RST);
Fault_AddHungupAndCrash("../graph.c", LN4(937, 940, 951, 1070, 1067));
Fault_AddHungupAndCrash("../graph.c", LN4(937, 940, 951, 1067, 1070));
}
if (pool->tailMagic != GFXPOOL_TAIL_MAGIC) {
@ -388,7 +388,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
PRINTF("%c", BEL);
PRINTF(VT_COL(RED, WHITE)
T("ダイナミック領域末尾が破壊されています\n", "Dynamic region tail is destroyed\n") VT_RST);
Fault_AddHungupAndCrash("../graph.c", LN4(943, 946, 957, 1076, 1073));
Fault_AddHungupAndCrash("../graph.c", LN4(943, 946, 957, 1073, 1076));
}
}
@ -481,7 +481,7 @@ void Graph_ThreadEntry(void* arg0) {
sprintf(faultMsg, "CLASS SIZE= %d bytes", size);
Fault_AddHungupAndCrashImpl("GAME CLASS MALLOC FAILED", faultMsg);
#else
Fault_AddHungupAndCrash("../graph.c", LN4(1067, 1070, 1081, 1200, 1197));
Fault_AddHungupAndCrash("../graph.c", LN4(1067, 1070, 1081, 1197, 1200));
#endif
}

View file

@ -185,11 +185,11 @@ void IrqMgr_CheckStacks(void) {
PRINTF(T("スタックは大丈夫みたいです\n", "The stack looks ok\n"));
} else {
PRINTF("%c", BEL);
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("スタックがオーバーフローしたか危険な状態です\n", "Stack overflow or dangerous\n"));
PRINTF(T("早々にスタックサイズを増やすか、スタックを消費しないようにしてください\n",
"Increase stack size early or don't consume stack\n"));
PRINTF(VT_RST);
PRINTF_RST();
}
}

View file

@ -23,8 +23,8 @@ extern struct IrqMgr gIrqMgr;
#include "n64dd.h"
#endif
#pragma increment_block_number "gc-eu:160 gc-eu-mq:160 gc-jp:160 gc-jp-ce:160 gc-jp-mq:160 gc-us:160 gc-us-mq:160" \
"ntsc-1.0:141 ntsc-1.1:141 ntsc-1.2:141 pal-1.0:139 pal-1.1:139"
#pragma increment_block_number "gc-eu:144 gc-eu-mq:144 gc-jp:144 gc-jp-ce:144 gc-jp-mq:144 gc-us:144 gc-us-mq:144" \
"ntsc-1.0:127 ntsc-1.1:127 ntsc-1.2:127 pal-1.0:125 pal-1.1:125"
extern u8 _buffersSegmentEnd[];
@ -59,11 +59,11 @@ OSMesg sSerialMsgBuf[1];
#if DEBUG_FEATURES
void Main_LogSystemHeap(void) {
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
PRINTF(
T("システムヒープサイズ %08x(%dKB) 開始アドレス %08x\n", "System heap size %08x (%dKB) Start address %08x\n"),
gSystemHeapSize, gSystemHeapSize / 1024, _buffersSegmentEnd);
PRINTF(VT_RST);
PRINTF_RST();
}
#endif

View file

@ -35,9 +35,9 @@
#define PADMGR_LOG(controllerNum, msg) \
if (DEBUG_FEATURES) { \
PRINTF(VT_FGCOL(YELLOW)); \
PRINTF_COLOR_YELLOW(); \
PRINTF(T("padmgr: %dコン: %s\n", "padmgr: Controller %d: %s\n"), (controllerNum) + 1, (msg)); \
PRINTF(VT_RST); \
PRINTF_RST(); \
} \
(void)0
@ -327,7 +327,7 @@ void PadMgr_UpdateInputs(PadMgr* padMgr) {
default:
// Unknown error response
LOG_HEX("padnow1->errno", pad->errno, "../padmgr.c", 396);
Fault_AddHungupAndCrash("../padmgr.c", LN3(379, 382, 397));
Fault_AddHungupAndCrash("../padmgr.c", LN3(379, 382, 397, 397));
break;
}

View file

@ -185,9 +185,9 @@ void SpeedMeter_DrawAllocEntry(SpeedMeterAllocEntry* this, GraphicsContext* gfxC
Gfx* gfx;
if (this->maxval == 0) {
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
LOG_NUM("this->maxval", this->maxval, "../speed_meter.c", 313);
PRINTF(VT_RST);
PRINTF_RST();
} else {
OPEN_DISPS(gfxCtx, "../speed_meter.c", 318);

View file

@ -34,7 +34,7 @@ void SysCfb_Init(s32 n64dd) {
PRINTF("RAM4M mode\n");
sSysCfbEnd = 0x80400000;
} else {
LogUtils_HungupThread("../sys_cfb.c", LN4(305, 308, 322, 354, 341));
LogUtils_HungupThread("../sys_cfb.c", LN4(305, 308, 322, 341, 354));
}
screenSize = SCREEN_WIDTH * SCREEN_HEIGHT;

View file

@ -5,7 +5,7 @@
#include "macros.h"
#include "sys_math3d.h"
#pragma increment_block_number "gc-eu:99 gc-eu-mq:99 gc-jp:99 gc-jp-ce:99 gc-jp-mq:99 gc-us:99 gc-us-mq:99" \
#pragma increment_block_number "gc-eu:98 gc-eu-mq:98 gc-jp:98 gc-jp-ce:98 gc-jp-mq:98 gc-us:98 gc-us-mq:98" \
"ntsc-1.0:80 ntsc-1.1:80 ntsc-1.2:79 pal-1.0:80 pal-1.1:80"
s32 Math3D_LineVsLineClosestTwoPoints(Vec3f* lineAPointA, Vec3f* lineAPointB, Vec3f* lineBPointA, Vec3f* lineBPointB,
@ -127,11 +127,11 @@ void Math3D_LineClosestToPoint(InfiniteLine* line, Vec3f* pos, Vec3f* closestPoi
dirVectorLengthSq = Math3D_Vec3fMagnitudeSq(&line->dir);
if (IS_ZERO(dirVectorLengthSq)) {
PRINTF(VT_COL(YELLOW, BLACK));
PRINTF_COLOR_WARNING();
PRINTF(T("Math3D_lineVsPosSuisenCross():直線の長さがありません\n",
"Math3D_lineVsPosSuisenCross(): No straight line length\n"));
PRINTF(T("cross = pos を返します。\n", "Returns cross = pos.\n"));
PRINTF(VT_RST);
PRINTF_RST();
Math_Vec3f_Copy(closestPoint, pos);
//! @bug Missing early return
}
@ -930,11 +930,11 @@ f32 Math3D_Plane(Plane* plane, Vec3f* pointOnPlane) {
*/
f32 Math3D_UDistPlaneToPos(f32 nx, f32 ny, f32 nz, f32 originDist, Vec3f* p) {
if (DEBUG_FEATURES && IS_ZERO(sqrtf(SQ(nx) + SQ(ny) + SQ(nz)))) {
PRINTF(VT_COL(YELLOW, BLACK));
PRINTF_COLOR_WARNING();
PRINTF(T("Math3DLengthPlaneAndPos():法線size がゼロ近いです%f %f %f\n",
"Math3DLengthPlaneAndPos(): Normal size is near zero %f %f %f\n"),
nx, ny, nz);
PRINTF(VT_RST);
PRINTF_RST();
return 0.0f;
}
return fabsf(Math3D_DistPlaneToPos(nx, ny, nz, originDist, p));
@ -949,11 +949,11 @@ f32 Math3D_DistPlaneToPos(f32 nx, f32 ny, f32 nz, f32 originDist, Vec3f* p) {
normMagnitude = sqrtf(SQ(nx) + SQ(ny) + SQ(nz));
if (IS_ZERO(normMagnitude)) {
PRINTF(VT_COL(YELLOW, BLACK));
PRINTF_COLOR_WARNING();
PRINTF(T("Math3DSignedLengthPlaneAndPos():法線size がゼロ近いです%f %f %f\n",
"Math3DSignedLengthPlaneAndPos(): Normal size is close to zero %f %f %f\n"),
nx, ny, nz);
PRINTF(VT_RST);
PRINTF_RST();
return 0.0f;
}
return Math3D_Planef(nx, ny, nz, originDist, p) / normMagnitude;

View file

@ -18,12 +18,12 @@ void Overlay_LoadGameState(GameStateOverlay* overlayEntry) {
return;
}
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
PRINTF("OVL(d):Seg:%08x-%08x Ram:%08x-%08x Off:%08x %s\n", overlayEntry->vramStart, overlayEntry->vramEnd,
overlayEntry->loadedRamAddr,
(u32)overlayEntry->loadedRamAddr + (u32)overlayEntry->vramEnd - (u32)overlayEntry->vramStart,
(u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr, "");
PRINTF(VT_RST);
PRINTF_RST();
if (overlayEntry->unk_14 != NULL) {
overlayEntry->unk_14 = (void*)((u32)overlayEntry->unk_14 -

File diff suppressed because it is too large Load diff

View file

@ -40,14 +40,14 @@ void DynaPolyActor_UpdateCarriedActorPos(CollisionContext* colCtx, s32 bgId, Act
if (BGCHECK_XYZ_ABSMAX <= pos.x || pos.x <= -BGCHECK_XYZ_ABSMAX || BGCHECK_XYZ_ABSMAX <= pos.y ||
pos.y <= -BGCHECK_XYZ_ABSMAX || BGCHECK_XYZ_ABSMAX <= pos.z || pos.z <= -BGCHECK_XYZ_ABSMAX) {
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
//! @bug file and line are not passed to PRINTF
PRINTF(T("BGCheckCollection_typicalActorPos():位置が妥当ではありません。\n"
"pos (%f,%f,%f) file:%s line:%d\n",
"BGCheckCollection_typicalActorPos(): Position is not valid. \n"
"pos (%f,%f,%f) file:%s line:%d\n"),
pos.x, pos.y, pos.z);
PRINTF(VT_RST);
PRINTF_RST();
}
#endif
}

View file

@ -2,7 +2,7 @@
#include "terminal.h"
#include "line_numbers.h"
#pragma increment_block_number "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128"
#pragma increment_block_number "ntsc-1.0:112 ntsc-1.1:112 ntsc-1.2:112"
u16 DynaSSNodeList_GetNextNodeIdx(DynaSSNodeList* nodeList);
void BgCheck_GetStaticLookupIndicesFromPos(CollisionContext* colCtx, Vec3f* pos, Vec3i* sector);
@ -89,11 +89,11 @@ u16 sSurfaceMaterialToSfxOffset[SURFACE_MATERIAL_MAX] = {
s32 BgCheck_PosErrorCheck(Vec3f* pos, const char* file, int line) {
if (pos->x >= BGCHECK_XYZ_ABSMAX || pos->x <= -BGCHECK_XYZ_ABSMAX || pos->y >= BGCHECK_XYZ_ABSMAX ||
pos->y <= -BGCHECK_XYZ_ABSMAX || pos->z >= BGCHECK_XYZ_ABSMAX || pos->z <= -BGCHECK_XYZ_ABSMAX) {
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("T_BGCheck_PosErrorCheck():位置が妥当ではありません。pos (%f,%f,%f) file:%s line:%d\n",
"T_BGCheck_PosErrorCheck(): Position is invalid. pos (%f,%f,%f) file:%s line:%d\n"),
pos->x, pos->y, pos->z, file, line);
PRINTF(VT_RST);
PRINTF_RST();
return true;
}
return false;
@ -307,11 +307,11 @@ void CollisionPoly_GetVerticesByBgId(CollisionPoly* poly, s32 bgId, CollisionCon
Vec3s* vtxList;
if (poly == NULL || bgId > BG_ACTOR_MAX || dest == NULL) {
PRINTF(VT_COL(RED, WHITE));
PRINTF_COLOR_ERROR();
PRINTF(T("T_Polygon_GetVertex_bg_ai(): Error %d %d %d 引数が適切ではありません。処理を終了します。\n",
"T_Polygon_GetVertex_bg_ai(): Error %d %d %d Argument not appropriate. Processing terminated.\n"),
poly == NULL, bgId > BG_ACTOR_MAX, dest == NULL);
PRINTF(VT_RST);
PRINTF_RST();
if (dest != NULL) {
//! @bug: dest[2] x and y are not set to 0
@ -1648,10 +1648,10 @@ void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader
SSNodeList_Alloc(play, &colCtx->polyNodes, tblMax, colCtx->colHeader->numPolygons);
lookupTblMemSize = BgCheck_InitializeStaticLookup(colCtx, play, colCtx->lookupTbl);
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
PRINTF(T("/*---結局 BG使用サイズ %dbyte---*/\n", "/*---BG size used in the end %dbyte---*/\n"),
memSize + lookupTblMemSize);
PRINTF(VT_RST);
PRINTF_RST();
DynaPoly_Init(play, &colCtx->dyna);
DynaPoly_Alloc(play, &colCtx->dyna);
@ -1669,10 +1669,10 @@ CollisionHeader* BgCheck_GetCollisionHeader(CollisionContext* colCtx, s32 bgId)
return NULL;
}
if (!(colCtx->dyna.bgActorFlags[bgId] & BGACTOR_IN_USE)) {
PRINTF(VT_COL(YELLOW, BLACK));
PRINTF_COLOR_WARNING();
PRINTF(T("T_BGCheck_getBGDataInfo():そのbg_actor_indexは使われておりません。index=%d\n",
"T_BGCheck_getBGDataInfo(): That bg_actor_index is not in use. index=%d\n"));
PRINTF(VT_RST);
PRINTF_RST();
return NULL;
}
return colCtx->dyna.bgActors[bgId].colHeader;
@ -2738,10 +2738,10 @@ s32 DynaPoly_SetBgActor(PlayState* play, DynaCollisionContext* dyna, Actor* acto
}
if (!foundSlot) {
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("DynaPolyInfo_setActor():ダイナミックポリゴン 空きインデックスはありません\n",
"DynaPolyInfo_setActor(): Dynamic polygon no free indexes\n"));
PRINTF(VT_RST);
PRINTF_RST();
return BG_ACTOR_MAX;
}
@ -2749,9 +2749,9 @@ s32 DynaPoly_SetBgActor(PlayState* play, DynaCollisionContext* dyna, Actor* acto
dyna->bitFlag |= DYNAPOLY_INVALIDATE_LOOKUP;
dyna->bgActorFlags[bgId] &= ~BGACTOR_1;
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
PRINTF("DynaPolyInfo_setActor():index %d\n", bgId);
PRINTF(VT_RST);
PRINTF_RST();
return bgId;
}
@ -2801,27 +2801,27 @@ void DynaPoly_EnableCeilingCollision(PlayState* play, DynaCollisionContext* dyna
void DynaPoly_DeleteBgActor(PlayState* play, DynaCollisionContext* dyna, s32 bgId) {
DynaPolyActor* actor;
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
PRINTF("DynaPolyInfo_delReserve():index %d\n", bgId);
PRINTF(VT_RST);
PRINTF_RST();
if (!DynaPoly_IsBgIdBgActor(bgId)) {
#if DEBUG_FEATURES
if (bgId == -1) {
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
PRINTF(T("DynaPolyInfo_delReserve():削除されているはずの(?)\n"
"インデックス(== -1)のため,処理を中止します。\n",
"DynaPolyInfo_delReserve():The index that should have been deleted(?)\n"
" was(== -1), processing aborted.\n"));
PRINTF(VT_RST);
PRINTF_RST();
} else {
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("DynaPolyInfo_delReserve():"
"確保していない出来なかったインデックスの解放のため、処理を中止します。index == %d\n",
"DynaPolyInfo_delReserve():"
" Unable to deallocate index / index unallocated, processing aborted. index == %d\n"),
bgId);
PRINTF(VT_RST);
PRINTF_RST();
}
#endif
@ -2880,14 +2880,14 @@ void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s3
#if DEBUG_FEATURES
if (!(dyna->polyListMax >= *polyStartIndex + pbgdata->numPolygons)) {
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("DynaPolyInfo_expandSRT():polygon over %dが%dを越えるとダメ\n",
"DynaPolyInfo_expandSRT():polygon over do not use if %d exceeds %d\n"),
*polyStartIndex + pbgdata->numPolygons, dyna->polyListMax);
}
if (!(dyna->vtxListMax >= *vtxStartIndex + pbgdata->numVertices)) {
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("DynaPolyInfo_expandSRT():vertex over %dが%dを越えるとダメ\n",
"DynaPolyInfo_expandSRT():vertex over do not use if %d exceeds %d\n"),
*vtxStartIndex + pbgdata->numVertices, dyna->vtxListMax);
@ -3067,9 +3067,9 @@ void DynaPoly_UpdateContext(PlayState* play, DynaCollisionContext* dyna) {
for (i = 0; i < BG_ACTOR_MAX; i++) {
if (dyna->bgActorFlags[i] & BGACTOR_1) {
// Initialize BgActor
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
PRINTF(T("DynaPolyInfo_setup():削除 index=%d\n", "DynaPolyInfo_setup(): Delete index=%d\n"), i);
PRINTF(VT_RST);
PRINTF_RST();
dyna->bgActorFlags[i] = 0;
BgActor_Initialize(play, &dyna->bgActors[i]);
@ -3077,9 +3077,9 @@ void DynaPoly_UpdateContext(PlayState* play, DynaCollisionContext* dyna) {
}
if (dyna->bgActors[i].actor != NULL && dyna->bgActors[i].actor->update == NULL) {
// Delete BgActor
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
PRINTF(T("DynaPolyInfo_setup():削除 index=%d\n", "DynaPolyInfo_setup(): Delete index=%d\n"), i);
PRINTF(VT_RST);
PRINTF_RST();
actor = DynaPoly_GetActor(&play->colCtx, i);
if (actor == NULL) {
return;

View file

@ -4,7 +4,7 @@
#include "terminal.h"
#include "overlays/actors/ovl_En_Horse/z_en_horse.h"
#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \
"ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128"
s16 Camera_RequestSettingImpl(Camera* camera, s16 requestedSetting, s16 flags);
@ -3639,7 +3639,7 @@ s32 Camera_KeepOn3(Camera* camera) {
}
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \
"ntsc-1.0:144 ntsc-1.1:144 ntsc-1.2:144 pal-1.0:142 pal-1.1:142"
"ntsc-1.0:129 ntsc-1.1:129 ntsc-1.2:129 pal-1.0:127 pal-1.1:127"
s32 Camera_KeepOn4(Camera* camera) {
static Vec3f D_8015BD50;

View file

@ -16,7 +16,7 @@
#include "z_lib.h"
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \
"ntsc-1.0:96 ntsc-1.1:96 ntsc-1.2:96 pal-1.0:96 pal-1.1:96"
"ntsc-1.0:88 ntsc-1.1:88 ntsc-1.2:88 pal-1.0:88 pal-1.1:88"
typedef s32 (*ColChkResetFunc)(PlayState*, Collider*);
typedef void (*ColChkApplyFunc)(PlayState*, CollisionCheckContext*, Collider*);
@ -367,9 +367,9 @@ s32 Collider_SetJntSphToActor(PlayState* play, ColliderJntSph* dest, ColliderJnt
if (dest->elements == NULL) {
dest->count = 0;
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("ClObjJntSph_set():zelda_malloc()出来ません。\n", "ClObjJntSph_set():zelda_malloc() Can not.\n"));
PRINTF(VT_RST);
PRINTF_RST();
return false;
}
@ -395,9 +395,9 @@ s32 Collider_SetJntSphAllocType1(PlayState* play, ColliderJntSph* dest, Actor* a
if (dest->elements == NULL) {
dest->count = 0;
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("ClObjJntSph_set3():zelda_malloc_出来ません。\n", "ClObjJntSph_set3():zelda_malloc_ Can not.\n"));
PRINTF(VT_RST);
PRINTF_RST();
return false;
}
@ -423,9 +423,9 @@ s32 Collider_SetJntSphAlloc(PlayState* play, ColliderJntSph* dest, Actor* actor,
if (dest->elements == NULL) {
dest->count = 0;
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("ClObjJntSph_set5():zelda_malloc出来ません\n", "ClObjJntSph_set5():zelda_malloc Can not\n"));
PRINTF(VT_RST);
PRINTF_RST();
return false;
}
for (destElem = dest->elements, srcElem = src->elements; destElem < dest->elements + dest->count;
@ -729,9 +729,9 @@ s32 Collider_SetTrisAllocType1(PlayState* play, ColliderTris* dest, Actor* actor
dest->elements = ZELDA_ARENA_MALLOC(dest->count * sizeof(ColliderTrisElement), "../z_collision_check.c", 2156);
if (dest->elements == NULL) {
dest->count = 0;
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("ClObjTris_set3():zelda_malloc()出来ません\n", "ClObjTris_set3():zelda_malloc() Can not\n"));
PRINTF(VT_RST);
PRINTF_RST();
return false;
}
for (destElem = dest->elements, srcElem = src->elements; destElem < dest->elements + dest->count;
@ -755,9 +755,9 @@ s32 Collider_SetTrisAlloc(PlayState* play, ColliderTris* dest, Actor* actor, Col
dest->elements = ZELDA_ARENA_MALLOC(dest->count * sizeof(ColliderTrisElement), "../z_collision_check.c", 2207);
if (dest->elements == NULL) {
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("ClObjTris_set5():zelda_malloc出来ません\n", "ClObjTris_set5():zelda_malloc Can not\n"));
PRINTF(VT_RST);
PRINTF_RST();
dest->count = 0;
return false;
}

View file

@ -3,7 +3,7 @@
#include "versions.h"
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \
"ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:192 pal-1.1:192"
"ntsc-1.0:176 ntsc-1.1:176 ntsc-1.2:176 pal-1.0:160 pal-1.1:160"
ALIGNED(16) SaveContext gSaveContext;
u32 D_8015FA88;
@ -24,7 +24,7 @@ void SaveContext_Init(void) {
gSaveContext.dogIsLost = true;
gSaveContext.nextTransitionType = TRANS_NEXT_TYPE_DEFAULT;
gSaveContext.prevHudVisibilityMode = HUD_VISIBILITY_ALL;
#if OOT_NTSC && OOT_VERSION < GC_US
#if OOT_NTSC && OOT_VERSION < GC_US || PLATFORM_IQUE
if (gCurrentRegion == REGION_JP) {
gSaveContext.language = LANGUAGE_JPN;
}

View file

@ -19,17 +19,17 @@ void Interface_Init(PlayState* play) {
View_Init(&interfaceCtx->view, play->state.gfxCtx);
interfaceCtx->unk_1EC = interfaceCtx->unk_1EE = interfaceCtx->unk_1F0 = 0;
interfaceCtx->unk_1F4 = 0.0f;
interfaceCtx->unk_1FA = interfaceCtx->unk_261 = interfaceCtx->unk_1FC = 0;
interfaceCtx->unk_22E = 0;
interfaceCtx->lensMagicConsumptionTimer = 16;
interfaceCtx->unk_1F4 = 0.0f;
interfaceCtx->unk_228 = XREG(95);
interfaceCtx->minimapAlpha = 0;
interfaceCtx->unk_260 = 0;
interfaceCtx->unk_244 = interfaceCtx->aAlpha = interfaceCtx->bAlpha = interfaceCtx->cLeftAlpha =
interfaceCtx->cDownAlpha = interfaceCtx->cRightAlpha = interfaceCtx->healthAlpha = interfaceCtx->startAlpha =
interfaceCtx->magicAlpha = 0;
interfaceCtx->minimapAlpha = 0;
interfaceCtx->unk_260 = 0;
parameterSize = (uintptr_t)_parameter_staticSegmentRomEnd - (uintptr_t)_parameter_staticSegmentRomStart;
@ -204,7 +204,7 @@ void Interface_Init(PlayState* play) {
void Message_Init(PlayState* play) {
MessageContext* msgCtx = &play->msgCtx;
s32 pad;
Font* font = &msgCtx->font;
Message_SetTables();
@ -224,7 +224,7 @@ void Message_Init(PlayState* play) {
PRINTF(T("吹き出しgame_alloc=%x\n", "Textbox game_alloc=%x\n"), TEXTBOX_SEGMENT_SIZE);
ASSERT(msgCtx->textboxSegment != NULL, "message->fukidashiSegment != NULL", "../z_construct.c", 352);
Font_LoadOrderedFont(&play->msgCtx.font);
Font_LoadOrderedFont(font);
YREG(31) = 0;
}
@ -484,7 +484,11 @@ void Regs_InitDataImpl(void) {
R_TEXTBOX_X_TARGET = 54;
R_TEXTBOX_Y_TARGET = 48;
R_TEXTBOX_WIDTH_TARGET = 128;
#if !PLATFORM_IQUE
R_TEXTBOX_HEIGHT_TARGET = 64;
#else
R_TEXTBOX_HEIGHT_TARGET = 74;
#endif
R_TEXTBOX_TEXWIDTH_TARGET = 2048;
R_TEXTBOX_TEXHEIGHT_TARGET = 512;
XREG(78) = 96;

View file

@ -18,10 +18,10 @@ void EffectShieldParticle_Init(void* thisx, void* initParamsx) {
if ((this != NULL) && (initParams != NULL)) {
this->numElements = initParams->numElements;
if (this->numElements > ARRAY_COUNT(this->elements)) {
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("EffectShieldParticle_ct():パーティクル数がオーバしてます。\n",
"EffectShieldParticle_ct(): Number of particles exceeded.\n"));
PRINTF(VT_RST);
PRINTF_RST();
return;
}

View file

@ -197,7 +197,7 @@ void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initParams) {
overlayEntry->loadedRamAddr = ZELDA_ARENA_MALLOC_R(overlaySize, "../z_effect_soft_sprite.c", 585);
if (overlayEntry->loadedRamAddr == NULL) {
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("EffectSoftSprite2_makeEffect():zelda_malloc_r()により,%dbyteのメモリ確保ができま\n"
"せん。そのため、プログラムのロードも\n"
"出来ません。ただいま危険な状態です!\n"
@ -207,18 +207,18 @@ void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initParams) {
"cannot be loaded. What a dangerous situation!\n"
"Naturally, effects will not be produced either.\n"),
overlaySize);
PRINTF(VT_RST);
PRINTF_RST();
return;
}
Overlay_Load(overlayEntry->file.vromStart, overlayEntry->file.vromEnd, overlayEntry->vramStart,
overlayEntry->vramEnd, overlayEntry->loadedRamAddr);
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
PRINTF("EFFECT SS OVL:SegRom %08x %08x, Seg %08x %08x, RamStart %08x, type: %d\n",
overlayEntry->file.vromStart, overlayEntry->file.vromEnd, overlayEntry->vramStart,
overlayEntry->vramEnd, overlayEntry->loadedRamAddr, type);
PRINTF(VT_RST);
PRINTF_RST();
}
profile = (void*)(uintptr_t)((overlayEntry->profile != NULL)
@ -246,14 +246,14 @@ void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initParams) {
sEffectSsInfo.table[index].priority = priority;
if (profile->init(play, index, &sEffectSsInfo.table[index], initParams) == 0) {
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
PRINTF(T("EffectSoftSprite2_makeEffect():"
"何らかの理由でコンストラクト失敗。コンストラクターがエラーを返しました。"
"エフェクトの追加を中止します。\n",
"EffectSoftSprite2_makeEffect(): "
"Construction failed for some reason. The constructor returned an error. "
"Ceasing effect addition.\n"));
PRINTF(VT_RST);
PRINTF_RST();
EffectSs_Reset(&sEffectSsInfo.table[index]);
}
}
@ -313,7 +313,7 @@ void EffectSs_DrawAll(PlayState* play) {
if ((sEffectSsInfo.table[i].pos.x > 32000.0f) || (sEffectSsInfo.table[i].pos.x < -32000.0f) ||
(sEffectSsInfo.table[i].pos.y > 32000.0f) || (sEffectSsInfo.table[i].pos.y < -32000.0f) ||
(sEffectSsInfo.table[i].pos.z > 32000.0f) || (sEffectSsInfo.table[i].pos.z < -32000.0f)) {
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("EffectSoftSprite2_disp():位置が領域外のため "
"削除します。エフェクトラベルNo.%d:プログラムの方で対応をお願いします。ここです ==> "
"pos(%f, %f, %f)で、ラベルはz_effect_soft_sprite_dlftbls.declにあります。\n",
@ -322,10 +322,10 @@ void EffectSs_DrawAll(PlayState* play) {
"pos(%f, %f, %f) and the label is in z_effect_soft_sprite_dlftbls.decl.\n"),
sEffectSsInfo.table[i].type, sEffectSsInfo.table[i].pos.x, sEffectSsInfo.table[i].pos.y,
sEffectSsInfo.table[i].pos.z);
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
PRINTF(T("もし、posを別のことに使っている場合相談に応じます。\n",
"If you are using pos for something else, consult me.\n"));
PRINTF(VT_RST);
PRINTF_RST();
EffectSs_Delete(&sEffectSsInfo.table[i]);
} else {

View file

@ -3,7 +3,7 @@
#include "assets/objects/gameplay_keep/gameplay_keep.h"
#include "overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.h"
#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-eu-mq-dbg:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128" \
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-eu-mq-dbg:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128" \
"gc-us-mq:128 ntsc-1.2:128"
#define FLAGS 0

View file

@ -115,11 +115,11 @@ void Horse_SetupInGameplay(PlayState* play, Player* player) {
horseActor->room = -1;
}
} else {
PRINTF(VT_COL(RED, WHITE));
PRINTF_COLOR_ERROR();
PRINTF(
T("Horse_SetNormal():%d セットスポットまずいです。\n", "Horse_SetNormal():%d set spot is no good.\n"),
gSaveContext.save.info.horseData.sceneId);
PRINTF(VT_RST);
PRINTF_RST();
Horse_ResetHorseData(play);
}
} else if ((play->sceneId == SCENE_LON_LON_RANCH) &&
@ -291,11 +291,11 @@ void Horse_SetupInCutscene(PlayState* play, Player* player) {
void Horse_InitPlayerHorse(PlayState* play, Player* player) {
if (LINK_IS_ADULT) {
if (!Horse_CanSpawn(gSaveContext.save.info.horseData.sceneId)) {
PRINTF(VT_COL(RED, WHITE));
PRINTF_COLOR_ERROR();
PRINTF(
T("Horse_Set_Check():%d セットスポットまずいです。\n", "Horse_Set_Check():%d set spot is no good.\n"),
gSaveContext.save.info.horseData.sceneId);
PRINTF(VT_RST);
PRINTF_RST();
Horse_ResetHorseData(play);
}

View file

@ -337,9 +337,9 @@ s32 Jpeg_Decode(void* data, void* zbuffer, void* work, u32 workSize) {
x = y = 0;
for (i = 0; i < 300; i += 4) {
if (JpegDecoder_Decode(&decoder, (u16*)workBuff->data, 4, i != 0, &state)) {
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF("Error : Can't decode jpeg\n");
PRINTF(VT_RST);
PRINTF_RST();
} else {
Jpeg_ScheduleDecoderTask(&ctx);
osInvalDCache(&workBuff->data, sizeof(workBuff->data[0]));

View file

@ -19,11 +19,11 @@ void KaleidoManager_LoadOvl(KaleidoMgrOverlay* ovl) {
ovl->loadedRamAddr = sKaleidoAreaPtr;
Overlay_Load(ovl->file.vromStart, ovl->file.vromEnd, ovl->vramStart, ovl->vramEnd, ovl->loadedRamAddr);
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
PRINTF("OVL(k):Seg:%08x-%08x Ram:%08x-%08x Off:%08x %s\n", ovl->vramStart, ovl->vramEnd, ovl->loadedRamAddr,
(uintptr_t)ovl->loadedRamAddr + (uintptr_t)ovl->vramEnd - (uintptr_t)ovl->vramStart,
(uintptr_t)ovl->vramStart - (uintptr_t)ovl->loadedRamAddr, ovl->name);
PRINTF(VT_RST);
PRINTF_RST();
ovl->offset = (uintptr_t)ovl->loadedRamAddr - (uintptr_t)ovl->vramStart;
gKaleidoMgrCurOvl = ovl;
@ -50,17 +50,17 @@ void KaleidoManager_Init(PlayState* play) {
}
}
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
PRINTF(T("KaleidoArea の最大サイズは %d バイトを確保します\n", "The maximum size of KaleidoArea is %d bytes\n"),
largestSize);
PRINTF(VT_RST);
PRINTF_RST();
sKaleidoAreaPtr = GAME_STATE_ALLOC(&play->state, largestSize, "../z_kaleido_manager.c", 150);
LOG_UTILS_CHECK_NULL_POINTER("KaleidoArea_allocp", sKaleidoAreaPtr, "../z_kaleido_manager.c", 151);
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
PRINTF("KaleidoArea %08x - %08x\n", sKaleidoAreaPtr, (uintptr_t)sKaleidoAreaPtr + largestSize);
PRINTF(VT_RST);
PRINTF_RST();
gKaleidoMgrCurOvl = NULL;
}

View file

@ -1,4 +1,4 @@
#pragma increment_block_number "gc-eu:224 gc-eu-mq:224 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224" \
#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:224 ntsc-1.1:224 ntsc-1.2:224 pal-1.0:224 pal-1.1:224"
#include "global.h"
@ -18,16 +18,16 @@ void KaleidoScopeCall_LoadPlayer(void) {
if (gKaleidoMgrCurOvl != playerActorOvl) {
if (gKaleidoMgrCurOvl != NULL) {
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
PRINTF(T("カレイド領域 強制排除\n", "Kaleido area forced exclusion\n"));
PRINTF(VT_RST);
PRINTF_RST();
KaleidoManager_ClearOvl(gKaleidoMgrCurOvl);
}
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
PRINTF(T("プレイヤーアクター搬入\n", "Player actor import\n"));
PRINTF(VT_RST);
PRINTF_RST();
KaleidoManager_LoadOvl(playerActorOvl);
}
@ -90,16 +90,16 @@ void KaleidoScopeCall_Update(PlayState* play) {
} else if (pauseCtx->state != PAUSE_STATE_OFF) {
if (gKaleidoMgrCurOvl != kaleidoScopeOvl) {
if (gKaleidoMgrCurOvl != NULL) {
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
PRINTF(T("カレイド領域 プレイヤー 強制排除\n", "Kaleido area Player Forced Elimination\n"));
PRINTF(VT_RST);
PRINTF_RST();
KaleidoManager_ClearOvl(gKaleidoMgrCurOvl);
}
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
PRINTF(T("カレイド領域 カレイドスコープ搬入\n", "Kaleido area Kaleidoscope loading\n"));
PRINTF(VT_RST);
PRINTF_RST();
KaleidoManager_LoadOvl(kaleidoScopeOvl);
}
@ -108,9 +108,9 @@ void KaleidoScopeCall_Update(PlayState* play) {
sKaleidoScopeUpdateFunc(play);
if (!IS_PAUSED(&play->pauseCtx)) {
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
PRINTF(T("カレイド領域 カレイドスコープ排出\n", "Kaleido area Kaleidoscope Emission\n"));
PRINTF(VT_RST);
PRINTF_RST();
KaleidoManager_ClearOvl(kaleidoScopeOvl);
KaleidoScopeCall_LoadPlayer();

View file

@ -19,13 +19,21 @@ void Font_LoadCharWide(Font* font, u16 character, u16 codePointIndex) {
* at `codePointIndex`. The value of `character` is the ASCII codepoint subtract ' '/0x20.
*/
void Font_LoadChar(Font* font, u8 character, u16 codePointIndex) {
u8 charTmp = character;
s32 offset = character * FONT_CHAR_TEX_SIZE;
DMA_REQUEST_SYNC(&font->charTexBuf[codePointIndex],
(uintptr_t)_nes_font_staticSegmentRomStart + charTmp * FONT_CHAR_TEX_SIZE, FONT_CHAR_TEX_SIZE,
"../z_kanfont.c", 93);
DMA_REQUEST_SYNC(&font->charTexBuf[codePointIndex], (uintptr_t)_nes_font_staticSegmentRomStart + offset,
FONT_CHAR_TEX_SIZE, "../z_kanfont.c", 93);
}
#if PLATFORM_IQUE
void Font_LoadCharCHN(Font* font, u16 character, u16 codePointIndex) {
s32 offset = character * FONT_CHAR_TEX_SIZE;
DMA_REQUEST_SYNC(&font->charTexBuf[codePointIndex], (uintptr_t)_nes_font_staticSegmentRomStart + offset,
FONT_CHAR_TEX_SIZE, "../z_kanfont.c", UNK_LINE);
}
#endif
/**
* Loads a message box icon from message_static, such as the ending triangle/square or choice arrow into the
* icon buffer.
@ -48,18 +56,23 @@ void Font_LoadOrderedFont(Font* font) {
s32 codePointIndex;
s32 fontBufIndex;
u32 offset;
const char* messageDataStart;
u16* msgBufWide;
font->msgOffset = FONT_MESSAGE_OFFSET;
size = font->msgLength = FONT_MESSAGE_LENGTH;
#if OOT_NTSC
#if OOT_NTSC && !PLATFORM_IQUE
messageDataStart = (const char*)_jpn_message_data_staticSegmentStart;
font->msgOffset = _message_0xFFFC_jpn - messageDataStart;
size = font->msgLength = _message_0xFFFD_jpn - _message_0xFFFC_jpn;
len = (u32)size / 2;
DMA_REQUEST_SYNC(font->msgBufWide, (uintptr_t)_jpn_message_data_staticSegmentRomStart + font->msgOffset, size,
"../z_kanfont.c", UNK_LINE);
PRINTF("msg_data=%x, msg_data0=%x jj=%x\n", font->msgOffset, font->msgLength, len);
fontBufIndex = 0;
for (codePointIndex = 0; font->msgBufWide[codePointIndex] != MESSAGE_WIDE_END; codePointIndex++) {
if (len < codePointIndex) {
PRINTF(T(" エラー!!! error───\n", "ERROR!! Error!!! error───!!!!\n"));
return;
}
@ -70,7 +83,10 @@ void Font_LoadOrderedFont(Font* font) {
fontBufIndex += FONT_CHAR_TEX_SIZE / 8;
}
}
#else
#elif OOT_PAL
messageDataStart = (const char*)_nes_message_data_staticSegmentStart;
font->msgOffset = _message_0xFFFC_nes - messageDataStart;
size = font->msgLength = _message_0xFFFD_nes - _message_0xFFFC_nes;
len = size;
DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, len,
"../z_kanfont.c", 122);
@ -93,5 +109,31 @@ void Font_LoadOrderedFont(Font* font) {
fontBufIndex += FONT_CHAR_TEX_SIZE / 8;
}
}
#elif PLATFORM_IQUE
messageDataStart = (const char*)_jpn_message_data_staticSegmentStart;
font->msgOffset = _message_0xFFFC_jpn - messageDataStart;
size = font->msgLength = _message_0xFFFD_jpn - _message_0xFFFC_jpn;
len = (u32)size / 2;
DMA_REQUEST_SYNC(font->msgBufWide, (uintptr_t)_jpn_message_data_staticSegmentRomStart + font->msgOffset, size,
"../z_kanfont.c", UNK_LINE);
PRINTF("msg_data=%x, msg_data0=%x jj=%x\n", font->msgOffset, font->msgLength, len);
// Workaround for EGCS internal compiler error (see docs/compilers.md)
msgBufWide = font->msgBufWide;
fontBufIndex = 0;
for (codePointIndex = 0; msgBufWide[codePointIndex] != MESSAGE_WIDE_END; codePointIndex++) {
if (len < codePointIndex) {
PRINTF(T(" エラー!!! error───\n", "ERROR!! Error!!! error───!!!!\n"));
return;
}
if (msgBufWide[codePointIndex] != MESSAGE_WIDE_NEWLINE) {
offset = Kanji_OffsetFromShiftJIS(msgBufWide[codePointIndex]);
DMA_REQUEST_SYNC(&font->fontBuf[fontBufIndex * 8], (uintptr_t)_kanjiSegmentRomStart + offset,
FONT_CHAR_TEX_SIZE, "../z_kanfont.c", UNK_LINE);
fontBufIndex += FONT_CHAR_TEX_SIZE / 8;
}
}
#endif
}

View file

@ -1,5 +1,5 @@
#pragma increment_block_number "gc-eu:232 gc-eu-mq:232 gc-jp:212 gc-jp-ce:212 gc-jp-mq:212 gc-us:212 gc-us-mq:212" \
"ntsc-1.0:224 ntsc-1.1:224 ntsc-1.2:224 pal-1.0:240 pal-1.1:240"
#pragma increment_block_number "gc-eu:216 gc-eu-mq:216 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \
"ntsc-1.0:208 ntsc-1.1:208 ntsc-1.2:208 pal-1.0:224 pal-1.1:224"
#include "global.h"
#include "ultra64.h"

View file

@ -30,12 +30,12 @@ void Map_SetPaletteData(PlayState* play, s16 room) {
interfaceCtx->mapPaletteIndex = paletteIndex;
}
PRINTF(VT_FGCOL(YELLOW));
PRINTF_COLOR_YELLOW();
PRINTF(T("PALETEセット 【 i=%x : room=%x 】Room_Inf[%d][4]=%x ( map_palete_no = %d )\n",
"PALETE Set 【 i=%x : room=%x 】Room_Inf[%d][4]=%x ( map_palete_no = %d )\n"),
paletteIndex, room, mapIndex, gSaveContext.save.info.sceneFlags[mapIndex].rooms,
interfaceCtx->mapPaletteIndex);
PRINTF(VT_RST);
PRINTF_RST();
interfaceCtx->mapPalette[paletteIndex * 2] = 2;
interfaceCtx->mapPalette[paletteIndex * 2 + 1] = 0xBF;
@ -130,9 +130,9 @@ void Map_InitData(PlayState* play, s16 room) {
extendedMapIndex = 0x17;
}
}
PRINTF(VT_FGCOL(BLUE));
PRINTF_COLOR_BLUE();
PRINTF("%d\n", extendedMapIndex);
PRINTF(VT_RST);
PRINTF_RST();
sEntranceIconMapIndex = extendedMapIndex;
DMA_REQUEST_SYNC(interfaceCtx->mapSegment,
(uintptr_t)_map_grand_staticSegmentRomStart +
@ -158,11 +158,11 @@ void Map_InitData(PlayState* play, s16 room) {
case SCENE_WATER_TEMPLE_BOSS:
case SCENE_SPIRIT_TEMPLE_BOSS:
case SCENE_SHADOW_TEMPLE_BOSS:
PRINTF(VT_FGCOL(YELLOW));
PRINTF_COLOR_YELLOW();
PRINTF(T("デクの樹ダンジョンMAP テクスチャDMA(%x) scene_id_offset=%d VREG(30)=%d\n",
"Deku Tree Dungeon MAP Texture DMA(%x) scene_id_offset=%d VREG(30)=%d\n"),
room, mapIndex, VREG(30));
PRINTF(VT_RST);
PRINTF_RST();
#if PLATFORM_N64
if ((B_80121220 != NULL) && (B_80121220->unk_28 != NULL) && B_80121220->unk_28(play)) {
@ -219,9 +219,9 @@ void Map_InitRoomData(PlayState* play, s16 room) {
interfaceCtx->mapRoomNum = room;
interfaceCtx->unk_25A = mapIndex;
Map_SetPaletteData(play, room);
PRINTF(VT_FGCOL(YELLOW));
PRINTF_COLOR_YELLOW();
PRINTF(T("部屋部屋=%d\n", "Room Room = %d\n"), room);
PRINTF(VT_RST);
PRINTF_RST();
Map_InitData(play, room);
break;
}
@ -598,9 +598,9 @@ void Map_Update(PlayState* play) {
if ((interfaceCtx->mapRoomNum == gMapData->switchFromRoom[mapIndex][i]) &&
(floor == gMapData->switchFromFloor[mapIndex][i])) {
interfaceCtx->mapRoomNum = gMapData->switchToRoom[mapIndex][i];
PRINTF(VT_FGCOL(YELLOW));
PRINTF_COLOR_YELLOW();
PRINTF(T("階層切替=%x\n", "Layer switching = %x\n"), interfaceCtx->mapRoomNum);
PRINTF(VT_RST);
PRINTF_RST();
Map_InitData(play, interfaceCtx->mapRoomNum);
gSaveContext.sunsSongState = SUNSSONG_INACTIVE;
Map_SavePlayerInitialInfo(play);

View file

@ -8,7 +8,7 @@
#endif
#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \
"ntsc-1.0:96 ntsc-1.1:96 ntsc-1.2:96 pal-1.0:128 pal-1.1:128"
"ntsc-1.0:80 ntsc-1.1:80 ntsc-1.2:80 pal-1.0:128 pal-1.1:128"
#if !PLATFORM_GC
#define OCARINA_BUTTON_A_PRIM_1_R 80
@ -2515,9 +2515,9 @@ void Message_OpenText(PlayState* play, u16 textId) {
msgCtx->textId = textId;
if (textId == 0x2030) { // Talking to Ingo as adult in Lon Lon Ranch for the first time before freeing Epona
PRINTF(VT_FGCOL(YELLOW));
PRINTF_COLOR_YELLOW();
PRINTF(" z_message.c \n");
PRINTF(VT_RST);
PRINTF_RST();
RESET_EVENTINF2();
}
@ -2657,9 +2657,9 @@ void Message_OpenText(PlayState* play, u16 textId) {
void Message_StartTextbox(PlayState* play, u16 textId, Actor* actor) {
MessageContext* msgCtx = &play->msgCtx;
PRINTF(VT_FGCOL(BLUE));
PRINTF_COLOR_BLUE();
PRINTF(T("めっせーじ=%x(%d)\n", "Message=%x(%d)\n"), textId, actor);
PRINTF(VT_RST);
PRINTF_RST();
msgCtx->ocarinaAction = 0xFFFF;
Message_OpenText(play, textId);
@ -2677,9 +2677,9 @@ void Message_ContinueTextbox(PlayState* play, u16 textId) {
s32 pad2[3];
#endif
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
PRINTF(T("めっせーじ=%x message->msg_data\n", "Message=%x message->msg_data\n"), textId, msgCtx->msgLength);
PRINTF(VT_RST);
PRINTF_RST();
msgCtx->msgLength = 0;
Message_OpenText(play, textId);
@ -2719,7 +2719,7 @@ void Message_StartOcarinaImpl(PlayState* play, u16 ocarinaActionId) {
s16 noStopDoAction;
s32 k;
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
for (i = sOcarinaSongBitFlags = 0; i <= (QUEST_SONG_STORMS - QUEST_SONG_MINUET); i++) {
if (CHECK_QUEST_ITEM(QUEST_SONG_MINUET + i)) {
@ -2731,7 +2731,7 @@ void Message_StartOcarinaImpl(PlayState* play, u16 ocarinaActionId) {
sOcarinaSongBitFlags |= (1 << OCARINA_SONG_SCARECROW_SPAWN);
}
PRINTF("ocarina_bit = %x\n", sOcarinaSongBitFlags);
PRINTF(VT_RST);
PRINTF_RST();
sHasSunsSong = CHECK_QUEST_ITEM(QUEST_SONG_SUN);
msgCtx->ocarinaStaff = AudioOcarina_GetRecordingStaff();
@ -3352,11 +3352,11 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
msgCtx->stateTimer--;
if (msgCtx->stateTimer == 0) {
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF);
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
PRINTF("Na_StopOcarinaMode();\n");
PRINTF("Na_StopOcarinaMode();\n");
PRINTF("Na_StopOcarinaMode();\n");
PRINTF(VT_RST);
PRINTF_RST();
Message_Decode(play);
msgCtx->msgMode = MSGMODE_SETUP_DISPLAY_SONG_PLAYED;
msgCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff();
@ -3456,7 +3456,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
if (msgCtx->lastPlayedSong == OCARINA_SONG_EPONAS) {
R_EPONAS_SONG_PLAYED = true;
}
PRINTF(VT_FGCOL(YELLOW));
PRINTF_COLOR_YELLOW();
PRINTF("☆☆☆ocarina=%d message->ocarina_no=%d ", msgCtx->lastPlayedSong,
msgCtx->ocarinaAction);
if (msgCtx->ocarinaAction == OCARINA_ACTION_FREE_PLAY_DONE) {
@ -3465,7 +3465,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
play->msgCtx.ocarinaMode = OCARINA_MODE_0B;
}
} else if (msgCtx->ocarinaAction >= OCARINA_ACTION_CHECK_MINUET) {
PRINTF(VT_FGCOL(YELLOW));
PRINTF_COLOR_YELLOW();
PRINTF("Ocarina_PC_Wind=%d(%d) ☆☆☆ ", OCARINA_ACTION_CHECK_MINUET,
msgCtx->ocarinaAction - OCARINA_ACTION_CHECK_MINUET);
if (msgCtx->lastPlayedSong == (msgCtx->ocarinaAction - OCARINA_ACTION_CHECK_MINUET)) {
@ -3474,7 +3474,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
play->msgCtx.ocarinaMode = msgCtx->lastPlayedSong - 1;
}
} else {
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
PRINTF("Ocarina_C_Wind=%d(%d) ☆☆☆ ", OCARINA_ACTION_PLAYBACK_MINUET,
msgCtx->ocarinaAction - OCARINA_ACTION_PLAYBACK_MINUET);
if (msgCtx->lastPlayedSong == (msgCtx->ocarinaAction - OCARINA_ACTION_PLAYBACK_MINUET)) {
@ -3483,7 +3483,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
play->msgCtx.ocarinaMode = OCARINA_MODE_04;
}
}
PRINTF(VT_RST);
PRINTF_RST();
PRINTF("→ OCARINA_MODE=%d\n", play->msgCtx.ocarinaMode);
}
}
@ -3529,10 +3529,10 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
msgCtx->lastPlayedSong = msgCtx->ocarinaStaff->state;
msgCtx->msgMode = MSGMODE_SONG_PLAYBACK_SUCCESS;
Item_Give(play, ITEM_SONG_MINUET + gOcarinaSongItemMap[msgCtx->ocarinaStaff->state]);
PRINTF(VT_FGCOL(YELLOW));
PRINTF_COLOR_YELLOW();
PRINTF(T("z_message.c 取得メロディ=%d\n", "z_message.c Song Acquired = %d\n"),
ITEM_SONG_MINUET + msgCtx->ocarinaStaff->state);
PRINTF(VT_RST);
PRINTF_RST();
msgCtx->stateTimer = 20;
Audio_PlaySfxGeneral(NA_SE_SY_TRE_BOX_APPEAR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
@ -3600,14 +3600,14 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
Message_CloseTextbox(play);
PRINTF(
T("録音終了!!!!!!!!!録音終了\n", "Recording complete!!!!!!!!! Recording Complete\n"));
PRINTF(VT_FGCOL(YELLOW));
PRINTF_COLOR_YELLOW();
PRINTF("\n====================================================================\n");
MemCpy(gSaveContext.save.info.scarecrowLongSong, gScarecrowLongSongPtr,
sizeof(gSaveContext.save.info.scarecrowLongSong));
for (i = 0; i < ARRAY_COUNT(gSaveContext.save.info.scarecrowLongSong); i++) {
PRINTF("%d, ", gSaveContext.save.info.scarecrowLongSong[i]);
}
PRINTF(VT_RST);
PRINTF_RST();
PRINTF("\n====================================================================\n");
}
DRAW_TEXT(play, &gfx, false);
@ -3665,14 +3665,14 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
msgCtx->msgMode = MSGMODE_SCARECROW_SPAWN_RECORDING_DONE;
Audio_PlaySfxGeneral(NA_SE_SY_TRE_BOX_APPEAR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
PRINTF(VT_FGCOL(YELLOW));
PRINTF_COLOR_YELLOW();
PRINTF("\n====================================================================\n");
MemCpy(gSaveContext.save.info.scarecrowSpawnSong, gScarecrowSpawnSongPtr,
sizeof(gSaveContext.save.info.scarecrowSpawnSong));
for (i = 0; i < ARRAY_COUNT(gSaveContext.save.info.scarecrowSpawnSong); i++) {
PRINTF("%d, ", gSaveContext.save.info.scarecrowSpawnSong[i]);
}
PRINTF(VT_RST);
PRINTF_RST();
PRINTF("\n====================================================================\n");
} else if (msgCtx->ocarinaStaff->state == OCARINA_RECORD_REJECTED ||
CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B)) {
@ -4289,7 +4289,7 @@ void Message_Update(PlayState* play) {
gSaveContext.prevHudVisibilityMode = HUD_VISIBILITY_ALL;
}
if (play->csCtx.state == 0) {
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
PRINTF("day_time=%x active_camera=%d ", gSaveContext.save.cutsceneIndex, play->activeCamId);
if (msgCtx->textId != 0x2061 && msgCtx->textId != 0x2025 && msgCtx->textId != 0x208C &&
@ -4307,7 +4307,7 @@ void Message_Update(PlayState* play) {
}
}
}
PRINTF(VT_RST);
PRINTF_RST();
msgCtx->msgLength = 0;
msgCtx->msgMode = MSGMODE_NONE;
interfaceCtx->unk_1FA = interfaceCtx->unk_1FC = 0;

View file

@ -639,9 +639,9 @@ void Interface_UpdateHudAlphas(PlayState* play, s16 dimmingAlpha) {
}
void func_80083108(PlayState* play) {
MessageContext* msgCtx = &play->msgCtx;
Player* player = GET_PLAYER(play);
InterfaceContext* interfaceCtx = &play->interfaceCtx;
Player* player = GET_PLAYER(play);
MessageContext* msgCtx = &play->msgCtx;
s16 i;
s16 sp28 = false;
@ -1100,7 +1100,9 @@ void Interface_SetSceneRestrictions(PlayState* play) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
s16 i = 0;
u8 sceneId;
s32 pad[3];
s32 pad1;
s32 pad2;
s32 pad3;
interfaceCtx->restrictions.all = 0;
interfaceCtx->restrictions.dinsNayrus = 0;
@ -1135,7 +1137,7 @@ void Interface_SetSceneRestrictions(PlayState* play) {
interfaceCtx->restrictions.dinsNayrus = (sRestrictionFlags[i].flags3 & 0x0C) >> 2;
interfaceCtx->restrictions.all = (sRestrictionFlags[i].flags3 & 0x03) >> 0;
PRINTF(VT_FGCOL(YELLOW));
PRINTF_COLOR_YELLOW();
PRINTF("parameter->button_status = %x,%x,%x\n", sRestrictionFlags[i].flags1, sRestrictionFlags[i].flags2,
sRestrictionFlags[i].flags3);
PRINTF("h_gage=%d, b_button=%d, a_button=%d, c_bottle=%d\n", interfaceCtx->restrictions.hGauge,
@ -1147,8 +1149,8 @@ void Interface_SetSceneRestrictions(PlayState* play) {
PRINTF("c_sunmoon=%d, m_wind=%d, m_magic=%d, another=%d\n", interfaceCtx->restrictions.sunsSong,
interfaceCtx->restrictions.farores, interfaceCtx->restrictions.dinsNayrus,
interfaceCtx->restrictions.all);
PRINTF(VT_RST);
return;
PRINTF_RST();
break;
}
i++;
} while (sRestrictionFlags[i].sceneId != 0xFF);
@ -1278,7 +1280,7 @@ void Inventory_SwapAgeEquipment(void) {
}
}
shieldEquipValue = gEquipMasks[EQUIP_TYPE_SHIELD] & gSaveContext.save.info.equips.equipment;
shieldEquipValue = gSaveContext.save.info.equips.equipment & gEquipMasks[EQUIP_TYPE_SHIELD];
if (shieldEquipValue) {
shieldEquipValue >>= gEquipShifts[EQUIP_TYPE_SHIELD];
if (!CHECK_OWNED_EQUIP_ALT(EQUIP_TYPE_SHIELD, shieldEquipValue - 1)) {
@ -1376,16 +1378,16 @@ u8 Item_Give(PlayState* play, u8 item) {
slot = SLOT(sExtraItemBases[item - ITEM_DEKU_STICKS_5]);
}
PRINTF(VT_FGCOL(YELLOW));
PRINTF_COLOR_YELLOW();
PRINTF("item_get_setting=%d pt=%d z=%x\n", item, slot, gSaveContext.save.info.inventory.items[slot]);
PRINTF(VT_RST);
PRINTF_RST();
if ((item >= ITEM_MEDALLION_FOREST) && (item <= ITEM_MEDALLION_LIGHT)) {
gSaveContext.save.info.inventory.questItems |= gBitFlags[item - ITEM_MEDALLION_FOREST + QUEST_MEDALLION_FOREST];
PRINTF(VT_FGCOL(YELLOW));
PRINTF_COLOR_YELLOW();
PRINTF(T("封印 = %x\n", "Seals = %x\n"), gSaveContext.save.info.inventory.questItems);
PRINTF(VT_RST);
PRINTF_RST();
if (item == ITEM_MEDALLION_WATER) {
Horse_FixLakeHyliaPosition(play);
@ -1395,38 +1397,38 @@ u8 Item_Give(PlayState* play, u8 item) {
} else if ((item >= ITEM_SONG_MINUET) && (item <= ITEM_SONG_STORMS)) {
gSaveContext.save.info.inventory.questItems |= gBitFlags[item - ITEM_SONG_MINUET + QUEST_SONG_MINUET];
PRINTF(VT_FGCOL(YELLOW));
PRINTF_COLOR_YELLOW();
PRINTF(T("楽譜 = %x\n", "Musical scores = %x\n"), gSaveContext.save.info.inventory.questItems);
PRINTF(T("楽譜 = %x (%x) (%x)\n", "Musical scores = %x (%x) (%x)\n"),
gSaveContext.save.info.inventory.questItems, gBitFlags[item - ITEM_SONG_MINUET + QUEST_SONG_MINUET],
gBitFlags[item - ITEM_SONG_MINUET]);
PRINTF(VT_RST);
PRINTF_RST();
return ITEM_NONE;
} else if ((item >= ITEM_KOKIRI_EMERALD) && (item <= ITEM_ZORA_SAPPHIRE)) {
gSaveContext.save.info.inventory.questItems |= gBitFlags[item - ITEM_KOKIRI_EMERALD + QUEST_KOKIRI_EMERALD];
PRINTF(VT_FGCOL(YELLOW));
PRINTF_COLOR_YELLOW();
PRINTF(T("精霊石 = %x\n", "Spiritual Stones = %x\n"), gSaveContext.save.info.inventory.questItems);
PRINTF(VT_RST);
PRINTF_RST();
return ITEM_NONE;
} else if ((item == ITEM_STONE_OF_AGONY) || (item == ITEM_GERUDOS_CARD)) {
gSaveContext.save.info.inventory.questItems |= gBitFlags[item - ITEM_STONE_OF_AGONY + QUEST_STONE_OF_AGONY];
PRINTF(VT_FGCOL(YELLOW));
PRINTF_COLOR_YELLOW();
PRINTF(T("アイテム = %x\n", "Items = %x\n"), gSaveContext.save.info.inventory.questItems);
PRINTF(VT_RST);
PRINTF_RST();
return ITEM_NONE;
} else if (item == ITEM_SKULL_TOKEN) {
gSaveContext.save.info.inventory.questItems |= gBitFlags[item - ITEM_SKULL_TOKEN + QUEST_SKULL_TOKEN];
gSaveContext.save.info.inventory.gsTokens++;
PRINTF(VT_FGCOL(YELLOW));
PRINTF_COLOR_YELLOW();
PRINTF(T("Nコイン = %x(%d)\n", "N Coins = %x(%d)\n"), gSaveContext.save.info.inventory.questItems,
gSaveContext.save.info.inventory.gsTokens);
PRINTF(VT_RST);
PRINTF_RST();
return ITEM_NONE;
} else if ((item >= ITEM_SWORD_KOKIRI) && (item <= ITEM_SWORD_BIGGORON)) {
@ -1641,8 +1643,7 @@ u8 Item_Give(PlayState* play, u8 item) {
AMMO(ITEM_BOMBCHU) = 10;
return ITEM_NONE;
} else {
AMMO(ITEM_BOMBCHU) += 10;
if (AMMO(ITEM_BOMBCHU) > 50) {
if ((AMMO(ITEM_BOMBCHU) += 10) > 50) {
AMMO(ITEM_BOMBCHU) = 50;
}
return ITEM_NONE;
@ -1653,8 +1654,7 @@ u8 Item_Give(PlayState* play, u8 item) {
AMMO(ITEM_BOMBCHU) += sBombchuRefillCounts[item - ITEM_BOMBCHUS_5];
return ITEM_NONE;
} else {
AMMO(ITEM_BOMBCHU) += sBombchuRefillCounts[item - ITEM_BOMBCHUS_5];
if (AMMO(ITEM_BOMBCHU) > 50) {
if ((AMMO(ITEM_BOMBCHU) += sBombchuRefillCounts[item - ITEM_BOMBCHUS_5]) > 50) {
AMMO(ITEM_BOMBCHU) = 50;
}
return ITEM_NONE;
@ -1801,15 +1801,15 @@ u8 Item_Give(PlayState* play, u8 item) {
gSaveContext.save.info.equips.cButtonSlots[0], gSaveContext.save.info.equips.cButtonSlots[1],
gSaveContext.save.info.equips.cButtonSlots[2], temp + i, item);
if ((temp + i) == gSaveContext.save.info.equips.cButtonSlots[0]) {
if (gSaveContext.save.info.equips.cButtonSlots[0] == temp + i) {
gSaveContext.save.info.equips.buttonItems[1] = item;
Interface_LoadItemIcon2(play, 1);
gSaveContext.buttonStatus[1] = BTN_ENABLED;
} else if ((temp + i) == gSaveContext.save.info.equips.cButtonSlots[1]) {
} else if (gSaveContext.save.info.equips.cButtonSlots[1] == temp + i) {
gSaveContext.save.info.equips.buttonItems[2] = item;
Interface_LoadItemIcon2(play, 2);
gSaveContext.buttonStatus[2] = BTN_ENABLED;
} else if ((temp + i) == gSaveContext.save.info.equips.cButtonSlots[2]) {
} else if (gSaveContext.save.info.equips.cButtonSlots[2] == temp + i) {
gSaveContext.save.info.equips.buttonItems[3] = item;
Interface_LoadItemIcon1(play, 3);
gSaveContext.buttonStatus[3] = BTN_ENABLED;
@ -1838,7 +1838,7 @@ u8 Item_Give(PlayState* play, u8 item) {
if (temp != ITEM_NONE) {
for (i = 1; i < 4; i++) {
if (temp == gSaveContext.save.info.equips.buttonItems[i]) {
if (gSaveContext.save.info.equips.buttonItems[i] == temp) {
if (item != ITEM_SOLD_OUT) {
gSaveContext.save.info.equips.buttonItems[i] = item;
Interface_LoadItemIcon1(play, i);
@ -1869,9 +1869,9 @@ u8 Item_CheckObtainability(u8 item) {
slot = SLOT(sExtraItemBases[item - ITEM_DEKU_STICKS_5]);
}
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
PRINTF("item_get_non_setting=%d pt=%d z=%x\n", item, slot, gSaveContext.save.info.inventory.items[slot]);
PRINTF(VT_RST);
PRINTF_RST();
if ((item >= ITEM_MEDALLION_FOREST) && (item <= ITEM_MEDALLION_LIGHT)) {
return ITEM_NONE;
@ -2017,7 +2017,7 @@ s32 Inventory_ReplaceItem(PlayState* play, u16 oldItem, u16 newItem) {
if (gSaveContext.save.info.equips.buttonItems[i] == oldItem) {
gSaveContext.save.info.equips.buttonItems[i] = newItem;
Interface_LoadItemIcon1(play, i);
break;
return true;
}
}
return true;
@ -2349,6 +2349,8 @@ void Magic_Reset(PlayState* play) {
* @return false if the request failed
*/
s32 Magic_RequestChange(PlayState* play, s16 amount, s16 type) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;
if (!gSaveContext.save.info.playerData.isMagicAcquired) {
return false;
}
@ -2400,7 +2402,7 @@ s32 Magic_RequestChange(PlayState* play, s16 amount, s16 type) {
case MAGIC_CONSUME_LENS:
if (gSaveContext.magicState == MAGIC_STATE_IDLE) {
if (gSaveContext.save.info.playerData.magic != 0) {
play->interfaceCtx.lensMagicConsumptionTimer = 80;
interfaceCtx->lensMagicConsumptionTimer = 80;
gSaveContext.magicState = MAGIC_STATE_CONSUME_LENS;
return true;
} else {
@ -2457,8 +2459,8 @@ void Magic_Update(PlayState* play) {
static s16 sMagicBorderIndices[] = { 0, 1, 1, 0 };
static s16 sMagicBorderRatio = 2;
static s16 sMagicBorderStep = 1;
MessageContext* msgCtx = &play->msgCtx;
InterfaceContext* interfaceCtx = &play->interfaceCtx;
MessageContext* msgCtx = &play->msgCtx;
s16 borderChangeR;
s16 borderChangeG;
s16 borderChangeB;
@ -2469,7 +2471,7 @@ void Magic_Update(PlayState* play) {
// Step magicCapacity to the capacity determined by magicLevel
// This changes the width of the magic meter drawn
temp = gSaveContext.save.info.playerData.magicLevel * MAGIC_NORMAL_METER;
if (gSaveContext.magicCapacity != temp) {
if (temp != gSaveContext.magicCapacity) {
if (gSaveContext.magicCapacity < temp) {
gSaveContext.magicCapacity += 8;
if (gSaveContext.magicCapacity > temp) {
@ -2659,11 +2661,12 @@ void Magic_DrawMeter(PlayState* play) {
OPEN_DISPS(play->state.gfxCtx, "../z_parameter.c", 2650);
if (gSaveContext.save.info.playerData.magicLevel != 0) {
if (gSaveContext.save.info.playerData.healthCapacity > 0xA0) {
// NOLINTBEGIN
if (gSaveContext.save.info.playerData.healthCapacity > 0xA0)
magicMeterY = R_MAGIC_METER_Y_LOWER; // two rows of hearts
} else {
else
magicMeterY = R_MAGIC_METER_Y_HIGHER; // one row of hearts
}
// NOLINTEND
Gfx_SetupDL_39Overlay(play->state.gfxCtx);
@ -2679,8 +2682,8 @@ void Magic_DrawMeter(PlayState* play) {
gDPLoadTextureBlock(OVERLAY_DISP++, gMagicMeterEndTex, G_IM_FMT_IA, G_IM_SIZ_8b, 8, 16, 0,
G_TX_MIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 3, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSPTextureRectangle(OVERLAY_DISP++, (R_MAGIC_METER_X + gSaveContext.magicCapacity + 8) << 2, magicMeterY << 2,
(R_MAGIC_METER_X + gSaveContext.magicCapacity + 16) << 2, (magicMeterY + 16) << 2,
gSPTextureRectangle(OVERLAY_DISP++, (R_MAGIC_METER_X + 8 + gSaveContext.magicCapacity) << 2, magicMeterY << 2,
(R_MAGIC_METER_X + 8 + gSaveContext.magicCapacity + 8) << 2, (magicMeterY + 16) << 2,
G_TX_RENDERTILE, 256, 0, 1 << 10, 1 << 10);
gDPPipeSync(OVERLAY_DISP++);
@ -2910,12 +2913,20 @@ void Interface_DrawItemButtons(PlayState* play) {
gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
#if !PLATFORM_IQUE
gDPLoadTextureBlock_4b(OVERLAY_DISP++, cUpLabelTextures[gSaveContext.language], G_IM_FMT_IA, 32, 8, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD);
gSPTextureRectangle(OVERLAY_DISP++, R_C_UP_ICON_X << 2, R_C_UP_ICON_Y << 2, (R_C_UP_ICON_X + 32) << 2,
(R_C_UP_ICON_Y + 8) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
#else
gDPLoadTextureBlock_4b(OVERLAY_DISP++, cUpLabelTextures[gSaveContext.language], G_IM_FMT_IA, 48, 16, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD);
gSPTextureRectangle(OVERLAY_DISP++, (R_C_UP_ICON_X - 8) << 2, (R_C_UP_ICON_Y - 4) << 2,
(R_C_UP_ICON_X + 40) << 2, (R_C_UP_ICON_Y + 12) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10,
1 << 10);
#endif
}
sCUpTimer--;
@ -3006,7 +3017,9 @@ void Interface_DrawAmmoCount(PlayState* play, s16 button, s16 alpha) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 100, 100, 100, alpha);
}
for (i = 0; ammo >= 10; i++) {
i = 0;
while (ammo >= 10) {
i++;
ammo -= 10;
}
@ -3446,11 +3459,11 @@ void Interface_Draw(PlayState* play) {
pauseCtx->cursorVtx[16].v.ob[0] = pauseCtx->cursorVtx[18].v.ob[0] =
pauseCtx->cursorVtx[16].v.ob[0] - svar1;
pauseCtx->cursorVtx[17].v.ob[0] = pauseCtx->cursorVtx[19].v.ob[0] =
pauseCtx->cursorVtx[16].v.ob[0] + svar1 * 2 + 32;
pauseCtx->cursorVtx[16].v.ob[0] + 32 + svar1 * 2;
pauseCtx->cursorVtx[16].v.ob[1] = pauseCtx->cursorVtx[17].v.ob[1] =
pauseCtx->cursorVtx[16].v.ob[1] + svar1;
pauseCtx->cursorVtx[18].v.ob[1] = pauseCtx->cursorVtx[19].v.ob[1] =
pauseCtx->cursorVtx[16].v.ob[1] - svar1 * 2 - 32;
pauseCtx->cursorVtx[16].v.ob[1] - 32 - svar1 * 2;
}
gSPVertex(OVERLAY_DISP++, &pauseCtx->cursorVtx[PAUSE_CURSOR_QUAD_4 * 4], 4, 0);
@ -3651,8 +3664,7 @@ void Interface_Draw(PlayState* play) {
}
if ((gSaveContext.timerState >= TIMER_STATE_ENV_HAZARD_MOVE) && (msgCtx->msgLength == 0)) {
sTimerNextSecondTimer--;
if (sTimerNextSecondTimer == 0) {
if (--sTimerNextSecondTimer == 0) {
if (gSaveContext.timerSeconds != 0) {
gSaveContext.timerSeconds--;
}
@ -4005,8 +4017,8 @@ void Interface_Draw(PlayState* play) {
void Interface_Update(PlayState* play) {
static u8 D_80125B60 = false;
static s16 sPrevTimeSpeed = 0;
MessageContext* msgCtx = &play->msgCtx;
InterfaceContext* interfaceCtx = &play->interfaceCtx;
MessageContext* msgCtx = &play->msgCtx;
Player* player = GET_PLAYER(play);
s16 dimmingAlpha;
s16 risingAlpha;
@ -4274,13 +4286,13 @@ void Interface_Update(PlayState* play) {
if (gSaveContext.save.info.playerData.isMagicAcquired && (gSaveContext.save.info.playerData.magicLevel == 0)) {
gSaveContext.save.info.playerData.magicLevel = gSaveContext.save.info.playerData.isDoubleMagicAcquired + 1;
gSaveContext.magicState = MAGIC_STATE_STEP_CAPACITY;
PRINTF(VT_FGCOL(YELLOW));
PRINTF_COLOR_YELLOW();
PRINTF(T("魔法スター─────ト!!!!!!!!!\n", "Magic Start!!!!!!!!!\n"));
PRINTF("MAGIC_MAX=%d\n", gSaveContext.save.info.playerData.magicLevel);
PRINTF("MAGIC_NOW=%d\n", gSaveContext.save.info.playerData.magic);
PRINTF("Z_MAGIC_NOW_NOW=%d\n", gSaveContext.magicFillTarget);
PRINTF("Z_MAGIC_NOW_MAX=%d\n", gSaveContext.magicCapacity);
PRINTF(VT_RST);
PRINTF_RST();
}
Magic_Update(play);

View file

@ -177,7 +177,7 @@ void Play_SetupTransition(PlayState* this, s32 transitionType) {
break;
default:
HUNGUP_AND_CRASH("../z_play.c", LN5(2263, 2266, 2269, 2272, 2287, 2290, 2293));
HUNGUP_AND_CRASH("../z_play.c", LN5(2263, 2266, 2269, 2272, 2282, 2287, 2290, 2293));
break;
}
}
@ -1622,7 +1622,7 @@ s16 Play_CreateSubCamera(PlayState* this) {
return camId;
}
s16 Play_GetActiveCamId(PlayState* this) {
s32 Play_GetActiveCamId(PlayState* this) {
return this->activeCamId;
}

View file

@ -611,14 +611,14 @@ u32 Room_SetupFirstRoom(PlayState* play, RoomContext* roomCtx) {
}
}
PRINTF(VT_FGCOL(YELLOW));
PRINTF_COLOR_YELLOW();
PRINTF(T("部屋バッファサイズ=%08x(%5.1fK)\n", "Room buffer size=%08x(%5.1fK)\n"), roomBufferSize,
roomBufferSize / 1024.0f);
roomCtx->bufPtrs[0] = GAME_STATE_ALLOC(&play->state, roomBufferSize, "../z_room.c", 946);
PRINTF(T("部屋バッファ開始ポインタ=%08x\n", "Room buffer initial pointer=%08x\n"), roomCtx->bufPtrs[0]);
roomCtx->bufPtrs[1] = (void*)((uintptr_t)roomCtx->bufPtrs[0] + roomBufferSize);
PRINTF(T("部屋バッファ終了ポインタ=%08x\n", "Room buffer end pointer=%08x\n"), roomCtx->bufPtrs[1]);
PRINTF(VT_RST);
PRINTF_RST();
roomCtx->activeBufPage = 0;
roomCtx->status = 0;

View file

@ -87,9 +87,9 @@ void Object_InitContext(PlayState* play, ObjectContext* objectCtx) {
objectCtx->slots[i].id = OBJECT_INVALID;
}
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
PRINTF(T("オブジェクト入れ替えバンク情報 %8.3fKB\n", "Object exchange bank data %8.3fKB\n"), spaceSize / 1024.0f);
PRINTF(VT_RST);
PRINTF_RST();
objectCtx->spaceStart = objectCtx->slots[0].segment =
GAME_STATE_ALLOC(&play->state, spaceSize, "../z_scene.c", 219);
@ -195,9 +195,9 @@ s32 Scene_ExecuteCommands(PlayState* play, SceneCmd* sceneCmd) {
if (cmdCode < ARRAY_COUNT(sSceneCmdHandlers)) {
sSceneCmdHandlers[cmdCode](play, sceneCmd);
} else {
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("code の値が異常です\n", "code variable is abnormal\n"));
PRINTF(VT_RST);
PRINTF_RST();
}
sceneCmd++;

View file

@ -71,9 +71,9 @@ void SkelAnime_DrawLod(PlayState* play, void** skeleton, Vec3s* jointTable, Over
Vec3s rot;
if (skeleton == NULL) {
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("Si2_Lod_draw():skelがNULLです。\n", "Si2_Lod_draw(): skel is NULL.\n"));
PRINTF(VT_RST);
PRINTF_RST();
return;
}
@ -184,9 +184,9 @@ void SkelAnime_DrawFlexLod(PlayState* play, void** skeleton, Vec3s* jointTable,
Mtx* mtx = GRAPH_ALLOC(play->state.gfxCtx, dListCount * sizeof(Mtx));
if (skeleton == NULL) {
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("Si2_Lod_draw_SV():skelがNULLです。\n", "Si2_Lod_draw_SV(): skel is NULL.\n"));
PRINTF(VT_RST);
PRINTF_RST();
return;
}
@ -287,9 +287,9 @@ void SkelAnime_DrawOpa(PlayState* play, void** skeleton, Vec3s* jointTable, Over
Vec3s rot;
if (skeleton == NULL) {
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("Si2_draw():skelがNULLです。\n", "Si2_draw(): skel is NULL.\n"));
PRINTF(VT_RST);
PRINTF_RST();
return;
}
@ -400,9 +400,9 @@ void SkelAnime_DrawFlexOpa(PlayState* play, void** skeleton, Vec3s* jointTable,
Mtx* mtx = GRAPH_ALLOC(play->state.gfxCtx, dListCount * sizeof(Mtx));
if (skeleton == NULL) {
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("Si2_draw_SV():skelがNULLです。\n", "Si2_draw_SV(): skel is NULL.\n"));
PRINTF(VT_RST);
PRINTF_RST();
return;
}
@ -553,9 +553,9 @@ Gfx* SkelAnime_Draw(PlayState* play, void** skeleton, Vec3s* jointTable, Overrid
Vec3s rot;
if (skeleton == NULL) {
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("Si2_draw2():skelがNULLです。NULLを返します。\n", "Si2_draw2(): skel is NULL. Returns NULL.\n"));
PRINTF(VT_RST);
PRINTF_RST();
return NULL;
}
@ -661,9 +661,9 @@ Gfx* SkelAnime_DrawFlex(PlayState* play, void** skeleton, Vec3s* jointTable, s32
Mtx* mtx = GRAPH_ALLOC(play->state.gfxCtx, dListCount * sizeof(*mtx));
if (skeleton == NULL) {
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("Si2_draw2_SV():skelがNULLです。NULLを返します。\n", "Si2_draw2_SV(): skel is NULL. Returns NULL.\n"));
PRINTF(VT_RST);
PRINTF_RST();
return NULL;
}
@ -849,7 +849,7 @@ AnimTask* AnimTaskQueue_NewTask(AnimTaskQueue* animTaskQueue, s32 type) {
return task;
}
#if PLATFORM_N64
#if !PLATFORM_GC
#define LINK_ANIMATION_OFFSET(addr, offset) \
(((uintptr_t)_link_animetionSegmentRomStart) + SEGMENT_OFFSET(addr) + (offset))
#else
@ -1129,10 +1129,10 @@ void SkelAnime_InitLink(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeade
}
if ((skelAnime->jointTable == NULL) || (skelAnime->morphTable == NULL)) {
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("Skeleton_Info_Rom_SV_ct メモリアロケーションエラー\n",
"Skeleton_Info_Rom_SV_ct Memory allocation error\n"));
PRINTF(VT_RST);
PRINTF_RST();
}
LinkAnimation_Change(play, skelAnime, animation, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f);
@ -1443,9 +1443,9 @@ BAD_RETURN(s32) SkelAnime_Init(PlayState* play, SkelAnime* skelAnime, SkeletonHe
skelAnime->morphTable = morphTable;
}
if ((skelAnime->jointTable == NULL) || (skelAnime->morphTable == NULL)) {
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("Skeleton_Info2_ct メモリアロケーションエラー\n", "Skeleton_Info2_ct Memory allocation error\n"));
PRINTF(VT_RST);
PRINTF_RST();
}
if (animation != NULL) {
@ -1476,10 +1476,10 @@ BAD_RETURN(s32) SkelAnime_InitFlex(PlayState* play, SkelAnime* skelAnime, FlexSk
skelAnime->morphTable = morphTable;
}
if ((skelAnime->jointTable == NULL) || (skelAnime->morphTable == NULL)) {
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("Skeleton_Info_Rom_SV_ct メモリアロケーションエラー\n",
"Skeleton_Info_Rom_SV_ct Memory allocation error\n"));
PRINTF(VT_RST);
PRINTF_RST();
}
if (animation != NULL) {
@ -1501,10 +1501,10 @@ BAD_RETURN(s32) SkelAnime_InitSkin(PlayState* play, SkelAnime* skelAnime, Skelet
skelAnime->morphTable =
ZELDA_ARENA_MALLOC(skelAnime->limbCount * sizeof(*skelAnime->morphTable), "../z_skelanime.c", 3121);
if ((skelAnime->jointTable == NULL) || (skelAnime->morphTable == NULL)) {
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("Skeleton_Info2_skin2_ct メモリアロケーションエラー\n",
"Skeleton_Info2_skin2_ct Memory allocation error\n"));
PRINTF(VT_RST);
PRINTF_RST();
}
if (animation != NULL) {

View file

@ -252,10 +252,10 @@ s32 SkinMatrix_Invert(MtxF* src, MtxF* dest) {
// Reaching row = 4 means the column is either all 0 or a duplicate column.
// Therefore src is a singular matrix (0 determinant).
PRINTF(VT_COL(YELLOW, BLACK));
PRINTF_COLOR_WARNING();
PRINTF(T("Skin_Matrix_InverseMatrix():逆行列つくれません\n",
"Skin_Matrix_InverseMatrix(): Cannot create inverse matrix\n"));
PRINTF(VT_RST);
PRINTF_RST();
return 2;
}

View file

@ -17,6 +17,30 @@
#define SLOT_OFFSET(index) (SRAM_HEADER_SIZE + 0x10 + (index * SLOT_SIZE))
#if !PLATFORM_IQUE
#define SRAM_READ(addr, dramAddr, size) SsSram_ReadWrite(addr, dramAddr, size, OS_READ)
#define SRAM_WRITE(addr, dramAddr, size) SsSram_ReadWrite(addr, dramAddr, size, OS_WRITE)
#else
void Sram_ReadWriteIQue(s32 addr, void* dramAddr, size_t size, s32 direction) {
void* sramAddr;
addr -= OS_K1_TO_PHYSICAL(0xA8000000);
sramAddr = (void*)(__osBbSramAddress + addr);
if (direction == OS_READ) {
bcopy(sramAddr, dramAddr, size);
} else if (direction == OS_WRITE) {
bcopy(dramAddr, sramAddr, size);
}
}
#define SRAM_READ(addr, dramAddr, size) Sram_ReadWriteIQue(addr, dramAddr, size, OS_READ)
#define SRAM_WRITE(addr, dramAddr, size) Sram_ReadWriteIQue(addr, dramAddr, size, OS_WRITE)
#endif
u16 gSramSlotOffsets[] = {
SLOT_OFFSET(0),
SLOT_OFFSET(1),
@ -27,7 +51,23 @@ u16 gSramSlotOffsets[] = {
SLOT_OFFSET(5),
};
static char sZeldaMagic[] = { '\0', '\0', '\0', '\x98', '\x09', '\x10', '\x21', 'Z', 'E', 'L', 'D', 'A' };
static u8 sSramDefaultHeader[] = {
// TODO: use enums for these
0, // SRAM_HEADER_SOUND
0, // SRAM_HEADER_ZTARGET
0, // SRAM_HEADER_LANGUAGE
// SRAM_HEADER_MAGIC
0x98,
0x09,
0x10,
0x21,
'Z',
'E',
'L',
'D',
'A',
};
static SavePlayerData sNewSavePlayerData = {
{ '\0', '\0', '\0', '\0', '\0', '\0' }, // newf
@ -138,15 +178,13 @@ static Inventory sNewSaveInventory = {
0, // gsTokens
};
static u16 sNewSaveChecksum = 0;
static Checksum sNewSaveChecksum = { 0 };
/**
* Initialize new save.
* This save has an empty inventory with 3 hearts and single magic.
*/
void Sram_InitNewSave(void) {
SaveContext* temp = &gSaveContext;
bzero(&gSaveContext.save.info, sizeof(SaveInfo));
gSaveContext.save.totalDays = 0;
gSaveContext.save.bgsDayCount = 0;
@ -154,8 +192,8 @@ void Sram_InitNewSave(void) {
gSaveContext.save.info.playerData = sNewSavePlayerData;
gSaveContext.save.info.equips = sNewSaveEquips;
gSaveContext.save.info.inventory = sNewSaveInventory;
gSaveContext.save.info.checksum = sNewSaveChecksum;
temp->save.info.checksum = sNewSaveChecksum;
gSaveContext.save.info.horseData.sceneId = SCENE_HYRULE_FIELD;
gSaveContext.save.info.horseData.pos.x = -1840;
gSaveContext.save.info.horseData.pos.y = 72;
@ -297,7 +335,7 @@ static Inventory sDebugSaveInventory = {
0, // gsTokens
};
static u16 sDebugSaveChecksum = 0;
static Checksum sDebugSaveChecksum = { 0 };
/**
* Initialize debug save. This is also used on the Title Screen
@ -309,8 +347,6 @@ static u16 sDebugSaveChecksum = 0;
* and set water level in Water Temple to lowest level.
*/
void Sram_InitDebugSave(void) {
SaveContext* temp = &gSaveContext;
bzero(&gSaveContext.save.info, sizeof(SaveInfo));
gSaveContext.save.totalDays = 0;
gSaveContext.save.bgsDayCount = 0;
@ -318,8 +354,8 @@ void Sram_InitDebugSave(void) {
gSaveContext.save.info.playerData = sDebugSavePlayerData;
gSaveContext.save.info.equips = sDebugSaveEquips;
gSaveContext.save.info.inventory = sDebugSaveInventory;
gSaveContext.save.info.checksum = sDebugSaveChecksum;
temp->save.info.checksum = sDebugSaveChecksum;
gSaveContext.save.info.horseData.sceneId = SCENE_HYRULE_FIELD;
gSaveContext.save.info.horseData.pos.x = -1840;
gSaveContext.save.info.horseData.pos.y = 72;
@ -392,7 +428,7 @@ void Sram_OpenSave(SramContext* sramCtx) {
MemCpy(&gSaveContext, sramCtx->readBuff + i, sizeof(Save));
PRINTF(VT_FGCOL(YELLOW));
PRINTF_COLOR_YELLOW();
PRINTF("SCENE_DATA_ID = %d SceneNo = %d\n", gSaveContext.save.info.playerData.savedSceneId,
((void)0, gSaveContext.save.entranceIndex));
@ -456,8 +492,11 @@ void Sram_OpenSave(SramContext* sramCtx) {
default:
if (gSaveContext.save.info.playerData.savedSceneId != SCENE_LINKS_HOUSE) {
gSaveContext.save.entranceIndex =
(LINK_AGE_IN_YEARS == YEARS_CHILD) ? ENTR_LINKS_HOUSE_0 : ENTR_TEMPLE_OF_TIME_7;
if (LINK_AGE_IN_YEARS == YEARS_CHILD) {
gSaveContext.save.entranceIndex = ENTR_LINKS_HOUSE_0;
} else {
gSaveContext.save.entranceIndex = ENTR_TEMPLE_OF_TIME_7;
}
} else {
gSaveContext.save.entranceIndex = ENTR_LINKS_HOUSE_0;
}
@ -465,14 +504,14 @@ void Sram_OpenSave(SramContext* sramCtx) {
}
PRINTF("scene_no = %d\n", gSaveContext.save.entranceIndex);
PRINTF(VT_RST);
PRINTF_RST();
if (gSaveContext.save.info.playerData.health < 0x30) {
gSaveContext.save.info.playerData.health = 0x30;
}
if (gSaveContext.save.info.scarecrowLongSongSet) {
PRINTF(VT_FGCOL(BLUE));
PRINTF_COLOR_BLUE();
PRINTF("\n====================================================================\n");
MemCpy(gScarecrowLongSongPtr, gSaveContext.save.info.scarecrowLongSong,
@ -484,11 +523,11 @@ void Sram_OpenSave(SramContext* sramCtx) {
}
PRINTF("\n====================================================================\n");
PRINTF(VT_RST);
PRINTF_RST();
}
if (gSaveContext.save.info.scarecrowSpawnSongSet) {
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
PRINTF("\n====================================================================\n");
MemCpy(gScarecrowSpawnSongPtr, gSaveContext.save.info.scarecrowSpawnSong,
@ -500,12 +539,13 @@ void Sram_OpenSave(SramContext* sramCtx) {
}
PRINTF("\n====================================================================\n");
PRINTF(VT_RST);
PRINTF_RST();
}
// if zelda cutscene has been watched but lullaby was not obtained, restore cutscene and take away letter
if (GET_EVENTCHKINF(EVENTCHKINF_40) && !CHECK_QUEST_ITEM(QUEST_SONG_LULLABY)) {
i = gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_40] & ~EVENTCHKINF_MASK(EVENTCHKINF_40);
i = gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_40];
i &= ~EVENTCHKINF_MASK(EVENTCHKINF_40);
gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_40] = i;
INV_CONTENT(ITEM_ZELDAS_LETTER) = ITEM_CHICKEN;
@ -551,7 +591,7 @@ void Sram_WriteSave(SramContext* sramCtx) {
u16 j;
u16* ptr;
gSaveContext.save.info.checksum = 0;
gSaveContext.save.info.checksum.value = 0;
ptr = (u16*)&gSaveContext;
checksum = j = 0;
@ -563,7 +603,7 @@ void Sram_WriteSave(SramContext* sramCtx) {
checksum += *ptr++;
}
gSaveContext.save.info.checksum = checksum;
gSaveContext.save.info.checksum.value = checksum;
ptr = (u16*)&gSaveContext;
checksum = 0;
@ -576,7 +616,7 @@ void Sram_WriteSave(SramContext* sramCtx) {
}
offset = gSramSlotOffsets[gSaveContext.fileNum];
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000) + offset, &gSaveContext, SLOT_SIZE, OS_WRITE);
SRAM_WRITE(OS_K1_TO_PHYSICAL(0xA8000000) + offset, &gSaveContext, SLOT_SIZE);
ptr = (u16*)&gSaveContext;
checksum = 0;
@ -589,7 +629,7 @@ void Sram_WriteSave(SramContext* sramCtx) {
}
offset = gSramSlotOffsets[gSaveContext.fileNum + 3];
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000) + offset, &gSaveContext, SLOT_SIZE, OS_WRITE);
SRAM_WRITE(OS_K1_TO_PHYSICAL(0xA8000000) + offset, &gSaveContext, SLOT_SIZE);
}
/**
@ -610,7 +650,7 @@ void Sram_VerifyAndLoadAllSaves(FileSelectState* fileSelect, SramContext* sramCt
PRINTF(" START─LOAD\n");
bzero(sramCtx->readBuff, SRAM_SIZE);
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_READ);
SRAM_READ(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE);
dayTime = ((void)0, gSaveContext.save.dayTime);
@ -620,8 +660,8 @@ void Sram_VerifyAndLoadAllSaves(FileSelectState* fileSelect, SramContext* sramCt
sizeof(Save));
MemCpy(&gSaveContext, sramCtx->readBuff + offset, sizeof(Save));
oldChecksum = gSaveContext.save.info.checksum;
gSaveContext.save.info.checksum = 0;
oldChecksum = gSaveContext.save.info.checksum.value;
gSaveContext.save.info.checksum.value = 0;
ptr = (u16*)&gSaveContext;
PRINTF("\n %d \n", slotNum);
@ -645,8 +685,8 @@ void Sram_VerifyAndLoadAllSaves(FileSelectState* fileSelect, SramContext* sramCt
offset = gSramSlotOffsets[slotNum + 3];
MemCpy(&gSaveContext, sramCtx->readBuff + offset, sizeof(Save));
oldChecksum = gSaveContext.save.info.checksum;
gSaveContext.save.info.checksum = 0;
oldChecksum = gSaveContext.save.info.checksum.value;
gSaveContext.save.info.checksum.value = 0;
ptr = (u16*)&gSaveContext;
PRINTF("================= BACK─UP ========================\n");
@ -710,32 +750,33 @@ void Sram_VerifyAndLoadAllSaves(FileSelectState* fileSelect, SramContext* sramCt
newChecksum += *ptr++;
}
gSaveContext.save.info.checksum = newChecksum;
PRINTF("\nCheck_Sum=%x(%x)\n", gSaveContext.save.info.checksum, newChecksum);
gSaveContext.save.info.checksum.value = newChecksum;
PRINTF("\nCheck_Sum=%x(%x)\n", gSaveContext.save.info.checksum.value, newChecksum);
i = gSramSlotOffsets[slotNum + 3];
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000) + i, &gSaveContext, SLOT_SIZE, OS_WRITE);
SRAM_WRITE(OS_K1_TO_PHYSICAL(0xA8000000) + i, &gSaveContext, SLOT_SIZE);
PRINTF("????#%x,%x,%x,%x,%x,%x\n", gSaveContext.save.info.playerData.newf[0],
//! @bug The ??= below is interpreted as a trigraph for # by IDO
PRINTF("??????=%x,%x,%x,%x,%x,%x\n", gSaveContext.save.info.playerData.newf[0],
gSaveContext.save.info.playerData.newf[1], gSaveContext.save.info.playerData.newf[2],
gSaveContext.save.info.playerData.newf[3], gSaveContext.save.info.playerData.newf[4],
gSaveContext.save.info.playerData.newf[5]);
PRINTF(T("\nぽいんと=%x(%d+3) check_sum=%x(%x)\n", "\npoints=%x(%d+3) check_sum=%x(%x)\n"), i,
slotNum, gSaveContext.save.info.checksum, newChecksum);
slotNum, gSaveContext.save.info.checksum.value, newChecksum);
}
i = gSramSlotOffsets[slotNum];
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000) + i, &gSaveContext, SLOT_SIZE, OS_WRITE);
SRAM_WRITE(OS_K1_TO_PHYSICAL(0xA8000000) + i, &gSaveContext, SLOT_SIZE);
PRINTF(T("ぽいんと=%x(%d) check_sum=%x(%x)\n", "point=%x(%d) check_sum=%x(%x)\n"), i, slotNum,
gSaveContext.save.info.checksum, newChecksum);
gSaveContext.save.info.checksum.value, newChecksum);
} else {
PRINTF(T("\nSAVEデータ \n", "\nSAVE data OK!!!!\n"));
}
}
bzero(sramCtx->readBuff, SRAM_SIZE);
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_READ);
SRAM_READ(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE);
gSaveContext.save.dayTime = dayTime;
PRINTF("SAVECT=%x, NAME=%x, LIFE=%x, ITEM=%x, 64DD=%x, HEART=%x\n", DEATHS, NAME, HEALTH_CAP, QUEST, N64DD,
@ -809,7 +850,14 @@ void Sram_InitSave(FileSelectState* fileSelect, SramContext* sramCtx) {
#endif
for (offset = 0; offset < 8; offset++) {
#if !PLATFORM_IQUE
gSaveContext.save.info.playerData.playerName[offset] = fileSelect->fileNames[fileSelect->buttonIndex][offset];
#else
// Workaround for EGCS internal compiler error (see docs/compilers.md)
u8* fileName = fileSelect->fileNames[fileSelect->buttonIndex];
gSaveContext.save.info.playerData.playerName[offset] = fileName[offset];
#endif
}
gSaveContext.save.info.playerData.newf[0] = 'Z';
@ -838,8 +886,8 @@ void Sram_InitSave(FileSelectState* fileSelect, SramContext* sramCtx) {
}
}
gSaveContext.save.info.checksum = checksum;
PRINTF(T("\nチェックサム=%x\n", "\nChecksum = %x\n"), gSaveContext.save.info.checksum);
gSaveContext.save.info.checksum.value = checksum;
PRINTF(T("\nチェックサム=%x\n", "\nChecksum = %x\n"), gSaveContext.save.info.checksum.value);
offset = gSramSlotOffsets[gSaveContext.fileNum];
PRINTF("I=%x no=%d\n", offset, gSaveContext.fileNum);
@ -849,7 +897,7 @@ void Sram_InitSave(FileSelectState* fileSelect, SramContext* sramCtx) {
PRINTF("I=%x no=%d\n", offset, gSaveContext.fileNum + 3);
MemCpy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save));
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_WRITE);
SRAM_WRITE(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE);
PRINTF(T("SAVE終了\n", "SAVE end\n"));
PRINTF("z_common_data.file_no = %d\n", gSaveContext.fileNum);
@ -879,26 +927,26 @@ void Sram_InitSave(FileSelectState* fileSelect, SramContext* sramCtx) {
}
void Sram_EraseSave(FileSelectState* fileSelect, SramContext* sramCtx) {
s32 offset;
u16 offset;
Sram_InitNewSave();
offset = gSramSlotOffsets[fileSelect->selectedFileIndex];
MemCpy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save));
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000) + offset, &gSaveContext, SLOT_SIZE, OS_WRITE);
SRAM_WRITE(OS_K1_TO_PHYSICAL(0xA8000000) + offset, &gSaveContext, SLOT_SIZE);
MemCpy(&fileSelect->n64ddFlags[fileSelect->selectedFileIndex], sramCtx->readBuff + offset + N64DD,
sizeof(fileSelect->n64ddFlags[0]));
offset = gSramSlotOffsets[fileSelect->selectedFileIndex + 3];
MemCpy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save));
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000) + offset, &gSaveContext, SLOT_SIZE, OS_WRITE);
SRAM_WRITE(OS_K1_TO_PHYSICAL(0xA8000000) + offset, &gSaveContext, SLOT_SIZE);
PRINTF(T("CLEAR終了\n", "CLEAR END\n"));
}
void Sram_CopySave(FileSelectState* fileSelect, SramContext* sramCtx) {
s32 offset;
u16 offset;
PRINTF("=%d(%x) =%d(%x)\n", fileSelect->selectedFileIndex,
gSramSlotOffsets[fileSelect->selectedFileIndex], fileSelect->copyDestFileIndex,
@ -913,7 +961,7 @@ void Sram_CopySave(FileSelectState* fileSelect, SramContext* sramCtx) {
offset = gSramSlotOffsets[fileSelect->copyDestFileIndex + 3];
MemCpy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save));
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_WRITE);
SRAM_WRITE(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE);
offset = gSramSlotOffsets[fileSelect->copyDestFileIndex];
@ -943,23 +991,23 @@ void Sram_CopySave(FileSelectState* fileSelect, SramContext* sramCtx) {
* Write the first 16 bytes of the read buffer to the SRAM header
*/
void Sram_WriteSramHeader(SramContext* sramCtx) {
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_HEADER_SIZE, OS_WRITE);
SRAM_WRITE(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_HEADER_SIZE);
}
void Sram_InitSram(GameState* gameState, SramContext* sramCtx) {
u16 i;
PRINTF("sram_initialize( Game *game, Sram *sram )\n");
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_READ);
SRAM_READ(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE);
for (i = 0; i < ARRAY_COUNTU(sZeldaMagic) - 3; i++) {
if (sZeldaMagic[i + SRAM_HEADER_MAGIC] != sramCtx->readBuff[i + SRAM_HEADER_MAGIC]) {
for (i = 0; i < ARRAY_COUNTU(sSramDefaultHeader) - SRAM_HEADER_MAGIC; i++) {
if (sSramDefaultHeader[i + SRAM_HEADER_MAGIC] != sramCtx->readBuff[i + SRAM_HEADER_MAGIC]) {
PRINTF(T("SRAM破壊!!!!!!\n", "SRAM destruction!!!!!!\n"));
#if PLATFORM_GC && OOT_PAL
gSaveContext.language = sramCtx->readBuff[SRAM_HEADER_LANGUAGE];
#endif
MemCpy(sramCtx->readBuff, sZeldaMagic, sizeof(sZeldaMagic));
MemCpy(sramCtx->readBuff, sSramDefaultHeader, sizeof(sSramDefaultHeader));
#if PLATFORM_GC && OOT_PAL
sramCtx->readBuff[SRAM_HEADER_LANGUAGE] = gSaveContext.language;
@ -986,18 +1034,18 @@ void Sram_InitSram(GameState* gameState, SramContext* sramCtx) {
for (i = 0; i < CHECKSUM_SIZE; i++) {
sramCtx->readBuff[i] = i;
}
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_WRITE);
SRAM_WRITE(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE);
PRINTF(T("SRAM破壊!!!!!!\n", "SRAM destruction!!!!!!\n"));
}
#endif
PRINTF(T(" サイズ=%d + %d %d\n", "GOOD! GOOD! Size = %d + %d = %d\n"), sizeof(SaveInfo), 4,
sizeof(SaveInfo) + 4);
PRINTF(VT_FGCOL(BLUE));
PRINTF_COLOR_BLUE();
PRINTF("Na_SetSoundOutputMode = %d\n", gSaveContext.audioSetting);
PRINTF("Na_SetSoundOutputMode = %d\n", gSaveContext.audioSetting);
PRINTF("Na_SetSoundOutputMode = %d\n", gSaveContext.audioSetting);
PRINTF(VT_RST);
PRINTF_RST();
func_800F6700(gSaveContext.audioSetting);
}

View file

@ -647,11 +647,11 @@ s32 View_ErrorCheckEyePosition(f32 eyeX, f32 eyeY, f32 eyeZ) {
}
if (error != 0) {
PRINTF(VT_FGCOL(RED));
PRINTF_COLOR_RED();
PRINTF(T("eye が大きすぎます eye=[%8.3f %8.3f %8.3f] error=%d\n",
"eye is too large eye=[%8.3f %8.3f %8.3f] error=%d\n"),
eyeX, eyeY, eyeZ, error);
PRINTF(VT_RST);
PRINTF_RST();
}
return error;

View file

@ -1030,7 +1030,7 @@ void Skybox_Init(GameState* state, SkyboxContext* skyboxCtx, s16 skyboxId) {
// Precompute vertices and display lists for drawing the skybox
if (skyboxId != SKYBOX_NONE) {
PRINTF(VT_FGCOL(GREEN));
PRINTF_COLOR_GREEN();
if (skyboxCtx->drawType != SKYBOX_DRAW_128) {
skyboxCtx->dListBuf = GAME_STATE_ALLOC(state, 8 * 150 * sizeof(Gfx), "../z_vr_box.c", 1636);
@ -1056,6 +1056,6 @@ void Skybox_Init(GameState* state, SkyboxContext* skyboxCtx, s16 skyboxId) {
Skybox_Calculate128(skyboxCtx, 5); // compute 5 faces, excludes the bottom face
}
}
PRINTF(VT_RST);
PRINTF_RST();
}
}

View file

@ -3,8 +3,6 @@
#include "libc64/os_malloc.h"
#include "terminal.h"
#if !PLATFORM_N64
#define FILL_ALLOC_BLOCK_FLAG (1 << 0)
#define FILL_FREE_BLOCK_FLAG (1 << 1)
#define CHECK_FREE_BLOCK_FLAG (1 << 2)
@ -891,5 +889,3 @@ u8 ArenaImpl_GetAllocFailures(Arena* arena) {
return arena->allocFailures;
}
#endif
#endif

View file

@ -2,8 +2,6 @@
#include "fault.h"
#include "libc64/os_malloc.h"
#if PLATFORM_N64
#define NODE_MAGIC 0x7373
#define NODE_IS_VALID(node) ((node)->magic == NODE_MAGIC)
@ -470,5 +468,3 @@ s32 __osCheckArena(Arena* arena) {
u8 ArenaImpl_GetAllocFailures(Arena* arena) {
return arena->allocFailures;
}
#endif

2
src/libgcc/__cmpdi2.c Normal file
View file

@ -0,0 +1,2 @@
#define L_cmpdi2
#include "src/libgcc/libgcc2.inc.c"

View file

2
src/libgcc/__divdi3.c Normal file
View file

@ -0,0 +1,2 @@
#define L_divdi3
#include "src/libgcc/libgcc2.inc.c"

View file

2
src/libgcc/__fixdfdi.c Normal file
View file

@ -0,0 +1,2 @@
#define L_fixdfdi
#include "src/libgcc/libgcc2.inc.c"

View file

2
src/libgcc/__fixsfdi.c Normal file
View file

@ -0,0 +1,2 @@
#define L_fixsfdi
#include "src/libgcc/libgcc2.inc.c"

View file

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